{"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "lemma I_le_monomorphisms : I.{u} \u2264 monomorphisms _\n:= by thisIsWrongLemmaNameXYZ\nrintro _ _ _ \u27e8n\u27e9\n exact monomorphisms.infer_property _", "diagnostic": "[CompilationUnit(i_begin=0, i_end=60, messages=[Message(data='unknown tactic', pos=Position(line=2, column=7), pos_end=None, severity=, kind=None), Message(data='invalid use of explicit universe parameters, `I` is a local variable', pos=Position(line=1, column=27), pos_end=Position(line=1, column=28), severity=, kind=None), Message(data=\"Function expected at\\n monomorphisms\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n _\\n\\nHint: The identifier `monomorphisms` 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=35), pos_end=Position(line=1, column=50), severity=, kind=None), Message(data='unsolved goals\\nx\u271d\u00b9 : Sort u_1\\nI : x\u271d\u00b9\\nx\u271d : Sort u_2\\nmonomorphisms : x\u271d\\n\u22a2 sorry \u2264 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=60, i_end=142, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]", "mutation_kind": "rewrite_lemma_name_broken", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 2093, "declarations_count": 262, "diagnostics_count": 1, "duplicate_fingerprint": "80e187d0d4763887", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 596, "lean_code_chars": 137, "lean_code_ratio": 0.0655, "length_bucket": "short", "line_count": 15, "natural_language_chars": 1956, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplicialSet.CategoryWithFibrations).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma I_le_monomorphisms : I.{u} \u2264 monomorphisms _\n:= by thisIsWrongLemmaNameXYZ\nrintro _ _ _ \u27e8n\u27e9\n exact monomorphisms.infer_property _\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=60, messages=[Message(data='unknown tactic', pos=Position(line=2, column=7), pos_end=None, severity=, kind=None), Message(data='invalid use of explicit universe parameters, `I` is a local variable', pos=Position(line=1, column=27), pos_end=Position(line=1, column=28), severity=, kind=None), Message(data=\"Function expected at\\n monomorphisms\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n _\\n\\nHint: The identifier `monomorphisms` 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=35), pos_end=Position(line=1, column=50), severity=, kind=None), Message(data='unsolved goals\\nx\u271d\u00b9 : Sort u_1\\nI : x\u271d\u00b9\\nx\u271d : Sort u_2\\nmonomorphisms : x\u271d\\n\u22a2 sorry \u2264 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=60, i_end=142, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplicialSet.CategoryWithFibrations).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma I_le_monomorphisms : I.{u} \u2264 monomorphisms _\n:= by thisIsWrongLemmaNameXYZ\nrintro _ _ _ \u27e8n\u27e9\n exact monomorphisms.infer_property _\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=60, messages=[Message(data='unknown tactic', pos=Position(line=2, column=7), pos_end=None, severity=, kind=None), Message(data='invalid use of explicit universe parameters, `I` is a local variable', pos=Position(line=1, column=27), pos_end=Position(line=1, column=28), severity=, kind=None), Message(data=\"Function expected at\\n monomorphisms\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n _\\n\\nHint: The identifier `monomorphisms` 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=35), pos_end=Position(line=1, column=50), severity=, kind=None), Message(data='unsolved goals\\nx\u271d\u00b9 : Sort u_1\\nI : x\u271d\u00b9\\nx\u271d : Sort u_2\\nmonomorphisms : x\u271d\\n\u22a2 sorry \u2264 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=60, i_end=142, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "sample_id": "B-Mathlib.AlgebraicTopology.SimplicialSet.CategoryWithFibrations.I_le_monomorphisms", "source": {"declaration": "Mathlib.AlgebraicTopology.SimplicialSet.CategoryWithFibrations.I_le_monomorphisms", "file": "Mathlib/AlgebraicTopology/SimplicialSet/CategoryWithFibrations.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.SimplicialSet.CategoryWithFibrations", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/SimplicialSet/CategoryWithFibrations.lean#L54", "span": "L54-L57"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Tactic.FunProp.Decl.FunPropDeclsExt (L45-L57)\nabbrev FunPropDeclsExt := SimpleScopedEnvExtension FunPropDecl FunPropDecls\n/-- Extension storing function properties tracked and used by the `fun_prop` attribute and tactic,\nincluding, for example, `Continuous`, `Measurable`, `Differentiable`, etc. -/\ninitialize funPropDeclsExt : FunPropDeclsExt \u2190\n registerSimpleScopedEnvExtension {\n name := by exact decl_name%\n initial := {}\n addEntry := fun d e =>\n {d with decls := d.decls.insertKeyValue e.path e}\n }\n\n/-- Register new function property. -/", "-- Mathlib.Tactic.FunProp.Decl.addFunPropDecl (L58-L92)\ndef addFunPropDecl (declName : Name) : MetaM Unit := do\nlet info \u2190 getConstInfo declName\n\n let (xs, bi, b) \u2190 forallMetaTelescope info.type\n\n if \u00acb.isProp then\n throwError \"invalid fun_prop declaration, has to be `Prop`-valued function\"\n\n let lvls := info.levelParams.map (fun l => Level.param l)\n let e := mkAppN (.const declName lvls) xs\n let path \u2190 DiscrTree.mkPath e\n\n -- find the argument position of the function `f` in `P f`\n let mut some funArgId \u2190 (xs.zip bi).findIdxM? fun (x,bi) => do\n if (\u2190 inferType x).isForall && bi.isExplicit then\n return true\n else\n return false\n | throwError \"invalid fun_prop declaration, can't find argument of type `\u03b1 \u2192 \u03b2`\"\n\n let decl : FunPropDecl := {\n funPropName := declName\n path := path\n funArgId := funArgId\n }\n\n modifyEnv fun env => funPropDeclsExt.addEntry env decl\n\n trace[Meta.Tactic.fun_prop.attr]\n \"added new function property `{declName}`\\nlook up pattern is `{path}`\"\n\n\n/-- Is `e` a function property statement? If yes return function property declaration and\nthe function it talks about. -/", "-- Mathlib.Tactic.FunProp.Decl.getFunProp (L93-L111)\ndef getFunProp? (e : Expr) : MetaM (Option (FunPropDecl \u00d7 Expr)) := do\nlet ext := funPropDeclsExt.getState (\u2190 getEnv)\n\n let decls \u2190 ext.decls.getMatch e (\u2190 read)\n\n if h : decls.size = 0 then\n return none\n else\n if decls.size > 1 then\n throwError \"fun_prop bug: expression {\u2190 ppExpr e} matches multiple function properties\\n\\\n {decls.map (fun d => d.funPropName)}\"\n\n let decl := decls[0]\n unless decl.funArgId < e.getAppNumArgs do return none\n let f := e.getArg! decl.funArgId\n\n return (decl,f)\n\n/-- Is `e` a function property statement? -/", "-- Mathlib.Tactic.FunProp.Decl.isFunPropGoal (L115-L119)\ndef isFunPropGoal (e : Expr) : MetaM Bool := do\nforallTelescope e fun _ b =>\n return (\u2190 getFunProp? b).isSome\n\n/-- Returns function property declaration from `e = P f`. -/", "-- Mathlib.Tactic.FunProp.Decl.getFunPropDecl (L120-L126)\ndef getFunPropDecl? (e : Expr) : MetaM (Option FunPropDecl) := do\nmatch \u2190 getFunProp? e with\n | some (decl, _) => return decl\n | none => return none\n\n\n/-- Returns function `f` from `e = P f` and `P` is function property. -/", "-- Mathlib.Tactic.FunProp.Decl.getFunPropFun (L127-L134)\ndef getFunPropFun? (e : Expr) : MetaM (Option Expr) := do\nmatch \u2190 getFunProp? e with\n | some (_, f) => return f\n | none => return none\n\n\nopen Elab Term in\n/-- Turn tactic syntax into a discharger function. -/", "-- Mathlib.Tactic.FunProp.Decl.tacticToDischarge (L135-L160)\ndef tacticToDischarge (tacticCode : TSyntax `tactic) : Expr \u2192 MetaM (Option Expr) := fun e =>\nwithTraceNode `Meta.Tactic.fun_prop\n (fun _ => do pure s!\"discharging: {\u2190 ppExpr e}\") do\n let mvar \u2190 mkFreshExprSyntheticOpaqueMVar e `funProp.discharger\n let runTac? : TermElabM (Option Expr) :=\n try\n instantiateMVarDeclMVars mvar.mvarId!\n\n let _ \u2190\n withSynthesize (postpone := .no) do\n Tactic.run mvar.mvarId! (Tactic.evalTactic tacticCode *> Tactic.pruneSolvedGoals)\n\n let result \u2190 instantiateMVars mvar\n if result.hasExprMVar then\n return none\n else\n return some result\n catch _ =>\n return none\n let (result?, _) \u2190 runTac?.run {} {}\n\n return result?\n\nend Meta.FunProp\n\nend Mathlib", "-- Mathlib.Tactic.FunProp.Core.bvarAppCase (L389-L402)\ndef bvarAppCase (funPropDecl : FunPropDecl) (e : Expr) (fData : FunctionData)\n (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\nif (\u2190 fData.isMorApplication) != .none then\n applyMorRules funPropDecl e fData funProp\n else\n if let some (f, g) \u2190 fData.nontrivialDecomposition then\n applyCompRule funPropDecl e f g funProp\n else\n applyApplyRule funPropDecl e funProp\n\n/--\nGet candidate theorems from the environment for function property `funPropDecl` and\nfunction `funName`. -/", "-- Mathlib.Tactic.FunProp.FunctionData.getFunctionData (L77-L118)\ndef getFunctionData (f : Expr) : MetaM FunctionData := do\nlambdaTelescope f fun xs b => do\n\n let xId := xs[0]!.fvarId!\n\n Mor.withApp b fun fn args => do\n\n let mut fn := fn\n let mut args := args\n\n -- revert projection in fn\n if let .proj n i x := fn then\n let some info := getStructureInfo? (\u2190 getEnv) n | unreachable!\n let some projName := info.getProjFn? i | unreachable!\n let p \u2190 mkAppM projName #[x]\n fn := p.getAppFn\n args := p.getAppArgs.map (fun a => {expr:=a}) ++ args\n\n let mainArgs := args\n |>.mapIdx (fun i \u27e8arg,_\u27e9 => if arg.containsFVar xId then some i else none)\n |>.filterMap id\n\n return {\n lctx := \u2190 getLCtx\n insts := \u2190 getLocalInstances\n fn := fn\n args := args\n mainVar := xs[0]!\n mainArgs := mainArgs\n }\n\n/-- Result of `getFunctionData?`. It returns function data if the function is in the form\n`fun x \u21a6 f y\u2081 ... y\u2099`. Two other cases are `fun x \u21a6 let y := ...` or `fun x y \u21a6 ...` -/\ninductive MaybeFunctionData where\n /-- Can't generate function data as function body has let binder. -/\n | letE (f : Expr)\n /-- Can't generate function data as function body has lambda binder. -/\n | lam (f : Expr)\n /-- Function data has been successfully generated. -/\n | data (fData : FunctionData)\n\n/-- Turn `MaybeFunctionData` to the function. -/", "-- Mathlib.Tactic.FunProp.Core.applyCompRule (L231-L253)\ndef applyCompRule (funPropDecl : FunPropDecl) (e f g : Expr)\n (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\nlet thms \u2190 getLambdaTheorems funPropDecl.funPropName .comp\n if thms.size = 0 then\n let msg := s!\"missing composition rule to prove `{\u2190 ppExpr e}`\"\n logError msg\n trace[Meta.Tactic.fun_prop] msg\n return none\n\n for thm in thms do\n let .comp id_f id_g := thm.thmArgs | return none\n if let some r \u2190 tryTheoremWithHint? e (.decl thm.thmName) #[(id_f, f), (id_g, g)] funProp then\n return r\n\n return none\n\n/--\nTry to prove `e` using *pi lambda theorem*.\n\nFor example, `e = q(Continuous fun x y \u21a6 f x y)` and `funPropDecl` is `FunPropDecl` for\n`Continuous`\n-/", "-- Mathlib.Tactic.FunProp.Core.synthesizeArgs (L50-L106)\ndef synthesizeArgs (thmId : Origin) (xs : Array Expr)\n (funProp : Expr \u2192 FunPropM (Option Result)) :\n FunPropM Bool := do\nlet mut postponed : Array Expr := #[]\n for x in xs do\n let type \u2190 inferType x\n if (\u2190 instantiateMVars x).isMVar then\n\n -- try type class\n if (\u2190 isClass? type).isSome then\n if (\u2190 synthesizeInstance thmId x type) then\n continue\n else if (\u2190 isFunPropGoal type) then\n -- try function property\n if let some \u27e8proof\u27e9 \u2190 funProp type then\n if (\u2190 isDefEq x proof) then\n continue\n else do\n trace[Meta.Tactic.fun_prop]\n \"{\u2190 ppOrigin thmId}, failed to assign proof{indentExpr type}\"\n return false\n else\n -- try user provided discharger\n let ctx : Context \u2190 read\n if (\u2190 isProp type) then\n if let some proof \u2190 ctx.disch type then\n if (\u2190 isDefEq x proof) then\n continue\n else do\n trace[Meta.Tactic.fun_prop]\n \"{\u2190 ppOrigin thmId}, failed to assign proof{indentExpr type}\"\n return false\n else\n logError s!\"Failed to prove necessary assumption `{\u2190 ppExpr type}` \\\n when applying theorem `{\u2190 ppOrigin' thmId}`.\"\n\n if \u00ac(\u2190 isProp type) then\n postponed := postponed.push x\n continue\n else\n trace[Meta.Tactic.fun_prop]\n \"{\u2190 ppOrigin thmId}, failed to discharge hypotheses{indentExpr type}\"\n return false\n\n for x in postponed do\n if (\u2190 instantiateMVars x).isMVar then\n logError s!\"Failed to infer `({\u2190 ppExpr x} : {\u2190 ppExpr (\u2190 inferType x)})` \\\n when applying theorem `{\u2190 ppOrigin' thmId}`.\"\n\n trace[Meta.Tactic.fun_prop]\n \"{\u2190 ppOrigin thmId}, failed to infer `({\u2190 ppExpr x} : {\u2190 ppExpr (\u2190 inferType x)})`\"\n return false\n\n return true\n\n\n/-- Try to apply theorem - core function -/", "-- Mathlib.Tactic.FunProp.Core.cacheResult (L615-L619)\ndef cacheResult (e : Expr) (r : Result) : FunPropM Result := do -- return proof?\nmodify (fun s => { s with cache := s.cache.insert e { expr := q(True), proof? := r.proof} })\n return r\n\n/-- Cache for failed goals such that `fun_prop` can fail fast next time. -/", "-- Mathlib.Tactic.FunProp.Core.letCase (L279-L320)\ndef letCase (funPropDecl : FunPropDecl) (e : Expr) (f : Expr)\n (funProp : Expr \u2192 FunPropM (Option Result)) :\n FunPropM (Option Result) := do\nmatch f with\n | .lam xName xType (.letE yName yType yValue yBody _) xBi => do\n let yType := yType.consumeMData\n let yValue := yValue.consumeMData\n let yBody := yBody.consumeMData\n -- We perform reduction because the type is quite often of the form\n -- `(fun x \u21a6 Y) #0` which is just `Y`\n -- Usually this is caused by the usage of `FunLike`\n let yType := yType.headBeta\n if (yType.hasLooseBVar 0) then\n throwError \"dependent type encountered {\u2190 ppExpr (Expr.forallE xName xType yType default)}\"\n\n -- let binding can be pulled out of the lambda function\n if \u00ac(yValue.hasLooseBVar 0) then\n let body := yBody.swapBVars 0 1\n let e' := mkLet yName yType yValue\n (e.setArg (funPropDecl.funArgId) (.lam xName xType body xBi))\n return \u2190 funProp e'\n\n match (yBody.hasLooseBVar 0), (yBody.hasLooseBVar 1) with\n | true, true =>\n let f \u2190 mkUncurryFun 2 (Expr.lam xName xType (.lam yName yType yBody default) xBi)\n let g := Expr.lam xName xType (binderInfo := default)\n (mkAppN (\u2190 mkConstWithFreshMVarLevels ``Prod.mk) #[xType,yType,.bvar 0, yValue])\n applyCompRule funPropDecl e f g funProp\n\n | true, false =>\n let f := Expr.lam yName yType yBody default\n let g := Expr.lam xName xType yValue default\n applyCompRule funPropDecl e f g funProp\n\n | false, _ =>\n let f := Expr.lam xName xType (yBody.lowerLooseBVars 1 1) xBi\n funProp (e.setArg (funPropDecl.funArgId) f)\n\n | _ => throwError \"expected expression of the form `fun x \u21a6 lam y := ..; ..`\"\n\n\n/-- Prove function property of using *morphism theorems*. -/", "-- Mathlib.Tactic.FunProp.Core.getDeclTheorems (L403-L422)\ndef getDeclTheorems (funPropDecl : FunPropDecl) (funName : Name)\n (mainArgs : Array Nat) (appliedArgs : Nat) : MetaM (Array FunctionTheorem) := do\nlet thms \u2190 getTheoremsForFunction funName funPropDecl.funPropName\n\n let thms := thms\n |>.filter (fun thm => (isOrderedSubsetOf mainArgs thm.mainArgs))\n |>.qsort (fun t s =>\n let dt := (Int.ofNat t.appliedArgs - Int.ofNat appliedArgs).natAbs\n let ds := (Int.ofNat s.appliedArgs - Int.ofNat appliedArgs).natAbs\n match compare dt ds with\n | .lt => true\n | .gt => false\n | .eq => t.mainArgs.size < s.mainArgs.size)\n -- todo: sorting and filtering\n return thms\n\n/--\nGet candidate theorems from the local context for function property `funPropDecl` and\nfunction `funName`. -/", "-- Mathlib.Tactic.FunProp.Core.applyMorRules (L321-L346)\ndef applyMorRules (funPropDecl : FunPropDecl) (e : Expr) (fData : FunctionData)\n (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\ntrace[Debug.Meta.Tactic.fun_prop] \"applying morphism theorems to {\u2190 ppExpr e}\"\n\n match \u2190 fData.isMorApplication with\n | .none => throwError \"fun_prop bug: invalid use of mor rules on {\u2190 ppExpr e}\"\n | .underApplied =>\n applyPiRule funPropDecl e funProp\n | .overApplied =>\n let some (f, g) \u2190 fData.peeloffArgDecomposition | return none\n applyCompRule funPropDecl e f g funProp\n | .exact =>\n\n let candidates \u2190 getMorphismTheorems e\n\n trace[Meta.Tactic.fun_prop]\n \"candidate morphism theorems: {\u2190 candidates.mapM fun c => ppOrigin (.decl c.thmName)}\"\n\n for c in candidates do\n if let some r \u2190 tryTheorem? e (.decl c.thmName) funProp then\n return r\n\n trace[Debug.Meta.Tactic.fun_prop] \"no theorem matched\"\n return none\n\n/-- Prove function property of using *transition theorems*. -/", "-- Mathlib.Tactic.FunProp.Core.constAppCase (L565-L614)\ndef constAppCase (funPropDecl : FunPropDecl) (e : Expr) (fData : FunctionData)\n (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\nlet some (funName, _) := fData.fn.const?\n | throwError \"fun_prop bug: invelid use of const app case\"\n let globalThms \u2190 getDeclTheorems funPropDecl funName fData.mainArgs fData.args.size\n\n trace[Meta.Tactic.fun_prop]\n s!\"candidate theorems for {funName} {\u2190 globalThms.mapM fun thm => ppOrigin' thm.thmOrigin}\"\n\n if let some r \u2190 tryTheorems funPropDecl e fData globalThms funProp then\n return r\n\n -- Try local theorems - this is useful for recursive functions\n let localThms \u2190 getLocalTheorems funPropDecl (.decl funName) fData.mainArgs fData.args.size\n if localThms.size \u2260 0 then\n trace[Meta.Tactic.fun_prop]\n s!\"candidate local theorems for {funName} \\\n {\u2190 localThms.mapM fun thm => ppOrigin' thm.thmOrigin}\"\n if let some r \u2190 tryTheorems funPropDecl e fData localThms funProp then\n return r\n\n -- log error if no global or local theorems were found\n if globalThms.size = 0 && localThms.size = 0 then\n logError s!\"No theorems found for `{funName}` in order to prove `{\u2190 ppExpr e}`\"\n\n if (\u2190 fData.isMorApplication) != .none then\n if let some r \u2190 applyMorRules funPropDecl e fData funProp then\n return r\n\n if let some (f, g) \u2190 fData.nontrivialDecomposition then\n trace[Meta.Tactic.fun_prop]\n s!\"failed applying `{funPropDecl.funPropName}` theorems for `{funName}`\n trying again after decomposing function as: `({\u2190 ppExpr f}) \u2218 ({\u2190 ppExpr g})`\"\n\n if let some r \u2190 applyCompRule funPropDecl e f g funProp then\n return r\n else\n trace[Meta.Tactic.fun_prop]\n s!\"failed applying `{funPropDecl.funPropName}` theorems for `{funName}`\n now trying to prove `{funPropDecl.funPropName}` from another function property\"\n\n if let some r \u2190 applyTransitionRules e funProp then\n return r\n\n\n return none\n\n\n/-- Cache result if it does not have any subgoals. -/", "-- Mathlib.Tactic.FunProp.Core.applyApplyRule (L215-L230)\ndef applyApplyRule (funPropDecl : FunPropDecl) (e : Expr)\n (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\nlet thms := (\u2190 getLambdaTheorems funPropDecl.funPropName .apply)\n for thm in thms do\n if let some r \u2190 tryTheoremWithHint? e (.decl thm.thmName) #[] funProp then\n return r\n\n return none\n\n/--\nTry to prove `e` using *composition lambda theorem*.\n\nFor example, `e = q(Continuous fun x \u21a6 f (g x))` and `funPropDecl` is `FunPropDecl` for\n`Continuous`\n\nYou also have to provide the functions `f` and `g`. -/", "-- Mathlib.Tactic.FunProp.Core.applyIdRule (L175-L194)\ndef applyIdRule (funPropDecl : FunPropDecl) (e : Expr)\n (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\nlet thms \u2190 getLambdaTheorems funPropDecl.funPropName .id\n if thms.size = 0 then\n let msg := s!\"missing identity rule to prove `{\u2190 ppExpr e}`\"\n logError msg\n trace[Meta.Tactic.fun_prop] msg\n return none\n\n for thm in thms do\n if let some r \u2190 tryTheoremWithHint? e (.decl thm.thmName) #[] funProp then\n return r\n\n return none\n\n/--\nTry to prove `e` using the *constant lambda theorem*.\n\nFor example, `e = q(Continuous fun x \u21a6 y)` and `funPropDecl` is `FunPropDecl` for `Continuous`.\n-/", "-- Mathlib.Tactic.FunProp.Core.getLocalTheorems (L423-L473)\ndef getLocalTheorems (funPropDecl : FunPropDecl) (funOrigin : Origin)\n (mainArgs : Array Nat) (appliedArgs : Nat) : FunPropM (Array FunctionTheorem) := do\nlet mut thms : Array FunctionTheorem := #[]\n let lctx \u2190 getLCtx\n for var in lctx do\n if (var.kind = Lean.LocalDeclKind.auxDecl) then\n continue\n let type \u2190 instantiateMVars var.type\n let thm? : Option FunctionTheorem \u2190\n forallTelescope type fun _ b => do\n let b \u2190 whnfR b\n let some (decl, f) \u2190 getFunProp? b | return none\n unless decl.funPropName = funPropDecl.funPropName do return none\n\n let .data fData \u2190 getFunctionData? f (\u2190 unfoldNamePred)\n | return none\n unless (fData.getFnOrigin == funOrigin) do return none\n\n unless isOrderedSubsetOf mainArgs fData.mainArgs do return none\n\n let dec? \u2190 fData.nontrivialDecomposition\n\n let thm : FunctionTheorem := {\n funPropName := funPropDecl.funPropName\n thmOrigin := .fvar var.fvarId\n funOrigin := funOrigin\n mainArgs := fData.mainArgs\n appliedArgs := fData.args.size\n priority := eval_prio default\n form := if dec?.isSome then .comp else .uncurried\n }\n\n return some thm\n\n if let some thm := thm? then\n thms := thms.push thm\n\n thms := thms\n |>.qsort (fun t s =>\n let dt := (Int.ofNat t.appliedArgs - Int.ofNat appliedArgs).natAbs\n let ds := (Int.ofNat s.appliedArgs - Int.ofNat appliedArgs).natAbs\n match compare dt ds with\n | .lt => true\n | .gt => false\n | .eq => t.mainArgs.size < s.mainArgs.size)\n\n return thms\n\n\n/-- Try to apply *function theorems* `thms` to `e`. -/", "-- Mathlib.Tactic.FunProp.Core.tryTheoremCore (L107-L124)\ndef tryTheoremCore (xs : Array Expr) (val : Expr) (type : Expr) (e : Expr)\n (thmId : Origin) (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\nwithTraceNode `Meta.Tactic.fun_prop\n (fun _ => return s!\"applying: {\u2190 ppOrigin' thmId}\") do\n\n if (\u2190 isDefEq type e) then\n\n if \u00ac(\u2190 synthesizeArgs thmId xs funProp) then\n return none\n let proof \u2190 instantiateMVars (mkAppN val xs)\n\n return some { proof := proof }\n else\n trace[Meta.Tactic.fun_prop] \"failed to unify {\u2190 ppOrigin thmId}\\n{type}\\nwith\\n{e}\"\n return none\n\n\n/-- Try to apply a theorem provided some of the theorem arguments. -/", "-- Mathlib.Tactic.FunProp.Core.applyPiRule (L254-L278)\ndef applyPiRule (funPropDecl : FunPropDecl) (e : Expr)\n (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\nlet thms \u2190 getLambdaTheorems funPropDecl.funPropName .pi\n if thms.size = 0 then\n let msg := s!\"missing pi rule to prove `{\u2190 ppExpr e}`\"\n logError msg\n trace[Meta.Tactic.fun_prop] msg\n return none\n\n for thm in thms do\n if let some r \u2190 tryTheoremWithHint? e (.decl thm.thmName) #[] funProp then\n return r\n\n return none\n\n\n/--\nTry to prove `e = q(P (fun x \u21a6 let y := \u03c6 x; \u03c8 x y)`.\n\nFor example,\n - `funPropDecl` is `FunPropDecl` for `Continuous`\n - `e = q(Continuous fun x \u21a6 let y := \u03c6 x; \u03c8 x y)`\n - `f = q(fun x \u21a6 let y := \u03c6 x; \u03c8 x y)`\n-/", "-- Mathlib.Tactic.FunProp.Core.applyTransitionRules (L347-L370)\ndef applyTransitionRules (e : Expr) (funProp : Expr \u2192 FunPropM (Option Result)) :\n FunPropM (Option Result) := do\nwithIncreasedTransitionDepth do\n\n let candidates \u2190 getTransitionTheorems e\n\n trace[Meta.Tactic.fun_prop]\n \"candidate transition theorems: {\u2190 candidates.mapM fun c => ppOrigin (.decl c.thmName)}\"\n\n for c in candidates do\n if let some r \u2190 tryTheorem? e (.decl c.thmName) funProp then\n return r\n\n trace[Debug.Meta.Tactic.fun_prop] \"no theorem matched\"\n return none\n\n/-- Try to remove applied argument i.e. prove `P (fun x \u21a6 f x y)` from `P (fun x \u21a6 f x)`.\n\nFor example\n - `funPropDecl` is `FunPropDecl` for `Continuous`\n - `e = q(Continuous fun x \u21a6 foo (bar x) y)`\n - `fData` contains info on `fun x \u21a6 foo (bar x) y`\n This tries to prove `Continuous fun x \u21a6 foo (bar x) y` from `Continuous fun x \u21a6 foo (bar x)`\n-/", "-- Mathlib.Tactic.FunProp.Core.synthesizeInstance (L31-L49)\ndef synthesizeInstance (thmId : Origin) (x type : Expr) : MetaM Bool := do\nmatch (\u2190 trySynthInstance type) with\n | .some val =>\n if (\u2190 withReducibleAndInstances <| isDefEq x val) then\n return true\n else\n trace[Meta.Tactic.fun_prop]\n\"{\u2190 ppOrigin thmId}, failed to assign instance{indentExpr type}\nsynthesized value{indentExpr val}\\nis not definitionally equal to{indentExpr x}\"\n return false\n | _ =>\n trace[Meta.Tactic.fun_prop]\n \"{\u2190 ppOrigin thmId}, failed to synthesize instance{indentExpr type}\"\n return false\n\n\n\n/-- Synthesize arguments `xs` either with typeclass synthesis, with `fun_prop` or with\ndischarger. -/", "-- Mathlib.Tactic.FunProp.FunctionData.FunctionData (L44-L49)\ndef FunctionData.toExpr (f : FunctionData) : MetaM Expr := do\nwithLCtx f.lctx f.insts do\n let body := Mor.mkAppN f.fn f.args\n mkLambdaFVars #[f.mainVar] body\n\n/-- Is `f` an identity function? -/", "-- Mathlib.Tactic.FunProp.Core.fvarAppCase (L529-L564)\ndef fvarAppCase (funPropDecl : FunPropDecl) (e : Expr) (fData : FunctionData)\n (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\n-- fvar theorems are almost exclusively in uncurried form so we decompose if we can\n if let some (f, g) \u2190 fData.nontrivialDecomposition then\n applyCompRule funPropDecl e f g funProp\n else\n let .fvar id := fData.fn | throwError \"fun_prop bug: invalid use of fvar app case\"\n let thms \u2190 getLocalTheorems funPropDecl (.fvar id) fData.mainArgs fData.args.size\n trace[Meta.Tactic.fun_prop]\n s!\"candidate local theorems for {\u2190ppExpr (.fvar id)} \\\n {\u2190 thms.mapM fun thm => ppOrigin' thm.thmOrigin}\"\n\n if let some r \u2190 tryTheorems funPropDecl e fData thms funProp then\n return r\n\n if let some f \u2190 fData.unfoldHeadFVar? then\n let e' := e.setArg funPropDecl.funArgId f\n if let some r \u2190 funProp e' then\n return r\n\n if (\u2190 fData.isMorApplication) != .none then\n if let some r \u2190 applyMorRules funPropDecl e fData funProp then\n return r\n\n if (\u2190 fData.nontrivialDecomposition).isNone then\n if let some r \u2190 applyTransitionRules e funProp then\n return r\n\n if thms.size = 0 then\n logError s!\"No theorems found for `{\u2190 ppExpr (.fvar id)}` in order to prove `{\u2190 ppExpr e}`\"\n\n return none\n\n\n/-- Prove function property of `fun x \u21a6 f x\u2081 ... x\u2099` where `f` is declared function. -/", "-- Mathlib.Tactic.FunProp.Core.tryTheoremWithHint (L125-L164)\ndef tryTheoremWithHint? (e : Expr) (thmOrigin : Origin)\n (hint : Array (Nat \u00d7 Expr))\n (funProp : Expr \u2192 FunPropM (Option Result)) (newMCtxDepth : Bool := false) :\nFunPropM (Option Result) := do\n let go : FunPropM (Option Result) := do\n let thmProof \u2190 thmOrigin.getValue\n -- for `fvar`s we need to instantiate the metavariables of its type.\n let type \u2190 instantiateMVars <| \u2190 inferType thmProof\n let (xs, _, type) \u2190 forallMetaTelescope type\n\n for (i,x) in hint do\n try\n for (id,v) in hint do\n xs[id]!.mvarId!.assignIfDefEq v\n catch _ =>\n trace[Debug.Meta.Tactic.fun_prop]\n \"failed to use hint {i} `{\u2190 ppExpr x} when applying theorem {\u2190 ppOrigin thmOrigin}\"\n\n tryTheoremCore xs thmProof type e thmOrigin funProp\n\n -- `simp` introduces new meta variable context depth for some reason\n -- This is probably to avoid mvar assignment when trying a theorem fails\n --\n -- However, in `fun_prop` case this is not completely desirable\n -- For example, I want to be able to solve a goal with mvars like `ContDiff \u211d ?n f` using local\n -- hypothesis `(h : ContDiff \u211d \u221e f)` and assign `\u221e` to the mvar `?n`.\n --\n -- This could be problematic if there are two local hypothesis `(hinf : ContDiff \u211d \u221e f)` and\n -- `(h1 : ContDiff \u211d 1 f)` and apart from solving `ContDiff \u211d ?n f` there is also a subgoal\n -- `2 \u2264 ?n`. If `fun_prop` decides to try `h1` first it would assign `1` to `?n` and then there\n -- is no hope solving `2 \u2264 1` and it won't be able to apply `hinf` after trying `h1` as `n?` is\n -- assigned already. Ideally `fun_prop` would roll back the `MetaM.State`. This issue did not\n -- come up yet so I didn't bother and I'm worried about the performance impact.\n if newMCtxDepth then\n withNewMCtxDepth go\n else\n go\n\n\n/-- Try to apply a theorem `thmOrigin` to the goal `e`. -/", "-- Mathlib.Tactic.FunProp.Core.tryTheorem (L165-L174)\ndef tryTheorem? (e : Expr) (thmOrigin : Origin) (funProp : Expr \u2192 FunPropM (Option Result))\n (newMCtxDepth : Bool := false) : FunPropM (Option Result) :=\ntryTheoremWithHint? e thmOrigin #[] funProp newMCtxDepth\n\n\n/--\nTry to prove `e` using the *identity lambda theorem*.\n\nFor example, `e = q(Continuous fun x \u21a6 x)` and `funPropDecl` is `FunPropDecl` for `Continuous`.\n-/", "-- Mathlib.Tactic.FunProp.Core.cacheFailure (L620-L702)\ndef cacheFailure (e : Expr) : FunPropM Unit := do -- return proof?\nmodify (fun s => { s with failureCache := s.failureCache.insert e })\n\n\nmutual\n /-- Main `funProp` function. Returns proof of `e`. -/\n partial def funProp (e : Expr) : FunPropM (Option Result) := do\n\n let e \u2190 instantiateMVars e\n\n withTraceNode `Meta.Tactic.fun_prop\n (fun _ => do pure s!\"{\u2190 ppExpr e}\") do\n\n -- check cache for successful goals\n if let some { expr := _, proof? := some proof } := (\u2190 get).cache.find? e then\n trace[Meta.Tactic.fun_prop] \"reusing previously found proof for {e}\"\n return some { proof := proof }\n else if (\u2190 get).failureCache.contains e then\n trace[Meta.Tactic.fun_prop] \"skipping proof search, proving {e} was tried already and failed\"\n return none\n else\n -- take care of forall and let binders and run main\n match e with\n | .letE .. =>\n letTelescope e fun xs b => do\n let some r \u2190 funProp b\n | return none\n cacheResult e {proof := \u2190 mkLambdaFVars (generalizeNondepLet := false) xs r.proof }\n | .forallE .. =>\n forallTelescope e fun xs b => do\n let some r \u2190 funProp b\n | return none\n cacheResult e {proof := \u2190 mkLambdaFVars xs r.proof }\n | .mdata _ e' => funProp e'\n | _ =>\n if let some r \u2190 main e then\n cacheResult e r\n else\n cacheFailure e\n return none\n\n\n /-- Main `funProp` function. Returns proof of `e`. -/\n private partial def main (e : Expr) : FunPropM (Option Result) := do\n\n let some (funPropDecl, f) \u2190 getFunProp? e\n | return none\n\n increaseSteps\n\n -- if function starts with let bindings move them the top of `e` and try again\n if f.isLet then\n return \u2190 funProp (\u2190 mapLetTelescope f fun _ b => pure <| e.setArg funPropDecl.funArgId b)\n\n match \u2190 getFunctionData? f (\u2190 unfoldNamePred) with\n | .letE f =>\n trace[Debug.Meta.Tactic.fun_prop] \"let case on {\u2190 ppExpr f}\"\n let e := e.setArg funPropDecl.funArgId f -- update e with reduced f\n letCase funPropDecl e f funProp\n | .lam f =>\n trace[Debug.Meta.Tactic.fun_prop] \"pi case on {\u2190 ppExpr f}\"\n let e := e.setArg funPropDecl.funArgId f -- update e with reduced f\n applyPiRule funPropDecl e funProp\n | .data fData =>\n let e := e.setArg funPropDecl.funArgId (\u2190 fData.toExpr) -- update e with reduced f\n\n if fData.isIdentityFun then\n applyIdRule funPropDecl e funProp\n else if fData.isConstantFun then\n applyConstRule funPropDecl e funProp\n else\n match fData.fn with\n | .fvar id =>\n if id == fData.mainVar.fvarId! then\n bvarAppCase funPropDecl e fData funProp\n else\n fvarAppCase funPropDecl e fData funProp\n | .const .. | .proj .. => do\n constAppCase funPropDecl e fData funProp\n | _ =>\n trace[Debug.Meta.Tactic.fun_prop] \"unknown case, ctor: {f.ctorName}\\n{e}\"\n return none", "-- Mathlib.Tactic.FunProp.Core.tryTheorems (L474-L528)\ndef tryTheorems (funPropDecl : FunPropDecl) (e : Expr) (fData : FunctionData)\n (thms : Array FunctionTheorem) (funProp : Expr \u2192 FunPropM (Option Result)) :\n FunPropM (Option Result) := do\n-- none - decomposition not tried\n -- some none - decomposition failed\n -- some some (f, g) - successful decomposition\n let mut dec? : Option (Option (Expr \u00d7 Expr)) := none\n\n for thm in thms do\n\n trace[Debug.Meta.Tactic.fun_prop] s!\"trying theorem {\u2190 ppOrigin' thm.thmOrigin}\"\n\n match compare thm.appliedArgs fData.args.size with\n | .lt =>\n trace[Meta.Tactic.fun_prop] s!\"removing argument to later use {\u2190 ppOrigin' thm.thmOrigin}\"\n if let some r \u2190 removeArgRule funPropDecl e fData funProp then\n return r\n continue\n | .gt =>\n trace[Meta.Tactic.fun_prop] s!\"adding argument to later use {\u2190 ppOrigin' thm.thmOrigin}\"\n if let some r \u2190 applyPiRule funPropDecl e funProp then\n return r\n continue\n | .eq =>\n if thm.form == .comp then\n if let some r \u2190 tryTheorem? e thm.thmOrigin funProp then\n return r\n else\n\n if thm.mainArgs.size == fData.mainArgs.size then\n if dec?.isNone then\n dec? := some (\u2190 fData.nontrivialDecomposition)\n match dec? with\n | some none =>\n if let some r \u2190 tryTheorem? e thm.thmOrigin funProp then\n return r\n | some (some (f, g)) =>\n trace[Meta.Tactic.fun_prop]\n s!\"decomposing to later use {\u2190ppOrigin' thm.thmOrigin} as:\n ({\u2190 ppExpr f}) \u2218 ({\u2190 ppExpr g})\"\n if let some r \u2190 applyCompRule funPropDecl e f g funProp then\n return r\n | _ => continue\n else\n let some (f, g) \u2190 fData.decompositionOverArgs thm.mainArgs | continue\n trace[Meta.Tactic.fun_prop]\n s!\"decomposing to later use {\u2190ppOrigin' thm.thmOrigin} as:\n ({\u2190 ppExpr f}) \u2218 ({\u2190 ppExpr g})\"\n if let some r \u2190 applyCompRule funPropDecl e f g funProp then\n return r\n -- todo: decompose if uncurried and arguments do not match exactly\n return none\n\n/-- Prove function property of `fun x \u21a6 f x\u2081 ... x\u2099` where `f` is free variable. -/", "-- Mathlib.Tactic.FunProp.Core.applyConstRule (L195-L214)\ndef applyConstRule (funPropDecl : FunPropDecl) (e : Expr)\n (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\nlet thms \u2190 getLambdaTheorems funPropDecl.funPropName .const\n if thms.size = 0 then\n let msg := s!\"missing constant rule to prove `{\u2190 ppExpr e}`\"\n logError msg\n trace[Meta.Tactic.fun_prop] msg\n return none\n for thm in thms do\n let .const := thm.thmArgs | return none\n if let some r \u2190 tryTheorem? e (.decl thm.thmName) funProp then\n return r\n\n return none\n\n/--\nTry to prove `e` using the *apply lambda theorem*.\n\nFor example, `e = q(Continuous fun f \u21a6 f x)` and `funPropDecl` is `FunPropDecl` for `Continuous`.\n-/", "-- Mathlib.Tactic.FunProp.Core.removeArgRule (L371-L388)\ndef removeArgRule (funPropDecl : FunPropDecl) (e : Expr) (fData : FunctionData)\n (funProp : Expr \u2192 FunPropM (Option Result)) :\n FunPropM (Option Result) := do\nmatch h : fData.args.size with\n | 0 => throwError \"fun_prop bug: invalid use of remove arg case {\u2190ppExpr e}\"\n | n + 1 =>\n let arg := fData.args[n]\n\n if arg.coe.isSome then\n -- if have to apply morphisms rules if we deal with morphisms\n return \u2190 applyMorRules funPropDecl e fData funProp\n else\n let some (f, g) \u2190 fData.peeloffArgDecomposition | return none\n applyCompRule funPropDecl e f g funProp\n\n\n/-- Prove function property of `fun f \u21a6 f x\u2081 ... x\u2099`. -/", "-- Mathlib.Tactic.FunProp.Elab.funPropTac (L68-L179)\ndef funPropTac : Tactic\n | `(tactic| fun_prop $cfg:optConfig $[$d]? $[[$names,*]]?) => do\n\n let goal \u2190 getMainGoal\n goal.withContext do\n let goalType \u2190 goal.getType\n\n -- the whnf and telescope is here because the goal can be\n -- `\u2200 y, let f := fun x => x + y; Continuous fun x => x + f x`\n-- However it is still not complete solution. How should we deal with mix of let and forall?\n withReducible <| forallTelescopeReducing (\u2190 whnfR goalType) fun _ type => do\n unless (\u2190 getFunProp? type).isSome do\n let hint :=\n if let some n := type.getAppFn.constName?\n then s!\" Maybe you forgot marking `{n}` with `@[fun_prop]`.\"\n else \"\"\n throwError \"`{\u2190 ppExpr type}` is not a `fun_prop` goal!{hint}\"\n\n let cfg \u2190 elabFunPropConfig cfg\n\n let disch \u2190 show MetaM (Expr \u2192 MetaM (Option Expr)) from do\n match d with\n | none => pure emptyDischarge\n | some d =>\n match d with\n | `(discharger| (discharger:=$tac)) => pure <| tacticToDischarge (\u2190 `(tactic| ($tac)))\n | _ => pure emptyDischarge\n\n let namesToUnfold : Array Name :=\n match names with\n | none => #[]\n | some ns => ns.getElems.map (fun n => n.getId)\n\n let namesToUnfold := namesToUnfold.append defaultNamesToUnfold\n\n let ctx : Context :=\n { config := cfg,\n disch := disch\n constToUnfold := .ofArray namesToUnfold _}\n let env \u2190 getEnv\n let s := {\n morTheorems := morTheoremsExt.getState env\n transitionTheorems := transitionTheoremsExt.getState env }\n let (r?, s) \u2190 funProp goalType ctx |>.run s\n if let some r := r? then\n goal.assign r.proof\n else\n let mut msg := s!\"`fun_prop` was unable to prove `{\u2190 Meta.ppExpr goalType}`\\n\\n\"\n\n msg := msg ++ \"Issues:\"\n msg := s.msgLog.foldl (init := msg) (fun msg m => msg ++ \"\\n \" ++ m)\n\n throwError msg\n\n | _ => throwUnsupportedSyntax\n\n\n\n/-- Command that prints all function properties attached to a function.\n\nFor example\n```\n#print_fun_prop_theorems HAdd.hAdd\n```\nmight print out\n```\nContinuous\n continuous_add, args: [4,5], priority: 1000\n continuous_const_add, args: [5], priority: 1000\n continuous_add_const, args [4], priority: 1000\n ...\nDifferentiable\n Differentiable.add, args: [4,5], priority: 1000\n Differentiable.add_const, args: [4], priority: 1000\n Differentiable.const_add, args: [5], priority: 1000\n ...\n```\n\nYou can also see only theorems about a concrete function property\n```\n#print_fun_prop_theorems HAdd.hAdd Continuous\n```\n-/\nelab \"#print_fun_prop_theorems \" funIdent:ident funProp:(ident)? : command => do\n\n let funName \u2190 ensureNonAmbiguous funIdent (\u2190 resolveGlobalConst funIdent)\n let funProp? \u2190 funProp.mapM (fun stx => do\n ensureNonAmbiguous stx (\u2190 resolveGlobalConst stx))\n\n let theorems := (functionTheoremsExt.getState (\u2190 getEnv)).theorems.getD funName {}\n\n let logTheorems (funProp : Name) (thms : Array FunctionTheorem) : Command.CommandElabM Unit := do\n let mut msg : MessageData := \"\"\n msg := msg ++ m!\"{\u2190 Meta.ppOrigin (.decl funProp)}\"\n for thm in thms do\n msg := msg ++ m!\"\\n {\u2190 Meta.ppOrigin (.decl thm.thmOrigin.name)}, \\\n args: {thm.mainArgs}, form: {thm.form}\"\n pure ()\n logInfo msg\n\n\n match funProp? with\n | none =>\n for (funProp,thms) in theorems do\n logTheorems funProp thms\n | some funProp =>\n logTheorems funProp (theorems.getD funProp #[])\n\n\nend Meta.FunProp\n\nend Mathlib"], "statement": "def isFunProp (e : Expr) : MetaM Bool", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 36664, "declarations_count": 4144, "diagnostics_count": 1, "duplicate_fingerprint": "77acbd213937037d", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 11221, "lean_code_chars": 33921, "lean_code_ratio": 0.9252, "length_bucket": "long", "line_count": 1100, "natural_language_chars": 2743, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 32, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.FunProp.Decl).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef isFunProp (e : Expr) : MetaM Bool\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Tactic.FunProp.Decl.FunPropDeclsExt (L45-L57)\nabbrev FunPropDeclsExt := SimpleScopedEnvExtension FunPropDecl FunPropDecls\n/-- Extension storing function properties tracked and used by the `fun_prop` attribute and tactic,\nincluding, for example, `Continuous`, `Measurable`, `Differentiable`, etc. -/\ninitialize funPropDeclsExt : FunPropDeclsExt \u2190\n registerSimpleScopedEnvExtension {\n name := by exact decl_name%\n initial := {}\n addEntry := fun d e =>\n {d with decls := d.decls.insertKeyValue e.path e}\n }\n\n/-- Register new function property. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Tactic.FunProp.Decl.addFunPropDecl (L58-L92)\ndef addFunPropDecl (declName : Name) : MetaM Unit := do\nlet info \u2190 getConstInfo declName\n\n let (xs, bi, b) \u2190 forallMetaTelescope info.type\n\n if \u00acb.isProp then\n throwError \"invalid fun_prop declaration, has to be `Prop`-valued function\"\n\n let lvls := info.levelParams.map (fun l => Level.param l)\n let e := mkAppN (.const declName lvls) xs\n let path \u2190 DiscrTree.mkPath e\n\n -- find the argument position of the function `f` in `P f`\n let mut some funArgId \u2190 (xs.zip bi).findIdxM? fun (x,bi) => do\n if (\u2190 inferType x).isForall && bi.isExplicit then\n return true\n else\n return false\n | throwError \"invalid fun_prop declaration, can't find argument of type `\u03b1 \u2192 \u03b2`\"\n\n let decl : FunPropDecl := {\n funPropName := declName\n path := path\n funArgId := funArgId\n }\n\n modifyEnv fun env => funPropDeclsExt.addEntry env decl\n\n trace[Meta.Tactic.fun_prop.attr]\n \"added new function property `{declName}`\\nlook up pattern is `{path}`\"\n\n\n/-- Is `e` a function property statement? If yes return function property declaration and\nthe function it talks about. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Tactic.FunProp.Decl.getFunProp (L93-L111)\ndef getFunProp? (e : Expr) : MetaM (Option (FunPropDecl \u00d7 Expr)) := do\nlet ext := funPropDeclsExt.getState (\u2190 getEnv)\n\n let decls \u2190 ext.decls.getMatch e (\u2190 read)\n\n if h : decls.size = 0 then\n return none\n else\n if decls.size > 1 then\n throwError \"fun_prop bug: expression {\u2190 ppExpr e} matches multiple function properties\\n\\\n {decls.map (fun d => d.funPropName)}\"\n\n let decl := decls[0]\n unless decl.funArgId < e.getAppNumArgs do return none\n let f := e.getArg! decl.funArgId\n\n return (decl,f)\n\n/-- Is `e` a function property statement? -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Tactic.FunProp.Decl.isFunPropGoal (L115-L119)\ndef isFunPropGoal (e : Expr) : MetaM Bool := do\nforallTelescope e fun _ b =>\n return (\u2190 getFunProp? b).isSome\n\n/-- Returns function property declaration from `e = P f`. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Tactic.FunProp.Decl.getFunPropDecl (L120-L126)\ndef getFunPropDecl? (e : Expr) : MetaM (Option FunPropDecl) := do\nmatch \u2190 getFunProp? e with\n | some (decl, _) => return decl\n | none => return none\n\n\n/-- Returns function `f` from `e = P f` and `P` is function property. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Tactic.FunProp.Decl.getFunPropFun (L127-L134)\ndef getFunPropFun? (e : Expr) : MetaM (Option Expr) := do\nmatch \u2190 getFunProp? e with\n | some (_, f) => return f\n | none => return none\n\n\nopen Elab Term in\n/-- Turn tactic syntax into a discharger function. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Tactic.FunProp.Decl.tacticToDischarge (L135-L160)\ndef tacticToDischarge (tacticCode : TSyntax `tactic) : Expr \u2192 MetaM (Option Expr) := fun e =>\nwithTraceNode `Meta.Tactic.fun_prop\n (fun _ => do pure s!\"discharging: {\u2190 ppExpr e}\") do\n let mvar \u2190 mkFreshExprSyntheticOpaqueMVar e `funProp.discharger\n let runTac? : TermElabM (Option Expr) :=\n try\n instantiateMVarDeclMVars mvar.mvarId!\n\n let _ \u2190\n withSynthesize (postpone := .no) do\n Tactic.run mvar.mvarId! (Tactic.evalTactic tacticCode *> Tactic.pruneSolvedGoals)\n\n let result \u2190 instantiateMVars mvar\n if result.hasExprMVar then\n return none\n else\n return some result\n catch _ =>\n return none\n let (result?, _) \u2190 runTac?.run {} {}\n\n return result?\n\nend Meta.FunProp\n\nend Mathlib\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Tactic.FunProp.Core.bvarAppCase (L389-L402)\ndef bvarAppCase (funPropDecl : FunPropDecl) (e : Expr) (fData : FunctionData)\n (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\nif (\u2190 fData.isMorApplication) != .none then\n applyMorRules funPropDecl e fData funProp\n else\n if let some (f, g) \u2190 fData.nontrivialDecomposition then\n applyCompRule funPropDecl e f g funProp\n else\n applyApplyRule funPropDecl e funProp\n\n/--\nGet candidate theorems from the environment for function property `funPropDecl` and\nfunction `funName`. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Tactic.FunProp.FunctionData.getFunctionData (L77-L118)\ndef getFunctionData (f : Expr) : MetaM FunctionData := do\nlambdaTelescope f fun xs b => do\n\n let xId := xs[0]!.fvarId!\n\n Mor.withApp b fun fn args => do\n\n let mut fn := fn\n let mut args := args\n\n -- revert projection in fn\n if let .proj n i x := fn then\n let some info := getStructureInfo? (\u2190 getEnv) n | unreachable!\n let some projName := info.getProjFn? i | unreachable!\n let p \u2190 mkAppM projName #[x]\n fn := p.getAppFn\n args := p.getAppArgs.map (fun a => {expr:=a}) ++ args\n\n let mainArgs := args\n |>.mapIdx (fun i \u27e8arg,_\u27e9 => if arg.containsFVar xId then some i else none)\n |>.filterMap id\n\n return {\n lctx := \u2190 getLCtx\n insts := \u2190 getLocalInstances\n fn := fn\n args := args\n mainVar := xs[0]!\n mainArgs := mainArgs\n }\n\n/-- Result of `getFunctionData?`. It returns function data if the function is in the form\n`fun x \u21a6 f y\u2081 ... y\u2099`. Two other cases are `fun x \u21a6 let y := ...` or `fun x y \u21a6 ...` -/\ninductive MaybeFunctionData where\n /-- Can't generate function data as function body has let binder. -/\n | letE (f : Expr)\n /-- Can't generate function data as function body has lambda binder. -/\n | lam (f : Expr)\n /-- Function data has been successfully generated. -/\n | data (fData : FunctionData)\n\n/-- Turn `MaybeFunctionData` to the function. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Tactic.FunProp.Core.applyCompRule (L231-L253)\ndef applyCompRule (funPropDecl : FunPropDecl) (e f g : Expr)\n (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\nlet thms \u2190 getLambdaTheorems funPropDecl.funPropName .comp\n if thms.size = 0 then\n let msg := s!\"missing composition rule to prove `{\u2190 ppExpr e}`\"\n logError msg\n trace[Meta.Tactic.fun_prop] msg\n return none\n\n for thm in thms do\n let .comp id_f id_g := thm.thmArgs | return none\n if let some r \u2190 tryTheoremWithHint? e (.decl thm.thmName) #[(id_f, f), (id_g, g)] funProp then\n return r\n\n return none\n\n/--\nTry to prove `e` using *pi lambda theorem*.\n\nFor example, `e = q(Continuous fun x y \u21a6 f x y)` and `funPropDecl` is `FunPropDecl` for\n`Continuous`\n-/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Tactic.FunProp.Core.synthesizeArgs (L50-L106)\ndef synthesizeArgs (thmId : Origin) (xs : Array Expr)\n (funProp : Expr \u2192 FunPropM (Option Result)) :\n FunPropM Bool := do\nlet mut postponed : Array Expr := #[]\n for x in xs do\n let type \u2190 inferType x\n if (\u2190 instantiateMVars x).isMVar then\n\n -- try type class\n if (\u2190 isClass? type).isSome then\n if (\u2190 synthesizeInstance thmId x type) then\n continue\n else if (\u2190 isFunPropGoal type) then\n -- try function property\n if let some \u27e8proof\u27e9 \u2190 funProp type then\n if (\u2190 isDefEq x proof) then\n continue\n else do\n trace[Meta.Tactic.fun_prop]\n \"{\u2190 ppOrigin thmId}, failed to assign proof{indentExpr type}\"\n return false\n else\n -- try user provided discharger\n let ctx : Context \u2190 read\n if (\u2190 isProp type) then\n if let some proof \u2190 ctx.disch type then\n if (\u2190 isDefEq x proof) then\n continue\n else do\n trace[Meta.Tactic.fun_prop]\n \"{\u2190 ppOrigin thmId}, failed to assign proof{indentExpr type}\"\n return false\n else\n logError s!\"Failed to prove necessary assumption `{\u2190 ppExpr type}` \\\n when applying theorem `{\u2190 ppOrigin' thmId}`.\"\n\n if \u00ac(\u2190 isProp type) then\n postponed := postponed.push x\n continue\n else\n trace[Meta.Tactic.fun_prop]\n \"{\u2190 ppOrigin thmId}, failed to discharge hypotheses{indentExpr type}\"\n return false\n\n for x in postponed do\n if (\u2190 instantiateMVars x).isMVar then\n logError s!\"Failed to infer `({\u2190 ppExpr x} : {\u2190 ppExpr (\u2190 inferType x)})` \\\n when applying theorem `{\u2190 ppOrigin' thmId}`.\"\n\n trace[Meta.Tactic.fun_prop]\n \"{\u2190 ppOrigin thmId}, failed to infer `({\u2190 ppExpr x} : {\u2190 ppExpr (\u2190 inferType x)})`\"\n return false\n\n return true\n\n\n/-- Try to apply theorem - core function -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Tactic.FunProp.Core.cacheResult (L615-L619)\ndef cacheResult (e : Expr) (r : Result) : FunPropM Result := do -- return proof?\nmodify (fun s => { s with cache := s.cache.insert e { expr := q(True), proof? := r.proof} })\n return r\n\n/-- Cache for failed goals such that `fun_prop` can fail fast next time. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Tactic.FunProp.Core.letCase (L279-L320)\ndef letCase (funPropDecl : FunPropDecl) (e : Expr) (f : Expr)\n (funProp : Expr \u2192 FunPropM (Option Result)) :\n FunPropM (Option Result) := do\nmatch f with\n | .lam xName xType (.letE yName yType yValue yBody _) xBi => do\n let yType := yType.consumeMData\n let yValue := yValue.consumeMData\n let yBody := yBody.consumeMData\n -- We perform reduction because the type is quite often of the form\n -- `(fun x \u21a6 Y) #0` which is just `Y`\n -- Usually this is caused by the usage of `FunLike`\n let yType := yType.headBeta\n if (yType.hasLooseBVar 0) then\n throwError \"dependent type encountered {\u2190 ppExpr (Expr.forallE xName xType yType default)}\"\n\n -- let binding can be pulled out of the lambda function\n if \u00ac(yValue.hasLooseBVar 0) then\n let body := yBody.swapBVars 0 1\n let e' := mkLet yName yType yValue\n (e.setArg (funPropDecl.funArgId) (.lam xName xType body xBi))\n return \u2190 funProp e'\n\n match (yBody.hasLooseBVar 0), (yBody.hasLooseBVar 1) with\n | true, true =>\n let f \u2190 mkUncurryFun 2 (Expr.lam xName xType (.lam yName yType yBody default) xBi)\n let g := Expr.lam xName xType (binderInfo := default)\n (mkAppN (\u2190 mkConstWithFreshMVarLevels ``Prod.mk) #[xType,yType,.bvar 0, yValue])\n applyCompRule funPropDecl e f g funProp\n\n | true, false =>\n let f := Expr.lam yName yType yBody default\n let g := Expr.lam xName xType yValue default\n applyCompRule funPropDecl e f g funProp\n\n | false, _ =>\n let f := Expr.lam xName xType (yBody.lowerLooseBVars 1 1) xBi\n funProp (e.setArg (funPropDecl.funArgId) f)\n\n | _ => throwError \"expected expression of the form `fun x \u21a6 lam y := ..; ..`\"\n\n\n/-- Prove function property of using *morphism theorems*. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Tactic.FunProp.Core.getDeclTheorems (L403-L422)\ndef getDeclTheorems (funPropDecl : FunPropDecl) (funName : Name)\n (mainArgs : Array Nat) (appliedArgs : Nat) : MetaM (Array FunctionTheorem) := do\nlet thms \u2190 getTheoremsForFunction funName funPropDecl.funPropName\n\n let thms := thms\n |>.filter (fun thm => (isOrderedSubsetOf mainArgs thm.mainArgs))\n |>.qsort (fun t s =>\n let dt := (Int.ofNat t.appliedArgs - Int.ofNat appliedArgs).natAbs\n let ds := (Int.ofNat s.appliedArgs - Int.ofNat appliedArgs).natAbs\n match compare dt ds with\n | .lt => true\n | .gt => false\n | .eq => t.mainArgs.size < s.mainArgs.size)\n -- todo: sorting and filtering\n return thms\n\n/--\nGet candidate theorems from the local context for function property `funPropDecl` and\nfunction `funName`. -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Tactic.FunProp.Core.applyMorRules (L321-L346)\ndef applyMorRules (funPropDecl : FunPropDecl) (e : Expr) (fData : FunctionData)\n (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\ntrace[Debug.Meta.Tactic.fun_prop] \"applying morphism theorems to {\u2190 ppExpr e}\"\n\n match \u2190 fData.isMorApplication with\n | .none => throwError \"fun_prop bug: invalid use of mor rules on {\u2190 ppExpr e}\"\n | .underApplied =>\n applyPiRule funPropDecl e funProp\n | .overApplied =>\n let some (f, g) \u2190 fData.peeloffArgDecomposition | return none\n applyCompRule funPropDecl e f g funProp\n | .exact =>\n\n let candidates \u2190 getMorphismTheorems e\n\n trace[Meta.Tactic.fun_prop]\n \"candidate morphism theorems: {\u2190 candidates.mapM fun c => ppOrigin (.decl c.thmName)}\"\n\n for c in candidates do\n if let some r \u2190 tryTheorem? e (.decl c.thmName) funProp then\n return r\n\n trace[Debug.Meta.Tactic.fun_prop] \"no theorem matched\"\n return none\n\n/-- Prove function property of using *transition theorems*. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Tactic.FunProp.Core.constAppCase (L565-L614)\ndef constAppCase (funPropDecl : FunPropDecl) (e : Expr) (fData : FunctionData)\n (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\nlet some (funName, _) := fData.fn.const?\n | throwError \"fun_prop bug: invelid use of const app case\"\n let globalThms \u2190 getDeclTheorems funPropDecl funName fData.mainArgs fData.args.size\n\n trace[Meta.Tactic.fun_prop]\n s!\"candidate theorems for {funName} {\u2190 globalThms.mapM fun thm => ppOrigin' thm.thmOrigin}\"\n\n if let some r \u2190 tryTheorems funPropDecl e fData globalThms funProp then\n return r\n\n -- Try local theorems - this is useful for recursive functions\n let localThms \u2190 getLocalTheorems funPropDecl (.decl funName) fData.mainArgs fData.args.size\n if localThms.size \u2260 0 then\n trace[Meta.Tactic.fun_prop]\n s!\"candidate local theorems for {funName} \\\n {\u2190 localThms.mapM fun thm => ppOrigin' thm.thmOrigin}\"\n if let some r \u2190 tryTheorems funPropDecl e fData localThms funProp then\n return r\n\n -- log error if no global or local theorems were found\n if globalThms.size = 0 && localThms.size = 0 then\n logError s!\"No theorems found for `{funName}` in order to prove `{\u2190 ppExpr e}`\"\n\n if (\u2190 fData.isMorApplication) != .none then\n if let some r \u2190 applyMorRules funPropDecl e fData funProp then\n return r\n\n if let some (f, g) \u2190 fData.nontrivialDecomposition then\n trace[Meta.Tactic.fun_prop]\n s!\"failed applying `{funPropDecl.funPropName}` theorems for `{funName}`\n trying again after decomposing function as: `({\u2190 ppExpr f}) \u2218 ({\u2190 ppExpr g})`\"\n\n if let some r \u2190 applyCompRule funPropDecl e f g funProp then\n return r\n else\n trace[Meta.Tactic.fun_prop]\n s!\"failed applying `{funPropDecl.funPropName}` theorems for `{funName}`\n now trying to prove `{funPropDecl.funPropName}` from another function property\"\n\n if let some r \u2190 applyTransitionRules e funProp then\n return r\n\n\n return none\n\n\n/-- Cache result if it does not have any subgoals. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Tactic.FunProp.Core.applyApplyRule (L215-L230)\ndef applyApplyRule (funPropDecl : FunPropDecl) (e : Expr)\n (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\nlet thms := (\u2190 getLambdaTheorems funPropDecl.funPropName .apply)\n for thm in thms do\n if let some r \u2190 tryTheoremWithHint? e (.decl thm.thmName) #[] funProp then\n return r\n\n return none\n\n/--\nTry to prove `e` using *composition lambda theorem*.\n\nFor example, `e = q(Continuous fun x \u21a6 f (g x))` and `funPropDecl` is `FunPropDecl` for\n`Continuous`\n\nYou also have to provide the functions `f` and `g`. -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Tactic.FunProp.Core.applyIdRule (L175-L194)\ndef applyIdRule (funPropDecl : FunPropDecl) (e : Expr)\n (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\nlet thms \u2190 getLambdaTheorems funPropDecl.funPropName .id\n if thms.size = 0 then\n let msg := s!\"missing identity rule to prove `{\u2190 ppExpr e}`\"\n logError msg\n trace[Meta.Tactic.fun_prop] msg\n return none\n\n for thm in thms do\n if let some r \u2190 tryTheoremWithHint? e (.decl thm.thmName) #[] funProp then\n return r\n\n return none\n\n/--\nTry to prove `e` using the *constant lambda theorem*.\n\nFor example, `e = q(Continuous fun x \u21a6 y)` and `funPropDecl` is `FunPropDecl` for `Continuous`.\n-/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Tactic.FunProp.Core.getLocalTheorems (L423-L473)\ndef getLocalTheorems (funPropDecl : FunPropDecl) (funOrigin : Origin)\n (mainArgs : Array Nat) (appliedArgs : Nat) : FunPropM (Array FunctionTheorem) := do\nlet mut thms : Array FunctionTheorem := #[]\n let lctx \u2190 getLCtx\n for var in lctx do\n if (var.kind = Lean.LocalDeclKind.auxDecl) then\n continue\n let type \u2190 instantiateMVars var.type\n let thm? : Option FunctionTheorem \u2190\n forallTelescope type fun _ b => do\n let b \u2190 whnfR b\n let some (decl, f) \u2190 getFunProp? b | return none\n unless decl.funPropName = funPropDecl.funPropName do return none\n\n let .data fData \u2190 getFunctionData? f (\u2190 unfoldNamePred)\n | return none\n unless (fData.getFnOrigin == funOrigin) do return none\n\n unless isOrderedSubsetOf mainArgs fData.mainArgs do return none\n\n let dec? \u2190 fData.nontrivialDecomposition\n\n let thm : FunctionTheorem := {\n funPropName := funPropDecl.funPropName\n thmOrigin := .fvar var.fvarId\n funOrigin := funOrigin\n mainArgs := fData.mainArgs\n appliedArgs := fData.args.size\n priority := eval_prio default\n form := if dec?.isSome then .comp else .uncurried\n }\n\n return some thm\n\n if let some thm := thm? then\n thms := thms.push thm\n\n thms := thms\n |>.qsort (fun t s =>\n let dt := (Int.ofNat t.appliedArgs - Int.ofNat appliedArgs).natAbs\n let ds := (Int.ofNat s.appliedArgs - Int.ofNat appliedArgs).natAbs\n match compare dt ds with\n | .lt => true\n | .gt => false\n | .eq => t.mainArgs.size < s.mainArgs.size)\n\n return thms\n\n\n/-- Try to apply *function theorems* `thms` to `e`. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Tactic.FunProp.Core.tryTheoremCore (L107-L124)\ndef tryTheoremCore (xs : Array Expr) (val : Expr) (type : Expr) (e : Expr)\n (thmId : Origin) (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\nwithTraceNode `Meta.Tactic.fun_prop\n (fun _ => return s!\"applying: {\u2190 ppOrigin' thmId}\") do\n\n if (\u2190 isDefEq type e) then\n\n if \u00ac(\u2190 synthesizeArgs thmId xs funProp) then\n return none\n let proof \u2190 instantiateMVars (mkAppN val xs)\n\n return some { proof := proof }\n else\n trace[Meta.Tactic.fun_prop] \"failed to unify {\u2190 ppOrigin thmId}\\n{type}\\nwith\\n{e}\"\n return none\n\n\n/-- Try to apply a theorem provided some of the theorem arguments. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Tactic.FunProp.Core.applyPiRule (L254-L278)\ndef applyPiRule (funPropDecl : FunPropDecl) (e : Expr)\n (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\nlet thms \u2190 getLambdaTheorems funPropDecl.funPropName .pi\n if thms.size = 0 then\n let msg := s!\"missing pi rule to prove `{\u2190 ppExpr e}`\"\n logError msg\n trace[Meta.Tactic.fun_prop] msg\n return none\n\n for thm in thms do\n if let some r \u2190 tryTheoremWithHint? e (.decl thm.thmName) #[] funProp then\n return r\n\n return none\n\n\n/--\nTry to prove `e = q(P (fun x \u21a6 let y := \u03c6 x; \u03c8 x y)`.\n\nFor example,\n - `funPropDecl` is `FunPropDecl` for `Continuous`\n - `e = q(Continuous fun x \u21a6 let y := \u03c6 x; \u03c8 x y)`\n - `f = q(fun x \u21a6 let y := \u03c6 x; \u03c8 x y)`\n-/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Tactic.FunProp.Core.applyTransitionRules (L347-L370)\ndef applyTransitionRules (e : Expr) (funProp : Expr \u2192 FunPropM (Option Result)) :\n FunPropM (Option Result) := do\nwithIncreasedTransitionDepth do\n\n let candidates \u2190 getTransitionTheorems e\n\n trace[Meta.Tactic.fun_prop]\n \"candidate transition theorems: {\u2190 candidates.mapM fun c => ppOrigin (.decl c.thmName)}\"\n\n for c in candidates do\n if let some r \u2190 tryTheorem? e (.decl c.thmName) funProp then\n return r\n\n trace[Debug.Meta.Tactic.fun_prop] \"no theorem matched\"\n return none\n\n/-- Try to remove applied argument i.e. prove `P (fun x \u21a6 f x y)` from `P (fun x \u21a6 f x)`.\n\nFor example\n - `funPropDecl` is `FunPropDecl` for `Continuous`\n - `e = q(Continuous fun x \u21a6 foo (bar x) y)`\n - `fData` contains info on `fun x \u21a6 foo (bar x) y`\n This tries to prove `Continuous fun x \u21a6 foo (bar x) y` from `Continuous fun x \u21a6 foo (bar x)`\n-/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Tactic.FunProp.Core.synthesizeInstance (L31-L49)\ndef synthesizeInstance (thmId : Origin) (x type : Expr) : MetaM Bool := do\nmatch (\u2190 trySynthInstance type) with\n | .some val =>\n if (\u2190 withReducibleAndInstances <| isDefEq x val) then\n return true\n else\n trace[Meta.Tactic.fun_prop]\n\"{\u2190 ppOrigin thmId}, failed to assign instance{indentExpr type}\nsynthesized value{indentExpr val}\\nis not definitionally equal to{indentExpr x}\"\n return false\n | _ =>\n trace[Meta.Tactic.fun_prop]\n \"{\u2190 ppOrigin thmId}, failed to synthesize instance{indentExpr type}\"\n return false\n\n\n\n/-- Synthesize arguments `xs` either with typeclass synthesis, with `fun_prop` or with\ndischarger. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Tactic.FunProp.FunctionData.FunctionData (L44-L49)\ndef FunctionData.toExpr (f : FunctionData) : MetaM Expr := do\nwithLCtx f.lctx f.insts do\n let body := Mor.mkAppN f.fn f.args\n mkLambdaFVars #[f.mainVar] body\n\n/-- Is `f` an identity function? -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Tactic.FunProp.Core.fvarAppCase (L529-L564)\ndef fvarAppCase (funPropDecl : FunPropDecl) (e : Expr) (fData : FunctionData)\n (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\n-- fvar theorems are almost exclusively in uncurried form so we decompose if we can\n if let some (f, g) \u2190 fData.nontrivialDecomposition then\n applyCompRule funPropDecl e f g funProp\n else\n let .fvar id := fData.fn | throwError \"fun_prop bug: invalid use of fvar app case\"\n let thms \u2190 getLocalTheorems funPropDecl (.fvar id) fData.mainArgs fData.args.size\n trace[Meta.Tactic.fun_prop]\n s!\"candidate local theorems for {\u2190ppExpr (.fvar id)} \\\n {\u2190 thms.mapM fun thm => ppOrigin' thm.thmOrigin}\"\n\n if let some r \u2190 tryTheorems funPropDecl e fData thms funProp then\n return r\n\n if let some f \u2190 fData.unfoldHeadFVar? then\n let e' := e.setArg funPropDecl.funArgId f\n if let some r \u2190 funProp e' then\n return r\n\n if (\u2190 fData.isMorApplication) != .none then\n if let some r \u2190 applyMorRules funPropDecl e fData funProp then\n return r\n\n if (\u2190 fData.nontrivialDecomposition).isNone then\n if let some r \u2190 applyTransitionRules e funProp then\n return r\n\n if thms.size = 0 then\n logError s!\"No theorems found for `{\u2190 ppExpr (.fvar id)}` in order to prove `{\u2190 ppExpr e}`\"\n\n return none\n\n\n/-- Prove function property of `fun x \u21a6 f x\u2081 ... x\u2099` where `f` is declared function. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Tactic.FunProp.Core.tryTheoremWithHint (L125-L164)\ndef tryTheoremWithHint? (e : Expr) (thmOrigin : Origin)\n (hint : Array (Nat \u00d7 Expr))\n (funProp : Expr \u2192 FunPropM (Option Result)) (newMCtxDepth : Bool := false) :\nFunPropM (Option Result) := do\n let go : FunPropM (Option Result) := do\n let thmProof \u2190 thmOrigin.getValue\n -- for `fvar`s we need to instantiate the metavariables of its type.\n let type \u2190 instantiateMVars <| \u2190 inferType thmProof\n let (xs, _, type) \u2190 forallMetaTelescope type\n\n for (i,x) in hint do\n try\n for (id,v) in hint do\n xs[id]!.mvarId!.assignIfDefEq v\n catch _ =>\n trace[Debug.Meta.Tactic.fun_prop]\n \"failed to use hint {i} `{\u2190 ppExpr x} when applying theorem {\u2190 ppOrigin thmOrigin}\"\n\n tryTheoremCore xs thmProof type e thmOrigin funProp\n\n -- `simp` introduces new meta variable context depth for some reason\n -- This is probably to avoid mvar assignment when trying a theorem fails\n --\n -- However, in `fun_prop` case this is not completely desirable\n -- For example, I want to be able to solve a goal with mvars like `ContDiff \u211d ?n f` using local\n -- hypothesis `(h : ContDiff \u211d \u221e f)` and assign `\u221e` to the mvar `?n`.\n --\n -- This could be problematic if there are two local hypothesis `(hinf : ContDiff \u211d \u221e f)` and\n -- `(h1 : ContDiff \u211d 1 f)` and apart from solving `ContDiff \u211d ?n f` there is also a subgoal\n -- `2 \u2264 ?n`. If `fun_prop` decides to try `h1` first it would assign `1` to `?n` and then there\n -- is no hope solving `2 \u2264 1` and it won't be able to apply `hinf` after trying `h1` as `n?` is\n -- assigned already. Ideally `fun_prop` would roll back the `MetaM.State`. This issue did not\n -- come up yet so I didn't bother and I'm worried about the performance impact.\n if newMCtxDepth then\n withNewMCtxDepth go\n else\n go\n\n\n/-- Try to apply a theorem `thmOrigin` to the goal `e`. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Tactic.FunProp.Core.tryTheorem (L165-L174)\ndef tryTheorem? (e : Expr) (thmOrigin : Origin) (funProp : Expr \u2192 FunPropM (Option Result))\n (newMCtxDepth : Bool := false) : FunPropM (Option Result) :=\ntryTheoremWithHint? e thmOrigin #[] funProp newMCtxDepth\n\n\n/--\nTry to prove `e` using the *identity lambda theorem*.\n\nFor example, `e = q(Continuous fun x \u21a6 x)` and `funPropDecl` is `FunPropDecl` for `Continuous`.\n-/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Tactic.FunProp.Core.cacheFailure (L620-L702)\ndef cacheFailure (e : Expr) : FunPropM Unit := do -- return proof?\nmodify (fun s => { s with failureCache := s.failureCache.insert e })\n\n\nmutual\n /-- Main `funProp` function. Returns proof of `e`. -/\n partial def funProp (e : Expr) : FunPropM (Option Result) := do\n\n let e \u2190 instantiateMVars e\n\n withTraceNode `Meta.Tactic.fun_prop\n (fun _ => do pure s!\"{\u2190 ppExpr e}\") do\n\n -- check cache for successful goals\n if let some { expr := _, proof? := some proof } := (\u2190 get).cache.find? e then\n trace[Meta.Tactic.fun_prop] \"reusing previously found proof for {e}\"\n return some { proof := proof }\n else if (\u2190 get).failureCache.contains e then\n trace[Meta.Tactic.fun_prop] \"skipping proof search, proving {e} was tried already and failed\"\n return none\n else\n -- take care of forall and let binders and run main\n match e with\n | .letE .. =>\n letTelescope e fun xs b => do\n let some r \u2190 funProp b\n | return none\n cacheResult e {proof := \u2190 mkLambdaFVars (generalizeNondepLet := false) xs r.proof }\n | .forallE .. =>\n forallTelescope e fun xs b => do\n let some r \u2190 funProp b\n | return none\n cacheResult e {proof := \u2190 mkLambdaFVars xs r.proof }\n | .mdata _ e' => funProp e'\n | _ =>\n if let some r \u2190 main e then\n cacheResult e r\n else\n cacheFailure e\n return none\n\n\n /-- Main `funProp` function. Returns proof of `e`. -/\n private partial def main (e : Expr) : FunPropM (Option Result) := do\n\n let some (funPropDecl, f) \u2190 getFunProp? e\n | return none\n\n increaseSteps\n\n -- if function starts with let bindings move them the top of `e` and try again\n if f.isLet then\n return \u2190 funProp (\u2190 mapLetTelescope f fun _ b => pure <| e.setArg funPropDecl.funArgId b)\n\n match \u2190 getFunctionData? f (\u2190 unfoldNamePred) with\n | .letE f =>\n trace[Debug.Meta.Tactic.fun_prop] \"let case on {\u2190 ppExpr f}\"\n let e := e.setArg funPropDecl.funArgId f -- update e with reduced f\n letCase funPropDecl e f funProp\n | .lam f =>\n trace[Debug.Meta.Tactic.fun_prop] \"pi case on {\u2190 ppExpr f}\"\n let e := e.setArg funPropDecl.funArgId f -- update e with reduced f\n applyPiRule funPropDecl e funProp\n | .data fData =>\n let e := e.setArg funPropDecl.funArgId (\u2190 fData.toExpr) -- update e with reduced f\n\n if fData.isIdentityFun then\n applyIdRule funPropDecl e funProp\n else if fData.isConstantFun then\n applyConstRule funPropDecl e funProp\n else\n match fData.fn with\n | .fvar id =>\n if id == fData.mainVar.fvarId! then\n bvarAppCase funPropDecl e fData funProp\n else\n fvarAppCase funPropDecl e fData funProp\n | .const .. | .proj .. => do\n constAppCase funPropDecl e fData funProp\n | _ =>\n trace[Debug.Meta.Tactic.fun_prop] \"unknown case, ctor: {f.ctorName}\\n{e}\"\n return none\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Tactic.FunProp.Core.tryTheorems (L474-L528)\ndef tryTheorems (funPropDecl : FunPropDecl) (e : Expr) (fData : FunctionData)\n (thms : Array FunctionTheorem) (funProp : Expr \u2192 FunPropM (Option Result)) :\n FunPropM (Option Result) := do\n-- none - decomposition not tried\n -- some none - decomposition failed\n -- some some (f, g) - successful decomposition\n let mut dec? : Option (Option (Expr \u00d7 Expr)) := none\n\n for thm in thms do\n\n trace[Debug.Meta.Tactic.fun_prop] s!\"trying theorem {\u2190 ppOrigin' thm.thmOrigin}\"\n\n match compare thm.appliedArgs fData.args.size with\n | .lt =>\n trace[Meta.Tactic.fun_prop] s!\"removing argument to later use {\u2190 ppOrigin' thm.thmOrigin}\"\n if let some r \u2190 removeArgRule funPropDecl e fData funProp then\n return r\n continue\n | .gt =>\n trace[Meta.Tactic.fun_prop] s!\"adding argument to later use {\u2190 ppOrigin' thm.thmOrigin}\"\n if let some r \u2190 applyPiRule funPropDecl e funProp then\n return r\n continue\n | .eq =>\n if thm.form == .comp then\n if let some r \u2190 tryTheorem? e thm.thmOrigin funProp then\n return r\n else\n\n if thm.mainArgs.size == fData.mainArgs.size then\n if dec?.isNone then\n dec? := some (\u2190 fData.nontrivialDecomposition)\n match dec? with\n | some none =>\n if let some r \u2190 tryTheorem? e thm.thmOrigin funProp then\n return r\n | some (some (f, g)) =>\n trace[Meta.Tactic.fun_prop]\n s!\"decomposing to later use {\u2190ppOrigin' thm.thmOrigin} as:\n ({\u2190 ppExpr f}) \u2218 ({\u2190 ppExpr g})\"\n if let some r \u2190 applyCompRule funPropDecl e f g funProp then\n return r\n | _ => continue\n else\n let some (f, g) \u2190 fData.decompositionOverArgs thm.mainArgs | continue\n trace[Meta.Tactic.fun_prop]\n s!\"decomposing to later use {\u2190ppOrigin' thm.thmOrigin} as:\n ({\u2190 ppExpr f}) \u2218 ({\u2190 ppExpr g})\"\n if let some r \u2190 applyCompRule funPropDecl e f g funProp then\n return r\n -- todo: decompose if uncurried and arguments do not match exactly\n return none\n\n/-- Prove function property of `fun x \u21a6 f x\u2081 ... x\u2099` where `f` is free variable. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Tactic.FunProp.Core.applyConstRule (L195-L214)\ndef applyConstRule (funPropDecl : FunPropDecl) (e : Expr)\n (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\nlet thms \u2190 getLambdaTheorems funPropDecl.funPropName .const\n if thms.size = 0 then\n let msg := s!\"missing constant rule to prove `{\u2190 ppExpr e}`\"\n logError msg\n trace[Meta.Tactic.fun_prop] msg\n return none\n for thm in thms do\n let .const := thm.thmArgs | return none\n if let some r \u2190 tryTheorem? e (.decl thm.thmName) funProp then\n return r\n\n return none\n\n/--\nTry to prove `e` using the *apply lambda theorem*.\n\nFor example, `e = q(Continuous fun f \u21a6 f x)` and `funPropDecl` is `FunPropDecl` for `Continuous`.\n-/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Tactic.FunProp.Core.removeArgRule (L371-L388)\ndef removeArgRule (funPropDecl : FunPropDecl) (e : Expr) (fData : FunctionData)\n (funProp : Expr \u2192 FunPropM (Option Result)) :\n FunPropM (Option Result) := do\nmatch h : fData.args.size with\n | 0 => throwError \"fun_prop bug: invalid use of remove arg case {\u2190ppExpr e}\"\n | n + 1 =>\n let arg := fData.args[n]\n\n if arg.coe.isSome then\n -- if have to apply morphisms rules if we deal with morphisms\n return \u2190 applyMorRules funPropDecl e fData funProp\n else\n let some (f, g) \u2190 fData.peeloffArgDecomposition | return none\n applyCompRule funPropDecl e f g funProp\n\n\n/-- Prove function property of `fun f \u21a6 f x\u2081 ... x\u2099`. -/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Tactic.FunProp.Elab.funPropTac (L68-L179)\ndef funPropTac : Tactic\n | `(tactic| fun_prop $cfg:optConfig $[$d]? $[[$names,*]]?) => do\n\n let goal \u2190 getMainGoal\n goal.withContext do\n let goalType \u2190 goal.getType\n\n -- the whnf and telescope is here because the goal can be\n -- `\u2200 y, let f := fun x => x + y; Continuous fun x => x + f x`\n-- However it is still not complete solution. How should we deal with mix of let and forall?\n withReducible <| forallTelescopeReducing (\u2190 whnfR goalType) fun _ type => do\n unless (\u2190 getFunProp? type).isSome do\n let hint :=\n if let some n := type.getAppFn.constName?\n then s!\" Maybe you forgot marking `{n}` with `@[fun_prop]`.\"\n else \"\"\n throwError \"`{\u2190 ppExpr type}` is not a `fun_prop` goal!{hint}\"\n\n let cfg \u2190 elabFunPropConfig cfg\n\n let disch \u2190 show MetaM (Expr \u2192 MetaM (Option Expr)) from do\n match d with\n | none => pure emptyDischarge\n | some d =>\n match d with\n | `(discharger| (discharger:=$tac)) => pure <| tacticToDischarge (\u2190 `(tactic| ($tac)))\n | _ => pure emptyDischarge\n\n let namesToUnfold : Array Name :=\n match names with\n | none => #[]\n | some ns => ns.getElems.map (fun n => n.getId)\n\n let namesToUnfold := namesToUnfold.append defaultNamesToUnfold\n\n let ctx : Context :=\n { config := cfg,\n disch := disch\n constToUnfold := .ofArray namesToUnfold _}\n let env \u2190 getEnv\n let s := {\n morTheorems := morTheoremsExt.getState env\n transitionTheorems := transitionTheoremsExt.getState env }\n let (r?, s) \u2190 funProp goalType ctx |>.run s\n if let some r := r? then\n goal.assign r.proof\n else\n let mut msg := s!\"`fun_prop` was unable to prove `{\u2190 Meta.ppExpr goalType}`\\n\\n\"\n\n msg := msg ++ \"Issues:\"\n msg := s.msgLog.foldl (init := msg) (fun msg m => msg ++ \"\\n \" ++ m)\n\n throwError msg\n\n | _ => throwUnsupportedSyntax\n\n\n\n/-- Command that prints all function properties attached to a function.\n\nFor example\n```\n#print_fun_prop_theorems HAdd.hAdd\n```\nmight print out\n```\nContinuous\n continuous_add, args: [4,5], priority: 1000\n continuous_const_add, args: [5], priority: 1000\n continuous_add_const, args [4], priority: 1000\n ...\nDifferentiable\n Differentiable.add, args: [4,5], priority: 1000\n Differentiable.add_const, args: [4], priority: 1000\n Differentiable.const_add, args: [5], priority: 1000\n ...\n```\n\nYou can also see only theorems about a concrete function property\n```\n#print_fun_prop_theorems HAdd.hAdd Continuous\n```\n-/\nelab \"#print_fun_prop_theorems \" funIdent:ident funProp:(ident)? : command => do\n\n let funName \u2190 ensureNonAmbiguous funIdent (\u2190 resolveGlobalConst funIdent)\n let funProp? \u2190 funProp.mapM (fun stx => do\n ensureNonAmbiguous stx (\u2190 resolveGlobalConst stx))\n\n let theorems := (functionTheoremsExt.getState (\u2190 getEnv)).theorems.getD funName {}\n\n let logTheorems (funProp : Name) (thms : Array FunctionTheorem) : Command.CommandElabM Unit := do\n let mut msg : MessageData := \"\"\n msg := msg ++ m!\"{\u2190 Meta.ppOrigin (.decl funProp)}\"\n for thm in thms do\n msg := msg ++ m!\"\\n {\u2190 Meta.ppOrigin (.decl thm.thmOrigin.name)}, \\\n args: {thm.mainArgs}, form: {thm.form}\"\n pure ()\n logInfo msg\n\n\n match funProp? with\n | none =>\n for (funProp,thms) in theorems do\n logTheorems funProp thms\n | some funProp =>\n logTheorems funProp (theorems.getD funProp #[])\n\n\nend Meta.FunProp\n\nend Mathlib\n```\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.FunProp.Decl).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef isFunProp (e : Expr) : MetaM Bool\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Tactic.FunProp.Decl.FunPropDeclsExt (L45-L57)\nabbrev FunPropDeclsExt := SimpleScopedEnvExtension FunPropDecl FunPropDecls\n/-- Extension storing function properties tracked and used by the `fun_prop` attribute and tactic,\nincluding, for example, `Continuous`, `Measurable`, `Differentiable`, etc. -/\ninitialize funPropDeclsExt : FunPropDeclsExt \u2190\n registerSimpleScopedEnvExtension {\n name := by exact decl_name%\n initial := {}\n addEntry := fun d e =>\n {d with decls := d.decls.insertKeyValue e.path e}\n }\n\n/-- Register new function property. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Tactic.FunProp.Decl.addFunPropDecl (L58-L92)\ndef addFunPropDecl (declName : Name) : MetaM Unit := do\nlet info \u2190 getConstInfo declName\n\n let (xs, bi, b) \u2190 forallMetaTelescope info.type\n\n if \u00acb.isProp then\n throwError \"invalid fun_prop declaration, has to be `Prop`-valued function\"\n\n let lvls := info.levelParams.map (fun l => Level.param l)\n let e := mkAppN (.const declName lvls) xs\n let path \u2190 DiscrTree.mkPath e\n\n -- find the argument position of the function `f` in `P f`\n let mut some funArgId \u2190 (xs.zip bi).findIdxM? fun (x,bi) => do\n if (\u2190 inferType x).isForall && bi.isExplicit then\n return true\n else\n return false\n | throwError \"invalid fun_prop declaration, can't find argument of type `\u03b1 \u2192 \u03b2`\"\n\n let decl : FunPropDecl := {\n funPropName := declName\n path := path\n funArgId := funArgId\n }\n\n modifyEnv fun env => funPropDeclsExt.addEntry env decl\n\n trace[Meta.Tactic.fun_prop.attr]\n \"added new function property `{declName}`\\nlook up pattern is `{path}`\"\n\n\n/-- Is `e` a function property statement? If yes return function property declaration and\nthe function it talks about. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Tactic.FunProp.Decl.getFunProp (L93-L111)\ndef getFunProp? (e : Expr) : MetaM (Option (FunPropDecl \u00d7 Expr)) := do\nlet ext := funPropDeclsExt.getState (\u2190 getEnv)\n\n let decls \u2190 ext.decls.getMatch e (\u2190 read)\n\n if h : decls.size = 0 then\n return none\n else\n if decls.size > 1 then\n throwError \"fun_prop bug: expression {\u2190 ppExpr e} matches multiple function properties\\n\\\n {decls.map (fun d => d.funPropName)}\"\n\n let decl := decls[0]\n unless decl.funArgId < e.getAppNumArgs do return none\n let f := e.getArg! decl.funArgId\n\n return (decl,f)\n\n/-- Is `e` a function property statement? -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Tactic.FunProp.Decl.isFunPropGoal (L115-L119)\ndef isFunPropGoal (e : Expr) : MetaM Bool := do\nforallTelescope e fun _ b =>\n return (\u2190 getFunProp? b).isSome\n\n/-- Returns function property declaration from `e = P f`. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Tactic.FunProp.Decl.getFunPropDecl (L120-L126)\ndef getFunPropDecl? (e : Expr) : MetaM (Option FunPropDecl) := do\nmatch \u2190 getFunProp? e with\n | some (decl, _) => return decl\n | none => return none\n\n\n/-- Returns function `f` from `e = P f` and `P` is function property. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Tactic.FunProp.Decl.getFunPropFun (L127-L134)\ndef getFunPropFun? (e : Expr) : MetaM (Option Expr) := do\nmatch \u2190 getFunProp? e with\n | some (_, f) => return f\n | none => return none\n\n\nopen Elab Term in\n/-- Turn tactic syntax into a discharger function. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Tactic.FunProp.Decl.tacticToDischarge (L135-L160)\ndef tacticToDischarge (tacticCode : TSyntax `tactic) : Expr \u2192 MetaM (Option Expr) := fun e =>\nwithTraceNode `Meta.Tactic.fun_prop\n (fun _ => do pure s!\"discharging: {\u2190 ppExpr e}\") do\n let mvar \u2190 mkFreshExprSyntheticOpaqueMVar e `funProp.discharger\n let runTac? : TermElabM (Option Expr) :=\n try\n instantiateMVarDeclMVars mvar.mvarId!\n\n let _ \u2190\n withSynthesize (postpone := .no) do\n Tactic.run mvar.mvarId! (Tactic.evalTactic tacticCode *> Tactic.pruneSolvedGoals)\n\n let result \u2190 instantiateMVars mvar\n if result.hasExprMVar then\n return none\n else\n return some result\n catch _ =>\n return none\n let (result?, _) \u2190 runTac?.run {} {}\n\n return result?\n\nend Meta.FunProp\n\nend Mathlib\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Tactic.FunProp.Core.bvarAppCase (L389-L402)\ndef bvarAppCase (funPropDecl : FunPropDecl) (e : Expr) (fData : FunctionData)\n (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\nif (\u2190 fData.isMorApplication) != .none then\n applyMorRules funPropDecl e fData funProp\n else\n if let some (f, g) \u2190 fData.nontrivialDecomposition then\n applyCompRule funPropDecl e f g funProp\n else\n applyApplyRule funPropDecl e funProp\n\n/--\nGet candidate theorems from the environment for function property `funPropDecl` and\nfunction `funName`. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Tactic.FunProp.FunctionData.getFunctionData (L77-L118)\ndef getFunctionData (f : Expr) : MetaM FunctionData := do\nlambdaTelescope f fun xs b => do\n\n let xId := xs[0]!.fvarId!\n\n Mor.withApp b fun fn args => do\n\n let mut fn := fn\n let mut args := args\n\n -- revert projection in fn\n if let .proj n i x := fn then\n let some info := getStructureInfo? (\u2190 getEnv) n | unreachable!\n let some projName := info.getProjFn? i | unreachable!\n let p \u2190 mkAppM projName #[x]\n fn := p.getAppFn\n args := p.getAppArgs.map (fun a => {expr:=a}) ++ args\n\n let mainArgs := args\n |>.mapIdx (fun i \u27e8arg,_\u27e9 => if arg.containsFVar xId then some i else none)\n |>.filterMap id\n\n return {\n lctx := \u2190 getLCtx\n insts := \u2190 getLocalInstances\n fn := fn\n args := args\n mainVar := xs[0]!\n mainArgs := mainArgs\n }\n\n/-- Result of `getFunctionData?`. It returns function data if the function is in the form\n`fun x \u21a6 f y\u2081 ... y\u2099`. Two other cases are `fun x \u21a6 let y := ...` or `fun x y \u21a6 ...` -/\ninductive MaybeFunctionData where\n /-- Can't generate function data as function body has let binder. -/\n | letE (f : Expr)\n /-- Can't generate function data as function body has lambda binder. -/\n | lam (f : Expr)\n /-- Function data has been successfully generated. -/\n | data (fData : FunctionData)\n\n/-- Turn `MaybeFunctionData` to the function. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Tactic.FunProp.Core.applyCompRule (L231-L253)\ndef applyCompRule (funPropDecl : FunPropDecl) (e f g : Expr)\n (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\nlet thms \u2190 getLambdaTheorems funPropDecl.funPropName .comp\n if thms.size = 0 then\n let msg := s!\"missing composition rule to prove `{\u2190 ppExpr e}`\"\n logError msg\n trace[Meta.Tactic.fun_prop] msg\n return none\n\n for thm in thms do\n let .comp id_f id_g := thm.thmArgs | return none\n if let some r \u2190 tryTheoremWithHint? e (.decl thm.thmName) #[(id_f, f), (id_g, g)] funProp then\n return r\n\n return none\n\n/--\nTry to prove `e` using *pi lambda theorem*.\n\nFor example, `e = q(Continuous fun x y \u21a6 f x y)` and `funPropDecl` is `FunPropDecl` for\n`Continuous`\n-/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Tactic.FunProp.Core.synthesizeArgs (L50-L106)\ndef synthesizeArgs (thmId : Origin) (xs : Array Expr)\n (funProp : Expr \u2192 FunPropM (Option Result)) :\n FunPropM Bool := do\nlet mut postponed : Array Expr := #[]\n for x in xs do\n let type \u2190 inferType x\n if (\u2190 instantiateMVars x).isMVar then\n\n -- try type class\n if (\u2190 isClass? type).isSome then\n if (\u2190 synthesizeInstance thmId x type) then\n continue\n else if (\u2190 isFunPropGoal type) then\n -- try function property\n if let some \u27e8proof\u27e9 \u2190 funProp type then\n if (\u2190 isDefEq x proof) then\n continue\n else do\n trace[Meta.Tactic.fun_prop]\n \"{\u2190 ppOrigin thmId}, failed to assign proof{indentExpr type}\"\n return false\n else\n -- try user provided discharger\n let ctx : Context \u2190 read\n if (\u2190 isProp type) then\n if let some proof \u2190 ctx.disch type then\n if (\u2190 isDefEq x proof) then\n continue\n else do\n trace[Meta.Tactic.fun_prop]\n \"{\u2190 ppOrigin thmId}, failed to assign proof{indentExpr type}\"\n return false\n else\n logError s!\"Failed to prove necessary assumption `{\u2190 ppExpr type}` \\\n when applying theorem `{\u2190 ppOrigin' thmId}`.\"\n\n if \u00ac(\u2190 isProp type) then\n postponed := postponed.push x\n continue\n else\n trace[Meta.Tactic.fun_prop]\n \"{\u2190 ppOrigin thmId}, failed to discharge hypotheses{indentExpr type}\"\n return false\n\n for x in postponed do\n if (\u2190 instantiateMVars x).isMVar then\n logError s!\"Failed to infer `({\u2190 ppExpr x} : {\u2190 ppExpr (\u2190 inferType x)})` \\\n when applying theorem `{\u2190 ppOrigin' thmId}`.\"\n\n trace[Meta.Tactic.fun_prop]\n \"{\u2190 ppOrigin thmId}, failed to infer `({\u2190 ppExpr x} : {\u2190 ppExpr (\u2190 inferType x)})`\"\n return false\n\n return true\n\n\n/-- Try to apply theorem - core function -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Tactic.FunProp.Core.cacheResult (L615-L619)\ndef cacheResult (e : Expr) (r : Result) : FunPropM Result := do -- return proof?\nmodify (fun s => { s with cache := s.cache.insert e { expr := q(True), proof? := r.proof} })\n return r\n\n/-- Cache for failed goals such that `fun_prop` can fail fast next time. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Tactic.FunProp.Core.letCase (L279-L320)\ndef letCase (funPropDecl : FunPropDecl) (e : Expr) (f : Expr)\n (funProp : Expr \u2192 FunPropM (Option Result)) :\n FunPropM (Option Result) := do\nmatch f with\n | .lam xName xType (.letE yName yType yValue yBody _) xBi => do\n let yType := yType.consumeMData\n let yValue := yValue.consumeMData\n let yBody := yBody.consumeMData\n -- We perform reduction because the type is quite often of the form\n -- `(fun x \u21a6 Y) #0` which is just `Y`\n -- Usually this is caused by the usage of `FunLike`\n let yType := yType.headBeta\n if (yType.hasLooseBVar 0) then\n throwError \"dependent type encountered {\u2190 ppExpr (Expr.forallE xName xType yType default)}\"\n\n -- let binding can be pulled out of the lambda function\n if \u00ac(yValue.hasLooseBVar 0) then\n let body := yBody.swapBVars 0 1\n let e' := mkLet yName yType yValue\n (e.setArg (funPropDecl.funArgId) (.lam xName xType body xBi))\n return \u2190 funProp e'\n\n match (yBody.hasLooseBVar 0), (yBody.hasLooseBVar 1) with\n | true, true =>\n let f \u2190 mkUncurryFun 2 (Expr.lam xName xType (.lam yName yType yBody default) xBi)\n let g := Expr.lam xName xType (binderInfo := default)\n (mkAppN (\u2190 mkConstWithFreshMVarLevels ``Prod.mk) #[xType,yType,.bvar 0, yValue])\n applyCompRule funPropDecl e f g funProp\n\n | true, false =>\n let f := Expr.lam yName yType yBody default\n let g := Expr.lam xName xType yValue default\n applyCompRule funPropDecl e f g funProp\n\n | false, _ =>\n let f := Expr.lam xName xType (yBody.lowerLooseBVars 1 1) xBi\n funProp (e.setArg (funPropDecl.funArgId) f)\n\n | _ => throwError \"expected expression of the form `fun x \u21a6 lam y := ..; ..`\"\n\n\n/-- Prove function property of using *morphism theorems*. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Tactic.FunProp.Core.getDeclTheorems (L403-L422)\ndef getDeclTheorems (funPropDecl : FunPropDecl) (funName : Name)\n (mainArgs : Array Nat) (appliedArgs : Nat) : MetaM (Array FunctionTheorem) := do\nlet thms \u2190 getTheoremsForFunction funName funPropDecl.funPropName\n\n let thms := thms\n |>.filter (fun thm => (isOrderedSubsetOf mainArgs thm.mainArgs))\n |>.qsort (fun t s =>\n let dt := (Int.ofNat t.appliedArgs - Int.ofNat appliedArgs).natAbs\n let ds := (Int.ofNat s.appliedArgs - Int.ofNat appliedArgs).natAbs\n match compare dt ds with\n | .lt => true\n | .gt => false\n | .eq => t.mainArgs.size < s.mainArgs.size)\n -- todo: sorting and filtering\n return thms\n\n/--\nGet candidate theorems from the local context for function property `funPropDecl` and\nfunction `funName`. -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Tactic.FunProp.Core.applyMorRules (L321-L346)\ndef applyMorRules (funPropDecl : FunPropDecl) (e : Expr) (fData : FunctionData)\n (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\ntrace[Debug.Meta.Tactic.fun_prop] \"applying morphism theorems to {\u2190 ppExpr e}\"\n\n match \u2190 fData.isMorApplication with\n | .none => throwError \"fun_prop bug: invalid use of mor rules on {\u2190 ppExpr e}\"\n | .underApplied =>\n applyPiRule funPropDecl e funProp\n | .overApplied =>\n let some (f, g) \u2190 fData.peeloffArgDecomposition | return none\n applyCompRule funPropDecl e f g funProp\n | .exact =>\n\n let candidates \u2190 getMorphismTheorems e\n\n trace[Meta.Tactic.fun_prop]\n \"candidate morphism theorems: {\u2190 candidates.mapM fun c => ppOrigin (.decl c.thmName)}\"\n\n for c in candidates do\n if let some r \u2190 tryTheorem? e (.decl c.thmName) funProp then\n return r\n\n trace[Debug.Meta.Tactic.fun_prop] \"no theorem matched\"\n return none\n\n/-- Prove function property of using *transition theorems*. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Tactic.FunProp.Core.constAppCase (L565-L614)\ndef constAppCase (funPropDecl : FunPropDecl) (e : Expr) (fData : FunctionData)\n (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\nlet some (funName, _) := fData.fn.const?\n | throwError \"fun_prop bug: invelid use of const app case\"\n let globalThms \u2190 getDeclTheorems funPropDecl funName fData.mainArgs fData.args.size\n\n trace[Meta.Tactic.fun_prop]\n s!\"candidate theorems for {funName} {\u2190 globalThms.mapM fun thm => ppOrigin' thm.thmOrigin}\"\n\n if let some r \u2190 tryTheorems funPropDecl e fData globalThms funProp then\n return r\n\n -- Try local theorems - this is useful for recursive functions\n let localThms \u2190 getLocalTheorems funPropDecl (.decl funName) fData.mainArgs fData.args.size\n if localThms.size \u2260 0 then\n trace[Meta.Tactic.fun_prop]\n s!\"candidate local theorems for {funName} \\\n {\u2190 localThms.mapM fun thm => ppOrigin' thm.thmOrigin}\"\n if let some r \u2190 tryTheorems funPropDecl e fData localThms funProp then\n return r\n\n -- log error if no global or local theorems were found\n if globalThms.size = 0 && localThms.size = 0 then\n logError s!\"No theorems found for `{funName}` in order to prove `{\u2190 ppExpr e}`\"\n\n if (\u2190 fData.isMorApplication) != .none then\n if let some r \u2190 applyMorRules funPropDecl e fData funProp then\n return r\n\n if let some (f, g) \u2190 fData.nontrivialDecomposition then\n trace[Meta.Tactic.fun_prop]\n s!\"failed applying `{funPropDecl.funPropName}` theorems for `{funName}`\n trying again after decomposing function as: `({\u2190 ppExpr f}) \u2218 ({\u2190 ppExpr g})`\"\n\n if let some r \u2190 applyCompRule funPropDecl e f g funProp then\n return r\n else\n trace[Meta.Tactic.fun_prop]\n s!\"failed applying `{funPropDecl.funPropName}` theorems for `{funName}`\n now trying to prove `{funPropDecl.funPropName}` from another function property\"\n\n if let some r \u2190 applyTransitionRules e funProp then\n return r\n\n\n return none\n\n\n/-- Cache result if it does not have any subgoals. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Tactic.FunProp.Core.applyApplyRule (L215-L230)\ndef applyApplyRule (funPropDecl : FunPropDecl) (e : Expr)\n (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\nlet thms := (\u2190 getLambdaTheorems funPropDecl.funPropName .apply)\n for thm in thms do\n if let some r \u2190 tryTheoremWithHint? e (.decl thm.thmName) #[] funProp then\n return r\n\n return none\n\n/--\nTry to prove `e` using *composition lambda theorem*.\n\nFor example, `e = q(Continuous fun x \u21a6 f (g x))` and `funPropDecl` is `FunPropDecl` for\n`Continuous`\n\nYou also have to provide the functions `f` and `g`. -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Tactic.FunProp.Core.applyIdRule (L175-L194)\ndef applyIdRule (funPropDecl : FunPropDecl) (e : Expr)\n (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\nlet thms \u2190 getLambdaTheorems funPropDecl.funPropName .id\n if thms.size = 0 then\n let msg := s!\"missing identity rule to prove `{\u2190 ppExpr e}`\"\n logError msg\n trace[Meta.Tactic.fun_prop] msg\n return none\n\n for thm in thms do\n if let some r \u2190 tryTheoremWithHint? e (.decl thm.thmName) #[] funProp then\n return r\n\n return none\n\n/--\nTry to prove `e` using the *constant lambda theorem*.\n\nFor example, `e = q(Continuous fun x \u21a6 y)` and `funPropDecl` is `FunPropDecl` for `Continuous`.\n-/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Tactic.FunProp.Core.getLocalTheorems (L423-L473)\ndef getLocalTheorems (funPropDecl : FunPropDecl) (funOrigin : Origin)\n (mainArgs : Array Nat) (appliedArgs : Nat) : FunPropM (Array FunctionTheorem) := do\nlet mut thms : Array FunctionTheorem := #[]\n let lctx \u2190 getLCtx\n for var in lctx do\n if (var.kind = Lean.LocalDeclKind.auxDecl) then\n continue\n let type \u2190 instantiateMVars var.type\n let thm? : Option FunctionTheorem \u2190\n forallTelescope type fun _ b => do\n let b \u2190 whnfR b\n let some (decl, f) \u2190 getFunProp? b | return none\n unless decl.funPropName = funPropDecl.funPropName do return none\n\n let .data fData \u2190 getFunctionData? f (\u2190 unfoldNamePred)\n | return none\n unless (fData.getFnOrigin == funOrigin) do return none\n\n unless isOrderedSubsetOf mainArgs fData.mainArgs do return none\n\n let dec? \u2190 fData.nontrivialDecomposition\n\n let thm : FunctionTheorem := {\n funPropName := funPropDecl.funPropName\n thmOrigin := .fvar var.fvarId\n funOrigin := funOrigin\n mainArgs := fData.mainArgs\n appliedArgs := fData.args.size\n priority := eval_prio default\n form := if dec?.isSome then .comp else .uncurried\n }\n\n return some thm\n\n if let some thm := thm? then\n thms := thms.push thm\n\n thms := thms\n |>.qsort (fun t s =>\n let dt := (Int.ofNat t.appliedArgs - Int.ofNat appliedArgs).natAbs\n let ds := (Int.ofNat s.appliedArgs - Int.ofNat appliedArgs).natAbs\n match compare dt ds with\n | .lt => true\n | .gt => false\n | .eq => t.mainArgs.size < s.mainArgs.size)\n\n return thms\n\n\n/-- Try to apply *function theorems* `thms` to `e`. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Tactic.FunProp.Core.tryTheoremCore (L107-L124)\ndef tryTheoremCore (xs : Array Expr) (val : Expr) (type : Expr) (e : Expr)\n (thmId : Origin) (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\nwithTraceNode `Meta.Tactic.fun_prop\n (fun _ => return s!\"applying: {\u2190 ppOrigin' thmId}\") do\n\n if (\u2190 isDefEq type e) then\n\n if \u00ac(\u2190 synthesizeArgs thmId xs funProp) then\n return none\n let proof \u2190 instantiateMVars (mkAppN val xs)\n\n return some { proof := proof }\n else\n trace[Meta.Tactic.fun_prop] \"failed to unify {\u2190 ppOrigin thmId}\\n{type}\\nwith\\n{e}\"\n return none\n\n\n/-- Try to apply a theorem provided some of the theorem arguments. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Tactic.FunProp.Core.applyPiRule (L254-L278)\ndef applyPiRule (funPropDecl : FunPropDecl) (e : Expr)\n (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\nlet thms \u2190 getLambdaTheorems funPropDecl.funPropName .pi\n if thms.size = 0 then\n let msg := s!\"missing pi rule to prove `{\u2190 ppExpr e}`\"\n logError msg\n trace[Meta.Tactic.fun_prop] msg\n return none\n\n for thm in thms do\n if let some r \u2190 tryTheoremWithHint? e (.decl thm.thmName) #[] funProp then\n return r\n\n return none\n\n\n/--\nTry to prove `e = q(P (fun x \u21a6 let y := \u03c6 x; \u03c8 x y)`.\n\nFor example,\n - `funPropDecl` is `FunPropDecl` for `Continuous`\n - `e = q(Continuous fun x \u21a6 let y := \u03c6 x; \u03c8 x y)`\n - `f = q(fun x \u21a6 let y := \u03c6 x; \u03c8 x y)`\n-/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Tactic.FunProp.Core.applyTransitionRules (L347-L370)\ndef applyTransitionRules (e : Expr) (funProp : Expr \u2192 FunPropM (Option Result)) :\n FunPropM (Option Result) := do\nwithIncreasedTransitionDepth do\n\n let candidates \u2190 getTransitionTheorems e\n\n trace[Meta.Tactic.fun_prop]\n \"candidate transition theorems: {\u2190 candidates.mapM fun c => ppOrigin (.decl c.thmName)}\"\n\n for c in candidates do\n if let some r \u2190 tryTheorem? e (.decl c.thmName) funProp then\n return r\n\n trace[Debug.Meta.Tactic.fun_prop] \"no theorem matched\"\n return none\n\n/-- Try to remove applied argument i.e. prove `P (fun x \u21a6 f x y)` from `P (fun x \u21a6 f x)`.\n\nFor example\n - `funPropDecl` is `FunPropDecl` for `Continuous`\n - `e = q(Continuous fun x \u21a6 foo (bar x) y)`\n - `fData` contains info on `fun x \u21a6 foo (bar x) y`\n This tries to prove `Continuous fun x \u21a6 foo (bar x) y` from `Continuous fun x \u21a6 foo (bar x)`\n-/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Tactic.FunProp.Core.synthesizeInstance (L31-L49)\ndef synthesizeInstance (thmId : Origin) (x type : Expr) : MetaM Bool := do\nmatch (\u2190 trySynthInstance type) with\n | .some val =>\n if (\u2190 withReducibleAndInstances <| isDefEq x val) then\n return true\n else\n trace[Meta.Tactic.fun_prop]\n\"{\u2190 ppOrigin thmId}, failed to assign instance{indentExpr type}\nsynthesized value{indentExpr val}\\nis not definitionally equal to{indentExpr x}\"\n return false\n | _ =>\n trace[Meta.Tactic.fun_prop]\n \"{\u2190 ppOrigin thmId}, failed to synthesize instance{indentExpr type}\"\n return false\n\n\n\n/-- Synthesize arguments `xs` either with typeclass synthesis, with `fun_prop` or with\ndischarger. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Tactic.FunProp.FunctionData.FunctionData (L44-L49)\ndef FunctionData.toExpr (f : FunctionData) : MetaM Expr := do\nwithLCtx f.lctx f.insts do\n let body := Mor.mkAppN f.fn f.args\n mkLambdaFVars #[f.mainVar] body\n\n/-- Is `f` an identity function? -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Tactic.FunProp.Core.fvarAppCase (L529-L564)\ndef fvarAppCase (funPropDecl : FunPropDecl) (e : Expr) (fData : FunctionData)\n (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\n-- fvar theorems are almost exclusively in uncurried form so we decompose if we can\n if let some (f, g) \u2190 fData.nontrivialDecomposition then\n applyCompRule funPropDecl e f g funProp\n else\n let .fvar id := fData.fn | throwError \"fun_prop bug: invalid use of fvar app case\"\n let thms \u2190 getLocalTheorems funPropDecl (.fvar id) fData.mainArgs fData.args.size\n trace[Meta.Tactic.fun_prop]\n s!\"candidate local theorems for {\u2190ppExpr (.fvar id)} \\\n {\u2190 thms.mapM fun thm => ppOrigin' thm.thmOrigin}\"\n\n if let some r \u2190 tryTheorems funPropDecl e fData thms funProp then\n return r\n\n if let some f \u2190 fData.unfoldHeadFVar? then\n let e' := e.setArg funPropDecl.funArgId f\n if let some r \u2190 funProp e' then\n return r\n\n if (\u2190 fData.isMorApplication) != .none then\n if let some r \u2190 applyMorRules funPropDecl e fData funProp then\n return r\n\n if (\u2190 fData.nontrivialDecomposition).isNone then\n if let some r \u2190 applyTransitionRules e funProp then\n return r\n\n if thms.size = 0 then\n logError s!\"No theorems found for `{\u2190 ppExpr (.fvar id)}` in order to prove `{\u2190 ppExpr e}`\"\n\n return none\n\n\n/-- Prove function property of `fun x \u21a6 f x\u2081 ... x\u2099` where `f` is declared function. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Tactic.FunProp.Core.tryTheoremWithHint (L125-L164)\ndef tryTheoremWithHint? (e : Expr) (thmOrigin : Origin)\n (hint : Array (Nat \u00d7 Expr))\n (funProp : Expr \u2192 FunPropM (Option Result)) (newMCtxDepth : Bool := false) :\nFunPropM (Option Result) := do\n let go : FunPropM (Option Result) := do\n let thmProof \u2190 thmOrigin.getValue\n -- for `fvar`s we need to instantiate the metavariables of its type.\n let type \u2190 instantiateMVars <| \u2190 inferType thmProof\n let (xs, _, type) \u2190 forallMetaTelescope type\n\n for (i,x) in hint do\n try\n for (id,v) in hint do\n xs[id]!.mvarId!.assignIfDefEq v\n catch _ =>\n trace[Debug.Meta.Tactic.fun_prop]\n \"failed to use hint {i} `{\u2190 ppExpr x} when applying theorem {\u2190 ppOrigin thmOrigin}\"\n\n tryTheoremCore xs thmProof type e thmOrigin funProp\n\n -- `simp` introduces new meta variable context depth for some reason\n -- This is probably to avoid mvar assignment when trying a theorem fails\n --\n -- However, in `fun_prop` case this is not completely desirable\n -- For example, I want to be able to solve a goal with mvars like `ContDiff \u211d ?n f` using local\n -- hypothesis `(h : ContDiff \u211d \u221e f)` and assign `\u221e` to the mvar `?n`.\n --\n -- This could be problematic if there are two local hypothesis `(hinf : ContDiff \u211d \u221e f)` and\n -- `(h1 : ContDiff \u211d 1 f)` and apart from solving `ContDiff \u211d ?n f` there is also a subgoal\n -- `2 \u2264 ?n`. If `fun_prop` decides to try `h1` first it would assign `1` to `?n` and then there\n -- is no hope solving `2 \u2264 1` and it won't be able to apply `hinf` after trying `h1` as `n?` is\n -- assigned already. Ideally `fun_prop` would roll back the `MetaM.State`. This issue did not\n -- come up yet so I didn't bother and I'm worried about the performance impact.\n if newMCtxDepth then\n withNewMCtxDepth go\n else\n go\n\n\n/-- Try to apply a theorem `thmOrigin` to the goal `e`. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Tactic.FunProp.Core.tryTheorem (L165-L174)\ndef tryTheorem? (e : Expr) (thmOrigin : Origin) (funProp : Expr \u2192 FunPropM (Option Result))\n (newMCtxDepth : Bool := false) : FunPropM (Option Result) :=\ntryTheoremWithHint? e thmOrigin #[] funProp newMCtxDepth\n\n\n/--\nTry to prove `e` using the *identity lambda theorem*.\n\nFor example, `e = q(Continuous fun x \u21a6 x)` and `funPropDecl` is `FunPropDecl` for `Continuous`.\n-/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Tactic.FunProp.Core.cacheFailure (L620-L702)\ndef cacheFailure (e : Expr) : FunPropM Unit := do -- return proof?\nmodify (fun s => { s with failureCache := s.failureCache.insert e })\n\n\nmutual\n /-- Main `funProp` function. Returns proof of `e`. -/\n partial def funProp (e : Expr) : FunPropM (Option Result) := do\n\n let e \u2190 instantiateMVars e\n\n withTraceNode `Meta.Tactic.fun_prop\n (fun _ => do pure s!\"{\u2190 ppExpr e}\") do\n\n -- check cache for successful goals\n if let some { expr := _, proof? := some proof } := (\u2190 get).cache.find? e then\n trace[Meta.Tactic.fun_prop] \"reusing previously found proof for {e}\"\n return some { proof := proof }\n else if (\u2190 get).failureCache.contains e then\n trace[Meta.Tactic.fun_prop] \"skipping proof search, proving {e} was tried already and failed\"\n return none\n else\n -- take care of forall and let binders and run main\n match e with\n | .letE .. =>\n letTelescope e fun xs b => do\n let some r \u2190 funProp b\n | return none\n cacheResult e {proof := \u2190 mkLambdaFVars (generalizeNondepLet := false) xs r.proof }\n | .forallE .. =>\n forallTelescope e fun xs b => do\n let some r \u2190 funProp b\n | return none\n cacheResult e {proof := \u2190 mkLambdaFVars xs r.proof }\n | .mdata _ e' => funProp e'\n | _ =>\n if let some r \u2190 main e then\n cacheResult e r\n else\n cacheFailure e\n return none\n\n\n /-- Main `funProp` function. Returns proof of `e`. -/\n private partial def main (e : Expr) : FunPropM (Option Result) := do\n\n let some (funPropDecl, f) \u2190 getFunProp? e\n | return none\n\n increaseSteps\n\n -- if function starts with let bindings move them the top of `e` and try again\n if f.isLet then\n return \u2190 funProp (\u2190 mapLetTelescope f fun _ b => pure <| e.setArg funPropDecl.funArgId b)\n\n match \u2190 getFunctionData? f (\u2190 unfoldNamePred) with\n | .letE f =>\n trace[Debug.Meta.Tactic.fun_prop] \"let case on {\u2190 ppExpr f}\"\n let e := e.setArg funPropDecl.funArgId f -- update e with reduced f\n letCase funPropDecl e f funProp\n | .lam f =>\n trace[Debug.Meta.Tactic.fun_prop] \"pi case on {\u2190 ppExpr f}\"\n let e := e.setArg funPropDecl.funArgId f -- update e with reduced f\n applyPiRule funPropDecl e funProp\n | .data fData =>\n let e := e.setArg funPropDecl.funArgId (\u2190 fData.toExpr) -- update e with reduced f\n\n if fData.isIdentityFun then\n applyIdRule funPropDecl e funProp\n else if fData.isConstantFun then\n applyConstRule funPropDecl e funProp\n else\n match fData.fn with\n | .fvar id =>\n if id == fData.mainVar.fvarId! then\n bvarAppCase funPropDecl e fData funProp\n else\n fvarAppCase funPropDecl e fData funProp\n | .const .. | .proj .. => do\n constAppCase funPropDecl e fData funProp\n | _ =>\n trace[Debug.Meta.Tactic.fun_prop] \"unknown case, ctor: {f.ctorName}\\n{e}\"\n return none\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Tactic.FunProp.Core.tryTheorems (L474-L528)\ndef tryTheorems (funPropDecl : FunPropDecl) (e : Expr) (fData : FunctionData)\n (thms : Array FunctionTheorem) (funProp : Expr \u2192 FunPropM (Option Result)) :\n FunPropM (Option Result) := do\n-- none - decomposition not tried\n -- some none - decomposition failed\n -- some some (f, g) - successful decomposition\n let mut dec? : Option (Option (Expr \u00d7 Expr)) := none\n\n for thm in thms do\n\n trace[Debug.Meta.Tactic.fun_prop] s!\"trying theorem {\u2190 ppOrigin' thm.thmOrigin}\"\n\n match compare thm.appliedArgs fData.args.size with\n | .lt =>\n trace[Meta.Tactic.fun_prop] s!\"removing argument to later use {\u2190 ppOrigin' thm.thmOrigin}\"\n if let some r \u2190 removeArgRule funPropDecl e fData funProp then\n return r\n continue\n | .gt =>\n trace[Meta.Tactic.fun_prop] s!\"adding argument to later use {\u2190 ppOrigin' thm.thmOrigin}\"\n if let some r \u2190 applyPiRule funPropDecl e funProp then\n return r\n continue\n | .eq =>\n if thm.form == .comp then\n if let some r \u2190 tryTheorem? e thm.thmOrigin funProp then\n return r\n else\n\n if thm.mainArgs.size == fData.mainArgs.size then\n if dec?.isNone then\n dec? := some (\u2190 fData.nontrivialDecomposition)\n match dec? with\n | some none =>\n if let some r \u2190 tryTheorem? e thm.thmOrigin funProp then\n return r\n | some (some (f, g)) =>\n trace[Meta.Tactic.fun_prop]\n s!\"decomposing to later use {\u2190ppOrigin' thm.thmOrigin} as:\n ({\u2190 ppExpr f}) \u2218 ({\u2190 ppExpr g})\"\n if let some r \u2190 applyCompRule funPropDecl e f g funProp then\n return r\n | _ => continue\n else\n let some (f, g) \u2190 fData.decompositionOverArgs thm.mainArgs | continue\n trace[Meta.Tactic.fun_prop]\n s!\"decomposing to later use {\u2190ppOrigin' thm.thmOrigin} as:\n ({\u2190 ppExpr f}) \u2218 ({\u2190 ppExpr g})\"\n if let some r \u2190 applyCompRule funPropDecl e f g funProp then\n return r\n -- todo: decompose if uncurried and arguments do not match exactly\n return none\n\n/-- Prove function property of `fun x \u21a6 f x\u2081 ... x\u2099` where `f` is free variable. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Tactic.FunProp.Core.applyConstRule (L195-L214)\ndef applyConstRule (funPropDecl : FunPropDecl) (e : Expr)\n (funProp : Expr \u2192 FunPropM (Option Result)) : FunPropM (Option Result) := do\nlet thms \u2190 getLambdaTheorems funPropDecl.funPropName .const\n if thms.size = 0 then\n let msg := s!\"missing constant rule to prove `{\u2190 ppExpr e}`\"\n logError msg\n trace[Meta.Tactic.fun_prop] msg\n return none\n for thm in thms do\n let .const := thm.thmArgs | return none\n if let some r \u2190 tryTheorem? e (.decl thm.thmName) funProp then\n return r\n\n return none\n\n/--\nTry to prove `e` using the *apply lambda theorem*.\n\nFor example, `e = q(Continuous fun f \u21a6 f x)` and `funPropDecl` is `FunPropDecl` for `Continuous`.\n-/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Tactic.FunProp.Core.removeArgRule (L371-L388)\ndef removeArgRule (funPropDecl : FunPropDecl) (e : Expr) (fData : FunctionData)\n (funProp : Expr \u2192 FunPropM (Option Result)) :\n FunPropM (Option Result) := do\nmatch h : fData.args.size with\n | 0 => throwError \"fun_prop bug: invalid use of remove arg case {\u2190ppExpr e}\"\n | n + 1 =>\n let arg := fData.args[n]\n\n if arg.coe.isSome then\n -- if have to apply morphisms rules if we deal with morphisms\n return \u2190 applyMorRules funPropDecl e fData funProp\n else\n let some (f, g) \u2190 fData.peeloffArgDecomposition | return none\n applyCompRule funPropDecl e f g funProp\n\n\n/-- Prove function property of `fun f \u21a6 f x\u2081 ... x\u2099`. -/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Tactic.FunProp.Elab.funPropTac (L68-L179)\ndef funPropTac : Tactic\n | `(tactic| fun_prop $cfg:optConfig $[$d]? $[[$names,*]]?) => do\n\n let goal \u2190 getMainGoal\n goal.withContext do\n let goalType \u2190 goal.getType\n\n -- the whnf and telescope is here because the goal can be\n -- `\u2200 y, let f := fun x => x + y; Continuous fun x => x + f x`\n-- However it is still not complete solution. How should we deal with mix of let and forall?\n withReducible <| forallTelescopeReducing (\u2190 whnfR goalType) fun _ type => do\n unless (\u2190 getFunProp? type).isSome do\n let hint :=\n if let some n := type.getAppFn.constName?\n then s!\" Maybe you forgot marking `{n}` with `@[fun_prop]`.\"\n else \"\"\n throwError \"`{\u2190 ppExpr type}` is not a `fun_prop` goal!{hint}\"\n\n let cfg \u2190 elabFunPropConfig cfg\n\n let disch \u2190 show MetaM (Expr \u2192 MetaM (Option Expr)) from do\n match d with\n | none => pure emptyDischarge\n | some d =>\n match d with\n | `(discharger| (discharger:=$tac)) => pure <| tacticToDischarge (\u2190 `(tactic| ($tac)))\n | _ => pure emptyDischarge\n\n let namesToUnfold : Array Name :=\n match names with\n | none => #[]\n | some ns => ns.getElems.map (fun n => n.getId)\n\n let namesToUnfold := namesToUnfold.append defaultNamesToUnfold\n\n let ctx : Context :=\n { config := cfg,\n disch := disch\n constToUnfold := .ofArray namesToUnfold _}\n let env \u2190 getEnv\n let s := {\n morTheorems := morTheoremsExt.getState env\n transitionTheorems := transitionTheoremsExt.getState env }\n let (r?, s) \u2190 funProp goalType ctx |>.run s\n if let some r := r? then\n goal.assign r.proof\n else\n let mut msg := s!\"`fun_prop` was unable to prove `{\u2190 Meta.ppExpr goalType}`\\n\\n\"\n\n msg := msg ++ \"Issues:\"\n msg := s.msgLog.foldl (init := msg) (fun msg m => msg ++ \"\\n \" ++ m)\n\n throwError msg\n\n | _ => throwUnsupportedSyntax\n\n\n\n/-- Command that prints all function properties attached to a function.\n\nFor example\n```\n#print_fun_prop_theorems HAdd.hAdd\n```\nmight print out\n```\nContinuous\n continuous_add, args: [4,5], priority: 1000\n continuous_const_add, args: [5], priority: 1000\n continuous_add_const, args [4], priority: 1000\n ...\nDifferentiable\n Differentiable.add, args: [4,5], priority: 1000\n Differentiable.add_const, args: [4], priority: 1000\n Differentiable.const_add, args: [5], priority: 1000\n ...\n```\n\nYou can also see only theorems about a concrete function property\n```\n#print_fun_prop_theorems HAdd.hAdd Continuous\n```\n-/\nelab \"#print_fun_prop_theorems \" funIdent:ident funProp:(ident)? : command => do\n\n let funName \u2190 ensureNonAmbiguous funIdent (\u2190 resolveGlobalConst funIdent)\n let funProp? \u2190 funProp.mapM (fun stx => do\n ensureNonAmbiguous stx (\u2190 resolveGlobalConst stx))\n\n let theorems := (functionTheoremsExt.getState (\u2190 getEnv)).theorems.getD funName {}\n\n let logTheorems (funProp : Name) (thms : Array FunctionTheorem) : Command.CommandElabM Unit := do\n let mut msg : MessageData := \"\"\n msg := msg ++ m!\"{\u2190 Meta.ppOrigin (.decl funProp)}\"\n for thm in thms do\n msg := msg ++ m!\"\\n {\u2190 Meta.ppOrigin (.decl thm.thmOrigin.name)}, \\\n args: {thm.mainArgs}, form: {thm.form}\"\n pure ()\n logInfo msg\n\n\n match funProp? with\n | none =>\n for (funProp,thms) in theorems do\n logTheorems funProp thms\n | some funProp =>\n logTheorems funProp (theorems.getD funProp #[])\n\n\nend Meta.FunProp\n\nend Mathlib\n```\n[/INST]", "sample_id": "C-Mathlib.Tactic.FunProp.Decl.isFunProp", "source": {"declaration": "Mathlib.Tactic.FunProp.Decl.isFunProp", "file": "Mathlib/Tactic/FunProp/Decl.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.FunProp.Decl", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/FunProp/Decl.lean#L112", "span": "L112-L114"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "lemma \u03c3_comp_toMk\u2081_of_lt {n : \u2115} (i : Fin (n + 2)) (j : Fin (n + 1)) (h : j.castSucc < i) :\n \u03c3 j \u226b toMk\u2081 i = toMk\u2081 i.succ\n:= by .someMissingNamespaceXYZ\nrefine ConcreteCategory.hom_ext _ _ (fun k \u21a6 ?_)\n change toMk\u2081 i (j.predAbove k) = _\n by_cases! hk : i < k\n \u00b7 grind [Fin.predAbove_of_castSucc_lt, toMk\u2081_of_le_castSucc]\n \u00b7 dsimp\n rw [toMk\u2081_of_castSucc_lt i.succ k (by simpa), toMk\u2081_of_castSucc_lt]\n by_cases hk' : j.castSucc < k\n \u00b7 rwa [Fin.predAbove_of_castSucc_lt _ _ hk', Fin.castSucc_pred_lt_iff]\n \u00b7 simp only [not_lt] at hk'\n rw [Fin.predAbove_of_le_castSucc _ _ hk']\n exact lt_of_le_of_lt (by simpa) h", "diagnostic": "[CompilationUnit(i_begin=0, i_end=106, messages=[Message(data='expected token', pos=Position(line=2, column=8), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n \u03c3\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n j\\n\\nHint: The identifier `\u03c3` 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=7), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=106, i_end=664, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]", "mutation_kind": "typeclass_instance", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 2124, "declarations_count": 266, "diagnostics_count": 1, "duplicate_fingerprint": "f435e513b48fd298", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 665, "lean_code_chars": 639, "lean_code_ratio": 0.3008, "length_bucket": "short", "line_count": 25, "natural_language_chars": 1485, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplexCategory.ToMkOne).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma \u03c3_comp_toMk\u2081_of_lt {n : \u2115} (i : Fin (n + 2)) (j : Fin (n + 1)) (h : j.castSucc < i) :\n \u03c3 j \u226b toMk\u2081 i = toMk\u2081 i.succ\n:= by .someMissingNamespaceXYZ\nrefine ConcreteCategory.hom_ext _ _ (fun k \u21a6 ?_)\n change toMk\u2081 i (j.predAbove k) = _\n by_cases! hk : i < k\n \u00b7 grind [Fin.predAbove_of_castSucc_lt, toMk\u2081_of_le_castSucc]\n \u00b7 dsimp\n rw [toMk\u2081_of_castSucc_lt i.succ k (by simpa), toMk\u2081_of_castSucc_lt]\n by_cases hk' : j.castSucc < k\n \u00b7 rwa [Fin.predAbove_of_castSucc_lt _ _ hk', Fin.castSucc_pred_lt_iff]\n \u00b7 simp only [not_lt] at hk'\n rw [Fin.predAbove_of_le_castSucc _ _ hk']\n exact lt_of_le_of_lt (by simpa) h\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=106, messages=[Message(data='expected token', pos=Position(line=2, column=8), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n \u03c3\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n j\\n\\nHint: The identifier `\u03c3` 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=7), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=106, i_end=664, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplexCategory.ToMkOne).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma \u03c3_comp_toMk\u2081_of_lt {n : \u2115} (i : Fin (n + 2)) (j : Fin (n + 1)) (h : j.castSucc < i) :\n \u03c3 j \u226b toMk\u2081 i = toMk\u2081 i.succ\n:= by .someMissingNamespaceXYZ\nrefine ConcreteCategory.hom_ext _ _ (fun k \u21a6 ?_)\n change toMk\u2081 i (j.predAbove k) = _\n by_cases! hk : i < k\n \u00b7 grind [Fin.predAbove_of_castSucc_lt, toMk\u2081_of_le_castSucc]\n \u00b7 dsimp\n rw [toMk\u2081_of_castSucc_lt i.succ k (by simpa), toMk\u2081_of_castSucc_lt]\n by_cases hk' : j.castSucc < k\n \u00b7 rwa [Fin.predAbove_of_castSucc_lt _ _ hk', Fin.castSucc_pred_lt_iff]\n \u00b7 simp only [not_lt] at hk'\n rw [Fin.predAbove_of_le_castSucc _ _ hk']\n exact lt_of_le_of_lt (by simpa) h\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=106, messages=[Message(data='expected token', pos=Position(line=2, column=8), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n \u03c3\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n j\\n\\nHint: The identifier `\u03c3` 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=7), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=106, i_end=664, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "sample_id": "B-Mathlib.AlgebraicTopology.SimplexCategory.ToMkOne.\u03c3_comp_toMk\u2081_of_lt", "source": {"declaration": "Mathlib.AlgebraicTopology.SimplexCategory.ToMkOne.\u03c3_comp_toMk\u2081_of_lt", "file": "Mathlib/AlgebraicTopology/SimplexCategory/ToMkOne.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.SimplexCategory.ToMkOne", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/SimplexCategory/ToMkOne.lean#L96", "span": "L96-L109"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"trace_states": [{"state": "lemma free_lightProfinite_internallyProjective_iff_tensor_condition' (P : LightProfinite.{u}) :\n InternallyProjective ((free R).obj P.toCondensed) \u2194\n \u2200 {A B : LightCondMod R} (e : A \u27f6 B) [Epi e], (\u2200 (S : LightProfinite)\n (g : (free R).obj ((S \u2297 P).toCondensed) \u27f6 B), \u2203 (S' : LightProfinite)\n (\u03c0 : S' \u27f6 S) (_ : Function.Surjective \u03c0) (g' : (free R).obj (S' \u2297 P).toCondensed \u27f6 A),\n ((free R).map (lightProfiniteToLightCondSet.map (\u03c0 \u25b7 P))) \u226b g = g' \u226b e)", "tactic": "rw [free_internallyProjective_iff_tensor_condition']"}, {"state": "", "tactic": "refine \u27e8fun h A B e he S g \u21a6 ?_, fun h A B e he S g \u21a6 ?_\u27e9 \u00b7 specialize h e S ((free R).map (\u03bcIso lightProfiniteToLightCondSet _ _).hom \u226b g)"}, {"state": "", "tactic": "obtain \u27e8S', \u03c0, h\u03c0, g', hh\u27e9 := h"}, {"state": "", "tactic": "refine \u27e8S', \u03c0, h\u03c0, (free R).map (\u03bcIso lightProfiniteToLightCondSet _ _).inv \u226b g', ?_\u27e9"}, {"state": "", "tactic": "rw [assoc, \u2190 hh]"}, {"state": "", "tactic": "simp [-map_comp, \u2190 map_comp_assoc] \u00b7 specialize h e S ((free R).map (\u03bcIso lightProfiniteToLightCondSet _ _).inv \u226b g)"}, {"state": "", "tactic": "obtain \u27e8S', \u03c0, h\u03c0, g', hh\u27e9 := h"}, {"state": "", "tactic": "refine \u27e8S', \u03c0, h\u03c0, (free R).map (\u03bcIso lightProfiniteToLightCondSet _ _).hom \u226b g', ?_\u27e9"}, {"state": "", "tactic": "rw [assoc, \u2190 hh]"}, {"state": "", "tactic": "simp [-map_comp, \u2190 map_comp_assoc, \u2190 \u03bc_natural_left_assoc] end LightCondensed"}], "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 2452, "declarations_count": 316, "diagnostics_count": 0, "duplicate_fingerprint": "f3bceb10cf3367f1", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 903, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "short", "line_count": 32, "natural_language_chars": 2452, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Condensed.Light.InternallyProjective).", "role": "system"}, {"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.Condensed.Light.InternallyProjective.free_lightProfinite_internallyProjective_iff_tensor_condition'`:\nState 0: \u22a2 lemma free_lightProfinite_internallyProjective_iff_tensor_condition' (P : LightProfinite.{u}) :\n InternallyProjective ((free R).obj P.toCondensed) \u2194\n \u2200 {A B : LightCondMod R} (e : A \u27f6 B) [Epi e], (\u2200 (S : LightProfinite)\n (g : (free R).obj ((S \u2297 P).toCondensed) \u27f6 B), \u2203 (S' : LightProfinite)\n (\u03c0 : S' \u27f6 S) (_ : Function.Surjective \u03c0) (g' : (free R).obj (S' \u2297 P).toCondensed \u27f6 A),\n ((free R).map (lightProfiniteToLightCondSet.map (\u03c0 \u25b7 P))) \u226b g = g' \u226b e)\nTactic: rw [free_internallyProjective_iff_tensor_condition']\nState 1: \u22a2 \nTactic: refine \u27e8fun h A B e he S g \u21a6 ?_, fun h A B e he S g \u21a6 ?_\u27e9 \u00b7 specialize h e S ((free R).map (\u03bcIso lightProfiniteToLightCondSet _ _).hom \u226b g)\nState 2: \u22a2 \nTactic: obtain \u27e8S', \u03c0, h\u03c0, g', hh\u27e9 := h\nState 3: \u22a2 \nTactic: refine \u27e8S', \u03c0, h\u03c0, (free R).map (\u03bcIso lightProfiniteToLightCondSet _ _).inv \u226b g', ?_\u27e9\nState 4: \u22a2 \nTactic: rw [assoc, \u2190 hh]\nState 5: \u22a2 \nTactic: simp [-map_comp, \u2190 map_comp_assoc] \u00b7 specialize h e S ((free R).map (\u03bcIso lightProfiniteToLightCondSet _ _).inv \u226b g)\nState 6: \u22a2 \nTactic: obtain \u27e8S', \u03c0, h\u03c0, g', hh\u27e9 := h\nState 7: \u22a2 \nTactic: refine \u27e8S', \u03c0, h\u03c0, (free R).map (\u03bcIso lightProfiniteToLightCondSet _ _).hom \u226b g', ?_\u27e9\nState 8: \u22a2 \nTactic: rw [assoc, \u2190 hh]\nState 9: \u22a2 \nTactic: simp [-map_comp, \u2190 map_comp_assoc, \u2190 \u03bc_natural_left_assoc] end LightCondensed\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Condensed.Light.InternallyProjective).[/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.Condensed.Light.InternallyProjective.free_lightProfinite_internallyProjective_iff_tensor_condition'`:\nState 0: \u22a2 lemma free_lightProfinite_internallyProjective_iff_tensor_condition' (P : LightProfinite.{u}) :\n InternallyProjective ((free R).obj P.toCondensed) \u2194\n \u2200 {A B : LightCondMod R} (e : A \u27f6 B) [Epi e], (\u2200 (S : LightProfinite)\n (g : (free R).obj ((S \u2297 P).toCondensed) \u27f6 B), \u2203 (S' : LightProfinite)\n (\u03c0 : S' \u27f6 S) (_ : Function.Surjective \u03c0) (g' : (free R).obj (S' \u2297 P).toCondensed \u27f6 A),\n ((free R).map (lightProfiniteToLightCondSet.map (\u03c0 \u25b7 P))) \u226b g = g' \u226b e)\nTactic: rw [free_internallyProjective_iff_tensor_condition']\nState 1: \u22a2 \nTactic: refine \u27e8fun h A B e he S g \u21a6 ?_, fun h A B e he S g \u21a6 ?_\u27e9 \u00b7 specialize h e S ((free R).map (\u03bcIso lightProfiniteToLightCondSet _ _).hom \u226b g)\nState 2: \u22a2 \nTactic: obtain \u27e8S', \u03c0, h\u03c0, g', hh\u27e9 := h\nState 3: \u22a2 \nTactic: refine \u27e8S', \u03c0, h\u03c0, (free R).map (\u03bcIso lightProfiniteToLightCondSet _ _).inv \u226b g', ?_\u27e9\nState 4: \u22a2 \nTactic: rw [assoc, \u2190 hh]\nState 5: \u22a2 \nTactic: simp [-map_comp, \u2190 map_comp_assoc] \u00b7 specialize h e S ((free R).map (\u03bcIso lightProfiniteToLightCondSet _ _).inv \u226b g)\nState 6: \u22a2 \nTactic: obtain \u27e8S', \u03c0, h\u03c0, g', hh\u27e9 := h\nState 7: \u22a2 \nTactic: refine \u27e8S', \u03c0, h\u03c0, (free R).map (\u03bcIso lightProfiniteToLightCondSet _ _).hom \u226b g', ?_\u27e9\nState 8: \u22a2 \nTactic: rw [assoc, \u2190 hh]\nState 9: \u22a2 \nTactic: simp [-map_comp, \u2190 map_comp_assoc, \u2190 \u03bc_natural_left_assoc] end LightCondensed\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.Condensed.Light.InternallyProjective.free_lightProfinite_internallyProjective_iff_tensor_condition'", "source": {"declaration": "Mathlib.Condensed.Light.InternallyProjective.free_lightProfinite_internallyProjective_iff_tensor_condition'", "file": "Mathlib/Condensed/Light/InternallyProjective.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Condensed.Light.InternallyProjective", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Condensed/Light/InternallyProjective.lean#L281", "span": "L281-L302"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\ntheorem trPosNum_natEnd : \u2200 (n), \u2200 x \u2208 trPosNum n, natEnd x = false\n | PosNum.one, _, List.Mem.head _ => rfl\n | PosNum.bit0 _, _, List.Mem.head _ => rfl\n | PosNum.bit0 n, _, List.Mem.tail _ h => trPosNum_natEnd n _ h\n | PosNum.bit1 _, _, List.Mem.head _ => rfl\n | PosNum.bit1 n, _, List.Mem.tail _ h => trPosNum_natEnd n _ h\n```", "instruction": "Edit `trPosNum_natEnd` so it still compiles and the proof is simplified where possible. Return the full updated `trPosNum_natEnd` block.", "proof_is_oneliner": false, "target_span": "L670-L676", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1084, "declarations_count": 121, "diagnostics_count": 0, "duplicate_fingerprint": "13b699f122dacf61", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 371, "lean_code_chars": 330, "lean_code_ratio": 0.3044, "length_bucket": "tiny", "line_count": 15, "natural_language_chars": 754, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.TuringMachine.ToPartrec).", "role": "system"}, {"content": "You are editing a file in `Mathlib/Computability/TuringMachine/ToPartrec.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Computability.TuringMachine.ToPartrec.trPosNum_natEnd`, L670-L676)\n```lean\ntheorem trPosNum_natEnd : \u2200 (n), \u2200 x \u2208 trPosNum n, natEnd x = false\n | PosNum.one, _, List.Mem.head _ => rfl\n | PosNum.bit0 _, _, List.Mem.head _ => rfl\n | PosNum.bit0 n, _, List.Mem.tail _ h => trPosNum_natEnd n _ h\n | PosNum.bit1 _, _, List.Mem.head _ => rfl\n | PosNum.bit1 n, _, List.Mem.tail _ h => trPosNum_natEnd n _ h\n```\n\n## Edit instruction\nEdit `trPosNum_natEnd` so it still compiles and the proof is simplified where possible. Return the full updated `trPosNum_natEnd` block.\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.TuringMachine.ToPartrec).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Computability/TuringMachine/ToPartrec.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Computability.TuringMachine.ToPartrec.trPosNum_natEnd`, L670-L676)\n```lean\ntheorem trPosNum_natEnd : \u2200 (n), \u2200 x \u2208 trPosNum n, natEnd x = false\n | PosNum.one, _, List.Mem.head _ => rfl\n | PosNum.bit0 _, _, List.Mem.head _ => rfl\n | PosNum.bit0 n, _, List.Mem.tail _ h => trPosNum_natEnd n _ h\n | PosNum.bit1 _, _, List.Mem.head _ => rfl\n | PosNum.bit1 n, _, List.Mem.tail _ h => trPosNum_natEnd n _ h\n```\n\n## Edit instruction\nEdit `trPosNum_natEnd` so it still compiles and the proof is simplified where possible. Return the full updated `trPosNum_natEnd` block.\n[/INST]", "sample_id": "D-Mathlib.Computability.TuringMachine.ToPartrec.trPosNum_natEnd", "source": {"declaration": "Mathlib.Computability.TuringMachine.ToPartrec.trPosNum_natEnd", "file": "Mathlib/Computability/TuringMachine/ToPartrec.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Computability.TuringMachine.ToPartrec", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Computability/TuringMachine/ToPartrec.lean#L670", "span": "L670-L676"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.objD (L66-L72)\ndef objD (n : \u2115) : X _\u298bn + 1\u298c \u27f6 X _\u298bn\u298c :=\n\u2211 i : Fin (n + 2), (-1 : \u2124) ^ (i : \u2115) \u2022 X.\u03b4 i\n\n/-!\n## The chain complex relation `d \u226b d`\n-/", "-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.d_squared (L73-L121)\ntheorem d_squared (n : \u2115) : objD X (n + 1) \u226b objD X n = 0 := by\n-- we start by expanding d \u226b d as a double sum\n dsimp\n simp only [comp_sum, sum_comp, \u2190 Finset.sum_product']\n -- then, we decompose the index set P into a subset S and its complement S\u1d9c\n let P := Fin (n + 2) \u00d7 Fin (n + 3)\n let S : Finset P := {ij : P | (ij.2 : \u2115) \u2264 (ij.1 : \u2115)}\n rw [Finset.univ_product_univ, \u2190 Finset.sum_add_sum_compl S, \u2190 eq_neg_iff_add_eq_zero,\n \u2190 Finset.sum_neg_distrib]\n /- we are reduced to showing that two sums are equal, and this is obtained\n by constructing a bijection \u03c6 : S -> S\u1d9c, which maps (i,j) to (j,i+1),\n and by comparing the terms -/\n let \u03c6 : \u2200 ij : P, ij \u2208 S \u2192 P := fun ij hij =>\n (Fin.castLT ij.2 (lt_of_le_of_lt (Finset.mem_filter.mp hij).right (Fin.is_lt ij.1)), ij.1.succ)\n apply Finset.sum_bij \u03c6\n \u00b7 -- \u03c6(S) is contained in S\u1d9c\n intro ij hij\n simp_rw [S, \u03c6, Finset.compl_filter, Finset.mem_filter_univ, Fin.val_succ,\n Fin.val_castLT] at hij \u22a2\n lia\n \u00b7 -- \u03c6 : S \u2192 S\u1d9c is injective\n rintro \u27e8i, j\u27e9 hij \u27e8i', j'\u27e9 hij' h\n rw [Prod.mk_inj]\n exact \u27e8by simpa [\u03c6] using congr_arg Prod.snd h,\n by simpa [\u03c6, Fin.castSucc_castLT] using congr_arg Fin.castSucc (congr_arg Prod.fst h)\u27e9\n \u00b7 -- \u03c6 : S \u2192 S\u1d9c is surjective\n rintro \u27e8i', j'\u27e9 hij'\n simp_rw [S, Finset.compl_filter, Finset.mem_filter_univ, not_le] at hij'\n refine \u27e8(j'.pred <| ?_, Fin.castSucc i'), ?_, ?_\u27e9\n \u00b7 rintro rfl\n simp only [Fin.val_zero, not_lt_zero'] at hij'\n \u00b7 simpa [S] using Nat.le_sub_one_of_lt hij'\n \u00b7 simp only [\u03c6, Fin.castLT_castSucc, Fin.succ_pred]\n \u00b7 -- identification of corresponding terms in both sums\n rintro \u27e8i, j\u27e9 hij\n dsimp\n simp only [zsmul_comp, comp_zsmul, smul_smul, \u2190 neg_smul]\n congr 1\n \u00b7 simp only [\u03c6, Fin.val_succ, pow_add, pow_one, mul_neg, neg_neg, mul_one]\n apply mul_comm\n \u00b7 rw [CategoryTheory.SimplicialObject.\u03b4_comp_\u03b4'']\n simpa [S] using hij\n\n/-!\n## Construction of the alternating face map complex functor\n-/\n\n\n/-- The alternating face map complex, on objects -/", "-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.obj (L122-L124)\ndef obj : ChainComplex C \u2115 :=\nChainComplex.of (fun n => X _\u298bn\u298c) (objD X) (d_squared X)", "-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.obj_X (L126-L128)\ntheorem obj_X (X : SimplicialObject C) (n : \u2115) : (AlternatingFaceMapComplex.obj X).X n = X _\u298bn\u298c :=\nrfl", "-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.obj_d_eq (L130-L137)\ntheorem obj_d_eq (X : SimplicialObject C) (n : \u2115) :\n (AlternatingFaceMapComplex.obj X).d (n + 1) n\n = \u2211 i : Fin (n + 2), (-1 : \u2124) ^ (i : \u2115) \u2022 X.\u03b4 i := by\napply ChainComplex.of_d\n\nvariable {X} {Y}\n\n/-- The alternating face map complex, on morphisms -/", "-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.map (L138-L147)\ndef map (f : X \u27f6 Y) : obj X \u27f6 obj Y :=\nChainComplex.ofHom _ _ _ _ _ _ (fun n => f.app (op \u298bn\u298c)) fun n => by\n dsimp\n rw [comp_sum, sum_comp]\n refine Finset.sum_congr rfl fun _ _ => ?_\n rw [comp_zsmul, zsmul_comp]\n congr 1\n symm\n apply f.naturality", "-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.map_f (L149-L156)\ntheorem map_f (f : X \u27f6 Y) (n : \u2115) : (map f).f n = f.app (op \u298bn\u298c) :=\nrfl\n\nend AlternatingFaceMapComplex\n\nvariable (C : Type*) [Category* C] [Preadditive C]\n\n/-- The alternating face map complex, as a functor -/", "-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.alternatingFaceMapComplex (L157-L162)\ndef alternatingFaceMapComplex : SimplicialObject C \u2964 ChainComplex C \u2115 where\n obj := AlternatingFaceMapComplex.obj\nmap f := AlternatingFaceMapComplex.map f\n\nvariable {C}", "-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.alternatingFaceMapComplex_obj_X (L164-L167)\ntheorem alternatingFaceMapComplex_obj_X (X : SimplicialObject C) (n : \u2115) :\n ((alternatingFaceMapComplex C).obj X).X n = X _\u298bn\u298c :=\nrfl", "-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.alternatingFaceMapComplex_obj_d (L169-L173)\ntheorem alternatingFaceMapComplex_obj_d (X : SimplicialObject C) (n : \u2115) :\n ((alternatingFaceMapComplex C).obj X).d (n + 1) n = AlternatingFaceMapComplex.objD X n := by\ndsimp only [alternatingFaceMapComplex, AlternatingFaceMapComplex.obj]\n apply ChainComplex.of_d", "-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.alternatingFaceMapComplex_map_f (L175-L179)\ntheorem alternatingFaceMapComplex_map_f {X Y : SimplicialObject C} (f : X \u27f6 Y) (n : \u2115) :\n ((alternatingFaceMapComplex C).map f).f n = f.app (op \u298bn\u298c) :=\nrfl\n\nset_option backward.isDefEq.respectTransparency false in", "-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.map_alternatingFaceMapComplex (L180-L200)\ntheorem map_alternatingFaceMapComplex {D : Type*} [Category* D] [Preadditive D] (F : C \u2964 D)\n [F.Additive] :\n alternatingFaceMapComplex C \u22d9 F.mapHomologicalComplex _ =\n (SimplicialObject.whiskering C D).obj F \u22d9 alternatingFaceMapComplex D := by\napply CategoryTheory.Functor.ext\n \u00b7 intro X Y f\n ext n\n simp only [Functor.comp_map, HomologicalComplex.comp_f, alternatingFaceMapComplex_map_f,\n Functor.mapHomologicalComplex_map_f, HomologicalComplex.eqToHom_f, eqToHom_refl, comp_id,\n id_comp, SimplicialObject.whiskering_obj_map_app]\n \u00b7 intro X\n apply HomologicalComplex.ext\n \u00b7 rintro i j (rfl : j + 1 = i)\n dsimp only [Functor.comp_obj]\n simp only [Functor.mapHomologicalComplex_obj_d, alternatingFaceMapComplex_obj_d,\n eqToHom_refl, id_comp, comp_id, AlternatingFaceMapComplex.objD, Functor.map_sum,\n Functor.map_zsmul]\n rfl\n \u00b7 ext n\n rfl", "-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.karoubi_alternatingFaceMapComplex_d (L201-L213)\ntheorem karoubi_alternatingFaceMapComplex_d (P : Karoubi (SimplicialObject C)) (n : \u2115) :\n ((AlternatingFaceMapComplex.obj (KaroubiFunctorCategoryEmbedding.obj P)).d (n + 1) n).f =\n P.p.app (op \u298bn + 1\u298c) \u226b (AlternatingFaceMapComplex.obj P.X).d (n + 1) n := by\ndsimp\n simp only [AlternatingFaceMapComplex.obj_d_eq, Karoubi.sum_hom, Preadditive.comp_sum,\n Karoubi.zsmul_hom, Preadditive.comp_zsmul]\n rfl\n\nnamespace AlternatingFaceMapComplex\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The natural transformation which gives the augmentation of the alternating face map\ncomplex attached to an augmented simplicial object. -/", "-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.\u03b5 (L214-L232)\ndef \u03b5 [Limits.HasZeroObject C] :\n SimplicialObject.Augmented.drop \u22d9 AlgebraicTopology.alternatingFaceMapComplex C \u27f6\n SimplicialObject.Augmented.point \u22d9 ChainComplex.single\u2080 C where\n app X := by\nrefine (ChainComplex.toSingle\u2080Equiv _ _).symm ?_\n refine \u27e8X.hom.app (op \u298b0\u298c), ?_\u27e9\n dsimp\n rw [alternatingFaceMapComplex_obj_d, objD, Fin.sum_univ_two, Fin.val_zero,\n pow_zero, one_smul, Fin.val_one, pow_one, neg_smul, one_smul, add_comp,\n neg_comp, SimplicialObject.\u03b4_naturality, SimplicialObject.\u03b4_naturality]\n apply add_neg_cancel\n naturality X Y f := by\n apply HomologicalComplex.to_single_hom_ext\n dsimp\n erw [ChainComplex.toSingle\u2080Equiv_symm_apply_f_zero,\n ChainComplex.toSingle\u2080Equiv_symm_apply_f_zero]\n simp only [ChainComplex.single\u2080_map_f_zero]\n exact congr_app f.w _", "-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.\u03b5_app_f_zero (L234-L237)\nlemma \u03b5_app_f_zero [Limits.HasZeroObject C] (X : SimplicialObject.Augmented C) :\n (\u03b5.app X).f 0 = X.hom.app (op \u298b0\u298c) :=\nChainComplex.toSingle\u2080Equiv_symm_apply_f_zero _ _"], "statement": "def inclusionOfMooreComplexMap (X : SimplicialObject A) :\n (normalizedMooreComplex A).obj X \u27f6 (alternatingFaceMapComplex A).obj X", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 8688, "declarations_count": 824, "diagnostics_count": 0, "duplicate_fingerprint": "2f59b881d3bbf620", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 3051, "lean_code_chars": 7843, "lean_code_ratio": 0.9027, "length_bucket": "medium", "line_count": 238, "natural_language_chars": 845, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 15, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.AlternatingFaceMapComplex).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef inclusionOfMooreComplexMap (X : SimplicialObject A) :\n (normalizedMooreComplex A).obj X \u27f6 (alternatingFaceMapComplex A).obj X\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.objD (L66-L72)\ndef objD (n : \u2115) : X _\u298bn + 1\u298c \u27f6 X _\u298bn\u298c :=\n\u2211 i : Fin (n + 2), (-1 : \u2124) ^ (i : \u2115) \u2022 X.\u03b4 i\n\n/-!\n## The chain complex relation `d \u226b d`\n-/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.d_squared (L73-L121)\ntheorem d_squared (n : \u2115) : objD X (n + 1) \u226b objD X n = 0 := by\n-- we start by expanding d \u226b d as a double sum\n dsimp\n simp only [comp_sum, sum_comp, \u2190 Finset.sum_product']\n -- then, we decompose the index set P into a subset S and its complement S\u1d9c\n let P := Fin (n + 2) \u00d7 Fin (n + 3)\n let S : Finset P := {ij : P | (ij.2 : \u2115) \u2264 (ij.1 : \u2115)}\n rw [Finset.univ_product_univ, \u2190 Finset.sum_add_sum_compl S, \u2190 eq_neg_iff_add_eq_zero,\n \u2190 Finset.sum_neg_distrib]\n /- we are reduced to showing that two sums are equal, and this is obtained\n by constructing a bijection \u03c6 : S -> S\u1d9c, which maps (i,j) to (j,i+1),\n and by comparing the terms -/\n let \u03c6 : \u2200 ij : P, ij \u2208 S \u2192 P := fun ij hij =>\n (Fin.castLT ij.2 (lt_of_le_of_lt (Finset.mem_filter.mp hij).right (Fin.is_lt ij.1)), ij.1.succ)\n apply Finset.sum_bij \u03c6\n \u00b7 -- \u03c6(S) is contained in S\u1d9c\n intro ij hij\n simp_rw [S, \u03c6, Finset.compl_filter, Finset.mem_filter_univ, Fin.val_succ,\n Fin.val_castLT] at hij \u22a2\n lia\n \u00b7 -- \u03c6 : S \u2192 S\u1d9c is injective\n rintro \u27e8i, j\u27e9 hij \u27e8i', j'\u27e9 hij' h\n rw [Prod.mk_inj]\n exact \u27e8by simpa [\u03c6] using congr_arg Prod.snd h,\n by simpa [\u03c6, Fin.castSucc_castLT] using congr_arg Fin.castSucc (congr_arg Prod.fst h)\u27e9\n \u00b7 -- \u03c6 : S \u2192 S\u1d9c is surjective\n rintro \u27e8i', j'\u27e9 hij'\n simp_rw [S, Finset.compl_filter, Finset.mem_filter_univ, not_le] at hij'\n refine \u27e8(j'.pred <| ?_, Fin.castSucc i'), ?_, ?_\u27e9\n \u00b7 rintro rfl\n simp only [Fin.val_zero, not_lt_zero'] at hij'\n \u00b7 simpa [S] using Nat.le_sub_one_of_lt hij'\n \u00b7 simp only [\u03c6, Fin.castLT_castSucc, Fin.succ_pred]\n \u00b7 -- identification of corresponding terms in both sums\n rintro \u27e8i, j\u27e9 hij\n dsimp\n simp only [zsmul_comp, comp_zsmul, smul_smul, \u2190 neg_smul]\n congr 1\n \u00b7 simp only [\u03c6, Fin.val_succ, pow_add, pow_one, mul_neg, neg_neg, mul_one]\n apply mul_comm\n \u00b7 rw [CategoryTheory.SimplicialObject.\u03b4_comp_\u03b4'']\n simpa [S] using hij\n\n/-!\n## Construction of the alternating face map complex functor\n-/\n\n\n/-- The alternating face map complex, on objects -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.obj (L122-L124)\ndef obj : ChainComplex C \u2115 :=\nChainComplex.of (fun n => X _\u298bn\u298c) (objD X) (d_squared X)\n```\n\n-- snippet 4\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.obj_X (L126-L128)\ntheorem obj_X (X : SimplicialObject C) (n : \u2115) : (AlternatingFaceMapComplex.obj X).X n = X _\u298bn\u298c :=\nrfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.obj_d_eq (L130-L137)\ntheorem obj_d_eq (X : SimplicialObject C) (n : \u2115) :\n (AlternatingFaceMapComplex.obj X).d (n + 1) n\n = \u2211 i : Fin (n + 2), (-1 : \u2124) ^ (i : \u2115) \u2022 X.\u03b4 i := by\napply ChainComplex.of_d\n\nvariable {X} {Y}\n\n/-- The alternating face map complex, on morphisms -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.map (L138-L147)\ndef map (f : X \u27f6 Y) : obj X \u27f6 obj Y :=\nChainComplex.ofHom _ _ _ _ _ _ (fun n => f.app (op \u298bn\u298c)) fun n => by\n dsimp\n rw [comp_sum, sum_comp]\n refine Finset.sum_congr rfl fun _ _ => ?_\n rw [comp_zsmul, zsmul_comp]\n congr 1\n symm\n apply f.naturality\n```\n\n-- snippet 7\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.map_f (L149-L156)\ntheorem map_f (f : X \u27f6 Y) (n : \u2115) : (map f).f n = f.app (op \u298bn\u298c) :=\nrfl\n\nend AlternatingFaceMapComplex\n\nvariable (C : Type*) [Category* C] [Preadditive C]\n\n/-- The alternating face map complex, as a functor -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.alternatingFaceMapComplex (L157-L162)\ndef alternatingFaceMapComplex : SimplicialObject C \u2964 ChainComplex C \u2115 where\n obj := AlternatingFaceMapComplex.obj\nmap f := AlternatingFaceMapComplex.map f\n\nvariable {C}\n```\n\n-- snippet 9\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.alternatingFaceMapComplex_obj_X (L164-L167)\ntheorem alternatingFaceMapComplex_obj_X (X : SimplicialObject C) (n : \u2115) :\n ((alternatingFaceMapComplex C).obj X).X n = X _\u298bn\u298c :=\nrfl\n```\n\n-- snippet 10\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.alternatingFaceMapComplex_obj_d (L169-L173)\ntheorem alternatingFaceMapComplex_obj_d (X : SimplicialObject C) (n : \u2115) :\n ((alternatingFaceMapComplex C).obj X).d (n + 1) n = AlternatingFaceMapComplex.objD X n := by\ndsimp only [alternatingFaceMapComplex, AlternatingFaceMapComplex.obj]\n apply ChainComplex.of_d\n```\n\n-- snippet 11\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.alternatingFaceMapComplex_map_f (L175-L179)\ntheorem alternatingFaceMapComplex_map_f {X Y : SimplicialObject C} (f : X \u27f6 Y) (n : \u2115) :\n ((alternatingFaceMapComplex C).map f).f n = f.app (op \u298bn\u298c) :=\nrfl\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 12\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.map_alternatingFaceMapComplex (L180-L200)\ntheorem map_alternatingFaceMapComplex {D : Type*} [Category* D] [Preadditive D] (F : C \u2964 D)\n [F.Additive] :\n alternatingFaceMapComplex C \u22d9 F.mapHomologicalComplex _ =\n (SimplicialObject.whiskering C D).obj F \u22d9 alternatingFaceMapComplex D := by\napply CategoryTheory.Functor.ext\n \u00b7 intro X Y f\n ext n\n simp only [Functor.comp_map, HomologicalComplex.comp_f, alternatingFaceMapComplex_map_f,\n Functor.mapHomologicalComplex_map_f, HomologicalComplex.eqToHom_f, eqToHom_refl, comp_id,\n id_comp, SimplicialObject.whiskering_obj_map_app]\n \u00b7 intro X\n apply HomologicalComplex.ext\n \u00b7 rintro i j (rfl : j + 1 = i)\n dsimp only [Functor.comp_obj]\n simp only [Functor.mapHomologicalComplex_obj_d, alternatingFaceMapComplex_obj_d,\n eqToHom_refl, id_comp, comp_id, AlternatingFaceMapComplex.objD, Functor.map_sum,\n Functor.map_zsmul]\n rfl\n \u00b7 ext n\n rfl\n```\n\n-- snippet 13\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.karoubi_alternatingFaceMapComplex_d (L201-L213)\ntheorem karoubi_alternatingFaceMapComplex_d (P : Karoubi (SimplicialObject C)) (n : \u2115) :\n ((AlternatingFaceMapComplex.obj (KaroubiFunctorCategoryEmbedding.obj P)).d (n + 1) n).f =\n P.p.app (op \u298bn + 1\u298c) \u226b (AlternatingFaceMapComplex.obj P.X).d (n + 1) n := by\ndsimp\n simp only [AlternatingFaceMapComplex.obj_d_eq, Karoubi.sum_hom, Preadditive.comp_sum,\n Karoubi.zsmul_hom, Preadditive.comp_zsmul]\n rfl\n\nnamespace AlternatingFaceMapComplex\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The natural transformation which gives the augmentation of the alternating face map\ncomplex attached to an augmented simplicial object. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.\u03b5 (L214-L232)\ndef \u03b5 [Limits.HasZeroObject C] :\n SimplicialObject.Augmented.drop \u22d9 AlgebraicTopology.alternatingFaceMapComplex C \u27f6\n SimplicialObject.Augmented.point \u22d9 ChainComplex.single\u2080 C where\n app X := by\nrefine (ChainComplex.toSingle\u2080Equiv _ _).symm ?_\n refine \u27e8X.hom.app (op \u298b0\u298c), ?_\u27e9\n dsimp\n rw [alternatingFaceMapComplex_obj_d, objD, Fin.sum_univ_two, Fin.val_zero,\n pow_zero, one_smul, Fin.val_one, pow_one, neg_smul, one_smul, add_comp,\n neg_comp, SimplicialObject.\u03b4_naturality, SimplicialObject.\u03b4_naturality]\n apply add_neg_cancel\n naturality X Y f := by\n apply HomologicalComplex.to_single_hom_ext\n dsimp\n erw [ChainComplex.toSingle\u2080Equiv_symm_apply_f_zero,\n ChainComplex.toSingle\u2080Equiv_symm_apply_f_zero]\n simp only [ChainComplex.single\u2080_map_f_zero]\n exact congr_app f.w _\n```\n\n-- snippet 15\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.\u03b5_app_f_zero (L234-L237)\nlemma \u03b5_app_f_zero [Limits.HasZeroObject C] (X : SimplicialObject.Augmented C) :\n (\u03b5.app X).f 0 = X.hom.app (op \u298b0\u298c) :=\nChainComplex.toSingle\u2080Equiv_symm_apply_f_zero _ _\n```\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.AlternatingFaceMapComplex).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef inclusionOfMooreComplexMap (X : SimplicialObject A) :\n (normalizedMooreComplex A).obj X \u27f6 (alternatingFaceMapComplex A).obj X\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.objD (L66-L72)\ndef objD (n : \u2115) : X _\u298bn + 1\u298c \u27f6 X _\u298bn\u298c :=\n\u2211 i : Fin (n + 2), (-1 : \u2124) ^ (i : \u2115) \u2022 X.\u03b4 i\n\n/-!\n## The chain complex relation `d \u226b d`\n-/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.d_squared (L73-L121)\ntheorem d_squared (n : \u2115) : objD X (n + 1) \u226b objD X n = 0 := by\n-- we start by expanding d \u226b d as a double sum\n dsimp\n simp only [comp_sum, sum_comp, \u2190 Finset.sum_product']\n -- then, we decompose the index set P into a subset S and its complement S\u1d9c\n let P := Fin (n + 2) \u00d7 Fin (n + 3)\n let S : Finset P := {ij : P | (ij.2 : \u2115) \u2264 (ij.1 : \u2115)}\n rw [Finset.univ_product_univ, \u2190 Finset.sum_add_sum_compl S, \u2190 eq_neg_iff_add_eq_zero,\n \u2190 Finset.sum_neg_distrib]\n /- we are reduced to showing that two sums are equal, and this is obtained\n by constructing a bijection \u03c6 : S -> S\u1d9c, which maps (i,j) to (j,i+1),\n and by comparing the terms -/\n let \u03c6 : \u2200 ij : P, ij \u2208 S \u2192 P := fun ij hij =>\n (Fin.castLT ij.2 (lt_of_le_of_lt (Finset.mem_filter.mp hij).right (Fin.is_lt ij.1)), ij.1.succ)\n apply Finset.sum_bij \u03c6\n \u00b7 -- \u03c6(S) is contained in S\u1d9c\n intro ij hij\n simp_rw [S, \u03c6, Finset.compl_filter, Finset.mem_filter_univ, Fin.val_succ,\n Fin.val_castLT] at hij \u22a2\n lia\n \u00b7 -- \u03c6 : S \u2192 S\u1d9c is injective\n rintro \u27e8i, j\u27e9 hij \u27e8i', j'\u27e9 hij' h\n rw [Prod.mk_inj]\n exact \u27e8by simpa [\u03c6] using congr_arg Prod.snd h,\n by simpa [\u03c6, Fin.castSucc_castLT] using congr_arg Fin.castSucc (congr_arg Prod.fst h)\u27e9\n \u00b7 -- \u03c6 : S \u2192 S\u1d9c is surjective\n rintro \u27e8i', j'\u27e9 hij'\n simp_rw [S, Finset.compl_filter, Finset.mem_filter_univ, not_le] at hij'\n refine \u27e8(j'.pred <| ?_, Fin.castSucc i'), ?_, ?_\u27e9\n \u00b7 rintro rfl\n simp only [Fin.val_zero, not_lt_zero'] at hij'\n \u00b7 simpa [S] using Nat.le_sub_one_of_lt hij'\n \u00b7 simp only [\u03c6, Fin.castLT_castSucc, Fin.succ_pred]\n \u00b7 -- identification of corresponding terms in both sums\n rintro \u27e8i, j\u27e9 hij\n dsimp\n simp only [zsmul_comp, comp_zsmul, smul_smul, \u2190 neg_smul]\n congr 1\n \u00b7 simp only [\u03c6, Fin.val_succ, pow_add, pow_one, mul_neg, neg_neg, mul_one]\n apply mul_comm\n \u00b7 rw [CategoryTheory.SimplicialObject.\u03b4_comp_\u03b4'']\n simpa [S] using hij\n\n/-!\n## Construction of the alternating face map complex functor\n-/\n\n\n/-- The alternating face map complex, on objects -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.obj (L122-L124)\ndef obj : ChainComplex C \u2115 :=\nChainComplex.of (fun n => X _\u298bn\u298c) (objD X) (d_squared X)\n```\n\n-- snippet 4\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.obj_X (L126-L128)\ntheorem obj_X (X : SimplicialObject C) (n : \u2115) : (AlternatingFaceMapComplex.obj X).X n = X _\u298bn\u298c :=\nrfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.obj_d_eq (L130-L137)\ntheorem obj_d_eq (X : SimplicialObject C) (n : \u2115) :\n (AlternatingFaceMapComplex.obj X).d (n + 1) n\n = \u2211 i : Fin (n + 2), (-1 : \u2124) ^ (i : \u2115) \u2022 X.\u03b4 i := by\napply ChainComplex.of_d\n\nvariable {X} {Y}\n\n/-- The alternating face map complex, on morphisms -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.map (L138-L147)\ndef map (f : X \u27f6 Y) : obj X \u27f6 obj Y :=\nChainComplex.ofHom _ _ _ _ _ _ (fun n => f.app (op \u298bn\u298c)) fun n => by\n dsimp\n rw [comp_sum, sum_comp]\n refine Finset.sum_congr rfl fun _ _ => ?_\n rw [comp_zsmul, zsmul_comp]\n congr 1\n symm\n apply f.naturality\n```\n\n-- snippet 7\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.map_f (L149-L156)\ntheorem map_f (f : X \u27f6 Y) (n : \u2115) : (map f).f n = f.app (op \u298bn\u298c) :=\nrfl\n\nend AlternatingFaceMapComplex\n\nvariable (C : Type*) [Category* C] [Preadditive C]\n\n/-- The alternating face map complex, as a functor -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.alternatingFaceMapComplex (L157-L162)\ndef alternatingFaceMapComplex : SimplicialObject C \u2964 ChainComplex C \u2115 where\n obj := AlternatingFaceMapComplex.obj\nmap f := AlternatingFaceMapComplex.map f\n\nvariable {C}\n```\n\n-- snippet 9\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.alternatingFaceMapComplex_obj_X (L164-L167)\ntheorem alternatingFaceMapComplex_obj_X (X : SimplicialObject C) (n : \u2115) :\n ((alternatingFaceMapComplex C).obj X).X n = X _\u298bn\u298c :=\nrfl\n```\n\n-- snippet 10\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.alternatingFaceMapComplex_obj_d (L169-L173)\ntheorem alternatingFaceMapComplex_obj_d (X : SimplicialObject C) (n : \u2115) :\n ((alternatingFaceMapComplex C).obj X).d (n + 1) n = AlternatingFaceMapComplex.objD X n := by\ndsimp only [alternatingFaceMapComplex, AlternatingFaceMapComplex.obj]\n apply ChainComplex.of_d\n```\n\n-- snippet 11\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.alternatingFaceMapComplex_map_f (L175-L179)\ntheorem alternatingFaceMapComplex_map_f {X Y : SimplicialObject C} (f : X \u27f6 Y) (n : \u2115) :\n ((alternatingFaceMapComplex C).map f).f n = f.app (op \u298bn\u298c) :=\nrfl\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 12\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.map_alternatingFaceMapComplex (L180-L200)\ntheorem map_alternatingFaceMapComplex {D : Type*} [Category* D] [Preadditive D] (F : C \u2964 D)\n [F.Additive] :\n alternatingFaceMapComplex C \u22d9 F.mapHomologicalComplex _ =\n (SimplicialObject.whiskering C D).obj F \u22d9 alternatingFaceMapComplex D := by\napply CategoryTheory.Functor.ext\n \u00b7 intro X Y f\n ext n\n simp only [Functor.comp_map, HomologicalComplex.comp_f, alternatingFaceMapComplex_map_f,\n Functor.mapHomologicalComplex_map_f, HomologicalComplex.eqToHom_f, eqToHom_refl, comp_id,\n id_comp, SimplicialObject.whiskering_obj_map_app]\n \u00b7 intro X\n apply HomologicalComplex.ext\n \u00b7 rintro i j (rfl : j + 1 = i)\n dsimp only [Functor.comp_obj]\n simp only [Functor.mapHomologicalComplex_obj_d, alternatingFaceMapComplex_obj_d,\n eqToHom_refl, id_comp, comp_id, AlternatingFaceMapComplex.objD, Functor.map_sum,\n Functor.map_zsmul]\n rfl\n \u00b7 ext n\n rfl\n```\n\n-- snippet 13\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.karoubi_alternatingFaceMapComplex_d (L201-L213)\ntheorem karoubi_alternatingFaceMapComplex_d (P : Karoubi (SimplicialObject C)) (n : \u2115) :\n ((AlternatingFaceMapComplex.obj (KaroubiFunctorCategoryEmbedding.obj P)).d (n + 1) n).f =\n P.p.app (op \u298bn + 1\u298c) \u226b (AlternatingFaceMapComplex.obj P.X).d (n + 1) n := by\ndsimp\n simp only [AlternatingFaceMapComplex.obj_d_eq, Karoubi.sum_hom, Preadditive.comp_sum,\n Karoubi.zsmul_hom, Preadditive.comp_zsmul]\n rfl\n\nnamespace AlternatingFaceMapComplex\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The natural transformation which gives the augmentation of the alternating face map\ncomplex attached to an augmented simplicial object. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.\u03b5 (L214-L232)\ndef \u03b5 [Limits.HasZeroObject C] :\n SimplicialObject.Augmented.drop \u22d9 AlgebraicTopology.alternatingFaceMapComplex C \u27f6\n SimplicialObject.Augmented.point \u22d9 ChainComplex.single\u2080 C where\n app X := by\nrefine (ChainComplex.toSingle\u2080Equiv _ _).symm ?_\n refine \u27e8X.hom.app (op \u298b0\u298c), ?_\u27e9\n dsimp\n rw [alternatingFaceMapComplex_obj_d, objD, Fin.sum_univ_two, Fin.val_zero,\n pow_zero, one_smul, Fin.val_one, pow_one, neg_smul, one_smul, add_comp,\n neg_comp, SimplicialObject.\u03b4_naturality, SimplicialObject.\u03b4_naturality]\n apply add_neg_cancel\n naturality X Y f := by\n apply HomologicalComplex.to_single_hom_ext\n dsimp\n erw [ChainComplex.toSingle\u2080Equiv_symm_apply_f_zero,\n ChainComplex.toSingle\u2080Equiv_symm_apply_f_zero]\n simp only [ChainComplex.single\u2080_map_f_zero]\n exact congr_app f.w _\n```\n\n-- snippet 15\n```lean\n-- Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.\u03b5_app_f_zero (L234-L237)\nlemma \u03b5_app_f_zero [Limits.HasZeroObject C] (X : SimplicialObject.Augmented C) :\n (\u03b5.app X).f 0 = X.hom.app (op \u298b0\u298c) :=\nChainComplex.toSingle\u2080Equiv_symm_apply_f_zero _ _\n```\n[/INST]", "sample_id": "C-Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.inclusionOfMooreComplexMap", "source": {"declaration": "Mathlib.AlgebraicTopology.AlternatingFaceMapComplex.inclusionOfMooreComplexMap", "file": "Mathlib/AlgebraicTopology/AlternatingFaceMapComplex.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.AlternatingFaceMapComplex", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/AlternatingFaceMapComplex.lean#L251", "span": "L251-L272"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Computability.Partrec.rfindX (L65-L90)\ndef rfindX : { n // true \u2208 p n \u2227 \u2200 m < n, false \u2208 p m } :=\nsuffices \u2200 k, (\u2200 n < k, false \u2208 p n) \u2192 { n // true \u2208 p n \u2227 \u2200 m < n, false \u2208 p m } from\n this 0 fun _ => (Nat.not_lt_zero _).elim\n @WellFounded.fix _ _ (lbp p) (wf_lbp p H)\n (by\n intro m IH al\n have pm : (p m).Dom := by\n rcases H with \u27e8n, h\u2081, h\u2082\u27e9\n rcases lt_trichotomy m n with (h\u2083 | h\u2083 | h\u2083)\n \u00b7 exact h\u2082 _ h\u2083\n \u00b7 rw [h\u2083]\n exact h\u2081.fst\n \u00b7 injection mem_unique h\u2081 (al _ h\u2083)\n cases e : (p m).get pm\n \u00b7 suffices \u2200\u1d49 k \u2264 m, false \u2208 p k from IH _ \u27e8rfl, this\u27e9 fun n h => this _ (le_of_lt_succ h)\n intro n h\n rcases h.lt_or_eq_dec with h | h\n \u00b7 exact al _ h\n \u00b7 rw [h]\n exact \u27e8_, e\u27e9\n \u00b7 exact \u27e8m, \u27e8_, e\u27e9, al\u27e9)\n\nend Rfind\n\n/-- Find the smallest `n` satisfying `p n`, where all `p k` for `k < n` are defined as false.\nReturns a `Part`. -/", "-- Mathlib.Computability.Partrec.rfind (L91-L93)\ndef rfind (p : \u2115 \u2192. Bool) : Part \u2115 :=\n\u27e8_, fun h => (rfindX p h).1\u27e9", "-- Mathlib.Computability.Partrec.rfind_spec (L94-L96)\ntheorem rfind_spec {p : \u2115 \u2192. Bool} {n : \u2115} (h : n \u2208 rfind p) : true \u2208 p n :=\nh.snd \u25b8 (rfindX p h.fst).2.1", "-- Mathlib.Computability.Partrec.rfind_min (L97-L99)\ntheorem rfind_min {p : \u2115 \u2192. Bool} {n : \u2115} (h : n \u2208 rfind p) : \u2200 {m : \u2115}, m < n \u2192 false \u2208 p m :=\n@(h.snd \u25b8 @((rfindX p h.fst).2.2))", "-- Mathlib.Computability.Partrec.rfind_dom (L101-L104)\ntheorem rfind_dom {p : \u2115 \u2192. Bool} :\n (rfind p).Dom \u2194 \u2203 n, true \u2208 p n \u2227 \u2200 {m : \u2115}, m < n \u2192 (p m).Dom :=\nIff.rfl", "-- Mathlib.Computability.Partrec.rfind_dom' (L105-L111)\ntheorem rfind_dom' {p : \u2115 \u2192. Bool} :\n (rfind p).Dom \u2194 \u2203 n, true \u2208 p n \u2227 \u2200 {m : \u2115}, m \u2264 n \u2192 (p m).Dom :=\nexists_congr fun _ =>\n and_congr_right fun pn =>\n \u27e8fun H _ h => (Decidable.eq_or_lt_of_le h).elim (fun e => e.symm \u25b8 pn.fst) (H _), fun H _ h =>\n H (le_of_lt h)\u27e9", "-- Mathlib.Computability.Partrec.mem_rfind (L113-L121)\ntheorem mem_rfind {p : \u2115 \u2192. Bool} {n : \u2115} :\n n \u2208 rfind p \u2194 true \u2208 p n \u2227 \u2200 {m : \u2115}, m < n \u2192 false \u2208 p m :=\n\u27e8fun h => \u27e8rfind_spec h, @rfind_min _ _ h\u27e9, fun \u27e8h\u2081, h\u2082\u27e9 => by\n let \u27e8m, hm\u27e9 := dom_iff_mem.1 <| (@rfind_dom p).2 \u27e8_, h\u2081, fun {m} mn => (h\u2082 mn).fst\u27e9\n rcases lt_trichotomy m n with (h | h | h)\n \u00b7 injection mem_unique (h\u2082 h) (rfind_spec hm)\n \u00b7 rwa [\u2190 h]\n \u00b7 injection mem_unique h\u2081 (rfind_min hm h)\u27e9", "-- Mathlib.Computability.Partrec.rfind_min' (L122-L126)\ntheorem rfind_min' {p : \u2115 \u2192 Bool} {m : \u2115} (pm : p m) : \u2203 n \u2208 rfind p, n \u2264 m :=\nhave : true \u2208 (p : \u2115 \u2192. Bool) m := \u27e8trivial, pm\u27e9\n let \u27e8n, hn\u27e9 := dom_iff_mem.1 <| (@rfind_dom p).2 \u27e8m, this, fun {_} _ => \u27e8\u27e9\u27e9\n \u27e8n, hn, not_lt.1 fun h => by injection mem_unique this (rfind_min hn h)\u27e9", "-- Mathlib.Computability.Partrec.rfind_zero_none (L127-L133)\ntheorem rfind_zero_none (p : \u2115 \u2192. Bool) (p0 : p 0 = Part.none) : rfind p = Part.none :=\neq_none_iff.2 fun _ h =>\n let \u27e8_, _, h\u2082\u27e9 := rfind_dom'.1 h.fst\n (p0 \u25b8 h\u2082 (zero_le _) : (@Part.none Bool).Dom)\n\n/-- Find the smallest `n` satisfying `f n`, where all `f k` for `k < n` are defined as false.\nReturns a `Part`. -/", "-- Mathlib.Computability.Partrec.rfindOpt (L134-L136)\ndef rfindOpt {\u03b1} (f : \u2115 \u2192 Option \u03b1) : Part \u03b1 :=\n(rfind fun n => (f n).isSome).bind fun n => f n", "-- Mathlib.Computability.Partrec.rfindOpt_spec (L137-L140)\ntheorem rfindOpt_spec {\u03b1} {f : \u2115 \u2192 Option \u03b1} {a} (h : a \u2208 rfindOpt f) : \u2203 n, a \u2208 f n :=\nlet \u27e8n, _, h\u2082\u27e9 := mem_bind_iff.1 h\n \u27e8n, mem_coe.1 h\u2082\u27e9", "-- Mathlib.Computability.Partrec.rfindOpt_dom (L141-L150)\ntheorem rfindOpt_dom {\u03b1} {f : \u2115 \u2192 Option \u03b1} : (rfindOpt f).Dom \u2194 \u2203 n a, a \u2208 f n :=\n\u27e8fun h => (rfindOpt_spec \u27e8h, rfl\u27e9).imp fun _ h => \u27e8_, h\u27e9, fun h => by\n have h' : \u2203 n, (f n).isSome := h.imp fun n => Option.isSome_iff_exists.2\n have s := Nat.find_spec h'\n have fd : (rfind fun n => (f n).isSome).Dom :=\n \u27e8Nat.find h', by simpa using s.symm, fun _ _ => trivial\u27e9\n refine \u27e8fd, ?_\u27e9\n have := rfind_spec (get_mem fd)\n simpa using this\u27e9", "-- Mathlib.Computability.Partrec.rfindOpt_mono (L151-L173)\ntheorem rfindOpt_mono {\u03b1} {f : \u2115 \u2192 Option \u03b1} (H : \u2200 {a m n}, m \u2264 n \u2192 a \u2208 f m \u2192 a \u2208 f n) {a} :\n a \u2208 rfindOpt f \u2194 \u2203 n, a \u2208 f n :=\n\u27e8rfindOpt_spec, fun \u27e8n, h\u27e9 => by\n have h' := rfindOpt_dom.2 \u27e8_, _, h\u27e9\n obtain \u27e8k, hk\u27e9 := rfindOpt_spec \u27e8h', rfl\u27e9\n have := (H (le_max_left _ _) h).symm.trans (H (le_max_right _ _) hk)\n simp at this; simp [this, get_mem]\u27e9\n\n/-- `Nat.Partrec f` means that the partial function `f : \u2115 \u2192. \u2115` is partially recursive. -/\nprotected inductive Partrec : (\u2115 \u2192. \u2115) \u2192 Prop\n | zero : Nat.Partrec (pure 0)\n | succ : Nat.Partrec succ\n | left : Nat.Partrec \u2191fun n : \u2115 => n.unpair.1\n | right : Nat.Partrec \u2191fun n : \u2115 => n.unpair.2\n | pair {f g} : Nat.Partrec f \u2192 Nat.Partrec g \u2192 Nat.Partrec fun n => pair <$> f n <*> g n\n | comp {f g} : Nat.Partrec f \u2192 Nat.Partrec g \u2192 Nat.Partrec fun n => g n >>= f\n | prec {f g} : Nat.Partrec f \u2192 Nat.Partrec g \u2192 Nat.Partrec (unpaired fun a n =>\n n.rec (f a) fun y IH => do let i \u2190 IH; g (pair a (pair y i)))\n | rfind {f} : Nat.Partrec f \u2192\n Nat.Partrec fun a => rfind fun n => (fun m => m = 0) <$> f (pair a n)\n\nnamespace Partrec", "-- Mathlib.Computability.Partrec.of_eq (L174-L176)\ntheorem of_eq {f g : \u2115 \u2192. \u2115} (hf : Nat.Partrec f) (H : \u2200 n, f n = g n) : Nat.Partrec g :=\n(funext H : f = g) \u25b8 hf", "-- Mathlib.Computability.Partrec.of_eq_tot (L177-L180)\ntheorem of_eq_tot {f : \u2115 \u2192. \u2115} {g : \u2115 \u2192 \u2115} (hf : Nat.Partrec f) (H : \u2200 n, g n \u2208 f n) :\n Nat.Partrec g :=\nhf.of_eq fun n => eq_some_iff.2 (H n)"], "statement": "theorem comp\u2082 {f : \u03b3 \u2192 \u03b4 \u2192. \u03c3} {g : \u03b1 \u2192 \u03b2 \u2192 \u03b3} {h : \u03b1 \u2192 \u03b2 \u2192 \u03b4} (hf : Partrec\u2082 f)\n (hg : Computable\u2082 g) (hh : Computable\u2082 h) : Partrec\u2082 fun a b => f (g a b) (h a b)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 6492, "declarations_count": 874, "diagnostics_count": 0, "duplicate_fingerprint": "4fa5ec0706db1d0d", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 2749, "lean_code_chars": 5669, "lean_code_ratio": 0.8732, "length_bucket": "medium", "line_count": 184, "natural_language_chars": 823, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 15, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.Partrec).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem comp\u2082 {f : \u03b3 \u2192 \u03b4 \u2192. \u03c3} {g : \u03b1 \u2192 \u03b2 \u2192 \u03b3} {h : \u03b1 \u2192 \u03b2 \u2192 \u03b4} (hf : Partrec\u2082 f)\n (hg : Computable\u2082 g) (hh : Computable\u2082 h) : Partrec\u2082 fun a b => f (g a b) (h a b)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Computability.Partrec.rfindX (L65-L90)\ndef rfindX : { n // true \u2208 p n \u2227 \u2200 m < n, false \u2208 p m } :=\nsuffices \u2200 k, (\u2200 n < k, false \u2208 p n) \u2192 { n // true \u2208 p n \u2227 \u2200 m < n, false \u2208 p m } from\n this 0 fun _ => (Nat.not_lt_zero _).elim\n @WellFounded.fix _ _ (lbp p) (wf_lbp p H)\n (by\n intro m IH al\n have pm : (p m).Dom := by\n rcases H with \u27e8n, h\u2081, h\u2082\u27e9\n rcases lt_trichotomy m n with (h\u2083 | h\u2083 | h\u2083)\n \u00b7 exact h\u2082 _ h\u2083\n \u00b7 rw [h\u2083]\n exact h\u2081.fst\n \u00b7 injection mem_unique h\u2081 (al _ h\u2083)\n cases e : (p m).get pm\n \u00b7 suffices \u2200\u1d49 k \u2264 m, false \u2208 p k from IH _ \u27e8rfl, this\u27e9 fun n h => this _ (le_of_lt_succ h)\n intro n h\n rcases h.lt_or_eq_dec with h | h\n \u00b7 exact al _ h\n \u00b7 rw [h]\n exact \u27e8_, e\u27e9\n \u00b7 exact \u27e8m, \u27e8_, e\u27e9, al\u27e9)\n\nend Rfind\n\n/-- Find the smallest `n` satisfying `p n`, where all `p k` for `k < n` are defined as false.\nReturns a `Part`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Computability.Partrec.rfind (L91-L93)\ndef rfind (p : \u2115 \u2192. Bool) : Part \u2115 :=\n\u27e8_, fun h => (rfindX p h).1\u27e9\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Computability.Partrec.rfind_spec (L94-L96)\ntheorem rfind_spec {p : \u2115 \u2192. Bool} {n : \u2115} (h : n \u2208 rfind p) : true \u2208 p n :=\nh.snd \u25b8 (rfindX p h.fst).2.1\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Computability.Partrec.rfind_min (L97-L99)\ntheorem rfind_min {p : \u2115 \u2192. Bool} {n : \u2115} (h : n \u2208 rfind p) : \u2200 {m : \u2115}, m < n \u2192 false \u2208 p m :=\n@(h.snd \u25b8 @((rfindX p h.fst).2.2))\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Computability.Partrec.rfind_dom (L101-L104)\ntheorem rfind_dom {p : \u2115 \u2192. Bool} :\n (rfind p).Dom \u2194 \u2203 n, true \u2208 p n \u2227 \u2200 {m : \u2115}, m < n \u2192 (p m).Dom :=\nIff.rfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Computability.Partrec.rfind_dom' (L105-L111)\ntheorem rfind_dom' {p : \u2115 \u2192. Bool} :\n (rfind p).Dom \u2194 \u2203 n, true \u2208 p n \u2227 \u2200 {m : \u2115}, m \u2264 n \u2192 (p m).Dom :=\nexists_congr fun _ =>\n and_congr_right fun pn =>\n \u27e8fun H _ h => (Decidable.eq_or_lt_of_le h).elim (fun e => e.symm \u25b8 pn.fst) (H _), fun H _ h =>\n H (le_of_lt h)\u27e9\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Computability.Partrec.mem_rfind (L113-L121)\ntheorem mem_rfind {p : \u2115 \u2192. Bool} {n : \u2115} :\n n \u2208 rfind p \u2194 true \u2208 p n \u2227 \u2200 {m : \u2115}, m < n \u2192 false \u2208 p m :=\n\u27e8fun h => \u27e8rfind_spec h, @rfind_min _ _ h\u27e9, fun \u27e8h\u2081, h\u2082\u27e9 => by\n let \u27e8m, hm\u27e9 := dom_iff_mem.1 <| (@rfind_dom p).2 \u27e8_, h\u2081, fun {m} mn => (h\u2082 mn).fst\u27e9\n rcases lt_trichotomy m n with (h | h | h)\n \u00b7 injection mem_unique (h\u2082 h) (rfind_spec hm)\n \u00b7 rwa [\u2190 h]\n \u00b7 injection mem_unique h\u2081 (rfind_min hm h)\u27e9\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Computability.Partrec.rfind_min' (L122-L126)\ntheorem rfind_min' {p : \u2115 \u2192 Bool} {m : \u2115} (pm : p m) : \u2203 n \u2208 rfind p, n \u2264 m :=\nhave : true \u2208 (p : \u2115 \u2192. Bool) m := \u27e8trivial, pm\u27e9\n let \u27e8n, hn\u27e9 := dom_iff_mem.1 <| (@rfind_dom p).2 \u27e8m, this, fun {_} _ => \u27e8\u27e9\u27e9\n \u27e8n, hn, not_lt.1 fun h => by injection mem_unique this (rfind_min hn h)\u27e9\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Computability.Partrec.rfind_zero_none (L127-L133)\ntheorem rfind_zero_none (p : \u2115 \u2192. Bool) (p0 : p 0 = Part.none) : rfind p = Part.none :=\neq_none_iff.2 fun _ h =>\n let \u27e8_, _, h\u2082\u27e9 := rfind_dom'.1 h.fst\n (p0 \u25b8 h\u2082 (zero_le _) : (@Part.none Bool).Dom)\n\n/-- Find the smallest `n` satisfying `f n`, where all `f k` for `k < n` are defined as false.\nReturns a `Part`. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Computability.Partrec.rfindOpt (L134-L136)\ndef rfindOpt {\u03b1} (f : \u2115 \u2192 Option \u03b1) : Part \u03b1 :=\n(rfind fun n => (f n).isSome).bind fun n => f n\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Computability.Partrec.rfindOpt_spec (L137-L140)\ntheorem rfindOpt_spec {\u03b1} {f : \u2115 \u2192 Option \u03b1} {a} (h : a \u2208 rfindOpt f) : \u2203 n, a \u2208 f n :=\nlet \u27e8n, _, h\u2082\u27e9 := mem_bind_iff.1 h\n \u27e8n, mem_coe.1 h\u2082\u27e9\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Computability.Partrec.rfindOpt_dom (L141-L150)\ntheorem rfindOpt_dom {\u03b1} {f : \u2115 \u2192 Option \u03b1} : (rfindOpt f).Dom \u2194 \u2203 n a, a \u2208 f n :=\n\u27e8fun h => (rfindOpt_spec \u27e8h, rfl\u27e9).imp fun _ h => \u27e8_, h\u27e9, fun h => by\n have h' : \u2203 n, (f n).isSome := h.imp fun n => Option.isSome_iff_exists.2\n have s := Nat.find_spec h'\n have fd : (rfind fun n => (f n).isSome).Dom :=\n \u27e8Nat.find h', by simpa using s.symm, fun _ _ => trivial\u27e9\n refine \u27e8fd, ?_\u27e9\n have := rfind_spec (get_mem fd)\n simpa using this\u27e9\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Computability.Partrec.rfindOpt_mono (L151-L173)\ntheorem rfindOpt_mono {\u03b1} {f : \u2115 \u2192 Option \u03b1} (H : \u2200 {a m n}, m \u2264 n \u2192 a \u2208 f m \u2192 a \u2208 f n) {a} :\n a \u2208 rfindOpt f \u2194 \u2203 n, a \u2208 f n :=\n\u27e8rfindOpt_spec, fun \u27e8n, h\u27e9 => by\n have h' := rfindOpt_dom.2 \u27e8_, _, h\u27e9\n obtain \u27e8k, hk\u27e9 := rfindOpt_spec \u27e8h', rfl\u27e9\n have := (H (le_max_left _ _) h).symm.trans (H (le_max_right _ _) hk)\n simp at this; simp [this, get_mem]\u27e9\n\n/-- `Nat.Partrec f` means that the partial function `f : \u2115 \u2192. \u2115` is partially recursive. -/\nprotected inductive Partrec : (\u2115 \u2192. \u2115) \u2192 Prop\n | zero : Nat.Partrec (pure 0)\n | succ : Nat.Partrec succ\n | left : Nat.Partrec \u2191fun n : \u2115 => n.unpair.1\n | right : Nat.Partrec \u2191fun n : \u2115 => n.unpair.2\n | pair {f g} : Nat.Partrec f \u2192 Nat.Partrec g \u2192 Nat.Partrec fun n => pair <$> f n <*> g n\n | comp {f g} : Nat.Partrec f \u2192 Nat.Partrec g \u2192 Nat.Partrec fun n => g n >>= f\n | prec {f g} : Nat.Partrec f \u2192 Nat.Partrec g \u2192 Nat.Partrec (unpaired fun a n =>\n n.rec (f a) fun y IH => do let i \u2190 IH; g (pair a (pair y i)))\n | rfind {f} : Nat.Partrec f \u2192\n Nat.Partrec fun a => rfind fun n => (fun m => m = 0) <$> f (pair a n)\n\nnamespace Partrec\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Computability.Partrec.of_eq (L174-L176)\ntheorem of_eq {f g : \u2115 \u2192. \u2115} (hf : Nat.Partrec f) (H : \u2200 n, f n = g n) : Nat.Partrec g :=\n(funext H : f = g) \u25b8 hf\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Computability.Partrec.of_eq_tot (L177-L180)\ntheorem of_eq_tot {f : \u2115 \u2192. \u2115} {g : \u2115 \u2192 \u2115} (hf : Nat.Partrec f) (H : \u2200 n, g n \u2208 f n) :\n Nat.Partrec g :=\nhf.of_eq fun n => eq_some_iff.2 (H n)\n```\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.Partrec).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem comp\u2082 {f : \u03b3 \u2192 \u03b4 \u2192. \u03c3} {g : \u03b1 \u2192 \u03b2 \u2192 \u03b3} {h : \u03b1 \u2192 \u03b2 \u2192 \u03b4} (hf : Partrec\u2082 f)\n (hg : Computable\u2082 g) (hh : Computable\u2082 h) : Partrec\u2082 fun a b => f (g a b) (h a b)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Computability.Partrec.rfindX (L65-L90)\ndef rfindX : { n // true \u2208 p n \u2227 \u2200 m < n, false \u2208 p m } :=\nsuffices \u2200 k, (\u2200 n < k, false \u2208 p n) \u2192 { n // true \u2208 p n \u2227 \u2200 m < n, false \u2208 p m } from\n this 0 fun _ => (Nat.not_lt_zero _).elim\n @WellFounded.fix _ _ (lbp p) (wf_lbp p H)\n (by\n intro m IH al\n have pm : (p m).Dom := by\n rcases H with \u27e8n, h\u2081, h\u2082\u27e9\n rcases lt_trichotomy m n with (h\u2083 | h\u2083 | h\u2083)\n \u00b7 exact h\u2082 _ h\u2083\n \u00b7 rw [h\u2083]\n exact h\u2081.fst\n \u00b7 injection mem_unique h\u2081 (al _ h\u2083)\n cases e : (p m).get pm\n \u00b7 suffices \u2200\u1d49 k \u2264 m, false \u2208 p k from IH _ \u27e8rfl, this\u27e9 fun n h => this _ (le_of_lt_succ h)\n intro n h\n rcases h.lt_or_eq_dec with h | h\n \u00b7 exact al _ h\n \u00b7 rw [h]\n exact \u27e8_, e\u27e9\n \u00b7 exact \u27e8m, \u27e8_, e\u27e9, al\u27e9)\n\nend Rfind\n\n/-- Find the smallest `n` satisfying `p n`, where all `p k` for `k < n` are defined as false.\nReturns a `Part`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Computability.Partrec.rfind (L91-L93)\ndef rfind (p : \u2115 \u2192. Bool) : Part \u2115 :=\n\u27e8_, fun h => (rfindX p h).1\u27e9\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Computability.Partrec.rfind_spec (L94-L96)\ntheorem rfind_spec {p : \u2115 \u2192. Bool} {n : \u2115} (h : n \u2208 rfind p) : true \u2208 p n :=\nh.snd \u25b8 (rfindX p h.fst).2.1\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Computability.Partrec.rfind_min (L97-L99)\ntheorem rfind_min {p : \u2115 \u2192. Bool} {n : \u2115} (h : n \u2208 rfind p) : \u2200 {m : \u2115}, m < n \u2192 false \u2208 p m :=\n@(h.snd \u25b8 @((rfindX p h.fst).2.2))\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Computability.Partrec.rfind_dom (L101-L104)\ntheorem rfind_dom {p : \u2115 \u2192. Bool} :\n (rfind p).Dom \u2194 \u2203 n, true \u2208 p n \u2227 \u2200 {m : \u2115}, m < n \u2192 (p m).Dom :=\nIff.rfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Computability.Partrec.rfind_dom' (L105-L111)\ntheorem rfind_dom' {p : \u2115 \u2192. Bool} :\n (rfind p).Dom \u2194 \u2203 n, true \u2208 p n \u2227 \u2200 {m : \u2115}, m \u2264 n \u2192 (p m).Dom :=\nexists_congr fun _ =>\n and_congr_right fun pn =>\n \u27e8fun H _ h => (Decidable.eq_or_lt_of_le h).elim (fun e => e.symm \u25b8 pn.fst) (H _), fun H _ h =>\n H (le_of_lt h)\u27e9\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Computability.Partrec.mem_rfind (L113-L121)\ntheorem mem_rfind {p : \u2115 \u2192. Bool} {n : \u2115} :\n n \u2208 rfind p \u2194 true \u2208 p n \u2227 \u2200 {m : \u2115}, m < n \u2192 false \u2208 p m :=\n\u27e8fun h => \u27e8rfind_spec h, @rfind_min _ _ h\u27e9, fun \u27e8h\u2081, h\u2082\u27e9 => by\n let \u27e8m, hm\u27e9 := dom_iff_mem.1 <| (@rfind_dom p).2 \u27e8_, h\u2081, fun {m} mn => (h\u2082 mn).fst\u27e9\n rcases lt_trichotomy m n with (h | h | h)\n \u00b7 injection mem_unique (h\u2082 h) (rfind_spec hm)\n \u00b7 rwa [\u2190 h]\n \u00b7 injection mem_unique h\u2081 (rfind_min hm h)\u27e9\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Computability.Partrec.rfind_min' (L122-L126)\ntheorem rfind_min' {p : \u2115 \u2192 Bool} {m : \u2115} (pm : p m) : \u2203 n \u2208 rfind p, n \u2264 m :=\nhave : true \u2208 (p : \u2115 \u2192. Bool) m := \u27e8trivial, pm\u27e9\n let \u27e8n, hn\u27e9 := dom_iff_mem.1 <| (@rfind_dom p).2 \u27e8m, this, fun {_} _ => \u27e8\u27e9\u27e9\n \u27e8n, hn, not_lt.1 fun h => by injection mem_unique this (rfind_min hn h)\u27e9\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Computability.Partrec.rfind_zero_none (L127-L133)\ntheorem rfind_zero_none (p : \u2115 \u2192. Bool) (p0 : p 0 = Part.none) : rfind p = Part.none :=\neq_none_iff.2 fun _ h =>\n let \u27e8_, _, h\u2082\u27e9 := rfind_dom'.1 h.fst\n (p0 \u25b8 h\u2082 (zero_le _) : (@Part.none Bool).Dom)\n\n/-- Find the smallest `n` satisfying `f n`, where all `f k` for `k < n` are defined as false.\nReturns a `Part`. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Computability.Partrec.rfindOpt (L134-L136)\ndef rfindOpt {\u03b1} (f : \u2115 \u2192 Option \u03b1) : Part \u03b1 :=\n(rfind fun n => (f n).isSome).bind fun n => f n\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Computability.Partrec.rfindOpt_spec (L137-L140)\ntheorem rfindOpt_spec {\u03b1} {f : \u2115 \u2192 Option \u03b1} {a} (h : a \u2208 rfindOpt f) : \u2203 n, a \u2208 f n :=\nlet \u27e8n, _, h\u2082\u27e9 := mem_bind_iff.1 h\n \u27e8n, mem_coe.1 h\u2082\u27e9\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Computability.Partrec.rfindOpt_dom (L141-L150)\ntheorem rfindOpt_dom {\u03b1} {f : \u2115 \u2192 Option \u03b1} : (rfindOpt f).Dom \u2194 \u2203 n a, a \u2208 f n :=\n\u27e8fun h => (rfindOpt_spec \u27e8h, rfl\u27e9).imp fun _ h => \u27e8_, h\u27e9, fun h => by\n have h' : \u2203 n, (f n).isSome := h.imp fun n => Option.isSome_iff_exists.2\n have s := Nat.find_spec h'\n have fd : (rfind fun n => (f n).isSome).Dom :=\n \u27e8Nat.find h', by simpa using s.symm, fun _ _ => trivial\u27e9\n refine \u27e8fd, ?_\u27e9\n have := rfind_spec (get_mem fd)\n simpa using this\u27e9\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Computability.Partrec.rfindOpt_mono (L151-L173)\ntheorem rfindOpt_mono {\u03b1} {f : \u2115 \u2192 Option \u03b1} (H : \u2200 {a m n}, m \u2264 n \u2192 a \u2208 f m \u2192 a \u2208 f n) {a} :\n a \u2208 rfindOpt f \u2194 \u2203 n, a \u2208 f n :=\n\u27e8rfindOpt_spec, fun \u27e8n, h\u27e9 => by\n have h' := rfindOpt_dom.2 \u27e8_, _, h\u27e9\n obtain \u27e8k, hk\u27e9 := rfindOpt_spec \u27e8h', rfl\u27e9\n have := (H (le_max_left _ _) h).symm.trans (H (le_max_right _ _) hk)\n simp at this; simp [this, get_mem]\u27e9\n\n/-- `Nat.Partrec f` means that the partial function `f : \u2115 \u2192. \u2115` is partially recursive. -/\nprotected inductive Partrec : (\u2115 \u2192. \u2115) \u2192 Prop\n | zero : Nat.Partrec (pure 0)\n | succ : Nat.Partrec succ\n | left : Nat.Partrec \u2191fun n : \u2115 => n.unpair.1\n | right : Nat.Partrec \u2191fun n : \u2115 => n.unpair.2\n | pair {f g} : Nat.Partrec f \u2192 Nat.Partrec g \u2192 Nat.Partrec fun n => pair <$> f n <*> g n\n | comp {f g} : Nat.Partrec f \u2192 Nat.Partrec g \u2192 Nat.Partrec fun n => g n >>= f\n | prec {f g} : Nat.Partrec f \u2192 Nat.Partrec g \u2192 Nat.Partrec (unpaired fun a n =>\n n.rec (f a) fun y IH => do let i \u2190 IH; g (pair a (pair y i)))\n | rfind {f} : Nat.Partrec f \u2192\n Nat.Partrec fun a => rfind fun n => (fun m => m = 0) <$> f (pair a n)\n\nnamespace Partrec\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Computability.Partrec.of_eq (L174-L176)\ntheorem of_eq {f g : \u2115 \u2192. \u2115} (hf : Nat.Partrec f) (H : \u2200 n, f n = g n) : Nat.Partrec g :=\n(funext H : f = g) \u25b8 hf\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Computability.Partrec.of_eq_tot (L177-L180)\ntheorem of_eq_tot {f : \u2115 \u2192. \u2115} {g : \u2115 \u2192 \u2115} (hf : Nat.Partrec f) (H : \u2200 n, g n \u2208 f n) :\n Nat.Partrec g :=\nhf.of_eq fun n => eq_some_iff.2 (H n)\n```\n[/INST]", "sample_id": "C-Mathlib.Computability.Partrec.comp\u2082", "source": {"declaration": "Mathlib.Computability.Partrec.comp\u2082", "file": "Mathlib/Computability/Partrec.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Computability.Partrec", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Computability/Partrec.lean#L449", "span": "L449-L463"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"trace_states": [{"state": "def lightCondSetToSequential : LightCondSet.{u} \u2964 Sequential.{u} where\n obj X", "tactic": "apply SeqContinuous.continuous unfold SeqContinuous"}, {"state": "", "tactic": "intro f p h let g := (topCatAdjunctionCounitEquiv X).invFun \u2218 (OnePoint.continuousMapMkNat f p h) change Filter.Tendsto (fun n : \u2115 \u21a6 g n) _ _ erw [\u2190 OnePoint.continuous_iff_from_nat] let x : X.toLightCondSet.obj.obj \u27e8(\u2115\u222a{\u221e})\u27e9 := OnePoint.continuousMapMkNat f p h"}, {"state": "", "tactic": "exact continuous_coinducingCoprod X.toLightCondSet x /-- The counit of the adjunction `lightCondSetToSequential \u22a3 sequentialToLightCondSet` is an isomorphism. Note: for now, we only have `\u2115\u222a{\u221e}` as a light profinite set at universe level 0, which is why we can only prove this for `X : Sequential.{0}`. -/ noncomputable def sequentialAdjunctionCounitIso (X : Sequential.{0}) : lightCondSetToSequential.obj (sequentialToLightCondSet.obj X) \u2245 X := isoOfHomeo (sequentialAdjunctionHomeo X.toTop)"}], "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1662, "declarations_count": 182, "diagnostics_count": 0, "duplicate_fingerprint": "7809f6bb4f159719", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 518, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "short", "line_count": 14, "natural_language_chars": 1662, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Condensed.Light.TopCatAdjunction).", "role": "system"}, {"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.Condensed.Light.TopCatAdjunction.lightCondSetToSequential`:\nState 0: \u22a2 def lightCondSetToSequential : LightCondSet.{u} \u2964 Sequential.{u} where\n obj X\nTactic: apply SeqContinuous.continuous unfold SeqContinuous\nState 1: \u22a2 \nTactic: intro f p h let g := (topCatAdjunctionCounitEquiv X).invFun \u2218 (OnePoint.continuousMapMkNat f p h) change Filter.Tendsto (fun n : \u2115 \u21a6 g n) _ _ erw [\u2190 OnePoint.continuous_iff_from_nat] let x : X.toLightCondSet.obj.obj \u27e8(\u2115\u222a{\u221e})\u27e9 := OnePoint.continuousMapMkNat f p h\nState 2: \u22a2 \nTactic: exact continuous_coinducingCoprod X.toLightCondSet x /-- The counit of the adjunction `lightCondSetToSequential \u22a3 sequentialToLightCondSet` is an isomorphism. Note: for now, we only have `\u2115\u222a{\u221e}` as a light profinite set at universe level 0, which is why we can only prove this for `X : Sequential.{0}`. -/ noncomputable def sequentialAdjunctionCounitIso (X : Sequential.{0}) : lightCondSetToSequential.obj (sequentialToLightCondSet.obj X) \u2245 X := isoOfHomeo (sequentialAdjunctionHomeo X.toTop)\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Condensed.Light.TopCatAdjunction).[/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.Condensed.Light.TopCatAdjunction.lightCondSetToSequential`:\nState 0: \u22a2 def lightCondSetToSequential : LightCondSet.{u} \u2964 Sequential.{u} where\n obj X\nTactic: apply SeqContinuous.continuous unfold SeqContinuous\nState 1: \u22a2 \nTactic: intro f p h let g := (topCatAdjunctionCounitEquiv X).invFun \u2218 (OnePoint.continuousMapMkNat f p h) change Filter.Tendsto (fun n : \u2115 \u21a6 g n) _ _ erw [\u2190 OnePoint.continuous_iff_from_nat] let x : X.toLightCondSet.obj.obj \u27e8(\u2115\u222a{\u221e})\u27e9 := OnePoint.continuousMapMkNat f p h\nState 2: \u22a2 \nTactic: exact continuous_coinducingCoprod X.toLightCondSet x /-- The counit of the adjunction `lightCondSetToSequential \u22a3 sequentialToLightCondSet` is an isomorphism. Note: for now, we only have `\u2115\u222a{\u221e}` as a light profinite set at universe level 0, which is why we can only prove this for `X : Sequential.{0}`. -/ noncomputable def sequentialAdjunctionCounitIso (X : Sequential.{0}) : lightCondSetToSequential.obj (sequentialToLightCondSet.obj X) \u2245 X := isoOfHomeo (sequentialAdjunctionHomeo X.toTop)\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.Condensed.Light.TopCatAdjunction.lightCondSetToSequential", "source": {"declaration": "Mathlib.Condensed.Light.TopCatAdjunction.lightCondSetToSequential", "file": "Mathlib/Condensed/Light/TopCatAdjunction.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Condensed.Light.TopCatAdjunction", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Condensed/Light/TopCatAdjunction.lean#L145", "span": "L145-L196"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "lemma topCatAdjunctionCounit_bijective (X : TopCat.{u + 1}) :\n Function.Bijective (topCatAdjunctionCounit X)\n:= _unbalancedParenXYZ\n(topCatAdjunctionCounitEquiv X).bijective\n\n/-- The unit of the adjunction `condensedSetToTopCat \u22a3 topCatToCondensedSet` -/", "diagnostic": "[CompilationUnit(i_begin=0, i_end=178, messages=[Message(data=\"Function expected at\\n topCatAdjunctionCounit\\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 `topCatAdjunctionCounit` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=24), pos_end=Position(line=2, column=48), severity=, kind=None), 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=178, i_end=259, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=6, column=79), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]", "mutation_kind": "term_arg_order", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1998, "declarations_count": 232, "diagnostics_count": 1, "duplicate_fingerprint": "5f7790bbb3ed5ccc", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 550, "lean_code_chars": 258, "lean_code_ratio": 0.1291, "length_bucket": "short", "line_count": 17, "natural_language_chars": 1740, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Condensed.TopCatAdjunction).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma topCatAdjunctionCounit_bijective (X : TopCat.{u + 1}) :\n Function.Bijective (topCatAdjunctionCounit X)\n:= _unbalancedParenXYZ\n(topCatAdjunctionCounitEquiv X).bijective\n\n/-- The unit of the adjunction `condensedSetToTopCat \u22a3 topCatToCondensedSet` -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=178, messages=[Message(data=\"Function expected at\\n topCatAdjunctionCounit\\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 `topCatAdjunctionCounit` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=24), pos_end=Position(line=2, column=48), severity=, kind=None), 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=178, i_end=259, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=6, column=79), 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.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Condensed.TopCatAdjunction).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma topCatAdjunctionCounit_bijective (X : TopCat.{u + 1}) :\n Function.Bijective (topCatAdjunctionCounit X)\n:= _unbalancedParenXYZ\n(topCatAdjunctionCounitEquiv X).bijective\n\n/-- The unit of the adjunction `condensedSetToTopCat \u22a3 topCatToCondensedSet` -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=178, messages=[Message(data=\"Function expected at\\n topCatAdjunctionCounit\\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 `topCatAdjunctionCounit` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=24), pos_end=Position(line=2, column=48), severity=, kind=None), 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=178, i_end=259, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=6, column=79), 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]", "sample_id": "B-Mathlib.Condensed.TopCatAdjunction.topCatAdjunctionCounit_bijective", "source": {"declaration": "Mathlib.Condensed.TopCatAdjunction.topCatAdjunctionCounit_bijective", "file": "Mathlib/Condensed/TopCatAdjunction.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Condensed.TopCatAdjunction", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Condensed/TopCatAdjunction.lean#L109", "span": "L109-L113"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "F", "construction": {"instruction": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.", "statement": "abbrev toArrow {x : X} (p : FundamentalGroup X x) :\n FundamentalGroupoid.mk x \u27f6 FundamentalGroupoid.mk x", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 690, "declarations_count": 58, "diagnostics_count": 0, "duplicate_fingerprint": "a929c7170e0502c4", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 192, "lean_code_chars": 108, "lean_code_ratio": 0.1565, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 582, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.FundamentalGroupoid.FundamentalGroup).", "role": "system"}, {"content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\nabbrev toArrow {x : X} (p : FundamentalGroup X x) :\n FundamentalGroupoid.mk x \u27f6 FundamentalGroupoid.mk x\n```\n\nDeclaration: `Mathlib.AlgebraicTopology.FundamentalGroupoid.FundamentalGroup.toArrow` (module Mathlib.AlgebraicTopology.FundamentalGroupoid.FundamentalGroup).", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.FundamentalGroupoid.FundamentalGroup).[/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 toArrow {x : X} (p : FundamentalGroup X x) :\n FundamentalGroupoid.mk x \u27f6 FundamentalGroupoid.mk x\n```\n\nDeclaration: `Mathlib.AlgebraicTopology.FundamentalGroupoid.FundamentalGroup.toArrow` (module Mathlib.AlgebraicTopology.FundamentalGroupoid.FundamentalGroup).[/INST]", "sample_id": "F-Mathlib.AlgebraicTopology.FundamentalGroupoid.FundamentalGroup.toArrow", "source": {"declaration": "Mathlib.AlgebraicTopology.FundamentalGroupoid.FundamentalGroup.toArrow", "file": "Mathlib/AlgebraicTopology/FundamentalGroupoid/FundamentalGroup.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.FundamentalGroupoid.FundamentalGroup", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/FundamentalGroupoid/FundamentalGroup.lean#L59", "span": "L59-L63"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "def lanSheafProfinite (X : Type (u + 1)) :\n Sheaf (coherentTopology Profinite.{u}) (Type (u + 1)) where\n obj\n frobnicateTacticThatDoesNotExist := lanPresheaf (locallyConstantPresheaf X)\nproperty := by\n rw [Presheaf.isSheaf_of_iso_iff (lanPresheafNatIso\n fun _ \u21a6 isColimitLocallyConstantPresheafDiagram _ _)]\n exact ((CompHausLike.LocallyConstant.functor.{u, u + 1}\n (hs := fun _ _ _ \u21a6 ((Profinite.effectiveEpi_tfae _).out 0 2).mp)).obj X).property\n\n/-- `lanPresheaf (locallyConstantPresheaf X)` as a condensed set. -/", "diagnostic": "[CompilationUnit(i_begin=0, i_end=191, messages=[Message(data=\"Function expected at\\n Sheaf\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n (coherentTopology Profinite.{u})\\n\\nHint: The identifier `Sheaf` 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=57), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=191, i_end=542, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=5, column=0), pos_end=Position(line=5, column=8), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=11, column=68), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]", "mutation_kind": "plausible_wrong_tactic", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 2242, "declarations_count": 266, "diagnostics_count": 1, "duplicate_fingerprint": "0ce4a3bc585fef12", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 646, "lean_code_chars": 539, "lean_code_ratio": 0.2404, "length_bucket": "short", "line_count": 22, "natural_language_chars": 1703, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Condensed.Discrete.Colimit).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef lanSheafProfinite (X : Type (u + 1)) :\n Sheaf (coherentTopology Profinite.{u}) (Type (u + 1)) where\n obj\n frobnicateTacticThatDoesNotExist := lanPresheaf (locallyConstantPresheaf X)\nproperty := by\n rw [Presheaf.isSheaf_of_iso_iff (lanPresheafNatIso\n fun _ \u21a6 isColimitLocallyConstantPresheafDiagram _ _)]\n exact ((CompHausLike.LocallyConstant.functor.{u, u + 1}\n (hs := fun _ _ _ \u21a6 ((Profinite.effectiveEpi_tfae _).out 0 2).mp)).obj X).property\n\n/-- `lanPresheaf (locallyConstantPresheaf X)` as a condensed set. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=191, messages=[Message(data=\"Function expected at\\n Sheaf\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n (coherentTopology Profinite.{u})\\n\\nHint: The identifier `Sheaf` 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=57), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=191, i_end=542, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=5, column=0), pos_end=Position(line=5, column=8), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=11, column=68), 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.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Condensed.Discrete.Colimit).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef lanSheafProfinite (X : Type (u + 1)) :\n Sheaf (coherentTopology Profinite.{u}) (Type (u + 1)) where\n obj\n frobnicateTacticThatDoesNotExist := lanPresheaf (locallyConstantPresheaf X)\nproperty := by\n rw [Presheaf.isSheaf_of_iso_iff (lanPresheafNatIso\n fun _ \u21a6 isColimitLocallyConstantPresheafDiagram _ _)]\n exact ((CompHausLike.LocallyConstant.functor.{u, u + 1}\n (hs := fun _ _ _ \u21a6 ((Profinite.effectiveEpi_tfae _).out 0 2).mp)).obj X).property\n\n/-- `lanPresheaf (locallyConstantPresheaf X)` as a condensed set. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=191, messages=[Message(data=\"Function expected at\\n Sheaf\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n (coherentTopology Profinite.{u})\\n\\nHint: The identifier `Sheaf` 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=57), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=191, i_end=542, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=5, column=0), pos_end=Position(line=5, column=8), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=11, column=68), 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]", "sample_id": "B-Mathlib.Condensed.Discrete.Colimit.lanSheafProfinite", "source": {"declaration": "Mathlib.Condensed.Discrete.Colimit.lanSheafProfinite", "file": "Mathlib/Condensed/Discrete/Colimit.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Condensed.Discrete.Colimit", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Condensed/Discrete/Colimit.lean#L162", "span": "L162-L171"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\ndef eraseProofs (e : Expr) : MetaM Expr := Meta.transform (skipConstInApp := true) e\n (pre := fun e => do\n if (\u2190 Meta.isProof e) then\n return .continue (\u2190 mkSorry (\u2190 inferType e) true)\n else\n return .continue)\n\n/-- If an `Expr` has the form `Type u`, then return `some u`, otherwise `none`. -/\n```", "instruction": "Edit `eraseProofs` so it still compiles and the proof is simplified where possible. Return the full updated `eraseProofs` block.", "proof_is_oneliner": false, "target_span": "L215-L223", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 997, "declarations_count": 116, "diagnostics_count": 0, "duplicate_fingerprint": "27a354034fe6998c", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 312, "lean_code_chars": 321, "lean_code_ratio": 0.322, "length_bucket": "tiny", "line_count": 17, "natural_language_chars": 676, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Lean.Expr.Basic).", "role": "system"}, {"content": "You are editing a file in `Mathlib/Lean/Expr/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Lean.Expr.Basic.eraseProofs`, L215-L223)\n```lean\ndef eraseProofs (e : Expr) : MetaM Expr := Meta.transform (skipConstInApp := true) e\n (pre := fun e => do\n if (\u2190 Meta.isProof e) then\n return .continue (\u2190 mkSorry (\u2190 inferType e) true)\n else\n return .continue)\n\n/-- If an `Expr` has the form `Type u`, then return `some u`, otherwise `none`. -/\n```\n\n## Edit instruction\nEdit `eraseProofs` so it still compiles and the proof is simplified where possible. Return the full updated `eraseProofs` block.\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Lean.Expr.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Lean/Expr/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Lean.Expr.Basic.eraseProofs`, L215-L223)\n```lean\ndef eraseProofs (e : Expr) : MetaM Expr := Meta.transform (skipConstInApp := true) e\n (pre := fun e => do\n if (\u2190 Meta.isProof e) then\n return .continue (\u2190 mkSorry (\u2190 inferType e) true)\n else\n return .continue)\n\n/-- If an `Expr` has the form `Type u`, then return `some u`, otherwise `none`. -/\n```\n\n## Edit instruction\nEdit `eraseProofs` so it still compiles and the proof is simplified where possible. Return the full updated `eraseProofs` block.\n[/INST]", "sample_id": "D-Mathlib.Lean.Expr.Basic.eraseProofs", "source": {"declaration": "Mathlib.Lean.Expr.Basic.eraseProofs", "file": "Mathlib/Lean/Expr/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Lean.Expr.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Lean/Expr/Basic.lean#L215", "span": "L215-L223"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalComp_nil_nil (L37-L40)\ntheorem evalComp_nil_nil (\u03b1 : f \u2245 g) (\u03b2 : g \u2245 h) :\n (\u03b1 \u226a\u226b \u03b2).hom = (\u03b1 \u226a\u226b \u03b2).hom := by\nsimp", "-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalComp_nil_cons (L41-L44)\ntheorem evalComp_nil_cons (\u03b1 : f \u2245 g) (\u03b2 : g \u2245 h) (\u03b7 : h \u27f6 i) (\u03b7s : i \u27f6 j) :\n \u03b1.hom \u226b (\u03b2.hom \u226b \u03b7 \u226b \u03b7s) = (\u03b1 \u226a\u226b \u03b2).hom \u226b \u03b7 \u226b \u03b7s := by\nsimp", "-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalComp_cons (L45-L49)\ntheorem evalComp_cons (\u03b1 : f \u2245 g) (\u03b7 : g \u27f6 h) {\u03b7s : h \u27f6 i} {\u03b8 : i \u27f6 j} {\u03b9 : h \u27f6 j}\n (e_\u03b9 : \u03b7s \u226b \u03b8 = \u03b9) :\n (\u03b1.hom \u226b \u03b7 \u226b \u03b7s) \u226b \u03b8 = \u03b1.hom \u226b \u03b7 \u226b \u03b9 := by\nsimp [e_\u03b9]", "-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.eval_comp (L50-L55)\ntheorem eval_comp\n {\u03b7 \u03b7' : f \u27f6 g} {\u03b8 \u03b8' : g \u27f6 h} {\u03b9 : f \u27f6 h}\n (e_\u03b7 : \u03b7 = \u03b7') (e_\u03b8 : \u03b8 = \u03b8') (e_\u03b7\u03b8 : \u03b7' \u226b \u03b8' = \u03b9) :\n \u03b7 \u226b \u03b8 = \u03b9 := by\nsimp [e_\u03b7, e_\u03b8, e_\u03b7\u03b8]", "-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.eval_of (L56-L59)\ntheorem eval_of (\u03b7 : f \u27f6 g) :\n \u03b7 = (Iso.refl _).hom \u226b \u03b7 \u226b (Iso.refl _).hom := by\nsimp", "-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.eval_monoidalComp (L60-L65)\ntheorem eval_monoidalComp\n {\u03b7 \u03b7' : f \u27f6 g} {\u03b1 : g \u2245 h} {\u03b8 \u03b8' : h \u27f6 i} {\u03b1\u03b8 : g \u27f6 i} {\u03b7\u03b1\u03b8 : f \u27f6 i}\n (e_\u03b7 : \u03b7 = \u03b7') (e_\u03b8 : \u03b8 = \u03b8') (e_\u03b1\u03b8 : \u03b1.hom \u226b \u03b8' = \u03b1\u03b8) (e_\u03b7\u03b1\u03b8 : \u03b7' \u226b \u03b1\u03b8 = \u03b7\u03b1\u03b8) :\n \u03b7 \u226b \u03b1.hom \u226b \u03b8 = \u03b7\u03b1\u03b8 := by\nsimp [e_\u03b7, e_\u03b8, e_\u03b1\u03b8, e_\u03b7\u03b1\u03b8]", "-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalWhiskerLeft_nil (L67-L70)\ntheorem evalWhiskerLeft_nil (f : a \u27f6 b) {g h : b \u27f6 c} (\u03b1 : g \u2245 h) :\n (whiskerLeftIso f \u03b1).hom = (whiskerLeftIso f \u03b1).hom := by\nsimp", "-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalWhiskerLeft_of_cons (L71-L76)\ntheorem evalWhiskerLeft_of_cons\n {f : a \u27f6 b} {g h i j : b \u27f6 c}\n (\u03b1 : g \u2245 h) (\u03b7 : h \u27f6 i) {\u03b7s : i \u27f6 j} {\u03b8 : f \u226b i \u27f6 f \u226b j} (e_\u03b8 : f \u25c1 \u03b7s = \u03b8) :\n f \u25c1 (\u03b1.hom \u226b \u03b7 \u226b \u03b7s) = (whiskerLeftIso f \u03b1).hom \u226b f \u25c1 \u03b7 \u226b \u03b8 := by\nsimp [e_\u03b8]", "-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalWhiskerLeft_comp (L77-L85)\ntheorem evalWhiskerLeft_comp\n {f : a \u27f6 b} {g : b \u27f6 c} {h i : c \u27f6 d}\n {\u03b7 : h \u27f6 i} {\u03b7\u2081 : g \u226b h \u27f6 g \u226b i} {\u03b7\u2082 : f \u226b g \u226b h \u27f6 f \u226b g \u226b i}\n {\u03b7\u2083 : f \u226b g \u226b h \u27f6 (f \u226b g) \u226b i} {\u03b7\u2084 : (f \u226b g) \u226b h \u27f6 (f \u226b g) \u226b i}\n (e_\u03b7\u2081 : g \u25c1 \u03b7 = \u03b7\u2081) (e_\u03b7\u2082 : f \u25c1 \u03b7\u2081 = \u03b7\u2082)\n (e_\u03b7\u2083 : \u03b7\u2082 \u226b (\u03b1_ _ _ _).inv = \u03b7\u2083) (e_\u03b7\u2084 : (\u03b1_ _ _ _).hom \u226b \u03b7\u2083 = \u03b7\u2084) :\n (f \u226b g) \u25c1 \u03b7 = \u03b7\u2084 := by\nsimp [e_\u03b7\u2081, e_\u03b7\u2082, e_\u03b7\u2083, e_\u03b7\u2084]", "-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalWhiskerLeft_id (L86-L91)\ntheorem evalWhiskerLeft_id {\u03b7 : f \u27f6 g}\n {\u03b7\u2081 : f \u27f6 \ud835\udfd9 a \u226b g} {\u03b7\u2082 : \ud835\udfd9 a \u226b f \u27f6 \ud835\udfd9 a \u226b g}\n (e_\u03b7\u2081 : \u03b7 \u226b (\u03bb_ _).inv = \u03b7\u2081) (e_\u03b7\u2082 : (\u03bb_ _).hom \u226b \u03b7\u2081 = \u03b7\u2082) :\n \ud835\udfd9 a \u25c1 \u03b7 = \u03b7\u2082 := by\nsimp [e_\u03b7\u2081, e_\u03b7\u2082]", "-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.eval_whiskerLeft (L92-L98)\ntheorem eval_whiskerLeft\n {f : a \u27f6 b} {g h : b \u27f6 c}\n {\u03b7 \u03b7' : g \u27f6 h} {\u03b8 : f \u226b g \u27f6 f \u226b h}\n (e_\u03b7 : \u03b7 = \u03b7') (e_\u03b8 : f \u25c1 \u03b7' = \u03b8) :\n f \u25c1 \u03b7 = \u03b8 := by\nsimp [e_\u03b7, e_\u03b8]", "-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.eval_whiskerRight (L99-L105)\ntheorem eval_whiskerRight\n {f g : a \u27f6 b} {h : b \u27f6 c}\n {\u03b7 \u03b7' : f \u27f6 g} {\u03b8 : f \u226b h \u27f6 g \u226b h}\n (e_\u03b7 : \u03b7 = \u03b7') (e_\u03b8 : \u03b7' \u25b7 h = \u03b8) :\n \u03b7 \u25b7 h = \u03b8 := by\nsimp [e_\u03b7, e_\u03b8]", "-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalWhiskerRight_nil (L107-L110)\ntheorem evalWhiskerRight_nil (\u03b1 : f \u2245 g) (h : b \u27f6 c) :\n \u03b1.hom \u25b7 h = \u03b1.hom \u25b7 h := by\nsimp", "-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalWhiskerRight_cons_of_of (L115-L123)\ntheorem evalWhiskerRight_cons_of_of\n {f g h i : a \u27f6 b} {j : b \u27f6 c}\n {\u03b1 : f \u2245 g} {\u03b7 : g \u27f6 h} {\u03b7s : h \u27f6 i} {\u03b7s\u2081 : h \u226b j \u27f6 i \u226b j}\n {\u03b7\u2081 : g \u226b j \u27f6 h \u226b j} {\u03b7\u2082 : g \u226b j \u27f6 i \u226b j} {\u03b7\u2083 : f \u226b j \u27f6 i \u226b j}\n (e_\u03b7s\u2081 : \u03b7s \u25b7 j = \u03b7s\u2081) (e_\u03b7\u2081 : \u03b7 \u25b7 j = \u03b7\u2081)\n (e_\u03b7\u2082 : \u03b7\u2081 \u226b \u03b7s\u2081 = \u03b7\u2082) (e_\u03b7\u2083 : (whiskerRightIso \u03b1 j).hom \u226b \u03b7\u2082 = \u03b7\u2083) :\n (\u03b1.hom \u226b \u03b7 \u226b \u03b7s) \u25b7 j = \u03b7\u2083 := by\nsimp_all", "-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalWhiskerRight_cons_whisker (L124-L137)\ntheorem evalWhiskerRight_cons_whisker\n {f : a \u27f6 b} {g : a \u27f6 c} {h i : b \u27f6 c} {j : a \u27f6 c} {k : c \u27f6 d}\n {\u03b1 : g \u2245 f \u226b h} {\u03b7 : h \u27f6 i} {\u03b7s : f \u226b i \u27f6 j}\n {\u03b7\u2081 : h \u226b k \u27f6 i \u226b k} {\u03b7\u2082 : f \u226b (h \u226b k) \u27f6 f \u226b (i \u226b k)} {\u03b7s\u2081 : (f \u226b i) \u226b k \u27f6 j \u226b k}\n {\u03b7s\u2082 : f \u226b (i \u226b k) \u27f6 j \u226b k} {\u03b7\u2083 : f \u226b (h \u226b k) \u27f6 j \u226b k} {\u03b7\u2084 : (f \u226b h) \u226b k \u27f6 j \u226b k}\n {\u03b7\u2085 : g \u226b k \u27f6 j \u226b k}\n (e_\u03b7\u2081 : ((Iso.refl _).hom \u226b \u03b7 \u226b (Iso.refl _).hom) \u25b7 k = \u03b7\u2081) (e_\u03b7\u2082 : f \u25c1 \u03b7\u2081 = \u03b7\u2082)\n (e_\u03b7s\u2081 : \u03b7s \u25b7 k = \u03b7s\u2081) (e_\u03b7s\u2082 : (\u03b1_ _ _ _).inv \u226b \u03b7s\u2081 = \u03b7s\u2082)\n (e_\u03b7\u2083 : \u03b7\u2082 \u226b \u03b7s\u2082 = \u03b7\u2083) (e_\u03b7\u2084 : (\u03b1_ _ _ _).hom \u226b \u03b7\u2083 = \u03b7\u2084)\n (e_\u03b7\u2085 : (whiskerRightIso \u03b1 k).hom \u226b \u03b7\u2084 = \u03b7\u2085) :\n (\u03b1.hom \u226b (f \u25c1 \u03b7) \u226b \u03b7s) \u25b7 k = \u03b7\u2085 := by\nsimp at e_\u03b7\u2081 e_\u03b7\u2085\n simp [e_\u03b7\u2081, e_\u03b7\u2082, e_\u03b7s\u2081, e_\u03b7s\u2082, e_\u03b7\u2083, e_\u03b7\u2084, e_\u03b7\u2085]", "-- Mathlib.Tactic.CategoryTheory.Bicategory.Basic.bicategoryNf (L35-L37)\ndef bicategoryNf (mvarId : MVarId) : MetaM (List MVarId) := do\nBicategoryLike.normalForm Bicategory.Context `bicategory mvarId", "-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.left' (L96-L99)\ninstance left' (f g : a \u27f6 b) [BicategoricalCoherence f g] :\n BicategoricalCoherence f (\ud835\udfd9 a \u226b g) :=\n\u27e8\u2297\ud835\udfd9 \u226a\u226b (\u03bb_ g).symm\u27e9", "-- Mathlib.Tactic.CategoryTheory.Bicategory.Datatypes.mkContext (L68-L85)\ndef mkContext? (e : Expr) : MetaM (Option Context) := do\nlet e \u2190 instantiateMVars e\n let type \u2190 instantiateMVars <| \u2190 inferType e\n match (\u2190 whnfR (\u2190 inferType e)).getAppFnArgs with\n | (``Quiver.Hom, #[_, _, f, _]) =>\n let fType \u2190 instantiateMVars <| \u2190 inferType f\n match (\u2190 whnfR fType).getAppFnArgs with\n | (``Quiver.Hom, #[_, _, a, _]) =>\n let B \u2190 inferType a\n let .succ level\u2080 \u2190 getLevel B | return none\n let .succ level\u2081 \u2190 getLevel fType | return none\n let .succ level\u2082 \u2190 getLevel type | return none\n let some instBicategory \u2190 synthInstance?\n (mkAppN (.const ``Bicategory [level\u2082, level\u2081, level\u2080]) #[B]) | return none\n return some \u27e8level\u2082, level\u2081, level\u2080, B, instBicategory\u27e9\n | _ => return none\n | _ => return none", "-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.bicategoricalComp_refl (L125-L128)\ntheorem bicategoricalComp_refl {f g h : a \u27f6 b} (\u03b7 : f \u27f6 g) (\u03b8 : g \u27f6 h) : \u03b7 \u2297\u226b \u03b8 = \u03b7 \u226b \u03b8 := by\ndsimp [bicategoricalComp]; simp\n\nend CategoryTheory", "-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.bicategoricalIso (L41-L45)\nabbrev bicategoricalIso (f g : a \u27f6 b) [BicategoricalCoherence f g] : f \u2245 g :=\n\u2297\ud835\udfd9\n\n/-- Compose two morphisms in a bicategorical category,\ninserting unitors and associators between as necessary. -/", "-- Mathlib.Tactic.CategoryTheory.Bicategory.Datatypes.structuralIso_inv (L113-L116)\ntheorem structuralIso_inv {f g : a \u27f6 b} (\u03b7 : f \u2245 g) :\n \u03b7.symm.hom = \u03b7.inv := by\nsimp only [Iso.symm_hom]", "-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.bicategoricalIsoComp (L56-L59)\ndef bicategoricalIsoComp {f g h i : a \u27f6 b} [BicategoricalCoherence g h]\n (\u03b7 : f \u2245 g) (\u03b8 : h \u2245 i) : f \u2245 i :=\n\u03b7 \u226a\u226b \u2297\ud835\udfd9 \u226a\u226b \u03b8", "-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.tensorRight' (L86-L89)\ninstance tensorRight' (f : a \u27f6 b) (g : b \u27f6 b)\n [BicategoricalCoherence g (\ud835\udfd9 b)] : BicategoricalCoherence (f \u226b g) f :=\n\u27e8whiskerLeftIso f \u2297\ud835\udfd9 \u226a\u226b (\u03c1_ f)\u27e9", "-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.whiskerRight (L76-L79)\ninstance whiskerRight (f g : a \u27f6 b) (h : b \u27f6 c)\n [BicategoricalCoherence f g] : BicategoricalCoherence (f \u226b h) (g \u226b h) :=\n\u27e8whiskerRightIso \u2297\ud835\udfd9 h\u27e9", "-- Mathlib.Tactic.CategoryTheory.Bicategory.Datatypes.tgtExprOfIso (L47-L67)\ndef tgtExprOfIso (\u03b7 : Expr) : MetaM Expr := do\nmatch (\u2190 whnfR (\u2190 inferType \u03b7)).getAppFnArgs with\n | (``Iso, #[_, _, _, g]) => return g\n | _ => throwError m!\"{\u03b7} is not a morphism\"\n\ninitialize registerTraceClass `bicategory\n\n/-- The context for evaluating expressions. -/\nstructure Context where\n /-- The level for 2-morphisms. -/\n level\u2082 : Level\n /-- The level for 1-morphisms. -/\n level\u2081 : Level\n /-- The level for objects. -/\n level\u2080 : Level\n /-- The expression for the underlying category. -/\n B : Q(Type level\u2080)\n /-- The bicategory instance. -/\n instBicategory : Q(Bicategory.{level\u2082, level\u2081} $B)\n\n/-- Populate a `context` object for evaluating `e`. -/", "-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.tensorRight (L81-L84)\ninstance tensorRight (f : a \u27f6 b) (g : b \u27f6 b)\n [BicategoricalCoherence (\ud835\udfd9 b) g] : BicategoricalCoherence f (f \u226b g) :=\n\u27e8(\u03c1_ f).symm \u226a\u226b (whiskerLeftIso f \u2297\ud835\udfd9)\u27e9", "-- Mathlib.Tactic.CategoryTheory.Bicategory.Datatypes.tgtExpr (L35-L40)\ndef tgtExpr (\u03b7 : Expr) : MetaM Expr := do\nmatch (\u2190 whnfR (\u2190 inferType \u03b7)).getAppFnArgs with\n | (``Quiver.Hom, #[_, _, _, g]) => return g\n | _ => throwError m!\"{\u03b7} is not a morphism\"\n\n/-- The domain of an isomorphism. -/", "-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.bicategoricalComp (L46-L50)\ndef bicategoricalComp {f g h i : a \u27f6 b} [BicategoricalCoherence g h]\n (\u03b7 : f \u27f6 g) (\u03b8 : h \u27f6 i) : f \u27f6 i :=\n\u03b7 \u226b \u2297\ud835\udfd9.hom \u226b \u03b8\n\n-- type as \\ot \\gg", "-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.whiskerLeft (L71-L74)\ninstance whiskerLeft (f : a \u27f6 b) (g h : b \u27f6 c)\n [BicategoricalCoherence g h] : BicategoricalCoherence (f \u226b g) (f \u226b h) :=\n\u27e8whiskerLeftIso f \u2297\ud835\udfd9\u27e9", "-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.left (L91-L94)\ninstance left (f g : a \u27f6 b) [BicategoricalCoherence f g] :\n BicategoricalCoherence (\ud835\udfd9 a \u226b f) g :=\n\u27e8\u03bb_ f \u226a\u226b \u2297\ud835\udfd9\u27e9", "-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.right' (L106-L109)\ninstance right' (f g : a \u27f6 b) [BicategoricalCoherence f g] :\n BicategoricalCoherence f (g \u226b \ud835\udfd9 b) :=\n\u27e8\u2297\ud835\udfd9 \u226a\u226b (\u03c1_ g).symm\u27e9", "-- Mathlib.Tactic.CategoryTheory.Bicategory.Datatypes.BicategoryM (L90-L91)\nabbrev BicategoryM := CoherenceM Context", "-- Mathlib.Tactic.CategoryTheory.Bicategory.Basic.bicategory (L52-L54)\ndef bicategory (mvarId : MVarId) : MetaM (List MVarId) :=\nBicategoryLike.main Bicategory.Context `bicategory mvarId", "-- Mathlib.Tactic.CategoryTheory.Bicategory.Datatypes.srcExpr (L29-L34)\ndef srcExpr (\u03b7 : Expr) : MetaM Expr := do\nmatch (\u2190 whnfR (\u2190 inferType \u03b7)).getAppFnArgs with\n | (``Quiver.Hom, #[_, _, f, _]) => return f\n | _ => throwError m!\"{\u03b7} is not a morphism\"\n\n/-- The codomain of a morphism. -/", "-- Mathlib.Tactic.CategoryTheory.Bicategory.Datatypes.srcExprOfIso (L41-L46)\ndef srcExprOfIso (\u03b7 : Expr) : MetaM Expr := do\nmatch (\u2190 whnfR (\u2190 inferType \u03b7)).getAppFnArgs with\n | (``Iso, #[_, _, f, _]) => return f\n | _ => throwError m!\"{\u03b7} is not a morphism\"\n\n/-- The codomain of an isomorphism. -/", "-- Mathlib.Tactic.CategoryTheory.Bicategory.Datatypes.structuralIsoOfExpr_comp (L117-L122)\ntheorem structuralIsoOfExpr_comp {f g h : a \u27f6 b}\n (\u03b7 : f \u27f6 g) (\u03b7' : f \u2245 g) (ih_\u03b7 : \u03b7'.hom = \u03b7)\n (\u03b8 : g \u27f6 h) (\u03b8' : g \u2245 h) (ih_\u03b8 : \u03b8'.hom = \u03b8) :\n (\u03b7' \u226a\u226b \u03b8').hom = \u03b7 \u226b \u03b8 := by\nsimp [ih_\u03b7, ih_\u03b8]", "-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.refl (L67-L69)\ninstance refl (f : a \u27f6 b) : BicategoricalCoherence f f :=\n\u27e8Iso.refl _\u27e9", "-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.assoc (L111-L115)\ninstance assoc (f : a \u27f6 b) (g : b \u27f6 c) (h : c \u27f6 d) (i : a \u27f6 d)\n [BicategoricalCoherence (f \u226b g \u226b h) i] :\n BicategoricalCoherence ((f \u226b g) \u226b h) i :=\n\u27e8\u03b1_ f g h \u226a\u226b \u2297\ud835\udfd9\u27e9", "-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.assoc' (L117-L123)\ninstance assoc' (f : a \u27f6 b) (g : b \u27f6 c) (h : c \u27f6 d) (i : a \u27f6 d)\n [BicategoricalCoherence i (f \u226b g \u226b h)] :\n BicategoricalCoherence i ((f \u226b g) \u226b h) :=\n\u27e8\u2297\ud835\udfd9 \u226a\u226b (\u03b1_ f g h).symm\u27e9\n\nend BicategoricalCoherence", "-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.right (L101-L104)\ninstance right (f g : a \u27f6 b) [BicategoricalCoherence f g] :\n BicategoricalCoherence (f \u226b \ud835\udfd9 b) g :=\n\u27e8\u03c1_ f \u226a\u226b \u2297\ud835\udfd9\u27e9"], "statement": "theorem evalWhiskerRightAux_of {f g : a \u27f6 b} (\u03b7 : f \u27f6 g) (h : b \u27f6 c) :\n \u03b7 \u25b7 h = (Iso.refl _).hom \u226b \u03b7 \u25b7 h \u226b (Iso.refl _).hom", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 12952, "declarations_count": 1353, "diagnostics_count": 0, "duplicate_fingerprint": "1bb63fdbf22f1d22", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 5785, "lean_code_chars": 11433, "lean_code_ratio": 0.8827, "length_bucket": "medium", "line_count": 410, "natural_language_chars": 1519, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 40, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.CategoryTheory.Bicategory.Normalize).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem evalWhiskerRightAux_of {f g : a \u27f6 b} (\u03b7 : f \u27f6 g) (h : b \u27f6 c) :\n \u03b7 \u25b7 h = (Iso.refl _).hom \u226b \u03b7 \u25b7 h \u226b (Iso.refl _).hom\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalComp_nil_nil (L37-L40)\ntheorem evalComp_nil_nil (\u03b1 : f \u2245 g) (\u03b2 : g \u2245 h) :\n (\u03b1 \u226a\u226b \u03b2).hom = (\u03b1 \u226a\u226b \u03b2).hom := by\nsimp\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalComp_nil_cons (L41-L44)\ntheorem evalComp_nil_cons (\u03b1 : f \u2245 g) (\u03b2 : g \u2245 h) (\u03b7 : h \u27f6 i) (\u03b7s : i \u27f6 j) :\n \u03b1.hom \u226b (\u03b2.hom \u226b \u03b7 \u226b \u03b7s) = (\u03b1 \u226a\u226b \u03b2).hom \u226b \u03b7 \u226b \u03b7s := by\nsimp\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalComp_cons (L45-L49)\ntheorem evalComp_cons (\u03b1 : f \u2245 g) (\u03b7 : g \u27f6 h) {\u03b7s : h \u27f6 i} {\u03b8 : i \u27f6 j} {\u03b9 : h \u27f6 j}\n (e_\u03b9 : \u03b7s \u226b \u03b8 = \u03b9) :\n (\u03b1.hom \u226b \u03b7 \u226b \u03b7s) \u226b \u03b8 = \u03b1.hom \u226b \u03b7 \u226b \u03b9 := by\nsimp [e_\u03b9]\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.eval_comp (L50-L55)\ntheorem eval_comp\n {\u03b7 \u03b7' : f \u27f6 g} {\u03b8 \u03b8' : g \u27f6 h} {\u03b9 : f \u27f6 h}\n (e_\u03b7 : \u03b7 = \u03b7') (e_\u03b8 : \u03b8 = \u03b8') (e_\u03b7\u03b8 : \u03b7' \u226b \u03b8' = \u03b9) :\n \u03b7 \u226b \u03b8 = \u03b9 := by\nsimp [e_\u03b7, e_\u03b8, e_\u03b7\u03b8]\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.eval_of (L56-L59)\ntheorem eval_of (\u03b7 : f \u27f6 g) :\n \u03b7 = (Iso.refl _).hom \u226b \u03b7 \u226b (Iso.refl _).hom := by\nsimp\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.eval_monoidalComp (L60-L65)\ntheorem eval_monoidalComp\n {\u03b7 \u03b7' : f \u27f6 g} {\u03b1 : g \u2245 h} {\u03b8 \u03b8' : h \u27f6 i} {\u03b1\u03b8 : g \u27f6 i} {\u03b7\u03b1\u03b8 : f \u27f6 i}\n (e_\u03b7 : \u03b7 = \u03b7') (e_\u03b8 : \u03b8 = \u03b8') (e_\u03b1\u03b8 : \u03b1.hom \u226b \u03b8' = \u03b1\u03b8) (e_\u03b7\u03b1\u03b8 : \u03b7' \u226b \u03b1\u03b8 = \u03b7\u03b1\u03b8) :\n \u03b7 \u226b \u03b1.hom \u226b \u03b8 = \u03b7\u03b1\u03b8 := by\nsimp [e_\u03b7, e_\u03b8, e_\u03b1\u03b8, e_\u03b7\u03b1\u03b8]\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalWhiskerLeft_nil (L67-L70)\ntheorem evalWhiskerLeft_nil (f : a \u27f6 b) {g h : b \u27f6 c} (\u03b1 : g \u2245 h) :\n (whiskerLeftIso f \u03b1).hom = (whiskerLeftIso f \u03b1).hom := by\nsimp\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalWhiskerLeft_of_cons (L71-L76)\ntheorem evalWhiskerLeft_of_cons\n {f : a \u27f6 b} {g h i j : b \u27f6 c}\n (\u03b1 : g \u2245 h) (\u03b7 : h \u27f6 i) {\u03b7s : i \u27f6 j} {\u03b8 : f \u226b i \u27f6 f \u226b j} (e_\u03b8 : f \u25c1 \u03b7s = \u03b8) :\n f \u25c1 (\u03b1.hom \u226b \u03b7 \u226b \u03b7s) = (whiskerLeftIso f \u03b1).hom \u226b f \u25c1 \u03b7 \u226b \u03b8 := by\nsimp [e_\u03b8]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalWhiskerLeft_comp (L77-L85)\ntheorem evalWhiskerLeft_comp\n {f : a \u27f6 b} {g : b \u27f6 c} {h i : c \u27f6 d}\n {\u03b7 : h \u27f6 i} {\u03b7\u2081 : g \u226b h \u27f6 g \u226b i} {\u03b7\u2082 : f \u226b g \u226b h \u27f6 f \u226b g \u226b i}\n {\u03b7\u2083 : f \u226b g \u226b h \u27f6 (f \u226b g) \u226b i} {\u03b7\u2084 : (f \u226b g) \u226b h \u27f6 (f \u226b g) \u226b i}\n (e_\u03b7\u2081 : g \u25c1 \u03b7 = \u03b7\u2081) (e_\u03b7\u2082 : f \u25c1 \u03b7\u2081 = \u03b7\u2082)\n (e_\u03b7\u2083 : \u03b7\u2082 \u226b (\u03b1_ _ _ _).inv = \u03b7\u2083) (e_\u03b7\u2084 : (\u03b1_ _ _ _).hom \u226b \u03b7\u2083 = \u03b7\u2084) :\n (f \u226b g) \u25c1 \u03b7 = \u03b7\u2084 := by\nsimp [e_\u03b7\u2081, e_\u03b7\u2082, e_\u03b7\u2083, e_\u03b7\u2084]\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalWhiskerLeft_id (L86-L91)\ntheorem evalWhiskerLeft_id {\u03b7 : f \u27f6 g}\n {\u03b7\u2081 : f \u27f6 \ud835\udfd9 a \u226b g} {\u03b7\u2082 : \ud835\udfd9 a \u226b f \u27f6 \ud835\udfd9 a \u226b g}\n (e_\u03b7\u2081 : \u03b7 \u226b (\u03bb_ _).inv = \u03b7\u2081) (e_\u03b7\u2082 : (\u03bb_ _).hom \u226b \u03b7\u2081 = \u03b7\u2082) :\n \ud835\udfd9 a \u25c1 \u03b7 = \u03b7\u2082 := by\nsimp [e_\u03b7\u2081, e_\u03b7\u2082]\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.eval_whiskerLeft (L92-L98)\ntheorem eval_whiskerLeft\n {f : a \u27f6 b} {g h : b \u27f6 c}\n {\u03b7 \u03b7' : g \u27f6 h} {\u03b8 : f \u226b g \u27f6 f \u226b h}\n (e_\u03b7 : \u03b7 = \u03b7') (e_\u03b8 : f \u25c1 \u03b7' = \u03b8) :\n f \u25c1 \u03b7 = \u03b8 := by\nsimp [e_\u03b7, e_\u03b8]\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.eval_whiskerRight (L99-L105)\ntheorem eval_whiskerRight\n {f g : a \u27f6 b} {h : b \u27f6 c}\n {\u03b7 \u03b7' : f \u27f6 g} {\u03b8 : f \u226b h \u27f6 g \u226b h}\n (e_\u03b7 : \u03b7 = \u03b7') (e_\u03b8 : \u03b7' \u25b7 h = \u03b8) :\n \u03b7 \u25b7 h = \u03b8 := by\nsimp [e_\u03b7, e_\u03b8]\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalWhiskerRight_nil (L107-L110)\ntheorem evalWhiskerRight_nil (\u03b1 : f \u2245 g) (h : b \u27f6 c) :\n \u03b1.hom \u25b7 h = \u03b1.hom \u25b7 h := by\nsimp\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalWhiskerRight_cons_of_of (L115-L123)\ntheorem evalWhiskerRight_cons_of_of\n {f g h i : a \u27f6 b} {j : b \u27f6 c}\n {\u03b1 : f \u2245 g} {\u03b7 : g \u27f6 h} {\u03b7s : h \u27f6 i} {\u03b7s\u2081 : h \u226b j \u27f6 i \u226b j}\n {\u03b7\u2081 : g \u226b j \u27f6 h \u226b j} {\u03b7\u2082 : g \u226b j \u27f6 i \u226b j} {\u03b7\u2083 : f \u226b j \u27f6 i \u226b j}\n (e_\u03b7s\u2081 : \u03b7s \u25b7 j = \u03b7s\u2081) (e_\u03b7\u2081 : \u03b7 \u25b7 j = \u03b7\u2081)\n (e_\u03b7\u2082 : \u03b7\u2081 \u226b \u03b7s\u2081 = \u03b7\u2082) (e_\u03b7\u2083 : (whiskerRightIso \u03b1 j).hom \u226b \u03b7\u2082 = \u03b7\u2083) :\n (\u03b1.hom \u226b \u03b7 \u226b \u03b7s) \u25b7 j = \u03b7\u2083 := by\nsimp_all\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalWhiskerRight_cons_whisker (L124-L137)\ntheorem evalWhiskerRight_cons_whisker\n {f : a \u27f6 b} {g : a \u27f6 c} {h i : b \u27f6 c} {j : a \u27f6 c} {k : c \u27f6 d}\n {\u03b1 : g \u2245 f \u226b h} {\u03b7 : h \u27f6 i} {\u03b7s : f \u226b i \u27f6 j}\n {\u03b7\u2081 : h \u226b k \u27f6 i \u226b k} {\u03b7\u2082 : f \u226b (h \u226b k) \u27f6 f \u226b (i \u226b k)} {\u03b7s\u2081 : (f \u226b i) \u226b k \u27f6 j \u226b k}\n {\u03b7s\u2082 : f \u226b (i \u226b k) \u27f6 j \u226b k} {\u03b7\u2083 : f \u226b (h \u226b k) \u27f6 j \u226b k} {\u03b7\u2084 : (f \u226b h) \u226b k \u27f6 j \u226b k}\n {\u03b7\u2085 : g \u226b k \u27f6 j \u226b k}\n (e_\u03b7\u2081 : ((Iso.refl _).hom \u226b \u03b7 \u226b (Iso.refl _).hom) \u25b7 k = \u03b7\u2081) (e_\u03b7\u2082 : f \u25c1 \u03b7\u2081 = \u03b7\u2082)\n (e_\u03b7s\u2081 : \u03b7s \u25b7 k = \u03b7s\u2081) (e_\u03b7s\u2082 : (\u03b1_ _ _ _).inv \u226b \u03b7s\u2081 = \u03b7s\u2082)\n (e_\u03b7\u2083 : \u03b7\u2082 \u226b \u03b7s\u2082 = \u03b7\u2083) (e_\u03b7\u2084 : (\u03b1_ _ _ _).hom \u226b \u03b7\u2083 = \u03b7\u2084)\n (e_\u03b7\u2085 : (whiskerRightIso \u03b1 k).hom \u226b \u03b7\u2084 = \u03b7\u2085) :\n (\u03b1.hom \u226b (f \u25c1 \u03b7) \u226b \u03b7s) \u25b7 k = \u03b7\u2085 := by\nsimp at e_\u03b7\u2081 e_\u03b7\u2085\n simp [e_\u03b7\u2081, e_\u03b7\u2082, e_\u03b7s\u2081, e_\u03b7s\u2082, e_\u03b7\u2083, e_\u03b7\u2084, e_\u03b7\u2085]\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Basic.bicategoryNf (L35-L37)\ndef bicategoryNf (mvarId : MVarId) : MetaM (List MVarId) := do\nBicategoryLike.normalForm Bicategory.Context `bicategory mvarId\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.left' (L96-L99)\ninstance left' (f g : a \u27f6 b) [BicategoricalCoherence f g] :\n BicategoricalCoherence f (\ud835\udfd9 a \u226b g) :=\n\u27e8\u2297\ud835\udfd9 \u226a\u226b (\u03bb_ g).symm\u27e9\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Datatypes.mkContext (L68-L85)\ndef mkContext? (e : Expr) : MetaM (Option Context) := do\nlet e \u2190 instantiateMVars e\n let type \u2190 instantiateMVars <| \u2190 inferType e\n match (\u2190 whnfR (\u2190 inferType e)).getAppFnArgs with\n | (``Quiver.Hom, #[_, _, f, _]) =>\n let fType \u2190 instantiateMVars <| \u2190 inferType f\n match (\u2190 whnfR fType).getAppFnArgs with\n | (``Quiver.Hom, #[_, _, a, _]) =>\n let B \u2190 inferType a\n let .succ level\u2080 \u2190 getLevel B | return none\n let .succ level\u2081 \u2190 getLevel fType | return none\n let .succ level\u2082 \u2190 getLevel type | return none\n let some instBicategory \u2190 synthInstance?\n (mkAppN (.const ``Bicategory [level\u2082, level\u2081, level\u2080]) #[B]) | return none\n return some \u27e8level\u2082, level\u2081, level\u2080, B, instBicategory\u27e9\n | _ => return none\n | _ => return none\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.bicategoricalComp_refl (L125-L128)\ntheorem bicategoricalComp_refl {f g h : a \u27f6 b} (\u03b7 : f \u27f6 g) (\u03b8 : g \u27f6 h) : \u03b7 \u2297\u226b \u03b8 = \u03b7 \u226b \u03b8 := by\ndsimp [bicategoricalComp]; simp\n\nend CategoryTheory\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.bicategoricalIso (L41-L45)\nabbrev bicategoricalIso (f g : a \u27f6 b) [BicategoricalCoherence f g] : f \u2245 g :=\n\u2297\ud835\udfd9\n\n/-- Compose two morphisms in a bicategorical category,\ninserting unitors and associators between as necessary. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Datatypes.structuralIso_inv (L113-L116)\ntheorem structuralIso_inv {f g : a \u27f6 b} (\u03b7 : f \u2245 g) :\n \u03b7.symm.hom = \u03b7.inv := by\nsimp only [Iso.symm_hom]\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.bicategoricalIsoComp (L56-L59)\ndef bicategoricalIsoComp {f g h i : a \u27f6 b} [BicategoricalCoherence g h]\n (\u03b7 : f \u2245 g) (\u03b8 : h \u2245 i) : f \u2245 i :=\n\u03b7 \u226a\u226b \u2297\ud835\udfd9 \u226a\u226b \u03b8\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.tensorRight' (L86-L89)\ninstance tensorRight' (f : a \u27f6 b) (g : b \u27f6 b)\n [BicategoricalCoherence g (\ud835\udfd9 b)] : BicategoricalCoherence (f \u226b g) f :=\n\u27e8whiskerLeftIso f \u2297\ud835\udfd9 \u226a\u226b (\u03c1_ f)\u27e9\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.whiskerRight (L76-L79)\ninstance whiskerRight (f g : a \u27f6 b) (h : b \u27f6 c)\n [BicategoricalCoherence f g] : BicategoricalCoherence (f \u226b h) (g \u226b h) :=\n\u27e8whiskerRightIso \u2297\ud835\udfd9 h\u27e9\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Datatypes.tgtExprOfIso (L47-L67)\ndef tgtExprOfIso (\u03b7 : Expr) : MetaM Expr := do\nmatch (\u2190 whnfR (\u2190 inferType \u03b7)).getAppFnArgs with\n | (``Iso, #[_, _, _, g]) => return g\n | _ => throwError m!\"{\u03b7} is not a morphism\"\n\ninitialize registerTraceClass `bicategory\n\n/-- The context for evaluating expressions. -/\nstructure Context where\n /-- The level for 2-morphisms. -/\n level\u2082 : Level\n /-- The level for 1-morphisms. -/\n level\u2081 : Level\n /-- The level for objects. -/\n level\u2080 : Level\n /-- The expression for the underlying category. -/\n B : Q(Type level\u2080)\n /-- The bicategory instance. -/\n instBicategory : Q(Bicategory.{level\u2082, level\u2081} $B)\n\n/-- Populate a `context` object for evaluating `e`. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.tensorRight (L81-L84)\ninstance tensorRight (f : a \u27f6 b) (g : b \u27f6 b)\n [BicategoricalCoherence (\ud835\udfd9 b) g] : BicategoricalCoherence f (f \u226b g) :=\n\u27e8(\u03c1_ f).symm \u226a\u226b (whiskerLeftIso f \u2297\ud835\udfd9)\u27e9\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Datatypes.tgtExpr (L35-L40)\ndef tgtExpr (\u03b7 : Expr) : MetaM Expr := do\nmatch (\u2190 whnfR (\u2190 inferType \u03b7)).getAppFnArgs with\n | (``Quiver.Hom, #[_, _, _, g]) => return g\n | _ => throwError m!\"{\u03b7} is not a morphism\"\n\n/-- The domain of an isomorphism. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.bicategoricalComp (L46-L50)\ndef bicategoricalComp {f g h i : a \u27f6 b} [BicategoricalCoherence g h]\n (\u03b7 : f \u27f6 g) (\u03b8 : h \u27f6 i) : f \u27f6 i :=\n\u03b7 \u226b \u2297\ud835\udfd9.hom \u226b \u03b8\n\n-- type as \\ot \\gg\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.whiskerLeft (L71-L74)\ninstance whiskerLeft (f : a \u27f6 b) (g h : b \u27f6 c)\n [BicategoricalCoherence g h] : BicategoricalCoherence (f \u226b g) (f \u226b h) :=\n\u27e8whiskerLeftIso f \u2297\ud835\udfd9\u27e9\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.left (L91-L94)\ninstance left (f g : a \u27f6 b) [BicategoricalCoherence f g] :\n BicategoricalCoherence (\ud835\udfd9 a \u226b f) g :=\n\u27e8\u03bb_ f \u226a\u226b \u2297\ud835\udfd9\u27e9\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.right' (L106-L109)\ninstance right' (f g : a \u27f6 b) [BicategoricalCoherence f g] :\n BicategoricalCoherence f (g \u226b \ud835\udfd9 b) :=\n\u27e8\u2297\ud835\udfd9 \u226a\u226b (\u03c1_ g).symm\u27e9\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Datatypes.BicategoryM (L90-L91)\nabbrev BicategoryM := CoherenceM Context\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Basic.bicategory (L52-L54)\ndef bicategory (mvarId : MVarId) : MetaM (List MVarId) :=\nBicategoryLike.main Bicategory.Context `bicategory mvarId\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Datatypes.srcExpr (L29-L34)\ndef srcExpr (\u03b7 : Expr) : MetaM Expr := do\nmatch (\u2190 whnfR (\u2190 inferType \u03b7)).getAppFnArgs with\n | (``Quiver.Hom, #[_, _, f, _]) => return f\n | _ => throwError m!\"{\u03b7} is not a morphism\"\n\n/-- The codomain of a morphism. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Datatypes.srcExprOfIso (L41-L46)\ndef srcExprOfIso (\u03b7 : Expr) : MetaM Expr := do\nmatch (\u2190 whnfR (\u2190 inferType \u03b7)).getAppFnArgs with\n | (``Iso, #[_, _, f, _]) => return f\n | _ => throwError m!\"{\u03b7} is not a morphism\"\n\n/-- The codomain of an isomorphism. -/\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Datatypes.structuralIsoOfExpr_comp (L117-L122)\ntheorem structuralIsoOfExpr_comp {f g h : a \u27f6 b}\n (\u03b7 : f \u27f6 g) (\u03b7' : f \u2245 g) (ih_\u03b7 : \u03b7'.hom = \u03b7)\n (\u03b8 : g \u27f6 h) (\u03b8' : g \u2245 h) (ih_\u03b8 : \u03b8'.hom = \u03b8) :\n (\u03b7' \u226a\u226b \u03b8').hom = \u03b7 \u226b \u03b8 := by\nsimp [ih_\u03b7, ih_\u03b8]\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.refl (L67-L69)\ninstance refl (f : a \u27f6 b) : BicategoricalCoherence f f :=\n\u27e8Iso.refl _\u27e9\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.assoc (L111-L115)\ninstance assoc (f : a \u27f6 b) (g : b \u27f6 c) (h : c \u27f6 d) (i : a \u27f6 d)\n [BicategoricalCoherence (f \u226b g \u226b h) i] :\n BicategoricalCoherence ((f \u226b g) \u226b h) i :=\n\u27e8\u03b1_ f g h \u226a\u226b \u2297\ud835\udfd9\u27e9\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.assoc' (L117-L123)\ninstance assoc' (f : a \u27f6 b) (g : b \u27f6 c) (h : c \u27f6 d) (i : a \u27f6 d)\n [BicategoricalCoherence i (f \u226b g \u226b h)] :\n BicategoricalCoherence i ((f \u226b g) \u226b h) :=\n\u27e8\u2297\ud835\udfd9 \u226a\u226b (\u03b1_ f g h).symm\u27e9\n\nend BicategoricalCoherence\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.right (L101-L104)\ninstance right (f g : a \u27f6 b) [BicategoricalCoherence f g] :\n BicategoricalCoherence (f \u226b \ud835\udfd9 b) g :=\n\u27e8\u03c1_ f \u226a\u226b \u2297\ud835\udfd9\u27e9\n```\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.CategoryTheory.Bicategory.Normalize).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem evalWhiskerRightAux_of {f g : a \u27f6 b} (\u03b7 : f \u27f6 g) (h : b \u27f6 c) :\n \u03b7 \u25b7 h = (Iso.refl _).hom \u226b \u03b7 \u25b7 h \u226b (Iso.refl _).hom\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalComp_nil_nil (L37-L40)\ntheorem evalComp_nil_nil (\u03b1 : f \u2245 g) (\u03b2 : g \u2245 h) :\n (\u03b1 \u226a\u226b \u03b2).hom = (\u03b1 \u226a\u226b \u03b2).hom := by\nsimp\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalComp_nil_cons (L41-L44)\ntheorem evalComp_nil_cons (\u03b1 : f \u2245 g) (\u03b2 : g \u2245 h) (\u03b7 : h \u27f6 i) (\u03b7s : i \u27f6 j) :\n \u03b1.hom \u226b (\u03b2.hom \u226b \u03b7 \u226b \u03b7s) = (\u03b1 \u226a\u226b \u03b2).hom \u226b \u03b7 \u226b \u03b7s := by\nsimp\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalComp_cons (L45-L49)\ntheorem evalComp_cons (\u03b1 : f \u2245 g) (\u03b7 : g \u27f6 h) {\u03b7s : h \u27f6 i} {\u03b8 : i \u27f6 j} {\u03b9 : h \u27f6 j}\n (e_\u03b9 : \u03b7s \u226b \u03b8 = \u03b9) :\n (\u03b1.hom \u226b \u03b7 \u226b \u03b7s) \u226b \u03b8 = \u03b1.hom \u226b \u03b7 \u226b \u03b9 := by\nsimp [e_\u03b9]\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.eval_comp (L50-L55)\ntheorem eval_comp\n {\u03b7 \u03b7' : f \u27f6 g} {\u03b8 \u03b8' : g \u27f6 h} {\u03b9 : f \u27f6 h}\n (e_\u03b7 : \u03b7 = \u03b7') (e_\u03b8 : \u03b8 = \u03b8') (e_\u03b7\u03b8 : \u03b7' \u226b \u03b8' = \u03b9) :\n \u03b7 \u226b \u03b8 = \u03b9 := by\nsimp [e_\u03b7, e_\u03b8, e_\u03b7\u03b8]\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.eval_of (L56-L59)\ntheorem eval_of (\u03b7 : f \u27f6 g) :\n \u03b7 = (Iso.refl _).hom \u226b \u03b7 \u226b (Iso.refl _).hom := by\nsimp\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.eval_monoidalComp (L60-L65)\ntheorem eval_monoidalComp\n {\u03b7 \u03b7' : f \u27f6 g} {\u03b1 : g \u2245 h} {\u03b8 \u03b8' : h \u27f6 i} {\u03b1\u03b8 : g \u27f6 i} {\u03b7\u03b1\u03b8 : f \u27f6 i}\n (e_\u03b7 : \u03b7 = \u03b7') (e_\u03b8 : \u03b8 = \u03b8') (e_\u03b1\u03b8 : \u03b1.hom \u226b \u03b8' = \u03b1\u03b8) (e_\u03b7\u03b1\u03b8 : \u03b7' \u226b \u03b1\u03b8 = \u03b7\u03b1\u03b8) :\n \u03b7 \u226b \u03b1.hom \u226b \u03b8 = \u03b7\u03b1\u03b8 := by\nsimp [e_\u03b7, e_\u03b8, e_\u03b1\u03b8, e_\u03b7\u03b1\u03b8]\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalWhiskerLeft_nil (L67-L70)\ntheorem evalWhiskerLeft_nil (f : a \u27f6 b) {g h : b \u27f6 c} (\u03b1 : g \u2245 h) :\n (whiskerLeftIso f \u03b1).hom = (whiskerLeftIso f \u03b1).hom := by\nsimp\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalWhiskerLeft_of_cons (L71-L76)\ntheorem evalWhiskerLeft_of_cons\n {f : a \u27f6 b} {g h i j : b \u27f6 c}\n (\u03b1 : g \u2245 h) (\u03b7 : h \u27f6 i) {\u03b7s : i \u27f6 j} {\u03b8 : f \u226b i \u27f6 f \u226b j} (e_\u03b8 : f \u25c1 \u03b7s = \u03b8) :\n f \u25c1 (\u03b1.hom \u226b \u03b7 \u226b \u03b7s) = (whiskerLeftIso f \u03b1).hom \u226b f \u25c1 \u03b7 \u226b \u03b8 := by\nsimp [e_\u03b8]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalWhiskerLeft_comp (L77-L85)\ntheorem evalWhiskerLeft_comp\n {f : a \u27f6 b} {g : b \u27f6 c} {h i : c \u27f6 d}\n {\u03b7 : h \u27f6 i} {\u03b7\u2081 : g \u226b h \u27f6 g \u226b i} {\u03b7\u2082 : f \u226b g \u226b h \u27f6 f \u226b g \u226b i}\n {\u03b7\u2083 : f \u226b g \u226b h \u27f6 (f \u226b g) \u226b i} {\u03b7\u2084 : (f \u226b g) \u226b h \u27f6 (f \u226b g) \u226b i}\n (e_\u03b7\u2081 : g \u25c1 \u03b7 = \u03b7\u2081) (e_\u03b7\u2082 : f \u25c1 \u03b7\u2081 = \u03b7\u2082)\n (e_\u03b7\u2083 : \u03b7\u2082 \u226b (\u03b1_ _ _ _).inv = \u03b7\u2083) (e_\u03b7\u2084 : (\u03b1_ _ _ _).hom \u226b \u03b7\u2083 = \u03b7\u2084) :\n (f \u226b g) \u25c1 \u03b7 = \u03b7\u2084 := by\nsimp [e_\u03b7\u2081, e_\u03b7\u2082, e_\u03b7\u2083, e_\u03b7\u2084]\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalWhiskerLeft_id (L86-L91)\ntheorem evalWhiskerLeft_id {\u03b7 : f \u27f6 g}\n {\u03b7\u2081 : f \u27f6 \ud835\udfd9 a \u226b g} {\u03b7\u2082 : \ud835\udfd9 a \u226b f \u27f6 \ud835\udfd9 a \u226b g}\n (e_\u03b7\u2081 : \u03b7 \u226b (\u03bb_ _).inv = \u03b7\u2081) (e_\u03b7\u2082 : (\u03bb_ _).hom \u226b \u03b7\u2081 = \u03b7\u2082) :\n \ud835\udfd9 a \u25c1 \u03b7 = \u03b7\u2082 := by\nsimp [e_\u03b7\u2081, e_\u03b7\u2082]\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.eval_whiskerLeft (L92-L98)\ntheorem eval_whiskerLeft\n {f : a \u27f6 b} {g h : b \u27f6 c}\n {\u03b7 \u03b7' : g \u27f6 h} {\u03b8 : f \u226b g \u27f6 f \u226b h}\n (e_\u03b7 : \u03b7 = \u03b7') (e_\u03b8 : f \u25c1 \u03b7' = \u03b8) :\n f \u25c1 \u03b7 = \u03b8 := by\nsimp [e_\u03b7, e_\u03b8]\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.eval_whiskerRight (L99-L105)\ntheorem eval_whiskerRight\n {f g : a \u27f6 b} {h : b \u27f6 c}\n {\u03b7 \u03b7' : f \u27f6 g} {\u03b8 : f \u226b h \u27f6 g \u226b h}\n (e_\u03b7 : \u03b7 = \u03b7') (e_\u03b8 : \u03b7' \u25b7 h = \u03b8) :\n \u03b7 \u25b7 h = \u03b8 := by\nsimp [e_\u03b7, e_\u03b8]\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalWhiskerRight_nil (L107-L110)\ntheorem evalWhiskerRight_nil (\u03b1 : f \u2245 g) (h : b \u27f6 c) :\n \u03b1.hom \u25b7 h = \u03b1.hom \u25b7 h := by\nsimp\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalWhiskerRight_cons_of_of (L115-L123)\ntheorem evalWhiskerRight_cons_of_of\n {f g h i : a \u27f6 b} {j : b \u27f6 c}\n {\u03b1 : f \u2245 g} {\u03b7 : g \u27f6 h} {\u03b7s : h \u27f6 i} {\u03b7s\u2081 : h \u226b j \u27f6 i \u226b j}\n {\u03b7\u2081 : g \u226b j \u27f6 h \u226b j} {\u03b7\u2082 : g \u226b j \u27f6 i \u226b j} {\u03b7\u2083 : f \u226b j \u27f6 i \u226b j}\n (e_\u03b7s\u2081 : \u03b7s \u25b7 j = \u03b7s\u2081) (e_\u03b7\u2081 : \u03b7 \u25b7 j = \u03b7\u2081)\n (e_\u03b7\u2082 : \u03b7\u2081 \u226b \u03b7s\u2081 = \u03b7\u2082) (e_\u03b7\u2083 : (whiskerRightIso \u03b1 j).hom \u226b \u03b7\u2082 = \u03b7\u2083) :\n (\u03b1.hom \u226b \u03b7 \u226b \u03b7s) \u25b7 j = \u03b7\u2083 := by\nsimp_all\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalWhiskerRight_cons_whisker (L124-L137)\ntheorem evalWhiskerRight_cons_whisker\n {f : a \u27f6 b} {g : a \u27f6 c} {h i : b \u27f6 c} {j : a \u27f6 c} {k : c \u27f6 d}\n {\u03b1 : g \u2245 f \u226b h} {\u03b7 : h \u27f6 i} {\u03b7s : f \u226b i \u27f6 j}\n {\u03b7\u2081 : h \u226b k \u27f6 i \u226b k} {\u03b7\u2082 : f \u226b (h \u226b k) \u27f6 f \u226b (i \u226b k)} {\u03b7s\u2081 : (f \u226b i) \u226b k \u27f6 j \u226b k}\n {\u03b7s\u2082 : f \u226b (i \u226b k) \u27f6 j \u226b k} {\u03b7\u2083 : f \u226b (h \u226b k) \u27f6 j \u226b k} {\u03b7\u2084 : (f \u226b h) \u226b k \u27f6 j \u226b k}\n {\u03b7\u2085 : g \u226b k \u27f6 j \u226b k}\n (e_\u03b7\u2081 : ((Iso.refl _).hom \u226b \u03b7 \u226b (Iso.refl _).hom) \u25b7 k = \u03b7\u2081) (e_\u03b7\u2082 : f \u25c1 \u03b7\u2081 = \u03b7\u2082)\n (e_\u03b7s\u2081 : \u03b7s \u25b7 k = \u03b7s\u2081) (e_\u03b7s\u2082 : (\u03b1_ _ _ _).inv \u226b \u03b7s\u2081 = \u03b7s\u2082)\n (e_\u03b7\u2083 : \u03b7\u2082 \u226b \u03b7s\u2082 = \u03b7\u2083) (e_\u03b7\u2084 : (\u03b1_ _ _ _).hom \u226b \u03b7\u2083 = \u03b7\u2084)\n (e_\u03b7\u2085 : (whiskerRightIso \u03b1 k).hom \u226b \u03b7\u2084 = \u03b7\u2085) :\n (\u03b1.hom \u226b (f \u25c1 \u03b7) \u226b \u03b7s) \u25b7 k = \u03b7\u2085 := by\nsimp at e_\u03b7\u2081 e_\u03b7\u2085\n simp [e_\u03b7\u2081, e_\u03b7\u2082, e_\u03b7s\u2081, e_\u03b7s\u2082, e_\u03b7\u2083, e_\u03b7\u2084, e_\u03b7\u2085]\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Basic.bicategoryNf (L35-L37)\ndef bicategoryNf (mvarId : MVarId) : MetaM (List MVarId) := do\nBicategoryLike.normalForm Bicategory.Context `bicategory mvarId\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.left' (L96-L99)\ninstance left' (f g : a \u27f6 b) [BicategoricalCoherence f g] :\n BicategoricalCoherence f (\ud835\udfd9 a \u226b g) :=\n\u27e8\u2297\ud835\udfd9 \u226a\u226b (\u03bb_ g).symm\u27e9\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Datatypes.mkContext (L68-L85)\ndef mkContext? (e : Expr) : MetaM (Option Context) := do\nlet e \u2190 instantiateMVars e\n let type \u2190 instantiateMVars <| \u2190 inferType e\n match (\u2190 whnfR (\u2190 inferType e)).getAppFnArgs with\n | (``Quiver.Hom, #[_, _, f, _]) =>\n let fType \u2190 instantiateMVars <| \u2190 inferType f\n match (\u2190 whnfR fType).getAppFnArgs with\n | (``Quiver.Hom, #[_, _, a, _]) =>\n let B \u2190 inferType a\n let .succ level\u2080 \u2190 getLevel B | return none\n let .succ level\u2081 \u2190 getLevel fType | return none\n let .succ level\u2082 \u2190 getLevel type | return none\n let some instBicategory \u2190 synthInstance?\n (mkAppN (.const ``Bicategory [level\u2082, level\u2081, level\u2080]) #[B]) | return none\n return some \u27e8level\u2082, level\u2081, level\u2080, B, instBicategory\u27e9\n | _ => return none\n | _ => return none\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.bicategoricalComp_refl (L125-L128)\ntheorem bicategoricalComp_refl {f g h : a \u27f6 b} (\u03b7 : f \u27f6 g) (\u03b8 : g \u27f6 h) : \u03b7 \u2297\u226b \u03b8 = \u03b7 \u226b \u03b8 := by\ndsimp [bicategoricalComp]; simp\n\nend CategoryTheory\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.bicategoricalIso (L41-L45)\nabbrev bicategoricalIso (f g : a \u27f6 b) [BicategoricalCoherence f g] : f \u2245 g :=\n\u2297\ud835\udfd9\n\n/-- Compose two morphisms in a bicategorical category,\ninserting unitors and associators between as necessary. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Datatypes.structuralIso_inv (L113-L116)\ntheorem structuralIso_inv {f g : a \u27f6 b} (\u03b7 : f \u2245 g) :\n \u03b7.symm.hom = \u03b7.inv := by\nsimp only [Iso.symm_hom]\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.bicategoricalIsoComp (L56-L59)\ndef bicategoricalIsoComp {f g h i : a \u27f6 b} [BicategoricalCoherence g h]\n (\u03b7 : f \u2245 g) (\u03b8 : h \u2245 i) : f \u2245 i :=\n\u03b7 \u226a\u226b \u2297\ud835\udfd9 \u226a\u226b \u03b8\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.tensorRight' (L86-L89)\ninstance tensorRight' (f : a \u27f6 b) (g : b \u27f6 b)\n [BicategoricalCoherence g (\ud835\udfd9 b)] : BicategoricalCoherence (f \u226b g) f :=\n\u27e8whiskerLeftIso f \u2297\ud835\udfd9 \u226a\u226b (\u03c1_ f)\u27e9\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.whiskerRight (L76-L79)\ninstance whiskerRight (f g : a \u27f6 b) (h : b \u27f6 c)\n [BicategoricalCoherence f g] : BicategoricalCoherence (f \u226b h) (g \u226b h) :=\n\u27e8whiskerRightIso \u2297\ud835\udfd9 h\u27e9\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Datatypes.tgtExprOfIso (L47-L67)\ndef tgtExprOfIso (\u03b7 : Expr) : MetaM Expr := do\nmatch (\u2190 whnfR (\u2190 inferType \u03b7)).getAppFnArgs with\n | (``Iso, #[_, _, _, g]) => return g\n | _ => throwError m!\"{\u03b7} is not a morphism\"\n\ninitialize registerTraceClass `bicategory\n\n/-- The context for evaluating expressions. -/\nstructure Context where\n /-- The level for 2-morphisms. -/\n level\u2082 : Level\n /-- The level for 1-morphisms. -/\n level\u2081 : Level\n /-- The level for objects. -/\n level\u2080 : Level\n /-- The expression for the underlying category. -/\n B : Q(Type level\u2080)\n /-- The bicategory instance. -/\n instBicategory : Q(Bicategory.{level\u2082, level\u2081} $B)\n\n/-- Populate a `context` object for evaluating `e`. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.tensorRight (L81-L84)\ninstance tensorRight (f : a \u27f6 b) (g : b \u27f6 b)\n [BicategoricalCoherence (\ud835\udfd9 b) g] : BicategoricalCoherence f (f \u226b g) :=\n\u27e8(\u03c1_ f).symm \u226a\u226b (whiskerLeftIso f \u2297\ud835\udfd9)\u27e9\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Datatypes.tgtExpr (L35-L40)\ndef tgtExpr (\u03b7 : Expr) : MetaM Expr := do\nmatch (\u2190 whnfR (\u2190 inferType \u03b7)).getAppFnArgs with\n | (``Quiver.Hom, #[_, _, _, g]) => return g\n | _ => throwError m!\"{\u03b7} is not a morphism\"\n\n/-- The domain of an isomorphism. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.bicategoricalComp (L46-L50)\ndef bicategoricalComp {f g h i : a \u27f6 b} [BicategoricalCoherence g h]\n (\u03b7 : f \u27f6 g) (\u03b8 : h \u27f6 i) : f \u27f6 i :=\n\u03b7 \u226b \u2297\ud835\udfd9.hom \u226b \u03b8\n\n-- type as \\ot \\gg\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.whiskerLeft (L71-L74)\ninstance whiskerLeft (f : a \u27f6 b) (g h : b \u27f6 c)\n [BicategoricalCoherence g h] : BicategoricalCoherence (f \u226b g) (f \u226b h) :=\n\u27e8whiskerLeftIso f \u2297\ud835\udfd9\u27e9\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.left (L91-L94)\ninstance left (f g : a \u27f6 b) [BicategoricalCoherence f g] :\n BicategoricalCoherence (\ud835\udfd9 a \u226b f) g :=\n\u27e8\u03bb_ f \u226a\u226b \u2297\ud835\udfd9\u27e9\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.right' (L106-L109)\ninstance right' (f g : a \u27f6 b) [BicategoricalCoherence f g] :\n BicategoricalCoherence f (g \u226b \ud835\udfd9 b) :=\n\u27e8\u2297\ud835\udfd9 \u226a\u226b (\u03c1_ g).symm\u27e9\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Datatypes.BicategoryM (L90-L91)\nabbrev BicategoryM := CoherenceM Context\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Basic.bicategory (L52-L54)\ndef bicategory (mvarId : MVarId) : MetaM (List MVarId) :=\nBicategoryLike.main Bicategory.Context `bicategory mvarId\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Datatypes.srcExpr (L29-L34)\ndef srcExpr (\u03b7 : Expr) : MetaM Expr := do\nmatch (\u2190 whnfR (\u2190 inferType \u03b7)).getAppFnArgs with\n | (``Quiver.Hom, #[_, _, f, _]) => return f\n | _ => throwError m!\"{\u03b7} is not a morphism\"\n\n/-- The codomain of a morphism. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Datatypes.srcExprOfIso (L41-L46)\ndef srcExprOfIso (\u03b7 : Expr) : MetaM Expr := do\nmatch (\u2190 whnfR (\u2190 inferType \u03b7)).getAppFnArgs with\n | (``Iso, #[_, _, f, _]) => return f\n | _ => throwError m!\"{\u03b7} is not a morphism\"\n\n/-- The codomain of an isomorphism. -/\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Tactic.CategoryTheory.Bicategory.Datatypes.structuralIsoOfExpr_comp (L117-L122)\ntheorem structuralIsoOfExpr_comp {f g h : a \u27f6 b}\n (\u03b7 : f \u27f6 g) (\u03b7' : f \u2245 g) (ih_\u03b7 : \u03b7'.hom = \u03b7)\n (\u03b8 : g \u27f6 h) (\u03b8' : g \u2245 h) (ih_\u03b8 : \u03b8'.hom = \u03b8) :\n (\u03b7' \u226a\u226b \u03b8').hom = \u03b7 \u226b \u03b8 := by\nsimp [ih_\u03b7, ih_\u03b8]\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.refl (L67-L69)\ninstance refl (f : a \u27f6 b) : BicategoricalCoherence f f :=\n\u27e8Iso.refl _\u27e9\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.assoc (L111-L115)\ninstance assoc (f : a \u27f6 b) (g : b \u27f6 c) (h : c \u27f6 d) (i : a \u27f6 d)\n [BicategoricalCoherence (f \u226b g \u226b h) i] :\n BicategoricalCoherence ((f \u226b g) \u226b h) i :=\n\u27e8\u03b1_ f g h \u226a\u226b \u2297\ud835\udfd9\u27e9\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.assoc' (L117-L123)\ninstance assoc' (f : a \u27f6 b) (g : b \u27f6 c) (h : c \u27f6 d) (i : a \u27f6 d)\n [BicategoricalCoherence i (f \u226b g \u226b h)] :\n BicategoricalCoherence i ((f \u226b g) \u226b h) :=\n\u27e8\u2297\ud835\udfd9 \u226a\u226b (\u03b1_ f g h).symm\u27e9\n\nend BicategoricalCoherence\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Tactic.CategoryTheory.BicategoricalComp.right (L101-L104)\ninstance right (f g : a \u27f6 b) [BicategoricalCoherence f g] :\n BicategoricalCoherence (f \u226b \ud835\udfd9 b) g :=\n\u27e8\u03c1_ f \u226a\u226b \u2297\ud835\udfd9\u27e9\n```\n[/INST]", "sample_id": "C-Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalWhiskerRightAux_of", "source": {"declaration": "Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.evalWhiskerRightAux_of", "file": "Mathlib/Tactic/CategoryTheory/Bicategory/Normalize.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.CategoryTheory.Bicategory.Normalize", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/CategoryTheory/Bicategory/Normalize.lean#L111", "span": "L111-L114"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\ndef punitProd (\u03b1) : PUnit \u00d7 \u03b1 \u2243 \u03b1 := calc\n PUnit \u00d7 \u03b1 \u2243 \u03b1 \u00d7 PUnit := prodComm _ _\n _ \u2243 \u03b1 := prodPUnit _\n\n/-- `PUnit` is a right identity for dependent type product up to an equivalence. -/\n```", "instruction": "Edit `punitProd` so it still compiles and the proof is simplified where possible. Return the full updated `punitProd` block.", "proof_is_oneliner": false, "target_span": "L134-L139", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 867, "declarations_count": 100, "diagnostics_count": 0, "duplicate_fingerprint": "eb5289c9807bd0c5", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 283, "lean_code_chars": 194, "lean_code_ratio": 0.2238, "length_bucket": "tiny", "line_count": 14, "natural_language_chars": 673, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Equiv.Prod).", "role": "system"}, {"content": "You are editing a file in `Mathlib/Logic/Equiv/Prod.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Logic.Equiv.Prod.punitProd`, L134-L139)\n```lean\ndef punitProd (\u03b1) : PUnit \u00d7 \u03b1 \u2243 \u03b1 := calc\n PUnit \u00d7 \u03b1 \u2243 \u03b1 \u00d7 PUnit := prodComm _ _\n _ \u2243 \u03b1 := prodPUnit _\n\n/-- `PUnit` is a right identity for dependent type product up to an equivalence. -/\n```\n\n## Edit instruction\nEdit `punitProd` so it still compiles and the proof is simplified where possible. Return the full updated `punitProd` block.\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Equiv.Prod).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Logic/Equiv/Prod.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Logic.Equiv.Prod.punitProd`, L134-L139)\n```lean\ndef punitProd (\u03b1) : PUnit \u00d7 \u03b1 \u2243 \u03b1 := calc\n PUnit \u00d7 \u03b1 \u2243 \u03b1 \u00d7 PUnit := prodComm _ _\n _ \u2243 \u03b1 := prodPUnit _\n\n/-- `PUnit` is a right identity for dependent type product up to an equivalence. -/\n```\n\n## Edit instruction\nEdit `punitProd` so it still compiles and the proof is simplified where possible. Return the full updated `punitProd` block.\n[/INST]", "sample_id": "D-Mathlib.Logic.Equiv.Prod.punitProd", "source": {"declaration": "Mathlib.Logic.Equiv.Prod.punitProd", "file": "Mathlib/Logic/Equiv/Prod.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Logic.Equiv.Prod", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Logic/Equiv/Prod.lean#L134", "span": "L134-L139"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "lemma opFunctorCompOpFunctorIso_hom_app_app (X : SimplicialObject C) (n : SimplexCategory\u1d52\u1d56) :\n (opFunctorCompOpFunctorIso.hom.app X).app n = opObjIso.hom \u226b opObjIso.hom\n frobnicateTacticThatDoesNotExist := by\nsimp [opFunctorCompOpFunctorIso, opObjIso, opFunctor]", "diagnostic": "[CompilationUnit(i_begin=0, i_end=162, messages=[Message(data='expected token', pos=Position(line=2, column=63), pos_end=None, severity=, kind=None), Message(data='Unknown identifier `opObjIso.hom`', pos=Position(line=2, column=50), pos_end=Position(line=2, column=62), severity=, kind='lean.unknownIdentifier._namedError'), Message(data=\"Function expected at\\n SimplicialObject\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n C\\n\\nHint: The identifier `SimplicialObject` 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=67), severity=, kind=None), Message(data='Unknown identifier `opFunctorCompOpFunctorIso.hom.app`', pos=Position(line=2, column=5), pos_end=Position(line=2, column=38), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=162, i_end=273, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]", "mutation_kind": "plausible_wrong_tactic", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 2190, "declarations_count": 245, "diagnostics_count": 1, "duplicate_fingerprint": "2ffe1ca8804fb413", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 627, "lean_code_chars": 268, "lean_code_ratio": 0.1224, "length_bucket": "short", "line_count": 15, "natural_language_chars": 1922, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplicialObject.Op).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma opFunctorCompOpFunctorIso_hom_app_app (X : SimplicialObject C) (n : SimplexCategory\u1d52\u1d56) :\n (opFunctorCompOpFunctorIso.hom.app X).app n = opObjIso.hom \u226b opObjIso.hom\n frobnicateTacticThatDoesNotExist := by\nsimp [opFunctorCompOpFunctorIso, opObjIso, opFunctor]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=162, messages=[Message(data='expected token', pos=Position(line=2, column=63), pos_end=None, severity=, kind=None), Message(data='Unknown identifier `opObjIso.hom`', pos=Position(line=2, column=50), pos_end=Position(line=2, column=62), severity=, kind='lean.unknownIdentifier._namedError'), Message(data=\"Function expected at\\n SimplicialObject\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n C\\n\\nHint: The identifier `SimplicialObject` 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=67), severity=, kind=None), Message(data='Unknown identifier `opFunctorCompOpFunctorIso.hom.app`', pos=Position(line=2, column=5), pos_end=Position(line=2, column=38), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=162, i_end=273, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplicialObject.Op).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma opFunctorCompOpFunctorIso_hom_app_app (X : SimplicialObject C) (n : SimplexCategory\u1d52\u1d56) :\n (opFunctorCompOpFunctorIso.hom.app X).app n = opObjIso.hom \u226b opObjIso.hom\n frobnicateTacticThatDoesNotExist := by\nsimp [opFunctorCompOpFunctorIso, opObjIso, opFunctor]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=162, messages=[Message(data='expected token', pos=Position(line=2, column=63), pos_end=None, severity=, kind=None), Message(data='Unknown identifier `opObjIso.hom`', pos=Position(line=2, column=50), pos_end=Position(line=2, column=62), severity=, kind='lean.unknownIdentifier._namedError'), Message(data=\"Function expected at\\n SimplicialObject\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n C\\n\\nHint: The identifier `SimplicialObject` 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=67), severity=, kind=None), Message(data='Unknown identifier `opFunctorCompOpFunctorIso.hom.app`', pos=Position(line=2, column=5), pos_end=Position(line=2, column=38), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=162, i_end=273, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "sample_id": "B-Mathlib.AlgebraicTopology.SimplicialObject.Op.opFunctorCompOpFunctorIso_hom_app_app", "source": {"declaration": "Mathlib.AlgebraicTopology.SimplicialObject.Op.opFunctorCompOpFunctorIso_hom_app_app", "file": "Mathlib/AlgebraicTopology/SimplicialObject/Op.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.SimplicialObject.Op", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/SimplicialObject/Op.lean#L70", "span": "L70-L73"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "F", "construction": {"instruction": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.", "statement": "theorem eq_update_iff {a : \u03b1} {b : \u03b2 a} {f g : \u2200 a, \u03b2 a} :\n g = update f a b \u2194 g a = b \u2227 \u2200 x \u2260 a, g x = f x", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 597, "declarations_count": 69, "diagnostics_count": 0, "duplicate_fingerprint": "559eb9692184cb03", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 188, "lean_code_chars": 111, "lean_code_ratio": 0.1859, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 486, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Function.Basic).", "role": "system"}, {"content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\ntheorem eq_update_iff {a : \u03b1} {b : \u03b2 a} {f g : \u2200 a, \u03b2 a} :\n g = update f a b \u2194 g a = b \u2227 \u2200 x \u2260 a, g x = f x\n```\n\nDeclaration: `Mathlib.Logic.Function.Basic.eq_update_iff` (module Mathlib.Logic.Function.Basic).", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Function.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 eq_update_iff {a : \u03b1} {b : \u03b2 a} {f g : \u2200 a, \u03b2 a} :\n g = update f a b \u2194 g a = b \u2227 \u2200 x \u2260 a, g x = f x\n```\n\nDeclaration: `Mathlib.Logic.Function.Basic.eq_update_iff` (module Mathlib.Logic.Function.Basic).[/INST]", "sample_id": "F-Mathlib.Logic.Function.Basic.eq_update_iff", "source": {"declaration": "Mathlib.Logic.Function.Basic.eq_update_iff", "file": "Mathlib/Logic/Function/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Logic.Function.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Logic/Function/Basic.lean#L570", "span": "L570-L573"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem Reflexive.ne_imp_iff (h : Reflexive r) {x y : \u03b1} : x \u2260 y \u2192 r x y \u2194 r x y", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 479, "declarations_count": 61, "diagnostics_count": 0, "duplicate_fingerprint": "e219ac8ab5962622", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 148, "lean_code_chars": 81, "lean_code_ratio": 0.1691, "length_bucket": "tiny", "line_count": 7, "natural_language_chars": 398, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Relation).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem Reflexive.ne_imp_iff (h : Reflexive r) {x y : \u03b1} : x \u2260 y \u2192 r x y \u2194 r x y\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Relation).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem Reflexive.ne_imp_iff (h : Reflexive r) {x y : \u03b1} : x \u2260 y \u2192 r x y \u2194 r x y\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Logic.Relation.Reflexive", "source": {"declaration": "Mathlib.Logic.Relation.Reflexive", "file": "Mathlib/Logic/Relation.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Logic.Relation", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Logic/Relation.lean#L73", "span": "L73-L77"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"trace_states": [{"state": "theorem isRat_le_true [Ring \u03b1] [LinearOrder \u03b1] [IsStrictOrderedRing \u03b1] :\n {a b : \u03b1} \u2192 {na nb : \u2124} \u2192 {da db : \u2115} \u2192\n IsRat a na da \u2192 IsRat b nb db \u2192\n decide (Int.mul na (.ofNat db) \u2264 Int.mul nb (.ofNat da)) \u2192 a \u2264 b\n | _, _, _, _, da, db, \u27e8_, rfl\u27e9, \u27e8_, rfl\u27e9, h => by\n have h", "tactic": "have ha : 0 \u2264 \u215f(da : \u03b1) := invOf_nonneg.mpr <| Nat.cast_nonneg da"}, {"state": "", "tactic": "have hb : 0 \u2264 \u215f(db : \u03b1) := invOf_nonneg.mpr <| Nat.cast_nonneg db"}, {"state": "", "tactic": "have h := (mul_le_mul_of_nonneg_left \u00b7 hb) <| mul_le_mul_of_nonneg_right h ha"}, {"state": "", "tactic": "rw [\u2190 mul_assoc, Int.commute_cast] at h"}, {"state": "", "tactic": "simp only [Int.ofNat_eq_natCast, Int.mul_def, Int.cast_mul, Int.cast_natCast, mul_invOf_cancel_right'] at h rwa [Int.commute_cast] at h"}], "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1668, "declarations_count": 195, "diagnostics_count": 0, "duplicate_fingerprint": "5f161e606ff4c22d", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 614, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "short", "line_count": 22, "natural_language_chars": 1668, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.NormNum.Ineq).", "role": "system"}, {"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.Tactic.NormNum.Ineq.isRat_le_true`:\nState 0: \u22a2 theorem isRat_le_true [Ring \u03b1] [LinearOrder \u03b1] [IsStrictOrderedRing \u03b1] :\n {a b : \u03b1} \u2192 {na nb : \u2124} \u2192 {da db : \u2115} \u2192\n IsRat a na da \u2192 IsRat b nb db \u2192\n decide (Int.mul na (.ofNat db) \u2264 Int.mul nb (.ofNat da)) \u2192 a \u2264 b\n | _, _, _, _, da, db, \u27e8_, rfl\u27e9, \u27e8_, rfl\u27e9, h => by\n have h\nTactic: have ha : 0 \u2264 \u215f(da : \u03b1) := invOf_nonneg.mpr <| Nat.cast_nonneg da\nState 1: \u22a2 \nTactic: have hb : 0 \u2264 \u215f(db : \u03b1) := invOf_nonneg.mpr <| Nat.cast_nonneg db\nState 2: \u22a2 \nTactic: have h := (mul_le_mul_of_nonneg_left \u00b7 hb) <| mul_le_mul_of_nonneg_right h ha\nState 3: \u22a2 \nTactic: rw [\u2190 mul_assoc, Int.commute_cast] at h\nState 4: \u22a2 \nTactic: simp only [Int.ofNat_eq_natCast, Int.mul_def, Int.cast_mul, Int.cast_natCast, mul_invOf_cancel_right'] at h rwa [Int.commute_cast] at h\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.NormNum.Ineq).[/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.Tactic.NormNum.Ineq.isRat_le_true`:\nState 0: \u22a2 theorem isRat_le_true [Ring \u03b1] [LinearOrder \u03b1] [IsStrictOrderedRing \u03b1] :\n {a b : \u03b1} \u2192 {na nb : \u2124} \u2192 {da db : \u2115} \u2192\n IsRat a na da \u2192 IsRat b nb db \u2192\n decide (Int.mul na (.ofNat db) \u2264 Int.mul nb (.ofNat da)) \u2192 a \u2264 b\n | _, _, _, _, da, db, \u27e8_, rfl\u27e9, \u27e8_, rfl\u27e9, h => by\n have h\nTactic: have ha : 0 \u2264 \u215f(da : \u03b1) := invOf_nonneg.mpr <| Nat.cast_nonneg da\nState 1: \u22a2 \nTactic: have hb : 0 \u2264 \u215f(db : \u03b1) := invOf_nonneg.mpr <| Nat.cast_nonneg db\nState 2: \u22a2 \nTactic: have h := (mul_le_mul_of_nonneg_left \u00b7 hb) <| mul_le_mul_of_nonneg_right h ha\nState 3: \u22a2 \nTactic: rw [\u2190 mul_assoc, Int.commute_cast] at h\nState 4: \u22a2 \nTactic: simp only [Int.ofNat_eq_natCast, Int.mul_def, Int.cast_mul, Int.cast_natCast, mul_invOf_cancel_right'] at h rwa [Int.commute_cast] at h\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.Tactic.NormNum.Ineq.isRat_le_true", "source": {"declaration": "Mathlib.Tactic.NormNum.Ineq.isRat_le_true", "file": "Mathlib/Tactic/NormNum/Ineq.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.NormNum.Ineq", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/NormNum/Ineq.lean#L114", "span": "L114-L127"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "F", "construction": {"instruction": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.", "statement": "def List.mapAccumLM (f : \u03b2' \u2192 \u03b1 \u2192 m' (\u03b2' \u00d7 \u03b3')) : \u03b2' \u2192 List \u03b1 \u2192 m' (\u03b2' \u00d7 List \u03b3')\n | a, [] => pure (a, [])\n | a, x :: xs => do\n let (a', y) \u2190 f a x\n let (a'', ys) \u2190 List.mapAccumLM f a' xs\n pure (a'', y :: ys)\n\nend Monad", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 688, "declarations_count": 79, "diagnostics_count": 0, "duplicate_fingerprint": "dd8560209b842e9c", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 227, "lean_code_chars": 232, "lean_code_ratio": 0.3372, "length_bucket": "tiny", "line_count": 14, "natural_language_chars": 456, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Control.Basic).", "role": "system"}, {"content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\ndef List.mapAccumLM (f : \u03b2' \u2192 \u03b1 \u2192 m' (\u03b2' \u00d7 \u03b3')) : \u03b2' \u2192 List \u03b1 \u2192 m' (\u03b2' \u00d7 List \u03b3')\n | a, [] => pure (a, [])\n | a, x :: xs => do\n let (a', y) \u2190 f a x\n let (a'', ys) \u2190 List.mapAccumLM f a' xs\n pure (a'', y :: ys)\n\nend Monad\n```\n\nDeclaration: `Mathlib.Control.Basic.List` (module Mathlib.Control.Basic).", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Control.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\ndef List.mapAccumLM (f : \u03b2' \u2192 \u03b1 \u2192 m' (\u03b2' \u00d7 \u03b3')) : \u03b2' \u2192 List \u03b1 \u2192 m' (\u03b2' \u00d7 List \u03b3')\n | a, [] => pure (a, [])\n | a, x :: xs => do\n let (a', y) \u2190 f a x\n let (a'', ys) \u2190 List.mapAccumLM f a' xs\n pure (a'', y :: ys)\n\nend Monad\n```\n\nDeclaration: `Mathlib.Control.Basic.List` (module Mathlib.Control.Basic).[/INST]", "sample_id": "F-Mathlib.Control.Basic.List", "source": {"declaration": "Mathlib.Control.Basic.List", "file": "Mathlib/Control/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Control.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Control/Basic.lean#L106", "span": "L106-L114"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"trace_states": [{"state": "theorem exists_fix_le_approx (x : \u03b1) : \u2203 i, Part.fix f x \u2264 approx f i x", "tactic": "intro b' h'"}, {"state": "", "tactic": "have hb' := approx_le_fix f i _ _ hb"}, {"state": "", "tactic": "obtain rfl := Part.mem_unique h' hb'"}, {"state": "", "tactic": "exact hb \u00b7 exists 0"}, {"state": "", "tactic": "intro b' h'"}, {"state": "", "tactic": "simp only [mem_iff f] at h'"}, {"state": "", "tactic": "obtain \u27e8i, h'\u27e9 := h'"}, {"state": "", "tactic": "cases hh _ _ h' /-- The series of approximations of `fix f` (see `approx`) as a `Chain` -/"}], "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1332, "declarations_count": 193, "diagnostics_count": 0, "duplicate_fingerprint": "98a50003ae812412", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 451, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "tiny", "line_count": 23, "natural_language_chars": 1332, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Control.LawfulFix).", "role": "system"}, {"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.Control.LawfulFix.exists_fix_le_approx`:\nState 0: \u22a2 theorem exists_fix_le_approx (x : \u03b1) : \u2203 i, Part.fix f x \u2264 approx f i x\nTactic: intro b' h'\nState 1: \u22a2 \nTactic: have hb' := approx_le_fix f i _ _ hb\nState 2: \u22a2 \nTactic: obtain rfl := Part.mem_unique h' hb'\nState 3: \u22a2 \nTactic: exact hb \u00b7 exists 0\nState 4: \u22a2 \nTactic: intro b' h'\nState 5: \u22a2 \nTactic: simp only [mem_iff f] at h'\nState 6: \u22a2 \nTactic: obtain \u27e8i, h'\u27e9 := h'\nState 7: \u22a2 \nTactic: cases hh _ _ h' /-- The series of approximations of `fix f` (see `approx`) as a `Chain` -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Control.LawfulFix).[/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.Control.LawfulFix.exists_fix_le_approx`:\nState 0: \u22a2 theorem exists_fix_le_approx (x : \u03b1) : \u2203 i, Part.fix f x \u2264 approx f i x\nTactic: intro b' h'\nState 1: \u22a2 \nTactic: have hb' := approx_le_fix f i _ _ hb\nState 2: \u22a2 \nTactic: obtain rfl := Part.mem_unique h' hb'\nState 3: \u22a2 \nTactic: exact hb \u00b7 exists 0\nState 4: \u22a2 \nTactic: intro b' h'\nState 5: \u22a2 \nTactic: simp only [mem_iff f] at h'\nState 6: \u22a2 \nTactic: obtain \u27e8i, h'\u27e9 := h'\nState 7: \u22a2 \nTactic: cases hh _ _ h' /-- The series of approximations of `fix f` (see `approx`) as a `Chain` -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.Control.LawfulFix.exists_fix_le_approx", "source": {"declaration": "Mathlib.Control.LawfulFix.exists_fix_le_approx", "file": "Mathlib/Control/LawfulFix.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Control.LawfulFix", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Control/LawfulFix.lean#L88", "span": "L88-L102"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"trace_states": [{"state": "def toTopCatMap : X.toTopCat \u27f6 Y.toTopCat", "tactic": "rw [continuous_coinduced_dom]"}, {"state": "", "tactic": "apply continuous_sigma"}, {"state": "", "tactic": "intro \u27e8S, x\u27e9"}, {"state": "", "tactic": "simp only [Function.comp_apply, coinducingCoprod]"}, {"state": "", "tactic": "rw [show (fun (a : S) \u21a6 f.hom.app \u27e8of PUnit\u27e9 (X.obj.map ((of PUnit.{u + 1}).const a).op x)) = _ from funext fun a \u21a6 NatTrans.naturality_apply f.hom ((of PUnit.{u + 1}).const a).op x]"}, {"state": "", "tactic": "exact continuous_coinducingCoprod Y _ } end CondensedSet /-- The functor `CondensedSet \u2964 TopCat` -/"}], "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1374, "declarations_count": 165, "diagnostics_count": 0, "duplicate_fingerprint": "f28fbbee36b40a3a", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 454, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "tiny", "line_count": 19, "natural_language_chars": 1374, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Condensed.TopCatAdjunction).", "role": "system"}, {"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.Condensed.TopCatAdjunction.toTopCatMap`:\nState 0: \u22a2 def toTopCatMap : X.toTopCat \u27f6 Y.toTopCat\nTactic: rw [continuous_coinduced_dom]\nState 1: \u22a2 \nTactic: apply continuous_sigma\nState 2: \u22a2 \nTactic: intro \u27e8S, x\u27e9\nState 3: \u22a2 \nTactic: simp only [Function.comp_apply, coinducingCoprod]\nState 4: \u22a2 \nTactic: rw [show (fun (a : S) \u21a6 f.hom.app \u27e8of PUnit\u27e9 (X.obj.map ((of PUnit.{u + 1}).const a).op x)) = _ from funext fun a \u21a6 NatTrans.naturality_apply f.hom ((of PUnit.{u + 1}).const a).op x]\nState 5: \u22a2 \nTactic: exact continuous_coinducingCoprod Y _ } end CondensedSet /-- The functor `CondensedSet \u2964 TopCat` -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Condensed.TopCatAdjunction).[/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.Condensed.TopCatAdjunction.toTopCatMap`:\nState 0: \u22a2 def toTopCatMap : X.toTopCat \u27f6 Y.toTopCat\nTactic: rw [continuous_coinduced_dom]\nState 1: \u22a2 \nTactic: apply continuous_sigma\nState 2: \u22a2 \nTactic: intro \u27e8S, x\u27e9\nState 3: \u22a2 \nTactic: simp only [Function.comp_apply, coinducingCoprod]\nState 4: \u22a2 \nTactic: rw [show (fun (a : S) \u21a6 f.hom.app \u27e8of PUnit\u27e9 (X.obj.map ((of PUnit.{u + 1}).const a).op x)) = _ from funext fun a \u21a6 NatTrans.naturality_apply f.hom ((of PUnit.{u + 1}).const a).op x]\nState 5: \u22a2 \nTactic: exact continuous_coinducingCoprod Y _ } end CondensedSet /-- The functor `CondensedSet \u2964 TopCat` -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.Condensed.TopCatAdjunction.toTopCatMap", "source": {"declaration": "Mathlib.Condensed.TopCatAdjunction.toTopCatMap", "file": "Mathlib/Condensed/TopCatAdjunction.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Condensed.TopCatAdjunction", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Condensed/TopCatAdjunction.lean#L62", "span": "L62-L77"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\ndef NormalizedHom.consM [MonadMor\u2081 m] (p : NormalizedHom) (f : Atom\u2081) :\n m NormalizedHom := do\nreturn NormalizedHom.cons (\u2190 comp\u2081M p.e (.of f)) p f\n\n/-- `Context \u03c1` provides the context for manipulating 2-morphisms in a monoidal category or\nbicategory. In particular, we will store `MonoidalCategory` or `Bicategory` instance in a context,\nand use this through a reader monad when we construct the lean expressions for 2-morphisms. -/\nclass Context (\u03c1 : Type) where\n /-- Construct a context from a lean expression for a 2-morphism. -/\n mkContext? : Expr \u2192 MetaM (Option \u03c1)\n\nexport Context (mkContext?)\n\n/-- Construct a context from a lean expression for a 2-morphism. -/\n```", "instruction": "Edit `NormalizedHom` so it still compiles and the proof is simplified where possible. Return the full updated `NormalizedHom` block.", "proof_is_oneliner": false, "target_span": "L436-L449", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1436, "declarations_count": 167, "diagnostics_count": 0, "duplicate_fingerprint": "8da881a6bc79fe3f", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 427, "lean_code_chars": 676, "lean_code_ratio": 0.4708, "length_bucket": "tiny", "line_count": 23, "natural_language_chars": 760, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.CategoryTheory.Coherence.Datatypes).", "role": "system"}, {"content": "You are editing a file in `Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Tactic.CategoryTheory.Coherence.Datatypes.NormalizedHom`, L436-L449)\n```lean\ndef NormalizedHom.consM [MonadMor\u2081 m] (p : NormalizedHom) (f : Atom\u2081) :\n m NormalizedHom := do\nreturn NormalizedHom.cons (\u2190 comp\u2081M p.e (.of f)) p f\n\n/-- `Context \u03c1` provides the context for manipulating 2-morphisms in a monoidal category or\nbicategory. In particular, we will store `MonoidalCategory` or `Bicategory` instance in a context,\nand use this through a reader monad when we construct the lean expressions for 2-morphisms. -/\nclass Context (\u03c1 : Type) where\n /-- Construct a context from a lean expression for a 2-morphism. -/\n mkContext? : Expr \u2192 MetaM (Option \u03c1)\n\nexport Context (mkContext?)\n\n/-- Construct a context from a lean expression for a 2-morphism. -/\n```\n\n## Edit instruction\nEdit `NormalizedHom` so it still compiles and the proof is simplified where possible. Return the full updated `NormalizedHom` block.\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.CategoryTheory.Coherence.Datatypes).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Tactic.CategoryTheory.Coherence.Datatypes.NormalizedHom`, L436-L449)\n```lean\ndef NormalizedHom.consM [MonadMor\u2081 m] (p : NormalizedHom) (f : Atom\u2081) :\n m NormalizedHom := do\nreturn NormalizedHom.cons (\u2190 comp\u2081M p.e (.of f)) p f\n\n/-- `Context \u03c1` provides the context for manipulating 2-morphisms in a monoidal category or\nbicategory. In particular, we will store `MonoidalCategory` or `Bicategory` instance in a context,\nand use this through a reader monad when we construct the lean expressions for 2-morphisms. -/\nclass Context (\u03c1 : Type) where\n /-- Construct a context from a lean expression for a 2-morphism. -/\n mkContext? : Expr \u2192 MetaM (Option \u03c1)\n\nexport Context (mkContext?)\n\n/-- Construct a context from a lean expression for a 2-morphism. -/\n```\n\n## Edit instruction\nEdit `NormalizedHom` so it still compiles and the proof is simplified where possible. Return the full updated `NormalizedHom` block.\n[/INST]", "sample_id": "D-Mathlib.Tactic.CategoryTheory.Coherence.Datatypes.NormalizedHom", "source": {"declaration": "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes.NormalizedHom", "file": "Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean#L436", "span": "L436-L449"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "def associatorInvM (f g h : Mor\u2081) : m NormalExpr\n:= do _unbalancedParenXYZ\nMonadNormalExpr.nilM <| \u2190 MonadMor\u2082Iso.symmM <|\n .structuralAtom <| \u2190 MonadMor\u2082Iso.associatorM f g h\n\n/-- The left unitor as a term of `normalExpr`. -/", "diagnostic": "[CompilationUnit(i_begin=0, i_end=77, messages=[Message(data=\"Function expected at\\n m\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n NormalExpr\\n\\nHint: The identifier `m` 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=36), pos_end=Position(line=1, column=48), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=77, i_end=239, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=3, column=0), pos_end=Position(line=3, column=20), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=6, column=49), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]", "mutation_kind": "term_arg_order", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1917, "declarations_count": 241, "diagnostics_count": 1, "duplicate_fingerprint": "c92760cb9aa645d3", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 531, "lean_code_chars": 230, "lean_code_ratio": 0.12, "length_bucket": "short", "line_count": 17, "natural_language_chars": 1687, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.CategoryTheory.Coherence.Normalize).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef associatorInvM (f g h : Mor\u2081) : m NormalExpr\n:= do _unbalancedParenXYZ\nMonadNormalExpr.nilM <| \u2190 MonadMor\u2082Iso.symmM <|\n .structuralAtom <| \u2190 MonadMor\u2082Iso.associatorM f g h\n\n/-- The left unitor as a term of `normalExpr`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=77, messages=[Message(data=\"Function expected at\\n m\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n NormalExpr\\n\\nHint: The identifier `m` 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=36), pos_end=Position(line=1, column=48), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=77, i_end=239, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=3, column=0), pos_end=Position(line=3, column=20), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=6, column=49), 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.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.CategoryTheory.Coherence.Normalize).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef associatorInvM (f g h : Mor\u2081) : m NormalExpr\n:= do _unbalancedParenXYZ\nMonadNormalExpr.nilM <| \u2190 MonadMor\u2082Iso.symmM <|\n .structuralAtom <| \u2190 MonadMor\u2082Iso.associatorM f g h\n\n/-- The left unitor as a term of `normalExpr`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=77, messages=[Message(data=\"Function expected at\\n m\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n NormalExpr\\n\\nHint: The identifier `m` 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=36), pos_end=Position(line=1, column=48), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=77, i_end=239, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=3, column=0), pos_end=Position(line=3, column=20), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=6, column=49), 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]", "sample_id": "B-Mathlib.Tactic.CategoryTheory.Coherence.Normalize.associatorInvM", "source": {"declaration": "Mathlib.Tactic.CategoryTheory.Coherence.Normalize.associatorInvM", "file": "Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.CategoryTheory.Coherence.Normalize", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/CategoryTheory/Coherence/Normalize.lean#L218", "span": "L218-L222"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "def makeCongrMString (pos : Array Lean.SubExpr.GoalsLocation) (goalType : Expr)\n (_ : SelectInsertParams) :\n MetaM (String \u00d7 String \u00d7 Option (String.Pos.Raw \u00d7 String.Pos.Raw))", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 586, "declarations_count": 61, "diagnostics_count": 0, "duplicate_fingerprint": "c6cc205a8d0e50c7", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 166, "lean_code_chars": 182, "lean_code_ratio": 0.3106, "length_bucket": "tiny", "line_count": 9, "natural_language_chars": 404, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.Widget.CongrM).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ndef makeCongrMString (pos : Array Lean.SubExpr.GoalsLocation) (goalType : Expr)\n (_ : SelectInsertParams) :\n MetaM (String \u00d7 String \u00d7 Option (String.Pos.Raw \u00d7 String.Pos.Raw))\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.Widget.CongrM).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ndef makeCongrMString (pos : Array Lean.SubExpr.GoalsLocation) (goalType : Expr)\n (_ : SelectInsertParams) :\n MetaM (String \u00d7 String \u00d7 Option (String.Pos.Raw \u00d7 String.Pos.Raw))\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Tactic.Widget.CongrM.makeCongrMString", "source": {"declaration": "Mathlib.Tactic.Widget.CongrM.makeCongrMString", "file": "Mathlib/Tactic/Widget/CongrM.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.Widget.CongrM", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/Widget/CongrM.lean#L27", "span": "L27-L42"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "def findModuleMatches (moduleRef : ModuleDiscrTreeRef \u03b1) (ty : Expr) : MetaM (MatchResult \u03b1)\n:= do \u27e8\u27e9\u27e8\u27e9\nprofileitM Exception \"RefinedDiscrTree local search\" (\u2190 getOptions) do\n let discrTree \u2190 moduleRef.ref.get\n let (localCandidates, localTree) \u2190 getMatch discrTree ty false false\n moduleRef.ref.set localTree\n MonadExcept.ofExcept localCandidates\n\n/--\n`findMatches` combines `findImportMatches` and `findModuleMatches`.\n\n* `ext` should be an environment extension with an `IO.Ref` for caching the `RefinedDiscrTree`.\n* `addEntry` is the function for creating `RefinedDiscrTree` entries from constants.\n* `ty` is the expression type.\n* `constantsPerTask` is the number of constants in imported modules to be used for each\n new task.\n* `capacityPerTask` is the initial capacity of the `HashMap` at the root of the\n `RefinedDiscrTree` for each new task.\n-/", "diagnostic": "[CompilationUnit(i_begin=0, i_end=114, messages=[Message(data=\"Function expected at\\n ModuleDiscrTreeRef\\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 `ModuleDiscrTreeRef` 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=35), pos_end=Position(line=1, column=55), severity=, kind=None), Message(data=\"Function expected at\\n MetaM\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n (MatchResult \u03b1)\\n\\nHint: The identifier `MetaM` 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=71), pos_end=Position(line=1, column=92), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=114, i_end=884, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=3, column=0), pos_end=Position(line=3, column=10), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=19, column=2), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]", "mutation_kind": "syntax_binder_mismatch", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 3199, "declarations_count": 411, "diagnostics_count": 1, "duplicate_fingerprint": "88e7d965b88d4ea3", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 856, "lean_code_chars": 869, "lean_code_ratio": 0.2716, "length_bucket": "short", "line_count": 30, "natural_language_chars": 2330, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Lean.Meta.RefinedDiscrTree).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef findModuleMatches (moduleRef : ModuleDiscrTreeRef \u03b1) (ty : Expr) : MetaM (MatchResult \u03b1)\n:= do \u27e8\u27e9\u27e8\u27e9\nprofileitM Exception \"RefinedDiscrTree local search\" (\u2190 getOptions) do\n let discrTree \u2190 moduleRef.ref.get\n let (localCandidates, localTree) \u2190 getMatch discrTree ty false false\n moduleRef.ref.set localTree\n MonadExcept.ofExcept localCandidates\n\n/--\n`findMatches` combines `findImportMatches` and `findModuleMatches`.\n\n* `ext` should be an environment extension with an `IO.Ref` for caching the `RefinedDiscrTree`.\n* `addEntry` is the function for creating `RefinedDiscrTree` entries from constants.\n* `ty` is the expression type.\n* `constantsPerTask` is the number of constants in imported modules to be used for each\n new task.\n* `capacityPerTask` is the initial capacity of the `HashMap` at the root of the\n `RefinedDiscrTree` for each new task.\n-/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=114, messages=[Message(data=\"Function expected at\\n ModuleDiscrTreeRef\\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 `ModuleDiscrTreeRef` 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=35), pos_end=Position(line=1, column=55), severity=, kind=None), Message(data=\"Function expected at\\n MetaM\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n (MatchResult \u03b1)\\n\\nHint: The identifier `MetaM` 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=71), pos_end=Position(line=1, column=92), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=114, i_end=884, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=3, column=0), pos_end=Position(line=3, column=10), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=19, 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.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Lean.Meta.RefinedDiscrTree).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef findModuleMatches (moduleRef : ModuleDiscrTreeRef \u03b1) (ty : Expr) : MetaM (MatchResult \u03b1)\n:= do \u27e8\u27e9\u27e8\u27e9\nprofileitM Exception \"RefinedDiscrTree local search\" (\u2190 getOptions) do\n let discrTree \u2190 moduleRef.ref.get\n let (localCandidates, localTree) \u2190 getMatch discrTree ty false false\n moduleRef.ref.set localTree\n MonadExcept.ofExcept localCandidates\n\n/--\n`findMatches` combines `findImportMatches` and `findModuleMatches`.\n\n* `ext` should be an environment extension with an `IO.Ref` for caching the `RefinedDiscrTree`.\n* `addEntry` is the function for creating `RefinedDiscrTree` entries from constants.\n* `ty` is the expression type.\n* `constantsPerTask` is the number of constants in imported modules to be used for each\n new task.\n* `capacityPerTask` is the initial capacity of the `HashMap` at the root of the\n `RefinedDiscrTree` for each new task.\n-/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=114, messages=[Message(data=\"Function expected at\\n ModuleDiscrTreeRef\\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 `ModuleDiscrTreeRef` 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=35), pos_end=Position(line=1, column=55), severity=, kind=None), Message(data=\"Function expected at\\n MetaM\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n (MatchResult \u03b1)\\n\\nHint: The identifier `MetaM` 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=71), pos_end=Position(line=1, column=92), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=114, i_end=884, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=3, column=0), pos_end=Position(line=3, column=10), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=19, 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]", "sample_id": "B-Mathlib.Lean.Meta.RefinedDiscrTree.findModuleMatches", "source": {"declaration": "Mathlib.Lean.Meta.RefinedDiscrTree.findModuleMatches", "file": "Mathlib/Lean/Meta/RefinedDiscrTree.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Lean.Meta.RefinedDiscrTree", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Lean/Meta/RefinedDiscrTree.lean#L133", "span": "L133-L150"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem eq_mul_of_eq_eq_eq_mul {M : Type*} [Mul M] {a b c D e f : M}\n (h\u2081 : a = b) (h\u2082 : b = c) (h\u2083 : c = D * e) (h\u2084 : e = f) :\n a = D * f", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 552, "declarations_count": 75, "diagnostics_count": 0, "duplicate_fingerprint": "a23d8f9b1af9064b", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 189, "lean_code_chars": 145, "lean_code_ratio": 0.2627, "length_bucket": "tiny", "line_count": 9, "natural_language_chars": 407, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.FieldSimp.Lemmas).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem eq_mul_of_eq_eq_eq_mul {M : Type*} [Mul M] {a b c D e f : M}\n (h\u2081 : a = b) (h\u2082 : b = c) (h\u2083 : c = D * e) (h\u2084 : e = f) :\n a = D * f\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.FieldSimp.Lemmas).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem eq_mul_of_eq_eq_eq_mul {M : Type*} [Mul M] {a b c D e f : M}\n (h\u2081 : a = b) (h\u2082 : b = c) (h\u2083 : c = D * e) (h\u2084 : e = f) :\n a = D * f\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Tactic.FieldSimp.Lemmas.eq_mul_of_eq_eq_eq_mul", "source": {"declaration": "Mathlib.Tactic.FieldSimp.Lemmas.eq_mul_of_eq_eq_eq_mul", "file": "Mathlib/Tactic/FieldSimp/Lemmas.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.FieldSimp.Lemmas", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/FieldSimp/Lemmas.lean#L148", "span": "L148-L152"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem optionEquivSumPUnit_coe {\u03b1} (a : \u03b1) : optionEquivSumPUnit \u03b1 a = Sum.inl a", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 484, "declarations_count": 53, "diagnostics_count": 0, "duplicate_fingerprint": "97f2f243f75e72e9", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 144, "lean_code_chars": 82, "lean_code_ratio": 0.1694, "length_bucket": "tiny", "line_count": 7, "natural_language_chars": 402, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 1.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Equiv.Option).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem optionEquivSumPUnit_coe {\u03b1} (a : \u03b1) : optionEquivSumPUnit \u03b1 a = Sum.inl a\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Equiv.Option).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem optionEquivSumPUnit_coe {\u03b1} (a : \u03b1) : optionEquivSumPUnit \u03b1 a = Sum.inl a\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Logic.Equiv.Option.optionEquivSumPUnit_coe", "source": {"declaration": "Mathlib.Logic.Equiv.Option.optionEquivSumPUnit_coe", "file": "Mathlib/Logic/Equiv/Option.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Logic.Equiv.Option", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Logic/Equiv/Option.lean#L267", "span": "L267-L269"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "lemma zero_mul_eq {\u03b1} {R : \u03b1 \u2192 \u03b1 \u2192 Prop} [Semiring \u03b1] {a b : \u03b1} (h : a = 0) (_ : R b 0) :\n a * b = 0", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 510, "declarations_count": 60, "diagnostics_count": 0, "duplicate_fingerprint": "03d5509cb073a4c6", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 164, "lean_code_chars": 104, "lean_code_ratio": 0.2039, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 406, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 1.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.Linarith.Lemmas).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\nlemma zero_mul_eq {\u03b1} {R : \u03b1 \u2192 \u03b1 \u2192 Prop} [Semiring \u03b1] {a b : \u03b1} (h : a = 0) (_ : R b 0) :\n a * b = 0\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.Linarith.Lemmas).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma zero_mul_eq {\u03b1} {R : \u03b1 \u2192 \u03b1 \u2192 Prop} [Semiring \u03b1] {a b : \u03b1} (h : a = 0) (_ : R b 0) :\n a * b = 0\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Tactic.Linarith.Lemmas.zero_mul_eq", "source": {"declaration": "Mathlib.Tactic.Linarith.Lemmas.zero_mul_eq", "file": "Mathlib/Tactic/Linarith/Lemmas.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.Linarith.Lemmas", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/Linarith/Lemmas.lean#L112", "span": "L112-L116"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\ndef sigmaSigmaSubtypeEq {\u03b1 \u03b2 : Type*} {\u03b3 : \u03b1 \u2192 \u03b2 \u2192 Type*} (a : \u03b1) (b : \u03b2) :\n {s : (a : \u03b1) \u00d7 (b : \u03b2) \u00d7 \u03b3 a b // s.1 = a \u2227 s.2.1 = b} \u2243 \u03b3 a b := have : Unique (@Subtype ((_ : \u03b1) \u00d7 \u03b2) (fun \u27e8a', b'\u27e9 \u21a6 a' = a \u2227 b' = b)) := {\n default := \u27e8\u27e8a, b\u27e9, \u27e8rfl, rfl\u27e9\u27e9\n uniq := by rintro \u27e8\u27e8a', b'\u27e9, \u27e8rfl, rfl\u27e9\u27e9; rfl }\n sigmaSigmaSubtype (fun \u27e8a', b'\u27e9 \u21a6 a' = a \u2227 b' = b) \u27e8rfl, rfl\u27e9\n```", "instruction": "Edit `sigmaSigmaSubtypeEq` so it still compiles and the proof is simplified where possible. Return the full updated `sigmaSigmaSubtypeEq` block.", "proof_is_oneliner": false, "target_span": "L468-L474", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1081, "declarations_count": 126, "diagnostics_count": 0, "duplicate_fingerprint": "56b635faf7859f97", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 437, "lean_code_chars": 375, "lean_code_ratio": 0.3469, "length_bucket": "tiny", "line_count": 14, "natural_language_chars": 706, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Equiv.Basic).", "role": "system"}, {"content": "You are editing a file in `Mathlib/Logic/Equiv/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Logic.Equiv.Basic.sigmaSigmaSubtypeEq`, L468-L474)\n```lean\ndef sigmaSigmaSubtypeEq {\u03b1 \u03b2 : Type*} {\u03b3 : \u03b1 \u2192 \u03b2 \u2192 Type*} (a : \u03b1) (b : \u03b2) :\n {s : (a : \u03b1) \u00d7 (b : \u03b2) \u00d7 \u03b3 a b // s.1 = a \u2227 s.2.1 = b} \u2243 \u03b3 a b := have : Unique (@Subtype ((_ : \u03b1) \u00d7 \u03b2) (fun \u27e8a', b'\u27e9 \u21a6 a' = a \u2227 b' = b)) := {\n default := \u27e8\u27e8a, b\u27e9, \u27e8rfl, rfl\u27e9\u27e9\n uniq := by rintro \u27e8\u27e8a', b'\u27e9, \u27e8rfl, rfl\u27e9\u27e9; rfl }\n sigmaSigmaSubtype (fun \u27e8a', b'\u27e9 \u21a6 a' = a \u2227 b' = b) \u27e8rfl, rfl\u27e9\n```\n\n## Edit instruction\nEdit `sigmaSigmaSubtypeEq` so it still compiles and the proof is simplified where possible. Return the full updated `sigmaSigmaSubtypeEq` block.\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Equiv.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Logic/Equiv/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Logic.Equiv.Basic.sigmaSigmaSubtypeEq`, L468-L474)\n```lean\ndef sigmaSigmaSubtypeEq {\u03b1 \u03b2 : Type*} {\u03b3 : \u03b1 \u2192 \u03b2 \u2192 Type*} (a : \u03b1) (b : \u03b2) :\n {s : (a : \u03b1) \u00d7 (b : \u03b2) \u00d7 \u03b3 a b // s.1 = a \u2227 s.2.1 = b} \u2243 \u03b3 a b := have : Unique (@Subtype ((_ : \u03b1) \u00d7 \u03b2) (fun \u27e8a', b'\u27e9 \u21a6 a' = a \u2227 b' = b)) := {\n default := \u27e8\u27e8a, b\u27e9, \u27e8rfl, rfl\u27e9\u27e9\n uniq := by rintro \u27e8\u27e8a', b'\u27e9, \u27e8rfl, rfl\u27e9\u27e9; rfl }\n sigmaSigmaSubtype (fun \u27e8a', b'\u27e9 \u21a6 a' = a \u2227 b' = b) \u27e8rfl, rfl\u27e9\n```\n\n## Edit instruction\nEdit `sigmaSigmaSubtypeEq` so it still compiles and the proof is simplified where possible. Return the full updated `sigmaSigmaSubtypeEq` block.\n[/INST]", "sample_id": "D-Mathlib.Logic.Equiv.Basic.sigmaSigmaSubtypeEq", "source": {"declaration": "Mathlib.Logic.Equiv.Basic.sigmaSigmaSubtypeEq", "file": "Mathlib/Logic/Equiv/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Logic.Equiv.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Logic/Equiv/Basic.lean#L468", "span": "L468-L474"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem trans_assoc_reparam {x\u2080 x\u2081 x\u2082 x\u2083 : X} (p : Path x\u2080 x\u2081) (q : Path x\u2081 x\u2082) (r : Path x\u2082 x\u2083) :\n (p.trans q).trans r =\n (p.trans (q.trans r)).reparam\n (fun t => \u27e8transAssocReparamAux t, transAssocReparamAux_mem_I t\u27e9) (by fun_prop)\n (Subtype.ext transAssocReparamAux_zero) (Subtype.ext transAssocReparamAux_one)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 763, "declarations_count": 85, "diagnostics_count": 0, "duplicate_fingerprint": "ae015df09e493a50", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 247, "lean_code_chars": 336, "lean_code_ratio": 0.4404, "length_bucket": "tiny", "line_count": 11, "natural_language_chars": 427, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.FundamentalGroupoid.Basic).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem trans_assoc_reparam {x\u2080 x\u2081 x\u2082 x\u2083 : X} (p : Path x\u2080 x\u2081) (q : Path x\u2081 x\u2082) (r : Path x\u2082 x\u2083) :\n (p.trans q).trans r =\n (p.trans (q.trans r)).reparam\n (fun t => \u27e8transAssocReparamAux t, transAssocReparamAux_mem_I t\u27e9) (by fun_prop)\n (Subtype.ext transAssocReparamAux_zero) (Subtype.ext transAssocReparamAux_one)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.FundamentalGroupoid.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem trans_assoc_reparam {x\u2080 x\u2081 x\u2082 x\u2083 : X} (p : Path x\u2080 x\u2081) (q : Path x\u2081 x\u2082) (r : Path x\u2082 x\u2083) :\n (p.trans q).trans r =\n (p.trans (q.trans r)).reparam\n (fun t => \u27e8transAssocReparamAux t, transAssocReparamAux_mem_I t\u27e9) (by fun_prop)\n (Subtype.ext transAssocReparamAux_zero) (Subtype.ext transAssocReparamAux_one)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.AlgebraicTopology.FundamentalGroupoid.Basic.trans_assoc_reparam", "source": {"declaration": "Mathlib.AlgebraicTopology.FundamentalGroupoid.Basic.trans_assoc_reparam", "file": "Mathlib/AlgebraicTopology/FundamentalGroupoid/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.FundamentalGroupoid.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/FundamentalGroupoid/Basic.lean#L144", "span": "L144-L157"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "F", "construction": {"instruction": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.", "statement": "def normalForm (\u03c1 : Type) [Context \u03c1]\n [MonadMor\u2081 (CoherenceM \u03c1)]\n [MonadMor\u2082Iso (CoherenceM \u03c1)]\n [MonadNormalExpr (CoherenceM \u03c1)] [MkEval (CoherenceM \u03c1)]\n [MkMor\u2082 (CoherenceM \u03c1)]\n [MonadMor\u2082 (CoherenceM \u03c1)]\n (nm : Name) (mvarId : MVarId) : MetaM (List MVarId)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 813, "declarations_count": 70, "diagnostics_count": 0, "duplicate_fingerprint": "1ed0869f0560ed01", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 252, "lean_code_chars": 279, "lean_code_ratio": 0.3432, "length_bucket": "tiny", "line_count": 13, "natural_language_chars": 534, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.CategoryTheory.Coherence.Basic).", "role": "system"}, {"content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\ndef normalForm (\u03c1 : Type) [Context \u03c1]\n [MonadMor\u2081 (CoherenceM \u03c1)]\n [MonadMor\u2082Iso (CoherenceM \u03c1)]\n [MonadNormalExpr (CoherenceM \u03c1)] [MkEval (CoherenceM \u03c1)]\n [MkMor\u2082 (CoherenceM \u03c1)]\n [MonadMor\u2082 (CoherenceM \u03c1)]\n (nm : Name) (mvarId : MVarId) : MetaM (List MVarId)\n```\n\nDeclaration: `Mathlib.Tactic.CategoryTheory.Coherence.Basic.normalForm` (module Mathlib.Tactic.CategoryTheory.Coherence.Basic).", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.CategoryTheory.Coherence.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\ndef normalForm (\u03c1 : Type) [Context \u03c1]\n [MonadMor\u2081 (CoherenceM \u03c1)]\n [MonadMor\u2082Iso (CoherenceM \u03c1)]\n [MonadNormalExpr (CoherenceM \u03c1)] [MkEval (CoherenceM \u03c1)]\n [MkMor\u2082 (CoherenceM \u03c1)]\n [MonadMor\u2082 (CoherenceM \u03c1)]\n (nm : Name) (mvarId : MVarId) : MetaM (List MVarId)\n```\n\nDeclaration: `Mathlib.Tactic.CategoryTheory.Coherence.Basic.normalForm` (module Mathlib.Tactic.CategoryTheory.Coherence.Basic).[/INST]", "sample_id": "F-Mathlib.Tactic.CategoryTheory.Coherence.Basic.normalForm", "source": {"declaration": "Mathlib.Tactic.CategoryTheory.Coherence.Basic.normalForm", "file": "Mathlib/Tactic/CategoryTheory/Coherence/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.CategoryTheory.Coherence.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/CategoryTheory/Coherence/Basic.lean#L39", "span": "L39-L61"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "F", "construction": {"instruction": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.", "statement": "lemma isNat_realSqrt {x : \u211d} {nx ny : \u2115} (h : IsNat x nx) (hy : ny * ny = nx) :\n IsNat \u221ax ny", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 592, "declarations_count": 62, "diagnostics_count": 0, "duplicate_fingerprint": "4847db643e292e8c", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 190, "lean_code_chars": 96, "lean_code_ratio": 0.1622, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 496, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.NormNum.RealSqrt).", "role": "system"}, {"content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\nlemma isNat_realSqrt {x : \u211d} {nx ny : \u2115} (h : IsNat x nx) (hy : ny * ny = nx) :\n IsNat \u221ax ny\n```\n\nDeclaration: `Mathlib.Tactic.NormNum.RealSqrt.isNat_realSqrt` (module Mathlib.Tactic.NormNum.RealSqrt).", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.NormNum.RealSqrt).[/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 isNat_realSqrt {x : \u211d} {nx ny : \u2115} (h : IsNat x nx) (hy : ny * ny = nx) :\n IsNat \u221ax ny\n```\n\nDeclaration: `Mathlib.Tactic.NormNum.RealSqrt.isNat_realSqrt` (module Mathlib.Tactic.NormNum.RealSqrt).[/INST]", "sample_id": "F-Mathlib.Tactic.NormNum.RealSqrt.isNat_realSqrt", "source": {"declaration": "Mathlib.Tactic.NormNum.RealSqrt.isNat_realSqrt", "file": "Mathlib/Tactic/NormNum/RealSqrt.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.NormNum.RealSqrt", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/NormNum/RealSqrt.lean#L21", "span": "L21-L23"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "def ReaderT.mkLabel {\u03b1 \u03b2} (\u03c1) : Label \u03b1 m \u03b2 \u2192 Label \u03b1 (ReaderT \u03c1 m) \u03b2\n | \u27e8f\u27e9 => \u27e8monadLift \u2218 f\u27e9", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 499, "declarations_count": 56, "diagnostics_count": 0, "duplicate_fingerprint": "7c2446864e0439e6", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 159, "lean_code_chars": 97, "lean_code_ratio": 0.1944, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 402, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Control.Monad.Cont).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ndef ReaderT.mkLabel {\u03b1 \u03b2} (\u03c1) : Label \u03b1 m \u03b2 \u2192 Label \u03b1 (ReaderT \u03c1 m) \u03b2\n | \u27e8f\u27e9 => \u27e8monadLift \u2218 f\u27e9\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Control.Monad.Cont).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ndef ReaderT.mkLabel {\u03b1 \u03b2} (\u03c1) : Label \u03b1 m \u03b2 \u2192 Label \u03b1 (ReaderT \u03c1 m) \u03b2\n | \u27e8f\u27e9 => \u27e8monadLift \u2218 f\u27e9\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Control.Monad.Cont.ReaderT", "source": {"declaration": "Mathlib.Control.Monad.Cont.ReaderT", "file": "Mathlib/Control/Monad/Cont.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Control.Monad.Cont", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Control/Monad/Cont.lean#L254", "span": "L254-L256"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.AlgebraicTopology.DoldKan.Projections.P_zero (L54-L54)\nlemma P_zero : (P 0 : K[X] \u27f6 K[X]) = \ud835\udfd9 _ := rfl", "-- Mathlib.AlgebraicTopology.DoldKan.Projections.P_succ (L55-L57)\nlemma P_succ (q : \u2115) : (P (q + 1) : K[X] \u27f6 K[X]) = P q \u226b (\ud835\udfd9 _ + H\u03c3 q) := rfl\n/-- All the `P q` coincide with `\ud835\udfd9 _` in degree 0. -/", "-- Mathlib.AlgebraicTopology.DoldKan.Projections.P_f_0_eq (L59-L66)\ntheorem P_f_0_eq (q : \u2115) : ((P q).f 0 : X _\u298b0\u298c \u27f6 X _\u298b0\u298c) = \ud835\udfd9 _ := by\ninduction q with\n | zero => rfl\n | succ q hq =>\n simp only [P_succ, HomologicalComplex.add_f_apply, HomologicalComplex.comp_f,\n HomologicalComplex.id_f, id_comp, hq, H\u03c3_eq_zero, add_zero]\n\n/-- `Q q` is the complement projection associated to `P q` -/", "-- Mathlib.AlgebraicTopology.DoldKan.Projections.Q (L67-L69)\ndef Q (q : \u2115) : K[X] \u27f6 K[X] :=\n\ud835\udfd9 _ - P q", "-- Mathlib.AlgebraicTopology.DoldKan.Projections.P_add_Q (L70-L73)\ntheorem P_add_Q (q : \u2115) : P q + Q q = \ud835\udfd9 K[X] := by\nrw [Q]\n abel", "-- Mathlib.AlgebraicTopology.DoldKan.Projections.P_add_Q_f (L74-L76)\ntheorem P_add_Q_f (q n : \u2115) : (P q).f n + (Q q).f n = \ud835\udfd9 (X _\u298bn\u298c) :=\nHomologicalComplex.congr_hom (P_add_Q q) n", "-- Mathlib.AlgebraicTopology.DoldKan.Projections.Q_succ (L81-L85)\ntheorem Q_succ (q : \u2115) : (Q (q + 1) : K[X] \u27f6 _) = Q q - P q \u226b H\u03c3 q := by\nsimp only [Q, P_succ, comp_add, comp_id]\n abel\n\n/-- All the `Q q` coincide with `0` in degree 0. -/", "-- Mathlib.AlgebraicTopology.DoldKan.Projections.Q_f_0_eq (L87-L93)\ntheorem Q_f_0_eq (q : \u2115) : ((Q q).f 0 : X _\u298b0\u298c \u27f6 X _\u298b0\u298c) = 0 := by\nsimp only [HomologicalComplex.sub_f_apply, HomologicalComplex.id_f, Q, P_f_0_eq, sub_self]\n\nnamespace HigherFacesVanish\n\n/-- This lemma expresses the vanishing of\n`(P q).f (n+1) \u226b X.\u03b4 k : X _\u298bn+1\u298c \u27f6 X _\u298bn\u298c` when `k\u22600` and `k\u2265n-q+2` -/", "-- Mathlib.AlgebraicTopology.DoldKan.Projections.of_P (L94-L100)\ntheorem of_P : \u2200 q n : \u2115, HigherFacesVanish q ((P q).f (n + 1) : X _\u298bn + 1\u298c \u27f6 X _\u298bn + 1\u298c)\n | 0 => fun n j hj\u2081 => by lia\n | q + 1 => fun n => by\n simp only [P_succ]\n exact (of_P q n).induction\n\nset_option backward.isDefEq.respectTransparency false in", "-- Mathlib.AlgebraicTopology.DoldKan.Projections.comp_P_eq_self (L102-L123)\ntheorem comp_P_eq_self {Y : C} {n q : \u2115} {\u03c6 : Y \u27f6 X _\u298bn + 1\u298c} (v : HigherFacesVanish q \u03c6) :\n \u03c6 \u226b (P q).f (n + 1) = \u03c6 := by\ninduction q with\n | zero =>\n simp only [P_zero]\n apply comp_id\n | succ q hq =>\n simp only [P_succ, comp_add, HomologicalComplex.comp_f, HomologicalComplex.add_f_apply,\n comp_id, \u2190 assoc, hq v.of_succ, add_eq_left]\n by_cases! hqn : n < q\n \u00b7 exact v.of_succ.comp_H\u03c3_eq_zero hqn\n \u00b7 obtain \u27e8a, ha\u27e9 := Nat.le.dest hqn\n have hnaq : n = a + q := by lia\n simp only [v.of_succ.comp_H\u03c3_eq hnaq, neg_eq_zero, \u2190 assoc]\n have eq := v \u27e8a, by lia\u27e9 (by\n simp only [hnaq, add_assoc]\n rfl)\n simp only [Fin.succ_mk] at eq\n simp only [eq, zero_comp]\n\nend HigherFacesVanish", "-- Mathlib.AlgebraicTopology.DoldKan.Projections.comp_P_eq_self_iff (L124-L132)\ntheorem comp_P_eq_self_iff {Y : C} {n q : \u2115} {\u03c6 : Y \u27f6 X _\u298bn + 1\u298c} :\n \u03c6 \u226b (P q).f (n + 1) = \u03c6 \u2194 HigherFacesVanish q \u03c6 := by\nconstructor\n \u00b7 intro h\u03c6\n rw [\u2190 h\u03c6]\n apply HigherFacesVanish.of_comp\n apply HigherFacesVanish.of_P\n \u00b7 exact HigherFacesVanish.comp_P_eq_self", "-- Mathlib.AlgebraicTopology.DoldKan.Projections.P_f_idem (L134-L138)\ntheorem P_f_idem (q n : \u2115) : ((P q).f n : X _\u298bn\u298c \u27f6 _) \u226b (P q).f n = (P q).f n := by\nrcases n with (_ | n)\n \u00b7 rw [P_f_0_eq q, comp_id]\n \u00b7 exact (HigherFacesVanish.of_P q n).comp_P_eq_self", "-- Mathlib.AlgebraicTopology.DoldKan.Projections.Q_f_idem (L140-L142)\ntheorem Q_f_idem (q n : \u2115) : ((Q q).f n : X _\u298bn\u298c \u27f6 _) \u226b (Q q).f n = (Q q).f n :=\nidem_of_id_sub_idem _ (P_f_idem q n)", "-- Mathlib.AlgebraicTopology.DoldKan.Projections.P_idem (L144-L147)\ntheorem P_idem (q : \u2115) : (P q : K[X] \u27f6 K[X]) \u226b P q = P q := by\next n\n exact P_f_idem q n", "-- Mathlib.AlgebraicTopology.DoldKan.Projections.Q_idem (L149-L154)\ntheorem Q_idem (q : \u2115) : (Q q : K[X] \u27f6 K[X]) \u226b Q q = Q q := by\next n\n exact Q_f_idem q n\n\nset_option backward.isDefEq.respectTransparency false in\n/-- For each `q`, `P q` is a natural transformation. -/", "-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.\u03c4\u2081 (L186-L197)\ndef \u03c4\u2081 (\u03b7 : G \u22d9 F \u2245 eB.functor) : eB.functor \u22d9 e'.inverse \u22d9 e'.functor \u2245 eB.functor :=\ncalc\n eB.functor \u22d9 e'.inverse \u22d9 e'.functor \u2245 (eB.functor \u22d9 e'.inverse) \u22d9 e'.functor :=\n (associator _ _ _).symm\n _ \u2245 (G \u22d9 eA.functor) \u22d9 e'.functor := isoWhiskerRight hG _\n _ \u2245 G \u22d9 eA.functor \u22d9 e'.functor := associator _ _ _\n _ \u2245 G \u22d9 F := isoWhiskerLeft _ hF\n _ \u2245 eB.functor := \u03b7\n\nvariable (\u03b7 : G \u22d9 F \u2245 eB.functor)\n\n/-- The counit isomorphism of `equivalence`. -/", "-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2082CounitIso_eq (L131-L136)\ntheorem equivalence\u2082CounitIso_eq :\n (equivalence\u2082 eB hF).counitIso = equivalence\u2082CounitIso eB hF := by\next Y'\n simp [equivalence\u2082, equivalence\u2081CounitIso_eq]\n\n/-- The unit isomorphism of the equivalence `equivalence\u2082` between `A` and `B`. -/", "-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2080 (L60-L66)\ndef equivalence\u2080 : A \u224c B' :=\neA.trans e'\n\nvariable {eA} {e'}\n\n/-- An intermediate equivalence `A \u224c B'` whose functor is `F` and whose inverse is\n`e'.inverse \u22d9 eA.inverse`. -/", "-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081UnitIso (L92-L102)\ndef equivalence\u2081UnitIso : \ud835\udfed A \u2245 F \u22d9 e'.inverse \u22d9 eA.inverse :=\ncalc\n \ud835\udfed A \u2245 eA.functor \u22d9 eA.inverse := eA.unitIso\n _ \u2245 eA.functor \u22d9 \ud835\udfed A' \u22d9 eA.inverse := isoWhiskerLeft _ (leftUnitor _).symm\n _ \u2245 eA.functor \u22d9 (e'.functor \u22d9 e'.inverse) \u22d9 eA.inverse :=\n isoWhiskerLeft _ (isoWhiskerRight e'.unitIso _)\n _ \u2245 eA.functor \u22d9 (e'.functor \u22d9 e'.inverse \u22d9 eA.inverse) :=\n isoWhiskerLeft _ (associator _ _ _)\n _ \u2245 (eA.functor \u22d9 e'.functor) \u22d9 e'.inverse \u22d9 eA.inverse := (associator _ _ _).symm\n _ \u2245 F \u22d9 e'.inverse \u22d9 eA.inverse := isoWhiskerRight hF _", "-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.\u03c5 (L229-L238)\ndef \u03c5 : eA.functor \u2245 F \u22d9 e'.inverse :=\ncalc\n eA.functor \u2245 eA.functor \u22d9 \ud835\udfed A' := (rightUnitor _).symm\n _ \u2245 eA.functor \u22d9 e'.functor \u22d9 e'.inverse := isoWhiskerLeft _ e'.unitIso\n _ \u2245 (eA.functor \u22d9 e'.functor) \u22d9 e'.inverse := (associator _ _ _).symm\n _ \u2245 F \u22d9 e'.inverse := isoWhiskerRight hF _\n\nvariable (\u03b5 : eA.functor \u2245 F \u22d9 e'.inverse) (hG)\n\n/-- The unit isomorphism of `equivalence`. -/", "-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence (L161-L169)\ndef equivalence : A \u224c B :=\n((equivalence\u2082 eB hF).changeInverse\n (calc eB.functor \u22d9 e'.inverse \u22d9 eA.inverse \u2245\n (eB.functor \u22d9 e'.inverse) \u22d9 eA.inverse := (associator _ _ _).symm\n _ \u2245 (G \u22d9 eA.functor) \u22d9 eA.inverse := isoWhiskerRight hG _\n _ \u2245 G \u22d9 eA.functor \u22d9 eA.inverse := associator _ _ _\n _ \u2245 G \u22d9 \ud835\udfed A := isoWhiskerLeft _ eA.unitIso.symm\n _ \u2245 G := G.rightUnitor))", "-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081CounitIso (L75-L85)\ndef equivalence\u2081CounitIso : (e'.inverse \u22d9 eA.inverse) \u22d9 F \u2245 \ud835\udfed B' :=\ncalc\n (e'.inverse \u22d9 eA.inverse) \u22d9 F \u2245 (e'.inverse \u22d9 eA.inverse) \u22d9 eA.functor \u22d9 e'.functor :=\n isoWhiskerLeft _ hF.symm\n _ \u2245 e'.inverse \u22d9 (eA.inverse \u22d9 eA.functor \u22d9 e'.functor) := associator _ _ _\n _ \u2245 e'.inverse \u22d9 (eA.inverse \u22d9 eA.functor) \u22d9 e'.functor :=\n isoWhiskerLeft _ (associator _ _ _).symm\n _ \u2245 e'.inverse \u22d9 \ud835\udfed _ \u22d9 e'.functor := isoWhiskerLeft _ (isoWhiskerRight eA.counitIso _)\n _ \u2245 e'.inverse \u22d9 e'.functor := isoWhiskerLeft _ (leftUnitor _)\n _ \u2245 \ud835\udfed B' := e'.counitIso", "-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081UnitIso_eq (L103-L108)\ntheorem equivalence\u2081UnitIso_eq : (equivalence\u2081 hF).unitIso = equivalence\u2081UnitIso hF := by\next X\n simp [equivalence\u2081]\n\n/-- An intermediate equivalence `A \u224c B` obtained as the composition of `equivalence\u2081` and\nthe inverse of `eB : B \u224c B'`. -/", "-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081 (L68-L69)\ndef equivalence\u2081 : A \u224c B' := (equivalence\u2080 eA e').changeFunctor hF", "-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081CounitIso_eq (L86-L90)\ntheorem equivalence\u2081CounitIso_eq : (equivalence\u2081 hF).counitIso = equivalence\u2081CounitIso hF := by\next Y\n simp [equivalence\u2081, equivalence\u2080]\n\n/-- The unit isomorphism of the equivalence `equivalence\u2081` between `A` and `B'`. -/", "-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalenceCounitIso (L199-L207)\ndef equivalenceCounitIso : G \u22d9 F \u22d9 eB.inverse \u2245 \ud835\udfed B :=\ncalc\n G \u22d9 F \u22d9 eB.inverse \u2245 (G \u22d9 F) \u22d9 eB.inverse := (associator _ _ _).symm\n _ \u2245 eB.functor \u22d9 eB.inverse := isoWhiskerRight \u03b7 _\n _ \u2245 \ud835\udfed B := eB.unitIso.symm\n\nvariable {\u03b7 hF hG}\n\nset_option backward.isDefEq.respectTransparency false in", "-- Mathlib.AlgebraicTopology.DoldKan.Decomposition.id (L109-L113)\ndef id : MorphComponents X n (X _\u298bn + 1\u298c) where\n a := PInfty.f (n + 1)\nb i := X.\u03c3 i\n\nset_option backward.isDefEq.respectTransparency false in", "-- Mathlib.AlgebraicTopology.DoldKan.Decomposition.\u03c6 (L100-L107)\ndef \u03c6 {Z : C} (f : MorphComponents X n Z) : X _\u298bn + 1\u298c \u27f6 Z :=\nPInfty.f (n + 1) \u226b f.a + \u2211 i : Fin (n + 1), (P i).f (n + 1) \u226b X.\u03b4 i.rev.succ \u226b\n f.b (Fin.rev i)\n\nvariable (X n)\n\n/-- the canonical `MorphComponents` whose associated morphism is the identity\n(see `F_id`) thanks to `decomposition_Q n (n+1)` -/", "-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2082_inverse (L113-L117)\ntheorem equivalence\u2082_inverse :\n (equivalence\u2082 eB hF).inverse = eB.functor \u22d9 e'.inverse \u22d9 eA.inverse :=\nrfl\n\n/-- The counit isomorphism of the equivalence `equivalence\u2082` between `A` and `B`. -/", "-- Mathlib.AlgebraicTopology.DoldKan.Decomposition.decomposition_Q (L55-L89)\ntheorem decomposition_Q (n q : \u2115) :\n ((Q q).f (n + 1) : X _\u298bn + 1\u298c \u27f6 X _\u298bn + 1\u298c) =\n \u2211 i : Fin (n + 1) with i.val < q, (P i).f (n + 1) \u226b X.\u03b4 i.rev.succ \u226b X.\u03c3 (Fin.rev i) := by\ninduction q with\n | zero =>\n simp only [Q_zero, HomologicalComplex.zero_f_apply, Nat.not_lt_zero,\n Finset.filter_false, Finset.sum_empty]\n | succ q hq =>\n by_cases! hqn : n < q\n \u00b7 rw [Q_is_eventually_constant (show n + 1 \u2264 q by lia), hq]\n congr 1\n ext \u27e8x, hx\u27e9\n simp_rw [Finset.mem_filter_univ]\n lia\n \u00b7 obtain \u27e8a, ha\u27e9 := Nat.le.dest hqn\n rw [Q_succ, HomologicalComplex.sub_f_apply, HomologicalComplex.comp_f, hq]\n symm\n conv_rhs => rw [sub_eq_add_neg, add_comm]\n let q' : Fin (n + 1) := \u27e8q, Nat.lt_succ_of_le hqn\u27e9\n rw [\u2190 @Finset.add_sum_erase _ _ _ _ _ _ q' (by simp [q'])]\n congr\n \u00b7 have hnaq' : n = a + q := by lia\n simp only [(HigherFacesVanish.of_P q n).comp_H\u03c3_eq hnaq', q'.rev_eq hnaq', neg_neg]\n rfl\n \u00b7 ext \u27e8i, hi\u27e9\n simp_rw [Finset.mem_erase, Finset.mem_filter_univ, q', ne_eq, Fin.mk.injEq]\n lia\n\nvariable (X)\n\n/-- The structure `MorphComponents` is an ad hoc structure that is used in\nthe proof that `N\u2081 : SimplicialObject C \u2964 Karoubi (ChainComplex C \u2115))`\nreflects isomorphisms. The fields are the data that are needed in order to\nconstruct a morphism `X _\u298bn+1\u298c \u27f6 Z` (see `\u03c6`) using the decomposition of the\nidentity given by `decomposition_Q n (n+1)`. -/", "-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalenceUnitIso (L240-L264)\ndef equivalenceUnitIso : \ud835\udfed A \u2245 (F \u22d9 eB.inverse) \u22d9 G :=\ncalc\n \ud835\udfed A \u2245 eA.functor \u22d9 eA.inverse := eA.unitIso\n _ \u2245 (F \u22d9 e'.inverse) \u22d9 eA.inverse := isoWhiskerRight \u03b5 _\n _ \u2245 F \u22d9 e'.inverse \u22d9 eA.inverse := associator _ _ _\n _ \u2245 F \u22d9 \ud835\udfed B' \u22d9 e'.inverse \u22d9 eA.inverse := isoWhiskerLeft _ (leftUnitor _).symm\n _ \u2245 F \u22d9 (eB.inverse \u22d9 eB.functor) \u22d9 e'.inverse \u22d9 eA.inverse :=\n isoWhiskerLeft _ (isoWhiskerRight eB.counitIso.symm _)\n _ \u2245 (F \u22d9 eB.inverse \u22d9 eB.functor) \u22d9 e'.inverse \u22d9 eA.inverse := (associator _ _ _).symm\n _ \u2245 ((F \u22d9 eB.inverse) \u22d9 eB.functor) \u22d9 e'.inverse \u22d9 eA.inverse :=\n isoWhiskerRight (associator _ _ _).symm _\n _ \u2245 (F \u22d9 eB.inverse) \u22d9 eB.functor \u22d9 e'.inverse \u22d9 eA.inverse := associator _ _ _\n _ \u2245 (F \u22d9 eB.inverse) \u22d9 (eB.functor \u22d9 e'.inverse) \u22d9 eA.inverse :=\n isoWhiskerLeft _ (associator _ _ _).symm\n _ \u2245 (F \u22d9 eB.inverse) \u22d9 (G \u22d9 eA.functor) \u22d9 eA.inverse :=\n isoWhiskerLeft _ (isoWhiskerRight hG _)\n _ \u2245 ((F \u22d9 eB.inverse) \u22d9 G \u22d9 eA.functor) \u22d9 eA.inverse := (associator _ _ _).symm\n _ \u2245 (((F \u22d9 eB.inverse) \u22d9 G) \u22d9 eA.functor) \u22d9 eA.inverse :=\n isoWhiskerRight (associator _ _ _).symm _\n _ \u2245 ((F \u22d9 eB.inverse) \u22d9 G) \u22d9 eA.functor \u22d9 eA.inverse := associator _ _ _\n _ \u2245 ((F \u22d9 eB.inverse) \u22d9 G) \u22d9 \ud835\udfed A := isoWhiskerLeft _ eA.unitIso.symm\n _ \u2245 (F \u22d9 eB.inverse) \u22d9 G := rightUnitor _\n\nvariable {\u03b5 hF hG}", "-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2082UnitIso (L138-L151)\ndef equivalence\u2082UnitIso : \ud835\udfed A \u2245 (F \u22d9 eB.inverse) \u22d9 eB.functor \u22d9 e'.inverse \u22d9 eA.inverse :=\ncalc\n \ud835\udfed A \u2245 F \u22d9 e'.inverse \u22d9 eA.inverse := equivalence\u2081UnitIso hF\n _ \u2245 F \u22d9 \ud835\udfed B' \u22d9 e'.inverse \u22d9 eA.inverse :=\n isoWhiskerLeft _ (leftUnitor _).symm\n _ \u2245 F \u22d9 (eB.inverse \u22d9 eB.functor) \u22d9 e'.inverse \u22d9 eA.inverse :=\n isoWhiskerLeft _ (isoWhiskerRight eB.counitIso.symm _)\n _ \u2245 (F \u22d9 eB.inverse \u22d9 eB.functor) \u22d9 e'.inverse \u22d9 eA.inverse :=\n (associator _ _ _).symm\n _ \u2245 ((F \u22d9 eB.inverse) \u22d9 eB.functor) \u22d9 e'.inverse \u22d9 eA.inverse :=\n isoWhiskerRight (associator _ _ _).symm _\n _ \u2245 (F \u22d9 eB.inverse) \u22d9 eB.functor \u22d9 e'.inverse \u22d9 eA.inverse :=\n associator _ _ _", "-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081_inverse (L70-L73)\ntheorem equivalence\u2081_inverse : (equivalence\u2081 hF).inverse = e'.inverse \u22d9 eA.inverse :=\nrfl\n\n/-- The counit isomorphism of the equivalence `equivalence\u2081` between `A` and `B'`. -/", "-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2082UnitIso_eq (L152-L159)\ntheorem equivalence\u2082UnitIso_eq : (equivalence\u2082 eB hF).unitIso = equivalence\u2082UnitIso eB hF := by\next X\n simp [equivalence\u2082, equivalence\u2081]\n\nvariable {eB}\n\n/-- The equivalence `A \u224c B` whose functor is `F \u22d9 eB.inverse` and\nwhose inverse functor is `G : B \u2964 A`. -/", "-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.\u03c4\u2080 (L176-L184)\ndef \u03c4\u2080 : eB.functor \u22d9 e'.inverse \u22d9 e'.functor \u2245 eB.functor :=\ncalc\n eB.functor \u22d9 e'.inverse \u22d9 e'.functor \u2245 eB.functor \u22d9 \ud835\udfed _ := isoWhiskerLeft _ e'.counitIso\n _ \u2245 eB.functor := Functor.rightUnitor _\n\n/-- The isomorphism `eB.functor \u22d9 e'.inverse \u22d9 e'.functor \u2245 eB.functor` deduced\nfrom the isomorphisms `hF : eA.functor \u22d9 e'.functor \u2245 F`,\n`hG : eB.functor \u22d9 e'.inverse \u2245 G \u22d9 eA.functor` and the datum of\nan isomorphism `\u03b7 : G \u22d9 F \u2245 eB.functor`. -/", "-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2082CounitIso (L119-L130)\ndef equivalence\u2082CounitIso : (eB.functor \u22d9 e'.inverse \u22d9 eA.inverse) \u22d9 F \u22d9 eB.inverse \u2245 \ud835\udfed B :=\ncalc\n (eB.functor \u22d9 e'.inverse \u22d9 eA.inverse) \u22d9 F \u22d9 eB.inverse\n \u2245 eB.functor \u22d9 (e'.inverse \u22d9 eA.inverse) \u22d9 F \u22d9 eB.inverse := associator _ _ _\n _ \u2245 eB.functor \u22d9 ((e'.inverse \u22d9 eA.inverse) \u22d9 F) \u22d9 eB.inverse :=\n isoWhiskerLeft _ (associator _ _ _).symm\n _ \u2245 eB.functor \u22d9 \ud835\udfed _ \u22d9 eB.inverse :=\n isoWhiskerLeft _ (isoWhiskerRight (equivalence\u2081CounitIso hF) _)\n _ \u2245 eB.functor \u22d9 eB.inverse := isoWhiskerLeft _ (leftUnitor _)\n _ \u2245 \ud835\udfed B := eB.unitIso.symm\n\nset_option backward.isDefEq.respectTransparency false in", "-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalenceUnitIso_eq (L265-L277)\ntheorem equivalenceUnitIso_eq (h\u03b5 : \u03c5 hF = \u03b5) :\n (equivalence hF hG).unitIso = equivalenceUnitIso hG \u03b5 := by\next1; apply NatTrans.ext; ext X\n dsimp [equivalence]\n simp only [assoc, comp_id, equivalenceUnitIso_hom_app, equivalence\u2082_inverse, Functor.comp_obj,\n id_comp, equivalence\u2082UnitIso_eq eB hF, equivalence\u2082UnitIso_hom_app,\n \u2190 eA.inverse.map_comp_assoc, assoc, \u2190 h\u03b5, \u03c5_hom_app]\n\nend Compatibility\n\nend DoldKan\n\nend AlgebraicTopology", "-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence_functor (L170-L174)\ntheorem equivalence_functor : (equivalence hF hG).functor = F \u22d9 eB.inverse :=\nrfl\n\n/-- The isomorphism `eB.functor \u22d9 e'.inverse \u22d9 e'.functor \u2245 eB.functor` deduced\nfrom the counit isomorphism of `e'`. -/", "-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2082 (L110-L112)\ndef equivalence\u2082 : A \u224c B :=\n(equivalence\u2081 hF).trans eB.symm", "-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalenceCounitIso_eq (L208-L227)\ntheorem equivalenceCounitIso_eq (h\u03b7 : \u03c4\u2080 = \u03c4\u2081 hF hG \u03b7) :\n (equivalence hF hG).counitIso = equivalenceCounitIso \u03b7 := by\next1; apply NatTrans.ext; ext Y\n dsimp [equivalence]\n simp only [comp_id, id_comp, Functor.map_comp, equivalence\u2082CounitIso_eq,\n equivalence\u2082CounitIso_hom_app, assoc, equivalenceCounitIso_hom_app]\n simp only [equivalence\u2082_inverse, comp_obj, \u2190 \u03c4\u2080_hom_app, h\u03b7, \u03c4\u2081_hom_app, \u2190\n eB.inverse.map_comp_assoc]\n rw [hF.inv.naturality_assoc, hF.inv.naturality_assoc]\n congr 2\n simp only [\u2190 e'.functor.map_comp_assoc]\n simp only [Functor.comp_map, Equivalence.fun_inv_map, comp_obj, id_obj, map_comp, assoc]\n simp only [\u2190 e'.functor.map_comp_assoc]\n simp only [Iso.inv_hom_id_app_assoc, Iso.inv_hom_id_app, comp_obj, comp_id,\n Equivalence.functor_unit_comp, map_id, id_comp]\n\nvariable (hF)\n\n/-- The isomorphism `eA.functor \u2245 F \u22d9 e'.inverse` deduced from the\nunit isomorphism of `e'` and the isomorphism `hF : eA.functor \u22d9 e'.functor \u2245 F`. -/"], "statement": "theorem Q_zero : (Q 0 : K[X] \u27f6 _) = 0", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 18605, "declarations_count": 1952, "diagnostics_count": 0, "duplicate_fingerprint": "c6b8e2faab59db15", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 7903, "lean_code_chars": 17091, "lean_code_ratio": 0.9186, "length_bucket": "medium", "line_count": 535, "natural_language_chars": 1514, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 40, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.DoldKan.Projections).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem Q_zero : (Q 0 : K[X] \u27f6 _) = 0\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.P_zero (L54-L54)\nlemma P_zero : (P 0 : K[X] \u27f6 K[X]) = \ud835\udfd9 _ := rfl\n```\n\n-- snippet 2\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.P_succ (L55-L57)\nlemma P_succ (q : \u2115) : (P (q + 1) : K[X] \u27f6 K[X]) = P q \u226b (\ud835\udfd9 _ + H\u03c3 q) := rfl\n/-- All the `P q` coincide with `\ud835\udfd9 _` in degree 0. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.P_f_0_eq (L59-L66)\ntheorem P_f_0_eq (q : \u2115) : ((P q).f 0 : X _\u298b0\u298c \u27f6 X _\u298b0\u298c) = \ud835\udfd9 _ := by\ninduction q with\n | zero => rfl\n | succ q hq =>\n simp only [P_succ, HomologicalComplex.add_f_apply, HomologicalComplex.comp_f,\n HomologicalComplex.id_f, id_comp, hq, H\u03c3_eq_zero, add_zero]\n\n/-- `Q q` is the complement projection associated to `P q` -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.Q (L67-L69)\ndef Q (q : \u2115) : K[X] \u27f6 K[X] :=\n\ud835\udfd9 _ - P q\n```\n\n-- snippet 5\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.P_add_Q (L70-L73)\ntheorem P_add_Q (q : \u2115) : P q + Q q = \ud835\udfd9 K[X] := by\nrw [Q]\n abel\n```\n\n-- snippet 6\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.P_add_Q_f (L74-L76)\ntheorem P_add_Q_f (q n : \u2115) : (P q).f n + (Q q).f n = \ud835\udfd9 (X _\u298bn\u298c) :=\nHomologicalComplex.congr_hom (P_add_Q q) n\n```\n\n-- snippet 7\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.Q_succ (L81-L85)\ntheorem Q_succ (q : \u2115) : (Q (q + 1) : K[X] \u27f6 _) = Q q - P q \u226b H\u03c3 q := by\nsimp only [Q, P_succ, comp_add, comp_id]\n abel\n\n/-- All the `Q q` coincide with `0` in degree 0. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.Q_f_0_eq (L87-L93)\ntheorem Q_f_0_eq (q : \u2115) : ((Q q).f 0 : X _\u298b0\u298c \u27f6 X _\u298b0\u298c) = 0 := by\nsimp only [HomologicalComplex.sub_f_apply, HomologicalComplex.id_f, Q, P_f_0_eq, sub_self]\n\nnamespace HigherFacesVanish\n\n/-- This lemma expresses the vanishing of\n`(P q).f (n+1) \u226b X.\u03b4 k : X _\u298bn+1\u298c \u27f6 X _\u298bn\u298c` when `k\u22600` and `k\u2265n-q+2` -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.of_P (L94-L100)\ntheorem of_P : \u2200 q n : \u2115, HigherFacesVanish q ((P q).f (n + 1) : X _\u298bn + 1\u298c \u27f6 X _\u298bn + 1\u298c)\n | 0 => fun n j hj\u2081 => by lia\n | q + 1 => fun n => by\n simp only [P_succ]\n exact (of_P q n).induction\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 10\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.comp_P_eq_self (L102-L123)\ntheorem comp_P_eq_self {Y : C} {n q : \u2115} {\u03c6 : Y \u27f6 X _\u298bn + 1\u298c} (v : HigherFacesVanish q \u03c6) :\n \u03c6 \u226b (P q).f (n + 1) = \u03c6 := by\ninduction q with\n | zero =>\n simp only [P_zero]\n apply comp_id\n | succ q hq =>\n simp only [P_succ, comp_add, HomologicalComplex.comp_f, HomologicalComplex.add_f_apply,\n comp_id, \u2190 assoc, hq v.of_succ, add_eq_left]\n by_cases! hqn : n < q\n \u00b7 exact v.of_succ.comp_H\u03c3_eq_zero hqn\n \u00b7 obtain \u27e8a, ha\u27e9 := Nat.le.dest hqn\n have hnaq : n = a + q := by lia\n simp only [v.of_succ.comp_H\u03c3_eq hnaq, neg_eq_zero, \u2190 assoc]\n have eq := v \u27e8a, by lia\u27e9 (by\n simp only [hnaq, add_assoc]\n rfl)\n simp only [Fin.succ_mk] at eq\n simp only [eq, zero_comp]\n\nend HigherFacesVanish\n```\n\n-- snippet 11\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.comp_P_eq_self_iff (L124-L132)\ntheorem comp_P_eq_self_iff {Y : C} {n q : \u2115} {\u03c6 : Y \u27f6 X _\u298bn + 1\u298c} :\n \u03c6 \u226b (P q).f (n + 1) = \u03c6 \u2194 HigherFacesVanish q \u03c6 := by\nconstructor\n \u00b7 intro h\u03c6\n rw [\u2190 h\u03c6]\n apply HigherFacesVanish.of_comp\n apply HigherFacesVanish.of_P\n \u00b7 exact HigherFacesVanish.comp_P_eq_self\n```\n\n-- snippet 12\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.P_f_idem (L134-L138)\ntheorem P_f_idem (q n : \u2115) : ((P q).f n : X _\u298bn\u298c \u27f6 _) \u226b (P q).f n = (P q).f n := by\nrcases n with (_ | n)\n \u00b7 rw [P_f_0_eq q, comp_id]\n \u00b7 exact (HigherFacesVanish.of_P q n).comp_P_eq_self\n```\n\n-- snippet 13\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.Q_f_idem (L140-L142)\ntheorem Q_f_idem (q n : \u2115) : ((Q q).f n : X _\u298bn\u298c \u27f6 _) \u226b (Q q).f n = (Q q).f n :=\nidem_of_id_sub_idem _ (P_f_idem q n)\n```\n\n-- snippet 14\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.P_idem (L144-L147)\ntheorem P_idem (q : \u2115) : (P q : K[X] \u27f6 K[X]) \u226b P q = P q := by\next n\n exact P_f_idem q n\n```\n\n-- snippet 15\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.Q_idem (L149-L154)\ntheorem Q_idem (q : \u2115) : (Q q : K[X] \u27f6 K[X]) \u226b Q q = Q q := by\next n\n exact Q_f_idem q n\n\nset_option backward.isDefEq.respectTransparency false in\n/-- For each `q`, `P q` is a natural transformation. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.\u03c4\u2081 (L186-L197)\ndef \u03c4\u2081 (\u03b7 : G \u22d9 F \u2245 eB.functor) : eB.functor \u22d9 e'.inverse \u22d9 e'.functor \u2245 eB.functor :=\ncalc\n eB.functor \u22d9 e'.inverse \u22d9 e'.functor \u2245 (eB.functor \u22d9 e'.inverse) \u22d9 e'.functor :=\n (associator _ _ _).symm\n _ \u2245 (G \u22d9 eA.functor) \u22d9 e'.functor := isoWhiskerRight hG _\n _ \u2245 G \u22d9 eA.functor \u22d9 e'.functor := associator _ _ _\n _ \u2245 G \u22d9 F := isoWhiskerLeft _ hF\n _ \u2245 eB.functor := \u03b7\n\nvariable (\u03b7 : G \u22d9 F \u2245 eB.functor)\n\n/-- The counit isomorphism of `equivalence`. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2082CounitIso_eq (L131-L136)\ntheorem equivalence\u2082CounitIso_eq :\n (equivalence\u2082 eB hF).counitIso = equivalence\u2082CounitIso eB hF := by\next Y'\n simp [equivalence\u2082, equivalence\u2081CounitIso_eq]\n\n/-- The unit isomorphism of the equivalence `equivalence\u2082` between `A` and `B`. -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2080 (L60-L66)\ndef equivalence\u2080 : A \u224c B' :=\neA.trans e'\n\nvariable {eA} {e'}\n\n/-- An intermediate equivalence `A \u224c B'` whose functor is `F` and whose inverse is\n`e'.inverse \u22d9 eA.inverse`. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081UnitIso (L92-L102)\ndef equivalence\u2081UnitIso : \ud835\udfed A \u2245 F \u22d9 e'.inverse \u22d9 eA.inverse :=\ncalc\n \ud835\udfed A \u2245 eA.functor \u22d9 eA.inverse := eA.unitIso\n _ \u2245 eA.functor \u22d9 \ud835\udfed A' \u22d9 eA.inverse := isoWhiskerLeft _ (leftUnitor _).symm\n _ \u2245 eA.functor \u22d9 (e'.functor \u22d9 e'.inverse) \u22d9 eA.inverse :=\n isoWhiskerLeft _ (isoWhiskerRight e'.unitIso _)\n _ \u2245 eA.functor \u22d9 (e'.functor \u22d9 e'.inverse \u22d9 eA.inverse) :=\n isoWhiskerLeft _ (associator _ _ _)\n _ \u2245 (eA.functor \u22d9 e'.functor) \u22d9 e'.inverse \u22d9 eA.inverse := (associator _ _ _).symm\n _ \u2245 F \u22d9 e'.inverse \u22d9 eA.inverse := isoWhiskerRight hF _\n```\n\n-- snippet 20\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.\u03c5 (L229-L238)\ndef \u03c5 : eA.functor \u2245 F \u22d9 e'.inverse :=\ncalc\n eA.functor \u2245 eA.functor \u22d9 \ud835\udfed A' := (rightUnitor _).symm\n _ \u2245 eA.functor \u22d9 e'.functor \u22d9 e'.inverse := isoWhiskerLeft _ e'.unitIso\n _ \u2245 (eA.functor \u22d9 e'.functor) \u22d9 e'.inverse := (associator _ _ _).symm\n _ \u2245 F \u22d9 e'.inverse := isoWhiskerRight hF _\n\nvariable (\u03b5 : eA.functor \u2245 F \u22d9 e'.inverse) (hG)\n\n/-- The unit isomorphism of `equivalence`. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence (L161-L169)\ndef equivalence : A \u224c B :=\n((equivalence\u2082 eB hF).changeInverse\n (calc eB.functor \u22d9 e'.inverse \u22d9 eA.inverse \u2245\n (eB.functor \u22d9 e'.inverse) \u22d9 eA.inverse := (associator _ _ _).symm\n _ \u2245 (G \u22d9 eA.functor) \u22d9 eA.inverse := isoWhiskerRight hG _\n _ \u2245 G \u22d9 eA.functor \u22d9 eA.inverse := associator _ _ _\n _ \u2245 G \u22d9 \ud835\udfed A := isoWhiskerLeft _ eA.unitIso.symm\n _ \u2245 G := G.rightUnitor))\n```\n\n-- snippet 22\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081CounitIso (L75-L85)\ndef equivalence\u2081CounitIso : (e'.inverse \u22d9 eA.inverse) \u22d9 F \u2245 \ud835\udfed B' :=\ncalc\n (e'.inverse \u22d9 eA.inverse) \u22d9 F \u2245 (e'.inverse \u22d9 eA.inverse) \u22d9 eA.functor \u22d9 e'.functor :=\n isoWhiskerLeft _ hF.symm\n _ \u2245 e'.inverse \u22d9 (eA.inverse \u22d9 eA.functor \u22d9 e'.functor) := associator _ _ _\n _ \u2245 e'.inverse \u22d9 (eA.inverse \u22d9 eA.functor) \u22d9 e'.functor :=\n isoWhiskerLeft _ (associator _ _ _).symm\n _ \u2245 e'.inverse \u22d9 \ud835\udfed _ \u22d9 e'.functor := isoWhiskerLeft _ (isoWhiskerRight eA.counitIso _)\n _ \u2245 e'.inverse \u22d9 e'.functor := isoWhiskerLeft _ (leftUnitor _)\n _ \u2245 \ud835\udfed B' := e'.counitIso\n```\n\n-- snippet 23\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081UnitIso_eq (L103-L108)\ntheorem equivalence\u2081UnitIso_eq : (equivalence\u2081 hF).unitIso = equivalence\u2081UnitIso hF := by\next X\n simp [equivalence\u2081]\n\n/-- An intermediate equivalence `A \u224c B` obtained as the composition of `equivalence\u2081` and\nthe inverse of `eB : B \u224c B'`. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081 (L68-L69)\ndef equivalence\u2081 : A \u224c B' := (equivalence\u2080 eA e').changeFunctor hF\n```\n\n-- snippet 25\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081CounitIso_eq (L86-L90)\ntheorem equivalence\u2081CounitIso_eq : (equivalence\u2081 hF).counitIso = equivalence\u2081CounitIso hF := by\next Y\n simp [equivalence\u2081, equivalence\u2080]\n\n/-- The unit isomorphism of the equivalence `equivalence\u2081` between `A` and `B'`. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalenceCounitIso (L199-L207)\ndef equivalenceCounitIso : G \u22d9 F \u22d9 eB.inverse \u2245 \ud835\udfed B :=\ncalc\n G \u22d9 F \u22d9 eB.inverse \u2245 (G \u22d9 F) \u22d9 eB.inverse := (associator _ _ _).symm\n _ \u2245 eB.functor \u22d9 eB.inverse := isoWhiskerRight \u03b7 _\n _ \u2245 \ud835\udfed B := eB.unitIso.symm\n\nvariable {\u03b7 hF hG}\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 27\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Decomposition.id (L109-L113)\ndef id : MorphComponents X n (X _\u298bn + 1\u298c) where\n a := PInfty.f (n + 1)\nb i := X.\u03c3 i\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 28\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Decomposition.\u03c6 (L100-L107)\ndef \u03c6 {Z : C} (f : MorphComponents X n Z) : X _\u298bn + 1\u298c \u27f6 Z :=\nPInfty.f (n + 1) \u226b f.a + \u2211 i : Fin (n + 1), (P i).f (n + 1) \u226b X.\u03b4 i.rev.succ \u226b\n f.b (Fin.rev i)\n\nvariable (X n)\n\n/-- the canonical `MorphComponents` whose associated morphism is the identity\n(see `F_id`) thanks to `decomposition_Q n (n+1)` -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2082_inverse (L113-L117)\ntheorem equivalence\u2082_inverse :\n (equivalence\u2082 eB hF).inverse = eB.functor \u22d9 e'.inverse \u22d9 eA.inverse :=\nrfl\n\n/-- The counit isomorphism of the equivalence `equivalence\u2082` between `A` and `B`. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Decomposition.decomposition_Q (L55-L89)\ntheorem decomposition_Q (n q : \u2115) :\n ((Q q).f (n + 1) : X _\u298bn + 1\u298c \u27f6 X _\u298bn + 1\u298c) =\n \u2211 i : Fin (n + 1) with i.val < q, (P i).f (n + 1) \u226b X.\u03b4 i.rev.succ \u226b X.\u03c3 (Fin.rev i) := by\ninduction q with\n | zero =>\n simp only [Q_zero, HomologicalComplex.zero_f_apply, Nat.not_lt_zero,\n Finset.filter_false, Finset.sum_empty]\n | succ q hq =>\n by_cases! hqn : n < q\n \u00b7 rw [Q_is_eventually_constant (show n + 1 \u2264 q by lia), hq]\n congr 1\n ext \u27e8x, hx\u27e9\n simp_rw [Finset.mem_filter_univ]\n lia\n \u00b7 obtain \u27e8a, ha\u27e9 := Nat.le.dest hqn\n rw [Q_succ, HomologicalComplex.sub_f_apply, HomologicalComplex.comp_f, hq]\n symm\n conv_rhs => rw [sub_eq_add_neg, add_comm]\n let q' : Fin (n + 1) := \u27e8q, Nat.lt_succ_of_le hqn\u27e9\n rw [\u2190 @Finset.add_sum_erase _ _ _ _ _ _ q' (by simp [q'])]\n congr\n \u00b7 have hnaq' : n = a + q := by lia\n simp only [(HigherFacesVanish.of_P q n).comp_H\u03c3_eq hnaq', q'.rev_eq hnaq', neg_neg]\n rfl\n \u00b7 ext \u27e8i, hi\u27e9\n simp_rw [Finset.mem_erase, Finset.mem_filter_univ, q', ne_eq, Fin.mk.injEq]\n lia\n\nvariable (X)\n\n/-- The structure `MorphComponents` is an ad hoc structure that is used in\nthe proof that `N\u2081 : SimplicialObject C \u2964 Karoubi (ChainComplex C \u2115))`\nreflects isomorphisms. The fields are the data that are needed in order to\nconstruct a morphism `X _\u298bn+1\u298c \u27f6 Z` (see `\u03c6`) using the decomposition of the\nidentity given by `decomposition_Q n (n+1)`. -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalenceUnitIso (L240-L264)\ndef equivalenceUnitIso : \ud835\udfed A \u2245 (F \u22d9 eB.inverse) \u22d9 G :=\ncalc\n \ud835\udfed A \u2245 eA.functor \u22d9 eA.inverse := eA.unitIso\n _ \u2245 (F \u22d9 e'.inverse) \u22d9 eA.inverse := isoWhiskerRight \u03b5 _\n _ \u2245 F \u22d9 e'.inverse \u22d9 eA.inverse := associator _ _ _\n _ \u2245 F \u22d9 \ud835\udfed B' \u22d9 e'.inverse \u22d9 eA.inverse := isoWhiskerLeft _ (leftUnitor _).symm\n _ \u2245 F \u22d9 (eB.inverse \u22d9 eB.functor) \u22d9 e'.inverse \u22d9 eA.inverse :=\n isoWhiskerLeft _ (isoWhiskerRight eB.counitIso.symm _)\n _ \u2245 (F \u22d9 eB.inverse \u22d9 eB.functor) \u22d9 e'.inverse \u22d9 eA.inverse := (associator _ _ _).symm\n _ \u2245 ((F \u22d9 eB.inverse) \u22d9 eB.functor) \u22d9 e'.inverse \u22d9 eA.inverse :=\n isoWhiskerRight (associator _ _ _).symm _\n _ \u2245 (F \u22d9 eB.inverse) \u22d9 eB.functor \u22d9 e'.inverse \u22d9 eA.inverse := associator _ _ _\n _ \u2245 (F \u22d9 eB.inverse) \u22d9 (eB.functor \u22d9 e'.inverse) \u22d9 eA.inverse :=\n isoWhiskerLeft _ (associator _ _ _).symm\n _ \u2245 (F \u22d9 eB.inverse) \u22d9 (G \u22d9 eA.functor) \u22d9 eA.inverse :=\n isoWhiskerLeft _ (isoWhiskerRight hG _)\n _ \u2245 ((F \u22d9 eB.inverse) \u22d9 G \u22d9 eA.functor) \u22d9 eA.inverse := (associator _ _ _).symm\n _ \u2245 (((F \u22d9 eB.inverse) \u22d9 G) \u22d9 eA.functor) \u22d9 eA.inverse :=\n isoWhiskerRight (associator _ _ _).symm _\n _ \u2245 ((F \u22d9 eB.inverse) \u22d9 G) \u22d9 eA.functor \u22d9 eA.inverse := associator _ _ _\n _ \u2245 ((F \u22d9 eB.inverse) \u22d9 G) \u22d9 \ud835\udfed A := isoWhiskerLeft _ eA.unitIso.symm\n _ \u2245 (F \u22d9 eB.inverse) \u22d9 G := rightUnitor _\n\nvariable {\u03b5 hF hG}\n```\n\n-- snippet 32\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2082UnitIso (L138-L151)\ndef equivalence\u2082UnitIso : \ud835\udfed A \u2245 (F \u22d9 eB.inverse) \u22d9 eB.functor \u22d9 e'.inverse \u22d9 eA.inverse :=\ncalc\n \ud835\udfed A \u2245 F \u22d9 e'.inverse \u22d9 eA.inverse := equivalence\u2081UnitIso hF\n _ \u2245 F \u22d9 \ud835\udfed B' \u22d9 e'.inverse \u22d9 eA.inverse :=\n isoWhiskerLeft _ (leftUnitor _).symm\n _ \u2245 F \u22d9 (eB.inverse \u22d9 eB.functor) \u22d9 e'.inverse \u22d9 eA.inverse :=\n isoWhiskerLeft _ (isoWhiskerRight eB.counitIso.symm _)\n _ \u2245 (F \u22d9 eB.inverse \u22d9 eB.functor) \u22d9 e'.inverse \u22d9 eA.inverse :=\n (associator _ _ _).symm\n _ \u2245 ((F \u22d9 eB.inverse) \u22d9 eB.functor) \u22d9 e'.inverse \u22d9 eA.inverse :=\n isoWhiskerRight (associator _ _ _).symm _\n _ \u2245 (F \u22d9 eB.inverse) \u22d9 eB.functor \u22d9 e'.inverse \u22d9 eA.inverse :=\n associator _ _ _\n```\n\n-- snippet 33\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081_inverse (L70-L73)\ntheorem equivalence\u2081_inverse : (equivalence\u2081 hF).inverse = e'.inverse \u22d9 eA.inverse :=\nrfl\n\n/-- The counit isomorphism of the equivalence `equivalence\u2081` between `A` and `B'`. -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2082UnitIso_eq (L152-L159)\ntheorem equivalence\u2082UnitIso_eq : (equivalence\u2082 eB hF).unitIso = equivalence\u2082UnitIso eB hF := by\next X\n simp [equivalence\u2082, equivalence\u2081]\n\nvariable {eB}\n\n/-- The equivalence `A \u224c B` whose functor is `F \u22d9 eB.inverse` and\nwhose inverse functor is `G : B \u2964 A`. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.\u03c4\u2080 (L176-L184)\ndef \u03c4\u2080 : eB.functor \u22d9 e'.inverse \u22d9 e'.functor \u2245 eB.functor :=\ncalc\n eB.functor \u22d9 e'.inverse \u22d9 e'.functor \u2245 eB.functor \u22d9 \ud835\udfed _ := isoWhiskerLeft _ e'.counitIso\n _ \u2245 eB.functor := Functor.rightUnitor _\n\n/-- The isomorphism `eB.functor \u22d9 e'.inverse \u22d9 e'.functor \u2245 eB.functor` deduced\nfrom the isomorphisms `hF : eA.functor \u22d9 e'.functor \u2245 F`,\n`hG : eB.functor \u22d9 e'.inverse \u2245 G \u22d9 eA.functor` and the datum of\nan isomorphism `\u03b7 : G \u22d9 F \u2245 eB.functor`. -/\n```\n\n-- snippet 36\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2082CounitIso (L119-L130)\ndef equivalence\u2082CounitIso : (eB.functor \u22d9 e'.inverse \u22d9 eA.inverse) \u22d9 F \u22d9 eB.inverse \u2245 \ud835\udfed B :=\ncalc\n (eB.functor \u22d9 e'.inverse \u22d9 eA.inverse) \u22d9 F \u22d9 eB.inverse\n \u2245 eB.functor \u22d9 (e'.inverse \u22d9 eA.inverse) \u22d9 F \u22d9 eB.inverse := associator _ _ _\n _ \u2245 eB.functor \u22d9 ((e'.inverse \u22d9 eA.inverse) \u22d9 F) \u22d9 eB.inverse :=\n isoWhiskerLeft _ (associator _ _ _).symm\n _ \u2245 eB.functor \u22d9 \ud835\udfed _ \u22d9 eB.inverse :=\n isoWhiskerLeft _ (isoWhiskerRight (equivalence\u2081CounitIso hF) _)\n _ \u2245 eB.functor \u22d9 eB.inverse := isoWhiskerLeft _ (leftUnitor _)\n _ \u2245 \ud835\udfed B := eB.unitIso.symm\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 37\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalenceUnitIso_eq (L265-L277)\ntheorem equivalenceUnitIso_eq (h\u03b5 : \u03c5 hF = \u03b5) :\n (equivalence hF hG).unitIso = equivalenceUnitIso hG \u03b5 := by\next1; apply NatTrans.ext; ext X\n dsimp [equivalence]\n simp only [assoc, comp_id, equivalenceUnitIso_hom_app, equivalence\u2082_inverse, Functor.comp_obj,\n id_comp, equivalence\u2082UnitIso_eq eB hF, equivalence\u2082UnitIso_hom_app,\n \u2190 eA.inverse.map_comp_assoc, assoc, \u2190 h\u03b5, \u03c5_hom_app]\n\nend Compatibility\n\nend DoldKan\n\nend AlgebraicTopology\n```\n\n-- snippet 38\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence_functor (L170-L174)\ntheorem equivalence_functor : (equivalence hF hG).functor = F \u22d9 eB.inverse :=\nrfl\n\n/-- The isomorphism `eB.functor \u22d9 e'.inverse \u22d9 e'.functor \u2245 eB.functor` deduced\nfrom the counit isomorphism of `e'`. -/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2082 (L110-L112)\ndef equivalence\u2082 : A \u224c B :=\n(equivalence\u2081 hF).trans eB.symm\n```\n\n-- snippet 40\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalenceCounitIso_eq (L208-L227)\ntheorem equivalenceCounitIso_eq (h\u03b7 : \u03c4\u2080 = \u03c4\u2081 hF hG \u03b7) :\n (equivalence hF hG).counitIso = equivalenceCounitIso \u03b7 := by\next1; apply NatTrans.ext; ext Y\n dsimp [equivalence]\n simp only [comp_id, id_comp, Functor.map_comp, equivalence\u2082CounitIso_eq,\n equivalence\u2082CounitIso_hom_app, assoc, equivalenceCounitIso_hom_app]\n simp only [equivalence\u2082_inverse, comp_obj, \u2190 \u03c4\u2080_hom_app, h\u03b7, \u03c4\u2081_hom_app, \u2190\n eB.inverse.map_comp_assoc]\n rw [hF.inv.naturality_assoc, hF.inv.naturality_assoc]\n congr 2\n simp only [\u2190 e'.functor.map_comp_assoc]\n simp only [Functor.comp_map, Equivalence.fun_inv_map, comp_obj, id_obj, map_comp, assoc]\n simp only [\u2190 e'.functor.map_comp_assoc]\n simp only [Iso.inv_hom_id_app_assoc, Iso.inv_hom_id_app, comp_obj, comp_id,\n Equivalence.functor_unit_comp, map_id, id_comp]\n\nvariable (hF)\n\n/-- The isomorphism `eA.functor \u2245 F \u22d9 e'.inverse` deduced from the\nunit isomorphism of `e'` and the isomorphism `hF : eA.functor \u22d9 e'.functor \u2245 F`. -/\n```\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.DoldKan.Projections).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem Q_zero : (Q 0 : K[X] \u27f6 _) = 0\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.P_zero (L54-L54)\nlemma P_zero : (P 0 : K[X] \u27f6 K[X]) = \ud835\udfd9 _ := rfl\n```\n\n-- snippet 2\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.P_succ (L55-L57)\nlemma P_succ (q : \u2115) : (P (q + 1) : K[X] \u27f6 K[X]) = P q \u226b (\ud835\udfd9 _ + H\u03c3 q) := rfl\n/-- All the `P q` coincide with `\ud835\udfd9 _` in degree 0. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.P_f_0_eq (L59-L66)\ntheorem P_f_0_eq (q : \u2115) : ((P q).f 0 : X _\u298b0\u298c \u27f6 X _\u298b0\u298c) = \ud835\udfd9 _ := by\ninduction q with\n | zero => rfl\n | succ q hq =>\n simp only [P_succ, HomologicalComplex.add_f_apply, HomologicalComplex.comp_f,\n HomologicalComplex.id_f, id_comp, hq, H\u03c3_eq_zero, add_zero]\n\n/-- `Q q` is the complement projection associated to `P q` -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.Q (L67-L69)\ndef Q (q : \u2115) : K[X] \u27f6 K[X] :=\n\ud835\udfd9 _ - P q\n```\n\n-- snippet 5\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.P_add_Q (L70-L73)\ntheorem P_add_Q (q : \u2115) : P q + Q q = \ud835\udfd9 K[X] := by\nrw [Q]\n abel\n```\n\n-- snippet 6\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.P_add_Q_f (L74-L76)\ntheorem P_add_Q_f (q n : \u2115) : (P q).f n + (Q q).f n = \ud835\udfd9 (X _\u298bn\u298c) :=\nHomologicalComplex.congr_hom (P_add_Q q) n\n```\n\n-- snippet 7\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.Q_succ (L81-L85)\ntheorem Q_succ (q : \u2115) : (Q (q + 1) : K[X] \u27f6 _) = Q q - P q \u226b H\u03c3 q := by\nsimp only [Q, P_succ, comp_add, comp_id]\n abel\n\n/-- All the `Q q` coincide with `0` in degree 0. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.Q_f_0_eq (L87-L93)\ntheorem Q_f_0_eq (q : \u2115) : ((Q q).f 0 : X _\u298b0\u298c \u27f6 X _\u298b0\u298c) = 0 := by\nsimp only [HomologicalComplex.sub_f_apply, HomologicalComplex.id_f, Q, P_f_0_eq, sub_self]\n\nnamespace HigherFacesVanish\n\n/-- This lemma expresses the vanishing of\n`(P q).f (n+1) \u226b X.\u03b4 k : X _\u298bn+1\u298c \u27f6 X _\u298bn\u298c` when `k\u22600` and `k\u2265n-q+2` -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.of_P (L94-L100)\ntheorem of_P : \u2200 q n : \u2115, HigherFacesVanish q ((P q).f (n + 1) : X _\u298bn + 1\u298c \u27f6 X _\u298bn + 1\u298c)\n | 0 => fun n j hj\u2081 => by lia\n | q + 1 => fun n => by\n simp only [P_succ]\n exact (of_P q n).induction\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 10\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.comp_P_eq_self (L102-L123)\ntheorem comp_P_eq_self {Y : C} {n q : \u2115} {\u03c6 : Y \u27f6 X _\u298bn + 1\u298c} (v : HigherFacesVanish q \u03c6) :\n \u03c6 \u226b (P q).f (n + 1) = \u03c6 := by\ninduction q with\n | zero =>\n simp only [P_zero]\n apply comp_id\n | succ q hq =>\n simp only [P_succ, comp_add, HomologicalComplex.comp_f, HomologicalComplex.add_f_apply,\n comp_id, \u2190 assoc, hq v.of_succ, add_eq_left]\n by_cases! hqn : n < q\n \u00b7 exact v.of_succ.comp_H\u03c3_eq_zero hqn\n \u00b7 obtain \u27e8a, ha\u27e9 := Nat.le.dest hqn\n have hnaq : n = a + q := by lia\n simp only [v.of_succ.comp_H\u03c3_eq hnaq, neg_eq_zero, \u2190 assoc]\n have eq := v \u27e8a, by lia\u27e9 (by\n simp only [hnaq, add_assoc]\n rfl)\n simp only [Fin.succ_mk] at eq\n simp only [eq, zero_comp]\n\nend HigherFacesVanish\n```\n\n-- snippet 11\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.comp_P_eq_self_iff (L124-L132)\ntheorem comp_P_eq_self_iff {Y : C} {n q : \u2115} {\u03c6 : Y \u27f6 X _\u298bn + 1\u298c} :\n \u03c6 \u226b (P q).f (n + 1) = \u03c6 \u2194 HigherFacesVanish q \u03c6 := by\nconstructor\n \u00b7 intro h\u03c6\n rw [\u2190 h\u03c6]\n apply HigherFacesVanish.of_comp\n apply HigherFacesVanish.of_P\n \u00b7 exact HigherFacesVanish.comp_P_eq_self\n```\n\n-- snippet 12\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.P_f_idem (L134-L138)\ntheorem P_f_idem (q n : \u2115) : ((P q).f n : X _\u298bn\u298c \u27f6 _) \u226b (P q).f n = (P q).f n := by\nrcases n with (_ | n)\n \u00b7 rw [P_f_0_eq q, comp_id]\n \u00b7 exact (HigherFacesVanish.of_P q n).comp_P_eq_self\n```\n\n-- snippet 13\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.Q_f_idem (L140-L142)\ntheorem Q_f_idem (q n : \u2115) : ((Q q).f n : X _\u298bn\u298c \u27f6 _) \u226b (Q q).f n = (Q q).f n :=\nidem_of_id_sub_idem _ (P_f_idem q n)\n```\n\n-- snippet 14\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.P_idem (L144-L147)\ntheorem P_idem (q : \u2115) : (P q : K[X] \u27f6 K[X]) \u226b P q = P q := by\next n\n exact P_f_idem q n\n```\n\n-- snippet 15\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Projections.Q_idem (L149-L154)\ntheorem Q_idem (q : \u2115) : (Q q : K[X] \u27f6 K[X]) \u226b Q q = Q q := by\next n\n exact Q_f_idem q n\n\nset_option backward.isDefEq.respectTransparency false in\n/-- For each `q`, `P q` is a natural transformation. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.\u03c4\u2081 (L186-L197)\ndef \u03c4\u2081 (\u03b7 : G \u22d9 F \u2245 eB.functor) : eB.functor \u22d9 e'.inverse \u22d9 e'.functor \u2245 eB.functor :=\ncalc\n eB.functor \u22d9 e'.inverse \u22d9 e'.functor \u2245 (eB.functor \u22d9 e'.inverse) \u22d9 e'.functor :=\n (associator _ _ _).symm\n _ \u2245 (G \u22d9 eA.functor) \u22d9 e'.functor := isoWhiskerRight hG _\n _ \u2245 G \u22d9 eA.functor \u22d9 e'.functor := associator _ _ _\n _ \u2245 G \u22d9 F := isoWhiskerLeft _ hF\n _ \u2245 eB.functor := \u03b7\n\nvariable (\u03b7 : G \u22d9 F \u2245 eB.functor)\n\n/-- The counit isomorphism of `equivalence`. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2082CounitIso_eq (L131-L136)\ntheorem equivalence\u2082CounitIso_eq :\n (equivalence\u2082 eB hF).counitIso = equivalence\u2082CounitIso eB hF := by\next Y'\n simp [equivalence\u2082, equivalence\u2081CounitIso_eq]\n\n/-- The unit isomorphism of the equivalence `equivalence\u2082` between `A` and `B`. -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2080 (L60-L66)\ndef equivalence\u2080 : A \u224c B' :=\neA.trans e'\n\nvariable {eA} {e'}\n\n/-- An intermediate equivalence `A \u224c B'` whose functor is `F` and whose inverse is\n`e'.inverse \u22d9 eA.inverse`. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081UnitIso (L92-L102)\ndef equivalence\u2081UnitIso : \ud835\udfed A \u2245 F \u22d9 e'.inverse \u22d9 eA.inverse :=\ncalc\n \ud835\udfed A \u2245 eA.functor \u22d9 eA.inverse := eA.unitIso\n _ \u2245 eA.functor \u22d9 \ud835\udfed A' \u22d9 eA.inverse := isoWhiskerLeft _ (leftUnitor _).symm\n _ \u2245 eA.functor \u22d9 (e'.functor \u22d9 e'.inverse) \u22d9 eA.inverse :=\n isoWhiskerLeft _ (isoWhiskerRight e'.unitIso _)\n _ \u2245 eA.functor \u22d9 (e'.functor \u22d9 e'.inverse \u22d9 eA.inverse) :=\n isoWhiskerLeft _ (associator _ _ _)\n _ \u2245 (eA.functor \u22d9 e'.functor) \u22d9 e'.inverse \u22d9 eA.inverse := (associator _ _ _).symm\n _ \u2245 F \u22d9 e'.inverse \u22d9 eA.inverse := isoWhiskerRight hF _\n```\n\n-- snippet 20\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.\u03c5 (L229-L238)\ndef \u03c5 : eA.functor \u2245 F \u22d9 e'.inverse :=\ncalc\n eA.functor \u2245 eA.functor \u22d9 \ud835\udfed A' := (rightUnitor _).symm\n _ \u2245 eA.functor \u22d9 e'.functor \u22d9 e'.inverse := isoWhiskerLeft _ e'.unitIso\n _ \u2245 (eA.functor \u22d9 e'.functor) \u22d9 e'.inverse := (associator _ _ _).symm\n _ \u2245 F \u22d9 e'.inverse := isoWhiskerRight hF _\n\nvariable (\u03b5 : eA.functor \u2245 F \u22d9 e'.inverse) (hG)\n\n/-- The unit isomorphism of `equivalence`. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence (L161-L169)\ndef equivalence : A \u224c B :=\n((equivalence\u2082 eB hF).changeInverse\n (calc eB.functor \u22d9 e'.inverse \u22d9 eA.inverse \u2245\n (eB.functor \u22d9 e'.inverse) \u22d9 eA.inverse := (associator _ _ _).symm\n _ \u2245 (G \u22d9 eA.functor) \u22d9 eA.inverse := isoWhiskerRight hG _\n _ \u2245 G \u22d9 eA.functor \u22d9 eA.inverse := associator _ _ _\n _ \u2245 G \u22d9 \ud835\udfed A := isoWhiskerLeft _ eA.unitIso.symm\n _ \u2245 G := G.rightUnitor))\n```\n\n-- snippet 22\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081CounitIso (L75-L85)\ndef equivalence\u2081CounitIso : (e'.inverse \u22d9 eA.inverse) \u22d9 F \u2245 \ud835\udfed B' :=\ncalc\n (e'.inverse \u22d9 eA.inverse) \u22d9 F \u2245 (e'.inverse \u22d9 eA.inverse) \u22d9 eA.functor \u22d9 e'.functor :=\n isoWhiskerLeft _ hF.symm\n _ \u2245 e'.inverse \u22d9 (eA.inverse \u22d9 eA.functor \u22d9 e'.functor) := associator _ _ _\n _ \u2245 e'.inverse \u22d9 (eA.inverse \u22d9 eA.functor) \u22d9 e'.functor :=\n isoWhiskerLeft _ (associator _ _ _).symm\n _ \u2245 e'.inverse \u22d9 \ud835\udfed _ \u22d9 e'.functor := isoWhiskerLeft _ (isoWhiskerRight eA.counitIso _)\n _ \u2245 e'.inverse \u22d9 e'.functor := isoWhiskerLeft _ (leftUnitor _)\n _ \u2245 \ud835\udfed B' := e'.counitIso\n```\n\n-- snippet 23\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081UnitIso_eq (L103-L108)\ntheorem equivalence\u2081UnitIso_eq : (equivalence\u2081 hF).unitIso = equivalence\u2081UnitIso hF := by\next X\n simp [equivalence\u2081]\n\n/-- An intermediate equivalence `A \u224c B` obtained as the composition of `equivalence\u2081` and\nthe inverse of `eB : B \u224c B'`. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081 (L68-L69)\ndef equivalence\u2081 : A \u224c B' := (equivalence\u2080 eA e').changeFunctor hF\n```\n\n-- snippet 25\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081CounitIso_eq (L86-L90)\ntheorem equivalence\u2081CounitIso_eq : (equivalence\u2081 hF).counitIso = equivalence\u2081CounitIso hF := by\next Y\n simp [equivalence\u2081, equivalence\u2080]\n\n/-- The unit isomorphism of the equivalence `equivalence\u2081` between `A` and `B'`. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalenceCounitIso (L199-L207)\ndef equivalenceCounitIso : G \u22d9 F \u22d9 eB.inverse \u2245 \ud835\udfed B :=\ncalc\n G \u22d9 F \u22d9 eB.inverse \u2245 (G \u22d9 F) \u22d9 eB.inverse := (associator _ _ _).symm\n _ \u2245 eB.functor \u22d9 eB.inverse := isoWhiskerRight \u03b7 _\n _ \u2245 \ud835\udfed B := eB.unitIso.symm\n\nvariable {\u03b7 hF hG}\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 27\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Decomposition.id (L109-L113)\ndef id : MorphComponents X n (X _\u298bn + 1\u298c) where\n a := PInfty.f (n + 1)\nb i := X.\u03c3 i\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 28\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Decomposition.\u03c6 (L100-L107)\ndef \u03c6 {Z : C} (f : MorphComponents X n Z) : X _\u298bn + 1\u298c \u27f6 Z :=\nPInfty.f (n + 1) \u226b f.a + \u2211 i : Fin (n + 1), (P i).f (n + 1) \u226b X.\u03b4 i.rev.succ \u226b\n f.b (Fin.rev i)\n\nvariable (X n)\n\n/-- the canonical `MorphComponents` whose associated morphism is the identity\n(see `F_id`) thanks to `decomposition_Q n (n+1)` -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2082_inverse (L113-L117)\ntheorem equivalence\u2082_inverse :\n (equivalence\u2082 eB hF).inverse = eB.functor \u22d9 e'.inverse \u22d9 eA.inverse :=\nrfl\n\n/-- The counit isomorphism of the equivalence `equivalence\u2082` between `A` and `B`. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Decomposition.decomposition_Q (L55-L89)\ntheorem decomposition_Q (n q : \u2115) :\n ((Q q).f (n + 1) : X _\u298bn + 1\u298c \u27f6 X _\u298bn + 1\u298c) =\n \u2211 i : Fin (n + 1) with i.val < q, (P i).f (n + 1) \u226b X.\u03b4 i.rev.succ \u226b X.\u03c3 (Fin.rev i) := by\ninduction q with\n | zero =>\n simp only [Q_zero, HomologicalComplex.zero_f_apply, Nat.not_lt_zero,\n Finset.filter_false, Finset.sum_empty]\n | succ q hq =>\n by_cases! hqn : n < q\n \u00b7 rw [Q_is_eventually_constant (show n + 1 \u2264 q by lia), hq]\n congr 1\n ext \u27e8x, hx\u27e9\n simp_rw [Finset.mem_filter_univ]\n lia\n \u00b7 obtain \u27e8a, ha\u27e9 := Nat.le.dest hqn\n rw [Q_succ, HomologicalComplex.sub_f_apply, HomologicalComplex.comp_f, hq]\n symm\n conv_rhs => rw [sub_eq_add_neg, add_comm]\n let q' : Fin (n + 1) := \u27e8q, Nat.lt_succ_of_le hqn\u27e9\n rw [\u2190 @Finset.add_sum_erase _ _ _ _ _ _ q' (by simp [q'])]\n congr\n \u00b7 have hnaq' : n = a + q := by lia\n simp only [(HigherFacesVanish.of_P q n).comp_H\u03c3_eq hnaq', q'.rev_eq hnaq', neg_neg]\n rfl\n \u00b7 ext \u27e8i, hi\u27e9\n simp_rw [Finset.mem_erase, Finset.mem_filter_univ, q', ne_eq, Fin.mk.injEq]\n lia\n\nvariable (X)\n\n/-- The structure `MorphComponents` is an ad hoc structure that is used in\nthe proof that `N\u2081 : SimplicialObject C \u2964 Karoubi (ChainComplex C \u2115))`\nreflects isomorphisms. The fields are the data that are needed in order to\nconstruct a morphism `X _\u298bn+1\u298c \u27f6 Z` (see `\u03c6`) using the decomposition of the\nidentity given by `decomposition_Q n (n+1)`. -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalenceUnitIso (L240-L264)\ndef equivalenceUnitIso : \ud835\udfed A \u2245 (F \u22d9 eB.inverse) \u22d9 G :=\ncalc\n \ud835\udfed A \u2245 eA.functor \u22d9 eA.inverse := eA.unitIso\n _ \u2245 (F \u22d9 e'.inverse) \u22d9 eA.inverse := isoWhiskerRight \u03b5 _\n _ \u2245 F \u22d9 e'.inverse \u22d9 eA.inverse := associator _ _ _\n _ \u2245 F \u22d9 \ud835\udfed B' \u22d9 e'.inverse \u22d9 eA.inverse := isoWhiskerLeft _ (leftUnitor _).symm\n _ \u2245 F \u22d9 (eB.inverse \u22d9 eB.functor) \u22d9 e'.inverse \u22d9 eA.inverse :=\n isoWhiskerLeft _ (isoWhiskerRight eB.counitIso.symm _)\n _ \u2245 (F \u22d9 eB.inverse \u22d9 eB.functor) \u22d9 e'.inverse \u22d9 eA.inverse := (associator _ _ _).symm\n _ \u2245 ((F \u22d9 eB.inverse) \u22d9 eB.functor) \u22d9 e'.inverse \u22d9 eA.inverse :=\n isoWhiskerRight (associator _ _ _).symm _\n _ \u2245 (F \u22d9 eB.inverse) \u22d9 eB.functor \u22d9 e'.inverse \u22d9 eA.inverse := associator _ _ _\n _ \u2245 (F \u22d9 eB.inverse) \u22d9 (eB.functor \u22d9 e'.inverse) \u22d9 eA.inverse :=\n isoWhiskerLeft _ (associator _ _ _).symm\n _ \u2245 (F \u22d9 eB.inverse) \u22d9 (G \u22d9 eA.functor) \u22d9 eA.inverse :=\n isoWhiskerLeft _ (isoWhiskerRight hG _)\n _ \u2245 ((F \u22d9 eB.inverse) \u22d9 G \u22d9 eA.functor) \u22d9 eA.inverse := (associator _ _ _).symm\n _ \u2245 (((F \u22d9 eB.inverse) \u22d9 G) \u22d9 eA.functor) \u22d9 eA.inverse :=\n isoWhiskerRight (associator _ _ _).symm _\n _ \u2245 ((F \u22d9 eB.inverse) \u22d9 G) \u22d9 eA.functor \u22d9 eA.inverse := associator _ _ _\n _ \u2245 ((F \u22d9 eB.inverse) \u22d9 G) \u22d9 \ud835\udfed A := isoWhiskerLeft _ eA.unitIso.symm\n _ \u2245 (F \u22d9 eB.inverse) \u22d9 G := rightUnitor _\n\nvariable {\u03b5 hF hG}\n```\n\n-- snippet 32\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2082UnitIso (L138-L151)\ndef equivalence\u2082UnitIso : \ud835\udfed A \u2245 (F \u22d9 eB.inverse) \u22d9 eB.functor \u22d9 e'.inverse \u22d9 eA.inverse :=\ncalc\n \ud835\udfed A \u2245 F \u22d9 e'.inverse \u22d9 eA.inverse := equivalence\u2081UnitIso hF\n _ \u2245 F \u22d9 \ud835\udfed B' \u22d9 e'.inverse \u22d9 eA.inverse :=\n isoWhiskerLeft _ (leftUnitor _).symm\n _ \u2245 F \u22d9 (eB.inverse \u22d9 eB.functor) \u22d9 e'.inverse \u22d9 eA.inverse :=\n isoWhiskerLeft _ (isoWhiskerRight eB.counitIso.symm _)\n _ \u2245 (F \u22d9 eB.inverse \u22d9 eB.functor) \u22d9 e'.inverse \u22d9 eA.inverse :=\n (associator _ _ _).symm\n _ \u2245 ((F \u22d9 eB.inverse) \u22d9 eB.functor) \u22d9 e'.inverse \u22d9 eA.inverse :=\n isoWhiskerRight (associator _ _ _).symm _\n _ \u2245 (F \u22d9 eB.inverse) \u22d9 eB.functor \u22d9 e'.inverse \u22d9 eA.inverse :=\n associator _ _ _\n```\n\n-- snippet 33\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081_inverse (L70-L73)\ntheorem equivalence\u2081_inverse : (equivalence\u2081 hF).inverse = e'.inverse \u22d9 eA.inverse :=\nrfl\n\n/-- The counit isomorphism of the equivalence `equivalence\u2081` between `A` and `B'`. -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2082UnitIso_eq (L152-L159)\ntheorem equivalence\u2082UnitIso_eq : (equivalence\u2082 eB hF).unitIso = equivalence\u2082UnitIso eB hF := by\next X\n simp [equivalence\u2082, equivalence\u2081]\n\nvariable {eB}\n\n/-- The equivalence `A \u224c B` whose functor is `F \u22d9 eB.inverse` and\nwhose inverse functor is `G : B \u2964 A`. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.\u03c4\u2080 (L176-L184)\ndef \u03c4\u2080 : eB.functor \u22d9 e'.inverse \u22d9 e'.functor \u2245 eB.functor :=\ncalc\n eB.functor \u22d9 e'.inverse \u22d9 e'.functor \u2245 eB.functor \u22d9 \ud835\udfed _ := isoWhiskerLeft _ e'.counitIso\n _ \u2245 eB.functor := Functor.rightUnitor _\n\n/-- The isomorphism `eB.functor \u22d9 e'.inverse \u22d9 e'.functor \u2245 eB.functor` deduced\nfrom the isomorphisms `hF : eA.functor \u22d9 e'.functor \u2245 F`,\n`hG : eB.functor \u22d9 e'.inverse \u2245 G \u22d9 eA.functor` and the datum of\nan isomorphism `\u03b7 : G \u22d9 F \u2245 eB.functor`. -/\n```\n\n-- snippet 36\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2082CounitIso (L119-L130)\ndef equivalence\u2082CounitIso : (eB.functor \u22d9 e'.inverse \u22d9 eA.inverse) \u22d9 F \u22d9 eB.inverse \u2245 \ud835\udfed B :=\ncalc\n (eB.functor \u22d9 e'.inverse \u22d9 eA.inverse) \u22d9 F \u22d9 eB.inverse\n \u2245 eB.functor \u22d9 (e'.inverse \u22d9 eA.inverse) \u22d9 F \u22d9 eB.inverse := associator _ _ _\n _ \u2245 eB.functor \u22d9 ((e'.inverse \u22d9 eA.inverse) \u22d9 F) \u22d9 eB.inverse :=\n isoWhiskerLeft _ (associator _ _ _).symm\n _ \u2245 eB.functor \u22d9 \ud835\udfed _ \u22d9 eB.inverse :=\n isoWhiskerLeft _ (isoWhiskerRight (equivalence\u2081CounitIso hF) _)\n _ \u2245 eB.functor \u22d9 eB.inverse := isoWhiskerLeft _ (leftUnitor _)\n _ \u2245 \ud835\udfed B := eB.unitIso.symm\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 37\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalenceUnitIso_eq (L265-L277)\ntheorem equivalenceUnitIso_eq (h\u03b5 : \u03c5 hF = \u03b5) :\n (equivalence hF hG).unitIso = equivalenceUnitIso hG \u03b5 := by\next1; apply NatTrans.ext; ext X\n dsimp [equivalence]\n simp only [assoc, comp_id, equivalenceUnitIso_hom_app, equivalence\u2082_inverse, Functor.comp_obj,\n id_comp, equivalence\u2082UnitIso_eq eB hF, equivalence\u2082UnitIso_hom_app,\n \u2190 eA.inverse.map_comp_assoc, assoc, \u2190 h\u03b5, \u03c5_hom_app]\n\nend Compatibility\n\nend DoldKan\n\nend AlgebraicTopology\n```\n\n-- snippet 38\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence_functor (L170-L174)\ntheorem equivalence_functor : (equivalence hF hG).functor = F \u22d9 eB.inverse :=\nrfl\n\n/-- The isomorphism `eB.functor \u22d9 e'.inverse \u22d9 e'.functor \u2245 eB.functor` deduced\nfrom the counit isomorphism of `e'`. -/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2082 (L110-L112)\ndef equivalence\u2082 : A \u224c B :=\n(equivalence\u2081 hF).trans eB.symm\n```\n\n-- snippet 40\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalenceCounitIso_eq (L208-L227)\ntheorem equivalenceCounitIso_eq (h\u03b7 : \u03c4\u2080 = \u03c4\u2081 hF hG \u03b7) :\n (equivalence hF hG).counitIso = equivalenceCounitIso \u03b7 := by\next1; apply NatTrans.ext; ext Y\n dsimp [equivalence]\n simp only [comp_id, id_comp, Functor.map_comp, equivalence\u2082CounitIso_eq,\n equivalence\u2082CounitIso_hom_app, assoc, equivalenceCounitIso_hom_app]\n simp only [equivalence\u2082_inverse, comp_obj, \u2190 \u03c4\u2080_hom_app, h\u03b7, \u03c4\u2081_hom_app, \u2190\n eB.inverse.map_comp_assoc]\n rw [hF.inv.naturality_assoc, hF.inv.naturality_assoc]\n congr 2\n simp only [\u2190 e'.functor.map_comp_assoc]\n simp only [Functor.comp_map, Equivalence.fun_inv_map, comp_obj, id_obj, map_comp, assoc]\n simp only [\u2190 e'.functor.map_comp_assoc]\n simp only [Iso.inv_hom_id_app_assoc, Iso.inv_hom_id_app, comp_obj, comp_id,\n Equivalence.functor_unit_comp, map_id, id_comp]\n\nvariable (hF)\n\n/-- The isomorphism `eA.functor \u2245 F \u22d9 e'.inverse` deduced from the\nunit isomorphism of `e'` and the isomorphism `hF : eA.functor \u22d9 e'.functor \u2245 F`. -/\n```\n[/INST]", "sample_id": "C-Mathlib.AlgebraicTopology.DoldKan.Projections.Q_zero", "source": {"declaration": "Mathlib.AlgebraicTopology.DoldKan.Projections.Q_zero", "file": "Mathlib/AlgebraicTopology/DoldKan/Projections.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.DoldKan.Projections", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/DoldKan/Projections.lean#L78", "span": "L78-L80"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"trace_states": [{"state": "theorem eq_\u03c3_comp_of_not_injective {n : \u2115} {\u0394' : SimplexCategory} (\u03b8 : \u298bn + 1\u298c \u27f6 \u0394')\n (h\u03b8 : \u00acFunction.Injective \u03b8.toOrderHom) :\n \u2203 (i : Fin (n + 1)) (\u03b8' : \u298bn\u298c \u27f6 \u0394'), \u03b8 = \u03c3 i \u226b \u03b8'", "tactic": "simp only [Function.Injective, exists_prop, not_forall] at h\u03b8 -- as \u03b8 is not injective, there exists `x", "tactic": "have h\u03b8\u2082 : \u2203 x y : Fin (n + 2), (Hom.toOrderHom \u03b8) x = (Hom.toOrderHom \u03b8) y \u2227 x < y := by rcases h\u03b8 with \u27e8x, y, \u27e8h\u2081, h\u2082\u27e9\u27e9 by_cases h : x < y \u00b7 exact \u27e8x, y, \u27e8h\u2081, h\u27e9\u27e9 \u00b7 refine \u27e8y, x, \u27e8h\u2081.symm, ?_\u27e9\u27e9 lia rcases h\u03b8\u2082 with \u27e8x, y, \u27e8h\u2081, h\u2082\u27e9\u27e9"}, {"state": "", "tactic": "use x.castPred ((Fin.le_last _).trans_lt' h\u2082).ne"}, {"state": "", "tactic": "apply eq_\u03c3_comp_of_not_injective'"}, {"state": "", "tactic": "apply le_antisymm \u00b7 exact \u03b8.toOrderHom.monotone (le_of_lt Fin.castSucc_lt_succ) \u00b7 rw [Fin.castSucc_castPred, h\u2081]"}, {"state": "", "tactic": "exact \u03b8.toOrderHom.monotone ((Fin.succ_castPred_le_iff _).mpr h\u2082)"}], "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1931, "declarations_count": 232, "diagnostics_count": 0, "duplicate_fingerprint": "f3ef1ed5a7a2e10f", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 744, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "short", "line_count": 21, "natural_language_chars": 1931, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplexCategory.Basic).", "role": "system"}, {"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.AlgebraicTopology.SimplexCategory.Basic.eq_\u03c3_comp_of_not_injective`:\nState 0: \u22a2 theorem eq_\u03c3_comp_of_not_injective {n : \u2115} {\u0394' : SimplexCategory} (\u03b8 : \u298bn + 1\u298c \u27f6 \u0394')\n (h\u03b8 : \u00acFunction.Injective \u03b8.toOrderHom) :\n \u2203 (i : Fin (n + 1)) (\u03b8' : \u298bn\u298c \u27f6 \u0394'), \u03b8 = \u03c3 i \u226b \u03b8'\nTactic: simp only [Function.Injective, exists_prop, not_forall] at h\u03b8 -- as \u03b8 is not injective, there exists `x\nTactic: have h\u03b8\u2082 : \u2203 x y : Fin (n + 2), (Hom.toOrderHom \u03b8) x = (Hom.toOrderHom \u03b8) y \u2227 x < y := by rcases h\u03b8 with \u27e8x, y, \u27e8h\u2081, h\u2082\u27e9\u27e9 by_cases h : x < y \u00b7 exact \u27e8x, y, \u27e8h\u2081, h\u27e9\u27e9 \u00b7 refine \u27e8y, x, \u27e8h\u2081.symm, ?_\u27e9\u27e9 lia rcases h\u03b8\u2082 with \u27e8x, y, \u27e8h\u2081, h\u2082\u27e9\u27e9\nState 2: \u22a2 \nTactic: use x.castPred ((Fin.le_last _).trans_lt' h\u2082).ne\nState 3: \u22a2 \nTactic: apply eq_\u03c3_comp_of_not_injective'\nState 4: \u22a2 \nTactic: apply le_antisymm \u00b7 exact \u03b8.toOrderHom.monotone (le_of_lt Fin.castSucc_lt_succ) \u00b7 rw [Fin.castSucc_castPred, h\u2081]\nState 5: \u22a2 \nTactic: exact \u03b8.toOrderHom.monotone ((Fin.succ_castPred_le_iff _).mpr h\u2082)\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplexCategory.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.AlgebraicTopology.SimplexCategory.Basic.eq_\u03c3_comp_of_not_injective`:\nState 0: \u22a2 theorem eq_\u03c3_comp_of_not_injective {n : \u2115} {\u0394' : SimplexCategory} (\u03b8 : \u298bn + 1\u298c \u27f6 \u0394')\n (h\u03b8 : \u00acFunction.Injective \u03b8.toOrderHom) :\n \u2203 (i : Fin (n + 1)) (\u03b8' : \u298bn\u298c \u27f6 \u0394'), \u03b8 = \u03c3 i \u226b \u03b8'\nTactic: simp only [Function.Injective, exists_prop, not_forall] at h\u03b8 -- as \u03b8 is not injective, there exists `x\nTactic: have h\u03b8\u2082 : \u2203 x y : Fin (n + 2), (Hom.toOrderHom \u03b8) x = (Hom.toOrderHom \u03b8) y \u2227 x < y := by rcases h\u03b8 with \u27e8x, y, \u27e8h\u2081, h\u2082\u27e9\u27e9 by_cases h : x < y \u00b7 exact \u27e8x, y, \u27e8h\u2081, h\u27e9\u27e9 \u00b7 refine \u27e8y, x, \u27e8h\u2081.symm, ?_\u27e9\u27e9 lia rcases h\u03b8\u2082 with \u27e8x, y, \u27e8h\u2081, h\u2082\u27e9\u27e9\nState 2: \u22a2 \nTactic: use x.castPred ((Fin.le_last _).trans_lt' h\u2082).ne\nState 3: \u22a2 \nTactic: apply eq_\u03c3_comp_of_not_injective'\nState 4: \u22a2 \nTactic: apply le_antisymm \u00b7 exact \u03b8.toOrderHom.monotone (le_of_lt Fin.castSucc_lt_succ) \u00b7 rw [Fin.castSucc_castPred, h\u2081]\nState 5: \u22a2 \nTactic: exact \u03b8.toOrderHom.monotone ((Fin.succ_castPred_le_iff _).mpr h\u2082)\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.AlgebraicTopology.SimplexCategory.Basic.eq_\u03c3_comp_of_not_injective", "source": {"declaration": "Mathlib.AlgebraicTopology.SimplexCategory.Basic.eq_\u03c3_comp_of_not_injective", "file": "Mathlib/AlgebraicTopology/SimplexCategory/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.SimplexCategory.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/SimplexCategory/Basic.lean#L772", "span": "L772-L791"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "def intEquivNatSumNat : \u2124 \u2243 \u2115 \u2295 \u2115 where\n toFun z", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 451, "declarations_count": 51, "diagnostics_count": 0, "duplicate_fingerprint": "7680221d03a597d0", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 137, "lean_code_chars": 50, "lean_code_ratio": 0.1109, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 401, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Equiv.Basic).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ndef intEquivNatSumNat : \u2124 \u2243 \u2115 \u2295 \u2115 where\n toFun z\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Equiv.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ndef intEquivNatSumNat : \u2124 \u2243 \u2115 \u2295 \u2115 where\n toFun z\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Logic.Equiv.Basic.intEquivNatSumNat", "source": {"declaration": "Mathlib.Logic.Equiv.Basic.intEquivNatSumNat", "file": "Mathlib/Logic/Equiv/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Logic.Equiv.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Logic/Equiv/Basic.lean#L232", "span": "L232-L237"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "theorem list_getD (d : \u03b1) : Primrec\u2082 fun l n => List.getD l n d\n frobnicateTacticThatDoesNotExist := by\nsimp only [List.getD_eq_getElem?_getD]\n exact option_getD.comp\u2082 list_getElem? (const _)", "diagnostic": "[CompilationUnit(i_begin=0, i_end=149, messages=[Message(data='Function expected at\\n l.getD n d\\nbut this term has type\\n \u03b1\\n\\nNote: Expected a function because this term is being applied to the argument\\n frobnicateTacticThatDoesNotExist', pos=Position(line=1, column=48), pos_end=Position(line=2, column=34), severity=, kind=None), Message(data='failed to synthesize instance of type class\\n Primcodable (List \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=28), pos_end=Position(line=2, column=34), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='`simp` made no progress', pos=Position(line=3, column=0), pos_end=Position(line=3, column=38), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=149, i_end=198, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=4, column=2), pos_end=Position(line=4, column=7), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]", "mutation_kind": "plausible_wrong_tactic", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1918, "declarations_count": 219, "diagnostics_count": 1, "duplicate_fingerprint": "7590c3e60dcbb02f", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 536, "lean_code_chars": 194, "lean_code_ratio": 0.1011, "length_bucket": "short", "line_count": 15, "natural_language_chars": 1724, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.Primrec.List).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem list_getD (d : \u03b1) : Primrec\u2082 fun l n => List.getD l n d\n frobnicateTacticThatDoesNotExist := by\nsimp only [List.getD_eq_getElem?_getD]\n exact option_getD.comp\u2082 list_getElem? (const _)\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=149, messages=[Message(data='Function expected at\\n l.getD n d\\nbut this term has type\\n \u03b1\\n\\nNote: Expected a function because this term is being applied to the argument\\n frobnicateTacticThatDoesNotExist', pos=Position(line=1, column=48), pos_end=Position(line=2, column=34), severity=, kind=None), Message(data='failed to synthesize instance of type class\\n Primcodable (List \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=28), pos_end=Position(line=2, column=34), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='`simp` made no progress', pos=Position(line=3, column=0), pos_end=Position(line=3, column=38), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=149, i_end=198, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=4, column=2), pos_end=Position(line=4, 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.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.Primrec.List).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem list_getD (d : \u03b1) : Primrec\u2082 fun l n => List.getD l n d\n frobnicateTacticThatDoesNotExist := by\nsimp only [List.getD_eq_getElem?_getD]\n exact option_getD.comp\u2082 list_getElem? (const _)\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=149, messages=[Message(data='Function expected at\\n l.getD n d\\nbut this term has type\\n \u03b1\\n\\nNote: Expected a function because this term is being applied to the argument\\n frobnicateTacticThatDoesNotExist', pos=Position(line=1, column=48), pos_end=Position(line=2, column=34), severity=, kind=None), Message(data='failed to synthesize instance of type class\\n Primcodable (List \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=28), pos_end=Position(line=2, column=34), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='`simp` made no progress', pos=Position(line=3, column=0), pos_end=Position(line=3, column=38), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=149, i_end=198, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=4, column=2), pos_end=Position(line=4, 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]", "sample_id": "B-Mathlib.Computability.Primrec.List.list_getD", "source": {"declaration": "Mathlib.Computability.Primrec.List.list_getD", "file": "Mathlib/Computability/Primrec/List.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Computability.Primrec.List", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Computability/Primrec/List.lean#L212", "span": "L212-L215"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "def tryTheoremWithHint? (e : Expr) (thmOrigin : Origin)\n (hint : Array (Nat \u00d7 Expr))\n (funProp : Expr \u2192 FunPropM (Option Result)) (newMCtxDepth : Bool", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 560, "declarations_count": 63, "diagnostics_count": 0, "duplicate_fingerprint": "5a271e0e74c53f6d", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 161, "lean_code_chars": 157, "lean_code_ratio": 0.2804, "length_bucket": "tiny", "line_count": 9, "natural_language_chars": 403, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.FunProp.Core).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ndef tryTheoremWithHint? (e : Expr) (thmOrigin : Origin)\n (hint : Array (Nat \u00d7 Expr))\n (funProp : Expr \u2192 FunPropM (Option Result)) (newMCtxDepth : Bool\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.FunProp.Core).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ndef tryTheoremWithHint? (e : Expr) (thmOrigin : Origin)\n (hint : Array (Nat \u00d7 Expr))\n (funProp : Expr \u2192 FunPropM (Option Result)) (newMCtxDepth : Bool\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Tactic.FunProp.Core.tryTheoremWithHint", "source": {"declaration": "Mathlib.Tactic.FunProp.Core.tryTheoremWithHint", "file": "Mathlib/Tactic/FunProp/Core.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.FunProp.Core", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/FunProp/Core.lean#L125", "span": "L125-L164"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.Basis (L44-L53)\nabbrev Basis := List (\u211d \u2192 \u211d)\n/-- Multiseries representing a given function `f : \u211d \u2192 \u211d`.\n`MultiseriesExpansion []` is just `\u211d`: multiseries representing constant functions.\nOtherwise it is a pair of a `Multiseries basis_hd basis_tl` and a function `\u211d \u2192 \u211d`. We call\nthe former an expansion of the latter.\n\nNote: most of the theory can be formulated in terms of `Multiseries`, but we need to explicitly\nstore the approximated function to be able to use the eventual zeroness oracle at the trimming step.\n-/", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.MultiseriesExpansion (L54-L71)\ndef MultiseriesExpansion (basis : Basis) : Type :=\nmatch basis with\n | [] => \u211d\n | .cons _ basis_tl => Seq (\u211d \u00d7 MultiseriesExpansion basis_tl) \u00d7 (\u211d \u2192 \u211d)\n\nnamespace MultiseriesExpansion\n\nset_option linter.unusedVariables false in\n/-- Multiseries in a basis `basis_hd :: basis_tl`. It is a generalisation of asymptotic expansions.\nA multiseries in a basis `[b\u2081, ..., b\u2099]` is a formal series made from monomials\n`b\u2081 ^ e\u2081 * ... * b\u2099 ^ e\u2099` where `e\u2081, ..., e\u2099` are real numbers. We treat multivariate series in\na basis `[b\u2081, ..., b\u2099]` as a univariate series in the variable `b\u2081` (`basis_hd`) with coefficients\nbeing multiseries in the basis `[b\u2082, ..., b\u2099]` (`basis_tl`). We represent such a series as a lazy\nlist (`Seq`) of pairs `(exp, coef)` where `exp` is the exponent of `b\u2081` and `coef` is the\ncoefficient (a multiseries in `basis_tl`).\n\n`MultiseriesExpansion` is a `Multiseries` with an attached real function.\n-/", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.Multiseries (L73-L78)\ndef Multiseries (basis_hd : \u211d \u2192 \u211d) (basis_tl : Basis) : Type :=\nSeq (\u211d \u00d7 MultiseriesExpansion basis_tl)\n\nnamespace Multiseries\n\n/-- Converts a `Multiseries basis_hd basis_tl` to a `Seq (\u211d \u00d7 MultiseriesExpansion basis_tl)`. -/", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.toSeq (L79-L83)\ndef toSeq {basis_hd basis_tl} (ms : Multiseries basis_hd basis_tl) :\n Seq (\u211d \u00d7 MultiseriesExpansion basis_tl) :=\nms\n\n/-- The empty multiseries. -/", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.nil (L84-L86)\ndef nil {basis_hd basis_tl} : Multiseries basis_hd basis_tl := Seq.nil\n/-- Prepend a monomial to a multiseries. -/", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.cons (L87-L93)\ndef cons {basis_hd basis_tl} (exp : \u211d) (coef : MultiseriesExpansion basis_tl)\n (tl : Multiseries basis_hd basis_tl) :\n Multiseries basis_hd basis_tl :=\nSeq.cons (exp, coef) tl\n\n/-- Recursion principle for `Multiseries basis_hd basis_tl`. It is equivalent to\n`Stream'.Seq.recOn` but provides some convenience. -/", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.recOn (L95-L101)\ndef recOn {basis_hd basis_tl} {motive : Multiseries basis_hd basis_tl \u2192 Sort*}\n (ms : Multiseries basis_hd basis_tl) (nil : motive nil)\n (cons : \u2200 exp coef (tl : Multiseries basis_hd basis_tl), motive (cons exp coef tl)) :\n motive ms := Stream'.Seq.recOn _ nil fun _ _ \u21a6 cons _ _ _\n/-- Destruct a multiseries into a triple `(exp, coef, tl)`, where `exp` is the leading exponent,\n`coef` is the leading coefficient, and `tl` is the tail. -/", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.destruct (L102-L106)\ndef destruct {basis_hd basis_tl} (ms : Multiseries basis_hd basis_tl) :\n Option (\u211d \u00d7 MultiseriesExpansion basis_tl \u00d7 Multiseries basis_hd basis_tl) :=\n(Seq.destruct ms).map (fun ((exp, coef), tl) => (exp, coef, tl))\n\n/-- The head of a multiseries, i.e. the first two entries of the tuple returned by `destruct`. -/", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.head (L107-L111)\ndef head {basis_hd basis_tl} (ms : Multiseries basis_hd basis_tl) :\n Option (\u211d \u00d7 MultiseriesExpansion basis_tl) :=\nSeq.head ms\n\n/-- The tail of a multiseries, i.e. the last entry of the tuple returned by `destruct`. -/", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.tail (L112-L117)\ndef tail {basis_hd basis_tl} (ms : Multiseries basis_hd basis_tl) : Multiseries basis_hd basis_tl :=\nSeq.tail ms\n\n/-- Given two functions `f : \u211d \u2192 \u211d` and\n`g : MultiseriesExpansion basis_tl \u2192 MultiseriesExpansion basis_tl'`, apply them to exponents and\ncoefficients of a multiseries. -/", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.map (L118-L124)\ndef map {basis_hd basis_tl basis_hd' basis_tl'} (f : \u211d \u2192 \u211d)\n (g : MultiseriesExpansion basis_tl \u2192 MultiseriesExpansion basis_tl')\n (ms : Multiseries basis_hd basis_tl) :\n Multiseries basis_hd' basis_tl' :=\nSeq.map (fun (exp, coef) \u21a6 (f exp, g coef)) ms\n\n/-- Corecursor for `Multiseries basis_hd basis_tl`. -/", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.corec (L125-L136)\ndef corec {\u03b2 : Type*} {basis_hd} {basis_tl}\n (f : \u03b2 \u2192 Option (\u211d \u00d7 MultiseriesExpansion basis_tl \u00d7 \u03b2)) (b : \u03b2) :\n Multiseries basis_hd basis_tl :=\nSeq.corec (fun a => (f a).map (fun (exp, coef, next) => ((exp, coef), next))) b\n\nprivate lemma destruct_eq_destruct_map {basis_hd basis_tl}\n (s : Stream'.Seq (\u211d \u00d7 MultiseriesExpansion basis_tl)) :\n s.destruct = (Multiseries.destruct (basis_hd := basis_hd) s).map\n (fun (exp, coef, tl) => ((exp, coef), tl)) := by\n simp only [destruct, Option.map_map]\n exact Option.map_id_apply.symm", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.eq_of_bisim (L144-L151)\ntheorem eq_of_bisim {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} {x y : Multiseries basis_hd basis_tl}\n (motive : Multiseries basis_hd basis_tl \u2192 Multiseries basis_hd basis_tl \u2192 Prop)\n (base : motive x y)\n (step : \u2200 x y, motive x y \u2192 (x = .nil \u2227 y = .nil) \u2228 \u2203 exp coef,\n \u2203 (x' y' : Multiseries basis_hd basis_tl),\n x = cons exp coef x' \u2227 y = cons exp coef y' \u2227 motive x' y') :\n x = y := Seq.eq_of_bisim' motive base (by grind [nil, cons])", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.eq_of_bisim_strong (L152-L162)\ntheorem eq_of_bisim_strong {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis}\n {x y : Multiseries basis_hd basis_tl}\n (motive : Multiseries basis_hd basis_tl \u2192 Multiseries basis_hd basis_tl \u2192 Prop)\n (base : motive x y)\n (step : \u2200 x y, motive x y \u2192 (x = y) \u2228 \u2203 exp coef,\n \u2203 (x' y' : Multiseries basis_hd basis_tl),\n x = cons exp coef x' \u2227 y = cons exp coef y' \u2227 motive x' y') :\n x = y := Seq.eq_of_bisim_strong motive base (by grind [nil, cons])\nsection simp", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.cons_ne_nil (L164-L171)\ntheorem cons_ne_nil {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} {exp : \u211d}\n {coef : MultiseriesExpansion basis_tl}\n {tl : Multiseries basis_hd basis_tl} :\n cons exp coef tl \u2260 .nil := by\nintro h\n simp only [cons, nil] at h\n apply Seq.cons_ne_nil h", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.nil_ne_cons (L173-L178)\ntheorem nil_ne_cons {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} {exp : \u211d}\n {coef : MultiseriesExpansion basis_tl}\n {tl : Multiseries basis_hd basis_tl} :\n .nil \u2260 cons exp coef tl := cons_ne_nil.symm\nset_option backward.isDefEq.respectTransparency false in", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.cons_eq_cons (L180-L185)\ntheorem cons_eq_cons {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} {exp1 exp2 : \u211d}\n {coef1 coef2 : MultiseriesExpansion basis_tl} {tl1 tl2 : Multiseries basis_hd basis_tl} :\n cons exp1 coef1 tl1 = cons exp2 coef2 tl2 \u2194 exp1 = exp2 \u2227 coef1 = coef2 \u2227 tl1 = tl2 := by\nrw [cons, cons, Seq.cons_eq_cons]\n grind", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.corec_nil (L186-L192)\ntheorem corec_nil {\u03b2 : Type*} {basis_hd} {basis_tl}\n {f : \u03b2 \u2192 Option (\u211d \u00d7 MultiseriesExpansion basis_tl \u00d7 \u03b2)} {b : \u03b2} (h : f b = none) :\n corec f b = (nil : Multiseries basis_hd basis_tl) := by\nsimp only [corec, nil]\n rw [Seq.corec_nil]\n simpa", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.corec_cons (L193-L201)\ntheorem corec_cons {\u03b2 : Type*} {basis_hd} {basis_tl} {exp : \u211d}\n {coef : MultiseriesExpansion basis_tl} {next : \u03b2}\n {f : \u03b2 \u2192 Option (\u211d \u00d7 MultiseriesExpansion basis_tl \u00d7 \u03b2)} {b : \u03b2}\n (h : f b = some (exp, coef, next)) :\n (corec f b : Multiseries basis_hd basis_tl) = cons exp coef (corec f next) := by\nsimp only [corec, cons]\n rw [Seq.corec_cons]\n simpa", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.destruct_nil (L203-L207)\ntheorem destruct_nil {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} :\n destruct (nil : Multiseries basis_hd basis_tl) = none := by\nsimp [destruct, nil]\n\nset_option backward.isDefEq.respectTransparency false in", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.destruct_cons (L209-L214)\ntheorem destruct_cons {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} {exp : \u211d}\n {coef : MultiseriesExpansion basis_tl}\n {tl : Multiseries basis_hd basis_tl} :\n destruct (cons exp coef tl) = some (exp, coef, tl) := by\nsimp [destruct, cons]", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.destruct_eq_none (L215-L219)\ntheorem destruct_eq_none {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} {ms : Multiseries basis_hd basis_tl}\n (h : destruct ms = none) : ms = nil := by\napply Stream'.Seq.destruct_eq_none\n simpa [destruct] using h", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.destruct_eq_cons (L220-L226)\ntheorem destruct_eq_cons {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} {ms : Multiseries basis_hd basis_tl}\n {exp : \u211d} {coef : MultiseriesExpansion basis_tl} {tl : Multiseries basis_hd basis_tl}\n (h : destruct ms = some (exp, coef, tl)) : ms = cons exp coef tl := by\napply Stream'.Seq.destruct_eq_cons\n simp [destruct] at h\n grind", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.head_nil (L228-L231)\ntheorem head_nil {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} :\n (nil : Multiseries basis_hd basis_tl).head = none := by\nsimp [head, nil]", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.head_cons (L233-L238)\ntheorem head_cons {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} {exp : \u211d}\n {coef : MultiseriesExpansion basis_tl}\n {tl : Multiseries basis_hd basis_tl} :\n (cons exp coef tl).head = some (exp, coef) := by\nsimp [head, cons]", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.eventually_pos (L128-L137)\ntheorem eventually_pos {basis : Basis} (h : WellFormedBasis basis) :\n \u2200\u1da0 x in atTop, \u2200 f \u2208 basis, 0 < f x := by\ninduction basis with\n | nil => simp\n | cons hd tl ih =>\n simp only [WellFormedBasis, List.pairwise_cons, List.mem_cons, forall_eq_or_imp] at h\n simp only [List.mem_cons, forall_eq_or_imp]\n exact (h.right.left.eventually <| eventually_gt_atTop 0).and (ih (by tauto))\n\n/-- The first function in a well-formed basis is eventually positive. -/", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.exists_fixed_point_of_contractible (L207-L218)\ntheorem exists_fixed_point_of_contractible (F : (\u03b2 \u2192\u1d64 Seq \u03b1) \u2192 (\u03b2 \u2192\u1d64 Seq \u03b1))\n (h : LipschitzWith 2\u207b\u00b9 F) :\n \u2203 f : \u03b2 \u2192 Seq \u03b1, Function.IsFixedPt F f := by\nhave hF : ContractingWith 2\u207b\u00b9 F := by\n constructor\n \u00b7 norm_num\n \u00b7 exact h\n let f := hF.fixedPoint _\n use f\n exact hF.fixedPoint_isFixedPt\n\n/-- Main theorem of this file. It shows that there exists a function satisfying the corecursive", "-- Mathlib.Tactic.ComputeAsymptotics.Lemmas.isBigOWith_of_tendsto_top (L66-L70)\ntheorem isBigOWith_of_tendsto_top {C : \u211d} {f g : \u211d \u2192 \u211d} {l : Filter \u211d}\n (h : Tendsto (fun x \u21a6 g x / f x) l atTop) (hC : 0 < C) :\n IsBigOWith C l f g :=\nAsymptotics.IsLittleO.forall_isBigOWith (.of_tendsto_div_atTop h) hC", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.dist_cons_cons (L117-L134)\ntheorem dist_cons_cons (x : \u03b1) (s t : Seq \u03b1) : dist (cons x s) (cons x t) = 2\u207b\u00b9 * dist s t := by\nby_cases! h : s = t\n \u00b7 simp [h]\n have h' : cons x s \u2260 cons x t := by\n simpa\n rw [Subtype.dist_eq, Subtype.dist_eq, PiNat.dist_eq_of_ne (Subtype.coe_ne_coe.mpr h),\n PiNat.dist_eq_of_ne (Subtype.coe_ne_coe.mpr h')]\n simp only [show (1 / 2 : \u211d) = 2\u207b\u00b9 by simp, \u2190 pow_succ']\n congr\n simp only [val_cons, PiNat.firstDiff, ne_eq, Classical.dite_not, Subtype.coe_ne_coe.mpr h,\n not_false_eq_true, \u2193reduceDIte, val_eq_get]\n split_ifs with h_if\n \u00b7 contrapose! h'\n apply_fun Subtype.val using Subtype.val_injective\n simpa\n \u00b7 convert Nat.find_comp_succ _ _ _\n simp [Stream'.cons]", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.Stream' (L95-L100)\ntheorem Stream'.dist_le_one (s t : Stream' \u03b1) : dist s t \u2264 1 := by\nby_cases h : s = t\n \u00b7 simp [h]\n rw [PiNat.dist_eq_of_ne h]\n bound", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.of_append_right (L56-L59)\ntheorem of_append_right {left right : Basis} (h : WellFormedBasis (left ++ right)) :\n WellFormedBasis right :=\nh.of_sublist (by simp)", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.const (L76-L84)\ntheorem const (h_tendsto : Tendsto b atTop atTop) {c : \u211d} :\n Majorized (fun _ \u21a6 c) b 0 := by\nintro exp h_exp\n apply Asymptotics.isLittleO_const_left.mpr\n right\n apply tendsto_norm_atTop_atTop.comp\n exact (tendsto_rpow_atTop h_exp).comp h_tendsto\n\n/-- The zero function is majorized with any exponent. -/", "-- Mathlib.Tactic.ComputeAsymptotics.Lemmas.tendsto_nhdsNE_of_tendsto_atTop (L53-L58)\ntheorem tendsto_nhdsNE_of_tendsto_atTop (h_neg : Tendsto (fun x \u21a6 f (c - x\u207b\u00b9)) atTop l)\n (h_pos : Tendsto (fun x \u21a6 f (c + x\u207b\u00b9)) atTop l) :\n Tendsto f (\ud835\udcdd[\u2260] c) l := by\nsimpa [Tendsto, \u2190 nhdsLT_sup_nhdsGT] using\n \u27e8tendsto_nhdsLT_of_tendsto_atTop _ _ h_neg, tendsto_nhdsGT_of_tendsto_atTop _ _ h_pos\u27e9", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.gcorec_some (L286-L294)\ntheorem gcorec_some {F : \u03b2 \u2192 Option (\u03b1 \u00d7 \u03b3 \u00d7 \u03b2)} {op : \u03b3 \u2192 Seq \u03b1 \u2192 Seq \u03b1}\n [FriendlyOperationClass op] {b : \u03b2}\n {a : \u03b1} {c : \u03b3} {b' : \u03b2}\n (h : F b = some (a, c, b')) :\n gcorec F op b = Seq.cons a (op c (gcorec F op b')) := by\nhave := (FriendlyOperation.exists_fixed_point F op).choose_spec b\n simpa [h] using this\n\nend Tactic.ComputeAsymptotics.Seq", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.foo (L19-L33)\ndef foo (x : X) := hd x :: foo (tlArg x)\n```\n(where hd and tlArg are arbitrary functions) can be encoded via the corecursor `Seq.corec`.\n\nIt is not enough, however, to define multiplication and `powser` operation for multiseries.\n\nThis file implements a more general form of corecursion in the spirit of [blanchette2015].\nThis is a bare minimum that needed for the tactic, it justifies a weaker class of\ncorecursive definitions than [blanchette2015] does, and only works for `Seq`.\n\nA function `f : Seq \u03b1 \u2192 Seq \u03b1` is called *friendly* if for all `n : \u2115` the `n`-prefix of its result\n`f s` depends only on the `n`-prefix of its input `s`.\n\nIn this file we develop a theory that justifies corecursive definitions of the form\n```", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.tendsto_atTop (L123-L127)\ntheorem tendsto_atTop {basis : Basis} (h : WellFormedBasis basis) {f : \u211d \u2192 \u211d}\n (hf : f \u2208 basis) :\n Tendsto f atTop atTop := h.right f hf\n/-- Eventually all functions from a well-formed basis are positive. -/", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.Majorized (L32-L39)\ndef Majorized (f b : \u211d \u2192 \u211d) (exp : \u211d) : Prop :=\n\u2200 exp' > exp, f =o[atTop] (b ^ exp')\n\nnamespace Majorized\n\nvariable {f g b : \u211d \u2192 \u211d} {exp : \u211d}\n\n/-- Replacing the first argument of `Majorized` by an eventually equal function preserves it. -/", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.tail (L52-L55)\ntheorem tail {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis}\n (h : WellFormedBasis (basis_hd :: basis_tl)) : WellFormedBasis basis_tl :=\nh.of_sublist (by simp)", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.mul_bounded (L118-L128)\ntheorem mul_bounded {f g basis_hd : \u211d \u2192 \u211d} {exp : \u211d} (hf : Majorized f basis_hd exp)\n (hg : g =O[atTop] (fun _ \u21a6 (1 : \u211d))) :\n Majorized (f * g) basis_hd exp := by\nintro exp h_exp\n convert IsLittleO.mul_isBigO (hf _ h_exp) hg using 1\n simp\n rfl\n\nend Majorized\n\nend Tactic.ComputeAsymptotics", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.dist_eq_one_of_head (L140-L150)\ntheorem dist_eq_one_of_head {s t : Seq \u03b1} (h : s.head \u2260 t.head) : dist s t = 1 := by\nrw [Subtype.dist_eq, PiNat.dist_eq_of_ne]\n \u00b7 convert pow_zero _\n simp only [PiNat.firstDiff, ne_eq, Classical.dite_not, dite_eq_left_iff,\n Nat.find_eq_zero]\n intro h'\n simpa [Stream'.cons]\n \u00b7 rw [Subtype.coe_ne_coe]\n contrapose! h\n simp [h]", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.single (L44-L46)\ntheorem single (f : \u211d \u2192 \u211d) (hf : Tendsto f atTop atTop) : WellFormedBasis [f] := by\nsimpa [WellFormedBasis]", "-- Mathlib.Tactic.ComputeAsymptotics.Lemmas.isBigOWith_of_tendsto_bot (L71-L75)\ntheorem isBigOWith_of_tendsto_bot {C : \u211d} {f g : \u211d \u2192 \u211d} {l : Filter \u211d}\n (h : Tendsto (fun x \u21a6 g x / f x) l atBot) (hC : 0 < C) :\n IsBigOWith C l f g :=\nAsymptotics.IsLittleO.forall_isBigOWith (.of_tendsto_div_atBot h) hC", "-- Mathlib.Tactic.ComputeAsymptotics.Lemmas.tendsto_nhdsLT_of_tendsto_atTop (L46-L52)\ntheorem tendsto_nhdsLT_of_tendsto_atTop (h : Tendsto (fun x \u21a6 f (c - x\u207b\u00b9)) atTop l) :\n Tendsto f (\ud835\udcdd[<] c) l := by\nconvert_to Tendsto (f \u2218 (fun x \u21a6 c + x) \u2218 Neg.neg \u2218 Inv.inv) atTop l at h\n \u00b7 ext\n simp [AddGroupWithOne.sub_eq_add_neg]\n simpa [Tendsto, \u2190 Filter.map_map] using h", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.mul (L104-L117)\ntheorem mul {f_exp g_exp : \u211d} (hf : Majorized f b f_exp)\n (hg : Majorized g b g_exp) (h_pos : \u2200\u1da0 t in atTop, 0 < b t) :\n Majorized (f * g) b (f_exp + g_exp) := by\nsimp only [Majorized] at *\n intro exp h_exp\n let \u03b5 := (exp - f_exp - g_exp) / 2\n specialize hf (f_exp + \u03b5) (by dsimp [\u03b5]; linarith)\n specialize hg (g_exp + \u03b5) (by dsimp [\u03b5]; linarith)\n apply (hf.mul hg).trans_eventuallyEq (g\u2081 := fun t \u21a6 b t ^ (f_exp + \u03b5) * b t ^ (g_exp + \u03b5))\n apply h_pos.mono\n intro t hx\n simp only [Pi.pow_apply]\n conv_rhs => rw [show exp = (f_exp + \u03b5) + (g_exp + \u03b5) by dsimp [\u03b5]; ring_nf, Real.rpow_add hx]", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.of_le (L65-L70)\ntheorem of_le {exp1 exp2 : \u211d} (h_lt : exp1 \u2264 exp2) (h : Majorized f b exp1) :\n Majorized f b exp2 := by\nsimp only [Majorized] at *\n exact fun exp' h_exp \u21a6 h _ (by linarith)\n\n/-- If `f` is majorized with a negative exponent, then it tends to zero. -/", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.dist_le_one (L102-L110)\ntheorem dist_le_one (s t : Seq \u03b1) : dist s t \u2264 1 := PiNat.dist_le_one _ _\nlocal instance : BoundedSpace (Stream' \u03b1) :=\n @PiNat.boundedSpace _ (fun _ \u21a6 \u22a5) (fun _ \u21a6 discreteTopology_bot _)\n\nlocal instance : BoundedSpace (Seq \u03b1) :=\n instBoundedSpaceSubtype\n\nset_option backward.isDefEq.respectTransparency false in", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.cons (L98-L104)\ntheorem cons {basis : Basis} {f : \u211d \u2192 \u211d} (h_basis : WellFormedBasis basis)\n (hf_tendsto : Tendsto f atTop atTop)\n (hf : \u2200 g \u2208 basis, (Real.log \u2218 g) =o[atTop] (Real.log \u2218 f)) :\n WellFormedBasis (f :: basis) := by\nchange WellFormedBasis ([f] ++ basis)\n exact append (by simpa [WellFormedBasis]) h_basis (by simpa)", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.dist_cons_nil (L157-L160)\ntheorem dist_cons_nil (x : \u03b1) (s : Seq \u03b1) : dist (cons x s) nil = 1 := by\napply dist_eq_one_of_head\n simp", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.tail_isLittleO_head (L143-L148)\ntheorem tail_isLittleO_head {hd : \u211d \u2192 \u211d} {tl : Basis}\n (h : WellFormedBasis (hd :: tl)) {f : \u211d \u2192 \u211d} (hf : f \u2208 tl) :\n (Real.log \u2218 f) =o[atTop] (Real.log \u2218 hd) := by\nrw [WellFormedBasis, List.pairwise_cons] at h\n exact h.left.left _ hf", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.nil (L42-L43)\ntheorem nil : WellFormedBasis [] := by simp [WellFormedBasis]", "-- Mathlib.Tactic.ComputeAsymptotics.Lemmas.tendsto_nhdsGT_of_tendsto_atTop (L42-L45)\ntheorem tendsto_nhdsGT_of_tendsto_atTop (h : Tendsto (fun x \u21a6 f (c + x\u207b\u00b9)) atTop l) :\n Tendsto f (\ud835\udcdd[>] c) l := by\nsimpa [\u2190 Function.comp_def, Tendsto, \u2190 Filter.map_map] using h", "-- Mathlib.Tactic.ComputeAsymptotics.Lemmas.tendsto_nhdsNE_of_tendsto_atTop_nhds_of_eq (L59-L65)\ntheorem tendsto_nhdsNE_of_tendsto_atTop_nhds_of_eq [TopologicalSpace \u03b1] {a b : \u03b1}\n (h_neg : Tendsto (fun x \u21a6 f (c - x\u207b\u00b9)) atTop (\ud835\udcdd a))\n (h_pos : Tendsto (fun x \u21a6 f (c + x\u207b\u00b9)) atTop (\ud835\udcdd b)) (h_eq : a = b) :\n Tendsto f (\ud835\udcdd[\u2260] c) (\ud835\udcdd a) := by\napply tendsto_nhdsNE_of_tendsto_atTop _ _ h_neg\n convert h_pos", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.of_eventuallyEq (L40-L46)\ntheorem of_eventuallyEq (h_eq : g =\u1da0[atTop] f) (h : Majorized f b exp) :\n Majorized g b exp := by\nsimp only [Majorized] at *\n intro exp' h_exp\n exact EventuallyEq.trans_isLittleO h_eq (h exp' h_exp)\n\n/-- For any function `f` tending to infinity, `f ^ exp` is majorized by `f` with exponent `exp`. -/", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.FriendlyOperationClass (L188-L191)\ntheorem FriendlyOperationClass.comp (F : \u03b3 \u2192 Seq \u03b1 \u2192 Seq \u03b1) (g : \u03b3' \u2192 \u03b3)\n [h : FriendlyOperationClass F] : FriendlyOperationClass (fun c \u21a6 F (g c)) := by\ngrind [FriendlyOperationClass]", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.zero (L85-L88)\ntheorem zero : Majorized 0 b exp :=\nfun _ _ \u21a6 Asymptotics.isLittleO_zero _ _\n\n/-- `c \u2022 f` is majorized with the same exponent as `f` for any constant `c`. -/", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.dist_nil_cons (L162-L167)\ntheorem dist_nil_cons (x : \u03b1) (s : Seq \u03b1) : dist nil (cons x s) = 1 := by\nrw [dist_comm]\n simp\n\n/-- A function on sequences is called a \"friend\" if any `n`-prefix of its output depends only on\nthe `n`-prefix of the input. Such functions can be used in the tail of (non-primitive) corecursive", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.compare_right_aux (L75-L88)\ntheorem compare_right_aux {basis : Basis} {f : \u211d \u2192 \u211d} (h : WellFormedBasis basis)\n (h_comp : \u2200 g, basis.head? = .some g \u2192 (Real.log \u2218 g) =o[atTop] (Real.log \u2218 f)) :\n \u2200 g \u2208 basis, (Real.log \u2218 g) =o[atTop] (Real.log \u2218 f) := by\nintro g hg\n cases basis with\n | nil => simp at hg\n | cons basis_hd basis_tl =>\n specialize h_comp basis_hd (by simp)\n simp only [List.mem_cons] at hg\n rcases hg with hg | hg\n \u00b7 simpa [hg]\n \u00b7 simp only [WellFormedBasis, List.pairwise_cons, List.mem_cons, forall_eq_or_imp] at h\n exact .trans (by grind) h_comp", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.self (L47-L64)\ntheorem self (h : Tendsto f atTop atTop) :\n Majorized (f ^ exp) f exp := by\nsimp only [Majorized]\n intro exp' h_exp\n apply (isLittleO_iff_tendsto' _).mpr\n \u00b7 have : (fun t \u21a6 f t ^ exp / f t ^ exp') =\u1da0[atTop] fun t \u21a6 (f t) ^ (exp - exp') :=\n (h.eventually_gt_atTop 0).mono (fun _ h \u21a6 by simp [\u2190 Real.rpow_sub h])\n apply Tendsto.congr' this.symm\n conv =>\n arg 1\n rw [show (fun t \u21a6 f t ^ (exp - exp')) = ((fun t \u21a6 t ^ (-(exp' - exp))) \u2218 f) by ext; simp]\n exact (tendsto_rpow_neg_atTop (by linarith)).comp h\n \u00b7 apply (Tendsto.eventually_gt_atTop h 0).mono\n intro t h1 h2\n absurd h2\n exact (Real.rpow_pos_of_pos h1 _).ne.symm\n\n/-- If `f` is majorized with exponent `exp\u2081`, then it is majorized with any `exp\u2082 \u2265 exp\u2081`. -/", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.dist_cons_cons_eq_one (L151-L155)\ntheorem dist_cons_cons_eq_one {x y : \u03b1} {s t : Seq \u03b1} (h : x \u2260 y) :\n dist (cons x s) (cons y t) = 1 := by\napply dist_eq_one_of_head\n simpa", "-- Mathlib.Tactic.ComputeAsymptotics.Lemmas.isBigO_of_div_tendsto_atBot (L81-L86)\ntheorem isBigO_of_div_tendsto_atBot {f g : \u211d \u2192 \u211d} {l : Filter \u211d}\n (h : Tendsto (fun x \u21a6 g x / f x) l atBot) :\n f =O[l] g :=\nAsymptotics.IsLittleO.isBigO (.of_tendsto_div_atBot h)\n\nend Tactic.ComputeAsymptotics", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.sublist_getBasis (L183-L189)\ntheorem sublist_getBasis {basis : Basis} {ex : BasisExtension basis} :\n List.Sublist basis ex.getBasis := by\ninduction ex with\n | nil => simp\n | keep _ ex ih => simpa [getBasis] using ih\n | insert _ ex ih => exact List.Sublist.cons _ ih", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.insert (L105-L115)\ntheorem insert {left right : Basis} {f : \u211d \u2192 \u211d}\n (h : WellFormedBasis (left ++ right)) (hf_tendsto : Tendsto f atTop atTop)\n (hf_comp_left : \u2200 g, left.getLast? = .some g \u2192 (Real.log \u2218 f) =o[atTop] (Real.log \u2218 g))\n (hf_comp_right : \u2200 g, right.head? = .some g \u2192 (Real.log \u2218 g) =o[atTop] (Real.log \u2218 f)) :\n WellFormedBasis (left ++ f :: right) := by\nhave : WellFormedBasis (f :: right) := cons (h.of_sublist (by simp)) hf_tendsto\n (compare_right_aux (h.of_sublist (by simp)) hf_comp_right)\n apply compare_left_aux (h.of_sublist (by simp)) at hf_comp_left\n apply append (h.of_sublist (by simp)) this\n exact fun g hg \u21a6 compare_right_aux this (by grind)", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.WellFormedBasis (L36-L41)\ndef WellFormedBasis (basis : Basis) : Prop :=\nbasis.Pairwise (fun x y => (Real.log \u2218 y) =o[atTop] (Real.log \u2218 x)) \u2227\n \u2200 f \u2208 basis, Tendsto f atTop atTop\n\nnamespace WellFormedBasis", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.getBasis (L177-L182)\ndef getBasis {basis : Basis} (ex : BasisExtension basis) : Basis :=\nmatch ex with\n | nil => []\n | keep basis_hd ex => basis_hd :: ex.getBasis\n | insert f ex => f :: ex.getBasis", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.push (L116-L122)\ntheorem push {basis : Basis} {f : \u211d \u2192 \u211d} (h : WellFormedBasis basis)\n (hf_tendsto : Tendsto f atTop atTop)\n (hf_comp : \u2200 g, basis.getLast? = .some g \u2192 (Real.log \u2218 f) =o[atTop] (Real.log \u2218 g)) :\n WellFormedBasis (basis ++ [f]) :=\ninsert (by simp [h]) hf_tendsto hf_comp (by simp)\n\n/-- All functions from a well-formed basis tend to `atTop`. -/", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.dist_eq_half_of_head (L135-L139)\ntheorem dist_eq_half_of_head {s t : Seq \u03b1} (h : s.head = t.head) :\n dist s t = 2\u207b\u00b9 * dist s.tail t.tail := by\ncases s <;> cases t <;> simp at h <;> simp [h]\n\nset_option backward.isDefEq.respectTransparency false in", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.Basis (L28-L35)\nabbrev Basis := List (\u211d \u2192 \u211d)\n/-- `WellFormedBasis basis` means that all functions from `basis` tend to `atTop`, and\n`basis` is sorted such that if\n`g` goes after `f` in `basis`, then `log f =o[atTop] log g`.\n\nWe use two types `Basis` and `WellFormedBasis` instead of a single bundled one because it\nit lets us to use the `List` API for `Basis`. -/", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.push_log_last (L149-L176)\ntheorem push_log_last {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis}\n (h_basis : WellFormedBasis (basis_hd :: basis_tl)) :\n WellFormedBasis ((basis_hd :: basis_tl) ++\n [Real.log \u2218 (basis_hd :: basis_tl).getLast (by simp)]) := by\napply h_basis.push\n \u00b7 simp [Real.tendsto_log_atTop.comp, h_basis.right]\n \u00b7 intro g hg\n simpa [List.getLast_of_getLast?_eq_some hg] using Real.isLittleO_log_id_atTop.comp_tendsto <|\n Real.tendsto_log_atTop.comp <| h_basis.tendsto_atTop <| List.mem_of_getLast? hg\n\nend WellFormedBasis\n\n/-! ### Basis extensions -/\n\n/-- The type of extensions of a given basis, defined as an inductive type.\nGiven a `basis : Basis` and `ex : BasisExtension basis` of it, one can use `getBasis` to produce a\nbasis `basis'` for which `basis <+ basis'`. Moreover, all such bases for which `basis` is a sublist\ncan be obtained in this manner. In this sense `BasisExtension` is a `Type`-valued analogue\nof `List.Sublist`. -/\ninductive BasisExtension : Basis \u2192 Type\n| nil : BasisExtension []\n| keep (basis_hd : \u211d \u2192 \u211d) {basis_tl : Basis} (ex : BasisExtension basis_tl) :\n BasisExtension (basis_hd :: basis_tl)\n| insert {basis : Basis} (f : \u211d \u2192 \u211d) (ex : BasisExtension basis) : BasisExtension basis\n\nnamespace BasisExtension\n\n/-- The basis after applying a basis extension. -/", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.dist_eq_two_inv_pow (L111-L115)\ntheorem dist_eq_two_inv_pow {s t : Seq \u03b1} (h : s \u2260 t) : \u2203 n, dist s t = 2\u207b\u00b9 ^ n := by\nrw [Subtype.dist_eq, PiNat.dist_eq_of_ne (Subtype.coe_ne_coe.mpr h)]\n simp\n\nset_option backward.isDefEq.respectTransparency false in", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.head_eventually_pos (L138-L142)\ntheorem head_eventually_pos {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis}\n (h : WellFormedBasis (basis_hd :: basis_tl)) : \u2200\u1da0 x in atTop, 0 < basis_hd x :=\n(forall_eventually_of_eventually_forall h.eventually_pos basis_hd).mono (by grind)\n\n/-- All functions in the tail of a well-formed basis are little-o of the basis' head. -/", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.append (L89-L97)\ntheorem append {left right : Basis}\n (h_left : WellFormedBasis left) (h_right : WellFormedBasis right)\n (h : \u2200 f \u2208 left, \u2200 g \u2208 right, (Real.log \u2218 g) =o[atTop] (Real.log \u2218 f)) :\n WellFormedBasis (left ++ right) := by\nsimp only [WellFormedBasis] at *\n constructor\n \u00b7 simpa [List.pairwise_append, h_left, h_right] using h\n \u00b7 grind", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.insert_tail_wellFormedBasis (L190-L198)\ntheorem insert_tail_wellFormedBasis {basis : Basis} {f : \u211d \u2192 \u211d}\n {ex_tl : BasisExtension basis}\n (h_basis : WellFormedBasis <| BasisExtension.getBasis (.insert f ex_tl)) :\n WellFormedBasis ex_tl.getBasis :=\nh_basis.of_sublist (by simp [getBasis])\n\nend BasisExtension\n\nend Tactic.ComputeAsymptotics", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.tendsto_zero_of_neg (L71-L75)\ntheorem tendsto_zero_of_neg (h_lt : exp < 0) (h : Majorized f b exp) :\n Tendsto f atTop (\ud835\udcdd 0) := by\nsimpa [Pi.pow_def, Majorized] using h 0 (by linarith)\n\n/-- Constants are majorized with exponent `exp = 0` by any functions which tends to infinity. -/", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.FriendlyOperation (L169-L174)\ndef FriendlyOperation (op : Seq \u03b1 \u2192 Seq \u03b1) : Prop := LipschitzWith 1 op\n/-- A family of friendly operations on sequences indexed by a type `\u03b3`. -/\nclass FriendlyOperationClass (F : \u03b3 \u2192 Seq \u03b1 \u2192 Seq \u03b1) : Prop where\n friend : \u2200 c : \u03b3, FriendlyOperation (F c)", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.smul (L89-L94)\ntheorem smul (h : Majorized f b exp) {c : \u211d} :\n Majorized (c \u2022 f) b exp :=\nfun exp h_exp \u21a6 (h exp h_exp).const_mul_left _\n\n/-- The sum of two functions that are majorized with exponents `f_exp` and `g_exp` is\nmajorized with exponent `exp` whenever `exp \u2265 max f_exp g_exp`. -/", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.compare_left_aux (L60-L74)\ntheorem compare_left_aux {basis : Basis} {f : \u211d \u2192 \u211d} (h : WellFormedBasis basis)\n (h_comp : \u2200 g, basis.getLast? = .some g \u2192 (Real.log \u2218 f) =o[atTop] (Real.log \u2218 g)) :\n \u2200 g \u2208 basis, (Real.log \u2218 f) =o[atTop] (Real.log \u2218 g) := by\nintro g hg\n rcases basis.eq_nil_or_concat with rfl | \u27e8basis_begin, basis_end, rfl\u27e9\n \u00b7 simp at hg\n simp only [List.concat_eq_append, List.mem_append, List.mem_cons, List.not_mem_nil, or_false,\n List.getLast?_append, List.getLast?_singleton, Option.some_or, Option.some.injEq,\n forall_eq'] at hg h_comp\n rcases hg with hg | hg\n \u00b7 simp only [WellFormedBasis, List.concat_eq_append, List.mem_append, List.mem_cons,\n List.not_mem_nil, or_false] at h\n exact h_comp.trans (by grind)\n \u00b7 grind", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.add (L95-L103)\ntheorem add {f_exp g_exp : \u211d} (hf : Majorized f b f_exp)\n (hg : Majorized g b g_exp) (hf_exp : f_exp \u2264 exp) (hg_exp : g_exp \u2264 exp) :\n Majorized (f + g) b exp := by\nsimp only [Majorized] at *\n intro exp' h_exp'\n exact (hf _ (by order)).add (hg _ (by order))\n\n/-- The product of two functions that are majorized with exponents `f_exp` and `g_exp` is\nmajorized with exponent `f_exp + g_exp`. -/", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.of_sublist (L47-L51)\ntheorem of_sublist {basis basis' : Basis} (h : List.Sublist basis basis')\n (h_basis : WellFormedBasis basis') : WellFormedBasis basis :=\n\u27e8h_basis.left.sublist h, fun _ hf \u21a6 h_basis.right _ (h.subset hf)\u27e9\n\n/-- The tail of a well-formed basis is well-formed. -/", "-- Mathlib.Tactic.ComputeAsymptotics.Lemmas.isBigO_of_div_tendsto_atTop (L76-L80)\ntheorem isBigO_of_div_tendsto_atTop {f g : \u211d \u2192 \u211d} {l : Filter \u211d}\n (h : Tendsto (fun x \u21a6 g x / f x) l atTop) :\n f =O[l] g :=\nAsymptotics.IsLittleO.isBigO (.of_tendsto_div_atTop h)", "-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.gcorec_nil (L279-L285)\ntheorem gcorec_nil {F : \u03b2 \u2192 Option (\u03b1 \u00d7 \u03b3 \u00d7 \u03b2)} {op : \u03b3 \u2192 Seq \u03b1 \u2192 Seq \u03b1}\n [FriendlyOperationClass op] {b : \u03b2}\n (h : F b = none) :\n gcorec F op b = nil := by\nhave := (FriendlyOperation.exists_fixed_point F op).choose_spec b\n simpa [h] using this"], "statement": "theorem tail_cons {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} {exp : \u211d}\n {coef : MultiseriesExpansion basis_tl}\n {tl : Multiseries basis_hd basis_tl} :\n (cons exp coef tl).tail = tl", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 35227, "declarations_count": 3673, "diagnostics_count": 0, "duplicate_fingerprint": "2be6a3c3bf2110f0", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 12940, "lean_code_chars": 31942, "lean_code_ratio": 0.9067, "length_bucket": "long", "line_count": 974, "natural_language_chars": 3285, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 80, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem tail_cons {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} {exp : \u211d}\n {coef : MultiseriesExpansion basis_tl}\n {tl : Multiseries basis_hd basis_tl} :\n (cons exp coef tl).tail = tl\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.Basis (L44-L53)\nabbrev Basis := List (\u211d \u2192 \u211d)\n/-- Multiseries representing a given function `f : \u211d \u2192 \u211d`.\n`MultiseriesExpansion []` is just `\u211d`: multiseries representing constant functions.\nOtherwise it is a pair of a `Multiseries basis_hd basis_tl` and a function `\u211d \u2192 \u211d`. We call\nthe former an expansion of the latter.\n\nNote: most of the theory can be formulated in terms of `Multiseries`, but we need to explicitly\nstore the approximated function to be able to use the eventual zeroness oracle at the trimming step.\n-/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.MultiseriesExpansion (L54-L71)\ndef MultiseriesExpansion (basis : Basis) : Type :=\nmatch basis with\n | [] => \u211d\n | .cons _ basis_tl => Seq (\u211d \u00d7 MultiseriesExpansion basis_tl) \u00d7 (\u211d \u2192 \u211d)\n\nnamespace MultiseriesExpansion\n\nset_option linter.unusedVariables false in\n/-- Multiseries in a basis `basis_hd :: basis_tl`. It is a generalisation of asymptotic expansions.\nA multiseries in a basis `[b\u2081, ..., b\u2099]` is a formal series made from monomials\n`b\u2081 ^ e\u2081 * ... * b\u2099 ^ e\u2099` where `e\u2081, ..., e\u2099` are real numbers. We treat multivariate series in\na basis `[b\u2081, ..., b\u2099]` as a univariate series in the variable `b\u2081` (`basis_hd`) with coefficients\nbeing multiseries in the basis `[b\u2082, ..., b\u2099]` (`basis_tl`). We represent such a series as a lazy\nlist (`Seq`) of pairs `(exp, coef)` where `exp` is the exponent of `b\u2081` and `coef` is the\ncoefficient (a multiseries in `basis_tl`).\n\n`MultiseriesExpansion` is a `Multiseries` with an attached real function.\n-/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.Multiseries (L73-L78)\ndef Multiseries (basis_hd : \u211d \u2192 \u211d) (basis_tl : Basis) : Type :=\nSeq (\u211d \u00d7 MultiseriesExpansion basis_tl)\n\nnamespace Multiseries\n\n/-- Converts a `Multiseries basis_hd basis_tl` to a `Seq (\u211d \u00d7 MultiseriesExpansion basis_tl)`. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.toSeq (L79-L83)\ndef toSeq {basis_hd basis_tl} (ms : Multiseries basis_hd basis_tl) :\n Seq (\u211d \u00d7 MultiseriesExpansion basis_tl) :=\nms\n\n/-- The empty multiseries. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.nil (L84-L86)\ndef nil {basis_hd basis_tl} : Multiseries basis_hd basis_tl := Seq.nil\n/-- Prepend a monomial to a multiseries. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.cons (L87-L93)\ndef cons {basis_hd basis_tl} (exp : \u211d) (coef : MultiseriesExpansion basis_tl)\n (tl : Multiseries basis_hd basis_tl) :\n Multiseries basis_hd basis_tl :=\nSeq.cons (exp, coef) tl\n\n/-- Recursion principle for `Multiseries basis_hd basis_tl`. It is equivalent to\n`Stream'.Seq.recOn` but provides some convenience. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.recOn (L95-L101)\ndef recOn {basis_hd basis_tl} {motive : Multiseries basis_hd basis_tl \u2192 Sort*}\n (ms : Multiseries basis_hd basis_tl) (nil : motive nil)\n (cons : \u2200 exp coef (tl : Multiseries basis_hd basis_tl), motive (cons exp coef tl)) :\n motive ms := Stream'.Seq.recOn _ nil fun _ _ \u21a6 cons _ _ _\n/-- Destruct a multiseries into a triple `(exp, coef, tl)`, where `exp` is the leading exponent,\n`coef` is the leading coefficient, and `tl` is the tail. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.destruct (L102-L106)\ndef destruct {basis_hd basis_tl} (ms : Multiseries basis_hd basis_tl) :\n Option (\u211d \u00d7 MultiseriesExpansion basis_tl \u00d7 Multiseries basis_hd basis_tl) :=\n(Seq.destruct ms).map (fun ((exp, coef), tl) => (exp, coef, tl))\n\n/-- The head of a multiseries, i.e. the first two entries of the tuple returned by `destruct`. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.head (L107-L111)\ndef head {basis_hd basis_tl} (ms : Multiseries basis_hd basis_tl) :\n Option (\u211d \u00d7 MultiseriesExpansion basis_tl) :=\nSeq.head ms\n\n/-- The tail of a multiseries, i.e. the last entry of the tuple returned by `destruct`. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.tail (L112-L117)\ndef tail {basis_hd basis_tl} (ms : Multiseries basis_hd basis_tl) : Multiseries basis_hd basis_tl :=\nSeq.tail ms\n\n/-- Given two functions `f : \u211d \u2192 \u211d` and\n`g : MultiseriesExpansion basis_tl \u2192 MultiseriesExpansion basis_tl'`, apply them to exponents and\ncoefficients of a multiseries. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.map (L118-L124)\ndef map {basis_hd basis_tl basis_hd' basis_tl'} (f : \u211d \u2192 \u211d)\n (g : MultiseriesExpansion basis_tl \u2192 MultiseriesExpansion basis_tl')\n (ms : Multiseries basis_hd basis_tl) :\n Multiseries basis_hd' basis_tl' :=\nSeq.map (fun (exp, coef) \u21a6 (f exp, g coef)) ms\n\n/-- Corecursor for `Multiseries basis_hd basis_tl`. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.corec (L125-L136)\ndef corec {\u03b2 : Type*} {basis_hd} {basis_tl}\n (f : \u03b2 \u2192 Option (\u211d \u00d7 MultiseriesExpansion basis_tl \u00d7 \u03b2)) (b : \u03b2) :\n Multiseries basis_hd basis_tl :=\nSeq.corec (fun a => (f a).map (fun (exp, coef, next) => ((exp, coef), next))) b\n\nprivate lemma destruct_eq_destruct_map {basis_hd basis_tl}\n (s : Stream'.Seq (\u211d \u00d7 MultiseriesExpansion basis_tl)) :\n s.destruct = (Multiseries.destruct (basis_hd := basis_hd) s).map\n (fun (exp, coef, tl) => ((exp, coef), tl)) := by\n simp only [destruct, Option.map_map]\n exact Option.map_id_apply.symm\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.eq_of_bisim (L144-L151)\ntheorem eq_of_bisim {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} {x y : Multiseries basis_hd basis_tl}\n (motive : Multiseries basis_hd basis_tl \u2192 Multiseries basis_hd basis_tl \u2192 Prop)\n (base : motive x y)\n (step : \u2200 x y, motive x y \u2192 (x = .nil \u2227 y = .nil) \u2228 \u2203 exp coef,\n \u2203 (x' y' : Multiseries basis_hd basis_tl),\n x = cons exp coef x' \u2227 y = cons exp coef y' \u2227 motive x' y') :\n x = y := Seq.eq_of_bisim' motive base (by grind [nil, cons])\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.eq_of_bisim_strong (L152-L162)\ntheorem eq_of_bisim_strong {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis}\n {x y : Multiseries basis_hd basis_tl}\n (motive : Multiseries basis_hd basis_tl \u2192 Multiseries basis_hd basis_tl \u2192 Prop)\n (base : motive x y)\n (step : \u2200 x y, motive x y \u2192 (x = y) \u2228 \u2203 exp coef,\n \u2203 (x' y' : Multiseries basis_hd basis_tl),\n x = cons exp coef x' \u2227 y = cons exp coef y' \u2227 motive x' y') :\n x = y := Seq.eq_of_bisim_strong motive base (by grind [nil, cons])\nsection simp\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.cons_ne_nil (L164-L171)\ntheorem cons_ne_nil {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} {exp : \u211d}\n {coef : MultiseriesExpansion basis_tl}\n {tl : Multiseries basis_hd basis_tl} :\n cons exp coef tl \u2260 .nil := by\nintro h\n simp only [cons, nil] at h\n apply Seq.cons_ne_nil h\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.nil_ne_cons (L173-L178)\ntheorem nil_ne_cons {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} {exp : \u211d}\n {coef : MultiseriesExpansion basis_tl}\n {tl : Multiseries basis_hd basis_tl} :\n .nil \u2260 cons exp coef tl := cons_ne_nil.symm\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.cons_eq_cons (L180-L185)\ntheorem cons_eq_cons {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} {exp1 exp2 : \u211d}\n {coef1 coef2 : MultiseriesExpansion basis_tl} {tl1 tl2 : Multiseries basis_hd basis_tl} :\n cons exp1 coef1 tl1 = cons exp2 coef2 tl2 \u2194 exp1 = exp2 \u2227 coef1 = coef2 \u2227 tl1 = tl2 := by\nrw [cons, cons, Seq.cons_eq_cons]\n grind\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.corec_nil (L186-L192)\ntheorem corec_nil {\u03b2 : Type*} {basis_hd} {basis_tl}\n {f : \u03b2 \u2192 Option (\u211d \u00d7 MultiseriesExpansion basis_tl \u00d7 \u03b2)} {b : \u03b2} (h : f b = none) :\n corec f b = (nil : Multiseries basis_hd basis_tl) := by\nsimp only [corec, nil]\n rw [Seq.corec_nil]\n simpa\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.corec_cons (L193-L201)\ntheorem corec_cons {\u03b2 : Type*} {basis_hd} {basis_tl} {exp : \u211d}\n {coef : MultiseriesExpansion basis_tl} {next : \u03b2}\n {f : \u03b2 \u2192 Option (\u211d \u00d7 MultiseriesExpansion basis_tl \u00d7 \u03b2)} {b : \u03b2}\n (h : f b = some (exp, coef, next)) :\n (corec f b : Multiseries basis_hd basis_tl) = cons exp coef (corec f next) := by\nsimp only [corec, cons]\n rw [Seq.corec_cons]\n simpa\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.destruct_nil (L203-L207)\ntheorem destruct_nil {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} :\n destruct (nil : Multiseries basis_hd basis_tl) = none := by\nsimp [destruct, nil]\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.destruct_cons (L209-L214)\ntheorem destruct_cons {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} {exp : \u211d}\n {coef : MultiseriesExpansion basis_tl}\n {tl : Multiseries basis_hd basis_tl} :\n destruct (cons exp coef tl) = some (exp, coef, tl) := by\nsimp [destruct, cons]\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.destruct_eq_none (L215-L219)\ntheorem destruct_eq_none {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} {ms : Multiseries basis_hd basis_tl}\n (h : destruct ms = none) : ms = nil := by\napply Stream'.Seq.destruct_eq_none\n simpa [destruct] using h\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.destruct_eq_cons (L220-L226)\ntheorem destruct_eq_cons {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} {ms : Multiseries basis_hd basis_tl}\n {exp : \u211d} {coef : MultiseriesExpansion basis_tl} {tl : Multiseries basis_hd basis_tl}\n (h : destruct ms = some (exp, coef, tl)) : ms = cons exp coef tl := by\napply Stream'.Seq.destruct_eq_cons\n simp [destruct] at h\n grind\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.head_nil (L228-L231)\ntheorem head_nil {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} :\n (nil : Multiseries basis_hd basis_tl).head = none := by\nsimp [head, nil]\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.head_cons (L233-L238)\ntheorem head_cons {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} {exp : \u211d}\n {coef : MultiseriesExpansion basis_tl}\n {tl : Multiseries basis_hd basis_tl} :\n (cons exp coef tl).head = some (exp, coef) := by\nsimp [head, cons]\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.eventually_pos (L128-L137)\ntheorem eventually_pos {basis : Basis} (h : WellFormedBasis basis) :\n \u2200\u1da0 x in atTop, \u2200 f \u2208 basis, 0 < f x := by\ninduction basis with\n | nil => simp\n | cons hd tl ih =>\n simp only [WellFormedBasis, List.pairwise_cons, List.mem_cons, forall_eq_or_imp] at h\n simp only [List.mem_cons, forall_eq_or_imp]\n exact (h.right.left.eventually <| eventually_gt_atTop 0).and (ih (by tauto))\n\n/-- The first function in a well-formed basis is eventually positive. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.exists_fixed_point_of_contractible (L207-L218)\ntheorem exists_fixed_point_of_contractible (F : (\u03b2 \u2192\u1d64 Seq \u03b1) \u2192 (\u03b2 \u2192\u1d64 Seq \u03b1))\n (h : LipschitzWith 2\u207b\u00b9 F) :\n \u2203 f : \u03b2 \u2192 Seq \u03b1, Function.IsFixedPt F f := by\nhave hF : ContractingWith 2\u207b\u00b9 F := by\n constructor\n \u00b7 norm_num\n \u00b7 exact h\n let f := hF.fixedPoint _\n use f\n exact hF.fixedPoint_isFixedPt\n\n/-- Main theorem of this file. It shows that there exists a function satisfying the corecursive\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Lemmas.isBigOWith_of_tendsto_top (L66-L70)\ntheorem isBigOWith_of_tendsto_top {C : \u211d} {f g : \u211d \u2192 \u211d} {l : Filter \u211d}\n (h : Tendsto (fun x \u21a6 g x / f x) l atTop) (hC : 0 < C) :\n IsBigOWith C l f g :=\nAsymptotics.IsLittleO.forall_isBigOWith (.of_tendsto_div_atTop h) hC\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.dist_cons_cons (L117-L134)\ntheorem dist_cons_cons (x : \u03b1) (s t : Seq \u03b1) : dist (cons x s) (cons x t) = 2\u207b\u00b9 * dist s t := by\nby_cases! h : s = t\n \u00b7 simp [h]\n have h' : cons x s \u2260 cons x t := by\n simpa\n rw [Subtype.dist_eq, Subtype.dist_eq, PiNat.dist_eq_of_ne (Subtype.coe_ne_coe.mpr h),\n PiNat.dist_eq_of_ne (Subtype.coe_ne_coe.mpr h')]\n simp only [show (1 / 2 : \u211d) = 2\u207b\u00b9 by simp, \u2190 pow_succ']\n congr\n simp only [val_cons, PiNat.firstDiff, ne_eq, Classical.dite_not, Subtype.coe_ne_coe.mpr h,\n not_false_eq_true, \u2193reduceDIte, val_eq_get]\n split_ifs with h_if\n \u00b7 contrapose! h'\n apply_fun Subtype.val using Subtype.val_injective\n simpa\n \u00b7 convert Nat.find_comp_succ _ _ _\n simp [Stream'.cons]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.Stream' (L95-L100)\ntheorem Stream'.dist_le_one (s t : Stream' \u03b1) : dist s t \u2264 1 := by\nby_cases h : s = t\n \u00b7 simp [h]\n rw [PiNat.dist_eq_of_ne h]\n bound\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.of_append_right (L56-L59)\ntheorem of_append_right {left right : Basis} (h : WellFormedBasis (left ++ right)) :\n WellFormedBasis right :=\nh.of_sublist (by simp)\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.const (L76-L84)\ntheorem const (h_tendsto : Tendsto b atTop atTop) {c : \u211d} :\n Majorized (fun _ \u21a6 c) b 0 := by\nintro exp h_exp\n apply Asymptotics.isLittleO_const_left.mpr\n right\n apply tendsto_norm_atTop_atTop.comp\n exact (tendsto_rpow_atTop h_exp).comp h_tendsto\n\n/-- The zero function is majorized with any exponent. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Lemmas.tendsto_nhdsNE_of_tendsto_atTop (L53-L58)\ntheorem tendsto_nhdsNE_of_tendsto_atTop (h_neg : Tendsto (fun x \u21a6 f (c - x\u207b\u00b9)) atTop l)\n (h_pos : Tendsto (fun x \u21a6 f (c + x\u207b\u00b9)) atTop l) :\n Tendsto f (\ud835\udcdd[\u2260] c) l := by\nsimpa [Tendsto, \u2190 nhdsLT_sup_nhdsGT] using\n \u27e8tendsto_nhdsLT_of_tendsto_atTop _ _ h_neg, tendsto_nhdsGT_of_tendsto_atTop _ _ h_pos\u27e9\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.gcorec_some (L286-L294)\ntheorem gcorec_some {F : \u03b2 \u2192 Option (\u03b1 \u00d7 \u03b3 \u00d7 \u03b2)} {op : \u03b3 \u2192 Seq \u03b1 \u2192 Seq \u03b1}\n [FriendlyOperationClass op] {b : \u03b2}\n {a : \u03b1} {c : \u03b3} {b' : \u03b2}\n (h : F b = some (a, c, b')) :\n gcorec F op b = Seq.cons a (op c (gcorec F op b')) := by\nhave := (FriendlyOperation.exists_fixed_point F op).choose_spec b\n simpa [h] using this\n\nend Tactic.ComputeAsymptotics.Seq\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.foo (L19-L33)\ndef foo (x : X) := hd x :: foo (tlArg x)\n```\n(where hd and tlArg are arbitrary functions) can be encoded via the corecursor `Seq.corec`.\n\nIt is not enough, however, to define multiplication and `powser` operation for multiseries.\n\nThis file implements a more general form of corecursion in the spirit of [blanchette2015].\nThis is a bare minimum that needed for the tactic, it justifies a weaker class of\ncorecursive definitions than [blanchette2015] does, and only works for `Seq`.\n\nA function `f : Seq \u03b1 \u2192 Seq \u03b1` is called *friendly* if for all `n : \u2115` the `n`-prefix of its result\n`f s` depends only on the `n`-prefix of its input `s`.\n\nIn this file we develop a theory that justifies corecursive definitions of the form\n```\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.tendsto_atTop (L123-L127)\ntheorem tendsto_atTop {basis : Basis} (h : WellFormedBasis basis) {f : \u211d \u2192 \u211d}\n (hf : f \u2208 basis) :\n Tendsto f atTop atTop := h.right f hf\n/-- Eventually all functions from a well-formed basis are positive. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.Majorized (L32-L39)\ndef Majorized (f b : \u211d \u2192 \u211d) (exp : \u211d) : Prop :=\n\u2200 exp' > exp, f =o[atTop] (b ^ exp')\n\nnamespace Majorized\n\nvariable {f g b : \u211d \u2192 \u211d} {exp : \u211d}\n\n/-- Replacing the first argument of `Majorized` by an eventually equal function preserves it. -/\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.tail (L52-L55)\ntheorem tail {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis}\n (h : WellFormedBasis (basis_hd :: basis_tl)) : WellFormedBasis basis_tl :=\nh.of_sublist (by simp)\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.mul_bounded (L118-L128)\ntheorem mul_bounded {f g basis_hd : \u211d \u2192 \u211d} {exp : \u211d} (hf : Majorized f basis_hd exp)\n (hg : g =O[atTop] (fun _ \u21a6 (1 : \u211d))) :\n Majorized (f * g) basis_hd exp := by\nintro exp h_exp\n convert IsLittleO.mul_isBigO (hf _ h_exp) hg using 1\n simp\n rfl\n\nend Majorized\n\nend Tactic.ComputeAsymptotics\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.dist_eq_one_of_head (L140-L150)\ntheorem dist_eq_one_of_head {s t : Seq \u03b1} (h : s.head \u2260 t.head) : dist s t = 1 := by\nrw [Subtype.dist_eq, PiNat.dist_eq_of_ne]\n \u00b7 convert pow_zero _\n simp only [PiNat.firstDiff, ne_eq, Classical.dite_not, dite_eq_left_iff,\n Nat.find_eq_zero]\n intro h'\n simpa [Stream'.cons]\n \u00b7 rw [Subtype.coe_ne_coe]\n contrapose! h\n simp [h]\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.single (L44-L46)\ntheorem single (f : \u211d \u2192 \u211d) (hf : Tendsto f atTop atTop) : WellFormedBasis [f] := by\nsimpa [WellFormedBasis]\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Lemmas.isBigOWith_of_tendsto_bot (L71-L75)\ntheorem isBigOWith_of_tendsto_bot {C : \u211d} {f g : \u211d \u2192 \u211d} {l : Filter \u211d}\n (h : Tendsto (fun x \u21a6 g x / f x) l atBot) (hC : 0 < C) :\n IsBigOWith C l f g :=\nAsymptotics.IsLittleO.forall_isBigOWith (.of_tendsto_div_atBot h) hC\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Lemmas.tendsto_nhdsLT_of_tendsto_atTop (L46-L52)\ntheorem tendsto_nhdsLT_of_tendsto_atTop (h : Tendsto (fun x \u21a6 f (c - x\u207b\u00b9)) atTop l) :\n Tendsto f (\ud835\udcdd[<] c) l := by\nconvert_to Tendsto (f \u2218 (fun x \u21a6 c + x) \u2218 Neg.neg \u2218 Inv.inv) atTop l at h\n \u00b7 ext\n simp [AddGroupWithOne.sub_eq_add_neg]\n simpa [Tendsto, \u2190 Filter.map_map] using h\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.mul (L104-L117)\ntheorem mul {f_exp g_exp : \u211d} (hf : Majorized f b f_exp)\n (hg : Majorized g b g_exp) (h_pos : \u2200\u1da0 t in atTop, 0 < b t) :\n Majorized (f * g) b (f_exp + g_exp) := by\nsimp only [Majorized] at *\n intro exp h_exp\n let \u03b5 := (exp - f_exp - g_exp) / 2\n specialize hf (f_exp + \u03b5) (by dsimp [\u03b5]; linarith)\n specialize hg (g_exp + \u03b5) (by dsimp [\u03b5]; linarith)\n apply (hf.mul hg).trans_eventuallyEq (g\u2081 := fun t \u21a6 b t ^ (f_exp + \u03b5) * b t ^ (g_exp + \u03b5))\n apply h_pos.mono\n intro t hx\n simp only [Pi.pow_apply]\n conv_rhs => rw [show exp = (f_exp + \u03b5) + (g_exp + \u03b5) by dsimp [\u03b5]; ring_nf, Real.rpow_add hx]\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.of_le (L65-L70)\ntheorem of_le {exp1 exp2 : \u211d} (h_lt : exp1 \u2264 exp2) (h : Majorized f b exp1) :\n Majorized f b exp2 := by\nsimp only [Majorized] at *\n exact fun exp' h_exp \u21a6 h _ (by linarith)\n\n/-- If `f` is majorized with a negative exponent, then it tends to zero. -/\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.dist_le_one (L102-L110)\ntheorem dist_le_one (s t : Seq \u03b1) : dist s t \u2264 1 := PiNat.dist_le_one _ _\nlocal instance : BoundedSpace (Stream' \u03b1) :=\n @PiNat.boundedSpace _ (fun _ \u21a6 \u22a5) (fun _ \u21a6 discreteTopology_bot _)\n\nlocal instance : BoundedSpace (Seq \u03b1) :=\n instBoundedSpaceSubtype\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.cons (L98-L104)\ntheorem cons {basis : Basis} {f : \u211d \u2192 \u211d} (h_basis : WellFormedBasis basis)\n (hf_tendsto : Tendsto f atTop atTop)\n (hf : \u2200 g \u2208 basis, (Real.log \u2218 g) =o[atTop] (Real.log \u2218 f)) :\n WellFormedBasis (f :: basis) := by\nchange WellFormedBasis ([f] ++ basis)\n exact append (by simpa [WellFormedBasis]) h_basis (by simpa)\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.dist_cons_nil (L157-L160)\ntheorem dist_cons_nil (x : \u03b1) (s : Seq \u03b1) : dist (cons x s) nil = 1 := by\napply dist_eq_one_of_head\n simp\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.tail_isLittleO_head (L143-L148)\ntheorem tail_isLittleO_head {hd : \u211d \u2192 \u211d} {tl : Basis}\n (h : WellFormedBasis (hd :: tl)) {f : \u211d \u2192 \u211d} (hf : f \u2208 tl) :\n (Real.log \u2218 f) =o[atTop] (Real.log \u2218 hd) := by\nrw [WellFormedBasis, List.pairwise_cons] at h\n exact h.left.left _ hf\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.nil (L42-L43)\ntheorem nil : WellFormedBasis [] := by simp [WellFormedBasis]\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Lemmas.tendsto_nhdsGT_of_tendsto_atTop (L42-L45)\ntheorem tendsto_nhdsGT_of_tendsto_atTop (h : Tendsto (fun x \u21a6 f (c + x\u207b\u00b9)) atTop l) :\n Tendsto f (\ud835\udcdd[>] c) l := by\nsimpa [\u2190 Function.comp_def, Tendsto, \u2190 Filter.map_map] using h\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Lemmas.tendsto_nhdsNE_of_tendsto_atTop_nhds_of_eq (L59-L65)\ntheorem tendsto_nhdsNE_of_tendsto_atTop_nhds_of_eq [TopologicalSpace \u03b1] {a b : \u03b1}\n (h_neg : Tendsto (fun x \u21a6 f (c - x\u207b\u00b9)) atTop (\ud835\udcdd a))\n (h_pos : Tendsto (fun x \u21a6 f (c + x\u207b\u00b9)) atTop (\ud835\udcdd b)) (h_eq : a = b) :\n Tendsto f (\ud835\udcdd[\u2260] c) (\ud835\udcdd a) := by\napply tendsto_nhdsNE_of_tendsto_atTop _ _ h_neg\n convert h_pos\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.of_eventuallyEq (L40-L46)\ntheorem of_eventuallyEq (h_eq : g =\u1da0[atTop] f) (h : Majorized f b exp) :\n Majorized g b exp := by\nsimp only [Majorized] at *\n intro exp' h_exp\n exact EventuallyEq.trans_isLittleO h_eq (h exp' h_exp)\n\n/-- For any function `f` tending to infinity, `f ^ exp` is majorized by `f` with exponent `exp`. -/\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.FriendlyOperationClass (L188-L191)\ntheorem FriendlyOperationClass.comp (F : \u03b3 \u2192 Seq \u03b1 \u2192 Seq \u03b1) (g : \u03b3' \u2192 \u03b3)\n [h : FriendlyOperationClass F] : FriendlyOperationClass (fun c \u21a6 F (g c)) := by\ngrind [FriendlyOperationClass]\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.zero (L85-L88)\ntheorem zero : Majorized 0 b exp :=\nfun _ _ \u21a6 Asymptotics.isLittleO_zero _ _\n\n/-- `c \u2022 f` is majorized with the same exponent as `f` for any constant `c`. -/\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.dist_nil_cons (L162-L167)\ntheorem dist_nil_cons (x : \u03b1) (s : Seq \u03b1) : dist nil (cons x s) = 1 := by\nrw [dist_comm]\n simp\n\n/-- A function on sequences is called a \"friend\" if any `n`-prefix of its output depends only on\nthe `n`-prefix of the input. Such functions can be used in the tail of (non-primitive) corecursive\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.compare_right_aux (L75-L88)\ntheorem compare_right_aux {basis : Basis} {f : \u211d \u2192 \u211d} (h : WellFormedBasis basis)\n (h_comp : \u2200 g, basis.head? = .some g \u2192 (Real.log \u2218 g) =o[atTop] (Real.log \u2218 f)) :\n \u2200 g \u2208 basis, (Real.log \u2218 g) =o[atTop] (Real.log \u2218 f) := by\nintro g hg\n cases basis with\n | nil => simp at hg\n | cons basis_hd basis_tl =>\n specialize h_comp basis_hd (by simp)\n simp only [List.mem_cons] at hg\n rcases hg with hg | hg\n \u00b7 simpa [hg]\n \u00b7 simp only [WellFormedBasis, List.pairwise_cons, List.mem_cons, forall_eq_or_imp] at h\n exact .trans (by grind) h_comp\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.self (L47-L64)\ntheorem self (h : Tendsto f atTop atTop) :\n Majorized (f ^ exp) f exp := by\nsimp only [Majorized]\n intro exp' h_exp\n apply (isLittleO_iff_tendsto' _).mpr\n \u00b7 have : (fun t \u21a6 f t ^ exp / f t ^ exp') =\u1da0[atTop] fun t \u21a6 (f t) ^ (exp - exp') :=\n (h.eventually_gt_atTop 0).mono (fun _ h \u21a6 by simp [\u2190 Real.rpow_sub h])\n apply Tendsto.congr' this.symm\n conv =>\n arg 1\n rw [show (fun t \u21a6 f t ^ (exp - exp')) = ((fun t \u21a6 t ^ (-(exp' - exp))) \u2218 f) by ext; simp]\n exact (tendsto_rpow_neg_atTop (by linarith)).comp h\n \u00b7 apply (Tendsto.eventually_gt_atTop h 0).mono\n intro t h1 h2\n absurd h2\n exact (Real.rpow_pos_of_pos h1 _).ne.symm\n\n/-- If `f` is majorized with exponent `exp\u2081`, then it is majorized with any `exp\u2082 \u2265 exp\u2081`. -/\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.dist_cons_cons_eq_one (L151-L155)\ntheorem dist_cons_cons_eq_one {x y : \u03b1} {s t : Seq \u03b1} (h : x \u2260 y) :\n dist (cons x s) (cons y t) = 1 := by\napply dist_eq_one_of_head\n simpa\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Lemmas.isBigO_of_div_tendsto_atBot (L81-L86)\ntheorem isBigO_of_div_tendsto_atBot {f g : \u211d \u2192 \u211d} {l : Filter \u211d}\n (h : Tendsto (fun x \u21a6 g x / f x) l atBot) :\n f =O[l] g :=\nAsymptotics.IsLittleO.isBigO (.of_tendsto_div_atBot h)\n\nend Tactic.ComputeAsymptotics\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.sublist_getBasis (L183-L189)\ntheorem sublist_getBasis {basis : Basis} {ex : BasisExtension basis} :\n List.Sublist basis ex.getBasis := by\ninduction ex with\n | nil => simp\n | keep _ ex ih => simpa [getBasis] using ih\n | insert _ ex ih => exact List.Sublist.cons _ ih\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.insert (L105-L115)\ntheorem insert {left right : Basis} {f : \u211d \u2192 \u211d}\n (h : WellFormedBasis (left ++ right)) (hf_tendsto : Tendsto f atTop atTop)\n (hf_comp_left : \u2200 g, left.getLast? = .some g \u2192 (Real.log \u2218 f) =o[atTop] (Real.log \u2218 g))\n (hf_comp_right : \u2200 g, right.head? = .some g \u2192 (Real.log \u2218 g) =o[atTop] (Real.log \u2218 f)) :\n WellFormedBasis (left ++ f :: right) := by\nhave : WellFormedBasis (f :: right) := cons (h.of_sublist (by simp)) hf_tendsto\n (compare_right_aux (h.of_sublist (by simp)) hf_comp_right)\n apply compare_left_aux (h.of_sublist (by simp)) at hf_comp_left\n apply append (h.of_sublist (by simp)) this\n exact fun g hg \u21a6 compare_right_aux this (by grind)\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.WellFormedBasis (L36-L41)\ndef WellFormedBasis (basis : Basis) : Prop :=\nbasis.Pairwise (fun x y => (Real.log \u2218 y) =o[atTop] (Real.log \u2218 x)) \u2227\n \u2200 f \u2208 basis, Tendsto f atTop atTop\n\nnamespace WellFormedBasis\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.getBasis (L177-L182)\ndef getBasis {basis : Basis} (ex : BasisExtension basis) : Basis :=\nmatch ex with\n | nil => []\n | keep basis_hd ex => basis_hd :: ex.getBasis\n | insert f ex => f :: ex.getBasis\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.push (L116-L122)\ntheorem push {basis : Basis} {f : \u211d \u2192 \u211d} (h : WellFormedBasis basis)\n (hf_tendsto : Tendsto f atTop atTop)\n (hf_comp : \u2200 g, basis.getLast? = .some g \u2192 (Real.log \u2218 f) =o[atTop] (Real.log \u2218 g)) :\n WellFormedBasis (basis ++ [f]) :=\ninsert (by simp [h]) hf_tendsto hf_comp (by simp)\n\n/-- All functions from a well-formed basis tend to `atTop`. -/\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.dist_eq_half_of_head (L135-L139)\ntheorem dist_eq_half_of_head {s t : Seq \u03b1} (h : s.head = t.head) :\n dist s t = 2\u207b\u00b9 * dist s.tail t.tail := by\ncases s <;> cases t <;> simp at h <;> simp [h]\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.Basis (L28-L35)\nabbrev Basis := List (\u211d \u2192 \u211d)\n/-- `WellFormedBasis basis` means that all functions from `basis` tend to `atTop`, and\n`basis` is sorted such that if\n`g` goes after `f` in `basis`, then `log f =o[atTop] log g`.\n\nWe use two types `Basis` and `WellFormedBasis` instead of a single bundled one because it\nit lets us to use the `List` API for `Basis`. -/\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.push_log_last (L149-L176)\ntheorem push_log_last {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis}\n (h_basis : WellFormedBasis (basis_hd :: basis_tl)) :\n WellFormedBasis ((basis_hd :: basis_tl) ++\n [Real.log \u2218 (basis_hd :: basis_tl).getLast (by simp)]) := by\napply h_basis.push\n \u00b7 simp [Real.tendsto_log_atTop.comp, h_basis.right]\n \u00b7 intro g hg\n simpa [List.getLast_of_getLast?_eq_some hg] using Real.isLittleO_log_id_atTop.comp_tendsto <|\n Real.tendsto_log_atTop.comp <| h_basis.tendsto_atTop <| List.mem_of_getLast? hg\n\nend WellFormedBasis\n\n/-! ### Basis extensions -/\n\n/-- The type of extensions of a given basis, defined as an inductive type.\nGiven a `basis : Basis` and `ex : BasisExtension basis` of it, one can use `getBasis` to produce a\nbasis `basis'` for which `basis <+ basis'`. Moreover, all such bases for which `basis` is a sublist\ncan be obtained in this manner. In this sense `BasisExtension` is a `Type`-valued analogue\nof `List.Sublist`. -/\ninductive BasisExtension : Basis \u2192 Type\n| nil : BasisExtension []\n| keep (basis_hd : \u211d \u2192 \u211d) {basis_tl : Basis} (ex : BasisExtension basis_tl) :\n BasisExtension (basis_hd :: basis_tl)\n| insert {basis : Basis} (f : \u211d \u2192 \u211d) (ex : BasisExtension basis) : BasisExtension basis\n\nnamespace BasisExtension\n\n/-- The basis after applying a basis extension. -/\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.dist_eq_two_inv_pow (L111-L115)\ntheorem dist_eq_two_inv_pow {s t : Seq \u03b1} (h : s \u2260 t) : \u2203 n, dist s t = 2\u207b\u00b9 ^ n := by\nrw [Subtype.dist_eq, PiNat.dist_eq_of_ne (Subtype.coe_ne_coe.mpr h)]\n simp\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.head_eventually_pos (L138-L142)\ntheorem head_eventually_pos {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis}\n (h : WellFormedBasis (basis_hd :: basis_tl)) : \u2200\u1da0 x in atTop, 0 < basis_hd x :=\n(forall_eventually_of_eventually_forall h.eventually_pos basis_hd).mono (by grind)\n\n/-- All functions in the tail of a well-formed basis are little-o of the basis' head. -/\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.append (L89-L97)\ntheorem append {left right : Basis}\n (h_left : WellFormedBasis left) (h_right : WellFormedBasis right)\n (h : \u2200 f \u2208 left, \u2200 g \u2208 right, (Real.log \u2218 g) =o[atTop] (Real.log \u2218 f)) :\n WellFormedBasis (left ++ right) := by\nsimp only [WellFormedBasis] at *\n constructor\n \u00b7 simpa [List.pairwise_append, h_left, h_right] using h\n \u00b7 grind\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.insert_tail_wellFormedBasis (L190-L198)\ntheorem insert_tail_wellFormedBasis {basis : Basis} {f : \u211d \u2192 \u211d}\n {ex_tl : BasisExtension basis}\n (h_basis : WellFormedBasis <| BasisExtension.getBasis (.insert f ex_tl)) :\n WellFormedBasis ex_tl.getBasis :=\nh_basis.of_sublist (by simp [getBasis])\n\nend BasisExtension\n\nend Tactic.ComputeAsymptotics\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.tendsto_zero_of_neg (L71-L75)\ntheorem tendsto_zero_of_neg (h_lt : exp < 0) (h : Majorized f b exp) :\n Tendsto f atTop (\ud835\udcdd 0) := by\nsimpa [Pi.pow_def, Majorized] using h 0 (by linarith)\n\n/-- Constants are majorized with exponent `exp = 0` by any functions which tends to infinity. -/\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.FriendlyOperation (L169-L174)\ndef FriendlyOperation (op : Seq \u03b1 \u2192 Seq \u03b1) : Prop := LipschitzWith 1 op\n/-- A family of friendly operations on sequences indexed by a type `\u03b3`. -/\nclass FriendlyOperationClass (F : \u03b3 \u2192 Seq \u03b1 \u2192 Seq \u03b1) : Prop where\n friend : \u2200 c : \u03b3, FriendlyOperation (F c)\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.smul (L89-L94)\ntheorem smul (h : Majorized f b exp) {c : \u211d} :\n Majorized (c \u2022 f) b exp :=\nfun exp h_exp \u21a6 (h exp h_exp).const_mul_left _\n\n/-- The sum of two functions that are majorized with exponents `f_exp` and `g_exp` is\nmajorized with exponent `exp` whenever `exp \u2265 max f_exp g_exp`. -/\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.compare_left_aux (L60-L74)\ntheorem compare_left_aux {basis : Basis} {f : \u211d \u2192 \u211d} (h : WellFormedBasis basis)\n (h_comp : \u2200 g, basis.getLast? = .some g \u2192 (Real.log \u2218 f) =o[atTop] (Real.log \u2218 g)) :\n \u2200 g \u2208 basis, (Real.log \u2218 f) =o[atTop] (Real.log \u2218 g) := by\nintro g hg\n rcases basis.eq_nil_or_concat with rfl | \u27e8basis_begin, basis_end, rfl\u27e9\n \u00b7 simp at hg\n simp only [List.concat_eq_append, List.mem_append, List.mem_cons, List.not_mem_nil, or_false,\n List.getLast?_append, List.getLast?_singleton, Option.some_or, Option.some.injEq,\n forall_eq'] at hg h_comp\n rcases hg with hg | hg\n \u00b7 simp only [WellFormedBasis, List.concat_eq_append, List.mem_append, List.mem_cons,\n List.not_mem_nil, or_false] at h\n exact h_comp.trans (by grind)\n \u00b7 grind\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.add (L95-L103)\ntheorem add {f_exp g_exp : \u211d} (hf : Majorized f b f_exp)\n (hg : Majorized g b g_exp) (hf_exp : f_exp \u2264 exp) (hg_exp : g_exp \u2264 exp) :\n Majorized (f + g) b exp := by\nsimp only [Majorized] at *\n intro exp' h_exp'\n exact (hf _ (by order)).add (hg _ (by order))\n\n/-- The product of two functions that are majorized with exponents `f_exp` and `g_exp` is\nmajorized with exponent `f_exp + g_exp`. -/\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.of_sublist (L47-L51)\ntheorem of_sublist {basis basis' : Basis} (h : List.Sublist basis basis')\n (h_basis : WellFormedBasis basis') : WellFormedBasis basis :=\n\u27e8h_basis.left.sublist h, fun _ hf \u21a6 h_basis.right _ (h.subset hf)\u27e9\n\n/-- The tail of a well-formed basis is well-formed. -/\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Lemmas.isBigO_of_div_tendsto_atTop (L76-L80)\ntheorem isBigO_of_div_tendsto_atTop {f g : \u211d \u2192 \u211d} {l : Filter \u211d}\n (h : Tendsto (fun x \u21a6 g x / f x) l atTop) :\n f =O[l] g :=\nAsymptotics.IsLittleO.isBigO (.of_tendsto_div_atTop h)\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.gcorec_nil (L279-L285)\ntheorem gcorec_nil {F : \u03b2 \u2192 Option (\u03b1 \u00d7 \u03b3 \u00d7 \u03b2)} {op : \u03b3 \u2192 Seq \u03b1 \u2192 Seq \u03b1}\n [FriendlyOperationClass op] {b : \u03b2}\n (h : F b = none) :\n gcorec F op b = nil := by\nhave := (FriendlyOperation.exists_fixed_point F op).choose_spec b\n simpa [h] using this\n```\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.ComputeAsymptotics.Multiseries.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 tail_cons {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} {exp : \u211d}\n {coef : MultiseriesExpansion basis_tl}\n {tl : Multiseries basis_hd basis_tl} :\n (cons exp coef tl).tail = tl\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.Basis (L44-L53)\nabbrev Basis := List (\u211d \u2192 \u211d)\n/-- Multiseries representing a given function `f : \u211d \u2192 \u211d`.\n`MultiseriesExpansion []` is just `\u211d`: multiseries representing constant functions.\nOtherwise it is a pair of a `Multiseries basis_hd basis_tl` and a function `\u211d \u2192 \u211d`. We call\nthe former an expansion of the latter.\n\nNote: most of the theory can be formulated in terms of `Multiseries`, but we need to explicitly\nstore the approximated function to be able to use the eventual zeroness oracle at the trimming step.\n-/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.MultiseriesExpansion (L54-L71)\ndef MultiseriesExpansion (basis : Basis) : Type :=\nmatch basis with\n | [] => \u211d\n | .cons _ basis_tl => Seq (\u211d \u00d7 MultiseriesExpansion basis_tl) \u00d7 (\u211d \u2192 \u211d)\n\nnamespace MultiseriesExpansion\n\nset_option linter.unusedVariables false in\n/-- Multiseries in a basis `basis_hd :: basis_tl`. It is a generalisation of asymptotic expansions.\nA multiseries in a basis `[b\u2081, ..., b\u2099]` is a formal series made from monomials\n`b\u2081 ^ e\u2081 * ... * b\u2099 ^ e\u2099` where `e\u2081, ..., e\u2099` are real numbers. We treat multivariate series in\na basis `[b\u2081, ..., b\u2099]` as a univariate series in the variable `b\u2081` (`basis_hd`) with coefficients\nbeing multiseries in the basis `[b\u2082, ..., b\u2099]` (`basis_tl`). We represent such a series as a lazy\nlist (`Seq`) of pairs `(exp, coef)` where `exp` is the exponent of `b\u2081` and `coef` is the\ncoefficient (a multiseries in `basis_tl`).\n\n`MultiseriesExpansion` is a `Multiseries` with an attached real function.\n-/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.Multiseries (L73-L78)\ndef Multiseries (basis_hd : \u211d \u2192 \u211d) (basis_tl : Basis) : Type :=\nSeq (\u211d \u00d7 MultiseriesExpansion basis_tl)\n\nnamespace Multiseries\n\n/-- Converts a `Multiseries basis_hd basis_tl` to a `Seq (\u211d \u00d7 MultiseriesExpansion basis_tl)`. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.toSeq (L79-L83)\ndef toSeq {basis_hd basis_tl} (ms : Multiseries basis_hd basis_tl) :\n Seq (\u211d \u00d7 MultiseriesExpansion basis_tl) :=\nms\n\n/-- The empty multiseries. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.nil (L84-L86)\ndef nil {basis_hd basis_tl} : Multiseries basis_hd basis_tl := Seq.nil\n/-- Prepend a monomial to a multiseries. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.cons (L87-L93)\ndef cons {basis_hd basis_tl} (exp : \u211d) (coef : MultiseriesExpansion basis_tl)\n (tl : Multiseries basis_hd basis_tl) :\n Multiseries basis_hd basis_tl :=\nSeq.cons (exp, coef) tl\n\n/-- Recursion principle for `Multiseries basis_hd basis_tl`. It is equivalent to\n`Stream'.Seq.recOn` but provides some convenience. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.recOn (L95-L101)\ndef recOn {basis_hd basis_tl} {motive : Multiseries basis_hd basis_tl \u2192 Sort*}\n (ms : Multiseries basis_hd basis_tl) (nil : motive nil)\n (cons : \u2200 exp coef (tl : Multiseries basis_hd basis_tl), motive (cons exp coef tl)) :\n motive ms := Stream'.Seq.recOn _ nil fun _ _ \u21a6 cons _ _ _\n/-- Destruct a multiseries into a triple `(exp, coef, tl)`, where `exp` is the leading exponent,\n`coef` is the leading coefficient, and `tl` is the tail. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.destruct (L102-L106)\ndef destruct {basis_hd basis_tl} (ms : Multiseries basis_hd basis_tl) :\n Option (\u211d \u00d7 MultiseriesExpansion basis_tl \u00d7 Multiseries basis_hd basis_tl) :=\n(Seq.destruct ms).map (fun ((exp, coef), tl) => (exp, coef, tl))\n\n/-- The head of a multiseries, i.e. the first two entries of the tuple returned by `destruct`. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.head (L107-L111)\ndef head {basis_hd basis_tl} (ms : Multiseries basis_hd basis_tl) :\n Option (\u211d \u00d7 MultiseriesExpansion basis_tl) :=\nSeq.head ms\n\n/-- The tail of a multiseries, i.e. the last entry of the tuple returned by `destruct`. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.tail (L112-L117)\ndef tail {basis_hd basis_tl} (ms : Multiseries basis_hd basis_tl) : Multiseries basis_hd basis_tl :=\nSeq.tail ms\n\n/-- Given two functions `f : \u211d \u2192 \u211d` and\n`g : MultiseriesExpansion basis_tl \u2192 MultiseriesExpansion basis_tl'`, apply them to exponents and\ncoefficients of a multiseries. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.map (L118-L124)\ndef map {basis_hd basis_tl basis_hd' basis_tl'} (f : \u211d \u2192 \u211d)\n (g : MultiseriesExpansion basis_tl \u2192 MultiseriesExpansion basis_tl')\n (ms : Multiseries basis_hd basis_tl) :\n Multiseries basis_hd' basis_tl' :=\nSeq.map (fun (exp, coef) \u21a6 (f exp, g coef)) ms\n\n/-- Corecursor for `Multiseries basis_hd basis_tl`. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.corec (L125-L136)\ndef corec {\u03b2 : Type*} {basis_hd} {basis_tl}\n (f : \u03b2 \u2192 Option (\u211d \u00d7 MultiseriesExpansion basis_tl \u00d7 \u03b2)) (b : \u03b2) :\n Multiseries basis_hd basis_tl :=\nSeq.corec (fun a => (f a).map (fun (exp, coef, next) => ((exp, coef), next))) b\n\nprivate lemma destruct_eq_destruct_map {basis_hd basis_tl}\n (s : Stream'.Seq (\u211d \u00d7 MultiseriesExpansion basis_tl)) :\n s.destruct = (Multiseries.destruct (basis_hd := basis_hd) s).map\n (fun (exp, coef, tl) => ((exp, coef), tl)) := by\n simp only [destruct, Option.map_map]\n exact Option.map_id_apply.symm\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.eq_of_bisim (L144-L151)\ntheorem eq_of_bisim {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} {x y : Multiseries basis_hd basis_tl}\n (motive : Multiseries basis_hd basis_tl \u2192 Multiseries basis_hd basis_tl \u2192 Prop)\n (base : motive x y)\n (step : \u2200 x y, motive x y \u2192 (x = .nil \u2227 y = .nil) \u2228 \u2203 exp coef,\n \u2203 (x' y' : Multiseries basis_hd basis_tl),\n x = cons exp coef x' \u2227 y = cons exp coef y' \u2227 motive x' y') :\n x = y := Seq.eq_of_bisim' motive base (by grind [nil, cons])\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.eq_of_bisim_strong (L152-L162)\ntheorem eq_of_bisim_strong {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis}\n {x y : Multiseries basis_hd basis_tl}\n (motive : Multiseries basis_hd basis_tl \u2192 Multiseries basis_hd basis_tl \u2192 Prop)\n (base : motive x y)\n (step : \u2200 x y, motive x y \u2192 (x = y) \u2228 \u2203 exp coef,\n \u2203 (x' y' : Multiseries basis_hd basis_tl),\n x = cons exp coef x' \u2227 y = cons exp coef y' \u2227 motive x' y') :\n x = y := Seq.eq_of_bisim_strong motive base (by grind [nil, cons])\nsection simp\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.cons_ne_nil (L164-L171)\ntheorem cons_ne_nil {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} {exp : \u211d}\n {coef : MultiseriesExpansion basis_tl}\n {tl : Multiseries basis_hd basis_tl} :\n cons exp coef tl \u2260 .nil := by\nintro h\n simp only [cons, nil] at h\n apply Seq.cons_ne_nil h\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.nil_ne_cons (L173-L178)\ntheorem nil_ne_cons {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} {exp : \u211d}\n {coef : MultiseriesExpansion basis_tl}\n {tl : Multiseries basis_hd basis_tl} :\n .nil \u2260 cons exp coef tl := cons_ne_nil.symm\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.cons_eq_cons (L180-L185)\ntheorem cons_eq_cons {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} {exp1 exp2 : \u211d}\n {coef1 coef2 : MultiseriesExpansion basis_tl} {tl1 tl2 : Multiseries basis_hd basis_tl} :\n cons exp1 coef1 tl1 = cons exp2 coef2 tl2 \u2194 exp1 = exp2 \u2227 coef1 = coef2 \u2227 tl1 = tl2 := by\nrw [cons, cons, Seq.cons_eq_cons]\n grind\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.corec_nil (L186-L192)\ntheorem corec_nil {\u03b2 : Type*} {basis_hd} {basis_tl}\n {f : \u03b2 \u2192 Option (\u211d \u00d7 MultiseriesExpansion basis_tl \u00d7 \u03b2)} {b : \u03b2} (h : f b = none) :\n corec f b = (nil : Multiseries basis_hd basis_tl) := by\nsimp only [corec, nil]\n rw [Seq.corec_nil]\n simpa\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.corec_cons (L193-L201)\ntheorem corec_cons {\u03b2 : Type*} {basis_hd} {basis_tl} {exp : \u211d}\n {coef : MultiseriesExpansion basis_tl} {next : \u03b2}\n {f : \u03b2 \u2192 Option (\u211d \u00d7 MultiseriesExpansion basis_tl \u00d7 \u03b2)} {b : \u03b2}\n (h : f b = some (exp, coef, next)) :\n (corec f b : Multiseries basis_hd basis_tl) = cons exp coef (corec f next) := by\nsimp only [corec, cons]\n rw [Seq.corec_cons]\n simpa\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.destruct_nil (L203-L207)\ntheorem destruct_nil {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} :\n destruct (nil : Multiseries basis_hd basis_tl) = none := by\nsimp [destruct, nil]\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.destruct_cons (L209-L214)\ntheorem destruct_cons {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} {exp : \u211d}\n {coef : MultiseriesExpansion basis_tl}\n {tl : Multiseries basis_hd basis_tl} :\n destruct (cons exp coef tl) = some (exp, coef, tl) := by\nsimp [destruct, cons]\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.destruct_eq_none (L215-L219)\ntheorem destruct_eq_none {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} {ms : Multiseries basis_hd basis_tl}\n (h : destruct ms = none) : ms = nil := by\napply Stream'.Seq.destruct_eq_none\n simpa [destruct] using h\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.destruct_eq_cons (L220-L226)\ntheorem destruct_eq_cons {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} {ms : Multiseries basis_hd basis_tl}\n {exp : \u211d} {coef : MultiseriesExpansion basis_tl} {tl : Multiseries basis_hd basis_tl}\n (h : destruct ms = some (exp, coef, tl)) : ms = cons exp coef tl := by\napply Stream'.Seq.destruct_eq_cons\n simp [destruct] at h\n grind\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.head_nil (L228-L231)\ntheorem head_nil {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} :\n (nil : Multiseries basis_hd basis_tl).head = none := by\nsimp [head, nil]\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.head_cons (L233-L238)\ntheorem head_cons {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis} {exp : \u211d}\n {coef : MultiseriesExpansion basis_tl}\n {tl : Multiseries basis_hd basis_tl} :\n (cons exp coef tl).head = some (exp, coef) := by\nsimp [head, cons]\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.eventually_pos (L128-L137)\ntheorem eventually_pos {basis : Basis} (h : WellFormedBasis basis) :\n \u2200\u1da0 x in atTop, \u2200 f \u2208 basis, 0 < f x := by\ninduction basis with\n | nil => simp\n | cons hd tl ih =>\n simp only [WellFormedBasis, List.pairwise_cons, List.mem_cons, forall_eq_or_imp] at h\n simp only [List.mem_cons, forall_eq_or_imp]\n exact (h.right.left.eventually <| eventually_gt_atTop 0).and (ih (by tauto))\n\n/-- The first function in a well-formed basis is eventually positive. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.exists_fixed_point_of_contractible (L207-L218)\ntheorem exists_fixed_point_of_contractible (F : (\u03b2 \u2192\u1d64 Seq \u03b1) \u2192 (\u03b2 \u2192\u1d64 Seq \u03b1))\n (h : LipschitzWith 2\u207b\u00b9 F) :\n \u2203 f : \u03b2 \u2192 Seq \u03b1, Function.IsFixedPt F f := by\nhave hF : ContractingWith 2\u207b\u00b9 F := by\n constructor\n \u00b7 norm_num\n \u00b7 exact h\n let f := hF.fixedPoint _\n use f\n exact hF.fixedPoint_isFixedPt\n\n/-- Main theorem of this file. It shows that there exists a function satisfying the corecursive\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Lemmas.isBigOWith_of_tendsto_top (L66-L70)\ntheorem isBigOWith_of_tendsto_top {C : \u211d} {f g : \u211d \u2192 \u211d} {l : Filter \u211d}\n (h : Tendsto (fun x \u21a6 g x / f x) l atTop) (hC : 0 < C) :\n IsBigOWith C l f g :=\nAsymptotics.IsLittleO.forall_isBigOWith (.of_tendsto_div_atTop h) hC\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.dist_cons_cons (L117-L134)\ntheorem dist_cons_cons (x : \u03b1) (s t : Seq \u03b1) : dist (cons x s) (cons x t) = 2\u207b\u00b9 * dist s t := by\nby_cases! h : s = t\n \u00b7 simp [h]\n have h' : cons x s \u2260 cons x t := by\n simpa\n rw [Subtype.dist_eq, Subtype.dist_eq, PiNat.dist_eq_of_ne (Subtype.coe_ne_coe.mpr h),\n PiNat.dist_eq_of_ne (Subtype.coe_ne_coe.mpr h')]\n simp only [show (1 / 2 : \u211d) = 2\u207b\u00b9 by simp, \u2190 pow_succ']\n congr\n simp only [val_cons, PiNat.firstDiff, ne_eq, Classical.dite_not, Subtype.coe_ne_coe.mpr h,\n not_false_eq_true, \u2193reduceDIte, val_eq_get]\n split_ifs with h_if\n \u00b7 contrapose! h'\n apply_fun Subtype.val using Subtype.val_injective\n simpa\n \u00b7 convert Nat.find_comp_succ _ _ _\n simp [Stream'.cons]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.Stream' (L95-L100)\ntheorem Stream'.dist_le_one (s t : Stream' \u03b1) : dist s t \u2264 1 := by\nby_cases h : s = t\n \u00b7 simp [h]\n rw [PiNat.dist_eq_of_ne h]\n bound\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.of_append_right (L56-L59)\ntheorem of_append_right {left right : Basis} (h : WellFormedBasis (left ++ right)) :\n WellFormedBasis right :=\nh.of_sublist (by simp)\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.const (L76-L84)\ntheorem const (h_tendsto : Tendsto b atTop atTop) {c : \u211d} :\n Majorized (fun _ \u21a6 c) b 0 := by\nintro exp h_exp\n apply Asymptotics.isLittleO_const_left.mpr\n right\n apply tendsto_norm_atTop_atTop.comp\n exact (tendsto_rpow_atTop h_exp).comp h_tendsto\n\n/-- The zero function is majorized with any exponent. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Lemmas.tendsto_nhdsNE_of_tendsto_atTop (L53-L58)\ntheorem tendsto_nhdsNE_of_tendsto_atTop (h_neg : Tendsto (fun x \u21a6 f (c - x\u207b\u00b9)) atTop l)\n (h_pos : Tendsto (fun x \u21a6 f (c + x\u207b\u00b9)) atTop l) :\n Tendsto f (\ud835\udcdd[\u2260] c) l := by\nsimpa [Tendsto, \u2190 nhdsLT_sup_nhdsGT] using\n \u27e8tendsto_nhdsLT_of_tendsto_atTop _ _ h_neg, tendsto_nhdsGT_of_tendsto_atTop _ _ h_pos\u27e9\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.gcorec_some (L286-L294)\ntheorem gcorec_some {F : \u03b2 \u2192 Option (\u03b1 \u00d7 \u03b3 \u00d7 \u03b2)} {op : \u03b3 \u2192 Seq \u03b1 \u2192 Seq \u03b1}\n [FriendlyOperationClass op] {b : \u03b2}\n {a : \u03b1} {c : \u03b3} {b' : \u03b2}\n (h : F b = some (a, c, b')) :\n gcorec F op b = Seq.cons a (op c (gcorec F op b')) := by\nhave := (FriendlyOperation.exists_fixed_point F op).choose_spec b\n simpa [h] using this\n\nend Tactic.ComputeAsymptotics.Seq\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.foo (L19-L33)\ndef foo (x : X) := hd x :: foo (tlArg x)\n```\n(where hd and tlArg are arbitrary functions) can be encoded via the corecursor `Seq.corec`.\n\nIt is not enough, however, to define multiplication and `powser` operation for multiseries.\n\nThis file implements a more general form of corecursion in the spirit of [blanchette2015].\nThis is a bare minimum that needed for the tactic, it justifies a weaker class of\ncorecursive definitions than [blanchette2015] does, and only works for `Seq`.\n\nA function `f : Seq \u03b1 \u2192 Seq \u03b1` is called *friendly* if for all `n : \u2115` the `n`-prefix of its result\n`f s` depends only on the `n`-prefix of its input `s`.\n\nIn this file we develop a theory that justifies corecursive definitions of the form\n```\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.tendsto_atTop (L123-L127)\ntheorem tendsto_atTop {basis : Basis} (h : WellFormedBasis basis) {f : \u211d \u2192 \u211d}\n (hf : f \u2208 basis) :\n Tendsto f atTop atTop := h.right f hf\n/-- Eventually all functions from a well-formed basis are positive. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.Majorized (L32-L39)\ndef Majorized (f b : \u211d \u2192 \u211d) (exp : \u211d) : Prop :=\n\u2200 exp' > exp, f =o[atTop] (b ^ exp')\n\nnamespace Majorized\n\nvariable {f g b : \u211d \u2192 \u211d} {exp : \u211d}\n\n/-- Replacing the first argument of `Majorized` by an eventually equal function preserves it. -/\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.tail (L52-L55)\ntheorem tail {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis}\n (h : WellFormedBasis (basis_hd :: basis_tl)) : WellFormedBasis basis_tl :=\nh.of_sublist (by simp)\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.mul_bounded (L118-L128)\ntheorem mul_bounded {f g basis_hd : \u211d \u2192 \u211d} {exp : \u211d} (hf : Majorized f basis_hd exp)\n (hg : g =O[atTop] (fun _ \u21a6 (1 : \u211d))) :\n Majorized (f * g) basis_hd exp := by\nintro exp h_exp\n convert IsLittleO.mul_isBigO (hf _ h_exp) hg using 1\n simp\n rfl\n\nend Majorized\n\nend Tactic.ComputeAsymptotics\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.dist_eq_one_of_head (L140-L150)\ntheorem dist_eq_one_of_head {s t : Seq \u03b1} (h : s.head \u2260 t.head) : dist s t = 1 := by\nrw [Subtype.dist_eq, PiNat.dist_eq_of_ne]\n \u00b7 convert pow_zero _\n simp only [PiNat.firstDiff, ne_eq, Classical.dite_not, dite_eq_left_iff,\n Nat.find_eq_zero]\n intro h'\n simpa [Stream'.cons]\n \u00b7 rw [Subtype.coe_ne_coe]\n contrapose! h\n simp [h]\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.single (L44-L46)\ntheorem single (f : \u211d \u2192 \u211d) (hf : Tendsto f atTop atTop) : WellFormedBasis [f] := by\nsimpa [WellFormedBasis]\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Lemmas.isBigOWith_of_tendsto_bot (L71-L75)\ntheorem isBigOWith_of_tendsto_bot {C : \u211d} {f g : \u211d \u2192 \u211d} {l : Filter \u211d}\n (h : Tendsto (fun x \u21a6 g x / f x) l atBot) (hC : 0 < C) :\n IsBigOWith C l f g :=\nAsymptotics.IsLittleO.forall_isBigOWith (.of_tendsto_div_atBot h) hC\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Lemmas.tendsto_nhdsLT_of_tendsto_atTop (L46-L52)\ntheorem tendsto_nhdsLT_of_tendsto_atTop (h : Tendsto (fun x \u21a6 f (c - x\u207b\u00b9)) atTop l) :\n Tendsto f (\ud835\udcdd[<] c) l := by\nconvert_to Tendsto (f \u2218 (fun x \u21a6 c + x) \u2218 Neg.neg \u2218 Inv.inv) atTop l at h\n \u00b7 ext\n simp [AddGroupWithOne.sub_eq_add_neg]\n simpa [Tendsto, \u2190 Filter.map_map] using h\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.mul (L104-L117)\ntheorem mul {f_exp g_exp : \u211d} (hf : Majorized f b f_exp)\n (hg : Majorized g b g_exp) (h_pos : \u2200\u1da0 t in atTop, 0 < b t) :\n Majorized (f * g) b (f_exp + g_exp) := by\nsimp only [Majorized] at *\n intro exp h_exp\n let \u03b5 := (exp - f_exp - g_exp) / 2\n specialize hf (f_exp + \u03b5) (by dsimp [\u03b5]; linarith)\n specialize hg (g_exp + \u03b5) (by dsimp [\u03b5]; linarith)\n apply (hf.mul hg).trans_eventuallyEq (g\u2081 := fun t \u21a6 b t ^ (f_exp + \u03b5) * b t ^ (g_exp + \u03b5))\n apply h_pos.mono\n intro t hx\n simp only [Pi.pow_apply]\n conv_rhs => rw [show exp = (f_exp + \u03b5) + (g_exp + \u03b5) by dsimp [\u03b5]; ring_nf, Real.rpow_add hx]\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.of_le (L65-L70)\ntheorem of_le {exp1 exp2 : \u211d} (h_lt : exp1 \u2264 exp2) (h : Majorized f b exp1) :\n Majorized f b exp2 := by\nsimp only [Majorized] at *\n exact fun exp' h_exp \u21a6 h _ (by linarith)\n\n/-- If `f` is majorized with a negative exponent, then it tends to zero. -/\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.dist_le_one (L102-L110)\ntheorem dist_le_one (s t : Seq \u03b1) : dist s t \u2264 1 := PiNat.dist_le_one _ _\nlocal instance : BoundedSpace (Stream' \u03b1) :=\n @PiNat.boundedSpace _ (fun _ \u21a6 \u22a5) (fun _ \u21a6 discreteTopology_bot _)\n\nlocal instance : BoundedSpace (Seq \u03b1) :=\n instBoundedSpaceSubtype\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.cons (L98-L104)\ntheorem cons {basis : Basis} {f : \u211d \u2192 \u211d} (h_basis : WellFormedBasis basis)\n (hf_tendsto : Tendsto f atTop atTop)\n (hf : \u2200 g \u2208 basis, (Real.log \u2218 g) =o[atTop] (Real.log \u2218 f)) :\n WellFormedBasis (f :: basis) := by\nchange WellFormedBasis ([f] ++ basis)\n exact append (by simpa [WellFormedBasis]) h_basis (by simpa)\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.dist_cons_nil (L157-L160)\ntheorem dist_cons_nil (x : \u03b1) (s : Seq \u03b1) : dist (cons x s) nil = 1 := by\napply dist_eq_one_of_head\n simp\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.tail_isLittleO_head (L143-L148)\ntheorem tail_isLittleO_head {hd : \u211d \u2192 \u211d} {tl : Basis}\n (h : WellFormedBasis (hd :: tl)) {f : \u211d \u2192 \u211d} (hf : f \u2208 tl) :\n (Real.log \u2218 f) =o[atTop] (Real.log \u2218 hd) := by\nrw [WellFormedBasis, List.pairwise_cons] at h\n exact h.left.left _ hf\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.nil (L42-L43)\ntheorem nil : WellFormedBasis [] := by simp [WellFormedBasis]\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Lemmas.tendsto_nhdsGT_of_tendsto_atTop (L42-L45)\ntheorem tendsto_nhdsGT_of_tendsto_atTop (h : Tendsto (fun x \u21a6 f (c + x\u207b\u00b9)) atTop l) :\n Tendsto f (\ud835\udcdd[>] c) l := by\nsimpa [\u2190 Function.comp_def, Tendsto, \u2190 Filter.map_map] using h\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Lemmas.tendsto_nhdsNE_of_tendsto_atTop_nhds_of_eq (L59-L65)\ntheorem tendsto_nhdsNE_of_tendsto_atTop_nhds_of_eq [TopologicalSpace \u03b1] {a b : \u03b1}\n (h_neg : Tendsto (fun x \u21a6 f (c - x\u207b\u00b9)) atTop (\ud835\udcdd a))\n (h_pos : Tendsto (fun x \u21a6 f (c + x\u207b\u00b9)) atTop (\ud835\udcdd b)) (h_eq : a = b) :\n Tendsto f (\ud835\udcdd[\u2260] c) (\ud835\udcdd a) := by\napply tendsto_nhdsNE_of_tendsto_atTop _ _ h_neg\n convert h_pos\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.of_eventuallyEq (L40-L46)\ntheorem of_eventuallyEq (h_eq : g =\u1da0[atTop] f) (h : Majorized f b exp) :\n Majorized g b exp := by\nsimp only [Majorized] at *\n intro exp' h_exp\n exact EventuallyEq.trans_isLittleO h_eq (h exp' h_exp)\n\n/-- For any function `f` tending to infinity, `f ^ exp` is majorized by `f` with exponent `exp`. -/\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.FriendlyOperationClass (L188-L191)\ntheorem FriendlyOperationClass.comp (F : \u03b3 \u2192 Seq \u03b1 \u2192 Seq \u03b1) (g : \u03b3' \u2192 \u03b3)\n [h : FriendlyOperationClass F] : FriendlyOperationClass (fun c \u21a6 F (g c)) := by\ngrind [FriendlyOperationClass]\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.zero (L85-L88)\ntheorem zero : Majorized 0 b exp :=\nfun _ _ \u21a6 Asymptotics.isLittleO_zero _ _\n\n/-- `c \u2022 f` is majorized with the same exponent as `f` for any constant `c`. -/\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.dist_nil_cons (L162-L167)\ntheorem dist_nil_cons (x : \u03b1) (s : Seq \u03b1) : dist nil (cons x s) = 1 := by\nrw [dist_comm]\n simp\n\n/-- A function on sequences is called a \"friend\" if any `n`-prefix of its output depends only on\nthe `n`-prefix of the input. Such functions can be used in the tail of (non-primitive) corecursive\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.compare_right_aux (L75-L88)\ntheorem compare_right_aux {basis : Basis} {f : \u211d \u2192 \u211d} (h : WellFormedBasis basis)\n (h_comp : \u2200 g, basis.head? = .some g \u2192 (Real.log \u2218 g) =o[atTop] (Real.log \u2218 f)) :\n \u2200 g \u2208 basis, (Real.log \u2218 g) =o[atTop] (Real.log \u2218 f) := by\nintro g hg\n cases basis with\n | nil => simp at hg\n | cons basis_hd basis_tl =>\n specialize h_comp basis_hd (by simp)\n simp only [List.mem_cons] at hg\n rcases hg with hg | hg\n \u00b7 simpa [hg]\n \u00b7 simp only [WellFormedBasis, List.pairwise_cons, List.mem_cons, forall_eq_or_imp] at h\n exact .trans (by grind) h_comp\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.self (L47-L64)\ntheorem self (h : Tendsto f atTop atTop) :\n Majorized (f ^ exp) f exp := by\nsimp only [Majorized]\n intro exp' h_exp\n apply (isLittleO_iff_tendsto' _).mpr\n \u00b7 have : (fun t \u21a6 f t ^ exp / f t ^ exp') =\u1da0[atTop] fun t \u21a6 (f t) ^ (exp - exp') :=\n (h.eventually_gt_atTop 0).mono (fun _ h \u21a6 by simp [\u2190 Real.rpow_sub h])\n apply Tendsto.congr' this.symm\n conv =>\n arg 1\n rw [show (fun t \u21a6 f t ^ (exp - exp')) = ((fun t \u21a6 t ^ (-(exp' - exp))) \u2218 f) by ext; simp]\n exact (tendsto_rpow_neg_atTop (by linarith)).comp h\n \u00b7 apply (Tendsto.eventually_gt_atTop h 0).mono\n intro t h1 h2\n absurd h2\n exact (Real.rpow_pos_of_pos h1 _).ne.symm\n\n/-- If `f` is majorized with exponent `exp\u2081`, then it is majorized with any `exp\u2082 \u2265 exp\u2081`. -/\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.dist_cons_cons_eq_one (L151-L155)\ntheorem dist_cons_cons_eq_one {x y : \u03b1} {s t : Seq \u03b1} (h : x \u2260 y) :\n dist (cons x s) (cons y t) = 1 := by\napply dist_eq_one_of_head\n simpa\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Lemmas.isBigO_of_div_tendsto_atBot (L81-L86)\ntheorem isBigO_of_div_tendsto_atBot {f g : \u211d \u2192 \u211d} {l : Filter \u211d}\n (h : Tendsto (fun x \u21a6 g x / f x) l atBot) :\n f =O[l] g :=\nAsymptotics.IsLittleO.isBigO (.of_tendsto_div_atBot h)\n\nend Tactic.ComputeAsymptotics\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.sublist_getBasis (L183-L189)\ntheorem sublist_getBasis {basis : Basis} {ex : BasisExtension basis} :\n List.Sublist basis ex.getBasis := by\ninduction ex with\n | nil => simp\n | keep _ ex ih => simpa [getBasis] using ih\n | insert _ ex ih => exact List.Sublist.cons _ ih\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.insert (L105-L115)\ntheorem insert {left right : Basis} {f : \u211d \u2192 \u211d}\n (h : WellFormedBasis (left ++ right)) (hf_tendsto : Tendsto f atTop atTop)\n (hf_comp_left : \u2200 g, left.getLast? = .some g \u2192 (Real.log \u2218 f) =o[atTop] (Real.log \u2218 g))\n (hf_comp_right : \u2200 g, right.head? = .some g \u2192 (Real.log \u2218 g) =o[atTop] (Real.log \u2218 f)) :\n WellFormedBasis (left ++ f :: right) := by\nhave : WellFormedBasis (f :: right) := cons (h.of_sublist (by simp)) hf_tendsto\n (compare_right_aux (h.of_sublist (by simp)) hf_comp_right)\n apply compare_left_aux (h.of_sublist (by simp)) at hf_comp_left\n apply append (h.of_sublist (by simp)) this\n exact fun g hg \u21a6 compare_right_aux this (by grind)\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.WellFormedBasis (L36-L41)\ndef WellFormedBasis (basis : Basis) : Prop :=\nbasis.Pairwise (fun x y => (Real.log \u2218 y) =o[atTop] (Real.log \u2218 x)) \u2227\n \u2200 f \u2208 basis, Tendsto f atTop atTop\n\nnamespace WellFormedBasis\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.getBasis (L177-L182)\ndef getBasis {basis : Basis} (ex : BasisExtension basis) : Basis :=\nmatch ex with\n | nil => []\n | keep basis_hd ex => basis_hd :: ex.getBasis\n | insert f ex => f :: ex.getBasis\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.push (L116-L122)\ntheorem push {basis : Basis} {f : \u211d \u2192 \u211d} (h : WellFormedBasis basis)\n (hf_tendsto : Tendsto f atTop atTop)\n (hf_comp : \u2200 g, basis.getLast? = .some g \u2192 (Real.log \u2218 f) =o[atTop] (Real.log \u2218 g)) :\n WellFormedBasis (basis ++ [f]) :=\ninsert (by simp [h]) hf_tendsto hf_comp (by simp)\n\n/-- All functions from a well-formed basis tend to `atTop`. -/\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.dist_eq_half_of_head (L135-L139)\ntheorem dist_eq_half_of_head {s t : Seq \u03b1} (h : s.head = t.head) :\n dist s t = 2\u207b\u00b9 * dist s.tail t.tail := by\ncases s <;> cases t <;> simp at h <;> simp [h]\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.Basis (L28-L35)\nabbrev Basis := List (\u211d \u2192 \u211d)\n/-- `WellFormedBasis basis` means that all functions from `basis` tend to `atTop`, and\n`basis` is sorted such that if\n`g` goes after `f` in `basis`, then `log f =o[atTop] log g`.\n\nWe use two types `Basis` and `WellFormedBasis` instead of a single bundled one because it\nit lets us to use the `List` API for `Basis`. -/\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.push_log_last (L149-L176)\ntheorem push_log_last {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis}\n (h_basis : WellFormedBasis (basis_hd :: basis_tl)) :\n WellFormedBasis ((basis_hd :: basis_tl) ++\n [Real.log \u2218 (basis_hd :: basis_tl).getLast (by simp)]) := by\napply h_basis.push\n \u00b7 simp [Real.tendsto_log_atTop.comp, h_basis.right]\n \u00b7 intro g hg\n simpa [List.getLast_of_getLast?_eq_some hg] using Real.isLittleO_log_id_atTop.comp_tendsto <|\n Real.tendsto_log_atTop.comp <| h_basis.tendsto_atTop <| List.mem_of_getLast? hg\n\nend WellFormedBasis\n\n/-! ### Basis extensions -/\n\n/-- The type of extensions of a given basis, defined as an inductive type.\nGiven a `basis : Basis` and `ex : BasisExtension basis` of it, one can use `getBasis` to produce a\nbasis `basis'` for which `basis <+ basis'`. Moreover, all such bases for which `basis` is a sublist\ncan be obtained in this manner. In this sense `BasisExtension` is a `Type`-valued analogue\nof `List.Sublist`. -/\ninductive BasisExtension : Basis \u2192 Type\n| nil : BasisExtension []\n| keep (basis_hd : \u211d \u2192 \u211d) {basis_tl : Basis} (ex : BasisExtension basis_tl) :\n BasisExtension (basis_hd :: basis_tl)\n| insert {basis : Basis} (f : \u211d \u2192 \u211d) (ex : BasisExtension basis) : BasisExtension basis\n\nnamespace BasisExtension\n\n/-- The basis after applying a basis extension. -/\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.dist_eq_two_inv_pow (L111-L115)\ntheorem dist_eq_two_inv_pow {s t : Seq \u03b1} (h : s \u2260 t) : \u2203 n, dist s t = 2\u207b\u00b9 ^ n := by\nrw [Subtype.dist_eq, PiNat.dist_eq_of_ne (Subtype.coe_ne_coe.mpr h)]\n simp\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.head_eventually_pos (L138-L142)\ntheorem head_eventually_pos {basis_hd : \u211d \u2192 \u211d} {basis_tl : Basis}\n (h : WellFormedBasis (basis_hd :: basis_tl)) : \u2200\u1da0 x in atTop, 0 < basis_hd x :=\n(forall_eventually_of_eventually_forall h.eventually_pos basis_hd).mono (by grind)\n\n/-- All functions in the tail of a well-formed basis are little-o of the basis' head. -/\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.append (L89-L97)\ntheorem append {left right : Basis}\n (h_left : WellFormedBasis left) (h_right : WellFormedBasis right)\n (h : \u2200 f \u2208 left, \u2200 g \u2208 right, (Real.log \u2218 g) =o[atTop] (Real.log \u2218 f)) :\n WellFormedBasis (left ++ right) := by\nsimp only [WellFormedBasis] at *\n constructor\n \u00b7 simpa [List.pairwise_append, h_left, h_right] using h\n \u00b7 grind\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.insert_tail_wellFormedBasis (L190-L198)\ntheorem insert_tail_wellFormedBasis {basis : Basis} {f : \u211d \u2192 \u211d}\n {ex_tl : BasisExtension basis}\n (h_basis : WellFormedBasis <| BasisExtension.getBasis (.insert f ex_tl)) :\n WellFormedBasis ex_tl.getBasis :=\nh_basis.of_sublist (by simp [getBasis])\n\nend BasisExtension\n\nend Tactic.ComputeAsymptotics\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.tendsto_zero_of_neg (L71-L75)\ntheorem tendsto_zero_of_neg (h_lt : exp < 0) (h : Majorized f b exp) :\n Tendsto f atTop (\ud835\udcdd 0) := by\nsimpa [Pi.pow_def, Majorized] using h 0 (by linarith)\n\n/-- Constants are majorized with exponent `exp = 0` by any functions which tends to infinity. -/\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.FriendlyOperation (L169-L174)\ndef FriendlyOperation (op : Seq \u03b1 \u2192 Seq \u03b1) : Prop := LipschitzWith 1 op\n/-- A family of friendly operations on sequences indexed by a type `\u03b3`. -/\nclass FriendlyOperationClass (F : \u03b3 \u2192 Seq \u03b1 \u2192 Seq \u03b1) : Prop where\n friend : \u2200 c : \u03b3, FriendlyOperation (F c)\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.smul (L89-L94)\ntheorem smul (h : Majorized f b exp) {c : \u211d} :\n Majorized (c \u2022 f) b exp :=\nfun exp h_exp \u21a6 (h exp h_exp).const_mul_left _\n\n/-- The sum of two functions that are majorized with exponents `f_exp` and `g_exp` is\nmajorized with exponent `exp` whenever `exp \u2265 max f_exp g_exp`. -/\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.compare_left_aux (L60-L74)\ntheorem compare_left_aux {basis : Basis} {f : \u211d \u2192 \u211d} (h : WellFormedBasis basis)\n (h_comp : \u2200 g, basis.getLast? = .some g \u2192 (Real.log \u2218 f) =o[atTop] (Real.log \u2218 g)) :\n \u2200 g \u2208 basis, (Real.log \u2218 f) =o[atTop] (Real.log \u2218 g) := by\nintro g hg\n rcases basis.eq_nil_or_concat with rfl | \u27e8basis_begin, basis_end, rfl\u27e9\n \u00b7 simp at hg\n simp only [List.concat_eq_append, List.mem_append, List.mem_cons, List.not_mem_nil, or_false,\n List.getLast?_append, List.getLast?_singleton, Option.some_or, Option.some.injEq,\n forall_eq'] at hg h_comp\n rcases hg with hg | hg\n \u00b7 simp only [WellFormedBasis, List.concat_eq_append, List.mem_append, List.mem_cons,\n List.not_mem_nil, or_false] at h\n exact h_comp.trans (by grind)\n \u00b7 grind\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized.add (L95-L103)\ntheorem add {f_exp g_exp : \u211d} (hf : Majorized f b f_exp)\n (hg : Majorized g b g_exp) (hf_exp : f_exp \u2264 exp) (hg_exp : g_exp \u2264 exp) :\n Majorized (f + g) b exp := by\nsimp only [Majorized] at *\n intro exp' h_exp'\n exact (hf _ (by order)).add (hg _ (by order))\n\n/-- The product of two functions that are majorized with exponents `f_exp` and `g_exp` is\nmajorized with exponent `f_exp + g_exp`. -/\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis.of_sublist (L47-L51)\ntheorem of_sublist {basis basis' : Basis} (h : List.Sublist basis basis')\n (h_basis : WellFormedBasis basis') : WellFormedBasis basis :=\n\u27e8h_basis.left.sublist h, fun _ hf \u21a6 h_basis.right _ (h.subset hf)\u27e9\n\n/-- The tail of a well-formed basis is well-formed. -/\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Lemmas.isBigO_of_div_tendsto_atTop (L76-L80)\ntheorem isBigO_of_div_tendsto_atTop {f g : \u211d \u2192 \u211d} {l : Filter \u211d}\n (h : Tendsto (fun x \u21a6 g x / f x) l atTop) :\n f =O[l] g :=\nAsymptotics.IsLittleO.isBigO (.of_tendsto_div_atTop h)\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.gcorec_nil (L279-L285)\ntheorem gcorec_nil {F : \u03b2 \u2192 Option (\u03b1 \u00d7 \u03b3 \u00d7 \u03b2)} {op : \u03b3 \u2192 Seq \u03b1 \u2192 Seq \u03b1}\n [FriendlyOperationClass op] {b : \u03b2}\n (h : F b = none) :\n gcorec F op b = nil := by\nhave := (FriendlyOperation.exists_fixed_point F op).choose_spec b\n simpa [h] using this\n```\n[/INST]", "sample_id": "C-Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.tail_cons", "source": {"declaration": "Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs.tail_cons", "file": "Mathlib/Tactic/ComputeAsymptotics/Multiseries/Defs.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/ComputeAsymptotics/Multiseries/Defs.lean#L245", "span": "L245-L250"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\ntheorem le_rearrange {\u03b1 : Type*} [AddCommGroup \u03b1] [PartialOrder \u03b1] [IsOrderedAddMonoid \u03b1]\n {a b : \u03b1} (h : a - b \u2264 0) : a \u2264 b := sub_nonpos.mp h\n```", "instruction": "Edit `le_rearrange` so it still compiles and the proof is simplified where possible. Return the full updated `le_rearrange` block.", "proof_is_oneliner": false, "target_span": "L184-L187", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 874, "declarations_count": 90, "diagnostics_count": 0, "duplicate_fingerprint": "c55e4f443596524e", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 285, "lean_code_chars": 147, "lean_code_ratio": 0.1682, "length_bucket": "tiny", "line_count": 11, "natural_language_chars": 727, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.LinearCombination.Lemmas).", "role": "system"}, {"content": "You are editing a file in `Mathlib/Tactic/LinearCombination/Lemmas.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Tactic.LinearCombination.Lemmas.le_rearrange`, L184-L187)\n```lean\ntheorem le_rearrange {\u03b1 : Type*} [AddCommGroup \u03b1] [PartialOrder \u03b1] [IsOrderedAddMonoid \u03b1]\n {a b : \u03b1} (h : a - b \u2264 0) : a \u2264 b := sub_nonpos.mp h\n```\n\n## Edit instruction\nEdit `le_rearrange` so it still compiles and the proof is simplified where possible. Return the full updated `le_rearrange` block.\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.LinearCombination.Lemmas).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Tactic/LinearCombination/Lemmas.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Tactic.LinearCombination.Lemmas.le_rearrange`, L184-L187)\n```lean\ntheorem le_rearrange {\u03b1 : Type*} [AddCommGroup \u03b1] [PartialOrder \u03b1] [IsOrderedAddMonoid \u03b1]\n {a b : \u03b1} (h : a - b \u2264 0) : a \u2264 b := sub_nonpos.mp h\n```\n\n## Edit instruction\nEdit `le_rearrange` so it still compiles and the proof is simplified where possible. Return the full updated `le_rearrange` block.\n[/INST]", "sample_id": "D-Mathlib.Tactic.LinearCombination.Lemmas.le_rearrange", "source": {"declaration": "Mathlib.Tactic.LinearCombination.Lemmas.le_rearrange", "file": "Mathlib/Tactic/LinearCombination/Lemmas.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.LinearCombination.Lemmas", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/LinearCombination/Lemmas.lean#L184", "span": "L184-L187"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.IsDynNetIn (L67-L69)\ndef IsDynNetIn (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) (s : Set X) : Prop :=\ns \u2286 F \u2227 s.PairwiseDisjoint fun x : X \u21a6 ball x (dynEntourage T U n)", "-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.IsDynNetIn (L70-L72)\nlemma IsDynNetIn.of_le (m_n : m \u2264 n) (h : IsDynNetIn T F U m s) : IsDynNetIn T F U n s :=\n\u27e8h.1, PairwiseDisjoint.mono h.2 fun x \u21a6 ball_mono (dynEntourage_antitone T U m_n) x\u27e9", "-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.IsDynNetIn (L73-L76)\nlemma IsDynNetIn.of_entourage_subset (U_V : U \u2286 V) (h : IsDynNetIn T F V n s) :\n IsDynNetIn T F U n s :=\n\u27e8h.1, PairwiseDisjoint.mono h.2 fun x \u21a6 ball_mono (dynEntourage_monotone T n U_V) x\u27e9", "-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.isDynNetIn_empty (L77-L78)\nlemma isDynNetIn_empty : IsDynNetIn T F U n \u2205 := \u27e8empty_subset F, pairwise_empty _\u27e9", "-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.isDynNetIn_singleton (L79-L85)\nlemma isDynNetIn_singleton (T : X \u2192 X) (U : SetRel X X) (n : \u2115) (h : x \u2208 F) :\n IsDynNetIn T F U n {x} :=\n\u27e8singleton_subset_iff.2 h, pairwise_singleton x _\u27e9\n\n/-- Given an entourage `U` and a time `n`, a dynamical net has a smaller cardinality than\n a dynamical cover. This lemma is the first of two key results to compare two versions of\n topological entropy: with cover and with nets, the second being `coverMincard_le_netMaxcard`. -/", "-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.IsDynNetIn (L86-L102)\nlemma IsDynNetIn.card_le_card_of_isDynCoverOf {s t : Finset X}\n (hs : IsDynNetIn T F U n s) (ht : IsDynCoverOf T F U n t) :\n s.card \u2264 t.card := by\nhave (x : X) (x_s : x \u2208 s) : \u2203 z \u2208 t, z \u2208 ball x (dynEntourage T U n) := by\n simpa using ht (hs.1 x_s)\n choose! F s_t using this\n apply Finset.card_le_card_of_injOn F fun x x_s \u21a6 (s_t x x_s).1\n exact fun x x_s y y_s Fx_Fy \u21a6\n PairwiseDisjoint.elim_set hs.2 x_s y_s (F x) (s_t x x_s).2 (Fx_Fy \u25b8 (s_t y y_s).2)\n\n/-! ### Maximal cardinality of dynamical nets -/\n\n/-- The largest cardinality of a `(U, n)`-dynamical net of `F`. Takes values in `\u2115\u221e`, and is\ninfinite if and only if `F` admits nets of arbitrarily large size. -/\nnoncomputable def netMaxcard (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) : \u2115\u221e :=\n \u2a06 (s : Finset X) (_ : IsDynNetIn T F U n s), (s.card : \u2115\u221e)", "-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.IsDynNetIn (L103-L106)\nlemma IsDynNetIn.card_le_netMaxcard {s : Finset X} (h : IsDynNetIn T F U n s) :\n s.card \u2264 netMaxcard T F U n :=\nle_iSup\u2082 (\u03b1 := \u2115\u221e) s h", "-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netMaxcard_monotone_time (L107-L110)\nlemma netMaxcard_monotone_time (T : X \u2192 X) (F : Set X) (U : SetRel X X) :\n Monotone fun n : \u2115 \u21a6 netMaxcard T F U n :=\nfun _ _ m_n \u21a6 biSup_mono fun _ h \u21a6 h.of_le m_n", "-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netMaxcard_antitone (L111-L115)\nlemma netMaxcard_antitone (T : X \u2192 X) (F : Set X) (n : \u2115) :\n Antitone fun U : SetRel X X \u21a6 netMaxcard T F U n :=\nfun _ _ U_V \u21a6 biSup_mono fun _ h \u21a6 h.of_entourage_subset U_V\n\nset_option backward.isDefEq.respectTransparency false in", "-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netMaxcard_finite_iff (L116-L150)\nlemma netMaxcard_finite_iff (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) :\n netMaxcard T F U n < \u22a4 \u2194\n \u2203 s : Finset X, IsDynNetIn T F U n s \u2227 (s.card : \u2115\u221e) = netMaxcard T F U n := by\napply Iff.intro <;> intro h\n \u00b7 obtain \u27e8k, k_max\u27e9 := WithTop.ne_top_iff_exists.1 h.ne\n rw [\u2190 k_max]\n simp only [ENat.some_eq_coe, Nat.cast_inj]\n -- The criterion we want to use is `Nat.sSup_mem`. We rewrite `netMaxcard` with an `sSup`,\n -- then check its `BddAbove` and `Nonempty` hypotheses.\n have : netMaxcard T F U n\n = sSup (WithTop.some '' (Finset.card '' {s : Finset X | IsDynNetIn T F U n s})) := by\n rw [netMaxcard, \u2190 image_comp, sSup_image]\n simp only [mem_setOf_eq, ENat.some_eq_coe, Function.comp_apply]\n rw [this] at k_max\n have h_bdda : BddAbove (Finset.card '' {s : Finset X | IsDynNetIn T F U n s}) := by\n refine \u27e8k, mem_upperBounds.2 ?_\u27e9\n simp only [mem_image, mem_setOf_eq, forall_exists_index, and_imp, forall_apply_eq_imp_iff\u2082]\n intro s h\n rw [\u2190 WithTop.coe_le_coe, k_max]\n apply le_sSup\n simp only [ENat.some_eq_coe, mem_image, mem_setOf_eq, Nat.cast_inj, exists_eq_right]\n exact Filter.frequently_principal.mp fun a \u21a6 a h rfl\n have h_nemp : (Finset.card '' {s : Finset X | IsDynNetIn T F U n s}).Nonempty := by\n refine \u27e80, ?_\u27e9\n simp only [mem_image, mem_setOf_eq, Finset.card_eq_zero, exists_eq_right, Finset.coe_empty]\n exact isDynNetIn_empty\n rw [\u2190 WithTop.coe_sSup' h_bdda, ENat.some_eq_coe, Nat.cast_inj] at k_max\n have key := Nat.sSup_mem h_nemp h_bdda\n rw [\u2190 k_max, mem_image] at key\n simp only [mem_setOf_eq] at key\n exact key\n \u00b7 obtain \u27e8s, _, s_card\u27e9 := h\n rw [\u2190 s_card]\n exact WithTop.coe_lt_top s.card", "-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netMaxcard_empty (L152-L158)\nlemma netMaxcard_empty : netMaxcard T \u2205 U n = 0 := by\nrw [netMaxcard, \u2190 bot_eq_zero, iSup\u2082_eq_bot]\n intro s s_net\n replace s_net := subset_empty_iff.1 s_net.1\n norm_cast at s_net\n rw [s_net, Finset.card_empty, CharP.cast_eq_zero, bot_eq_zero']", "-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netMaxcard_eq_zero_iff (L159-L169)\nlemma netMaxcard_eq_zero_iff (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) :\n netMaxcard T F U n = 0 \u2194 F = \u2205 := by\nrefine \u27e8fun h \u21a6 ?_, fun h \u21a6 by rw [h, netMaxcard_empty]\u27e9\n rw [eq_empty_iff_forall_notMem]\n intro x x_F\n have key := isDynNetIn_singleton T U n x_F\n rw [\u2190 Finset.coe_singleton] at key\n replace key := key.card_le_netMaxcard\n rw [Finset.card_singleton, Nat.cast_one, h] at key\n exact key.not_gt zero_lt_one", "-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.one_le_netMaxcard_iff (L170-L174)\nlemma one_le_netMaxcard_iff (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) :\n 1 \u2264 netMaxcard T F U n \u2194 F.Nonempty := by\nrw [ENat.one_le_iff_ne_zero, nonempty_iff_ne_empty]\n exact not_iff_not.2 (netMaxcard_eq_zero_iff T F U n)", "-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netMaxcard_zero (L175-L182)\nlemma netMaxcard_zero (T : X \u2192 X) (h : F.Nonempty) (U : SetRel X X) : netMaxcard T F U 0 = 1 := by\napply (iSup\u2082_le _).antisymm ((one_le_netMaxcard_iff T F U 0).2 h)\n intro s \u27e8_, s_net\u27e9\n simp only [ball, dynEntourage_zero, preimage_univ] at s_net\n norm_cast\n refine Finset.card_le_one.2 fun x x_s y y_s \u21a6 ?_\n exact PairwiseDisjoint.elim_set s_net x_s y_s x (mem_univ x) (mem_univ x)", "-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netMaxcard_univ (L183-L191)\nlemma netMaxcard_univ (T : X \u2192 X) (h : F.Nonempty) (n : \u2115) : netMaxcard T F univ n = 1 := by\napply (iSup\u2082_le _).antisymm ((one_le_netMaxcard_iff T F univ n).2 h)\n intro s \u27e8_, s_net\u27e9\n simp only [ball, dynEntourage_univ, preimage_univ] at s_net\n norm_cast\n refine Finset.card_le_one.2 fun x x_s y y_s \u21a6 ?_\n exact PairwiseDisjoint.elim_set s_net x_s y_s x (mem_univ x) (mem_univ x)\n\nset_option backward.isDefEq.respectTransparency false in", "-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netMaxcard_infinite_iff (L192-L207)\nlemma netMaxcard_infinite_iff (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) :\n netMaxcard T F U n = \u22a4 \u2194 \u2200 k : \u2115, \u2203 s : Finset X, IsDynNetIn T F U n s \u2227 k \u2264 s.card := by\napply Iff.intro <;> intro h\n \u00b7 intro k\n rw [netMaxcard, iSup_subtype', iSup_eq_top] at h\n specialize h k (ENat.coe_lt_top k)\n simp only [Nat.cast_lt, Subtype.exists, exists_prop] at h\n obtain \u27e8s, s_net, s_k\u27e9 := h\n exact \u27e8s, s_net, s_k.le\u27e9\n \u00b7 refine WithTop.eq_top_iff_forall_gt.2 fun k \u21a6 ?_\n specialize h (k + 1)\n obtain \u27e8s, s_net, s_card\u27e9 := h\n apply s_net.card_le_netMaxcard.trans_lt'\n rw [ENat.some_eq_coe, Nat.cast_lt]\n exact (lt_add_one k).trans_le s_card", "-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netMaxcard_le_coverMincard (L208-L218)\nlemma netMaxcard_le_coverMincard (T : X \u2192 X) (F : Set X) (n : \u2115) :\n netMaxcard T F U n \u2264 coverMincard T F U n := by\nrcases eq_top_or_lt_top (coverMincard T F U n) with h | h\n \u00b7 exact h \u25b8 le_top\n \u00b7 obtain \u27e8t, t_cover, t_mincard\u27e9 := (coverMincard_finite_iff T F U n).1 h\n rw [\u2190 t_mincard]\n exact iSup\u2082_le fun s s_net \u21a6 Nat.cast_le.2 (s_net.card_le_card_of_isDynCoverOf t_cover)\n\n/-- Given an entourage `U` and a time `n`, a minimal dynamical cover by `U \u25cb U` has a smaller\n cardinality than a maximal dynamical net by `U`. This lemma is the second of two key results to\n compare two versions topological entropy: with cover and with nets. -/", "-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.coverMincard_le_netMaxcard (L219-L261)\nlemma coverMincard_le_netMaxcard (T : X \u2192 X) (F : Set X) [U.IsRefl] [U.IsSymm] (n : \u2115) :\n coverMincard T F (U \u25cb U) n \u2264 netMaxcard T F U n := by\nclassical\n -- WLOG, there exists a maximal dynamical net `s`.\n rcases eq_top_or_lt_top (netMaxcard T F U n) with h | h\n \u00b7 exact h \u25b8 le_top\n obtain \u27e8s, s_net, s_card\u27e9 := (netMaxcard_finite_iff T F U n).1 h\n rw [\u2190 s_card]\n apply IsDynCoverOf.coverMincard_le_card\n -- We have to check that `s` is a cover for `dynEntourage T F (U \u25cb U) n`.\n -- If `s` is not a cover, then we can add to `s` a point `x` which is not covered\n -- and get a new net. This contradicts the maximality of `s`.\n rw [IsDynCoverOf, isCover_iff_subset_iUnion_ball]\n by_contra h\n obtain \u27e8x, x_F, x_uncov\u27e9 := not_subset.1 h\n simp only [Finset.mem_coe, mem_iUnion, exists_prop, not_exists, not_and] at x_uncov\n have larger_net : IsDynNetIn T F U n (insert x s) := by\n refine \u27e8insert_subset x_F s_net.1, pairwiseDisjoint_insert.2 \u27e8s_net.2, ?_\u27e9\u27e9\n refine fun y y_s _ \u21a6 disjoint_left.2 fun z z_x z_y \u21a6 x_uncov y y_s ?_\n exact mem_ball_dynEntourage_comp T n x y (nonempty_of_mem \u27e8z_x, z_y\u27e9)\n rw [\u2190 s.coe_insert x] at larger_net\n apply larger_net.card_le_netMaxcard.not_gt\n rw [\u2190 s_card, Nat.cast_lt]\n refine (lt_add_one s.card).trans_eq (s.card_insert_of_notMem fun x_s \u21a6 ?_).symm\n exact x_uncov x x_s (ball_mono (dynEntourage_monotone T n SetRel.left_subset_comp) x <|\n SetRel.rfl (dynEntourage T U n))\n\n/-! ### Net entropy of entourages -/\n\nopen ENNReal EReal ExpGrowth Filter\n\n/-- The entropy of an entourage `U`, defined as the exponential rate of growth of the size of the\nlargest `(U, n)`-dynamical net of `F`. Takes values in the space of extended real numbers\n`[-\u221e,+\u221e]`. This version uses a `limsup`, and is chosen as the default definition. -/\nnoncomputable def netEntropyEntourage (T : X \u2192 X) (F : Set X) (U : SetRel X X) :=\n expGrowthSup fun n : \u2115 \u21a6 netMaxcard T F U n\n\n/-- The entropy of an entourage `U`, defined as the exponential rate of growth of the size of the\nlargest `(U, n)`-dynamical net of `F`. Takes values in the space of extended real numbers\n`[-\u221e,+\u221e]`. This version uses a `liminf`, and is an alternative definition. -/\nnoncomputable def netEntropyInfEntourage (T : X \u2192 X) (F : Set X) (U : SetRel X X) :=\n expGrowthInf fun n : \u2115 \u21a6 netMaxcard T F U n", "-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netEntropyInfEntourage_antitone (L262-L265)\nlemma netEntropyInfEntourage_antitone (T : X \u2192 X) (F : Set X) :\n Antitone fun U : SetRel X X \u21a6 netEntropyInfEntourage T F U :=\nfun _ _ U_V \u21a6 expGrowthInf_monotone fun n \u21a6 ENat.toENNReal_mono (netMaxcard_antitone T F n U_V)", "-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netEntropyEntourage_antitone (L266-L269)\nlemma netEntropyEntourage_antitone (T : X \u2192 X) (F : Set X) :\n Antitone fun U : SetRel X X \u21a6 netEntropyEntourage T F U :=\nfun _ _ U_V \u21a6 expGrowthSup_monotone fun n \u21a6 ENat.toENNReal_mono (netMaxcard_antitone T F n U_V)", "-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netEntropyInfEntourage_le_netEntropyEntourage (L270-L273)\nlemma netEntropyInfEntourage_le_netEntropyEntourage (T : X \u2192 X) (F : Set X) (U : SetRel X X) :\n netEntropyInfEntourage T F U \u2264 netEntropyEntourage T F U :=\nexpGrowthInf_le_expGrowthSup", "-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netEntropyEntourage_empty (L275-L279)\nlemma netEntropyEntourage_empty : netEntropyEntourage T \u2205 U = \u22a5 := by\nrw [netEntropyEntourage, \u2190 expGrowthSup_zero]\n congr\n simp only [netMaxcard_empty, ENat.toENNReal_zero, Pi.zero_def]", "-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netEntropyInfEntourage_empty (L281-L283)\nlemma netEntropyInfEntourage_empty : netEntropyInfEntourage T \u2205 U = \u22a5 :=\neq_bot_mono (netEntropyInfEntourage_le_netEntropyEntourage T \u2205 U) netEntropyEntourage_empty", "-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netEntropyInfEntourage_nonneg (L284-L292)\nlemma netEntropyInfEntourage_nonneg (T : X \u2192 X) (h : F.Nonempty) (U : SetRel X X) :\n 0 \u2264 netEntropyInfEntourage T F U := by\napply Monotone.expGrowthInf_nonneg\n \u00b7 exact fun _ _ m_n \u21a6 ENat.toENNReal_mono (netMaxcard_monotone_time T F U m_n)\n \u00b7 rw [ne_eq, funext_iff.not, not_forall]\n use 0\n rw [netMaxcard_zero T h U, Pi.zero_apply, ENat.toENNReal_one]\n exact one_ne_zero", "-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netEntropyEntourage_nonneg (L293-L296)\nlemma netEntropyEntourage_nonneg (T : X \u2192 X) (h : F.Nonempty) (U : SetRel X X) :\n 0 \u2264 netEntropyEntourage T F U :=\n(netEntropyInfEntourage_nonneg T h U).trans (netEntropyInfEntourage_le_netEntropyEntourage T F U)", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_finite_of_isCompact_uniformContinuous (L290-L295)\nlemma coverMincard_finite_of_isCompact_uniformContinuous [UniformSpace X] (F_comp : IsCompact F)\n (h : UniformContinuous T) (U_uni : U \u2208 \ud835\udce4 X) (n : \u2115) :\n coverMincard T F U n < \u22a4 := by\nobtain \u27e8s, s_cover\u27e9 := exists_isDynCoverOf_of_isCompact_uniformContinuous F_comp h U_uni n\n exact s_cover.coverMincard_le_card.trans_lt (WithTop.coe_lt_top s.card)", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyEntourage_nonneg (L371-L375)\nlemma coverEntropyEntourage_nonneg (T : X \u2192 X) (h : F.Nonempty) (U : SetRel X X) :\n 0 \u2264 coverEntropyEntourage T F U :=\n(coverEntropyInfEntourage_nonneg T h U).trans\n (coverEntropyInfEntourage_le_coverEntropyEntourage T F U)", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.one_le_coverMincard_iff (L250-L254)\nlemma one_le_coverMincard_iff (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) :\n 1 \u2264 coverMincard T F U n \u2194 F.Nonempty := by\nrw [ENat.one_le_iff_ne_zero, nonempty_iff_ne_empty, not_iff_not]\n exact coverMincard_eq_zero_iff T F U n", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInf_empty (L486-L488)\nlemma coverEntropyInf_empty : coverEntropyInf T \u2205 = \u22a5 := by\nsimp only [coverEntropyInf, coverEntropyInfEntourage_empty, iSup_bot]", "-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.le_coverMincard_image (L93-L101)\nlemma le_coverMincard_image (h : Semiconj \u03c6 S T) (F : Set X) [V.IsSymm] (n : \u2115) :\n coverMincard S F ((map \u03c6 \u03c6) \u207b\u00b9' (V \u25cb V)) n \u2264 coverMincard T (\u03c6 '' F) V n := by\nrcases eq_top_or_lt_top (coverMincard T (\u03c6 '' F) V n) with h' | h'\n \u00b7 exact h' \u25b8 le_top\n obtain \u27e8t, t_cover, t_card\u27e9 := (coverMincard_finite_iff T (\u03c6 '' F) V n).1 h'\n obtain \u27e8s, s_cover, s_card\u27e9 := t_cover.preimage h\n rw [\u2190 t_card]\n exact s_cover.coverMincard_le_card.trans (WithTop.coe_le_coe.2 s_card)", "-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.dynEntourage_mem_uniformity (L65-L77)\nlemma dynEntourage_mem_uniformity [UniformSpace X] (h : UniformContinuous T)\n (U_uni : U \u2208 \ud835\udce4 X) (n : \u2115) :\n dynEntourage T U n \u2208 \ud835\udce4 X := by\nrw [dynEntourage_eq_inter_Ico T U n]\n induction n with\n | zero => simp\n | succ n ih =>\n simp only [iInter_coe_set, mem_Ico, Nat.zero_le, true_and] at ih \u22a2\n rw [Set.biInter_lt_succ]\n apply Filter.inter_mem ih\n rw [map_iterate T T n]\n exact uniformContinuous_def.1 (UniformContinuous.iterate T n h) U U_uni", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_monotone_time (L213-L216)\nlemma coverMincard_monotone_time (T : X \u2192 X) (F : Set X) (U : SetRel X X) :\n Monotone fun n : \u2115 \u21a6 coverMincard T F U n :=\nfun _ _ m_n \u21a6 biInf_mono fun _ h \u21a6 h.of_le m_n", "-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropy_restrict (L189-L193)\ntheorem coverEntropy_restrict [UniformSpace X] {T : X \u2192 X} {F : Set X} (h : MapsTo T F F) :\n coverEntropy (h.restrict T F F) univ = coverEntropy T F := by\nrw [\u2190 coverEntropy_restrict_subset Subset.rfl h, coe_preimage_self F]\n\n/-- The entropy of `\u03c6 '' F` is at most the entropy of `F` if `\u03c6` is uniformly continuous. -/", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropy_antitone (L442-L447)\nlemma coverEntropy_antitone (T : X \u2192 X) (F : Set X) :\n Antitone fun (u : UniformSpace X) \u21a6 @coverEntropy X u T F :=\nfun _ _ h \u21a6 iSup\u2082_mono' fun U U_uni \u21a6 \u27e8U, (le_def.1 h) U U_uni, le_refl _\u27e9\n\nvariable [UniformSpace X]", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInfEntourage_univ (L381-L385)\nlemma coverEntropyInfEntourage_univ (T : X \u2192 X) (h : F.Nonempty) :\n coverEntropyInfEntourage T F univ = 0 := by\nrw [\u2190 expGrowthInf_const one_ne_zero one_ne_top, coverEntropyInfEntourage]\n simp only [coverMincard_univ T h, ENat.toENNReal_one]", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyEntourage_le_coverEntropyInfEntourage (L407-L411)\nlemma coverEntropyEntourage_le_coverEntropyInfEntourage (F_inv : MapsTo T F F) [U.IsSymm] :\n coverEntropyEntourage T F (U \u25cb U) \u2264 coverEntropyInfEntourage T F U := by\nrefine (le_liminf_of_le) (eventually_atTop.2 \u27e81, fun m m_pos \u21a6 ?_\u27e9)\n exact coverEntropyEntourage_le_log_coverMincard_div F_inv (Nat.one_le_iff_ne_zero.1 m_pos)", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropy_eq_iSup_basis (L458-L466)\nlemma coverEntropy_eq_iSup_basis {\u03b9 : Sort*} {p : \u03b9 \u2192 Prop} {s : \u03b9 \u2192 SetRel X X}\n (h : (\ud835\udce4 X).HasBasis p s) (T : X \u2192 X) (F : Set X) :\n coverEntropy T F = \u2a06 (i : \u03b9) (_ : p i), coverEntropyEntourage T F (s i) := by\nrefine (iSup\u2082_le fun U U_uni \u21a6 ?_).antisymm\n (iSup\u2082_mono' fun i h_i \u21a6 \u27e8s i, HasBasis.mem_of_mem h h_i, le_refl _\u27e9)\n obtain \u27e8i, h_i, si_U\u27e9 := (HasBasis.mem_iff h).1 U_uni\n exact (coverEntropyEntourage_antitone T F si_U).trans\n (le_iSup\u2082 (f := fun (i : \u03b9) (_ : p i) \u21a6 coverEntropyEntourage T F (s i)) i h_i)", "-- Mathlib.Dynamics.TopologicalEntropy.Subset.IsDynCoverOf (L50-L53)\nlemma IsDynCoverOf.monotone_subset (F_G : F \u2286 G) (h : IsDynCoverOf T G U n s) :\n IsDynCoverOf T F U n s :=\nF_G.trans h", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.isDynCoverOf_zero (L94-L96)\nlemma isDynCoverOf_zero (T : X \u2192 X) (F : Set X) (U : SetRel X X) (h : s.Nonempty) :\n IsDynCoverOf T F U 0 s := by simp [IsDynCoverOf, h]", "-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.mem_ball_dynEntourage (L61-L64)\nlemma mem_ball_dynEntourage :\n y \u2208 ball x (dynEntourage T U n) \u2194 \u2200 k < n, T^[k] y \u2208 ball (T^[k] x) U := by\nsimp only [ball, mem_preimage, mem_dynEntourage]", "-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverMincard_image_le (L102-L114)\nlemma coverMincard_image_le (h : Semiconj \u03c6 S T) (F : Set X) (V : SetRel Y Y) (n : \u2115) :\n coverMincard T (\u03c6 '' F) V n \u2264 coverMincard S F ((map \u03c6 \u03c6) \u207b\u00b9' V) n := by\nclassical\n rcases eq_top_or_lt_top (coverMincard S F ((map \u03c6 \u03c6) \u207b\u00b9' V) n) with h' | h'\n \u00b7 exact h' \u25b8 le_top\n obtain \u27e8s, s_cover, s_card\u27e9 := (coverMincard_finite_iff S F ((map \u03c6 \u03c6) \u207b\u00b9' V) n).1 h'\n rw [\u2190 s_card]\n have := s_cover.image h\n rw [\u2190 s.coe_image] at this\n exact this.coverMincard_le_card.trans (WithTop.coe_le_coe.2 s.card_image_le)\n\nopen ENNReal EReal ExpGrowth Filter", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_eq_zero_iff (L246-L249)\nlemma coverMincard_eq_zero_iff (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) :\n coverMincard T F U n = 0 \u2194 F = \u2205 := by\nsimp [coverMincard, ENat.iInf_eq_zero]", "-- Mathlib.Dynamics.TopologicalEntropy.Subset.coverEntropyInfEntourage_monotone (L65-L69)\nlemma coverEntropyInfEntourage_monotone (T : X \u2192 X) (U : SetRel X X) :\n Monotone fun F : Set X \u21a6 coverEntropyInfEntourage T F U := by\nrefine fun F G F_G \u21a6 ExpGrowth.expGrowthInf_monotone fun n \u21a6 ?_\n exact ENat.toENNReal_mono (coverMincard_monotone_subset T U n F_G)", "-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropy_image_le_of_uniformContinuousOn_invariant (L208-L219)\nlemma coverEntropy_image_le_of_uniformContinuousOn_invariant [UniformSpace X] [UniformSpace Y]\n {S : X \u2192 X} {T : Y \u2192 Y} {\u03c6 : X \u2192 Y} (h : Semiconj \u03c6 S T) {F G : Set X}\n (h' : UniformContinuousOn \u03c6 G) (hF : F \u2286 G) (hG : MapsTo S G G) :\n coverEntropy T (\u03c6 '' F) \u2264 coverEntropy S F := by\nrw [\u2190 coverEntropy_restrict_subset hF hG]\n have h\u03c6 : Semiconj (G.restrict \u03c6) (hG.restrict S G G) T := by\n intro x\n rw [G.restrict_apply, G.restrict_apply, hG.val_restrict_apply, h.eq x]\n apply (coverEntropy_image_le_of_uniformContinuous h\u03c6\n (uniformContinuousOn_iff_restrict.1 h') (val \u207b\u00b9' F)).trans_eq'\n rw [\u2190 image_image_val_eq_restrict_image, image_preimage_coe G F, inter_eq_right.2 hF]", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.isDynCoverOf_univ (L97-L99)\nlemma isDynCoverOf_univ (T : X \u2192 X) (F : Set X) (n : \u2115) (h : s.Nonempty) :\n IsDynCoverOf T F univ n s := by simp [IsDynCoverOf, h]", "-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.isSymm_dynEntourage (L91-L94)\ninstance isSymm_dynEntourage [U.IsSymm] : (dynEntourage T U n).IsSymm := by\nsimp [dynEntourage]; infer_instance\n\nset_option linter.deprecated false in", "-- Mathlib.Dynamics.TopologicalEntropy.Subset.IsDynNetIn (L54-L56)\nlemma IsDynNetIn.monotone_subset (F_G : F \u2286 G) (h : IsDynNetIn T F U n s) : IsDynNetIn T G U n s :=\n\u27e8h.1.trans F_G, h.2\u27e9", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyEntourage_finite_of_isCompact_invariant (L412-L437)\nlemma coverEntropyEntourage_finite_of_isCompact_invariant [UniformSpace X]\n (F_comp : IsCompact F) (F_inv : MapsTo T F F) (U_uni : U \u2208 \ud835\udce4 X) :\n coverEntropyEntourage T F U < \u22a4 := by\nobtain \u27e8V, V_uni, V_symm, V_U\u27e9 := comp_symm_mem_uniformity_sets U_uni\n obtain \u27e8s, s_cover\u27e9 := exists_isDynCoverOf_of_isCompact_invariant F_comp F_inv V_uni 1\n apply (coverEntropyEntourage_antitone T F V_U).trans_lt\n apply (s_cover.coverEntropyEntourage_le_log_card_div F_inv one_ne_zero).trans_lt\n rw [Nat.cast_one, div_one, log_lt_top_iff, \u2190 ENat.toENNReal_top]\n exact_mod_cast (ENat.coe_ne_top (Finset.card s)).lt_top\n\n/-! ### Cover entropy -/\n\n/-- The entropy of `T` restricted to `F`, obtained by taking the supremum\n of `coverEntropyEntourage` over entourages. Note that this supremum is approached by taking small\n entourages. This first version uses a `limsup`, and is chosen as the default definition\n for topological entropy. -/\nnoncomputable def coverEntropy [UniformSpace X] (T : X \u2192 X) (F : Set X) :=\n \u2a06 U \u2208 \ud835\udce4 X, coverEntropyEntourage T F U\n\n/-- The entropy of `T` restricted to `F`, obtained by taking the supremum\n of `coverEntropyInfEntourage` over entourages. Note that this supremum is approached by taking\n small entourages. This second version uses a `liminf`, and is chosen as an alternative\n definition for topological entropy. -/\nnoncomputable def coverEntropyInf [UniformSpace X] (T : X \u2192 X) (F : Set X) :=\n \u2a06 U \u2208 \ud835\udce4 X, coverEntropyInfEntourage T F U", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInf_eq_coverEntropy (L496-L503)\nlemma coverEntropyInf_eq_coverEntropy (T : X \u2192 X) (h : MapsTo T F F) :\n coverEntropyInf T F = coverEntropy T F := by\nrefine le_antisymm (coverEntropyInf_le_coverEntropy T F) (iSup\u2082_le fun U U_uni \u21a6 ?_)\n obtain \u27e8V, V_uni, V_symm, V_U\u27e9 := comp_symm_mem_uniformity_sets U_uni\n exact (coverEntropyEntourage_antitone T F V_U).trans <| le_iSup\u2082_of_le V V_uni <|\n coverEntropyEntourage_le_coverEntropyInfEntourage h\n\nend Dynamics", "-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropy_restrict_subset (L175-L180)\nlemma coverEntropy_restrict_subset [UniformSpace X] {T : X \u2192 X} {F G : Set X} (hF : F \u2286 G)\n (hG : MapsTo T G G) :\n coverEntropy (hG.restrict T G G) (val \u207b\u00b9' F) = coverEntropy T F := by\nrw [\u2190 coverEntropy_image_of_comap _ hG.val_restrict_apply (val \u207b\u00b9' F), image_preimage_coe G F,\n inter_eq_right.2 hF]", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInf_le_coverEntropy (L476-L480)\nlemma coverEntropyInf_le_coverEntropy (T : X \u2192 X) (F : Set X) :\n coverEntropyInf T F \u2264 coverEntropy T F :=\niSup\u2082_mono fun (U : SetRel X X) (_ : U \u2208 \ud835\udce4 X) \u21a6\n coverEntropyInfEntourage_le_coverEntropyEntourage T F U", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_le_pow (L285-L289)\nlemma coverMincard_le_pow (F_inv : MapsTo T F F) [U.IsSymm] (m_pos : 0 < m) (n : \u2115) :\n coverMincard T F (U \u25cb U) n \u2264 coverMincard T F U m ^ (n / m + 1) :=\n(coverMincard_monotone_time T F (U \u25cb U) (Nat.lt_mul_div_succ n m_pos).le).trans\n (coverMincard_mul_le_pow F_inv m (n / m + 1))", "-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.isRefl_dynEntourage (L87-L90)\ninstance isRefl_dynEntourage [U.IsRefl] : (dynEntourage T U n).IsRefl := by\nsimp [dynEntourage]; infer_instance\n\nset_option linter.flexible false in -- simp followed by infer_instance", "-- Mathlib.Dynamics.TopologicalEntropy.Subset.coverMincard_monotone_subset (L57-L60)\nlemma coverMincard_monotone_subset (T : X \u2192 X) (U : SetRel X X) (n : \u2115) :\n Monotone fun F : Set X \u21a6 coverMincard T F U n :=\nfun _ _ F_G \u21a6 biInf_mono fun _ h \u21a6 h.monotone_subset F_G", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyEntourage_empty (L354-L357)\nlemma coverEntropyEntourage_empty : coverEntropyEntourage T \u2205 U = \u22a5 := by\nsimp only [coverEntropyEntourage, coverMincard_empty]\n rw [ENat.toENNReal_zero, \u2190 Pi.zero_def, expGrowthSup_zero]", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInf_antitone (L438-L441)\nlemma coverEntropyInf_antitone (T : X \u2192 X) (F : Set X) :\n Antitone fun (u : UniformSpace X) \u21a6 @coverEntropyInf X u T F :=\nfun _ _ h \u21a6 iSup\u2082_mono' fun U U_uni \u21a6 \u27e8U, (le_def.1 h) U U_uni, le_refl _\u27e9", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.IsDynCoverOf (L78-L80)\ndef IsDynCoverOf (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) (s : Set X) : Prop :=\nIsCover (dynEntourage T U n) F s", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInf_eq_iSup_basis (L467-L475)\nlemma coverEntropyInf_eq_iSup_basis {\u03b9 : Sort*} {p : \u03b9 \u2192 Prop} {s : \u03b9 \u2192 SetRel X X}\n (h : (\ud835\udce4 X).HasBasis p s) (T : X \u2192 X) (F : Set X) :\n coverEntropyInf T F = \u2a06 (i : \u03b9) (_ : p i), coverEntropyInfEntourage T F (s i) := by\nrefine (iSup\u2082_le fun U U_uni \u21a6 ?_).antisymm\n (iSup\u2082_mono' fun i h_i \u21a6 \u27e8s i, HasBasis.mem_of_mem h h_i, le_refl _\u27e9)\n obtain \u27e8i, h_i, si_U\u27e9 := (HasBasis.mem_iff h).1 U_uni\n exact (coverEntropyInfEntourage_antitone T F si_U).trans\n (le_iSup\u2082 (f := fun (i : \u03b9) (_ : p i) \u21a6 coverEntropyInfEntourage T F (s i)) i h_i)", "-- Mathlib.Dynamics.TopologicalEntropy.Subset.coverEntropyEntourage_monotone (L70-L74)\nlemma coverEntropyEntourage_monotone (T : X \u2192 X) (U : SetRel X X) :\n Monotone fun F : Set X \u21a6 coverEntropyEntourage T F U := by\nrefine fun F G F_G \u21a6 ExpGrowth.expGrowthSup_monotone fun n \u21a6 ?_\n exact ENat.toENNReal_mono (coverMincard_monotone_subset T U n F_G)", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.nonempty_inter_of_coverMincard (L305-L340)\nlemma nonempty_inter_of_coverMincard [U.IsSymm] {s : Finset X} (h : IsDynCoverOf T F U n s)\n (h' : #s = coverMincard T F U n) :\n \u2200 x \u2208 s, (F \u2229 ball x (dynEntourage T U n)).Nonempty := by\n-- Otherwise, there is a ball which does not intersect `F`. Removing it yields a smaller cover.\n classical\n by_contra! \u27e8x, x_s, ball_empt\u27e9\n have smaller_cover : IsDynCoverOf T F U n (s.erase x) := by\n intro y y_F\n specialize h y_F\n simp only [s.mem_coe] at h\n simp only [s.coe_erase, mem_diff, s.mem_coe, mem_singleton_iff]\n obtain \u27e8z, z_s, hz\u27e9 := h\n refine \u27e8z, \u27e8z_s, fun z_x \u21a6 notMem_empty y ?_\u27e9, hz\u27e9\n rw [\u2190 ball_empt]\n rw [z_x] at hz\n exact mem_inter y_F <| (dynEntourage T U n).symm hz\n apply smaller_cover.coverMincard_le_card.not_gt\n rw [\u2190 h']\n exact_mod_cast s.card_erase_lt_of_mem x_s\n\n/-! ### Cover entropy of entourages -/\n\nopen ENNReal EReal ExpGrowth Filter\n\n/-- The entropy of an entourage `U`, defined as the exponential rate of growth of the size\n of the smallest `(U, n)`-refined cover of `F`. Takes values in the space of extended real numbers\n `[-\u221e, +\u221e]`. This first version uses a `limsup`, and is chosen as the default definition. -/\nnoncomputable def coverEntropyEntourage (T : X \u2192 X) (F : Set X) (U : SetRel X X) :=\n expGrowthSup fun n : \u2115 \u21a6 coverMincard T F U n\n\n/-- The entropy of an entourage `U`, defined as the exponential rate of growth of the size\n of the smallest `(U, n)`-refined cover of `F`. Takes values in the space of extended real numbers\n `[-\u221e, +\u221e]`. This second version uses a `liminf`, and is chosen as an alternative definition. -/\nnoncomputable def coverEntropyInfEntourage (T : X \u2192 X) (F : Set X) (U : SetRel X X) :=\n expGrowthInf fun n : \u2115 \u21a6 coverMincard T F U n", "-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.dynEntourage_antitone (L130-L133)\nlemma dynEntourage_antitone (T : X \u2192 X) (U : SetRel X X) :\n Antitone (fun n : \u2115 \u21a6 dynEntourage T U n) :=\nfun m n m_n \u21a6 iInter\u2082_mono' fun k k_m \u21a6 by use k, lt_of_lt_of_le k_m m_n", "-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropyInf_image_of_comap (L154-L174)\ntheorem coverEntropyInf_image_of_comap (u : UniformSpace Y) {S : X \u2192 X} {T : Y \u2192 Y} {\u03c6 : X \u2192 Y}\n (h : Semiconj \u03c6 S T) (F : Set X) :\n coverEntropyInf T (\u03c6 '' F) = @coverEntropyInf X (comap \u03c6 u) S F := by\nlet : UniformSpace X := comap \u03c6 u\n apply le_antisymm\n \u00b7 refine iSup\u2082_le fun V V_uni \u21a6\n (coverEntropyInfEntourage_antitone _ _ SetRel.symmetrize_subset_self).trans <|\n (coverEntropyInfEntourage_image_le h F _).trans ?_\n apply coverEntropyInfEntourage_le_coverEntropyInf\n rw [uniformity_comap \u03c6, mem_comap]\n exact \u27e8_, symmetrize_mem_uniformity V_uni, .rfl\u27e9\n \u00b7 refine iSup\u2082_le fun U U_uni \u21a6 ?_\n simp only [uniformity_comap \u03c6, mem_comap] at U_uni\n obtain \u27e8V, V_uni, V_sub\u27e9 := U_uni\n obtain \u27e8W, W_uni, W_symm, W_V\u27e9 := comp_symm_mem_uniformity_sets V_uni\n apply (coverEntropyInfEntourage_antitone S F ((preimage_mono W_V).trans V_sub)).trans\n apply (le_coverEntropyInfEntourage_image h F).trans\n exact coverEntropyInfEntourage_le_coverEntropyInf T (\u03c6 '' F) W_uni\n\nopen Subtype", "-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.dynEntourage_eq_inter_Ico (L54-L57)\nlemma dynEntourage_eq_inter_Ico (T : X \u2192 X) (U : SetRel X X) (n : \u2115) :\n dynEntourage T U n = \u22c2 k : Ico 0 n, (map T T)^[k] \u207b\u00b9' U := by\nsimp [dynEntourage]", "-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropyInfEntourage_image_le (L127-L132)\nlemma coverEntropyInfEntourage_image_le (h : Semiconj \u03c6 S T) (F : Set X) (V : SetRel Y Y) :\n coverEntropyInfEntourage T (\u03c6 '' F) V \u2264 coverEntropyInfEntourage S F ((map \u03c6 \u03c6) \u207b\u00b9' V) :=\nexpGrowthInf_monotone fun n \u21a6 ENat.toENNReal_mono (coverMincard_image_le h F V n)\n\n/-- The entropy of `\u03c6 '' F` equals the entropy of `F` if `X` is endowed with the pullback by `\u03c6`\n of the uniform structure of `Y`. -/", "-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropyInf_image_le_of_uniformContinuous (L202-L207)\ntheorem coverEntropyInf_image_le_of_uniformContinuous [UniformSpace X] [UniformSpace Y] {S : X \u2192 X}\n {T : Y \u2192 Y} {\u03c6 : X \u2192 Y} (h : Semiconj \u03c6 S T) (h' : UniformContinuous \u03c6) (F : Set X) :\n coverEntropyInf T (\u03c6 '' F) \u2264 coverEntropyInf S F := by\nrw [coverEntropyInf_image_of_comap _ h F]\n exact coverEntropyInf_antitone S F (uniformContinuous_iff.1 h')", "-- Mathlib.Dynamics.TopologicalEntropy.Subset.netMaxcard_monotone_subset (L61-L64)\nlemma netMaxcard_monotone_subset (T : X \u2192 X) (U : SetRel X X) (n : \u2115) :\n Monotone fun F : Set X \u21a6 netMaxcard T F U n :=\nfun _ _ F_G \u21a6 biSup_mono fun _ h \u21a6 h.monotone_subset F_G", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_empty (L243-L245)\nlemma coverMincard_empty : coverMincard T \u2205 U n = 0 :=\n(sInf_le (by simp [IsDynCoverOf])).antisymm (zero_le (coverMincard T \u2205 U n))", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyEntourage_antitone (L345-L348)\nlemma coverEntropyEntourage_antitone (T : X \u2192 X) (F : Set X) :\n Antitone fun U : SetRel X X \u21a6 coverEntropyEntourage T F U :=\nfun _ _ U_V \u21a6 expGrowthSup_monotone fun n \u21a6 ENat.toENNReal_mono (coverMincard_antitone T F n U_V)", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyEntourage_le_coverEntropy (L448-L452)\nlemma coverEntropyEntourage_le_coverEntropy (T : X \u2192 X) (F : Set X)\n (h : U \u2208 \ud835\udce4 X) :\n coverEntropyEntourage T F U \u2264 coverEntropy T F :=\nle_iSup\u2082 (f := fun (U : SetRel X X) (_ : U \u2208 \ud835\udce4 X) \u21a6 coverEntropyEntourage T F U) U h", "-- Mathlib.Dynamics.TopologicalEntropy.Subset.netEntropyInfEntourage_monotone (L75-L79)\nlemma netEntropyInfEntourage_monotone (T : X \u2192 X) (U : SetRel X X) :\n Monotone fun F : Set X \u21a6 netEntropyInfEntourage T F U := by\nrefine fun F G F_G \u21a6 ExpGrowth.expGrowthInf_monotone fun n \u21a6 ?_\n exact ENat.toENNReal_mono (netMaxcard_monotone_subset T U n F_G)", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.exists_isDynCoverOf_of_isCompact_invariant (L191-L208)\nlemma exists_isDynCoverOf_of_isCompact_invariant [UniformSpace X]\n (F_comp : IsCompact F) (F_inv : MapsTo T F F) (U_uni : U \u2208 \ud835\udce4 X) (n : \u2115) :\n \u2203 s : Finset X, IsDynCoverOf T F U n s := by\nobtain \u27e8(V : SetRel X X), V_uni, V_symm, V_U\u27e9 := comp_symm_mem_uniformity_sets U_uni\n obtain \u27e8s, _, s_cover\u27e9 := F_comp.elim_nhds_subcover (ball \u00b7 V)\n fun (x : X) _ \u21a6 ball_mem_nhds x V_uni\n have : IsDynCoverOf T F V 1 s := .of_subset_iUnion_ball <| by simpa using s_cover\n obtain \u27e8t, t_dyncover, t_card\u27e9 := this.iterate_le_pow F_inv n\n rw [one_mul n] at t_dyncover\n exact \u27e8t, t_dyncover.of_entourage_subset V_U\u27e9\n\n/-! ### Minimal cardinality of dynamical covers -/\n\n/-- The smallest cardinality of a `(U, n)`-dynamical cover of `F`. Takes values in `\u2115\u221e`, and is\n infinite if and only if `F` admits no finite dynamical cover. -/\nnoncomputable def coverMincard (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) : \u2115\u221e :=\n \u2a05 (s : Finset X) (_ : IsDynCoverOf T F U n s), (s.card : \u2115\u221e)", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyEntourage_le_log_coverMincard_div (L386-L399)\nlemma coverEntropyEntourage_le_log_coverMincard_div (F_inv : MapsTo T F F) [U.IsSymm]\n (n_pos : n \u2260 0) :\n coverEntropyEntourage T F (U \u25cb U) \u2264 log (coverMincard T F U n) / n := by\nhave cv_mono : Monotone fun m \u21a6 (coverMincard T F (U \u25cb U) m).toENNReal :=\n fun _ _ k_m \u21a6 ENat.toENNReal_mono (coverMincard_monotone_time T F (U \u25cb U) k_m)\n have h := cv_mono.expGrowthSup_comp_mul n_pos\n rw [mul_comm, \u2190 div_eq_iff (natCast_ne_bot n) (natCast_ne_top n) (Nat.cast_ne_zero.2 n_pos)] at h\n rw [coverEntropyEntourage, \u2190 h]\n apply monotone_div_right_of_nonneg n.cast_nonneg'\n rw [\u2190 expGrowthSup_pow]\n refine expGrowthSup_monotone fun m \u21a6 ?_\n rw [\u2190 ENat.toENNReal_pow]\n exact ENat.toENNReal_mono (coverMincard_mul_le_pow F_inv n m)", "-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropyInf_image_le_of_uniformContinuousOn_invariant (L220-L232)\nlemma coverEntropyInf_image_le_of_uniformContinuousOn_invariant [UniformSpace X] [UniformSpace Y]\n {S : X \u2192 X} {T : Y \u2192 Y} {\u03c6 : X \u2192 Y} (h : Semiconj \u03c6 S T) {F G : Set X}\n (h' : UniformContinuousOn \u03c6 G) (hF : F \u2286 G) (hG : MapsTo S G G) :\n coverEntropyInf T (\u03c6 '' F) \u2264 coverEntropyInf S F := by\nrw [\u2190 coverEntropyInf_restrict_subset hF hG]\n have h\u03c6 : Semiconj (G.restrict \u03c6) (hG.restrict S G G) T := by\n intro a\n rw [G.restrict_apply, G.restrict_apply, hG.val_restrict_apply, h.eq a]\n apply (coverEntropyInf_image_le_of_uniformContinuous h\u03c6\n (uniformContinuousOn_iff_restrict.1 h') (val \u207b\u00b9' F)).trans_eq'\n rw [\u2190 image_image_val_eq_restrict_image, image_preimage_coe G F, inter_eq_right.2 hF]\n\nend Dynamics", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropy_nonneg (L493-L495)\nlemma coverEntropy_nonneg (T : X \u2192 X) (h : F.Nonempty) : 0 \u2264 coverEntropy T F :=\n(coverEntropyInf_nonneg T h).trans (coverEntropyInf_le_coverEntropy T F)", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_antitone (L217-L221)\nlemma coverMincard_antitone (T : X \u2192 X) (F : Set X) (n : \u2115) :\n Antitone fun U : SetRel X X \u21a6 coverMincard T F U n :=\nfun _ _ U_V \u21a6 biInf_mono fun _ h \u21a6 h.of_entourage_subset U_V\n\nset_option backward.isDefEq.respectTransparency false in", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_mul_le_pow (L272-L284)\nlemma coverMincard_mul_le_pow (F_inv : MapsTo T F F) [U.IsSymm] (m n : \u2115) :\n coverMincard T F (U \u25cb U) (m * n) \u2264 coverMincard T F U m ^ n := by\nrcases F.eq_empty_or_nonempty with rfl | F_nonempty\n \u00b7 rw [coverMincard_empty]; exact zero_le _\n obtain rfl | hn := eq_or_ne n 0\n \u00b7 rw [mul_zero, coverMincard_zero T F_nonempty (U \u25cb U), pow_zero]\n rcases eq_top_or_lt_top (coverMincard T F U m) with h | h\n \u00b7 simp [*]\n \u00b7 obtain \u27e8s, s_cover, s_coverMincard\u27e9 := (coverMincard_finite_iff T F U m).1 h\n obtain \u27e8t, t_cover, t_sn\u27e9 := s_cover.iterate_le_pow F_inv n\n rw [\u2190 s_coverMincard]\n exact t_cover.coverMincard_le_card.trans (WithTop.coe_le_coe.2 t_sn)", "-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.le_coverEntropyInfEntourage_image (L119-L122)\nlemma le_coverEntropyInfEntourage_image (h : Semiconj \u03c6 S T) (F : Set X) [V.IsSymm] :\n coverEntropyInfEntourage S F ((map \u03c6 \u03c6) \u207b\u00b9' (V \u25cb V)) \u2264 coverEntropyInfEntourage T (\u03c6 '' F) V :=\nexpGrowthInf_monotone fun n \u21a6 ENat.toENNReal_mono (le_coverMincard_image h F n)", "-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.le_coverEntropyEntourage_image (L115-L118)\nlemma le_coverEntropyEntourage_image (h : Semiconj \u03c6 S T) (F : Set X) [V.IsSymm] :\n coverEntropyEntourage S F ((map \u03c6 \u03c6) \u207b\u00b9' (V \u25cb V)) \u2264 coverEntropyEntourage T (\u03c6 '' F) V :=\nexpGrowthSup_monotone fun n \u21a6 ENat.toENNReal_mono (le_coverMincard_image h F n)", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInfEntourage_le_coverEntropyInf (L453-L457)\nlemma coverEntropyInfEntourage_le_coverEntropyInf (T : X \u2192 X) (F : Set X)\n (h : U \u2208 \ud835\udce4 X) :\n coverEntropyInfEntourage T F U \u2264 coverEntropyInf T F :=\nle_iSup\u2082 (f := fun (U : SetRel X X) (_ : U \u2208 \ud835\udce4 X) \u21a6 coverEntropyInfEntourage T F U) U h", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_finite_iff (L222-L241)\nlemma coverMincard_finite_iff (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) :\n coverMincard T F U n < \u22a4 \u2194\n \u2203 s : Finset X, IsDynCoverOf T F U n s \u2227 s.card = coverMincard T F U n := by\nrefine \u27e8fun h_fin \u21a6 ?_, fun \u27e8s, _, s_coverMincard\u27e9 \u21a6 s_coverMincard \u25b8 WithTop.coe_lt_top s.card\u27e9\n obtain \u27e8k, k_min\u27e9 := WithTop.ne_top_iff_exists.1 h_fin.ne\n rw [\u2190 k_min]\n simp only [ENat.some_eq_coe, Nat.cast_inj]\n have : Nonempty {s : Finset X // IsDynCoverOf T F U n s} := by\n by_contra h\n apply ENat.coe_ne_top k\n rw [\u2190 ENat.some_eq_coe, k_min, coverMincard, iInf\u2082_eq_top]\n simp only [ENat.coe_ne_top, imp_false]\n rw [nonempty_subtype, not_exists] at h\n exact h\n have key := ciInf_mem fun s : {s : Finset X // IsDynCoverOf T F U n s} \u21a6 (s.val.card : \u2115\u221e)\n rw [coverMincard, iInf_subtype'] at k_min\n rw [\u2190 k_min, mem_range, Subtype.exists] at key\n simp only [ENat.some_eq_coe, Nat.cast_inj, exists_prop] at key\n exact key", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_zero (L255-L263)\nlemma coverMincard_zero (T : X \u2192 X) (h : F.Nonempty) (U : SetRel X X) :\n coverMincard T F U 0 = 1 := by\napply le_antisymm _ ((one_le_coverMincard_iff T F U 0).2 h)\n obtain \u27e8x, _\u27e9 := h\n have := isDynCoverOf_zero T F U (singleton_nonempty x)\n rw [\u2190 Finset.coe_singleton] at this\n apply this.coverMincard_le_card.trans_eq\n rw [Finset.card_singleton, Nat.cast_one]", "-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.dynEntourage (L51-L53)\ndef dynEntourage (T : X \u2192 X) (U : SetRel X X) (n : \u2115) : SetRel X X :=\n\u22c2 k < n, (map T T)^[k] \u207b\u00b9' U", "-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropyEntourage_image_le (L123-L126)\nlemma coverEntropyEntourage_image_le (h : Semiconj \u03c6 S T) (F : Set X) (V : SetRel Y Y) :\n coverEntropyEntourage T (\u03c6 '' F) V \u2264 coverEntropyEntourage S F ((map \u03c6 \u03c6) \u207b\u00b9' V) :=\nexpGrowthSup_monotone fun n \u21a6 ENat.toENNReal_mono (coverMincard_image_le h F V n)", "-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.dynEntourage_monotone (L126-L129)\nlemma dynEntourage_monotone (T : X \u2192 X) (n : \u2115) :\n Monotone (fun U : SetRel X X \u21a6 dynEntourage T U n) :=\nfun _ _ h \u21a6 iInter\u2082_mono fun _ _ \u21a6 preimage_mono h", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_finite_of_isCompact_invariant (L296-L304)\nlemma coverMincard_finite_of_isCompact_invariant [UniformSpace X] (F_comp : IsCompact F)\n (F_inv : MapsTo T F F) (U_uni : U \u2208 \ud835\udce4 X) (n : \u2115) :\n coverMincard T F U n < \u22a4 := by\nobtain \u27e8s, s_cover\u27e9 := exists_isDynCoverOf_of_isCompact_invariant F_comp F_inv U_uni n\n exact s_cover.coverMincard_le_card.trans_lt (WithTop.coe_lt_top s.card)\n\n/-- All dynamical balls of a minimal dynamical cover of `F` intersect `F`. This lemma is the key\n to relate Bowen-Dinaburg's definition of topological entropy with covers and their definition\n of topological entropy with nets. -/", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInf_nonneg (L489-L492)\nlemma coverEntropyInf_nonneg (T : X \u2192 X) (h : F.Nonempty) : 0 \u2264 coverEntropyInf T F :=\n(coverEntropyInfEntourage_le_coverEntropyInf T F univ_mem).trans_eq'\n (coverEntropyInfEntourage_univ T h)", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInfEntourage_antitone (L341-L344)\nlemma coverEntropyInfEntourage_antitone (T : X \u2192 X) (F : Set X) :\n Antitone fun U : SetRel X X \u21a6 coverEntropyInfEntourage T F U :=\nfun _ _ U_V \u21a6 expGrowthInf_monotone fun n \u21a6 ENat.toENNReal_mono (coverMincard_antitone T F n U_V)", "-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.ball_dynEntourage_mem_nhds (L78-L86)\nlemma ball_dynEntourage_mem_nhds [UniformSpace X] (h : Continuous T)\n (U_uni : U \u2208 \ud835\udce4 X) (n : \u2115) (x : X) :\n ball x (dynEntourage T U n) \u2208 \ud835\udcdd x := by\nrw [dynEntourage_eq_inter_Ico T U n, ball_iInter, Filter.iInter_mem, Subtype.forall]\n intro k _\n simp only [map_iterate, _root_.ball_preimage]\n exact (h.iterate k).continuousAt.preimage_mem_nhds (ball_mem_nhds (T^[k] x) U_uni)\n\nset_option linter.flexible false in -- simp followed by infer_instance", "-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.dynEntourage_univ (L142-L144)\nlemma dynEntourage_univ {T : X \u2192 X} {n : \u2115} :\n dynEntourage T univ n = univ := by simp [dynEntourage]", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.exists_isDynCoverOf_of_isCompact_uniformContinuous (L182-L190)\nlemma exists_isDynCoverOf_of_isCompact_uniformContinuous [UniformSpace X]\n (F_comp : IsCompact F) (h : UniformContinuous T) (U_uni : U \u2208 \ud835\udce4 X) (n : \u2115) :\n \u2203 s : Finset X, IsDynCoverOf T F U n s := by\nobtain \u27e8(V : SetRel X X), hV, hVsymm, hVU\u27e9 := symm_of_uniformity U_uni\n have uni_ite := dynEntourage_mem_uniformity h hV n\n let openCover x := ball x (dynEntourage T V n)\n obtain \u27e8s, _, s_cover\u27e9 := F_comp.elim_nhds_subcover openCover fun x _ \u21a6 ball_mem_nhds x uni_ite\n exact \u27e8s, .of_entourage_subset hVU <| .of_subset_iUnion_ball s_cover\u27e9", "-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.mem_ball_dynEntourage_comp (L145-L151)\nlemma mem_ball_dynEntourage_comp (T : X \u2192 X) (n : \u2115) {U : SetRel X X} [U.IsSymm]\n (x y : X) (h : (ball x (dynEntourage T U n) \u2229 ball y (dynEntourage T U n)).Nonempty) :\n x \u2208 ball y (dynEntourage T (U \u25cb U) n) := by\nrcases h with \u27e8z, z_Bx, z_By\u27e9\n rw [mem_ball_symmetry] at z_Bx\n exact dynEntourage_comp_subset T U U n (mem_ball_comp z_By z_Bx)", "-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropyInf_restrict_subset (L181-L187)\nlemma coverEntropyInf_restrict_subset [UniformSpace X] {T : X \u2192 X} {F G : Set X} (hF : F \u2286 G)\n (hG : MapsTo T G G) :\n coverEntropyInf (hG.restrict T G G) (val \u207b\u00b9' F) = coverEntropyInf T F := by\nrw [\u2190 coverEntropyInf_image_of_comap _ hG.val_restrict_apply (val \u207b\u00b9' F), image_preimage_coe G F,\n inter_eq_right.2 hF]\n\n/-- The entropy of the restriction of `T` to an invariant set `F` is `coverEntropy T F`. This", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInfEntourage_empty (L359-L361)\nlemma coverEntropyInfEntourage_empty : coverEntropyInfEntourage T \u2205 U = \u22a5 :=\neq_bot_mono (coverEntropyInfEntourage_le_coverEntropyEntourage T \u2205 U) coverEntropyEntourage_empty", "-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.dynEntourage_mono (L135-L137)\nlemma dynEntourage_mono (hUV : U \u2286 V) (hmn : m \u2264 n) : dynEntourage T U n \u2286 dynEntourage T V m :=\n(dynEntourage_monotone _ _ hUV).trans (dynEntourage_antitone _ _ hmn)", "-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropy_image_of_comap (L133-L153)\ntheorem coverEntropy_image_of_comap (u : UniformSpace Y) {S : X \u2192 X} {T : Y \u2192 Y} {\u03c6 : X \u2192 Y}\n (h : Semiconj \u03c6 S T) (F : Set X) :\n coverEntropy T (\u03c6 '' F) = @coverEntropy X (comap \u03c6 u) S F := by\nlet : UniformSpace X := comap \u03c6 u\n apply le_antisymm\n \u00b7 refine iSup\u2082_le fun V V_uni \u21a6\n (coverEntropyEntourage_antitone _ _ SetRel.symmetrize_subset_self).trans <|\n (coverEntropyEntourage_image_le h F _).trans ?_\n apply coverEntropyEntourage_le_coverEntropy\n rw [uniformity_comap \u03c6, mem_comap]\n exact \u27e8_, symmetrize_mem_uniformity V_uni, .rfl\u27e9\n \u00b7 refine iSup\u2082_le fun U U_uni \u21a6 ?_\n simp only [uniformity_comap \u03c6, mem_comap] at U_uni\n obtain \u27e8V, V_uni, V_sub\u27e9 := U_uni\n obtain \u27e8W, W_uni, W_symm, W_V\u27e9 := comp_symm_mem_uniformity_sets V_uni\n apply (coverEntropyEntourage_antitone S F ((preimage_mono W_V).trans V_sub)).trans\n apply (le_coverEntropyEntourage_image h F).trans\n exact coverEntropyEntourage_le_coverEntropy T (\u03c6 '' F) W_uni\n\n/-- The entropy of `\u03c6 '' F` equals the entropy of `F` if `X` is endowed with the pullback by `\u03c6`\n of the uniform structure of `Y`. This version uses a `liminf`. -/", "-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.mem_dynEntourage (L58-L60)\nlemma mem_dynEntourage : (x, y) \u2208 dynEntourage T U n \u2194 \u2200 k < n, (T^[k] x, T^[k] y) \u2208 U := by\nsimp [dynEntourage]", "-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.IsDynCoverOf (L65-L71)\nlemma IsDynCoverOf.image (h : Semiconj \u03c6 S T) (h' : IsDynCoverOf S F (map \u03c6 \u03c6 \u207b\u00b9' V) n s) :\n IsDynCoverOf T (\u03c6 '' F) V n (\u03c6 '' s) := by\nrintro _ \u27e8x, hx, rfl\u27e9\n obtain \u27e8y, hy, hxy\u27e9 := h' hx\n refine \u27e8_, Set.mem_image_of_mem _ hy, show (x, y) \u2208 map \u03c6 \u03c6 \u207b\u00b9' dynEntourage T V n from ?_\u27e9\n rwa [h.preimage_dynEntourage V n]", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInfEntourage_le_coverEntropyEntourage (L349-L352)\nlemma coverEntropyInfEntourage_le_coverEntropyEntourage (T : X \u2192 X) (F : Set X) (U : SetRel X X) :\n coverEntropyInfEntourage T F U \u2264 coverEntropyEntourage T F U :=\nexpGrowthInf_le_expGrowthSup", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_univ (L264-L271)\nlemma coverMincard_univ (T : X \u2192 X) (h : F.Nonempty) (n : \u2115) : coverMincard T F univ n = 1 := by\napply le_antisymm _ ((one_le_coverMincard_iff T F univ n).2 h)\n obtain \u27e8x, _\u27e9 := h\n have := isDynCoverOf_univ T F n (singleton_nonempty x)\n rw [\u2190 Finset.coe_singleton] at this\n apply this.coverMincard_le_card.trans_eq\n rw [Finset.card_singleton, Nat.cast_one]", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyEntourage_univ (L376-L380)\nlemma coverEntropyEntourage_univ (T : X \u2192 X) (h : F.Nonempty) :\n coverEntropyEntourage T F univ = 0 := by\nrw [\u2190 expGrowthSup_const one_ne_zero one_ne_top, coverEntropyEntourage]\n simp only [coverMincard_univ T h, ENat.toENNReal_one]", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInfEntourage_nonneg (L362-L370)\nlemma coverEntropyInfEntourage_nonneg (T : X \u2192 X) (h : F.Nonempty) (U : SetRel X X) :\n 0 \u2264 coverEntropyInfEntourage T F U := by\napply Monotone.expGrowthInf_nonneg\n \u00b7 exact fun _ _ m_n \u21a6 ENat.toENNReal_mono (coverMincard_monotone_time T F U m_n)\n \u00b7 rw [ne_eq, funext_iff.not, not_forall]\n use 0\n rw [coverMincard_zero T h U, Pi.zero_apply, ENat.toENNReal_one]\n exact one_ne_zero", "-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.dynEntourage_comp_subset (L111-L118)\nlemma dynEntourage_comp_subset (T : X \u2192 X) (U V : SetRel X X) (n : \u2115) :\n (dynEntourage T U n) \u25cb (dynEntourage T V n) \u2286 dynEntourage T (U \u25cb V) n := by\nsimp only [dynEntourage, map_iterate, subset_iInter_iff]\n intro k k_n xy xy_comp\n simp only [SetRel.comp, mem_iInter, mem_preimage, map_apply, mem_setOf_eq] at xy_comp \u22a2\n rcases xy_comp with \u27e8z, hz1, hz2\u27e9\n exact mem_ball_comp (hz1 k k_n) (hz2 k k_n)", "-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropy_image_le_of_uniformContinuous (L194-L201)\ntheorem coverEntropy_image_le_of_uniformContinuous [UniformSpace X] [UniformSpace Y] {S : X \u2192 X}\n {T : Y \u2192 Y} {\u03c6 : X \u2192 Y} (h : Semiconj \u03c6 S T) (h' : UniformContinuous \u03c6) (F : Set X) :\n coverEntropy T (\u03c6 '' F) \u2264 coverEntropy S F := by\nrw [coverEntropy_image_of_comap _ h F]\n exact coverEntropy_antitone S F (uniformContinuous_iff.1 h')\n\n/-- The entropy of `\u03c6 '' F` is at most the entropy of `F` if `\u03c6` is uniformly continuous. This\n version uses a `liminf`. -/", "-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.idRel_subset_dynEntourage (L96-L101)\nlemma idRel_subset_dynEntourage (T : X \u2192 X) {U : Set (X \u00d7 X)} (h : idRel \u2286 U) (n : \u2115) :\n idRel \u2286 (dynEntourage T U n) := by\nsimp only [dynEntourage, map_iterate, subset_iInter_iff, idRel_subset, mem_preimage, map_apply]\n exact fun _ _ _ \u21a6 h rfl\n\nset_option linter.deprecated false in", "-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropy_empty (L482-L484)\nlemma coverEntropy_empty : coverEntropy T \u2205 = \u22a5 := by\nsimp only [coverEntropy, coverEntropyEntourage_empty, iSup_bot]"], "statement": "lemma netEntropyInfEntourage_univ (T : X \u2192 X) {F : Set X} (h : F.Nonempty) :\n netEntropyInfEntourage T F univ = 0", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 52836, "declarations_count": 5807, "diagnostics_count": 0, "duplicate_fingerprint": "3c9883e07659226e", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 19807, "lean_code_chars": 49560, "lean_code_ratio": 0.938, "length_bucket": "long", "line_count": 1242, "natural_language_chars": 3276, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 105, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.TopologicalEntropy.NetEntropy).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma netEntropyInfEntourage_univ (T : X \u2192 X) {F : Set X} (h : F.Nonempty) :\n netEntropyInfEntourage T F univ = 0\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.IsDynNetIn (L67-L69)\ndef IsDynNetIn (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) (s : Set X) : Prop :=\ns \u2286 F \u2227 s.PairwiseDisjoint fun x : X \u21a6 ball x (dynEntourage T U n)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.IsDynNetIn (L70-L72)\nlemma IsDynNetIn.of_le (m_n : m \u2264 n) (h : IsDynNetIn T F U m s) : IsDynNetIn T F U n s :=\n\u27e8h.1, PairwiseDisjoint.mono h.2 fun x \u21a6 ball_mono (dynEntourage_antitone T U m_n) x\u27e9\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.IsDynNetIn (L73-L76)\nlemma IsDynNetIn.of_entourage_subset (U_V : U \u2286 V) (h : IsDynNetIn T F V n s) :\n IsDynNetIn T F U n s :=\n\u27e8h.1, PairwiseDisjoint.mono h.2 fun x \u21a6 ball_mono (dynEntourage_monotone T n U_V) x\u27e9\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.isDynNetIn_empty (L77-L78)\nlemma isDynNetIn_empty : IsDynNetIn T F U n \u2205 := \u27e8empty_subset F, pairwise_empty _\u27e9\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.isDynNetIn_singleton (L79-L85)\nlemma isDynNetIn_singleton (T : X \u2192 X) (U : SetRel X X) (n : \u2115) (h : x \u2208 F) :\n IsDynNetIn T F U n {x} :=\n\u27e8singleton_subset_iff.2 h, pairwise_singleton x _\u27e9\n\n/-- Given an entourage `U` and a time `n`, a dynamical net has a smaller cardinality than\n a dynamical cover. This lemma is the first of two key results to compare two versions of\n topological entropy: with cover and with nets, the second being `coverMincard_le_netMaxcard`. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.IsDynNetIn (L86-L102)\nlemma IsDynNetIn.card_le_card_of_isDynCoverOf {s t : Finset X}\n (hs : IsDynNetIn T F U n s) (ht : IsDynCoverOf T F U n t) :\n s.card \u2264 t.card := by\nhave (x : X) (x_s : x \u2208 s) : \u2203 z \u2208 t, z \u2208 ball x (dynEntourage T U n) := by\n simpa using ht (hs.1 x_s)\n choose! F s_t using this\n apply Finset.card_le_card_of_injOn F fun x x_s \u21a6 (s_t x x_s).1\n exact fun x x_s y y_s Fx_Fy \u21a6\n PairwiseDisjoint.elim_set hs.2 x_s y_s (F x) (s_t x x_s).2 (Fx_Fy \u25b8 (s_t y y_s).2)\n\n/-! ### Maximal cardinality of dynamical nets -/\n\n/-- The largest cardinality of a `(U, n)`-dynamical net of `F`. Takes values in `\u2115\u221e`, and is\ninfinite if and only if `F` admits nets of arbitrarily large size. -/\nnoncomputable def netMaxcard (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) : \u2115\u221e :=\n \u2a06 (s : Finset X) (_ : IsDynNetIn T F U n s), (s.card : \u2115\u221e)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.IsDynNetIn (L103-L106)\nlemma IsDynNetIn.card_le_netMaxcard {s : Finset X} (h : IsDynNetIn T F U n s) :\n s.card \u2264 netMaxcard T F U n :=\nle_iSup\u2082 (\u03b1 := \u2115\u221e) s h\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netMaxcard_monotone_time (L107-L110)\nlemma netMaxcard_monotone_time (T : X \u2192 X) (F : Set X) (U : SetRel X X) :\n Monotone fun n : \u2115 \u21a6 netMaxcard T F U n :=\nfun _ _ m_n \u21a6 biSup_mono fun _ h \u21a6 h.of_le m_n\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netMaxcard_antitone (L111-L115)\nlemma netMaxcard_antitone (T : X \u2192 X) (F : Set X) (n : \u2115) :\n Antitone fun U : SetRel X X \u21a6 netMaxcard T F U n :=\nfun _ _ U_V \u21a6 biSup_mono fun _ h \u21a6 h.of_entourage_subset U_V\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netMaxcard_finite_iff (L116-L150)\nlemma netMaxcard_finite_iff (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) :\n netMaxcard T F U n < \u22a4 \u2194\n \u2203 s : Finset X, IsDynNetIn T F U n s \u2227 (s.card : \u2115\u221e) = netMaxcard T F U n := by\napply Iff.intro <;> intro h\n \u00b7 obtain \u27e8k, k_max\u27e9 := WithTop.ne_top_iff_exists.1 h.ne\n rw [\u2190 k_max]\n simp only [ENat.some_eq_coe, Nat.cast_inj]\n -- The criterion we want to use is `Nat.sSup_mem`. We rewrite `netMaxcard` with an `sSup`,\n -- then check its `BddAbove` and `Nonempty` hypotheses.\n have : netMaxcard T F U n\n = sSup (WithTop.some '' (Finset.card '' {s : Finset X | IsDynNetIn T F U n s})) := by\n rw [netMaxcard, \u2190 image_comp, sSup_image]\n simp only [mem_setOf_eq, ENat.some_eq_coe, Function.comp_apply]\n rw [this] at k_max\n have h_bdda : BddAbove (Finset.card '' {s : Finset X | IsDynNetIn T F U n s}) := by\n refine \u27e8k, mem_upperBounds.2 ?_\u27e9\n simp only [mem_image, mem_setOf_eq, forall_exists_index, and_imp, forall_apply_eq_imp_iff\u2082]\n intro s h\n rw [\u2190 WithTop.coe_le_coe, k_max]\n apply le_sSup\n simp only [ENat.some_eq_coe, mem_image, mem_setOf_eq, Nat.cast_inj, exists_eq_right]\n exact Filter.frequently_principal.mp fun a \u21a6 a h rfl\n have h_nemp : (Finset.card '' {s : Finset X | IsDynNetIn T F U n s}).Nonempty := by\n refine \u27e80, ?_\u27e9\n simp only [mem_image, mem_setOf_eq, Finset.card_eq_zero, exists_eq_right, Finset.coe_empty]\n exact isDynNetIn_empty\n rw [\u2190 WithTop.coe_sSup' h_bdda, ENat.some_eq_coe, Nat.cast_inj] at k_max\n have key := Nat.sSup_mem h_nemp h_bdda\n rw [\u2190 k_max, mem_image] at key\n simp only [mem_setOf_eq] at key\n exact key\n \u00b7 obtain \u27e8s, _, s_card\u27e9 := h\n rw [\u2190 s_card]\n exact WithTop.coe_lt_top s.card\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netMaxcard_empty (L152-L158)\nlemma netMaxcard_empty : netMaxcard T \u2205 U n = 0 := by\nrw [netMaxcard, \u2190 bot_eq_zero, iSup\u2082_eq_bot]\n intro s s_net\n replace s_net := subset_empty_iff.1 s_net.1\n norm_cast at s_net\n rw [s_net, Finset.card_empty, CharP.cast_eq_zero, bot_eq_zero']\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netMaxcard_eq_zero_iff (L159-L169)\nlemma netMaxcard_eq_zero_iff (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) :\n netMaxcard T F U n = 0 \u2194 F = \u2205 := by\nrefine \u27e8fun h \u21a6 ?_, fun h \u21a6 by rw [h, netMaxcard_empty]\u27e9\n rw [eq_empty_iff_forall_notMem]\n intro x x_F\n have key := isDynNetIn_singleton T U n x_F\n rw [\u2190 Finset.coe_singleton] at key\n replace key := key.card_le_netMaxcard\n rw [Finset.card_singleton, Nat.cast_one, h] at key\n exact key.not_gt zero_lt_one\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.one_le_netMaxcard_iff (L170-L174)\nlemma one_le_netMaxcard_iff (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) :\n 1 \u2264 netMaxcard T F U n \u2194 F.Nonempty := by\nrw [ENat.one_le_iff_ne_zero, nonempty_iff_ne_empty]\n exact not_iff_not.2 (netMaxcard_eq_zero_iff T F U n)\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netMaxcard_zero (L175-L182)\nlemma netMaxcard_zero (T : X \u2192 X) (h : F.Nonempty) (U : SetRel X X) : netMaxcard T F U 0 = 1 := by\napply (iSup\u2082_le _).antisymm ((one_le_netMaxcard_iff T F U 0).2 h)\n intro s \u27e8_, s_net\u27e9\n simp only [ball, dynEntourage_zero, preimage_univ] at s_net\n norm_cast\n refine Finset.card_le_one.2 fun x x_s y y_s \u21a6 ?_\n exact PairwiseDisjoint.elim_set s_net x_s y_s x (mem_univ x) (mem_univ x)\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netMaxcard_univ (L183-L191)\nlemma netMaxcard_univ (T : X \u2192 X) (h : F.Nonempty) (n : \u2115) : netMaxcard T F univ n = 1 := by\napply (iSup\u2082_le _).antisymm ((one_le_netMaxcard_iff T F univ n).2 h)\n intro s \u27e8_, s_net\u27e9\n simp only [ball, dynEntourage_univ, preimage_univ] at s_net\n norm_cast\n refine Finset.card_le_one.2 fun x x_s y y_s \u21a6 ?_\n exact PairwiseDisjoint.elim_set s_net x_s y_s x (mem_univ x) (mem_univ x)\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netMaxcard_infinite_iff (L192-L207)\nlemma netMaxcard_infinite_iff (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) :\n netMaxcard T F U n = \u22a4 \u2194 \u2200 k : \u2115, \u2203 s : Finset X, IsDynNetIn T F U n s \u2227 k \u2264 s.card := by\napply Iff.intro <;> intro h\n \u00b7 intro k\n rw [netMaxcard, iSup_subtype', iSup_eq_top] at h\n specialize h k (ENat.coe_lt_top k)\n simp only [Nat.cast_lt, Subtype.exists, exists_prop] at h\n obtain \u27e8s, s_net, s_k\u27e9 := h\n exact \u27e8s, s_net, s_k.le\u27e9\n \u00b7 refine WithTop.eq_top_iff_forall_gt.2 fun k \u21a6 ?_\n specialize h (k + 1)\n obtain \u27e8s, s_net, s_card\u27e9 := h\n apply s_net.card_le_netMaxcard.trans_lt'\n rw [ENat.some_eq_coe, Nat.cast_lt]\n exact (lt_add_one k).trans_le s_card\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netMaxcard_le_coverMincard (L208-L218)\nlemma netMaxcard_le_coverMincard (T : X \u2192 X) (F : Set X) (n : \u2115) :\n netMaxcard T F U n \u2264 coverMincard T F U n := by\nrcases eq_top_or_lt_top (coverMincard T F U n) with h | h\n \u00b7 exact h \u25b8 le_top\n \u00b7 obtain \u27e8t, t_cover, t_mincard\u27e9 := (coverMincard_finite_iff T F U n).1 h\n rw [\u2190 t_mincard]\n exact iSup\u2082_le fun s s_net \u21a6 Nat.cast_le.2 (s_net.card_le_card_of_isDynCoverOf t_cover)\n\n/-- Given an entourage `U` and a time `n`, a minimal dynamical cover by `U \u25cb U` has a smaller\n cardinality than a maximal dynamical net by `U`. This lemma is the second of two key results to\n compare two versions topological entropy: with cover and with nets. -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.coverMincard_le_netMaxcard (L219-L261)\nlemma coverMincard_le_netMaxcard (T : X \u2192 X) (F : Set X) [U.IsRefl] [U.IsSymm] (n : \u2115) :\n coverMincard T F (U \u25cb U) n \u2264 netMaxcard T F U n := by\nclassical\n -- WLOG, there exists a maximal dynamical net `s`.\n rcases eq_top_or_lt_top (netMaxcard T F U n) with h | h\n \u00b7 exact h \u25b8 le_top\n obtain \u27e8s, s_net, s_card\u27e9 := (netMaxcard_finite_iff T F U n).1 h\n rw [\u2190 s_card]\n apply IsDynCoverOf.coverMincard_le_card\n -- We have to check that `s` is a cover for `dynEntourage T F (U \u25cb U) n`.\n -- If `s` is not a cover, then we can add to `s` a point `x` which is not covered\n -- and get a new net. This contradicts the maximality of `s`.\n rw [IsDynCoverOf, isCover_iff_subset_iUnion_ball]\n by_contra h\n obtain \u27e8x, x_F, x_uncov\u27e9 := not_subset.1 h\n simp only [Finset.mem_coe, mem_iUnion, exists_prop, not_exists, not_and] at x_uncov\n have larger_net : IsDynNetIn T F U n (insert x s) := by\n refine \u27e8insert_subset x_F s_net.1, pairwiseDisjoint_insert.2 \u27e8s_net.2, ?_\u27e9\u27e9\n refine fun y y_s _ \u21a6 disjoint_left.2 fun z z_x z_y \u21a6 x_uncov y y_s ?_\n exact mem_ball_dynEntourage_comp T n x y (nonempty_of_mem \u27e8z_x, z_y\u27e9)\n rw [\u2190 s.coe_insert x] at larger_net\n apply larger_net.card_le_netMaxcard.not_gt\n rw [\u2190 s_card, Nat.cast_lt]\n refine (lt_add_one s.card).trans_eq (s.card_insert_of_notMem fun x_s \u21a6 ?_).symm\n exact x_uncov x x_s (ball_mono (dynEntourage_monotone T n SetRel.left_subset_comp) x <|\n SetRel.rfl (dynEntourage T U n))\n\n/-! ### Net entropy of entourages -/\n\nopen ENNReal EReal ExpGrowth Filter\n\n/-- The entropy of an entourage `U`, defined as the exponential rate of growth of the size of the\nlargest `(U, n)`-dynamical net of `F`. Takes values in the space of extended real numbers\n`[-\u221e,+\u221e]`. This version uses a `limsup`, and is chosen as the default definition. -/\nnoncomputable def netEntropyEntourage (T : X \u2192 X) (F : Set X) (U : SetRel X X) :=\n expGrowthSup fun n : \u2115 \u21a6 netMaxcard T F U n\n\n/-- The entropy of an entourage `U`, defined as the exponential rate of growth of the size of the\nlargest `(U, n)`-dynamical net of `F`. Takes values in the space of extended real numbers\n`[-\u221e,+\u221e]`. This version uses a `liminf`, and is an alternative definition. -/\nnoncomputable def netEntropyInfEntourage (T : X \u2192 X) (F : Set X) (U : SetRel X X) :=\n expGrowthInf fun n : \u2115 \u21a6 netMaxcard T F U n\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netEntropyInfEntourage_antitone (L262-L265)\nlemma netEntropyInfEntourage_antitone (T : X \u2192 X) (F : Set X) :\n Antitone fun U : SetRel X X \u21a6 netEntropyInfEntourage T F U :=\nfun _ _ U_V \u21a6 expGrowthInf_monotone fun n \u21a6 ENat.toENNReal_mono (netMaxcard_antitone T F n U_V)\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netEntropyEntourage_antitone (L266-L269)\nlemma netEntropyEntourage_antitone (T : X \u2192 X) (F : Set X) :\n Antitone fun U : SetRel X X \u21a6 netEntropyEntourage T F U :=\nfun _ _ U_V \u21a6 expGrowthSup_monotone fun n \u21a6 ENat.toENNReal_mono (netMaxcard_antitone T F n U_V)\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netEntropyInfEntourage_le_netEntropyEntourage (L270-L273)\nlemma netEntropyInfEntourage_le_netEntropyEntourage (T : X \u2192 X) (F : Set X) (U : SetRel X X) :\n netEntropyInfEntourage T F U \u2264 netEntropyEntourage T F U :=\nexpGrowthInf_le_expGrowthSup\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netEntropyEntourage_empty (L275-L279)\nlemma netEntropyEntourage_empty : netEntropyEntourage T \u2205 U = \u22a5 := by\nrw [netEntropyEntourage, \u2190 expGrowthSup_zero]\n congr\n simp only [netMaxcard_empty, ENat.toENNReal_zero, Pi.zero_def]\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netEntropyInfEntourage_empty (L281-L283)\nlemma netEntropyInfEntourage_empty : netEntropyInfEntourage T \u2205 U = \u22a5 :=\neq_bot_mono (netEntropyInfEntourage_le_netEntropyEntourage T \u2205 U) netEntropyEntourage_empty\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netEntropyInfEntourage_nonneg (L284-L292)\nlemma netEntropyInfEntourage_nonneg (T : X \u2192 X) (h : F.Nonempty) (U : SetRel X X) :\n 0 \u2264 netEntropyInfEntourage T F U := by\napply Monotone.expGrowthInf_nonneg\n \u00b7 exact fun _ _ m_n \u21a6 ENat.toENNReal_mono (netMaxcard_monotone_time T F U m_n)\n \u00b7 rw [ne_eq, funext_iff.not, not_forall]\n use 0\n rw [netMaxcard_zero T h U, Pi.zero_apply, ENat.toENNReal_one]\n exact one_ne_zero\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netEntropyEntourage_nonneg (L293-L296)\nlemma netEntropyEntourage_nonneg (T : X \u2192 X) (h : F.Nonempty) (U : SetRel X X) :\n 0 \u2264 netEntropyEntourage T F U :=\n(netEntropyInfEntourage_nonneg T h U).trans (netEntropyInfEntourage_le_netEntropyEntourage T F U)\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_finite_of_isCompact_uniformContinuous (L290-L295)\nlemma coverMincard_finite_of_isCompact_uniformContinuous [UniformSpace X] (F_comp : IsCompact F)\n (h : UniformContinuous T) (U_uni : U \u2208 \ud835\udce4 X) (n : \u2115) :\n coverMincard T F U n < \u22a4 := by\nobtain \u27e8s, s_cover\u27e9 := exists_isDynCoverOf_of_isCompact_uniformContinuous F_comp h U_uni n\n exact s_cover.coverMincard_le_card.trans_lt (WithTop.coe_lt_top s.card)\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyEntourage_nonneg (L371-L375)\nlemma coverEntropyEntourage_nonneg (T : X \u2192 X) (h : F.Nonempty) (U : SetRel X X) :\n 0 \u2264 coverEntropyEntourage T F U :=\n(coverEntropyInfEntourage_nonneg T h U).trans\n (coverEntropyInfEntourage_le_coverEntropyEntourage T F U)\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.one_le_coverMincard_iff (L250-L254)\nlemma one_le_coverMincard_iff (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) :\n 1 \u2264 coverMincard T F U n \u2194 F.Nonempty := by\nrw [ENat.one_le_iff_ne_zero, nonempty_iff_ne_empty, not_iff_not]\n exact coverMincard_eq_zero_iff T F U n\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInf_empty (L486-L488)\nlemma coverEntropyInf_empty : coverEntropyInf T \u2205 = \u22a5 := by\nsimp only [coverEntropyInf, coverEntropyInfEntourage_empty, iSup_bot]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.le_coverMincard_image (L93-L101)\nlemma le_coverMincard_image (h : Semiconj \u03c6 S T) (F : Set X) [V.IsSymm] (n : \u2115) :\n coverMincard S F ((map \u03c6 \u03c6) \u207b\u00b9' (V \u25cb V)) n \u2264 coverMincard T (\u03c6 '' F) V n := by\nrcases eq_top_or_lt_top (coverMincard T (\u03c6 '' F) V n) with h' | h'\n \u00b7 exact h' \u25b8 le_top\n obtain \u27e8t, t_cover, t_card\u27e9 := (coverMincard_finite_iff T (\u03c6 '' F) V n).1 h'\n obtain \u27e8s, s_cover, s_card\u27e9 := t_cover.preimage h\n rw [\u2190 t_card]\n exact s_cover.coverMincard_le_card.trans (WithTop.coe_le_coe.2 s_card)\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.dynEntourage_mem_uniformity (L65-L77)\nlemma dynEntourage_mem_uniformity [UniformSpace X] (h : UniformContinuous T)\n (U_uni : U \u2208 \ud835\udce4 X) (n : \u2115) :\n dynEntourage T U n \u2208 \ud835\udce4 X := by\nrw [dynEntourage_eq_inter_Ico T U n]\n induction n with\n | zero => simp\n | succ n ih =>\n simp only [iInter_coe_set, mem_Ico, Nat.zero_le, true_and] at ih \u22a2\n rw [Set.biInter_lt_succ]\n apply Filter.inter_mem ih\n rw [map_iterate T T n]\n exact uniformContinuous_def.1 (UniformContinuous.iterate T n h) U U_uni\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_monotone_time (L213-L216)\nlemma coverMincard_monotone_time (T : X \u2192 X) (F : Set X) (U : SetRel X X) :\n Monotone fun n : \u2115 \u21a6 coverMincard T F U n :=\nfun _ _ m_n \u21a6 biInf_mono fun _ h \u21a6 h.of_le m_n\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropy_restrict (L189-L193)\ntheorem coverEntropy_restrict [UniformSpace X] {T : X \u2192 X} {F : Set X} (h : MapsTo T F F) :\n coverEntropy (h.restrict T F F) univ = coverEntropy T F := by\nrw [\u2190 coverEntropy_restrict_subset Subset.rfl h, coe_preimage_self F]\n\n/-- The entropy of `\u03c6 '' F` is at most the entropy of `F` if `\u03c6` is uniformly continuous. -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropy_antitone (L442-L447)\nlemma coverEntropy_antitone (T : X \u2192 X) (F : Set X) :\n Antitone fun (u : UniformSpace X) \u21a6 @coverEntropy X u T F :=\nfun _ _ h \u21a6 iSup\u2082_mono' fun U U_uni \u21a6 \u27e8U, (le_def.1 h) U U_uni, le_refl _\u27e9\n\nvariable [UniformSpace X]\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInfEntourage_univ (L381-L385)\nlemma coverEntropyInfEntourage_univ (T : X \u2192 X) (h : F.Nonempty) :\n coverEntropyInfEntourage T F univ = 0 := by\nrw [\u2190 expGrowthInf_const one_ne_zero one_ne_top, coverEntropyInfEntourage]\n simp only [coverMincard_univ T h, ENat.toENNReal_one]\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyEntourage_le_coverEntropyInfEntourage (L407-L411)\nlemma coverEntropyEntourage_le_coverEntropyInfEntourage (F_inv : MapsTo T F F) [U.IsSymm] :\n coverEntropyEntourage T F (U \u25cb U) \u2264 coverEntropyInfEntourage T F U := by\nrefine (le_liminf_of_le) (eventually_atTop.2 \u27e81, fun m m_pos \u21a6 ?_\u27e9)\n exact coverEntropyEntourage_le_log_coverMincard_div F_inv (Nat.one_le_iff_ne_zero.1 m_pos)\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropy_eq_iSup_basis (L458-L466)\nlemma coverEntropy_eq_iSup_basis {\u03b9 : Sort*} {p : \u03b9 \u2192 Prop} {s : \u03b9 \u2192 SetRel X X}\n (h : (\ud835\udce4 X).HasBasis p s) (T : X \u2192 X) (F : Set X) :\n coverEntropy T F = \u2a06 (i : \u03b9) (_ : p i), coverEntropyEntourage T F (s i) := by\nrefine (iSup\u2082_le fun U U_uni \u21a6 ?_).antisymm\n (iSup\u2082_mono' fun i h_i \u21a6 \u27e8s i, HasBasis.mem_of_mem h h_i, le_refl _\u27e9)\n obtain \u27e8i, h_i, si_U\u27e9 := (HasBasis.mem_iff h).1 U_uni\n exact (coverEntropyEntourage_antitone T F si_U).trans\n (le_iSup\u2082 (f := fun (i : \u03b9) (_ : p i) \u21a6 coverEntropyEntourage T F (s i)) i h_i)\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Subset.IsDynCoverOf (L50-L53)\nlemma IsDynCoverOf.monotone_subset (F_G : F \u2286 G) (h : IsDynCoverOf T G U n s) :\n IsDynCoverOf T F U n s :=\nF_G.trans h\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.isDynCoverOf_zero (L94-L96)\nlemma isDynCoverOf_zero (T : X \u2192 X) (F : Set X) (U : SetRel X X) (h : s.Nonempty) :\n IsDynCoverOf T F U 0 s := by simp [IsDynCoverOf, h]\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.mem_ball_dynEntourage (L61-L64)\nlemma mem_ball_dynEntourage :\n y \u2208 ball x (dynEntourage T U n) \u2194 \u2200 k < n, T^[k] y \u2208 ball (T^[k] x) U := by\nsimp only [ball, mem_preimage, mem_dynEntourage]\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverMincard_image_le (L102-L114)\nlemma coverMincard_image_le (h : Semiconj \u03c6 S T) (F : Set X) (V : SetRel Y Y) (n : \u2115) :\n coverMincard T (\u03c6 '' F) V n \u2264 coverMincard S F ((map \u03c6 \u03c6) \u207b\u00b9' V) n := by\nclassical\n rcases eq_top_or_lt_top (coverMincard S F ((map \u03c6 \u03c6) \u207b\u00b9' V) n) with h' | h'\n \u00b7 exact h' \u25b8 le_top\n obtain \u27e8s, s_cover, s_card\u27e9 := (coverMincard_finite_iff S F ((map \u03c6 \u03c6) \u207b\u00b9' V) n).1 h'\n rw [\u2190 s_card]\n have := s_cover.image h\n rw [\u2190 s.coe_image] at this\n exact this.coverMincard_le_card.trans (WithTop.coe_le_coe.2 s.card_image_le)\n\nopen ENNReal EReal ExpGrowth Filter\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_eq_zero_iff (L246-L249)\nlemma coverMincard_eq_zero_iff (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) :\n coverMincard T F U n = 0 \u2194 F = \u2205 := by\nsimp [coverMincard, ENat.iInf_eq_zero]\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Subset.coverEntropyInfEntourage_monotone (L65-L69)\nlemma coverEntropyInfEntourage_monotone (T : X \u2192 X) (U : SetRel X X) :\n Monotone fun F : Set X \u21a6 coverEntropyInfEntourage T F U := by\nrefine fun F G F_G \u21a6 ExpGrowth.expGrowthInf_monotone fun n \u21a6 ?_\n exact ENat.toENNReal_mono (coverMincard_monotone_subset T U n F_G)\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropy_image_le_of_uniformContinuousOn_invariant (L208-L219)\nlemma coverEntropy_image_le_of_uniformContinuousOn_invariant [UniformSpace X] [UniformSpace Y]\n {S : X \u2192 X} {T : Y \u2192 Y} {\u03c6 : X \u2192 Y} (h : Semiconj \u03c6 S T) {F G : Set X}\n (h' : UniformContinuousOn \u03c6 G) (hF : F \u2286 G) (hG : MapsTo S G G) :\n coverEntropy T (\u03c6 '' F) \u2264 coverEntropy S F := by\nrw [\u2190 coverEntropy_restrict_subset hF hG]\n have h\u03c6 : Semiconj (G.restrict \u03c6) (hG.restrict S G G) T := by\n intro x\n rw [G.restrict_apply, G.restrict_apply, hG.val_restrict_apply, h.eq x]\n apply (coverEntropy_image_le_of_uniformContinuous h\u03c6\n (uniformContinuousOn_iff_restrict.1 h') (val \u207b\u00b9' F)).trans_eq'\n rw [\u2190 image_image_val_eq_restrict_image, image_preimage_coe G F, inter_eq_right.2 hF]\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.isDynCoverOf_univ (L97-L99)\nlemma isDynCoverOf_univ (T : X \u2192 X) (F : Set X) (n : \u2115) (h : s.Nonempty) :\n IsDynCoverOf T F univ n s := by simp [IsDynCoverOf, h]\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.isSymm_dynEntourage (L91-L94)\ninstance isSymm_dynEntourage [U.IsSymm] : (dynEntourage T U n).IsSymm := by\nsimp [dynEntourage]; infer_instance\n\nset_option linter.deprecated false in\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Subset.IsDynNetIn (L54-L56)\nlemma IsDynNetIn.monotone_subset (F_G : F \u2286 G) (h : IsDynNetIn T F U n s) : IsDynNetIn T G U n s :=\n\u27e8h.1.trans F_G, h.2\u27e9\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyEntourage_finite_of_isCompact_invariant (L412-L437)\nlemma coverEntropyEntourage_finite_of_isCompact_invariant [UniformSpace X]\n (F_comp : IsCompact F) (F_inv : MapsTo T F F) (U_uni : U \u2208 \ud835\udce4 X) :\n coverEntropyEntourage T F U < \u22a4 := by\nobtain \u27e8V, V_uni, V_symm, V_U\u27e9 := comp_symm_mem_uniformity_sets U_uni\n obtain \u27e8s, s_cover\u27e9 := exists_isDynCoverOf_of_isCompact_invariant F_comp F_inv V_uni 1\n apply (coverEntropyEntourage_antitone T F V_U).trans_lt\n apply (s_cover.coverEntropyEntourage_le_log_card_div F_inv one_ne_zero).trans_lt\n rw [Nat.cast_one, div_one, log_lt_top_iff, \u2190 ENat.toENNReal_top]\n exact_mod_cast (ENat.coe_ne_top (Finset.card s)).lt_top\n\n/-! ### Cover entropy -/\n\n/-- The entropy of `T` restricted to `F`, obtained by taking the supremum\n of `coverEntropyEntourage` over entourages. Note that this supremum is approached by taking small\n entourages. This first version uses a `limsup`, and is chosen as the default definition\n for topological entropy. -/\nnoncomputable def coverEntropy [UniformSpace X] (T : X \u2192 X) (F : Set X) :=\n \u2a06 U \u2208 \ud835\udce4 X, coverEntropyEntourage T F U\n\n/-- The entropy of `T` restricted to `F`, obtained by taking the supremum\n of `coverEntropyInfEntourage` over entourages. Note that this supremum is approached by taking\n small entourages. This second version uses a `liminf`, and is chosen as an alternative\n definition for topological entropy. -/\nnoncomputable def coverEntropyInf [UniformSpace X] (T : X \u2192 X) (F : Set X) :=\n \u2a06 U \u2208 \ud835\udce4 X, coverEntropyInfEntourage T F U\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInf_eq_coverEntropy (L496-L503)\nlemma coverEntropyInf_eq_coverEntropy (T : X \u2192 X) (h : MapsTo T F F) :\n coverEntropyInf T F = coverEntropy T F := by\nrefine le_antisymm (coverEntropyInf_le_coverEntropy T F) (iSup\u2082_le fun U U_uni \u21a6 ?_)\n obtain \u27e8V, V_uni, V_symm, V_U\u27e9 := comp_symm_mem_uniformity_sets U_uni\n exact (coverEntropyEntourage_antitone T F V_U).trans <| le_iSup\u2082_of_le V V_uni <|\n coverEntropyEntourage_le_coverEntropyInfEntourage h\n\nend Dynamics\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropy_restrict_subset (L175-L180)\nlemma coverEntropy_restrict_subset [UniformSpace X] {T : X \u2192 X} {F G : Set X} (hF : F \u2286 G)\n (hG : MapsTo T G G) :\n coverEntropy (hG.restrict T G G) (val \u207b\u00b9' F) = coverEntropy T F := by\nrw [\u2190 coverEntropy_image_of_comap _ hG.val_restrict_apply (val \u207b\u00b9' F), image_preimage_coe G F,\n inter_eq_right.2 hF]\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInf_le_coverEntropy (L476-L480)\nlemma coverEntropyInf_le_coverEntropy (T : X \u2192 X) (F : Set X) :\n coverEntropyInf T F \u2264 coverEntropy T F :=\niSup\u2082_mono fun (U : SetRel X X) (_ : U \u2208 \ud835\udce4 X) \u21a6\n coverEntropyInfEntourage_le_coverEntropyEntourage T F U\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_le_pow (L285-L289)\nlemma coverMincard_le_pow (F_inv : MapsTo T F F) [U.IsSymm] (m_pos : 0 < m) (n : \u2115) :\n coverMincard T F (U \u25cb U) n \u2264 coverMincard T F U m ^ (n / m + 1) :=\n(coverMincard_monotone_time T F (U \u25cb U) (Nat.lt_mul_div_succ n m_pos).le).trans\n (coverMincard_mul_le_pow F_inv m (n / m + 1))\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.isRefl_dynEntourage (L87-L90)\ninstance isRefl_dynEntourage [U.IsRefl] : (dynEntourage T U n).IsRefl := by\nsimp [dynEntourage]; infer_instance\n\nset_option linter.flexible false in -- simp followed by infer_instance\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Subset.coverMincard_monotone_subset (L57-L60)\nlemma coverMincard_monotone_subset (T : X \u2192 X) (U : SetRel X X) (n : \u2115) :\n Monotone fun F : Set X \u21a6 coverMincard T F U n :=\nfun _ _ F_G \u21a6 biInf_mono fun _ h \u21a6 h.monotone_subset F_G\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyEntourage_empty (L354-L357)\nlemma coverEntropyEntourage_empty : coverEntropyEntourage T \u2205 U = \u22a5 := by\nsimp only [coverEntropyEntourage, coverMincard_empty]\n rw [ENat.toENNReal_zero, \u2190 Pi.zero_def, expGrowthSup_zero]\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInf_antitone (L438-L441)\nlemma coverEntropyInf_antitone (T : X \u2192 X) (F : Set X) :\n Antitone fun (u : UniformSpace X) \u21a6 @coverEntropyInf X u T F :=\nfun _ _ h \u21a6 iSup\u2082_mono' fun U U_uni \u21a6 \u27e8U, (le_def.1 h) U U_uni, le_refl _\u27e9\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.IsDynCoverOf (L78-L80)\ndef IsDynCoverOf (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) (s : Set X) : Prop :=\nIsCover (dynEntourage T U n) F s\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInf_eq_iSup_basis (L467-L475)\nlemma coverEntropyInf_eq_iSup_basis {\u03b9 : Sort*} {p : \u03b9 \u2192 Prop} {s : \u03b9 \u2192 SetRel X X}\n (h : (\ud835\udce4 X).HasBasis p s) (T : X \u2192 X) (F : Set X) :\n coverEntropyInf T F = \u2a06 (i : \u03b9) (_ : p i), coverEntropyInfEntourage T F (s i) := by\nrefine (iSup\u2082_le fun U U_uni \u21a6 ?_).antisymm\n (iSup\u2082_mono' fun i h_i \u21a6 \u27e8s i, HasBasis.mem_of_mem h h_i, le_refl _\u27e9)\n obtain \u27e8i, h_i, si_U\u27e9 := (HasBasis.mem_iff h).1 U_uni\n exact (coverEntropyInfEntourage_antitone T F si_U).trans\n (le_iSup\u2082 (f := fun (i : \u03b9) (_ : p i) \u21a6 coverEntropyInfEntourage T F (s i)) i h_i)\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Subset.coverEntropyEntourage_monotone (L70-L74)\nlemma coverEntropyEntourage_monotone (T : X \u2192 X) (U : SetRel X X) :\n Monotone fun F : Set X \u21a6 coverEntropyEntourage T F U := by\nrefine fun F G F_G \u21a6 ExpGrowth.expGrowthSup_monotone fun n \u21a6 ?_\n exact ENat.toENNReal_mono (coverMincard_monotone_subset T U n F_G)\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.nonempty_inter_of_coverMincard (L305-L340)\nlemma nonempty_inter_of_coverMincard [U.IsSymm] {s : Finset X} (h : IsDynCoverOf T F U n s)\n (h' : #s = coverMincard T F U n) :\n \u2200 x \u2208 s, (F \u2229 ball x (dynEntourage T U n)).Nonempty := by\n-- Otherwise, there is a ball which does not intersect `F`. Removing it yields a smaller cover.\n classical\n by_contra! \u27e8x, x_s, ball_empt\u27e9\n have smaller_cover : IsDynCoverOf T F U n (s.erase x) := by\n intro y y_F\n specialize h y_F\n simp only [s.mem_coe] at h\n simp only [s.coe_erase, mem_diff, s.mem_coe, mem_singleton_iff]\n obtain \u27e8z, z_s, hz\u27e9 := h\n refine \u27e8z, \u27e8z_s, fun z_x \u21a6 notMem_empty y ?_\u27e9, hz\u27e9\n rw [\u2190 ball_empt]\n rw [z_x] at hz\n exact mem_inter y_F <| (dynEntourage T U n).symm hz\n apply smaller_cover.coverMincard_le_card.not_gt\n rw [\u2190 h']\n exact_mod_cast s.card_erase_lt_of_mem x_s\n\n/-! ### Cover entropy of entourages -/\n\nopen ENNReal EReal ExpGrowth Filter\n\n/-- The entropy of an entourage `U`, defined as the exponential rate of growth of the size\n of the smallest `(U, n)`-refined cover of `F`. Takes values in the space of extended real numbers\n `[-\u221e, +\u221e]`. This first version uses a `limsup`, and is chosen as the default definition. -/\nnoncomputable def coverEntropyEntourage (T : X \u2192 X) (F : Set X) (U : SetRel X X) :=\n expGrowthSup fun n : \u2115 \u21a6 coverMincard T F U n\n\n/-- The entropy of an entourage `U`, defined as the exponential rate of growth of the size\n of the smallest `(U, n)`-refined cover of `F`. Takes values in the space of extended real numbers\n `[-\u221e, +\u221e]`. This second version uses a `liminf`, and is chosen as an alternative definition. -/\nnoncomputable def coverEntropyInfEntourage (T : X \u2192 X) (F : Set X) (U : SetRel X X) :=\n expGrowthInf fun n : \u2115 \u21a6 coverMincard T F U n\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.dynEntourage_antitone (L130-L133)\nlemma dynEntourage_antitone (T : X \u2192 X) (U : SetRel X X) :\n Antitone (fun n : \u2115 \u21a6 dynEntourage T U n) :=\nfun m n m_n \u21a6 iInter\u2082_mono' fun k k_m \u21a6 by use k, lt_of_lt_of_le k_m m_n\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropyInf_image_of_comap (L154-L174)\ntheorem coverEntropyInf_image_of_comap (u : UniformSpace Y) {S : X \u2192 X} {T : Y \u2192 Y} {\u03c6 : X \u2192 Y}\n (h : Semiconj \u03c6 S T) (F : Set X) :\n coverEntropyInf T (\u03c6 '' F) = @coverEntropyInf X (comap \u03c6 u) S F := by\nlet : UniformSpace X := comap \u03c6 u\n apply le_antisymm\n \u00b7 refine iSup\u2082_le fun V V_uni \u21a6\n (coverEntropyInfEntourage_antitone _ _ SetRel.symmetrize_subset_self).trans <|\n (coverEntropyInfEntourage_image_le h F _).trans ?_\n apply coverEntropyInfEntourage_le_coverEntropyInf\n rw [uniformity_comap \u03c6, mem_comap]\n exact \u27e8_, symmetrize_mem_uniformity V_uni, .rfl\u27e9\n \u00b7 refine iSup\u2082_le fun U U_uni \u21a6 ?_\n simp only [uniformity_comap \u03c6, mem_comap] at U_uni\n obtain \u27e8V, V_uni, V_sub\u27e9 := U_uni\n obtain \u27e8W, W_uni, W_symm, W_V\u27e9 := comp_symm_mem_uniformity_sets V_uni\n apply (coverEntropyInfEntourage_antitone S F ((preimage_mono W_V).trans V_sub)).trans\n apply (le_coverEntropyInfEntourage_image h F).trans\n exact coverEntropyInfEntourage_le_coverEntropyInf T (\u03c6 '' F) W_uni\n\nopen Subtype\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.dynEntourage_eq_inter_Ico (L54-L57)\nlemma dynEntourage_eq_inter_Ico (T : X \u2192 X) (U : SetRel X X) (n : \u2115) :\n dynEntourage T U n = \u22c2 k : Ico 0 n, (map T T)^[k] \u207b\u00b9' U := by\nsimp [dynEntourage]\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropyInfEntourage_image_le (L127-L132)\nlemma coverEntropyInfEntourage_image_le (h : Semiconj \u03c6 S T) (F : Set X) (V : SetRel Y Y) :\n coverEntropyInfEntourage T (\u03c6 '' F) V \u2264 coverEntropyInfEntourage S F ((map \u03c6 \u03c6) \u207b\u00b9' V) :=\nexpGrowthInf_monotone fun n \u21a6 ENat.toENNReal_mono (coverMincard_image_le h F V n)\n\n/-- The entropy of `\u03c6 '' F` equals the entropy of `F` if `X` is endowed with the pullback by `\u03c6`\n of the uniform structure of `Y`. -/\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropyInf_image_le_of_uniformContinuous (L202-L207)\ntheorem coverEntropyInf_image_le_of_uniformContinuous [UniformSpace X] [UniformSpace Y] {S : X \u2192 X}\n {T : Y \u2192 Y} {\u03c6 : X \u2192 Y} (h : Semiconj \u03c6 S T) (h' : UniformContinuous \u03c6) (F : Set X) :\n coverEntropyInf T (\u03c6 '' F) \u2264 coverEntropyInf S F := by\nrw [coverEntropyInf_image_of_comap _ h F]\n exact coverEntropyInf_antitone S F (uniformContinuous_iff.1 h')\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Subset.netMaxcard_monotone_subset (L61-L64)\nlemma netMaxcard_monotone_subset (T : X \u2192 X) (U : SetRel X X) (n : \u2115) :\n Monotone fun F : Set X \u21a6 netMaxcard T F U n :=\nfun _ _ F_G \u21a6 biSup_mono fun _ h \u21a6 h.monotone_subset F_G\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_empty (L243-L245)\nlemma coverMincard_empty : coverMincard T \u2205 U n = 0 :=\n(sInf_le (by simp [IsDynCoverOf])).antisymm (zero_le (coverMincard T \u2205 U n))\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyEntourage_antitone (L345-L348)\nlemma coverEntropyEntourage_antitone (T : X \u2192 X) (F : Set X) :\n Antitone fun U : SetRel X X \u21a6 coverEntropyEntourage T F U :=\nfun _ _ U_V \u21a6 expGrowthSup_monotone fun n \u21a6 ENat.toENNReal_mono (coverMincard_antitone T F n U_V)\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyEntourage_le_coverEntropy (L448-L452)\nlemma coverEntropyEntourage_le_coverEntropy (T : X \u2192 X) (F : Set X)\n (h : U \u2208 \ud835\udce4 X) :\n coverEntropyEntourage T F U \u2264 coverEntropy T F :=\nle_iSup\u2082 (f := fun (U : SetRel X X) (_ : U \u2208 \ud835\udce4 X) \u21a6 coverEntropyEntourage T F U) U h\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Subset.netEntropyInfEntourage_monotone (L75-L79)\nlemma netEntropyInfEntourage_monotone (T : X \u2192 X) (U : SetRel X X) :\n Monotone fun F : Set X \u21a6 netEntropyInfEntourage T F U := by\nrefine fun F G F_G \u21a6 ExpGrowth.expGrowthInf_monotone fun n \u21a6 ?_\n exact ENat.toENNReal_mono (netMaxcard_monotone_subset T U n F_G)\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.exists_isDynCoverOf_of_isCompact_invariant (L191-L208)\nlemma exists_isDynCoverOf_of_isCompact_invariant [UniformSpace X]\n (F_comp : IsCompact F) (F_inv : MapsTo T F F) (U_uni : U \u2208 \ud835\udce4 X) (n : \u2115) :\n \u2203 s : Finset X, IsDynCoverOf T F U n s := by\nobtain \u27e8(V : SetRel X X), V_uni, V_symm, V_U\u27e9 := comp_symm_mem_uniformity_sets U_uni\n obtain \u27e8s, _, s_cover\u27e9 := F_comp.elim_nhds_subcover (ball \u00b7 V)\n fun (x : X) _ \u21a6 ball_mem_nhds x V_uni\n have : IsDynCoverOf T F V 1 s := .of_subset_iUnion_ball <| by simpa using s_cover\n obtain \u27e8t, t_dyncover, t_card\u27e9 := this.iterate_le_pow F_inv n\n rw [one_mul n] at t_dyncover\n exact \u27e8t, t_dyncover.of_entourage_subset V_U\u27e9\n\n/-! ### Minimal cardinality of dynamical covers -/\n\n/-- The smallest cardinality of a `(U, n)`-dynamical cover of `F`. Takes values in `\u2115\u221e`, and is\n infinite if and only if `F` admits no finite dynamical cover. -/\nnoncomputable def coverMincard (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) : \u2115\u221e :=\n \u2a05 (s : Finset X) (_ : IsDynCoverOf T F U n s), (s.card : \u2115\u221e)\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyEntourage_le_log_coverMincard_div (L386-L399)\nlemma coverEntropyEntourage_le_log_coverMincard_div (F_inv : MapsTo T F F) [U.IsSymm]\n (n_pos : n \u2260 0) :\n coverEntropyEntourage T F (U \u25cb U) \u2264 log (coverMincard T F U n) / n := by\nhave cv_mono : Monotone fun m \u21a6 (coverMincard T F (U \u25cb U) m).toENNReal :=\n fun _ _ k_m \u21a6 ENat.toENNReal_mono (coverMincard_monotone_time T F (U \u25cb U) k_m)\n have h := cv_mono.expGrowthSup_comp_mul n_pos\n rw [mul_comm, \u2190 div_eq_iff (natCast_ne_bot n) (natCast_ne_top n) (Nat.cast_ne_zero.2 n_pos)] at h\n rw [coverEntropyEntourage, \u2190 h]\n apply monotone_div_right_of_nonneg n.cast_nonneg'\n rw [\u2190 expGrowthSup_pow]\n refine expGrowthSup_monotone fun m \u21a6 ?_\n rw [\u2190 ENat.toENNReal_pow]\n exact ENat.toENNReal_mono (coverMincard_mul_le_pow F_inv n m)\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropyInf_image_le_of_uniformContinuousOn_invariant (L220-L232)\nlemma coverEntropyInf_image_le_of_uniformContinuousOn_invariant [UniformSpace X] [UniformSpace Y]\n {S : X \u2192 X} {T : Y \u2192 Y} {\u03c6 : X \u2192 Y} (h : Semiconj \u03c6 S T) {F G : Set X}\n (h' : UniformContinuousOn \u03c6 G) (hF : F \u2286 G) (hG : MapsTo S G G) :\n coverEntropyInf T (\u03c6 '' F) \u2264 coverEntropyInf S F := by\nrw [\u2190 coverEntropyInf_restrict_subset hF hG]\n have h\u03c6 : Semiconj (G.restrict \u03c6) (hG.restrict S G G) T := by\n intro a\n rw [G.restrict_apply, G.restrict_apply, hG.val_restrict_apply, h.eq a]\n apply (coverEntropyInf_image_le_of_uniformContinuous h\u03c6\n (uniformContinuousOn_iff_restrict.1 h') (val \u207b\u00b9' F)).trans_eq'\n rw [\u2190 image_image_val_eq_restrict_image, image_preimage_coe G F, inter_eq_right.2 hF]\n\nend Dynamics\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropy_nonneg (L493-L495)\nlemma coverEntropy_nonneg (T : X \u2192 X) (h : F.Nonempty) : 0 \u2264 coverEntropy T F :=\n(coverEntropyInf_nonneg T h).trans (coverEntropyInf_le_coverEntropy T F)\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_antitone (L217-L221)\nlemma coverMincard_antitone (T : X \u2192 X) (F : Set X) (n : \u2115) :\n Antitone fun U : SetRel X X \u21a6 coverMincard T F U n :=\nfun _ _ U_V \u21a6 biInf_mono fun _ h \u21a6 h.of_entourage_subset U_V\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_mul_le_pow (L272-L284)\nlemma coverMincard_mul_le_pow (F_inv : MapsTo T F F) [U.IsSymm] (m n : \u2115) :\n coverMincard T F (U \u25cb U) (m * n) \u2264 coverMincard T F U m ^ n := by\nrcases F.eq_empty_or_nonempty with rfl | F_nonempty\n \u00b7 rw [coverMincard_empty]; exact zero_le _\n obtain rfl | hn := eq_or_ne n 0\n \u00b7 rw [mul_zero, coverMincard_zero T F_nonempty (U \u25cb U), pow_zero]\n rcases eq_top_or_lt_top (coverMincard T F U m) with h | h\n \u00b7 simp [*]\n \u00b7 obtain \u27e8s, s_cover, s_coverMincard\u27e9 := (coverMincard_finite_iff T F U m).1 h\n obtain \u27e8t, t_cover, t_sn\u27e9 := s_cover.iterate_le_pow F_inv n\n rw [\u2190 s_coverMincard]\n exact t_cover.coverMincard_le_card.trans (WithTop.coe_le_coe.2 t_sn)\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.le_coverEntropyInfEntourage_image (L119-L122)\nlemma le_coverEntropyInfEntourage_image (h : Semiconj \u03c6 S T) (F : Set X) [V.IsSymm] :\n coverEntropyInfEntourage S F ((map \u03c6 \u03c6) \u207b\u00b9' (V \u25cb V)) \u2264 coverEntropyInfEntourage T (\u03c6 '' F) V :=\nexpGrowthInf_monotone fun n \u21a6 ENat.toENNReal_mono (le_coverMincard_image h F n)\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.le_coverEntropyEntourage_image (L115-L118)\nlemma le_coverEntropyEntourage_image (h : Semiconj \u03c6 S T) (F : Set X) [V.IsSymm] :\n coverEntropyEntourage S F ((map \u03c6 \u03c6) \u207b\u00b9' (V \u25cb V)) \u2264 coverEntropyEntourage T (\u03c6 '' F) V :=\nexpGrowthSup_monotone fun n \u21a6 ENat.toENNReal_mono (le_coverMincard_image h F n)\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInfEntourage_le_coverEntropyInf (L453-L457)\nlemma coverEntropyInfEntourage_le_coverEntropyInf (T : X \u2192 X) (F : Set X)\n (h : U \u2208 \ud835\udce4 X) :\n coverEntropyInfEntourage T F U \u2264 coverEntropyInf T F :=\nle_iSup\u2082 (f := fun (U : SetRel X X) (_ : U \u2208 \ud835\udce4 X) \u21a6 coverEntropyInfEntourage T F U) U h\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_finite_iff (L222-L241)\nlemma coverMincard_finite_iff (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) :\n coverMincard T F U n < \u22a4 \u2194\n \u2203 s : Finset X, IsDynCoverOf T F U n s \u2227 s.card = coverMincard T F U n := by\nrefine \u27e8fun h_fin \u21a6 ?_, fun \u27e8s, _, s_coverMincard\u27e9 \u21a6 s_coverMincard \u25b8 WithTop.coe_lt_top s.card\u27e9\n obtain \u27e8k, k_min\u27e9 := WithTop.ne_top_iff_exists.1 h_fin.ne\n rw [\u2190 k_min]\n simp only [ENat.some_eq_coe, Nat.cast_inj]\n have : Nonempty {s : Finset X // IsDynCoverOf T F U n s} := by\n by_contra h\n apply ENat.coe_ne_top k\n rw [\u2190 ENat.some_eq_coe, k_min, coverMincard, iInf\u2082_eq_top]\n simp only [ENat.coe_ne_top, imp_false]\n rw [nonempty_subtype, not_exists] at h\n exact h\n have key := ciInf_mem fun s : {s : Finset X // IsDynCoverOf T F U n s} \u21a6 (s.val.card : \u2115\u221e)\n rw [coverMincard, iInf_subtype'] at k_min\n rw [\u2190 k_min, mem_range, Subtype.exists] at key\n simp only [ENat.some_eq_coe, Nat.cast_inj, exists_prop] at key\n exact key\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_zero (L255-L263)\nlemma coverMincard_zero (T : X \u2192 X) (h : F.Nonempty) (U : SetRel X X) :\n coverMincard T F U 0 = 1 := by\napply le_antisymm _ ((one_le_coverMincard_iff T F U 0).2 h)\n obtain \u27e8x, _\u27e9 := h\n have := isDynCoverOf_zero T F U (singleton_nonempty x)\n rw [\u2190 Finset.coe_singleton] at this\n apply this.coverMincard_le_card.trans_eq\n rw [Finset.card_singleton, Nat.cast_one]\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.dynEntourage (L51-L53)\ndef dynEntourage (T : X \u2192 X) (U : SetRel X X) (n : \u2115) : SetRel X X :=\n\u22c2 k < n, (map T T)^[k] \u207b\u00b9' U\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropyEntourage_image_le (L123-L126)\nlemma coverEntropyEntourage_image_le (h : Semiconj \u03c6 S T) (F : Set X) (V : SetRel Y Y) :\n coverEntropyEntourage T (\u03c6 '' F) V \u2264 coverEntropyEntourage S F ((map \u03c6 \u03c6) \u207b\u00b9' V) :=\nexpGrowthSup_monotone fun n \u21a6 ENat.toENNReal_mono (coverMincard_image_le h F V n)\n```\n\n-- snippet 84\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.dynEntourage_monotone (L126-L129)\nlemma dynEntourage_monotone (T : X \u2192 X) (n : \u2115) :\n Monotone (fun U : SetRel X X \u21a6 dynEntourage T U n) :=\nfun _ _ h \u21a6 iInter\u2082_mono fun _ _ \u21a6 preimage_mono h\n```\n\n-- snippet 85\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_finite_of_isCompact_invariant (L296-L304)\nlemma coverMincard_finite_of_isCompact_invariant [UniformSpace X] (F_comp : IsCompact F)\n (F_inv : MapsTo T F F) (U_uni : U \u2208 \ud835\udce4 X) (n : \u2115) :\n coverMincard T F U n < \u22a4 := by\nobtain \u27e8s, s_cover\u27e9 := exists_isDynCoverOf_of_isCompact_invariant F_comp F_inv U_uni n\n exact s_cover.coverMincard_le_card.trans_lt (WithTop.coe_lt_top s.card)\n\n/-- All dynamical balls of a minimal dynamical cover of `F` intersect `F`. This lemma is the key\n to relate Bowen-Dinaburg's definition of topological entropy with covers and their definition\n of topological entropy with nets. -/\n```\n\n-- snippet 86\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInf_nonneg (L489-L492)\nlemma coverEntropyInf_nonneg (T : X \u2192 X) (h : F.Nonempty) : 0 \u2264 coverEntropyInf T F :=\n(coverEntropyInfEntourage_le_coverEntropyInf T F univ_mem).trans_eq'\n (coverEntropyInfEntourage_univ T h)\n```\n\n-- snippet 87\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInfEntourage_antitone (L341-L344)\nlemma coverEntropyInfEntourage_antitone (T : X \u2192 X) (F : Set X) :\n Antitone fun U : SetRel X X \u21a6 coverEntropyInfEntourage T F U :=\nfun _ _ U_V \u21a6 expGrowthInf_monotone fun n \u21a6 ENat.toENNReal_mono (coverMincard_antitone T F n U_V)\n```\n\n-- snippet 88\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.ball_dynEntourage_mem_nhds (L78-L86)\nlemma ball_dynEntourage_mem_nhds [UniformSpace X] (h : Continuous T)\n (U_uni : U \u2208 \ud835\udce4 X) (n : \u2115) (x : X) :\n ball x (dynEntourage T U n) \u2208 \ud835\udcdd x := by\nrw [dynEntourage_eq_inter_Ico T U n, ball_iInter, Filter.iInter_mem, Subtype.forall]\n intro k _\n simp only [map_iterate, _root_.ball_preimage]\n exact (h.iterate k).continuousAt.preimage_mem_nhds (ball_mem_nhds (T^[k] x) U_uni)\n\nset_option linter.flexible false in -- simp followed by infer_instance\n```\n\n-- snippet 89\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.dynEntourage_univ (L142-L144)\nlemma dynEntourage_univ {T : X \u2192 X} {n : \u2115} :\n dynEntourage T univ n = univ := by simp [dynEntourage]\n```\n\n-- snippet 90\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.exists_isDynCoverOf_of_isCompact_uniformContinuous (L182-L190)\nlemma exists_isDynCoverOf_of_isCompact_uniformContinuous [UniformSpace X]\n (F_comp : IsCompact F) (h : UniformContinuous T) (U_uni : U \u2208 \ud835\udce4 X) (n : \u2115) :\n \u2203 s : Finset X, IsDynCoverOf T F U n s := by\nobtain \u27e8(V : SetRel X X), hV, hVsymm, hVU\u27e9 := symm_of_uniformity U_uni\n have uni_ite := dynEntourage_mem_uniformity h hV n\n let openCover x := ball x (dynEntourage T V n)\n obtain \u27e8s, _, s_cover\u27e9 := F_comp.elim_nhds_subcover openCover fun x _ \u21a6 ball_mem_nhds x uni_ite\n exact \u27e8s, .of_entourage_subset hVU <| .of_subset_iUnion_ball s_cover\u27e9\n```\n\n-- snippet 91\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.mem_ball_dynEntourage_comp (L145-L151)\nlemma mem_ball_dynEntourage_comp (T : X \u2192 X) (n : \u2115) {U : SetRel X X} [U.IsSymm]\n (x y : X) (h : (ball x (dynEntourage T U n) \u2229 ball y (dynEntourage T U n)).Nonempty) :\n x \u2208 ball y (dynEntourage T (U \u25cb U) n) := by\nrcases h with \u27e8z, z_Bx, z_By\u27e9\n rw [mem_ball_symmetry] at z_Bx\n exact dynEntourage_comp_subset T U U n (mem_ball_comp z_By z_Bx)\n```\n\n-- snippet 92\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropyInf_restrict_subset (L181-L187)\nlemma coverEntropyInf_restrict_subset [UniformSpace X] {T : X \u2192 X} {F G : Set X} (hF : F \u2286 G)\n (hG : MapsTo T G G) :\n coverEntropyInf (hG.restrict T G G) (val \u207b\u00b9' F) = coverEntropyInf T F := by\nrw [\u2190 coverEntropyInf_image_of_comap _ hG.val_restrict_apply (val \u207b\u00b9' F), image_preimage_coe G F,\n inter_eq_right.2 hF]\n\n/-- The entropy of the restriction of `T` to an invariant set `F` is `coverEntropy T F`. This\n```\n\n-- snippet 93\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInfEntourage_empty (L359-L361)\nlemma coverEntropyInfEntourage_empty : coverEntropyInfEntourage T \u2205 U = \u22a5 :=\neq_bot_mono (coverEntropyInfEntourage_le_coverEntropyEntourage T \u2205 U) coverEntropyEntourage_empty\n```\n\n-- snippet 94\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.dynEntourage_mono (L135-L137)\nlemma dynEntourage_mono (hUV : U \u2286 V) (hmn : m \u2264 n) : dynEntourage T U n \u2286 dynEntourage T V m :=\n(dynEntourage_monotone _ _ hUV).trans (dynEntourage_antitone _ _ hmn)\n```\n\n-- snippet 95\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropy_image_of_comap (L133-L153)\ntheorem coverEntropy_image_of_comap (u : UniformSpace Y) {S : X \u2192 X} {T : Y \u2192 Y} {\u03c6 : X \u2192 Y}\n (h : Semiconj \u03c6 S T) (F : Set X) :\n coverEntropy T (\u03c6 '' F) = @coverEntropy X (comap \u03c6 u) S F := by\nlet : UniformSpace X := comap \u03c6 u\n apply le_antisymm\n \u00b7 refine iSup\u2082_le fun V V_uni \u21a6\n (coverEntropyEntourage_antitone _ _ SetRel.symmetrize_subset_self).trans <|\n (coverEntropyEntourage_image_le h F _).trans ?_\n apply coverEntropyEntourage_le_coverEntropy\n rw [uniformity_comap \u03c6, mem_comap]\n exact \u27e8_, symmetrize_mem_uniformity V_uni, .rfl\u27e9\n \u00b7 refine iSup\u2082_le fun U U_uni \u21a6 ?_\n simp only [uniformity_comap \u03c6, mem_comap] at U_uni\n obtain \u27e8V, V_uni, V_sub\u27e9 := U_uni\n obtain \u27e8W, W_uni, W_symm, W_V\u27e9 := comp_symm_mem_uniformity_sets V_uni\n apply (coverEntropyEntourage_antitone S F ((preimage_mono W_V).trans V_sub)).trans\n apply (le_coverEntropyEntourage_image h F).trans\n exact coverEntropyEntourage_le_coverEntropy T (\u03c6 '' F) W_uni\n\n/-- The entropy of `\u03c6 '' F` equals the entropy of `F` if `X` is endowed with the pullback by `\u03c6`\n of the uniform structure of `Y`. This version uses a `liminf`. -/\n```\n\n-- snippet 96\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.mem_dynEntourage (L58-L60)\nlemma mem_dynEntourage : (x, y) \u2208 dynEntourage T U n \u2194 \u2200 k < n, (T^[k] x, T^[k] y) \u2208 U := by\nsimp [dynEntourage]\n```\n\n-- snippet 97\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.IsDynCoverOf (L65-L71)\nlemma IsDynCoverOf.image (h : Semiconj \u03c6 S T) (h' : IsDynCoverOf S F (map \u03c6 \u03c6 \u207b\u00b9' V) n s) :\n IsDynCoverOf T (\u03c6 '' F) V n (\u03c6 '' s) := by\nrintro _ \u27e8x, hx, rfl\u27e9\n obtain \u27e8y, hy, hxy\u27e9 := h' hx\n refine \u27e8_, Set.mem_image_of_mem _ hy, show (x, y) \u2208 map \u03c6 \u03c6 \u207b\u00b9' dynEntourage T V n from ?_\u27e9\n rwa [h.preimage_dynEntourage V n]\n```\n\n-- snippet 98\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInfEntourage_le_coverEntropyEntourage (L349-L352)\nlemma coverEntropyInfEntourage_le_coverEntropyEntourage (T : X \u2192 X) (F : Set X) (U : SetRel X X) :\n coverEntropyInfEntourage T F U \u2264 coverEntropyEntourage T F U :=\nexpGrowthInf_le_expGrowthSup\n```\n\n-- snippet 99\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_univ (L264-L271)\nlemma coverMincard_univ (T : X \u2192 X) (h : F.Nonempty) (n : \u2115) : coverMincard T F univ n = 1 := by\napply le_antisymm _ ((one_le_coverMincard_iff T F univ n).2 h)\n obtain \u27e8x, _\u27e9 := h\n have := isDynCoverOf_univ T F n (singleton_nonempty x)\n rw [\u2190 Finset.coe_singleton] at this\n apply this.coverMincard_le_card.trans_eq\n rw [Finset.card_singleton, Nat.cast_one]\n```\n\n-- snippet 100\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyEntourage_univ (L376-L380)\nlemma coverEntropyEntourage_univ (T : X \u2192 X) (h : F.Nonempty) :\n coverEntropyEntourage T F univ = 0 := by\nrw [\u2190 expGrowthSup_const one_ne_zero one_ne_top, coverEntropyEntourage]\n simp only [coverMincard_univ T h, ENat.toENNReal_one]\n```\n\n-- snippet 101\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInfEntourage_nonneg (L362-L370)\nlemma coverEntropyInfEntourage_nonneg (T : X \u2192 X) (h : F.Nonempty) (U : SetRel X X) :\n 0 \u2264 coverEntropyInfEntourage T F U := by\napply Monotone.expGrowthInf_nonneg\n \u00b7 exact fun _ _ m_n \u21a6 ENat.toENNReal_mono (coverMincard_monotone_time T F U m_n)\n \u00b7 rw [ne_eq, funext_iff.not, not_forall]\n use 0\n rw [coverMincard_zero T h U, Pi.zero_apply, ENat.toENNReal_one]\n exact one_ne_zero\n```\n\n-- snippet 102\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.dynEntourage_comp_subset (L111-L118)\nlemma dynEntourage_comp_subset (T : X \u2192 X) (U V : SetRel X X) (n : \u2115) :\n (dynEntourage T U n) \u25cb (dynEntourage T V n) \u2286 dynEntourage T (U \u25cb V) n := by\nsimp only [dynEntourage, map_iterate, subset_iInter_iff]\n intro k k_n xy xy_comp\n simp only [SetRel.comp, mem_iInter, mem_preimage, map_apply, mem_setOf_eq] at xy_comp \u22a2\n rcases xy_comp with \u27e8z, hz1, hz2\u27e9\n exact mem_ball_comp (hz1 k k_n) (hz2 k k_n)\n```\n\n-- snippet 103\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropy_image_le_of_uniformContinuous (L194-L201)\ntheorem coverEntropy_image_le_of_uniformContinuous [UniformSpace X] [UniformSpace Y] {S : X \u2192 X}\n {T : Y \u2192 Y} {\u03c6 : X \u2192 Y} (h : Semiconj \u03c6 S T) (h' : UniformContinuous \u03c6) (F : Set X) :\n coverEntropy T (\u03c6 '' F) \u2264 coverEntropy S F := by\nrw [coverEntropy_image_of_comap _ h F]\n exact coverEntropy_antitone S F (uniformContinuous_iff.1 h')\n\n/-- The entropy of `\u03c6 '' F` is at most the entropy of `F` if `\u03c6` is uniformly continuous. This\n version uses a `liminf`. -/\n```\n\n-- snippet 104\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.idRel_subset_dynEntourage (L96-L101)\nlemma idRel_subset_dynEntourage (T : X \u2192 X) {U : Set (X \u00d7 X)} (h : idRel \u2286 U) (n : \u2115) :\n idRel \u2286 (dynEntourage T U n) := by\nsimp only [dynEntourage, map_iterate, subset_iInter_iff, idRel_subset, mem_preimage, map_apply]\n exact fun _ _ _ \u21a6 h rfl\n\nset_option linter.deprecated false in\n```\n\n-- snippet 105\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropy_empty (L482-L484)\nlemma coverEntropy_empty : coverEntropy T \u2205 = \u22a5 := by\nsimp only [coverEntropy, coverEntropyEntourage_empty, iSup_bot]\n```\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.TopologicalEntropy.NetEntropy).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma netEntropyInfEntourage_univ (T : X \u2192 X) {F : Set X} (h : F.Nonempty) :\n netEntropyInfEntourage T F univ = 0\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.IsDynNetIn (L67-L69)\ndef IsDynNetIn (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) (s : Set X) : Prop :=\ns \u2286 F \u2227 s.PairwiseDisjoint fun x : X \u21a6 ball x (dynEntourage T U n)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.IsDynNetIn (L70-L72)\nlemma IsDynNetIn.of_le (m_n : m \u2264 n) (h : IsDynNetIn T F U m s) : IsDynNetIn T F U n s :=\n\u27e8h.1, PairwiseDisjoint.mono h.2 fun x \u21a6 ball_mono (dynEntourage_antitone T U m_n) x\u27e9\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.IsDynNetIn (L73-L76)\nlemma IsDynNetIn.of_entourage_subset (U_V : U \u2286 V) (h : IsDynNetIn T F V n s) :\n IsDynNetIn T F U n s :=\n\u27e8h.1, PairwiseDisjoint.mono h.2 fun x \u21a6 ball_mono (dynEntourage_monotone T n U_V) x\u27e9\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.isDynNetIn_empty (L77-L78)\nlemma isDynNetIn_empty : IsDynNetIn T F U n \u2205 := \u27e8empty_subset F, pairwise_empty _\u27e9\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.isDynNetIn_singleton (L79-L85)\nlemma isDynNetIn_singleton (T : X \u2192 X) (U : SetRel X X) (n : \u2115) (h : x \u2208 F) :\n IsDynNetIn T F U n {x} :=\n\u27e8singleton_subset_iff.2 h, pairwise_singleton x _\u27e9\n\n/-- Given an entourage `U` and a time `n`, a dynamical net has a smaller cardinality than\n a dynamical cover. This lemma is the first of two key results to compare two versions of\n topological entropy: with cover and with nets, the second being `coverMincard_le_netMaxcard`. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.IsDynNetIn (L86-L102)\nlemma IsDynNetIn.card_le_card_of_isDynCoverOf {s t : Finset X}\n (hs : IsDynNetIn T F U n s) (ht : IsDynCoverOf T F U n t) :\n s.card \u2264 t.card := by\nhave (x : X) (x_s : x \u2208 s) : \u2203 z \u2208 t, z \u2208 ball x (dynEntourage T U n) := by\n simpa using ht (hs.1 x_s)\n choose! F s_t using this\n apply Finset.card_le_card_of_injOn F fun x x_s \u21a6 (s_t x x_s).1\n exact fun x x_s y y_s Fx_Fy \u21a6\n PairwiseDisjoint.elim_set hs.2 x_s y_s (F x) (s_t x x_s).2 (Fx_Fy \u25b8 (s_t y y_s).2)\n\n/-! ### Maximal cardinality of dynamical nets -/\n\n/-- The largest cardinality of a `(U, n)`-dynamical net of `F`. Takes values in `\u2115\u221e`, and is\ninfinite if and only if `F` admits nets of arbitrarily large size. -/\nnoncomputable def netMaxcard (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) : \u2115\u221e :=\n \u2a06 (s : Finset X) (_ : IsDynNetIn T F U n s), (s.card : \u2115\u221e)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.IsDynNetIn (L103-L106)\nlemma IsDynNetIn.card_le_netMaxcard {s : Finset X} (h : IsDynNetIn T F U n s) :\n s.card \u2264 netMaxcard T F U n :=\nle_iSup\u2082 (\u03b1 := \u2115\u221e) s h\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netMaxcard_monotone_time (L107-L110)\nlemma netMaxcard_monotone_time (T : X \u2192 X) (F : Set X) (U : SetRel X X) :\n Monotone fun n : \u2115 \u21a6 netMaxcard T F U n :=\nfun _ _ m_n \u21a6 biSup_mono fun _ h \u21a6 h.of_le m_n\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netMaxcard_antitone (L111-L115)\nlemma netMaxcard_antitone (T : X \u2192 X) (F : Set X) (n : \u2115) :\n Antitone fun U : SetRel X X \u21a6 netMaxcard T F U n :=\nfun _ _ U_V \u21a6 biSup_mono fun _ h \u21a6 h.of_entourage_subset U_V\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netMaxcard_finite_iff (L116-L150)\nlemma netMaxcard_finite_iff (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) :\n netMaxcard T F U n < \u22a4 \u2194\n \u2203 s : Finset X, IsDynNetIn T F U n s \u2227 (s.card : \u2115\u221e) = netMaxcard T F U n := by\napply Iff.intro <;> intro h\n \u00b7 obtain \u27e8k, k_max\u27e9 := WithTop.ne_top_iff_exists.1 h.ne\n rw [\u2190 k_max]\n simp only [ENat.some_eq_coe, Nat.cast_inj]\n -- The criterion we want to use is `Nat.sSup_mem`. We rewrite `netMaxcard` with an `sSup`,\n -- then check its `BddAbove` and `Nonempty` hypotheses.\n have : netMaxcard T F U n\n = sSup (WithTop.some '' (Finset.card '' {s : Finset X | IsDynNetIn T F U n s})) := by\n rw [netMaxcard, \u2190 image_comp, sSup_image]\n simp only [mem_setOf_eq, ENat.some_eq_coe, Function.comp_apply]\n rw [this] at k_max\n have h_bdda : BddAbove (Finset.card '' {s : Finset X | IsDynNetIn T F U n s}) := by\n refine \u27e8k, mem_upperBounds.2 ?_\u27e9\n simp only [mem_image, mem_setOf_eq, forall_exists_index, and_imp, forall_apply_eq_imp_iff\u2082]\n intro s h\n rw [\u2190 WithTop.coe_le_coe, k_max]\n apply le_sSup\n simp only [ENat.some_eq_coe, mem_image, mem_setOf_eq, Nat.cast_inj, exists_eq_right]\n exact Filter.frequently_principal.mp fun a \u21a6 a h rfl\n have h_nemp : (Finset.card '' {s : Finset X | IsDynNetIn T F U n s}).Nonempty := by\n refine \u27e80, ?_\u27e9\n simp only [mem_image, mem_setOf_eq, Finset.card_eq_zero, exists_eq_right, Finset.coe_empty]\n exact isDynNetIn_empty\n rw [\u2190 WithTop.coe_sSup' h_bdda, ENat.some_eq_coe, Nat.cast_inj] at k_max\n have key := Nat.sSup_mem h_nemp h_bdda\n rw [\u2190 k_max, mem_image] at key\n simp only [mem_setOf_eq] at key\n exact key\n \u00b7 obtain \u27e8s, _, s_card\u27e9 := h\n rw [\u2190 s_card]\n exact WithTop.coe_lt_top s.card\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netMaxcard_empty (L152-L158)\nlemma netMaxcard_empty : netMaxcard T \u2205 U n = 0 := by\nrw [netMaxcard, \u2190 bot_eq_zero, iSup\u2082_eq_bot]\n intro s s_net\n replace s_net := subset_empty_iff.1 s_net.1\n norm_cast at s_net\n rw [s_net, Finset.card_empty, CharP.cast_eq_zero, bot_eq_zero']\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netMaxcard_eq_zero_iff (L159-L169)\nlemma netMaxcard_eq_zero_iff (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) :\n netMaxcard T F U n = 0 \u2194 F = \u2205 := by\nrefine \u27e8fun h \u21a6 ?_, fun h \u21a6 by rw [h, netMaxcard_empty]\u27e9\n rw [eq_empty_iff_forall_notMem]\n intro x x_F\n have key := isDynNetIn_singleton T U n x_F\n rw [\u2190 Finset.coe_singleton] at key\n replace key := key.card_le_netMaxcard\n rw [Finset.card_singleton, Nat.cast_one, h] at key\n exact key.not_gt zero_lt_one\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.one_le_netMaxcard_iff (L170-L174)\nlemma one_le_netMaxcard_iff (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) :\n 1 \u2264 netMaxcard T F U n \u2194 F.Nonempty := by\nrw [ENat.one_le_iff_ne_zero, nonempty_iff_ne_empty]\n exact not_iff_not.2 (netMaxcard_eq_zero_iff T F U n)\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netMaxcard_zero (L175-L182)\nlemma netMaxcard_zero (T : X \u2192 X) (h : F.Nonempty) (U : SetRel X X) : netMaxcard T F U 0 = 1 := by\napply (iSup\u2082_le _).antisymm ((one_le_netMaxcard_iff T F U 0).2 h)\n intro s \u27e8_, s_net\u27e9\n simp only [ball, dynEntourage_zero, preimage_univ] at s_net\n norm_cast\n refine Finset.card_le_one.2 fun x x_s y y_s \u21a6 ?_\n exact PairwiseDisjoint.elim_set s_net x_s y_s x (mem_univ x) (mem_univ x)\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netMaxcard_univ (L183-L191)\nlemma netMaxcard_univ (T : X \u2192 X) (h : F.Nonempty) (n : \u2115) : netMaxcard T F univ n = 1 := by\napply (iSup\u2082_le _).antisymm ((one_le_netMaxcard_iff T F univ n).2 h)\n intro s \u27e8_, s_net\u27e9\n simp only [ball, dynEntourage_univ, preimage_univ] at s_net\n norm_cast\n refine Finset.card_le_one.2 fun x x_s y y_s \u21a6 ?_\n exact PairwiseDisjoint.elim_set s_net x_s y_s x (mem_univ x) (mem_univ x)\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netMaxcard_infinite_iff (L192-L207)\nlemma netMaxcard_infinite_iff (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) :\n netMaxcard T F U n = \u22a4 \u2194 \u2200 k : \u2115, \u2203 s : Finset X, IsDynNetIn T F U n s \u2227 k \u2264 s.card := by\napply Iff.intro <;> intro h\n \u00b7 intro k\n rw [netMaxcard, iSup_subtype', iSup_eq_top] at h\n specialize h k (ENat.coe_lt_top k)\n simp only [Nat.cast_lt, Subtype.exists, exists_prop] at h\n obtain \u27e8s, s_net, s_k\u27e9 := h\n exact \u27e8s, s_net, s_k.le\u27e9\n \u00b7 refine WithTop.eq_top_iff_forall_gt.2 fun k \u21a6 ?_\n specialize h (k + 1)\n obtain \u27e8s, s_net, s_card\u27e9 := h\n apply s_net.card_le_netMaxcard.trans_lt'\n rw [ENat.some_eq_coe, Nat.cast_lt]\n exact (lt_add_one k).trans_le s_card\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netMaxcard_le_coverMincard (L208-L218)\nlemma netMaxcard_le_coverMincard (T : X \u2192 X) (F : Set X) (n : \u2115) :\n netMaxcard T F U n \u2264 coverMincard T F U n := by\nrcases eq_top_or_lt_top (coverMincard T F U n) with h | h\n \u00b7 exact h \u25b8 le_top\n \u00b7 obtain \u27e8t, t_cover, t_mincard\u27e9 := (coverMincard_finite_iff T F U n).1 h\n rw [\u2190 t_mincard]\n exact iSup\u2082_le fun s s_net \u21a6 Nat.cast_le.2 (s_net.card_le_card_of_isDynCoverOf t_cover)\n\n/-- Given an entourage `U` and a time `n`, a minimal dynamical cover by `U \u25cb U` has a smaller\n cardinality than a maximal dynamical net by `U`. This lemma is the second of two key results to\n compare two versions topological entropy: with cover and with nets. -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.coverMincard_le_netMaxcard (L219-L261)\nlemma coverMincard_le_netMaxcard (T : X \u2192 X) (F : Set X) [U.IsRefl] [U.IsSymm] (n : \u2115) :\n coverMincard T F (U \u25cb U) n \u2264 netMaxcard T F U n := by\nclassical\n -- WLOG, there exists a maximal dynamical net `s`.\n rcases eq_top_or_lt_top (netMaxcard T F U n) with h | h\n \u00b7 exact h \u25b8 le_top\n obtain \u27e8s, s_net, s_card\u27e9 := (netMaxcard_finite_iff T F U n).1 h\n rw [\u2190 s_card]\n apply IsDynCoverOf.coverMincard_le_card\n -- We have to check that `s` is a cover for `dynEntourage T F (U \u25cb U) n`.\n -- If `s` is not a cover, then we can add to `s` a point `x` which is not covered\n -- and get a new net. This contradicts the maximality of `s`.\n rw [IsDynCoverOf, isCover_iff_subset_iUnion_ball]\n by_contra h\n obtain \u27e8x, x_F, x_uncov\u27e9 := not_subset.1 h\n simp only [Finset.mem_coe, mem_iUnion, exists_prop, not_exists, not_and] at x_uncov\n have larger_net : IsDynNetIn T F U n (insert x s) := by\n refine \u27e8insert_subset x_F s_net.1, pairwiseDisjoint_insert.2 \u27e8s_net.2, ?_\u27e9\u27e9\n refine fun y y_s _ \u21a6 disjoint_left.2 fun z z_x z_y \u21a6 x_uncov y y_s ?_\n exact mem_ball_dynEntourage_comp T n x y (nonempty_of_mem \u27e8z_x, z_y\u27e9)\n rw [\u2190 s.coe_insert x] at larger_net\n apply larger_net.card_le_netMaxcard.not_gt\n rw [\u2190 s_card, Nat.cast_lt]\n refine (lt_add_one s.card).trans_eq (s.card_insert_of_notMem fun x_s \u21a6 ?_).symm\n exact x_uncov x x_s (ball_mono (dynEntourage_monotone T n SetRel.left_subset_comp) x <|\n SetRel.rfl (dynEntourage T U n))\n\n/-! ### Net entropy of entourages -/\n\nopen ENNReal EReal ExpGrowth Filter\n\n/-- The entropy of an entourage `U`, defined as the exponential rate of growth of the size of the\nlargest `(U, n)`-dynamical net of `F`. Takes values in the space of extended real numbers\n`[-\u221e,+\u221e]`. This version uses a `limsup`, and is chosen as the default definition. -/\nnoncomputable def netEntropyEntourage (T : X \u2192 X) (F : Set X) (U : SetRel X X) :=\n expGrowthSup fun n : \u2115 \u21a6 netMaxcard T F U n\n\n/-- The entropy of an entourage `U`, defined as the exponential rate of growth of the size of the\nlargest `(U, n)`-dynamical net of `F`. Takes values in the space of extended real numbers\n`[-\u221e,+\u221e]`. This version uses a `liminf`, and is an alternative definition. -/\nnoncomputable def netEntropyInfEntourage (T : X \u2192 X) (F : Set X) (U : SetRel X X) :=\n expGrowthInf fun n : \u2115 \u21a6 netMaxcard T F U n\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netEntropyInfEntourage_antitone (L262-L265)\nlemma netEntropyInfEntourage_antitone (T : X \u2192 X) (F : Set X) :\n Antitone fun U : SetRel X X \u21a6 netEntropyInfEntourage T F U :=\nfun _ _ U_V \u21a6 expGrowthInf_monotone fun n \u21a6 ENat.toENNReal_mono (netMaxcard_antitone T F n U_V)\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netEntropyEntourage_antitone (L266-L269)\nlemma netEntropyEntourage_antitone (T : X \u2192 X) (F : Set X) :\n Antitone fun U : SetRel X X \u21a6 netEntropyEntourage T F U :=\nfun _ _ U_V \u21a6 expGrowthSup_monotone fun n \u21a6 ENat.toENNReal_mono (netMaxcard_antitone T F n U_V)\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netEntropyInfEntourage_le_netEntropyEntourage (L270-L273)\nlemma netEntropyInfEntourage_le_netEntropyEntourage (T : X \u2192 X) (F : Set X) (U : SetRel X X) :\n netEntropyInfEntourage T F U \u2264 netEntropyEntourage T F U :=\nexpGrowthInf_le_expGrowthSup\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netEntropyEntourage_empty (L275-L279)\nlemma netEntropyEntourage_empty : netEntropyEntourage T \u2205 U = \u22a5 := by\nrw [netEntropyEntourage, \u2190 expGrowthSup_zero]\n congr\n simp only [netMaxcard_empty, ENat.toENNReal_zero, Pi.zero_def]\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netEntropyInfEntourage_empty (L281-L283)\nlemma netEntropyInfEntourage_empty : netEntropyInfEntourage T \u2205 U = \u22a5 :=\neq_bot_mono (netEntropyInfEntourage_le_netEntropyEntourage T \u2205 U) netEntropyEntourage_empty\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netEntropyInfEntourage_nonneg (L284-L292)\nlemma netEntropyInfEntourage_nonneg (T : X \u2192 X) (h : F.Nonempty) (U : SetRel X X) :\n 0 \u2264 netEntropyInfEntourage T F U := by\napply Monotone.expGrowthInf_nonneg\n \u00b7 exact fun _ _ m_n \u21a6 ENat.toENNReal_mono (netMaxcard_monotone_time T F U m_n)\n \u00b7 rw [ne_eq, funext_iff.not, not_forall]\n use 0\n rw [netMaxcard_zero T h U, Pi.zero_apply, ENat.toENNReal_one]\n exact one_ne_zero\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netEntropyEntourage_nonneg (L293-L296)\nlemma netEntropyEntourage_nonneg (T : X \u2192 X) (h : F.Nonempty) (U : SetRel X X) :\n 0 \u2264 netEntropyEntourage T F U :=\n(netEntropyInfEntourage_nonneg T h U).trans (netEntropyInfEntourage_le_netEntropyEntourage T F U)\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_finite_of_isCompact_uniformContinuous (L290-L295)\nlemma coverMincard_finite_of_isCompact_uniformContinuous [UniformSpace X] (F_comp : IsCompact F)\n (h : UniformContinuous T) (U_uni : U \u2208 \ud835\udce4 X) (n : \u2115) :\n coverMincard T F U n < \u22a4 := by\nobtain \u27e8s, s_cover\u27e9 := exists_isDynCoverOf_of_isCompact_uniformContinuous F_comp h U_uni n\n exact s_cover.coverMincard_le_card.trans_lt (WithTop.coe_lt_top s.card)\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyEntourage_nonneg (L371-L375)\nlemma coverEntropyEntourage_nonneg (T : X \u2192 X) (h : F.Nonempty) (U : SetRel X X) :\n 0 \u2264 coverEntropyEntourage T F U :=\n(coverEntropyInfEntourage_nonneg T h U).trans\n (coverEntropyInfEntourage_le_coverEntropyEntourage T F U)\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.one_le_coverMincard_iff (L250-L254)\nlemma one_le_coverMincard_iff (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) :\n 1 \u2264 coverMincard T F U n \u2194 F.Nonempty := by\nrw [ENat.one_le_iff_ne_zero, nonempty_iff_ne_empty, not_iff_not]\n exact coverMincard_eq_zero_iff T F U n\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInf_empty (L486-L488)\nlemma coverEntropyInf_empty : coverEntropyInf T \u2205 = \u22a5 := by\nsimp only [coverEntropyInf, coverEntropyInfEntourage_empty, iSup_bot]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.le_coverMincard_image (L93-L101)\nlemma le_coverMincard_image (h : Semiconj \u03c6 S T) (F : Set X) [V.IsSymm] (n : \u2115) :\n coverMincard S F ((map \u03c6 \u03c6) \u207b\u00b9' (V \u25cb V)) n \u2264 coverMincard T (\u03c6 '' F) V n := by\nrcases eq_top_or_lt_top (coverMincard T (\u03c6 '' F) V n) with h' | h'\n \u00b7 exact h' \u25b8 le_top\n obtain \u27e8t, t_cover, t_card\u27e9 := (coverMincard_finite_iff T (\u03c6 '' F) V n).1 h'\n obtain \u27e8s, s_cover, s_card\u27e9 := t_cover.preimage h\n rw [\u2190 t_card]\n exact s_cover.coverMincard_le_card.trans (WithTop.coe_le_coe.2 s_card)\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.dynEntourage_mem_uniformity (L65-L77)\nlemma dynEntourage_mem_uniformity [UniformSpace X] (h : UniformContinuous T)\n (U_uni : U \u2208 \ud835\udce4 X) (n : \u2115) :\n dynEntourage T U n \u2208 \ud835\udce4 X := by\nrw [dynEntourage_eq_inter_Ico T U n]\n induction n with\n | zero => simp\n | succ n ih =>\n simp only [iInter_coe_set, mem_Ico, Nat.zero_le, true_and] at ih \u22a2\n rw [Set.biInter_lt_succ]\n apply Filter.inter_mem ih\n rw [map_iterate T T n]\n exact uniformContinuous_def.1 (UniformContinuous.iterate T n h) U U_uni\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_monotone_time (L213-L216)\nlemma coverMincard_monotone_time (T : X \u2192 X) (F : Set X) (U : SetRel X X) :\n Monotone fun n : \u2115 \u21a6 coverMincard T F U n :=\nfun _ _ m_n \u21a6 biInf_mono fun _ h \u21a6 h.of_le m_n\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropy_restrict (L189-L193)\ntheorem coverEntropy_restrict [UniformSpace X] {T : X \u2192 X} {F : Set X} (h : MapsTo T F F) :\n coverEntropy (h.restrict T F F) univ = coverEntropy T F := by\nrw [\u2190 coverEntropy_restrict_subset Subset.rfl h, coe_preimage_self F]\n\n/-- The entropy of `\u03c6 '' F` is at most the entropy of `F` if `\u03c6` is uniformly continuous. -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropy_antitone (L442-L447)\nlemma coverEntropy_antitone (T : X \u2192 X) (F : Set X) :\n Antitone fun (u : UniformSpace X) \u21a6 @coverEntropy X u T F :=\nfun _ _ h \u21a6 iSup\u2082_mono' fun U U_uni \u21a6 \u27e8U, (le_def.1 h) U U_uni, le_refl _\u27e9\n\nvariable [UniformSpace X]\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInfEntourage_univ (L381-L385)\nlemma coverEntropyInfEntourage_univ (T : X \u2192 X) (h : F.Nonempty) :\n coverEntropyInfEntourage T F univ = 0 := by\nrw [\u2190 expGrowthInf_const one_ne_zero one_ne_top, coverEntropyInfEntourage]\n simp only [coverMincard_univ T h, ENat.toENNReal_one]\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyEntourage_le_coverEntropyInfEntourage (L407-L411)\nlemma coverEntropyEntourage_le_coverEntropyInfEntourage (F_inv : MapsTo T F F) [U.IsSymm] :\n coverEntropyEntourage T F (U \u25cb U) \u2264 coverEntropyInfEntourage T F U := by\nrefine (le_liminf_of_le) (eventually_atTop.2 \u27e81, fun m m_pos \u21a6 ?_\u27e9)\n exact coverEntropyEntourage_le_log_coverMincard_div F_inv (Nat.one_le_iff_ne_zero.1 m_pos)\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropy_eq_iSup_basis (L458-L466)\nlemma coverEntropy_eq_iSup_basis {\u03b9 : Sort*} {p : \u03b9 \u2192 Prop} {s : \u03b9 \u2192 SetRel X X}\n (h : (\ud835\udce4 X).HasBasis p s) (T : X \u2192 X) (F : Set X) :\n coverEntropy T F = \u2a06 (i : \u03b9) (_ : p i), coverEntropyEntourage T F (s i) := by\nrefine (iSup\u2082_le fun U U_uni \u21a6 ?_).antisymm\n (iSup\u2082_mono' fun i h_i \u21a6 \u27e8s i, HasBasis.mem_of_mem h h_i, le_refl _\u27e9)\n obtain \u27e8i, h_i, si_U\u27e9 := (HasBasis.mem_iff h).1 U_uni\n exact (coverEntropyEntourage_antitone T F si_U).trans\n (le_iSup\u2082 (f := fun (i : \u03b9) (_ : p i) \u21a6 coverEntropyEntourage T F (s i)) i h_i)\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Subset.IsDynCoverOf (L50-L53)\nlemma IsDynCoverOf.monotone_subset (F_G : F \u2286 G) (h : IsDynCoverOf T G U n s) :\n IsDynCoverOf T F U n s :=\nF_G.trans h\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.isDynCoverOf_zero (L94-L96)\nlemma isDynCoverOf_zero (T : X \u2192 X) (F : Set X) (U : SetRel X X) (h : s.Nonempty) :\n IsDynCoverOf T F U 0 s := by simp [IsDynCoverOf, h]\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.mem_ball_dynEntourage (L61-L64)\nlemma mem_ball_dynEntourage :\n y \u2208 ball x (dynEntourage T U n) \u2194 \u2200 k < n, T^[k] y \u2208 ball (T^[k] x) U := by\nsimp only [ball, mem_preimage, mem_dynEntourage]\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverMincard_image_le (L102-L114)\nlemma coverMincard_image_le (h : Semiconj \u03c6 S T) (F : Set X) (V : SetRel Y Y) (n : \u2115) :\n coverMincard T (\u03c6 '' F) V n \u2264 coverMincard S F ((map \u03c6 \u03c6) \u207b\u00b9' V) n := by\nclassical\n rcases eq_top_or_lt_top (coverMincard S F ((map \u03c6 \u03c6) \u207b\u00b9' V) n) with h' | h'\n \u00b7 exact h' \u25b8 le_top\n obtain \u27e8s, s_cover, s_card\u27e9 := (coverMincard_finite_iff S F ((map \u03c6 \u03c6) \u207b\u00b9' V) n).1 h'\n rw [\u2190 s_card]\n have := s_cover.image h\n rw [\u2190 s.coe_image] at this\n exact this.coverMincard_le_card.trans (WithTop.coe_le_coe.2 s.card_image_le)\n\nopen ENNReal EReal ExpGrowth Filter\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_eq_zero_iff (L246-L249)\nlemma coverMincard_eq_zero_iff (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) :\n coverMincard T F U n = 0 \u2194 F = \u2205 := by\nsimp [coverMincard, ENat.iInf_eq_zero]\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Subset.coverEntropyInfEntourage_monotone (L65-L69)\nlemma coverEntropyInfEntourage_monotone (T : X \u2192 X) (U : SetRel X X) :\n Monotone fun F : Set X \u21a6 coverEntropyInfEntourage T F U := by\nrefine fun F G F_G \u21a6 ExpGrowth.expGrowthInf_monotone fun n \u21a6 ?_\n exact ENat.toENNReal_mono (coverMincard_monotone_subset T U n F_G)\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropy_image_le_of_uniformContinuousOn_invariant (L208-L219)\nlemma coverEntropy_image_le_of_uniformContinuousOn_invariant [UniformSpace X] [UniformSpace Y]\n {S : X \u2192 X} {T : Y \u2192 Y} {\u03c6 : X \u2192 Y} (h : Semiconj \u03c6 S T) {F G : Set X}\n (h' : UniformContinuousOn \u03c6 G) (hF : F \u2286 G) (hG : MapsTo S G G) :\n coverEntropy T (\u03c6 '' F) \u2264 coverEntropy S F := by\nrw [\u2190 coverEntropy_restrict_subset hF hG]\n have h\u03c6 : Semiconj (G.restrict \u03c6) (hG.restrict S G G) T := by\n intro x\n rw [G.restrict_apply, G.restrict_apply, hG.val_restrict_apply, h.eq x]\n apply (coverEntropy_image_le_of_uniformContinuous h\u03c6\n (uniformContinuousOn_iff_restrict.1 h') (val \u207b\u00b9' F)).trans_eq'\n rw [\u2190 image_image_val_eq_restrict_image, image_preimage_coe G F, inter_eq_right.2 hF]\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.isDynCoverOf_univ (L97-L99)\nlemma isDynCoverOf_univ (T : X \u2192 X) (F : Set X) (n : \u2115) (h : s.Nonempty) :\n IsDynCoverOf T F univ n s := by simp [IsDynCoverOf, h]\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.isSymm_dynEntourage (L91-L94)\ninstance isSymm_dynEntourage [U.IsSymm] : (dynEntourage T U n).IsSymm := by\nsimp [dynEntourage]; infer_instance\n\nset_option linter.deprecated false in\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Subset.IsDynNetIn (L54-L56)\nlemma IsDynNetIn.monotone_subset (F_G : F \u2286 G) (h : IsDynNetIn T F U n s) : IsDynNetIn T G U n s :=\n\u27e8h.1.trans F_G, h.2\u27e9\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyEntourage_finite_of_isCompact_invariant (L412-L437)\nlemma coverEntropyEntourage_finite_of_isCompact_invariant [UniformSpace X]\n (F_comp : IsCompact F) (F_inv : MapsTo T F F) (U_uni : U \u2208 \ud835\udce4 X) :\n coverEntropyEntourage T F U < \u22a4 := by\nobtain \u27e8V, V_uni, V_symm, V_U\u27e9 := comp_symm_mem_uniformity_sets U_uni\n obtain \u27e8s, s_cover\u27e9 := exists_isDynCoverOf_of_isCompact_invariant F_comp F_inv V_uni 1\n apply (coverEntropyEntourage_antitone T F V_U).trans_lt\n apply (s_cover.coverEntropyEntourage_le_log_card_div F_inv one_ne_zero).trans_lt\n rw [Nat.cast_one, div_one, log_lt_top_iff, \u2190 ENat.toENNReal_top]\n exact_mod_cast (ENat.coe_ne_top (Finset.card s)).lt_top\n\n/-! ### Cover entropy -/\n\n/-- The entropy of `T` restricted to `F`, obtained by taking the supremum\n of `coverEntropyEntourage` over entourages. Note that this supremum is approached by taking small\n entourages. This first version uses a `limsup`, and is chosen as the default definition\n for topological entropy. -/\nnoncomputable def coverEntropy [UniformSpace X] (T : X \u2192 X) (F : Set X) :=\n \u2a06 U \u2208 \ud835\udce4 X, coverEntropyEntourage T F U\n\n/-- The entropy of `T` restricted to `F`, obtained by taking the supremum\n of `coverEntropyInfEntourage` over entourages. Note that this supremum is approached by taking\n small entourages. This second version uses a `liminf`, and is chosen as an alternative\n definition for topological entropy. -/\nnoncomputable def coverEntropyInf [UniformSpace X] (T : X \u2192 X) (F : Set X) :=\n \u2a06 U \u2208 \ud835\udce4 X, coverEntropyInfEntourage T F U\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInf_eq_coverEntropy (L496-L503)\nlemma coverEntropyInf_eq_coverEntropy (T : X \u2192 X) (h : MapsTo T F F) :\n coverEntropyInf T F = coverEntropy T F := by\nrefine le_antisymm (coverEntropyInf_le_coverEntropy T F) (iSup\u2082_le fun U U_uni \u21a6 ?_)\n obtain \u27e8V, V_uni, V_symm, V_U\u27e9 := comp_symm_mem_uniformity_sets U_uni\n exact (coverEntropyEntourage_antitone T F V_U).trans <| le_iSup\u2082_of_le V V_uni <|\n coverEntropyEntourage_le_coverEntropyInfEntourage h\n\nend Dynamics\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropy_restrict_subset (L175-L180)\nlemma coverEntropy_restrict_subset [UniformSpace X] {T : X \u2192 X} {F G : Set X} (hF : F \u2286 G)\n (hG : MapsTo T G G) :\n coverEntropy (hG.restrict T G G) (val \u207b\u00b9' F) = coverEntropy T F := by\nrw [\u2190 coverEntropy_image_of_comap _ hG.val_restrict_apply (val \u207b\u00b9' F), image_preimage_coe G F,\n inter_eq_right.2 hF]\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInf_le_coverEntropy (L476-L480)\nlemma coverEntropyInf_le_coverEntropy (T : X \u2192 X) (F : Set X) :\n coverEntropyInf T F \u2264 coverEntropy T F :=\niSup\u2082_mono fun (U : SetRel X X) (_ : U \u2208 \ud835\udce4 X) \u21a6\n coverEntropyInfEntourage_le_coverEntropyEntourage T F U\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_le_pow (L285-L289)\nlemma coverMincard_le_pow (F_inv : MapsTo T F F) [U.IsSymm] (m_pos : 0 < m) (n : \u2115) :\n coverMincard T F (U \u25cb U) n \u2264 coverMincard T F U m ^ (n / m + 1) :=\n(coverMincard_monotone_time T F (U \u25cb U) (Nat.lt_mul_div_succ n m_pos).le).trans\n (coverMincard_mul_le_pow F_inv m (n / m + 1))\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.isRefl_dynEntourage (L87-L90)\ninstance isRefl_dynEntourage [U.IsRefl] : (dynEntourage T U n).IsRefl := by\nsimp [dynEntourage]; infer_instance\n\nset_option linter.flexible false in -- simp followed by infer_instance\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Subset.coverMincard_monotone_subset (L57-L60)\nlemma coverMincard_monotone_subset (T : X \u2192 X) (U : SetRel X X) (n : \u2115) :\n Monotone fun F : Set X \u21a6 coverMincard T F U n :=\nfun _ _ F_G \u21a6 biInf_mono fun _ h \u21a6 h.monotone_subset F_G\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyEntourage_empty (L354-L357)\nlemma coverEntropyEntourage_empty : coverEntropyEntourage T \u2205 U = \u22a5 := by\nsimp only [coverEntropyEntourage, coverMincard_empty]\n rw [ENat.toENNReal_zero, \u2190 Pi.zero_def, expGrowthSup_zero]\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInf_antitone (L438-L441)\nlemma coverEntropyInf_antitone (T : X \u2192 X) (F : Set X) :\n Antitone fun (u : UniformSpace X) \u21a6 @coverEntropyInf X u T F :=\nfun _ _ h \u21a6 iSup\u2082_mono' fun U U_uni \u21a6 \u27e8U, (le_def.1 h) U U_uni, le_refl _\u27e9\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.IsDynCoverOf (L78-L80)\ndef IsDynCoverOf (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) (s : Set X) : Prop :=\nIsCover (dynEntourage T U n) F s\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInf_eq_iSup_basis (L467-L475)\nlemma coverEntropyInf_eq_iSup_basis {\u03b9 : Sort*} {p : \u03b9 \u2192 Prop} {s : \u03b9 \u2192 SetRel X X}\n (h : (\ud835\udce4 X).HasBasis p s) (T : X \u2192 X) (F : Set X) :\n coverEntropyInf T F = \u2a06 (i : \u03b9) (_ : p i), coverEntropyInfEntourage T F (s i) := by\nrefine (iSup\u2082_le fun U U_uni \u21a6 ?_).antisymm\n (iSup\u2082_mono' fun i h_i \u21a6 \u27e8s i, HasBasis.mem_of_mem h h_i, le_refl _\u27e9)\n obtain \u27e8i, h_i, si_U\u27e9 := (HasBasis.mem_iff h).1 U_uni\n exact (coverEntropyInfEntourage_antitone T F si_U).trans\n (le_iSup\u2082 (f := fun (i : \u03b9) (_ : p i) \u21a6 coverEntropyInfEntourage T F (s i)) i h_i)\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Subset.coverEntropyEntourage_monotone (L70-L74)\nlemma coverEntropyEntourage_monotone (T : X \u2192 X) (U : SetRel X X) :\n Monotone fun F : Set X \u21a6 coverEntropyEntourage T F U := by\nrefine fun F G F_G \u21a6 ExpGrowth.expGrowthSup_monotone fun n \u21a6 ?_\n exact ENat.toENNReal_mono (coverMincard_monotone_subset T U n F_G)\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.nonempty_inter_of_coverMincard (L305-L340)\nlemma nonempty_inter_of_coverMincard [U.IsSymm] {s : Finset X} (h : IsDynCoverOf T F U n s)\n (h' : #s = coverMincard T F U n) :\n \u2200 x \u2208 s, (F \u2229 ball x (dynEntourage T U n)).Nonempty := by\n-- Otherwise, there is a ball which does not intersect `F`. Removing it yields a smaller cover.\n classical\n by_contra! \u27e8x, x_s, ball_empt\u27e9\n have smaller_cover : IsDynCoverOf T F U n (s.erase x) := by\n intro y y_F\n specialize h y_F\n simp only [s.mem_coe] at h\n simp only [s.coe_erase, mem_diff, s.mem_coe, mem_singleton_iff]\n obtain \u27e8z, z_s, hz\u27e9 := h\n refine \u27e8z, \u27e8z_s, fun z_x \u21a6 notMem_empty y ?_\u27e9, hz\u27e9\n rw [\u2190 ball_empt]\n rw [z_x] at hz\n exact mem_inter y_F <| (dynEntourage T U n).symm hz\n apply smaller_cover.coverMincard_le_card.not_gt\n rw [\u2190 h']\n exact_mod_cast s.card_erase_lt_of_mem x_s\n\n/-! ### Cover entropy of entourages -/\n\nopen ENNReal EReal ExpGrowth Filter\n\n/-- The entropy of an entourage `U`, defined as the exponential rate of growth of the size\n of the smallest `(U, n)`-refined cover of `F`. Takes values in the space of extended real numbers\n `[-\u221e, +\u221e]`. This first version uses a `limsup`, and is chosen as the default definition. -/\nnoncomputable def coverEntropyEntourage (T : X \u2192 X) (F : Set X) (U : SetRel X X) :=\n expGrowthSup fun n : \u2115 \u21a6 coverMincard T F U n\n\n/-- The entropy of an entourage `U`, defined as the exponential rate of growth of the size\n of the smallest `(U, n)`-refined cover of `F`. Takes values in the space of extended real numbers\n `[-\u221e, +\u221e]`. This second version uses a `liminf`, and is chosen as an alternative definition. -/\nnoncomputable def coverEntropyInfEntourage (T : X \u2192 X) (F : Set X) (U : SetRel X X) :=\n expGrowthInf fun n : \u2115 \u21a6 coverMincard T F U n\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.dynEntourage_antitone (L130-L133)\nlemma dynEntourage_antitone (T : X \u2192 X) (U : SetRel X X) :\n Antitone (fun n : \u2115 \u21a6 dynEntourage T U n) :=\nfun m n m_n \u21a6 iInter\u2082_mono' fun k k_m \u21a6 by use k, lt_of_lt_of_le k_m m_n\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropyInf_image_of_comap (L154-L174)\ntheorem coverEntropyInf_image_of_comap (u : UniformSpace Y) {S : X \u2192 X} {T : Y \u2192 Y} {\u03c6 : X \u2192 Y}\n (h : Semiconj \u03c6 S T) (F : Set X) :\n coverEntropyInf T (\u03c6 '' F) = @coverEntropyInf X (comap \u03c6 u) S F := by\nlet : UniformSpace X := comap \u03c6 u\n apply le_antisymm\n \u00b7 refine iSup\u2082_le fun V V_uni \u21a6\n (coverEntropyInfEntourage_antitone _ _ SetRel.symmetrize_subset_self).trans <|\n (coverEntropyInfEntourage_image_le h F _).trans ?_\n apply coverEntropyInfEntourage_le_coverEntropyInf\n rw [uniformity_comap \u03c6, mem_comap]\n exact \u27e8_, symmetrize_mem_uniformity V_uni, .rfl\u27e9\n \u00b7 refine iSup\u2082_le fun U U_uni \u21a6 ?_\n simp only [uniformity_comap \u03c6, mem_comap] at U_uni\n obtain \u27e8V, V_uni, V_sub\u27e9 := U_uni\n obtain \u27e8W, W_uni, W_symm, W_V\u27e9 := comp_symm_mem_uniformity_sets V_uni\n apply (coverEntropyInfEntourage_antitone S F ((preimage_mono W_V).trans V_sub)).trans\n apply (le_coverEntropyInfEntourage_image h F).trans\n exact coverEntropyInfEntourage_le_coverEntropyInf T (\u03c6 '' F) W_uni\n\nopen Subtype\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.dynEntourage_eq_inter_Ico (L54-L57)\nlemma dynEntourage_eq_inter_Ico (T : X \u2192 X) (U : SetRel X X) (n : \u2115) :\n dynEntourage T U n = \u22c2 k : Ico 0 n, (map T T)^[k] \u207b\u00b9' U := by\nsimp [dynEntourage]\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropyInfEntourage_image_le (L127-L132)\nlemma coverEntropyInfEntourage_image_le (h : Semiconj \u03c6 S T) (F : Set X) (V : SetRel Y Y) :\n coverEntropyInfEntourage T (\u03c6 '' F) V \u2264 coverEntropyInfEntourage S F ((map \u03c6 \u03c6) \u207b\u00b9' V) :=\nexpGrowthInf_monotone fun n \u21a6 ENat.toENNReal_mono (coverMincard_image_le h F V n)\n\n/-- The entropy of `\u03c6 '' F` equals the entropy of `F` if `X` is endowed with the pullback by `\u03c6`\n of the uniform structure of `Y`. -/\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropyInf_image_le_of_uniformContinuous (L202-L207)\ntheorem coverEntropyInf_image_le_of_uniformContinuous [UniformSpace X] [UniformSpace Y] {S : X \u2192 X}\n {T : Y \u2192 Y} {\u03c6 : X \u2192 Y} (h : Semiconj \u03c6 S T) (h' : UniformContinuous \u03c6) (F : Set X) :\n coverEntropyInf T (\u03c6 '' F) \u2264 coverEntropyInf S F := by\nrw [coverEntropyInf_image_of_comap _ h F]\n exact coverEntropyInf_antitone S F (uniformContinuous_iff.1 h')\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Subset.netMaxcard_monotone_subset (L61-L64)\nlemma netMaxcard_monotone_subset (T : X \u2192 X) (U : SetRel X X) (n : \u2115) :\n Monotone fun F : Set X \u21a6 netMaxcard T F U n :=\nfun _ _ F_G \u21a6 biSup_mono fun _ h \u21a6 h.monotone_subset F_G\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_empty (L243-L245)\nlemma coverMincard_empty : coverMincard T \u2205 U n = 0 :=\n(sInf_le (by simp [IsDynCoverOf])).antisymm (zero_le (coverMincard T \u2205 U n))\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyEntourage_antitone (L345-L348)\nlemma coverEntropyEntourage_antitone (T : X \u2192 X) (F : Set X) :\n Antitone fun U : SetRel X X \u21a6 coverEntropyEntourage T F U :=\nfun _ _ U_V \u21a6 expGrowthSup_monotone fun n \u21a6 ENat.toENNReal_mono (coverMincard_antitone T F n U_V)\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyEntourage_le_coverEntropy (L448-L452)\nlemma coverEntropyEntourage_le_coverEntropy (T : X \u2192 X) (F : Set X)\n (h : U \u2208 \ud835\udce4 X) :\n coverEntropyEntourage T F U \u2264 coverEntropy T F :=\nle_iSup\u2082 (f := fun (U : SetRel X X) (_ : U \u2208 \ud835\udce4 X) \u21a6 coverEntropyEntourage T F U) U h\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Subset.netEntropyInfEntourage_monotone (L75-L79)\nlemma netEntropyInfEntourage_monotone (T : X \u2192 X) (U : SetRel X X) :\n Monotone fun F : Set X \u21a6 netEntropyInfEntourage T F U := by\nrefine fun F G F_G \u21a6 ExpGrowth.expGrowthInf_monotone fun n \u21a6 ?_\n exact ENat.toENNReal_mono (netMaxcard_monotone_subset T U n F_G)\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.exists_isDynCoverOf_of_isCompact_invariant (L191-L208)\nlemma exists_isDynCoverOf_of_isCompact_invariant [UniformSpace X]\n (F_comp : IsCompact F) (F_inv : MapsTo T F F) (U_uni : U \u2208 \ud835\udce4 X) (n : \u2115) :\n \u2203 s : Finset X, IsDynCoverOf T F U n s := by\nobtain \u27e8(V : SetRel X X), V_uni, V_symm, V_U\u27e9 := comp_symm_mem_uniformity_sets U_uni\n obtain \u27e8s, _, s_cover\u27e9 := F_comp.elim_nhds_subcover (ball \u00b7 V)\n fun (x : X) _ \u21a6 ball_mem_nhds x V_uni\n have : IsDynCoverOf T F V 1 s := .of_subset_iUnion_ball <| by simpa using s_cover\n obtain \u27e8t, t_dyncover, t_card\u27e9 := this.iterate_le_pow F_inv n\n rw [one_mul n] at t_dyncover\n exact \u27e8t, t_dyncover.of_entourage_subset V_U\u27e9\n\n/-! ### Minimal cardinality of dynamical covers -/\n\n/-- The smallest cardinality of a `(U, n)`-dynamical cover of `F`. Takes values in `\u2115\u221e`, and is\n infinite if and only if `F` admits no finite dynamical cover. -/\nnoncomputable def coverMincard (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) : \u2115\u221e :=\n \u2a05 (s : Finset X) (_ : IsDynCoverOf T F U n s), (s.card : \u2115\u221e)\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyEntourage_le_log_coverMincard_div (L386-L399)\nlemma coverEntropyEntourage_le_log_coverMincard_div (F_inv : MapsTo T F F) [U.IsSymm]\n (n_pos : n \u2260 0) :\n coverEntropyEntourage T F (U \u25cb U) \u2264 log (coverMincard T F U n) / n := by\nhave cv_mono : Monotone fun m \u21a6 (coverMincard T F (U \u25cb U) m).toENNReal :=\n fun _ _ k_m \u21a6 ENat.toENNReal_mono (coverMincard_monotone_time T F (U \u25cb U) k_m)\n have h := cv_mono.expGrowthSup_comp_mul n_pos\n rw [mul_comm, \u2190 div_eq_iff (natCast_ne_bot n) (natCast_ne_top n) (Nat.cast_ne_zero.2 n_pos)] at h\n rw [coverEntropyEntourage, \u2190 h]\n apply monotone_div_right_of_nonneg n.cast_nonneg'\n rw [\u2190 expGrowthSup_pow]\n refine expGrowthSup_monotone fun m \u21a6 ?_\n rw [\u2190 ENat.toENNReal_pow]\n exact ENat.toENNReal_mono (coverMincard_mul_le_pow F_inv n m)\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropyInf_image_le_of_uniformContinuousOn_invariant (L220-L232)\nlemma coverEntropyInf_image_le_of_uniformContinuousOn_invariant [UniformSpace X] [UniformSpace Y]\n {S : X \u2192 X} {T : Y \u2192 Y} {\u03c6 : X \u2192 Y} (h : Semiconj \u03c6 S T) {F G : Set X}\n (h' : UniformContinuousOn \u03c6 G) (hF : F \u2286 G) (hG : MapsTo S G G) :\n coverEntropyInf T (\u03c6 '' F) \u2264 coverEntropyInf S F := by\nrw [\u2190 coverEntropyInf_restrict_subset hF hG]\n have h\u03c6 : Semiconj (G.restrict \u03c6) (hG.restrict S G G) T := by\n intro a\n rw [G.restrict_apply, G.restrict_apply, hG.val_restrict_apply, h.eq a]\n apply (coverEntropyInf_image_le_of_uniformContinuous h\u03c6\n (uniformContinuousOn_iff_restrict.1 h') (val \u207b\u00b9' F)).trans_eq'\n rw [\u2190 image_image_val_eq_restrict_image, image_preimage_coe G F, inter_eq_right.2 hF]\n\nend Dynamics\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropy_nonneg (L493-L495)\nlemma coverEntropy_nonneg (T : X \u2192 X) (h : F.Nonempty) : 0 \u2264 coverEntropy T F :=\n(coverEntropyInf_nonneg T h).trans (coverEntropyInf_le_coverEntropy T F)\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_antitone (L217-L221)\nlemma coverMincard_antitone (T : X \u2192 X) (F : Set X) (n : \u2115) :\n Antitone fun U : SetRel X X \u21a6 coverMincard T F U n :=\nfun _ _ U_V \u21a6 biInf_mono fun _ h \u21a6 h.of_entourage_subset U_V\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_mul_le_pow (L272-L284)\nlemma coverMincard_mul_le_pow (F_inv : MapsTo T F F) [U.IsSymm] (m n : \u2115) :\n coverMincard T F (U \u25cb U) (m * n) \u2264 coverMincard T F U m ^ n := by\nrcases F.eq_empty_or_nonempty with rfl | F_nonempty\n \u00b7 rw [coverMincard_empty]; exact zero_le _\n obtain rfl | hn := eq_or_ne n 0\n \u00b7 rw [mul_zero, coverMincard_zero T F_nonempty (U \u25cb U), pow_zero]\n rcases eq_top_or_lt_top (coverMincard T F U m) with h | h\n \u00b7 simp [*]\n \u00b7 obtain \u27e8s, s_cover, s_coverMincard\u27e9 := (coverMincard_finite_iff T F U m).1 h\n obtain \u27e8t, t_cover, t_sn\u27e9 := s_cover.iterate_le_pow F_inv n\n rw [\u2190 s_coverMincard]\n exact t_cover.coverMincard_le_card.trans (WithTop.coe_le_coe.2 t_sn)\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.le_coverEntropyInfEntourage_image (L119-L122)\nlemma le_coverEntropyInfEntourage_image (h : Semiconj \u03c6 S T) (F : Set X) [V.IsSymm] :\n coverEntropyInfEntourage S F ((map \u03c6 \u03c6) \u207b\u00b9' (V \u25cb V)) \u2264 coverEntropyInfEntourage T (\u03c6 '' F) V :=\nexpGrowthInf_monotone fun n \u21a6 ENat.toENNReal_mono (le_coverMincard_image h F n)\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.le_coverEntropyEntourage_image (L115-L118)\nlemma le_coverEntropyEntourage_image (h : Semiconj \u03c6 S T) (F : Set X) [V.IsSymm] :\n coverEntropyEntourage S F ((map \u03c6 \u03c6) \u207b\u00b9' (V \u25cb V)) \u2264 coverEntropyEntourage T (\u03c6 '' F) V :=\nexpGrowthSup_monotone fun n \u21a6 ENat.toENNReal_mono (le_coverMincard_image h F n)\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInfEntourage_le_coverEntropyInf (L453-L457)\nlemma coverEntropyInfEntourage_le_coverEntropyInf (T : X \u2192 X) (F : Set X)\n (h : U \u2208 \ud835\udce4 X) :\n coverEntropyInfEntourage T F U \u2264 coverEntropyInf T F :=\nle_iSup\u2082 (f := fun (U : SetRel X X) (_ : U \u2208 \ud835\udce4 X) \u21a6 coverEntropyInfEntourage T F U) U h\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_finite_iff (L222-L241)\nlemma coverMincard_finite_iff (T : X \u2192 X) (F : Set X) (U : SetRel X X) (n : \u2115) :\n coverMincard T F U n < \u22a4 \u2194\n \u2203 s : Finset X, IsDynCoverOf T F U n s \u2227 s.card = coverMincard T F U n := by\nrefine \u27e8fun h_fin \u21a6 ?_, fun \u27e8s, _, s_coverMincard\u27e9 \u21a6 s_coverMincard \u25b8 WithTop.coe_lt_top s.card\u27e9\n obtain \u27e8k, k_min\u27e9 := WithTop.ne_top_iff_exists.1 h_fin.ne\n rw [\u2190 k_min]\n simp only [ENat.some_eq_coe, Nat.cast_inj]\n have : Nonempty {s : Finset X // IsDynCoverOf T F U n s} := by\n by_contra h\n apply ENat.coe_ne_top k\n rw [\u2190 ENat.some_eq_coe, k_min, coverMincard, iInf\u2082_eq_top]\n simp only [ENat.coe_ne_top, imp_false]\n rw [nonempty_subtype, not_exists] at h\n exact h\n have key := ciInf_mem fun s : {s : Finset X // IsDynCoverOf T F U n s} \u21a6 (s.val.card : \u2115\u221e)\n rw [coverMincard, iInf_subtype'] at k_min\n rw [\u2190 k_min, mem_range, Subtype.exists] at key\n simp only [ENat.some_eq_coe, Nat.cast_inj, exists_prop] at key\n exact key\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_zero (L255-L263)\nlemma coverMincard_zero (T : X \u2192 X) (h : F.Nonempty) (U : SetRel X X) :\n coverMincard T F U 0 = 1 := by\napply le_antisymm _ ((one_le_coverMincard_iff T F U 0).2 h)\n obtain \u27e8x, _\u27e9 := h\n have := isDynCoverOf_zero T F U (singleton_nonempty x)\n rw [\u2190 Finset.coe_singleton] at this\n apply this.coverMincard_le_card.trans_eq\n rw [Finset.card_singleton, Nat.cast_one]\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.dynEntourage (L51-L53)\ndef dynEntourage (T : X \u2192 X) (U : SetRel X X) (n : \u2115) : SetRel X X :=\n\u22c2 k < n, (map T T)^[k] \u207b\u00b9' U\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropyEntourage_image_le (L123-L126)\nlemma coverEntropyEntourage_image_le (h : Semiconj \u03c6 S T) (F : Set X) (V : SetRel Y Y) :\n coverEntropyEntourage T (\u03c6 '' F) V \u2264 coverEntropyEntourage S F ((map \u03c6 \u03c6) \u207b\u00b9' V) :=\nexpGrowthSup_monotone fun n \u21a6 ENat.toENNReal_mono (coverMincard_image_le h F V n)\n```\n\n-- snippet 84\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.dynEntourage_monotone (L126-L129)\nlemma dynEntourage_monotone (T : X \u2192 X) (n : \u2115) :\n Monotone (fun U : SetRel X X \u21a6 dynEntourage T U n) :=\nfun _ _ h \u21a6 iInter\u2082_mono fun _ _ \u21a6 preimage_mono h\n```\n\n-- snippet 85\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_finite_of_isCompact_invariant (L296-L304)\nlemma coverMincard_finite_of_isCompact_invariant [UniformSpace X] (F_comp : IsCompact F)\n (F_inv : MapsTo T F F) (U_uni : U \u2208 \ud835\udce4 X) (n : \u2115) :\n coverMincard T F U n < \u22a4 := by\nobtain \u27e8s, s_cover\u27e9 := exists_isDynCoverOf_of_isCompact_invariant F_comp F_inv U_uni n\n exact s_cover.coverMincard_le_card.trans_lt (WithTop.coe_lt_top s.card)\n\n/-- All dynamical balls of a minimal dynamical cover of `F` intersect `F`. This lemma is the key\n to relate Bowen-Dinaburg's definition of topological entropy with covers and their definition\n of topological entropy with nets. -/\n```\n\n-- snippet 86\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInf_nonneg (L489-L492)\nlemma coverEntropyInf_nonneg (T : X \u2192 X) (h : F.Nonempty) : 0 \u2264 coverEntropyInf T F :=\n(coverEntropyInfEntourage_le_coverEntropyInf T F univ_mem).trans_eq'\n (coverEntropyInfEntourage_univ T h)\n```\n\n-- snippet 87\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInfEntourage_antitone (L341-L344)\nlemma coverEntropyInfEntourage_antitone (T : X \u2192 X) (F : Set X) :\n Antitone fun U : SetRel X X \u21a6 coverEntropyInfEntourage T F U :=\nfun _ _ U_V \u21a6 expGrowthInf_monotone fun n \u21a6 ENat.toENNReal_mono (coverMincard_antitone T F n U_V)\n```\n\n-- snippet 88\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.ball_dynEntourage_mem_nhds (L78-L86)\nlemma ball_dynEntourage_mem_nhds [UniformSpace X] (h : Continuous T)\n (U_uni : U \u2208 \ud835\udce4 X) (n : \u2115) (x : X) :\n ball x (dynEntourage T U n) \u2208 \ud835\udcdd x := by\nrw [dynEntourage_eq_inter_Ico T U n, ball_iInter, Filter.iInter_mem, Subtype.forall]\n intro k _\n simp only [map_iterate, _root_.ball_preimage]\n exact (h.iterate k).continuousAt.preimage_mem_nhds (ball_mem_nhds (T^[k] x) U_uni)\n\nset_option linter.flexible false in -- simp followed by infer_instance\n```\n\n-- snippet 89\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.dynEntourage_univ (L142-L144)\nlemma dynEntourage_univ {T : X \u2192 X} {n : \u2115} :\n dynEntourage T univ n = univ := by simp [dynEntourage]\n```\n\n-- snippet 90\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.exists_isDynCoverOf_of_isCompact_uniformContinuous (L182-L190)\nlemma exists_isDynCoverOf_of_isCompact_uniformContinuous [UniformSpace X]\n (F_comp : IsCompact F) (h : UniformContinuous T) (U_uni : U \u2208 \ud835\udce4 X) (n : \u2115) :\n \u2203 s : Finset X, IsDynCoverOf T F U n s := by\nobtain \u27e8(V : SetRel X X), hV, hVsymm, hVU\u27e9 := symm_of_uniformity U_uni\n have uni_ite := dynEntourage_mem_uniformity h hV n\n let openCover x := ball x (dynEntourage T V n)\n obtain \u27e8s, _, s_cover\u27e9 := F_comp.elim_nhds_subcover openCover fun x _ \u21a6 ball_mem_nhds x uni_ite\n exact \u27e8s, .of_entourage_subset hVU <| .of_subset_iUnion_ball s_cover\u27e9\n```\n\n-- snippet 91\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.mem_ball_dynEntourage_comp (L145-L151)\nlemma mem_ball_dynEntourage_comp (T : X \u2192 X) (n : \u2115) {U : SetRel X X} [U.IsSymm]\n (x y : X) (h : (ball x (dynEntourage T U n) \u2229 ball y (dynEntourage T U n)).Nonempty) :\n x \u2208 ball y (dynEntourage T (U \u25cb U) n) := by\nrcases h with \u27e8z, z_Bx, z_By\u27e9\n rw [mem_ball_symmetry] at z_Bx\n exact dynEntourage_comp_subset T U U n (mem_ball_comp z_By z_Bx)\n```\n\n-- snippet 92\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropyInf_restrict_subset (L181-L187)\nlemma coverEntropyInf_restrict_subset [UniformSpace X] {T : X \u2192 X} {F G : Set X} (hF : F \u2286 G)\n (hG : MapsTo T G G) :\n coverEntropyInf (hG.restrict T G G) (val \u207b\u00b9' F) = coverEntropyInf T F := by\nrw [\u2190 coverEntropyInf_image_of_comap _ hG.val_restrict_apply (val \u207b\u00b9' F), image_preimage_coe G F,\n inter_eq_right.2 hF]\n\n/-- The entropy of the restriction of `T` to an invariant set `F` is `coverEntropy T F`. This\n```\n\n-- snippet 93\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInfEntourage_empty (L359-L361)\nlemma coverEntropyInfEntourage_empty : coverEntropyInfEntourage T \u2205 U = \u22a5 :=\neq_bot_mono (coverEntropyInfEntourage_le_coverEntropyEntourage T \u2205 U) coverEntropyEntourage_empty\n```\n\n-- snippet 94\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.dynEntourage_mono (L135-L137)\nlemma dynEntourage_mono (hUV : U \u2286 V) (hmn : m \u2264 n) : dynEntourage T U n \u2286 dynEntourage T V m :=\n(dynEntourage_monotone _ _ hUV).trans (dynEntourage_antitone _ _ hmn)\n```\n\n-- snippet 95\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropy_image_of_comap (L133-L153)\ntheorem coverEntropy_image_of_comap (u : UniformSpace Y) {S : X \u2192 X} {T : Y \u2192 Y} {\u03c6 : X \u2192 Y}\n (h : Semiconj \u03c6 S T) (F : Set X) :\n coverEntropy T (\u03c6 '' F) = @coverEntropy X (comap \u03c6 u) S F := by\nlet : UniformSpace X := comap \u03c6 u\n apply le_antisymm\n \u00b7 refine iSup\u2082_le fun V V_uni \u21a6\n (coverEntropyEntourage_antitone _ _ SetRel.symmetrize_subset_self).trans <|\n (coverEntropyEntourage_image_le h F _).trans ?_\n apply coverEntropyEntourage_le_coverEntropy\n rw [uniformity_comap \u03c6, mem_comap]\n exact \u27e8_, symmetrize_mem_uniformity V_uni, .rfl\u27e9\n \u00b7 refine iSup\u2082_le fun U U_uni \u21a6 ?_\n simp only [uniformity_comap \u03c6, mem_comap] at U_uni\n obtain \u27e8V, V_uni, V_sub\u27e9 := U_uni\n obtain \u27e8W, W_uni, W_symm, W_V\u27e9 := comp_symm_mem_uniformity_sets V_uni\n apply (coverEntropyEntourage_antitone S F ((preimage_mono W_V).trans V_sub)).trans\n apply (le_coverEntropyEntourage_image h F).trans\n exact coverEntropyEntourage_le_coverEntropy T (\u03c6 '' F) W_uni\n\n/-- The entropy of `\u03c6 '' F` equals the entropy of `F` if `X` is endowed with the pullback by `\u03c6`\n of the uniform structure of `Y`. This version uses a `liminf`. -/\n```\n\n-- snippet 96\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.mem_dynEntourage (L58-L60)\nlemma mem_dynEntourage : (x, y) \u2208 dynEntourage T U n \u2194 \u2200 k < n, (T^[k] x, T^[k] y) \u2208 U := by\nsimp [dynEntourage]\n```\n\n-- snippet 97\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.IsDynCoverOf (L65-L71)\nlemma IsDynCoverOf.image (h : Semiconj \u03c6 S T) (h' : IsDynCoverOf S F (map \u03c6 \u03c6 \u207b\u00b9' V) n s) :\n IsDynCoverOf T (\u03c6 '' F) V n (\u03c6 '' s) := by\nrintro _ \u27e8x, hx, rfl\u27e9\n obtain \u27e8y, hy, hxy\u27e9 := h' hx\n refine \u27e8_, Set.mem_image_of_mem _ hy, show (x, y) \u2208 map \u03c6 \u03c6 \u207b\u00b9' dynEntourage T V n from ?_\u27e9\n rwa [h.preimage_dynEntourage V n]\n```\n\n-- snippet 98\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInfEntourage_le_coverEntropyEntourage (L349-L352)\nlemma coverEntropyInfEntourage_le_coverEntropyEntourage (T : X \u2192 X) (F : Set X) (U : SetRel X X) :\n coverEntropyInfEntourage T F U \u2264 coverEntropyEntourage T F U :=\nexpGrowthInf_le_expGrowthSup\n```\n\n-- snippet 99\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverMincard_univ (L264-L271)\nlemma coverMincard_univ (T : X \u2192 X) (h : F.Nonempty) (n : \u2115) : coverMincard T F univ n = 1 := by\napply le_antisymm _ ((one_le_coverMincard_iff T F univ n).2 h)\n obtain \u27e8x, _\u27e9 := h\n have := isDynCoverOf_univ T F n (singleton_nonempty x)\n rw [\u2190 Finset.coe_singleton] at this\n apply this.coverMincard_le_card.trans_eq\n rw [Finset.card_singleton, Nat.cast_one]\n```\n\n-- snippet 100\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyEntourage_univ (L376-L380)\nlemma coverEntropyEntourage_univ (T : X \u2192 X) (h : F.Nonempty) :\n coverEntropyEntourage T F univ = 0 := by\nrw [\u2190 expGrowthSup_const one_ne_zero one_ne_top, coverEntropyEntourage]\n simp only [coverMincard_univ T h, ENat.toENNReal_one]\n```\n\n-- snippet 101\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropyInfEntourage_nonneg (L362-L370)\nlemma coverEntropyInfEntourage_nonneg (T : X \u2192 X) (h : F.Nonempty) (U : SetRel X X) :\n 0 \u2264 coverEntropyInfEntourage T F U := by\napply Monotone.expGrowthInf_nonneg\n \u00b7 exact fun _ _ m_n \u21a6 ENat.toENNReal_mono (coverMincard_monotone_time T F U m_n)\n \u00b7 rw [ne_eq, funext_iff.not, not_forall]\n use 0\n rw [coverMincard_zero T h U, Pi.zero_apply, ENat.toENNReal_one]\n exact one_ne_zero\n```\n\n-- snippet 102\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.dynEntourage_comp_subset (L111-L118)\nlemma dynEntourage_comp_subset (T : X \u2192 X) (U V : SetRel X X) (n : \u2115) :\n (dynEntourage T U n) \u25cb (dynEntourage T V n) \u2286 dynEntourage T (U \u25cb V) n := by\nsimp only [dynEntourage, map_iterate, subset_iInter_iff]\n intro k k_n xy xy_comp\n simp only [SetRel.comp, mem_iInter, mem_preimage, map_apply, mem_setOf_eq] at xy_comp \u22a2\n rcases xy_comp with \u27e8z, hz1, hz2\u27e9\n exact mem_ball_comp (hz1 k k_n) (hz2 k k_n)\n```\n\n-- snippet 103\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropy_image_le_of_uniformContinuous (L194-L201)\ntheorem coverEntropy_image_le_of_uniformContinuous [UniformSpace X] [UniformSpace Y] {S : X \u2192 X}\n {T : Y \u2192 Y} {\u03c6 : X \u2192 Y} (h : Semiconj \u03c6 S T) (h' : UniformContinuous \u03c6) (F : Set X) :\n coverEntropy T (\u03c6 '' F) \u2264 coverEntropy S F := by\nrw [coverEntropy_image_of_comap _ h F]\n exact coverEntropy_antitone S F (uniformContinuous_iff.1 h')\n\n/-- The entropy of `\u03c6 '' F` is at most the entropy of `F` if `\u03c6` is uniformly continuous. This\n version uses a `liminf`. -/\n```\n\n-- snippet 104\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.DynamicalEntourage.idRel_subset_dynEntourage (L96-L101)\nlemma idRel_subset_dynEntourage (T : X \u2192 X) {U : Set (X \u00d7 X)} (h : idRel \u2286 U) (n : \u2115) :\n idRel \u2286 (dynEntourage T U n) := by\nsimp only [dynEntourage, map_iterate, subset_iInter_iff, idRel_subset, mem_preimage, map_apply]\n exact fun _ _ _ \u21a6 h rfl\n\nset_option linter.deprecated false in\n```\n\n-- snippet 105\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.coverEntropy_empty (L482-L484)\nlemma coverEntropy_empty : coverEntropy T \u2205 = \u22a5 := by\nsimp only [coverEntropy, coverEntropyEntourage_empty, iSup_bot]\n```\n[/INST]", "sample_id": "C-Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netEntropyInfEntourage_univ", "source": {"declaration": "Mathlib.Dynamics.TopologicalEntropy.NetEntropy.netEntropyInfEntourage_univ", "file": "Mathlib/Dynamics/TopologicalEntropy/NetEntropy.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Dynamics.TopologicalEntropy.NetEntropy", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Dynamics/TopologicalEntropy/NetEntropy.lean#L297", "span": "L297-L301"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Logic.Function.OfArity.ofArity_zero (L34-L35)\ntheorem ofArity_zero (\u03b1 \u03b2 : Type u) : OfArity \u03b1 \u03b2 0 = \u03b2 := fromTypes_zero _ _", "-- Mathlib.Logic.Function.OfArity.ofArity_succ (L37-L42)\ntheorem ofArity_succ (\u03b1 \u03b2 : Type u) (n : \u2115) :\n OfArity \u03b1 \u03b2 n.succ = (\u03b1 \u2192 OfArity \u03b1 \u03b2 n) := fromTypes_succ _ _\nnamespace OfArity\n\n/-- Constant `n`-ary function with value `b`. -/", "-- Mathlib.Logic.Function.OfArity.const (L43-L45)\ndef const (\u03b1 : Type u) {\u03b2 : Type u} (b : \u03b2) (n : \u2115) : OfArity \u03b1 \u03b2 n :=\nFromTypes.const (fun _ => \u03b1) b", "-- Mathlib.Logic.Function.OfArity.const_zero (L47-L49)\ntheorem const_zero (\u03b1 : Type u) {\u03b2 : Type u} (b : \u03b2) : const \u03b1 b 0 = b :=\nFromTypes.const_zero (fun _ => \u03b1) b", "-- Mathlib.Logic.Function.OfArity.const_succ (L51-L54)\ntheorem const_succ (\u03b1 : Type u) {\u03b2 : Type u} (b : \u03b2) (n : \u2115) :\n const \u03b1 b n.succ = fun _ => const _ b n :=\nFromTypes.const_succ (fun _ => \u03b1) b", "-- Mathlib.Logic.Function.OfArity.const_succ_apply (L55-L57)\ntheorem const_succ_apply (\u03b1 : Type u) {\u03b2 : Type u} (b : \u03b2) (n : \u2115) (x : \u03b1) :\n const \u03b1 b n.succ x = const _ b n := FromTypes.const_succ_apply _ b x", "-- Mathlib.Logic.Function.OfArity.inhabited (L58-L64)\ninstance inhabited {\u03b1 \u03b2 n} [Inhabited \u03b2] : Inhabited (OfArity \u03b1 \u03b2 n) :=\ninferInstanceAs (Inhabited (FromTypes (fun _ => \u03b1) \u03b2))\n\nend OfArity\n\nnamespace FromTypes", "-- Mathlib.Logic.Function.OfArity.fromTypes_fin_const (L65-L69)\nlemma fromTypes_fin_const (\u03b1 \u03b2 : Type u) (n : \u2115) :\n FromTypes (fun (_ : Fin n) => \u03b1) \u03b2 = OfArity \u03b1 \u03b2 n := rfl\n/-- The definitional equality between heterogeneous functions with constant\ndomain and `n`-ary functions with that domain. -/", "-- Mathlib.Logic.Function.OfArity.fromTypes_fin_const_equiv (L70-L75)\ndef fromTypes_fin_const_equiv (\u03b1 \u03b2 : Type u) (n : \u2115) :\n FromTypes (fun (_ : Fin n) => \u03b1) \u03b2 \u2243 OfArity \u03b1 \u03b2 n := .refl _\nend FromTypes\n\nend Function", "-- Mathlib.Logic.Function.Basic.IsPartialInv (L286-L288)\ndef IsPartialInv {\u03b1 \u03b2} (f : \u03b1 \u2192 \u03b2) (g : \u03b2 \u2192 Option \u03b1) : Prop :=\n\u2200 x y, g y = some x \u2194 f x = y", "-- Mathlib.Logic.Function.Basic.const_injective (L45-L48)\ntheorem const_injective [Nonempty \u03b1] : Injective (const \u03b1 : \u03b2 \u2192 \u03b1 \u2192 \u03b2) := fun _ _ h \u21a6\nlet \u27e8x\u27e9 := \u2039Nonempty \u03b1\u203a\n congr_fun h x", "-- Mathlib.Logic.Function.Basic.ne_iff (L64-L66)\ntheorem ne_iff {\u03b2 : \u03b1 \u2192 Sort*} {f\u2081 f\u2082 : \u2200 a, \u03b2 a} : f\u2081 \u2260 f\u2082 \u2194 \u2203 a, f\u2081 a \u2260 f\u2082 a :=\nfunext_iff.not.trans not_forall", "-- Mathlib.Logic.Function.Basic.injective_comp_right_iff_surjective (L201-L213)\ntheorem injective_comp_right_iff_surjective {\u03b3 : Type*} [Nontrivial \u03b3] :\n Injective (fun g : \u03b2 \u2192 \u03b3 \u21a6 g \u2218 f) \u2194 Surjective f := by\nrefine \u27e8not_imp_not.mp fun not_surj inj \u21a6 not_subsingleton \u03b3 \u27e8fun c c' \u21a6 ?_\u27e9,\n (\u00b7.injective_comp_right)\u27e9\n have \u27e8b\u2080, hb\u27e9 := not_forall.mp not_surj\n classical have := inj (a\u2081 := fun _ \u21a6 c) (a\u2082 := (if \u00b7 = b\u2080 then c' else c)) ?_\n \u00b7 simpa using congr_fun this b\u2080\n ext a; simp only [comp_apply, if_neg fun h \u21a6 hb \u27e8a, h\u27e9]\n\nprotected theorem Surjective.right_cancellable (hf : Surjective f) {g\u2081 g\u2082 : \u03b2 \u2192 \u03b3} :\n g\u2081 \u2218 f = g\u2082 \u2218 f \u2194 g\u2081 = g\u2082 :=\n hf.injective_comp_right.eq_iff", "-- Mathlib.Logic.Function.Basic.onFun_apply (L53-L55)\ntheorem onFun_apply (f : \u03b2 \u2192 \u03b2 \u2192 \u03b3) (g : \u03b1 \u2192 \u03b2) (a b : \u03b1) : onFun f g a b = f (g a) (g b) :=\nrfl", "-- Mathlib.Logic.Function.Basic.Bijective (L229-L238)\ntheorem Bijective.existsUnique_iff {f : \u03b1 \u2192 \u03b2} (hf : Bijective f) {p : \u03b2 \u2192 Prop} :\n (\u2203! y, p y) \u2194 \u2203! x, p (f x) :=\n\u27e8fun \u27e8y, hpy, hy\u27e9 \u21a6\n let \u27e8x, hx\u27e9 := hf.surjective y\n \u27e8x, by simpa [hx], fun z (hz : p (f z)) \u21a6 hf.injective <| hx.symm \u25b8 hy _ hz\u27e9,\n fun \u27e8x, hpx, hx\u27e9 \u21a6\n \u27e8f x, hpx, fun y hy \u21a6\n let \u27e8z, hz\u27e9 := hf.surjective y\n hz \u25b8 congr_arg f (hx _ (by simpa [hz]))\u27e9\u27e9", "-- Mathlib.Logic.Function.Basic.swap_lt (L73-L73)\ntheorem swap_lt {\u03b1} [LT \u03b1] : swap (\u00b7 < \u00b7 : \u03b1 \u2192 \u03b1 \u2192 _) = (\u00b7 > \u00b7) := rfl", "-- Mathlib.Logic.Function.Basic.injective_comp_left_iff (L126-L130)\ntheorem injective_comp_left_iff [Nonempty \u03b1] {g : \u03b2 \u2192 \u03b3} :\n Injective (g \u2218 \u00b7 : (\u03b1 \u2192 \u03b2) \u2192 \u03b1 \u2192 \u03b3) \u2194 Injective g :=\n\u27e8fun h b\u2081 b\u2082 eq \u21a6 Nonempty.elim \u2039_\u203a\n (congr_fun <| h (a\u2081 := fun _ \u21a6 b\u2081) (a\u2082 := fun _ \u21a6 b\u2082) <| funext fun _ \u21a6 eq), (\u00b7.comp_left)\u27e9", "-- Mathlib.Logic.Function.Basic.swap_le (L74-L74)\ntheorem swap_le {\u03b1} [LE \u03b1] : swap (\u00b7 \u2264 \u00b7 : \u03b1 \u2192 \u03b1 \u2192 _) = (\u00b7 \u2265 \u00b7) := rfl", "-- Mathlib.Logic.Function.Basic.bijective_iff_existsUnique (L218-L228)\ntheorem bijective_iff_existsUnique (f : \u03b1 \u2192 \u03b2) : Bijective f \u2194 \u2200 b : \u03b2, \u2203! a : \u03b1, f a = b :=\n\u27e8fun hf b \u21a6\n let \u27e8a, ha\u27e9 := hf.surjective b\n \u27e8a, ha, fun _ ha' \u21a6 hf.injective (ha'.trans ha.symm)\u27e9,\n fun he \u21a6 \u27e8fun {_a a'} h \u21a6 (he (f a')).unique h rfl, fun b \u21a6 (he b).exists\u27e9\u27e9\n\n/-- Shorthand for using projection notation with `Function.bijective_iff_existsUnique`. -/\nprotected theorem Bijective.existsUnique {f : \u03b1 \u2192 \u03b2} (hf : Bijective f) (b : \u03b2) :\n \u2203! a : \u03b1, f a = b :=\n (bijective_iff_existsUnique f).mp hf b", "-- Mathlib.Logic.Function.Basic.funext_iff_of_subsingleton (L67-L72)\nlemma funext_iff_of_subsingleton [Subsingleton \u03b1] {g : \u03b1 \u2192 \u03b2} (x y : \u03b1) :\n f x = g y \u2194 f = g := by\nrefine \u27e8fun h \u21a6 funext fun z \u21a6 ?_, fun h \u21a6 ?_\u27e9\n \u00b7 rwa [Subsingleton.elim x z, Subsingleton.elim y z] at h\n \u00b7 rw [h, Subsingleton.elim x y]", "-- Mathlib.Logic.Function.Basic.eval_apply (L39-L41)\ntheorem eval_apply {\u03b2 : \u03b1 \u2192 Sort*} (x : \u03b1) (f : \u2200 x, \u03b2 x) : eval x f = f x :=\nrfl", "-- Mathlib.Logic.Function.Basic.Injective (L95-L97)\ntheorem Injective.of_comp {g : \u03b3 \u2192 \u03b1} (I : Injective (f \u2218 g)) : Injective g :=\nfun _ _ h \u21a6 I <| congr_arg f h", "-- Mathlib.Logic.Function.Basic.not_surjective_Type (L270-L285)\ntheorem not_surjective_Type {\u03b1 : Type u} (f : \u03b1 \u2192 Type max u v) : \u00acSurjective f := by\nintro hf\n let T : Type max u v := Sigma f\n cases hf (Set T) with | intro U hU =>\n let g : Set T \u2192 T := fun s \u21a6 \u27e8U, cast hU.symm s\u27e9\n have hg : Injective g := by\n intro s t h\n suffices cast hU (g s).2 = cast hU (g t).2 by\n simp only [g, cast_cast, cast_eq] at this\n assumption\n \u00b7 congr\n exact cantor_injective g hg\n\n/-- `g` is a partial inverse to `f` (an injective but not necessarily\n surjective function) if `g y = some x` implies `f x = y`, and `g y = none`\n implies that `y` is not in the range of `f`. -/", "-- Mathlib.Logic.Function.Basic.hfunext (L56-L63)\nlemma hfunext {\u03b1 \u03b1' : Sort u} {\u03b2 : \u03b1 \u2192 Sort v} {\u03b2' : \u03b1' \u2192 Sort v} {f : \u2200 a, \u03b2 a} {f' : \u2200 a, \u03b2' a}\n (h\u03b1 : \u03b1 = \u03b1') (h : \u2200 a a', a \u224d a' \u2192 f a \u224d f' a') : f \u224d f' := by\nsubst h\u03b1\n have : \u2200 a, f a \u224d f' a := fun a \u21a6 h a a (HEq.refl a)\n have : \u03b2 = \u03b2' := by funext a; exact type_eq_of_heq (this a)\n subst this\n grind", "-- Mathlib.Logic.Function.Basic.swap_gt (L75-L75)\ntheorem swap_gt {\u03b1} [LT \u03b1] : swap (\u00b7 > \u00b7 : \u03b1 \u2192 \u03b1 \u2192 _) = (\u00b7 < \u00b7) := rfl", "-- Mathlib.Logic.Function.Basic.const_inj (L50-L52)\ntheorem const_inj [Nonempty \u03b1] {y\u2081 y\u2082 : \u03b2} : const \u03b1 y\u2081 = const \u03b1 y\u2082 \u2194 y\u2081 = y\u2082 :=\n\u27e8fun h \u21a6 const_injective h, fun h \u21a6 h \u25b8 rfl\u27e9", "-- Mathlib.Logic.Function.Basic.exists_fixed_point_of_surjective (L251-L257)\ntheorem exists_fixed_point_of_surjective {\u03b1 \u03b2 : Type*} (f : \u03b1 \u2192 \u03b1 \u2192 \u03b2)\n (hf : Surjective f) (g : \u03b2 \u2192 \u03b2) : \u2203 x, g x = x :=\nlet \u27e8a, ha\u27e9 := hf fun a => g (f a a)\n \u27e8f a a, (congr_fun ha a).symm\u27e9\n\n/-- **Cantor's diagonal argument** implies that there are no surjective functions from `\u03b1`\nto `Set \u03b1`. -/", "-- Mathlib.Logic.Function.Basic.decidableEqPFun (L165-L197)\ninstance decidableEqPFun (p : Prop) [Decidable p] (\u03b1 : p \u2192 Type*) [\u2200 hp, DecidableEq (\u03b1 hp)] :\n DecidableEq (\u2200 hp, \u03b1 hp)\n | f, g => decidable_of_iff (\u2200 hp, f hp = g hp) funext_iff.symm\n\nprotected theorem Surjective.forall (hf : Surjective f) {p : \u03b2 \u2192 Prop} :\n (\u2200 y, p y) \u2194 \u2200 x, p (f x) :=\n\u27e8fun h x \u21a6 h (f x), fun h y \u21a6\n let \u27e8x, hx\u27e9 := hf y\n hx \u25b8 h x\u27e9\n\nprotected theorem Surjective.forall\u2082 (hf : Surjective f) {p : \u03b2 \u2192 \u03b2 \u2192 Prop} :\n (\u2200 y\u2081 y\u2082, p y\u2081 y\u2082) \u2194 \u2200 x\u2081 x\u2082, p (f x\u2081) (f x\u2082) :=\n hf.forall.trans <| forall_congr' fun _ \u21a6 hf.forall\n\nprotected theorem Surjective.forall\u2083 (hf : Surjective f) {p : \u03b2 \u2192 \u03b2 \u2192 \u03b2 \u2192 Prop} :\n (\u2200 y\u2081 y\u2082 y\u2083, p y\u2081 y\u2082 y\u2083) \u2194 \u2200 x\u2081 x\u2082 x\u2083, p (f x\u2081) (f x\u2082) (f x\u2083) :=\n hf.forall.trans <| forall_congr' fun _ \u21a6 hf.forall\u2082\n\nprotected theorem Surjective.exists (hf : Surjective f) {p : \u03b2 \u2192 Prop} :\n (\u2203 y, p y) \u2194 \u2203 x, p (f x) :=\n \u27e8fun \u27e8y, hy\u27e9 \u21a6\n let \u27e8x, hx\u27e9 := hf y\n \u27e8x, hx.symm \u25b8 hy\u27e9,\n fun \u27e8x, hx\u27e9 \u21a6 \u27e8f x, hx\u27e9\u27e9\n\nprotected theorem Surjective.exists\u2082 (hf : Surjective f) {p : \u03b2 \u2192 \u03b2 \u2192 Prop} :\n (\u2203 y\u2081 y\u2082, p y\u2081 y\u2082) \u2194 \u2203 x\u2081 x\u2082, p (f x\u2081) (f x\u2082) :=\n hf.exists.trans <| exists_congr fun _ \u21a6 hf.exists\n\nprotected theorem Surjective.exists\u2083 (hf : Surjective f) {p : \u03b2 \u2192 \u03b2 \u2192 \u03b2 \u2192 Prop} :\n (\u2203 y\u2081 y\u2082 y\u2083, p y\u2081 y\u2082 y\u2083) \u2194 \u2203 x\u2081 x\u2082 x\u2083, p (f x\u2081) (f x\u2082) (f x\u2083) :=\n hf.exists.trans <| exists_congr fun _ \u21a6 hf.exists\u2082", "-- Mathlib.Logic.Function.Basic.not_injective_iff (L81-L83)\ntheorem not_injective_iff : \u00ac Injective f \u2194 \u2203 a b, f a = f b \u2227 a \u2260 b := by\nsimp only [Injective, not_forall, exists_prop]", "-- Mathlib.Logic.Function.Basic.cantor_surjective (L258-L263)\ntheorem cantor_surjective {\u03b1} (f : \u03b1 \u2192 Set \u03b1) : \u00acSurjective f := fun h =>\nlet \u27e8_, hx\u27e9 := exists_fixed_point_of_surjective f h (\u00ac\u00b7)\n not_iff_self (iff_of_eq hx)\n\n/-- **Cantor's diagonal argument** implies that there are no injective functions from `Set \u03b1`\nto `\u03b1`. -/", "-- Mathlib.Logic.Function.Basic.Surjective (L109-L112)\ntheorem Surjective.bijective\u2082_of_injective {g : \u03b3 \u2192 \u03b1} (hf : Surjective f) (hg : Surjective g)\n (I : Injective (f \u2218 g)) : Bijective f \u2227 Bijective g :=\n\u27e8\u27e8I.of_comp_right hg, hf\u27e9, I.of_comp, hg\u27e9", "-- Mathlib.Logic.Function.Basic.swap_ge (L76-L80)\ntheorem swap_ge {\u03b1} [LE \u03b1] : swap (\u00b7 \u2265 \u00b7 : \u03b1 \u2192 \u03b1 \u2192 _) = (\u00b7 \u2264 \u00b7) := rfl\nprotected theorem Bijective.injective {f : \u03b1 \u2192 \u03b2} (hf : Bijective f) : Injective f := hf.1\nprotected theorem Bijective.surjective {f : \u03b1 \u2192 \u03b2} (hf : Bijective f) : Surjective f := hf.2", "-- Mathlib.Logic.Function.Basic.const_def (L42-L44)\ntheorem const_def {y : \u03b2} : (fun _ : \u03b1 \u21a6 y) = const \u03b1 y :=\nrfl", "-- Mathlib.Logic.Function.Basic.surjective_of_right_cancellable_Prop (L214-L217)\ntheorem surjective_of_right_cancellable_Prop (h : \u2200 g\u2081 g\u2082 : \u03b2 \u2192 Prop, g\u2081 \u2218 f = g\u2082 \u2218 f \u2192 g\u2081 = g\u2082) :\n Surjective f :=\ninjective_comp_right_iff_surjective.mp h"], "statement": "abbrev OfArity (\u03b1 \u03b2 : Type u) (n : \u2115) : Type u", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 11316, "declarations_count": 1310, "diagnostics_count": 0, "duplicate_fingerprint": "0529c1e0ec1ec227", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 4658, "lean_code_chars": 9979, "lean_code_ratio": 0.8818, "length_bucket": "medium", "line_count": 346, "natural_language_chars": 1337, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 34, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Function.OfArity).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nabbrev OfArity (\u03b1 \u03b2 : Type u) (n : \u2115) : Type u\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Logic.Function.OfArity.ofArity_zero (L34-L35)\ntheorem ofArity_zero (\u03b1 \u03b2 : Type u) : OfArity \u03b1 \u03b2 0 = \u03b2 := fromTypes_zero _ _\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Logic.Function.OfArity.ofArity_succ (L37-L42)\ntheorem ofArity_succ (\u03b1 \u03b2 : Type u) (n : \u2115) :\n OfArity \u03b1 \u03b2 n.succ = (\u03b1 \u2192 OfArity \u03b1 \u03b2 n) := fromTypes_succ _ _\nnamespace OfArity\n\n/-- Constant `n`-ary function with value `b`. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Logic.Function.OfArity.const (L43-L45)\ndef const (\u03b1 : Type u) {\u03b2 : Type u} (b : \u03b2) (n : \u2115) : OfArity \u03b1 \u03b2 n :=\nFromTypes.const (fun _ => \u03b1) b\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Logic.Function.OfArity.const_zero (L47-L49)\ntheorem const_zero (\u03b1 : Type u) {\u03b2 : Type u} (b : \u03b2) : const \u03b1 b 0 = b :=\nFromTypes.const_zero (fun _ => \u03b1) b\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Logic.Function.OfArity.const_succ (L51-L54)\ntheorem const_succ (\u03b1 : Type u) {\u03b2 : Type u} (b : \u03b2) (n : \u2115) :\n const \u03b1 b n.succ = fun _ => const _ b n :=\nFromTypes.const_succ (fun _ => \u03b1) b\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Logic.Function.OfArity.const_succ_apply (L55-L57)\ntheorem const_succ_apply (\u03b1 : Type u) {\u03b2 : Type u} (b : \u03b2) (n : \u2115) (x : \u03b1) :\n const \u03b1 b n.succ x = const _ b n := FromTypes.const_succ_apply _ b x\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Logic.Function.OfArity.inhabited (L58-L64)\ninstance inhabited {\u03b1 \u03b2 n} [Inhabited \u03b2] : Inhabited (OfArity \u03b1 \u03b2 n) :=\ninferInstanceAs (Inhabited (FromTypes (fun _ => \u03b1) \u03b2))\n\nend OfArity\n\nnamespace FromTypes\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Logic.Function.OfArity.fromTypes_fin_const (L65-L69)\nlemma fromTypes_fin_const (\u03b1 \u03b2 : Type u) (n : \u2115) :\n FromTypes (fun (_ : Fin n) => \u03b1) \u03b2 = OfArity \u03b1 \u03b2 n := rfl\n/-- The definitional equality between heterogeneous functions with constant\ndomain and `n`-ary functions with that domain. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Logic.Function.OfArity.fromTypes_fin_const_equiv (L70-L75)\ndef fromTypes_fin_const_equiv (\u03b1 \u03b2 : Type u) (n : \u2115) :\n FromTypes (fun (_ : Fin n) => \u03b1) \u03b2 \u2243 OfArity \u03b1 \u03b2 n := .refl _\nend FromTypes\n\nend Function\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Logic.Function.Basic.IsPartialInv (L286-L288)\ndef IsPartialInv {\u03b1 \u03b2} (f : \u03b1 \u2192 \u03b2) (g : \u03b2 \u2192 Option \u03b1) : Prop :=\n\u2200 x y, g y = some x \u2194 f x = y\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Logic.Function.Basic.const_injective (L45-L48)\ntheorem const_injective [Nonempty \u03b1] : Injective (const \u03b1 : \u03b2 \u2192 \u03b1 \u2192 \u03b2) := fun _ _ h \u21a6\nlet \u27e8x\u27e9 := \u2039Nonempty \u03b1\u203a\n congr_fun h x\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Logic.Function.Basic.ne_iff (L64-L66)\ntheorem ne_iff {\u03b2 : \u03b1 \u2192 Sort*} {f\u2081 f\u2082 : \u2200 a, \u03b2 a} : f\u2081 \u2260 f\u2082 \u2194 \u2203 a, f\u2081 a \u2260 f\u2082 a :=\nfunext_iff.not.trans not_forall\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Logic.Function.Basic.injective_comp_right_iff_surjective (L201-L213)\ntheorem injective_comp_right_iff_surjective {\u03b3 : Type*} [Nontrivial \u03b3] :\n Injective (fun g : \u03b2 \u2192 \u03b3 \u21a6 g \u2218 f) \u2194 Surjective f := by\nrefine \u27e8not_imp_not.mp fun not_surj inj \u21a6 not_subsingleton \u03b3 \u27e8fun c c' \u21a6 ?_\u27e9,\n (\u00b7.injective_comp_right)\u27e9\n have \u27e8b\u2080, hb\u27e9 := not_forall.mp not_surj\n classical have := inj (a\u2081 := fun _ \u21a6 c) (a\u2082 := (if \u00b7 = b\u2080 then c' else c)) ?_\n \u00b7 simpa using congr_fun this b\u2080\n ext a; simp only [comp_apply, if_neg fun h \u21a6 hb \u27e8a, h\u27e9]\n\nprotected theorem Surjective.right_cancellable (hf : Surjective f) {g\u2081 g\u2082 : \u03b2 \u2192 \u03b3} :\n g\u2081 \u2218 f = g\u2082 \u2218 f \u2194 g\u2081 = g\u2082 :=\n hf.injective_comp_right.eq_iff\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Logic.Function.Basic.onFun_apply (L53-L55)\ntheorem onFun_apply (f : \u03b2 \u2192 \u03b2 \u2192 \u03b3) (g : \u03b1 \u2192 \u03b2) (a b : \u03b1) : onFun f g a b = f (g a) (g b) :=\nrfl\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Logic.Function.Basic.Bijective (L229-L238)\ntheorem Bijective.existsUnique_iff {f : \u03b1 \u2192 \u03b2} (hf : Bijective f) {p : \u03b2 \u2192 Prop} :\n (\u2203! y, p y) \u2194 \u2203! x, p (f x) :=\n\u27e8fun \u27e8y, hpy, hy\u27e9 \u21a6\n let \u27e8x, hx\u27e9 := hf.surjective y\n \u27e8x, by simpa [hx], fun z (hz : p (f z)) \u21a6 hf.injective <| hx.symm \u25b8 hy _ hz\u27e9,\n fun \u27e8x, hpx, hx\u27e9 \u21a6\n \u27e8f x, hpx, fun y hy \u21a6\n let \u27e8z, hz\u27e9 := hf.surjective y\n hz \u25b8 congr_arg f (hx _ (by simpa [hz]))\u27e9\u27e9\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Logic.Function.Basic.swap_lt (L73-L73)\ntheorem swap_lt {\u03b1} [LT \u03b1] : swap (\u00b7 < \u00b7 : \u03b1 \u2192 \u03b1 \u2192 _) = (\u00b7 > \u00b7) := rfl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Logic.Function.Basic.injective_comp_left_iff (L126-L130)\ntheorem injective_comp_left_iff [Nonempty \u03b1] {g : \u03b2 \u2192 \u03b3} :\n Injective (g \u2218 \u00b7 : (\u03b1 \u2192 \u03b2) \u2192 \u03b1 \u2192 \u03b3) \u2194 Injective g :=\n\u27e8fun h b\u2081 b\u2082 eq \u21a6 Nonempty.elim \u2039_\u203a\n (congr_fun <| h (a\u2081 := fun _ \u21a6 b\u2081) (a\u2082 := fun _ \u21a6 b\u2082) <| funext fun _ \u21a6 eq), (\u00b7.comp_left)\u27e9\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Logic.Function.Basic.swap_le (L74-L74)\ntheorem swap_le {\u03b1} [LE \u03b1] : swap (\u00b7 \u2264 \u00b7 : \u03b1 \u2192 \u03b1 \u2192 _) = (\u00b7 \u2265 \u00b7) := rfl\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Logic.Function.Basic.bijective_iff_existsUnique (L218-L228)\ntheorem bijective_iff_existsUnique (f : \u03b1 \u2192 \u03b2) : Bijective f \u2194 \u2200 b : \u03b2, \u2203! a : \u03b1, f a = b :=\n\u27e8fun hf b \u21a6\n let \u27e8a, ha\u27e9 := hf.surjective b\n \u27e8a, ha, fun _ ha' \u21a6 hf.injective (ha'.trans ha.symm)\u27e9,\n fun he \u21a6 \u27e8fun {_a a'} h \u21a6 (he (f a')).unique h rfl, fun b \u21a6 (he b).exists\u27e9\u27e9\n\n/-- Shorthand for using projection notation with `Function.bijective_iff_existsUnique`. -/\nprotected theorem Bijective.existsUnique {f : \u03b1 \u2192 \u03b2} (hf : Bijective f) (b : \u03b2) :\n \u2203! a : \u03b1, f a = b :=\n (bijective_iff_existsUnique f).mp hf b\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Logic.Function.Basic.funext_iff_of_subsingleton (L67-L72)\nlemma funext_iff_of_subsingleton [Subsingleton \u03b1] {g : \u03b1 \u2192 \u03b2} (x y : \u03b1) :\n f x = g y \u2194 f = g := by\nrefine \u27e8fun h \u21a6 funext fun z \u21a6 ?_, fun h \u21a6 ?_\u27e9\n \u00b7 rwa [Subsingleton.elim x z, Subsingleton.elim y z] at h\n \u00b7 rw [h, Subsingleton.elim x y]\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Logic.Function.Basic.eval_apply (L39-L41)\ntheorem eval_apply {\u03b2 : \u03b1 \u2192 Sort*} (x : \u03b1) (f : \u2200 x, \u03b2 x) : eval x f = f x :=\nrfl\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Logic.Function.Basic.Injective (L95-L97)\ntheorem Injective.of_comp {g : \u03b3 \u2192 \u03b1} (I : Injective (f \u2218 g)) : Injective g :=\nfun _ _ h \u21a6 I <| congr_arg f h\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Logic.Function.Basic.not_surjective_Type (L270-L285)\ntheorem not_surjective_Type {\u03b1 : Type u} (f : \u03b1 \u2192 Type max u v) : \u00acSurjective f := by\nintro hf\n let T : Type max u v := Sigma f\n cases hf (Set T) with | intro U hU =>\n let g : Set T \u2192 T := fun s \u21a6 \u27e8U, cast hU.symm s\u27e9\n have hg : Injective g := by\n intro s t h\n suffices cast hU (g s).2 = cast hU (g t).2 by\n simp only [g, cast_cast, cast_eq] at this\n assumption\n \u00b7 congr\n exact cantor_injective g hg\n\n/-- `g` is a partial inverse to `f` (an injective but not necessarily\n surjective function) if `g y = some x` implies `f x = y`, and `g y = none`\n implies that `y` is not in the range of `f`. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Logic.Function.Basic.hfunext (L56-L63)\nlemma hfunext {\u03b1 \u03b1' : Sort u} {\u03b2 : \u03b1 \u2192 Sort v} {\u03b2' : \u03b1' \u2192 Sort v} {f : \u2200 a, \u03b2 a} {f' : \u2200 a, \u03b2' a}\n (h\u03b1 : \u03b1 = \u03b1') (h : \u2200 a a', a \u224d a' \u2192 f a \u224d f' a') : f \u224d f' := by\nsubst h\u03b1\n have : \u2200 a, f a \u224d f' a := fun a \u21a6 h a a (HEq.refl a)\n have : \u03b2 = \u03b2' := by funext a; exact type_eq_of_heq (this a)\n subst this\n grind\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Logic.Function.Basic.swap_gt (L75-L75)\ntheorem swap_gt {\u03b1} [LT \u03b1] : swap (\u00b7 > \u00b7 : \u03b1 \u2192 \u03b1 \u2192 _) = (\u00b7 < \u00b7) := rfl\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Logic.Function.Basic.const_inj (L50-L52)\ntheorem const_inj [Nonempty \u03b1] {y\u2081 y\u2082 : \u03b2} : const \u03b1 y\u2081 = const \u03b1 y\u2082 \u2194 y\u2081 = y\u2082 :=\n\u27e8fun h \u21a6 const_injective h, fun h \u21a6 h \u25b8 rfl\u27e9\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Logic.Function.Basic.exists_fixed_point_of_surjective (L251-L257)\ntheorem exists_fixed_point_of_surjective {\u03b1 \u03b2 : Type*} (f : \u03b1 \u2192 \u03b1 \u2192 \u03b2)\n (hf : Surjective f) (g : \u03b2 \u2192 \u03b2) : \u2203 x, g x = x :=\nlet \u27e8a, ha\u27e9 := hf fun a => g (f a a)\n \u27e8f a a, (congr_fun ha a).symm\u27e9\n\n/-- **Cantor's diagonal argument** implies that there are no surjective functions from `\u03b1`\nto `Set \u03b1`. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Logic.Function.Basic.decidableEqPFun (L165-L197)\ninstance decidableEqPFun (p : Prop) [Decidable p] (\u03b1 : p \u2192 Type*) [\u2200 hp, DecidableEq (\u03b1 hp)] :\n DecidableEq (\u2200 hp, \u03b1 hp)\n | f, g => decidable_of_iff (\u2200 hp, f hp = g hp) funext_iff.symm\n\nprotected theorem Surjective.forall (hf : Surjective f) {p : \u03b2 \u2192 Prop} :\n (\u2200 y, p y) \u2194 \u2200 x, p (f x) :=\n\u27e8fun h x \u21a6 h (f x), fun h y \u21a6\n let \u27e8x, hx\u27e9 := hf y\n hx \u25b8 h x\u27e9\n\nprotected theorem Surjective.forall\u2082 (hf : Surjective f) {p : \u03b2 \u2192 \u03b2 \u2192 Prop} :\n (\u2200 y\u2081 y\u2082, p y\u2081 y\u2082) \u2194 \u2200 x\u2081 x\u2082, p (f x\u2081) (f x\u2082) :=\n hf.forall.trans <| forall_congr' fun _ \u21a6 hf.forall\n\nprotected theorem Surjective.forall\u2083 (hf : Surjective f) {p : \u03b2 \u2192 \u03b2 \u2192 \u03b2 \u2192 Prop} :\n (\u2200 y\u2081 y\u2082 y\u2083, p y\u2081 y\u2082 y\u2083) \u2194 \u2200 x\u2081 x\u2082 x\u2083, p (f x\u2081) (f x\u2082) (f x\u2083) :=\n hf.forall.trans <| forall_congr' fun _ \u21a6 hf.forall\u2082\n\nprotected theorem Surjective.exists (hf : Surjective f) {p : \u03b2 \u2192 Prop} :\n (\u2203 y, p y) \u2194 \u2203 x, p (f x) :=\n \u27e8fun \u27e8y, hy\u27e9 \u21a6\n let \u27e8x, hx\u27e9 := hf y\n \u27e8x, hx.symm \u25b8 hy\u27e9,\n fun \u27e8x, hx\u27e9 \u21a6 \u27e8f x, hx\u27e9\u27e9\n\nprotected theorem Surjective.exists\u2082 (hf : Surjective f) {p : \u03b2 \u2192 \u03b2 \u2192 Prop} :\n (\u2203 y\u2081 y\u2082, p y\u2081 y\u2082) \u2194 \u2203 x\u2081 x\u2082, p (f x\u2081) (f x\u2082) :=\n hf.exists.trans <| exists_congr fun _ \u21a6 hf.exists\n\nprotected theorem Surjective.exists\u2083 (hf : Surjective f) {p : \u03b2 \u2192 \u03b2 \u2192 \u03b2 \u2192 Prop} :\n (\u2203 y\u2081 y\u2082 y\u2083, p y\u2081 y\u2082 y\u2083) \u2194 \u2203 x\u2081 x\u2082 x\u2083, p (f x\u2081) (f x\u2082) (f x\u2083) :=\n hf.exists.trans <| exists_congr fun _ \u21a6 hf.exists\u2082\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Logic.Function.Basic.not_injective_iff (L81-L83)\ntheorem not_injective_iff : \u00ac Injective f \u2194 \u2203 a b, f a = f b \u2227 a \u2260 b := by\nsimp only [Injective, not_forall, exists_prop]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Logic.Function.Basic.cantor_surjective (L258-L263)\ntheorem cantor_surjective {\u03b1} (f : \u03b1 \u2192 Set \u03b1) : \u00acSurjective f := fun h =>\nlet \u27e8_, hx\u27e9 := exists_fixed_point_of_surjective f h (\u00ac\u00b7)\n not_iff_self (iff_of_eq hx)\n\n/-- **Cantor's diagonal argument** implies that there are no injective functions from `Set \u03b1`\nto `\u03b1`. -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Logic.Function.Basic.Surjective (L109-L112)\ntheorem Surjective.bijective\u2082_of_injective {g : \u03b3 \u2192 \u03b1} (hf : Surjective f) (hg : Surjective g)\n (I : Injective (f \u2218 g)) : Bijective f \u2227 Bijective g :=\n\u27e8\u27e8I.of_comp_right hg, hf\u27e9, I.of_comp, hg\u27e9\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Logic.Function.Basic.swap_ge (L76-L80)\ntheorem swap_ge {\u03b1} [LE \u03b1] : swap (\u00b7 \u2265 \u00b7 : \u03b1 \u2192 \u03b1 \u2192 _) = (\u00b7 \u2264 \u00b7) := rfl\nprotected theorem Bijective.injective {f : \u03b1 \u2192 \u03b2} (hf : Bijective f) : Injective f := hf.1\nprotected theorem Bijective.surjective {f : \u03b1 \u2192 \u03b2} (hf : Bijective f) : Surjective f := hf.2\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Logic.Function.Basic.const_def (L42-L44)\ntheorem const_def {y : \u03b2} : (fun _ : \u03b1 \u21a6 y) = const \u03b1 y :=\nrfl\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Logic.Function.Basic.surjective_of_right_cancellable_Prop (L214-L217)\ntheorem surjective_of_right_cancellable_Prop (h : \u2200 g\u2081 g\u2082 : \u03b2 \u2192 Prop, g\u2081 \u2218 f = g\u2082 \u2218 f \u2192 g\u2081 = g\u2082) :\n Surjective f :=\ninjective_comp_right_iff_surjective.mp h\n```\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Function.OfArity).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nabbrev OfArity (\u03b1 \u03b2 : Type u) (n : \u2115) : Type u\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Logic.Function.OfArity.ofArity_zero (L34-L35)\ntheorem ofArity_zero (\u03b1 \u03b2 : Type u) : OfArity \u03b1 \u03b2 0 = \u03b2 := fromTypes_zero _ _\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Logic.Function.OfArity.ofArity_succ (L37-L42)\ntheorem ofArity_succ (\u03b1 \u03b2 : Type u) (n : \u2115) :\n OfArity \u03b1 \u03b2 n.succ = (\u03b1 \u2192 OfArity \u03b1 \u03b2 n) := fromTypes_succ _ _\nnamespace OfArity\n\n/-- Constant `n`-ary function with value `b`. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Logic.Function.OfArity.const (L43-L45)\ndef const (\u03b1 : Type u) {\u03b2 : Type u} (b : \u03b2) (n : \u2115) : OfArity \u03b1 \u03b2 n :=\nFromTypes.const (fun _ => \u03b1) b\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Logic.Function.OfArity.const_zero (L47-L49)\ntheorem const_zero (\u03b1 : Type u) {\u03b2 : Type u} (b : \u03b2) : const \u03b1 b 0 = b :=\nFromTypes.const_zero (fun _ => \u03b1) b\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Logic.Function.OfArity.const_succ (L51-L54)\ntheorem const_succ (\u03b1 : Type u) {\u03b2 : Type u} (b : \u03b2) (n : \u2115) :\n const \u03b1 b n.succ = fun _ => const _ b n :=\nFromTypes.const_succ (fun _ => \u03b1) b\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Logic.Function.OfArity.const_succ_apply (L55-L57)\ntheorem const_succ_apply (\u03b1 : Type u) {\u03b2 : Type u} (b : \u03b2) (n : \u2115) (x : \u03b1) :\n const \u03b1 b n.succ x = const _ b n := FromTypes.const_succ_apply _ b x\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Logic.Function.OfArity.inhabited (L58-L64)\ninstance inhabited {\u03b1 \u03b2 n} [Inhabited \u03b2] : Inhabited (OfArity \u03b1 \u03b2 n) :=\ninferInstanceAs (Inhabited (FromTypes (fun _ => \u03b1) \u03b2))\n\nend OfArity\n\nnamespace FromTypes\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Logic.Function.OfArity.fromTypes_fin_const (L65-L69)\nlemma fromTypes_fin_const (\u03b1 \u03b2 : Type u) (n : \u2115) :\n FromTypes (fun (_ : Fin n) => \u03b1) \u03b2 = OfArity \u03b1 \u03b2 n := rfl\n/-- The definitional equality between heterogeneous functions with constant\ndomain and `n`-ary functions with that domain. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Logic.Function.OfArity.fromTypes_fin_const_equiv (L70-L75)\ndef fromTypes_fin_const_equiv (\u03b1 \u03b2 : Type u) (n : \u2115) :\n FromTypes (fun (_ : Fin n) => \u03b1) \u03b2 \u2243 OfArity \u03b1 \u03b2 n := .refl _\nend FromTypes\n\nend Function\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Logic.Function.Basic.IsPartialInv (L286-L288)\ndef IsPartialInv {\u03b1 \u03b2} (f : \u03b1 \u2192 \u03b2) (g : \u03b2 \u2192 Option \u03b1) : Prop :=\n\u2200 x y, g y = some x \u2194 f x = y\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Logic.Function.Basic.const_injective (L45-L48)\ntheorem const_injective [Nonempty \u03b1] : Injective (const \u03b1 : \u03b2 \u2192 \u03b1 \u2192 \u03b2) := fun _ _ h \u21a6\nlet \u27e8x\u27e9 := \u2039Nonempty \u03b1\u203a\n congr_fun h x\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Logic.Function.Basic.ne_iff (L64-L66)\ntheorem ne_iff {\u03b2 : \u03b1 \u2192 Sort*} {f\u2081 f\u2082 : \u2200 a, \u03b2 a} : f\u2081 \u2260 f\u2082 \u2194 \u2203 a, f\u2081 a \u2260 f\u2082 a :=\nfunext_iff.not.trans not_forall\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Logic.Function.Basic.injective_comp_right_iff_surjective (L201-L213)\ntheorem injective_comp_right_iff_surjective {\u03b3 : Type*} [Nontrivial \u03b3] :\n Injective (fun g : \u03b2 \u2192 \u03b3 \u21a6 g \u2218 f) \u2194 Surjective f := by\nrefine \u27e8not_imp_not.mp fun not_surj inj \u21a6 not_subsingleton \u03b3 \u27e8fun c c' \u21a6 ?_\u27e9,\n (\u00b7.injective_comp_right)\u27e9\n have \u27e8b\u2080, hb\u27e9 := not_forall.mp not_surj\n classical have := inj (a\u2081 := fun _ \u21a6 c) (a\u2082 := (if \u00b7 = b\u2080 then c' else c)) ?_\n \u00b7 simpa using congr_fun this b\u2080\n ext a; simp only [comp_apply, if_neg fun h \u21a6 hb \u27e8a, h\u27e9]\n\nprotected theorem Surjective.right_cancellable (hf : Surjective f) {g\u2081 g\u2082 : \u03b2 \u2192 \u03b3} :\n g\u2081 \u2218 f = g\u2082 \u2218 f \u2194 g\u2081 = g\u2082 :=\n hf.injective_comp_right.eq_iff\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Logic.Function.Basic.onFun_apply (L53-L55)\ntheorem onFun_apply (f : \u03b2 \u2192 \u03b2 \u2192 \u03b3) (g : \u03b1 \u2192 \u03b2) (a b : \u03b1) : onFun f g a b = f (g a) (g b) :=\nrfl\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Logic.Function.Basic.Bijective (L229-L238)\ntheorem Bijective.existsUnique_iff {f : \u03b1 \u2192 \u03b2} (hf : Bijective f) {p : \u03b2 \u2192 Prop} :\n (\u2203! y, p y) \u2194 \u2203! x, p (f x) :=\n\u27e8fun \u27e8y, hpy, hy\u27e9 \u21a6\n let \u27e8x, hx\u27e9 := hf.surjective y\n \u27e8x, by simpa [hx], fun z (hz : p (f z)) \u21a6 hf.injective <| hx.symm \u25b8 hy _ hz\u27e9,\n fun \u27e8x, hpx, hx\u27e9 \u21a6\n \u27e8f x, hpx, fun y hy \u21a6\n let \u27e8z, hz\u27e9 := hf.surjective y\n hz \u25b8 congr_arg f (hx _ (by simpa [hz]))\u27e9\u27e9\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Logic.Function.Basic.swap_lt (L73-L73)\ntheorem swap_lt {\u03b1} [LT \u03b1] : swap (\u00b7 < \u00b7 : \u03b1 \u2192 \u03b1 \u2192 _) = (\u00b7 > \u00b7) := rfl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Logic.Function.Basic.injective_comp_left_iff (L126-L130)\ntheorem injective_comp_left_iff [Nonempty \u03b1] {g : \u03b2 \u2192 \u03b3} :\n Injective (g \u2218 \u00b7 : (\u03b1 \u2192 \u03b2) \u2192 \u03b1 \u2192 \u03b3) \u2194 Injective g :=\n\u27e8fun h b\u2081 b\u2082 eq \u21a6 Nonempty.elim \u2039_\u203a\n (congr_fun <| h (a\u2081 := fun _ \u21a6 b\u2081) (a\u2082 := fun _ \u21a6 b\u2082) <| funext fun _ \u21a6 eq), (\u00b7.comp_left)\u27e9\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Logic.Function.Basic.swap_le (L74-L74)\ntheorem swap_le {\u03b1} [LE \u03b1] : swap (\u00b7 \u2264 \u00b7 : \u03b1 \u2192 \u03b1 \u2192 _) = (\u00b7 \u2265 \u00b7) := rfl\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Logic.Function.Basic.bijective_iff_existsUnique (L218-L228)\ntheorem bijective_iff_existsUnique (f : \u03b1 \u2192 \u03b2) : Bijective f \u2194 \u2200 b : \u03b2, \u2203! a : \u03b1, f a = b :=\n\u27e8fun hf b \u21a6\n let \u27e8a, ha\u27e9 := hf.surjective b\n \u27e8a, ha, fun _ ha' \u21a6 hf.injective (ha'.trans ha.symm)\u27e9,\n fun he \u21a6 \u27e8fun {_a a'} h \u21a6 (he (f a')).unique h rfl, fun b \u21a6 (he b).exists\u27e9\u27e9\n\n/-- Shorthand for using projection notation with `Function.bijective_iff_existsUnique`. -/\nprotected theorem Bijective.existsUnique {f : \u03b1 \u2192 \u03b2} (hf : Bijective f) (b : \u03b2) :\n \u2203! a : \u03b1, f a = b :=\n (bijective_iff_existsUnique f).mp hf b\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Logic.Function.Basic.funext_iff_of_subsingleton (L67-L72)\nlemma funext_iff_of_subsingleton [Subsingleton \u03b1] {g : \u03b1 \u2192 \u03b2} (x y : \u03b1) :\n f x = g y \u2194 f = g := by\nrefine \u27e8fun h \u21a6 funext fun z \u21a6 ?_, fun h \u21a6 ?_\u27e9\n \u00b7 rwa [Subsingleton.elim x z, Subsingleton.elim y z] at h\n \u00b7 rw [h, Subsingleton.elim x y]\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Logic.Function.Basic.eval_apply (L39-L41)\ntheorem eval_apply {\u03b2 : \u03b1 \u2192 Sort*} (x : \u03b1) (f : \u2200 x, \u03b2 x) : eval x f = f x :=\nrfl\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Logic.Function.Basic.Injective (L95-L97)\ntheorem Injective.of_comp {g : \u03b3 \u2192 \u03b1} (I : Injective (f \u2218 g)) : Injective g :=\nfun _ _ h \u21a6 I <| congr_arg f h\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Logic.Function.Basic.not_surjective_Type (L270-L285)\ntheorem not_surjective_Type {\u03b1 : Type u} (f : \u03b1 \u2192 Type max u v) : \u00acSurjective f := by\nintro hf\n let T : Type max u v := Sigma f\n cases hf (Set T) with | intro U hU =>\n let g : Set T \u2192 T := fun s \u21a6 \u27e8U, cast hU.symm s\u27e9\n have hg : Injective g := by\n intro s t h\n suffices cast hU (g s).2 = cast hU (g t).2 by\n simp only [g, cast_cast, cast_eq] at this\n assumption\n \u00b7 congr\n exact cantor_injective g hg\n\n/-- `g` is a partial inverse to `f` (an injective but not necessarily\n surjective function) if `g y = some x` implies `f x = y`, and `g y = none`\n implies that `y` is not in the range of `f`. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Logic.Function.Basic.hfunext (L56-L63)\nlemma hfunext {\u03b1 \u03b1' : Sort u} {\u03b2 : \u03b1 \u2192 Sort v} {\u03b2' : \u03b1' \u2192 Sort v} {f : \u2200 a, \u03b2 a} {f' : \u2200 a, \u03b2' a}\n (h\u03b1 : \u03b1 = \u03b1') (h : \u2200 a a', a \u224d a' \u2192 f a \u224d f' a') : f \u224d f' := by\nsubst h\u03b1\n have : \u2200 a, f a \u224d f' a := fun a \u21a6 h a a (HEq.refl a)\n have : \u03b2 = \u03b2' := by funext a; exact type_eq_of_heq (this a)\n subst this\n grind\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Logic.Function.Basic.swap_gt (L75-L75)\ntheorem swap_gt {\u03b1} [LT \u03b1] : swap (\u00b7 > \u00b7 : \u03b1 \u2192 \u03b1 \u2192 _) = (\u00b7 < \u00b7) := rfl\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Logic.Function.Basic.const_inj (L50-L52)\ntheorem const_inj [Nonempty \u03b1] {y\u2081 y\u2082 : \u03b2} : const \u03b1 y\u2081 = const \u03b1 y\u2082 \u2194 y\u2081 = y\u2082 :=\n\u27e8fun h \u21a6 const_injective h, fun h \u21a6 h \u25b8 rfl\u27e9\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Logic.Function.Basic.exists_fixed_point_of_surjective (L251-L257)\ntheorem exists_fixed_point_of_surjective {\u03b1 \u03b2 : Type*} (f : \u03b1 \u2192 \u03b1 \u2192 \u03b2)\n (hf : Surjective f) (g : \u03b2 \u2192 \u03b2) : \u2203 x, g x = x :=\nlet \u27e8a, ha\u27e9 := hf fun a => g (f a a)\n \u27e8f a a, (congr_fun ha a).symm\u27e9\n\n/-- **Cantor's diagonal argument** implies that there are no surjective functions from `\u03b1`\nto `Set \u03b1`. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Logic.Function.Basic.decidableEqPFun (L165-L197)\ninstance decidableEqPFun (p : Prop) [Decidable p] (\u03b1 : p \u2192 Type*) [\u2200 hp, DecidableEq (\u03b1 hp)] :\n DecidableEq (\u2200 hp, \u03b1 hp)\n | f, g => decidable_of_iff (\u2200 hp, f hp = g hp) funext_iff.symm\n\nprotected theorem Surjective.forall (hf : Surjective f) {p : \u03b2 \u2192 Prop} :\n (\u2200 y, p y) \u2194 \u2200 x, p (f x) :=\n\u27e8fun h x \u21a6 h (f x), fun h y \u21a6\n let \u27e8x, hx\u27e9 := hf y\n hx \u25b8 h x\u27e9\n\nprotected theorem Surjective.forall\u2082 (hf : Surjective f) {p : \u03b2 \u2192 \u03b2 \u2192 Prop} :\n (\u2200 y\u2081 y\u2082, p y\u2081 y\u2082) \u2194 \u2200 x\u2081 x\u2082, p (f x\u2081) (f x\u2082) :=\n hf.forall.trans <| forall_congr' fun _ \u21a6 hf.forall\n\nprotected theorem Surjective.forall\u2083 (hf : Surjective f) {p : \u03b2 \u2192 \u03b2 \u2192 \u03b2 \u2192 Prop} :\n (\u2200 y\u2081 y\u2082 y\u2083, p y\u2081 y\u2082 y\u2083) \u2194 \u2200 x\u2081 x\u2082 x\u2083, p (f x\u2081) (f x\u2082) (f x\u2083) :=\n hf.forall.trans <| forall_congr' fun _ \u21a6 hf.forall\u2082\n\nprotected theorem Surjective.exists (hf : Surjective f) {p : \u03b2 \u2192 Prop} :\n (\u2203 y, p y) \u2194 \u2203 x, p (f x) :=\n \u27e8fun \u27e8y, hy\u27e9 \u21a6\n let \u27e8x, hx\u27e9 := hf y\n \u27e8x, hx.symm \u25b8 hy\u27e9,\n fun \u27e8x, hx\u27e9 \u21a6 \u27e8f x, hx\u27e9\u27e9\n\nprotected theorem Surjective.exists\u2082 (hf : Surjective f) {p : \u03b2 \u2192 \u03b2 \u2192 Prop} :\n (\u2203 y\u2081 y\u2082, p y\u2081 y\u2082) \u2194 \u2203 x\u2081 x\u2082, p (f x\u2081) (f x\u2082) :=\n hf.exists.trans <| exists_congr fun _ \u21a6 hf.exists\n\nprotected theorem Surjective.exists\u2083 (hf : Surjective f) {p : \u03b2 \u2192 \u03b2 \u2192 \u03b2 \u2192 Prop} :\n (\u2203 y\u2081 y\u2082 y\u2083, p y\u2081 y\u2082 y\u2083) \u2194 \u2203 x\u2081 x\u2082 x\u2083, p (f x\u2081) (f x\u2082) (f x\u2083) :=\n hf.exists.trans <| exists_congr fun _ \u21a6 hf.exists\u2082\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Logic.Function.Basic.not_injective_iff (L81-L83)\ntheorem not_injective_iff : \u00ac Injective f \u2194 \u2203 a b, f a = f b \u2227 a \u2260 b := by\nsimp only [Injective, not_forall, exists_prop]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Logic.Function.Basic.cantor_surjective (L258-L263)\ntheorem cantor_surjective {\u03b1} (f : \u03b1 \u2192 Set \u03b1) : \u00acSurjective f := fun h =>\nlet \u27e8_, hx\u27e9 := exists_fixed_point_of_surjective f h (\u00ac\u00b7)\n not_iff_self (iff_of_eq hx)\n\n/-- **Cantor's diagonal argument** implies that there are no injective functions from `Set \u03b1`\nto `\u03b1`. -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Logic.Function.Basic.Surjective (L109-L112)\ntheorem Surjective.bijective\u2082_of_injective {g : \u03b3 \u2192 \u03b1} (hf : Surjective f) (hg : Surjective g)\n (I : Injective (f \u2218 g)) : Bijective f \u2227 Bijective g :=\n\u27e8\u27e8I.of_comp_right hg, hf\u27e9, I.of_comp, hg\u27e9\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Logic.Function.Basic.swap_ge (L76-L80)\ntheorem swap_ge {\u03b1} [LE \u03b1] : swap (\u00b7 \u2265 \u00b7 : \u03b1 \u2192 \u03b1 \u2192 _) = (\u00b7 \u2264 \u00b7) := rfl\nprotected theorem Bijective.injective {f : \u03b1 \u2192 \u03b2} (hf : Bijective f) : Injective f := hf.1\nprotected theorem Bijective.surjective {f : \u03b1 \u2192 \u03b2} (hf : Bijective f) : Surjective f := hf.2\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Logic.Function.Basic.const_def (L42-L44)\ntheorem const_def {y : \u03b2} : (fun _ : \u03b1 \u21a6 y) = const \u03b1 y :=\nrfl\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Logic.Function.Basic.surjective_of_right_cancellable_Prop (L214-L217)\ntheorem surjective_of_right_cancellable_Prop (h : \u2200 g\u2081 g\u2082 : \u03b2 \u2192 Prop, g\u2081 \u2218 f = g\u2082 \u2218 f \u2192 g\u2081 = g\u2082) :\n Surjective f :=\ninjective_comp_right_iff_surjective.mp h\n```\n[/INST]", "sample_id": "C-Mathlib.Logic.Function.OfArity.OfArity", "source": {"declaration": "Mathlib.Logic.Function.OfArity.OfArity", "file": "Mathlib/Logic/Function/OfArity.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Logic.Function.OfArity", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Logic/Function/OfArity.lean#L31", "span": "L31-L32"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "def getPropHyps : MetaM (Array FVarId)\n:= do _unbalancedParenXYZ\nlet mut result := #[]\n for localDecl in (\u2190 getLCtx) do\n unless localDecl.isAuxDecl do\n if (\u2190 isProp localDecl.type) then\n result := result.push localDecl.fvarId\n return result\n\nend Simp\n\n/-- Construct a `SimpTheorems` from a list of names. -/", "diagnostic": "[CompilationUnit(i_begin=0, i_end=65, messages=[Message(data=\"Function expected at\\n MetaM\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n (Array FVarId)\\n\\nHint: The identifier `MetaM` 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=18), pos_end=Position(line=1, column=38), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=65, i_end=273, messages=[Message(data=\"unexpected token 'let'; expected command\", pos=Position(line=3, column=0), pos_end=Position(line=3, column=3), 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=10, column=0), pos_end=Position(line=10, column=8), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=273, i_end=328, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=12, column=55), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]", "mutation_kind": "term_arg_order", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 2370, "declarations_count": 297, "diagnostics_count": 1, "duplicate_fingerprint": "27c113e8c683e60d", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 653, "lean_code_chars": 325, "lean_code_ratio": 0.1371, "length_bucket": "short", "line_count": 23, "natural_language_chars": 2045, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Lean.Meta.Simp).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef getPropHyps : MetaM (Array FVarId)\n:= do _unbalancedParenXYZ\nlet mut result := #[]\n for localDecl in (\u2190 getLCtx) do\n unless localDecl.isAuxDecl do\n if (\u2190 isProp localDecl.type) then\n result := result.push localDecl.fvarId\n return result\n\nend Simp\n\n/-- Construct a `SimpTheorems` from a list of names. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=65, messages=[Message(data=\"Function expected at\\n MetaM\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n (Array FVarId)\\n\\nHint: The identifier `MetaM` 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=18), pos_end=Position(line=1, column=38), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=65, i_end=273, messages=[Message(data=\"unexpected token 'let'; expected command\", pos=Position(line=3, column=0), pos_end=Position(line=3, column=3), 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=10, column=0), pos_end=Position(line=10, column=8), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=273, i_end=328, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=12, column=55), 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.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Lean.Meta.Simp).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef getPropHyps : MetaM (Array FVarId)\n:= do _unbalancedParenXYZ\nlet mut result := #[]\n for localDecl in (\u2190 getLCtx) do\n unless localDecl.isAuxDecl do\n if (\u2190 isProp localDecl.type) then\n result := result.push localDecl.fvarId\n return result\n\nend Simp\n\n/-- Construct a `SimpTheorems` from a list of names. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=65, messages=[Message(data=\"Function expected at\\n MetaM\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n (Array FVarId)\\n\\nHint: The identifier `MetaM` 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=18), pos_end=Position(line=1, column=38), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=65, i_end=273, messages=[Message(data=\"unexpected token 'let'; expected command\", pos=Position(line=3, column=0), pos_end=Position(line=3, column=3), 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=10, column=0), pos_end=Position(line=10, column=8), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=273, i_end=328, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=12, column=55), 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]", "sample_id": "B-Mathlib.Lean.Meta.Simp.getPropHyps", "source": {"declaration": "Mathlib.Lean.Meta.Simp.getPropHyps", "file": "Mathlib/Lean/Meta/Simp.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Lean.Meta.Simp", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Lean/Meta/Simp.lean#L55", "span": "L55-L65"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem FactorsHelper.nil {a : \u2115} : FactorsHelper 1 a []", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 463, "declarations_count": 51, "diagnostics_count": 0, "duplicate_fingerprint": "1cf6d742e4fb4d15", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 130, "lean_code_chars": 57, "lean_code_ratio": 0.1231, "length_bucket": "tiny", "line_count": 7, "natural_language_chars": 406, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.Simproc.Factors).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem FactorsHelper.nil {a : \u2115} : FactorsHelper 1 a []\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.Simproc.Factors).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem FactorsHelper.nil {a : \u2115} : FactorsHelper 1 a []\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Tactic.Simproc.Factors.FactorsHelper", "source": {"declaration": "Mathlib.Tactic.Simproc.Factors.FactorsHelper", "file": "Mathlib/Tactic/Simproc/Factors.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.Simproc.Factors", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/Simproc/Factors.lean#L35", "span": "L35-L37"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"trace_states": [{"state": "theorem coverEntropy_closure (h : Continuous T) :\n coverEntropy T (closure F) = coverEntropy T F", "tactic": "refine (iSup\u2082_le fun U U_uni \u21a6 ?_).antisymm (coverEntropy_monotone T subset_closure)"}, {"state": "", "tactic": "obtain \u27e8V, V_uni, V_U\u27e9 := comp_mem_uniformity_sets U_uni"}, {"state": "", "tactic": "exact le_iSup\u2082_of_le V V_uni ((coverEntropyEntourage_antitone T (closure F) V_U).trans (coverEntropyEntourage_closure h F V V_uni)) end Closure /-! ### Finite unions -/ section Union"}], "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1289, "declarations_count": 150, "diagnostics_count": 0, "duplicate_fingerprint": "7d031774e16b5770", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 400, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "tiny", "line_count": 14, "natural_language_chars": 1289, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.TopologicalEntropy.Subset).", "role": "system"}, {"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.Dynamics.TopologicalEntropy.Subset.coverEntropy_closure`:\nState 0: \u22a2 theorem coverEntropy_closure (h : Continuous T) :\n coverEntropy T (closure F) = coverEntropy T F\nTactic: refine (iSup\u2082_le fun U U_uni \u21a6 ?_).antisymm (coverEntropy_monotone T subset_closure)\nState 1: \u22a2 \nTactic: obtain \u27e8V, V_uni, V_U\u27e9 := comp_mem_uniformity_sets U_uni\nState 2: \u22a2 \nTactic: exact le_iSup\u2082_of_le V V_uni ((coverEntropyEntourage_antitone T (closure F) V_U).trans (coverEntropyEntourage_closure h F V V_uni)) end Closure /-! ### Finite unions -/ section Union\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.TopologicalEntropy.Subset).[/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.Dynamics.TopologicalEntropy.Subset.coverEntropy_closure`:\nState 0: \u22a2 theorem coverEntropy_closure (h : Continuous T) :\n coverEntropy T (closure F) = coverEntropy T F\nTactic: refine (iSup\u2082_le fun U U_uni \u21a6 ?_).antisymm (coverEntropy_monotone T subset_closure)\nState 1: \u22a2 \nTactic: obtain \u27e8V, V_uni, V_U\u27e9 := comp_mem_uniformity_sets U_uni\nState 2: \u22a2 \nTactic: exact le_iSup\u2082_of_le V V_uni ((coverEntropyEntourage_antitone T (closure F) V_U).trans (coverEntropyEntourage_closure h F V V_uni)) end Closure /-! ### Finite unions -/ section Union\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.Dynamics.TopologicalEntropy.Subset.coverEntropy_closure", "source": {"declaration": "Mathlib.Dynamics.TopologicalEntropy.Subset.coverEntropy_closure", "file": "Mathlib/Dynamics/TopologicalEntropy/Subset.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Dynamics.TopologicalEntropy.Subset", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Dynamics/TopologicalEntropy/Subset.lean#L135", "span": "L135-L147"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"trace_states": [{"state": "lemma nonempty_inter_of_coverMincard [U.IsSymm] {s : Finset X} (h : IsDynCoverOf T F U n s)\n (h' : #s = coverMincard T F U n) :\n \u2200 x \u2208 s, (F \u2229 ball x (dynEntourage T U n)).Nonempty", "tactic": "have smaller_cover : IsDynCoverOf T F U n (s.erase x) := by"}, {"state": "", "tactic": "intro y y_F specialize h y_F"}, {"state": "", "tactic": "simp only [s.mem_coe] at h"}, {"state": "", "tactic": "simp only [s.coe_erase, mem_diff, s.mem_coe, mem_singleton_iff]"}, {"state": "", "tactic": "obtain \u27e8z, z_s, hz\u27e9 := h"}, {"state": "", "tactic": "refine \u27e8z, \u27e8z_s, fun z_x \u21a6 notMem_empty y ?_\u27e9, hz\u27e9"}, {"state": "", "tactic": "rw [\u2190 ball_empt]"}, {"state": "", "tactic": "rw [z_x] at hz"}, {"state": "", "tactic": "exact mem_inter y_F <| (dynEntourage T U n).symm hz"}, {"state": "", "tactic": "apply smaller_cover.coverMincard_le_card.not_gt"}, {"state": "", "tactic": "rw [\u2190 h'] exact_mod_cast s.card_erase_lt_of_mem x_s /-! ### Cover entropy of entourages -/ open ENNReal EReal ExpGrowth Filter /-- The entropy of an entourage `U`, defined as the exponential rate of growth of the size of the smallest `(U, n)`-refined cover of `F`. Takes values in the space of extended real numbers `[-\u221e, +\u221e]`. This first version uses a `limsup`, and is chosen as the default definition. -/ noncomputable def coverEntropyEntourage (T : X \u2192 X) (F : Set X) (U : SetRel X X) := expGrowthSup fun n : \u2115 \u21a6 coverMincard T F U n /-- The entropy of an entourage `U`, defined as the exponential rate of growth of the size of the smallest `(U, n)`-refined cover of `F`. Takes values in the space of extended real numbers `[-\u221e, +\u221e]`. This second version uses a `liminf`, and is chosen as an alternative definition. -/ noncomputable def coverEntropyInfEntourage (T : X \u2192 X) (F : Set X) (U : SetRel X X) := expGrowthInf fun n : \u2115 \u21a6 coverMincard T F U n"}], "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 2913, "declarations_count": 407, "diagnostics_count": 0, "duplicate_fingerprint": "81be3f272a1fccf0", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1033, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "short", "line_count": 31, "natural_language_chars": 2913, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.TopologicalEntropy.CoverEntropy).", "role": "system"}, {"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.Dynamics.TopologicalEntropy.CoverEntropy.nonempty_inter_of_coverMincard`:\nState 0: \u22a2 lemma nonempty_inter_of_coverMincard [U.IsSymm] {s : Finset X} (h : IsDynCoverOf T F U n s)\n (h' : #s = coverMincard T F U n) :\n \u2200 x \u2208 s, (F \u2229 ball x (dynEntourage T U n)).Nonempty\nTactic: have smaller_cover : IsDynCoverOf T F U n (s.erase x) := by\nState 1: \u22a2 \nTactic: intro y y_F specialize h y_F\nState 2: \u22a2 \nTactic: simp only [s.mem_coe] at h\nState 3: \u22a2 \nTactic: simp only [s.coe_erase, mem_diff, s.mem_coe, mem_singleton_iff]\nState 4: \u22a2 \nTactic: obtain \u27e8z, z_s, hz\u27e9 := h\nState 5: \u22a2 \nTactic: refine \u27e8z, \u27e8z_s, fun z_x \u21a6 notMem_empty y ?_\u27e9, hz\u27e9\nState 6: \u22a2 \nTactic: rw [\u2190 ball_empt]\nState 7: \u22a2 \nTactic: rw [z_x] at hz\nState 8: \u22a2 \nTactic: exact mem_inter y_F <| (dynEntourage T U n).symm hz\nState 9: \u22a2 \nTactic: apply smaller_cover.coverMincard_le_card.not_gt\nState 10: \u22a2 \nTactic: rw [\u2190 h'] exact_mod_cast s.card_erase_lt_of_mem x_s /-! ### Cover entropy of entourages -/ open ENNReal EReal ExpGrowth Filter /-- The entropy of an entourage `U`, defined as the exponential rate of growth of the size of the smallest `(U, n)`-refined cover of `F`. Takes values in the space of extended real numbers `[-\u221e, +\u221e]`. This first version uses a `limsup`, and is chosen as the default definition. -/ noncomputable def coverEntropyEntourage (T : X \u2192 X) (F : Set X) (U : SetRel X X) := expGrowthSup fun n : \u2115 \u21a6 coverMincard T F U n /-- The entropy of an entourage `U`, defined as the exponential rate of growth of the size of the smallest `(U, n)`-refined cover of `F`. Takes values in the space of extended real numbers `[-\u221e, +\u221e]`. This second version uses a `liminf`, and is chosen as an alternative definition. -/ noncomputable def coverEntropyInfEntourage (T : X \u2192 X) (F : Set X) (U : SetRel X X) := expGrowthInf fun n : \u2115 \u21a6 coverMincard T F U n\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.TopologicalEntropy.CoverEntropy).[/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.Dynamics.TopologicalEntropy.CoverEntropy.nonempty_inter_of_coverMincard`:\nState 0: \u22a2 lemma nonempty_inter_of_coverMincard [U.IsSymm] {s : Finset X} (h : IsDynCoverOf T F U n s)\n (h' : #s = coverMincard T F U n) :\n \u2200 x \u2208 s, (F \u2229 ball x (dynEntourage T U n)).Nonempty\nTactic: have smaller_cover : IsDynCoverOf T F U n (s.erase x) := by\nState 1: \u22a2 \nTactic: intro y y_F specialize h y_F\nState 2: \u22a2 \nTactic: simp only [s.mem_coe] at h\nState 3: \u22a2 \nTactic: simp only [s.coe_erase, mem_diff, s.mem_coe, mem_singleton_iff]\nState 4: \u22a2 \nTactic: obtain \u27e8z, z_s, hz\u27e9 := h\nState 5: \u22a2 \nTactic: refine \u27e8z, \u27e8z_s, fun z_x \u21a6 notMem_empty y ?_\u27e9, hz\u27e9\nState 6: \u22a2 \nTactic: rw [\u2190 ball_empt]\nState 7: \u22a2 \nTactic: rw [z_x] at hz\nState 8: \u22a2 \nTactic: exact mem_inter y_F <| (dynEntourage T U n).symm hz\nState 9: \u22a2 \nTactic: apply smaller_cover.coverMincard_le_card.not_gt\nState 10: \u22a2 \nTactic: rw [\u2190 h'] exact_mod_cast s.card_erase_lt_of_mem x_s /-! ### Cover entropy of entourages -/ open ENNReal EReal ExpGrowth Filter /-- The entropy of an entourage `U`, defined as the exponential rate of growth of the size of the smallest `(U, n)`-refined cover of `F`. Takes values in the space of extended real numbers `[-\u221e, +\u221e]`. This first version uses a `limsup`, and is chosen as the default definition. -/ noncomputable def coverEntropyEntourage (T : X \u2192 X) (F : Set X) (U : SetRel X X) := expGrowthSup fun n : \u2115 \u21a6 coverMincard T F U n /-- The entropy of an entourage `U`, defined as the exponential rate of growth of the size of the smallest `(U, n)`-refined cover of `F`. Takes values in the space of extended real numbers `[-\u221e, +\u221e]`. This second version uses a `liminf`, and is chosen as an alternative definition. -/ noncomputable def coverEntropyInfEntourage (T : X \u2192 X) (F : Set X) (U : SetRel X X) := expGrowthInf fun n : \u2115 \u21a6 coverMincard T F U n\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.nonempty_inter_of_coverMincard", "source": {"declaration": "Mathlib.Dynamics.TopologicalEntropy.CoverEntropy.nonempty_inter_of_coverMincard", "file": "Mathlib/Dynamics/TopologicalEntropy/CoverEntropy.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Dynamics.TopologicalEntropy.CoverEntropy", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Dynamics/TopologicalEntropy/CoverEntropy.lean#L305", "span": "L305-L340"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "theorem ReflTransGen.lift {p : \u03b2 \u2192 \u03b2 \u2192 Prop} {a b : \u03b1} (f : \u03b1 \u2192 \u03b2)\n (h : \u2200 a b, r a b \u2192 p (f a) (f b)) (hab : ReflTransGen r a b) : ReflTransGen p (f a) (f b)\n:= thisIsWrongLemmaNameXYZ\nReflTransGen.trans_induction_on hab (fun _ \u21a6 refl) (ReflTransGen.single \u2218 h _ _) fun _ _ \u21a6 trans", "diagnostic": "[CompilationUnit(i_begin=0, i_end=306, 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 a\\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=2, column=16), pos_end=Position(line=2, column=21), severity=, kind=None), Message(data=\"Function expected at\\n ReflTransGen\\nbut this term has type\\n ?m.4\\n\\nNote: Expected a function because this term is being applied to the argument\\n r\\n\\nHint: The identifier `ReflTransGen` 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=46), pos_end=Position(line=2, column=64), severity=, kind=None), Message(data=\"Function expected at\\n ReflTransGen\\nbut this term has type\\n ?m.4\\n\\nNote: Expected a function because this term is being applied to the argument\\n p\\n\\nHint: The identifier `ReflTransGen` 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=68), pos_end=Position(line=2, column=94), 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)]", "mutation_kind": "rewrite_lemma_name_broken", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 2958, "declarations_count": 426, "diagnostics_count": 1, "duplicate_fingerprint": "97b06a2f7e55294b", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 811, "lean_code_chars": 286, "lean_code_ratio": 0.0967, "length_bucket": "short", "line_count": 15, "natural_language_chars": 2672, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Relation).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem ReflTransGen.lift {p : \u03b2 \u2192 \u03b2 \u2192 Prop} {a b : \u03b1} (f : \u03b1 \u2192 \u03b2)\n (h : \u2200 a b, r a b \u2192 p (f a) (f b)) (hab : ReflTransGen r a b) : ReflTransGen p (f a) (f b)\n:= thisIsWrongLemmaNameXYZ\nReflTransGen.trans_induction_on hab (fun _ \u21a6 refl) (ReflTransGen.single \u2218 h _ _) fun _ _ \u21a6 trans\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=306, 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 a\\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=2, column=16), pos_end=Position(line=2, column=21), severity=, kind=None), Message(data=\"Function expected at\\n ReflTransGen\\nbut this term has type\\n ?m.4\\n\\nNote: Expected a function because this term is being applied to the argument\\n r\\n\\nHint: The identifier `ReflTransGen` 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=46), pos_end=Position(line=2, column=64), severity=, kind=None), Message(data=\"Function expected at\\n ReflTransGen\\nbut this term has type\\n ?m.4\\n\\nNote: Expected a function because this term is being applied to the argument\\n p\\n\\nHint: The identifier `ReflTransGen` 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=68), pos_end=Position(line=2, column=94), 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.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Relation).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem ReflTransGen.lift {p : \u03b2 \u2192 \u03b2 \u2192 Prop} {a b : \u03b1} (f : \u03b1 \u2192 \u03b2)\n (h : \u2200 a b, r a b \u2192 p (f a) (f b)) (hab : ReflTransGen r a b) : ReflTransGen p (f a) (f b)\n:= thisIsWrongLemmaNameXYZ\nReflTransGen.trans_induction_on hab (fun _ \u21a6 refl) (ReflTransGen.single \u2218 h _ _) fun _ _ \u21a6 trans\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=306, 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 a\\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=2, column=16), pos_end=Position(line=2, column=21), severity=, kind=None), Message(data=\"Function expected at\\n ReflTransGen\\nbut this term has type\\n ?m.4\\n\\nNote: Expected a function because this term is being applied to the argument\\n r\\n\\nHint: The identifier `ReflTransGen` 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=46), pos_end=Position(line=2, column=64), severity=, kind=None), Message(data=\"Function expected at\\n ReflTransGen\\nbut this term has type\\n ?m.4\\n\\nNote: Expected a function because this term is being applied to the argument\\n p\\n\\nHint: The identifier `ReflTransGen` 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=68), pos_end=Position(line=2, column=94), 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]", "sample_id": "B-Mathlib.Logic.Relation.ReflTransGen", "source": {"declaration": "Mathlib.Logic.Relation.ReflTransGen", "file": "Mathlib/Logic/Relation.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Logic.Relation", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Logic/Relation.lean#L652", "span": "L652-L655"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"trace_states": [{"state": "theorem N\u2081\u0393\u2080_app (K : ChainComplex C \u2115) :\n N\u2081\u0393\u2080.app K = (\u0393\u2080.splitting K).toKaroubiNondegComplexIsoN\u2081.symm \u226a\u226b\n (toKaroubi _).mapIso (\u0393\u2080NondegComplexIso K)", "tactic": "ext"}, {"state": "", "tactic": "simp [N\u2081\u0393\u2080, \u0393\u2080'CompNondegComplexFunctor]"}], "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 889, "declarations_count": 102, "diagnostics_count": 0, "duplicate_fingerprint": "0772144a3cb97d22", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 297, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "tiny", "line_count": 13, "natural_language_chars": 889, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.DoldKan.GammaCompN).", "role": "system"}, {"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.AlgebraicTopology.DoldKan.GammaCompN.N\u2081\u0393\u2080_app`:\nState 0: \u22a2 theorem N\u2081\u0393\u2080_app (K : ChainComplex C \u2115) :\n N\u2081\u0393\u2080.app K = (\u0393\u2080.splitting K).toKaroubiNondegComplexIsoN\u2081.symm \u226a\u226b\n (toKaroubi _).mapIso (\u0393\u2080NondegComplexIso K)\nTactic: ext\nState 1: \u22a2 \nTactic: simp [N\u2081\u0393\u2080, \u0393\u2080'CompNondegComplexFunctor]\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.DoldKan.GammaCompN).[/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.AlgebraicTopology.DoldKan.GammaCompN.N\u2081\u0393\u2080_app`:\nState 0: \u22a2 theorem N\u2081\u0393\u2080_app (K : ChainComplex C \u2115) :\n N\u2081\u0393\u2080.app K = (\u0393\u2080.splitting K).toKaroubiNondegComplexIsoN\u2081.symm \u226a\u226b\n (toKaroubi _).mapIso (\u0393\u2080NondegComplexIso K)\nTactic: ext\nState 1: \u22a2 \nTactic: simp [N\u2081\u0393\u2080, \u0393\u2080'CompNondegComplexFunctor]\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.AlgebraicTopology.DoldKan.GammaCompN.N\u2081\u0393\u2080_app", "source": {"declaration": "Mathlib.AlgebraicTopology.DoldKan.GammaCompN.N\u2081\u0393\u2080_app", "file": "Mathlib/AlgebraicTopology/DoldKan/GammaCompN.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.DoldKan.GammaCompN", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/DoldKan/GammaCompN.lean#L81", "span": "L81-L86"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\ndef shift {n : \u2115} {\u0394 : SimplexCategory} (f : \u298bn\u298c \u27f6 \u0394) : \u298bn + 1\u298c \u27f6 \u0394 := SimplexCategory.Hom.mk\n { toFun := shiftFun f.toOrderHom\n monotone' := fun i\u2081 i\u2082 hi => by\n by_cases h\u2081 : i\u2081 = 0\n \u00b7 subst h\u2081\n simp only [shiftFun_zero, Fin.zero_le]\n \u00b7 have h\u2082 : i\u2082 \u2260 0 := by\n rintro rfl\n exact h\u2081 (le_antisymm hi (Fin.zero_le _))\n obtain \u27e8j\u2081, hj\u2081\u27e9 := Fin.eq_succ_of_ne_zero h\u2081\n obtain \u27e8j\u2082, hj\u2082\u27e9 := Fin.eq_succ_of_ne_zero h\u2082\n substs hj\u2081 hj\u2082\n simpa only [shiftFun_succ] using f.toOrderHom.monotone (Fin.succ_le_succ_iff.mp hi) }\n\nset_option backward.isDefEq.respectTransparency false in\nopen SSet.stdSimplex in\n/-- The obvious extra degeneracy on the standard simplex. -/\nprotected noncomputable def extraDegeneracy (\u0394 : SimplexCategory) :\n SimplicialObject.Augmented.ExtraDegeneracy (stdSimplex.obj \u0394) where\n s' _ := objMk (OrderHom.const _ 0)\n s _ f := objEquiv.symm (shift (objEquiv f))\n s'_comp_\u03b5 := by\n dsimp\n subsingleton\n s\u2080_comp_\u03b4\u2081 := by\n dsimp\n ext1 x\n apply objEquiv.injective\n ext j\n fin_cases j\n rfl\n s_comp_\u03b4\u2080 n := by\n ext1 \u03c6\n apply objEquiv.injective\n apply SimplexCategory.Hom.ext\n ext i : 2\n dsimp [SimplicialObject.\u03b4, SimplexCategory.\u03b4, SSet.stdSimplex,\n objEquiv, Equiv.ulift, uliftFunctor]\n s_comp_\u03b4 n i := by\n ext1 \u03c6\n apply objEquiv.injective\n apply SimplexCategory.Hom.ext\n ext j : 2\n dsimp [SimplicialObject.\u03b4, SimplexCategory.\u03b4, SSet.stdSimplex,\n objEquiv, Equiv.ulift, uliftFunctor]\n cases j using Fin.cases <;> simp\n s_comp_\u03c3 n i := by\n ext1 \u03c6\n apply objEquiv.injective\n apply SimplexCategory.Hom.ext\n ext j : 2\n dsimp [SimplicialObject.\u03c3, SimplexCategory.\u03c3, SSet.stdSimplex, objEquiv, Equiv.ulift,\n uliftFunctor, Function.comp_def]\n cases j using Fin.cases <;> simp\n```", "instruction": "Edit `shift` so it still compiles and the proof is simplified where possible. Return the full updated `shift` block.", "proof_is_oneliner": false, "target_span": "L170-L225", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 2584, "declarations_count": 248, "diagnostics_count": 0, "duplicate_fingerprint": "2e9987c04ce7ff36", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 909, "lean_code_chars": 1872, "lean_code_ratio": 0.7245, "length_bucket": "short", "line_count": 63, "natural_language_chars": 712, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.ExtraDegeneracy).", "role": "system"}, {"content": "You are editing a file in `Mathlib/AlgebraicTopology/ExtraDegeneracy.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.AlgebraicTopology.ExtraDegeneracy.shift`, L170-L225)\n```lean\ndef shift {n : \u2115} {\u0394 : SimplexCategory} (f : \u298bn\u298c \u27f6 \u0394) : \u298bn + 1\u298c \u27f6 \u0394 := SimplexCategory.Hom.mk\n { toFun := shiftFun f.toOrderHom\n monotone' := fun i\u2081 i\u2082 hi => by\n by_cases h\u2081 : i\u2081 = 0\n \u00b7 subst h\u2081\n simp only [shiftFun_zero, Fin.zero_le]\n \u00b7 have h\u2082 : i\u2082 \u2260 0 := by\n rintro rfl\n exact h\u2081 (le_antisymm hi (Fin.zero_le _))\n obtain \u27e8j\u2081, hj\u2081\u27e9 := Fin.eq_succ_of_ne_zero h\u2081\n obtain \u27e8j\u2082, hj\u2082\u27e9 := Fin.eq_succ_of_ne_zero h\u2082\n substs hj\u2081 hj\u2082\n simpa only [shiftFun_succ] using f.toOrderHom.monotone (Fin.succ_le_succ_iff.mp hi) }\n\nset_option backward.isDefEq.respectTransparency false in\nopen SSet.stdSimplex in\n/-- The obvious extra degeneracy on the standard simplex. -/\nprotected noncomputable def extraDegeneracy (\u0394 : SimplexCategory) :\n SimplicialObject.Augmented.ExtraDegeneracy (stdSimplex.obj \u0394) where\n s' _ := objMk (OrderHom.const _ 0)\n s _ f := objEquiv.symm (shift (objEquiv f))\n s'_comp_\u03b5 := by\n dsimp\n subsingleton\n s\u2080_comp_\u03b4\u2081 := by\n dsimp\n ext1 x\n apply objEquiv.injective\n ext j\n fin_cases j\n rfl\n s_comp_\u03b4\u2080 n := by\n ext1 \u03c6\n apply objEquiv.injective\n apply SimplexCategory.Hom.ext\n ext i : 2\n dsimp [SimplicialObject.\u03b4, SimplexCategory.\u03b4, SSet.stdSimplex,\n objEquiv, Equiv.ulift, uliftFunctor]\n s_comp_\u03b4 n i := by\n ext1 \u03c6\n apply objEquiv.injective\n apply SimplexCategory.Hom.ext\n ext j : 2\n dsimp [SimplicialObject.\u03b4, SimplexCategory.\u03b4, SSet.stdSimplex,\n objEquiv, Equiv.ulift, uliftFunctor]\n cases j using Fin.cases <;> simp\n s_comp_\u03c3 n i := by\n ext1 \u03c6\n apply objEquiv.injective\n apply SimplexCategory.Hom.ext\n ext j : 2\n dsimp [SimplicialObject.\u03c3, SimplexCategory.\u03c3, SSet.stdSimplex, objEquiv, Equiv.ulift,\n uliftFunctor, Function.comp_def]\n cases j using Fin.cases <;> simp\n```\n\n## Edit instruction\nEdit `shift` so it still compiles and the proof is simplified where possible. Return the full updated `shift` block.\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.ExtraDegeneracy).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/AlgebraicTopology/ExtraDegeneracy.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.AlgebraicTopology.ExtraDegeneracy.shift`, L170-L225)\n```lean\ndef shift {n : \u2115} {\u0394 : SimplexCategory} (f : \u298bn\u298c \u27f6 \u0394) : \u298bn + 1\u298c \u27f6 \u0394 := SimplexCategory.Hom.mk\n { toFun := shiftFun f.toOrderHom\n monotone' := fun i\u2081 i\u2082 hi => by\n by_cases h\u2081 : i\u2081 = 0\n \u00b7 subst h\u2081\n simp only [shiftFun_zero, Fin.zero_le]\n \u00b7 have h\u2082 : i\u2082 \u2260 0 := by\n rintro rfl\n exact h\u2081 (le_antisymm hi (Fin.zero_le _))\n obtain \u27e8j\u2081, hj\u2081\u27e9 := Fin.eq_succ_of_ne_zero h\u2081\n obtain \u27e8j\u2082, hj\u2082\u27e9 := Fin.eq_succ_of_ne_zero h\u2082\n substs hj\u2081 hj\u2082\n simpa only [shiftFun_succ] using f.toOrderHom.monotone (Fin.succ_le_succ_iff.mp hi) }\n\nset_option backward.isDefEq.respectTransparency false in\nopen SSet.stdSimplex in\n/-- The obvious extra degeneracy on the standard simplex. -/\nprotected noncomputable def extraDegeneracy (\u0394 : SimplexCategory) :\n SimplicialObject.Augmented.ExtraDegeneracy (stdSimplex.obj \u0394) where\n s' _ := objMk (OrderHom.const _ 0)\n s _ f := objEquiv.symm (shift (objEquiv f))\n s'_comp_\u03b5 := by\n dsimp\n subsingleton\n s\u2080_comp_\u03b4\u2081 := by\n dsimp\n ext1 x\n apply objEquiv.injective\n ext j\n fin_cases j\n rfl\n s_comp_\u03b4\u2080 n := by\n ext1 \u03c6\n apply objEquiv.injective\n apply SimplexCategory.Hom.ext\n ext i : 2\n dsimp [SimplicialObject.\u03b4, SimplexCategory.\u03b4, SSet.stdSimplex,\n objEquiv, Equiv.ulift, uliftFunctor]\n s_comp_\u03b4 n i := by\n ext1 \u03c6\n apply objEquiv.injective\n apply SimplexCategory.Hom.ext\n ext j : 2\n dsimp [SimplicialObject.\u03b4, SimplexCategory.\u03b4, SSet.stdSimplex,\n objEquiv, Equiv.ulift, uliftFunctor]\n cases j using Fin.cases <;> simp\n s_comp_\u03c3 n i := by\n ext1 \u03c6\n apply objEquiv.injective\n apply SimplexCategory.Hom.ext\n ext j : 2\n dsimp [SimplicialObject.\u03c3, SimplexCategory.\u03c3, SSet.stdSimplex, objEquiv, Equiv.ulift,\n uliftFunctor, Function.comp_def]\n cases j using Fin.cases <;> simp\n```\n\n## Edit instruction\nEdit `shift` so it still compiles and the proof is simplified where possible. Return the full updated `shift` block.\n[/INST]", "sample_id": "D-Mathlib.AlgebraicTopology.ExtraDegeneracy.shift", "source": {"declaration": "Mathlib.AlgebraicTopology.ExtraDegeneracy.shift", "file": "Mathlib/AlgebraicTopology/ExtraDegeneracy.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.ExtraDegeneracy", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/ExtraDegeneracy.lean#L170", "span": "L170-L225"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "F", "construction": {"instruction": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.", "statement": "lemma spineEquiv_f\u2082_arrow_one (x : X _\u298b2\u298c\u2082) :\n ((hY.spineEquiv 2) (f\u2082 f\u2080 f\u2081 h\u03b4\u2081 h\u03b4\u2080 hY x)).arrow 1 = f\u2081 (X.map (\u03b4\u2082 0).op x)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 704, "declarations_count": 66, "diagnostics_count": 0, "duplicate_fingerprint": "8fc5c19bda03a33a", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 239, "lean_code_chars": 127, "lean_code_ratio": 0.1804, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 577, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplicialSet.NerveAdjunction).", "role": "system"}, {"content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\nlemma spineEquiv_f\u2082_arrow_one (x : X _\u298b2\u298c\u2082) :\n ((hY.spineEquiv 2) (f\u2082 f\u2080 f\u2081 h\u03b4\u2081 h\u03b4\u2080 hY x)).arrow 1 = f\u2081 (X.map (\u03b4\u2082 0).op x)\n```\n\nDeclaration: `Mathlib.AlgebraicTopology.SimplicialSet.NerveAdjunction.spineEquiv_f\u2082_arrow_one` (module Mathlib.AlgebraicTopology.SimplicialSet.NerveAdjunction).", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplicialSet.NerveAdjunction).[/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 spineEquiv_f\u2082_arrow_one (x : X _\u298b2\u298c\u2082) :\n ((hY.spineEquiv 2) (f\u2082 f\u2080 f\u2081 h\u03b4\u2081 h\u03b4\u2080 hY x)).arrow 1 = f\u2081 (X.map (\u03b4\u2082 0).op x)\n```\n\nDeclaration: `Mathlib.AlgebraicTopology.SimplicialSet.NerveAdjunction.spineEquiv_f\u2082_arrow_one` (module Mathlib.AlgebraicTopology.SimplicialSet.NerveAdjunction).[/INST]", "sample_id": "F-Mathlib.AlgebraicTopology.SimplicialSet.NerveAdjunction.spineEquiv_f\u2082_arrow_one", "source": {"declaration": "Mathlib.AlgebraicTopology.SimplicialSet.NerveAdjunction.spineEquiv_f\u2082_arrow_one", "file": "Mathlib/AlgebraicTopology/SimplicialSet/NerveAdjunction.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.SimplicialSet.NerveAdjunction", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/SimplicialSet/NerveAdjunction.lean#L83", "span": "L83-L86"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"trace_states": [{"state": "theorem disjoint_stepSet_reverse {a : \u03b1} {S S' : Set \u03c3} :\n Disjoint S (M.reverse.stepSet S' a) \u2194 Disjoint S' (M.stepSet S a)", "tactic": "rw [\u2190 not_iff_not]"}, {"state": "", "tactic": "simp only [Set.not_disjoint_iff, mem_stepSet, reverse_step, Set.mem_setOf_eq] tauto"}], "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 907, "declarations_count": 105, "diagnostics_count": 0, "duplicate_fingerprint": "8aa7c30445e8bfaa", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 269, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "tiny", "line_count": 12, "natural_language_chars": 907, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.NFA).", "role": "system"}, {"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.Computability.NFA.disjoint_stepSet_reverse`:\nState 0: \u22a2 theorem disjoint_stepSet_reverse {a : \u03b1} {S S' : Set \u03c3} :\n Disjoint S (M.reverse.stepSet S' a) \u2194 Disjoint S' (M.stepSet S a)\nTactic: rw [\u2190 not_iff_not]\nState 1: \u22a2 \nTactic: simp only [Set.not_disjoint_iff, mem_stepSet, reverse_step, Set.mem_setOf_eq] tauto\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.NFA).[/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.Computability.NFA.disjoint_stepSet_reverse`:\nState 0: \u22a2 theorem disjoint_stepSet_reverse {a : \u03b1} {S S' : Set \u03c3} :\n Disjoint S (M.reverse.stepSet S' a) \u2194 Disjoint S' (M.stepSet S a)\nTactic: rw [\u2190 not_iff_not]\nState 1: \u22a2 \nTactic: simp only [Set.not_disjoint_iff, mem_stepSet, reverse_step, Set.mem_setOf_eq] tauto\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.Computability.NFA.disjoint_stepSet_reverse", "source": {"declaration": "Mathlib.Computability.NFA.disjoint_stepSet_reverse", "file": "Mathlib/Computability/NFA.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Computability.NFA", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Computability/NFA.lean#L385", "span": "L385-L390"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "F", "construction": {"instruction": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.", "statement": "theorem optionCongr_refl : optionCongr (Equiv.refl \u03b1) = Equiv.refl _", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 552, "declarations_count": 52, "diagnostics_count": 0, "duplicate_fingerprint": "95e027f5aaaf00be", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 163, "lean_code_chars": 69, "lean_code_ratio": 0.125, "length_bucket": "tiny", "line_count": 7, "natural_language_chars": 483, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Equiv.Option).", "role": "system"}, {"content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\ntheorem optionCongr_refl : optionCongr (Equiv.refl \u03b1) = Equiv.refl _\n```\n\nDeclaration: `Mathlib.Logic.Equiv.Option.optionCongr_refl` (module Mathlib.Logic.Equiv.Option).", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Equiv.Option).[/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 optionCongr_refl : optionCongr (Equiv.refl \u03b1) = Equiv.refl _\n```\n\nDeclaration: `Mathlib.Logic.Equiv.Option.optionCongr_refl` (module Mathlib.Logic.Equiv.Option).[/INST]", "sample_id": "F-Mathlib.Logic.Equiv.Option.optionCongr_refl", "source": {"declaration": "Mathlib.Logic.Equiv.Option.optionCongr_refl", "file": "Mathlib/Logic/Equiv/Option.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Logic.Equiv.Option", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Logic/Equiv/Option.lean#L45", "span": "L45-L47"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem exists_mem_target {p : \u03b2 \u2192 Prop} : (\u2203 y \u2208 e.target, p y) \u2194 \u2203 x \u2208 e.source, p (e x)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 499, "declarations_count": 59, "diagnostics_count": 0, "duplicate_fingerprint": "c5c58d6ecd96c2f0", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 151, "lean_code_chars": 91, "lean_code_ratio": 0.1824, "length_bucket": "tiny", "line_count": 7, "natural_language_chars": 408, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Equiv.PartialEquiv).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem exists_mem_target {p : \u03b2 \u2192 Prop} : (\u2203 y \u2208 e.target, p y) \u2194 \u2203 x \u2208 e.source, p (e x)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Equiv.PartialEquiv).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem exists_mem_target {p : \u03b2 \u2192 Prop} : (\u2203 y \u2208 e.target, p y) \u2194 \u2203 x \u2208 e.source, p (e x)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Logic.Equiv.PartialEquiv.exists_mem_target", "source": {"declaration": "Mathlib.Logic.Equiv.PartialEquiv.exists_mem_target", "file": "Mathlib/Logic/Equiv/PartialEquiv.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Logic.Equiv.PartialEquiv", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Logic/Equiv/PartialEquiv.lean#L300", "span": "L300-L309"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Computability.TuringMachine.StackTuringMachine.Stmt (L138-L151)\ninstance Stmt.inhabited : Inhabited (Stmt \u0393 \u039b \u03c3)", "-- Mathlib.Computability.TuringMachine.StackTuringMachine.Cfg (L152-L156)\ninstance Cfg.inhabited [Inhabited \u03c3] : Inhabited (Cfg \u0393 \u039b \u03c3)", "-- Mathlib.Computability.TuringMachine.StackTuringMachine.stepAux (L161-L170)\ndef stepAux : Stmt \u0393 \u039b \u03c3 \u2192 \u03c3 \u2192 (\u2200 k, List (\u0393 k)) \u2192 Cfg \u0393 \u039b \u03c3\n | push k f q, v, S => stepAux q v (update S k (f v :: S k))\n | peek k f q, v, S => stepAux q (f v (S k).head?) S\n | pop k f q, v, S => stepAux q (f v (S k).head?) (update S k (S k).tail)\n | load a q, v, S => stepAux q (a v) S\n | branch f q\u2081 q\u2082, v, S => cond (f v) (stepAux q\u2081 v S) (stepAux q\u2082 v S)\n | goto f, v, S => \u27e8some (f v), v, S\u27e9\n | halt, v, S => \u27e8none, v, S\u27e9\n\n/-- The step function for the TM2 model. -/", "-- Mathlib.Computability.TuringMachine.StackTuringMachine.step (L171-L174)\ndef step (M : \u039b \u2192 Stmt \u0393 \u039b \u03c3) : Cfg \u0393 \u039b \u03c3 \u2192 Option (Cfg \u0393 \u039b \u03c3)\n | \u27e8none, _, _\u27e9 => none\n | \u27e8some l, v, S\u27e9 => some (stepAux (M l) v S)", "-- Mathlib.Computability.TuringMachine.StackTuringMachine.Reaches (L179-L181)\ndef Reaches (M : \u039b \u2192 Stmt \u0393 \u039b \u03c3) : Cfg \u0393 \u039b \u03c3 \u2192 Cfg \u0393 \u039b \u03c3 \u2192 Prop", "-- Mathlib.Computability.TuringMachine.StackTuringMachine.stmts\u2081_self (L207-L209)\ntheorem stmts\u2081_self {q : Stmt \u0393 \u039b \u03c3} : q \u2208 stmts\u2081 q", "-- Mathlib.Computability.TuringMachine.StackTuringMachine.stmts\u2081_trans (L210-L229)\ntheorem stmts\u2081_trans {q\u2081 q\u2082 : Stmt \u0393 \u039b \u03c3} : q\u2081 \u2208 stmts\u2081 q\u2082 \u2192 stmts\u2081 q\u2081 \u2286 stmts\u2081 q\u2082", "-- Mathlib.Computability.TuringMachine.StackTuringMachine.stmts\u2081_supportsStmt_mono (L230-L244)\ntheorem stmts\u2081_supportsStmt_mono {S : Finset \u039b} {q\u2081 q\u2082 : Stmt \u0393 \u039b \u03c3} (h : q\u2081 \u2208 stmts\u2081 q\u2082)\n (hs : SupportsStmt S q\u2082) : SupportsStmt S q\u2081", "-- Mathlib.Computability.TuringMachine.Computable.inhabited\u03c3 (L83-L86)\ninstance inhabited\u03c3 : Inhabited tm.\u03c3", "-- Mathlib.Computability.TuringMachine.Computable.decidableEqK (L80-L82)\ninstance decidableEqK : DecidableEq tm.K", "-- Mathlib.Computability.TuringMachine.Computable.Cfg (L94-L96)\ndef Cfg : Type", "-- Mathlib.Computability.TuringMachine.Computable.inhabitedStmt (L90-L93)\ninstance inhabitedStmt : Inhabited (Stmt tm)", "-- Mathlib.Computability.TuringMachine.Computable.Stmt (L87-L89)\ndef Stmt : Type", "-- Mathlib.Computability.TuringMachine.Computable.inhabitedCfg (L97-L100)\ninstance inhabitedCfg : Inhabited (Cfg tm)"], "statement": "def SupportsStmt (S : Finset \u039b) : Stmt \u0393 \u039b \u03c3 \u2192 Prop\n | push _ _ q => SupportsStmt S q\n | peek _ _ q => SupportsStmt S q\n | pop _ _ q => SupportsStmt S q\n | load _ q => SupportsStmt S q\n | branch _ q\u2081 q\u2082 => SupportsStmt S q\u2081 \u2227 SupportsStmt S q\u2082\n | goto l => \u2200 v, l v \u2208 S\n | halt => True", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 3435, "declarations_count": 377, "diagnostics_count": 0, "duplicate_fingerprint": "c1a87cde7c117c05", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1290, "lean_code_chars": 2614, "lean_code_ratio": 0.761, "length_bucket": "short", "line_count": 110, "natural_language_chars": 821, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 14, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.TuringMachine.StackTuringMachine).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef SupportsStmt (S : Finset \u039b) : Stmt \u0393 \u039b \u03c3 \u2192 Prop\n | push _ _ q => SupportsStmt S q\n | peek _ _ q => SupportsStmt S q\n | pop _ _ q => SupportsStmt S q\n | load _ q => SupportsStmt S q\n | branch _ q\u2081 q\u2082 => SupportsStmt S q\u2081 \u2227 SupportsStmt S q\u2082\n | goto l => \u2200 v, l v \u2208 S\n | halt => True\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Computability.TuringMachine.StackTuringMachine.Stmt (L138-L151)\ninstance Stmt.inhabited : Inhabited (Stmt \u0393 \u039b \u03c3)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Computability.TuringMachine.StackTuringMachine.Cfg (L152-L156)\ninstance Cfg.inhabited [Inhabited \u03c3] : Inhabited (Cfg \u0393 \u039b \u03c3)\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Computability.TuringMachine.StackTuringMachine.stepAux (L161-L170)\ndef stepAux : Stmt \u0393 \u039b \u03c3 \u2192 \u03c3 \u2192 (\u2200 k, List (\u0393 k)) \u2192 Cfg \u0393 \u039b \u03c3\n | push k f q, v, S => stepAux q v (update S k (f v :: S k))\n | peek k f q, v, S => stepAux q (f v (S k).head?) S\n | pop k f q, v, S => stepAux q (f v (S k).head?) (update S k (S k).tail)\n | load a q, v, S => stepAux q (a v) S\n | branch f q\u2081 q\u2082, v, S => cond (f v) (stepAux q\u2081 v S) (stepAux q\u2082 v S)\n | goto f, v, S => \u27e8some (f v), v, S\u27e9\n | halt, v, S => \u27e8none, v, S\u27e9\n\n/-- The step function for the TM2 model. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Computability.TuringMachine.StackTuringMachine.step (L171-L174)\ndef step (M : \u039b \u2192 Stmt \u0393 \u039b \u03c3) : Cfg \u0393 \u039b \u03c3 \u2192 Option (Cfg \u0393 \u039b \u03c3)\n | \u27e8none, _, _\u27e9 => none\n | \u27e8some l, v, S\u27e9 => some (stepAux (M l) v S)\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Computability.TuringMachine.StackTuringMachine.Reaches (L179-L181)\ndef Reaches (M : \u039b \u2192 Stmt \u0393 \u039b \u03c3) : Cfg \u0393 \u039b \u03c3 \u2192 Cfg \u0393 \u039b \u03c3 \u2192 Prop\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Computability.TuringMachine.StackTuringMachine.stmts\u2081_self (L207-L209)\ntheorem stmts\u2081_self {q : Stmt \u0393 \u039b \u03c3} : q \u2208 stmts\u2081 q\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Computability.TuringMachine.StackTuringMachine.stmts\u2081_trans (L210-L229)\ntheorem stmts\u2081_trans {q\u2081 q\u2082 : Stmt \u0393 \u039b \u03c3} : q\u2081 \u2208 stmts\u2081 q\u2082 \u2192 stmts\u2081 q\u2081 \u2286 stmts\u2081 q\u2082\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Computability.TuringMachine.StackTuringMachine.stmts\u2081_supportsStmt_mono (L230-L244)\ntheorem stmts\u2081_supportsStmt_mono {S : Finset \u039b} {q\u2081 q\u2082 : Stmt \u0393 \u039b \u03c3} (h : q\u2081 \u2208 stmts\u2081 q\u2082)\n (hs : SupportsStmt S q\u2082) : SupportsStmt S q\u2081\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Computability.TuringMachine.Computable.inhabited\u03c3 (L83-L86)\ninstance inhabited\u03c3 : Inhabited tm.\u03c3\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Computability.TuringMachine.Computable.decidableEqK (L80-L82)\ninstance decidableEqK : DecidableEq tm.K\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Computability.TuringMachine.Computable.Cfg (L94-L96)\ndef Cfg : Type\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Computability.TuringMachine.Computable.inhabitedStmt (L90-L93)\ninstance inhabitedStmt : Inhabited (Stmt tm)\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Computability.TuringMachine.Computable.Stmt (L87-L89)\ndef Stmt : Type\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Computability.TuringMachine.Computable.inhabitedCfg (L97-L100)\ninstance inhabitedCfg : Inhabited (Cfg tm)\n```\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.TuringMachine.StackTuringMachine).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef SupportsStmt (S : Finset \u039b) : Stmt \u0393 \u039b \u03c3 \u2192 Prop\n | push _ _ q => SupportsStmt S q\n | peek _ _ q => SupportsStmt S q\n | pop _ _ q => SupportsStmt S q\n | load _ q => SupportsStmt S q\n | branch _ q\u2081 q\u2082 => SupportsStmt S q\u2081 \u2227 SupportsStmt S q\u2082\n | goto l => \u2200 v, l v \u2208 S\n | halt => True\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Computability.TuringMachine.StackTuringMachine.Stmt (L138-L151)\ninstance Stmt.inhabited : Inhabited (Stmt \u0393 \u039b \u03c3)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Computability.TuringMachine.StackTuringMachine.Cfg (L152-L156)\ninstance Cfg.inhabited [Inhabited \u03c3] : Inhabited (Cfg \u0393 \u039b \u03c3)\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Computability.TuringMachine.StackTuringMachine.stepAux (L161-L170)\ndef stepAux : Stmt \u0393 \u039b \u03c3 \u2192 \u03c3 \u2192 (\u2200 k, List (\u0393 k)) \u2192 Cfg \u0393 \u039b \u03c3\n | push k f q, v, S => stepAux q v (update S k (f v :: S k))\n | peek k f q, v, S => stepAux q (f v (S k).head?) S\n | pop k f q, v, S => stepAux q (f v (S k).head?) (update S k (S k).tail)\n | load a q, v, S => stepAux q (a v) S\n | branch f q\u2081 q\u2082, v, S => cond (f v) (stepAux q\u2081 v S) (stepAux q\u2082 v S)\n | goto f, v, S => \u27e8some (f v), v, S\u27e9\n | halt, v, S => \u27e8none, v, S\u27e9\n\n/-- The step function for the TM2 model. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Computability.TuringMachine.StackTuringMachine.step (L171-L174)\ndef step (M : \u039b \u2192 Stmt \u0393 \u039b \u03c3) : Cfg \u0393 \u039b \u03c3 \u2192 Option (Cfg \u0393 \u039b \u03c3)\n | \u27e8none, _, _\u27e9 => none\n | \u27e8some l, v, S\u27e9 => some (stepAux (M l) v S)\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Computability.TuringMachine.StackTuringMachine.Reaches (L179-L181)\ndef Reaches (M : \u039b \u2192 Stmt \u0393 \u039b \u03c3) : Cfg \u0393 \u039b \u03c3 \u2192 Cfg \u0393 \u039b \u03c3 \u2192 Prop\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Computability.TuringMachine.StackTuringMachine.stmts\u2081_self (L207-L209)\ntheorem stmts\u2081_self {q : Stmt \u0393 \u039b \u03c3} : q \u2208 stmts\u2081 q\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Computability.TuringMachine.StackTuringMachine.stmts\u2081_trans (L210-L229)\ntheorem stmts\u2081_trans {q\u2081 q\u2082 : Stmt \u0393 \u039b \u03c3} : q\u2081 \u2208 stmts\u2081 q\u2082 \u2192 stmts\u2081 q\u2081 \u2286 stmts\u2081 q\u2082\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Computability.TuringMachine.StackTuringMachine.stmts\u2081_supportsStmt_mono (L230-L244)\ntheorem stmts\u2081_supportsStmt_mono {S : Finset \u039b} {q\u2081 q\u2082 : Stmt \u0393 \u039b \u03c3} (h : q\u2081 \u2208 stmts\u2081 q\u2082)\n (hs : SupportsStmt S q\u2082) : SupportsStmt S q\u2081\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Computability.TuringMachine.Computable.inhabited\u03c3 (L83-L86)\ninstance inhabited\u03c3 : Inhabited tm.\u03c3\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Computability.TuringMachine.Computable.decidableEqK (L80-L82)\ninstance decidableEqK : DecidableEq tm.K\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Computability.TuringMachine.Computable.Cfg (L94-L96)\ndef Cfg : Type\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Computability.TuringMachine.Computable.inhabitedStmt (L90-L93)\ninstance inhabitedStmt : Inhabited (Stmt tm)\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Computability.TuringMachine.Computable.Stmt (L87-L89)\ndef Stmt : Type\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Computability.TuringMachine.Computable.inhabitedCfg (L97-L100)\ninstance inhabitedCfg : Inhabited (Cfg tm)\n```\n[/INST]", "sample_id": "C-Mathlib.Computability.TuringMachine.StackTuringMachine.SupportsStmt", "source": {"declaration": "Mathlib.Computability.TuringMachine.StackTuringMachine.SupportsStmt", "file": "Mathlib/Computability/TuringMachine/StackTuringMachine.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Computability.TuringMachine.StackTuringMachine", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Computability/TuringMachine/StackTuringMachine.lean#L185", "span": "L185-L193"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.congr_toOrderHom_apply (L42-L45)\nlemma congr_toOrderHom_apply {a b : SimplexCategory} {f g : a \u27f6 b} (h : f = g)\n (x : Fin (a.len + 1)) : f.toOrderHom x = g.toOrderHom x := by rw [h]\n/-- The constant morphism from \u298b0\u298c. -/", "-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const (L46-L48)\ndef const (x y : SimplexCategory) (i : Fin (y.len + 1)) : x \u27f6 y :=\nHom.mk <| \u27e8fun _ => i, by tauto\u27e9", "-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const_eq_id (L50-L51)\nlemma const_eq_id : const \u298b0\u298c \u298b0\u298c 0 = \ud835\udfd9 _ := by aesop", "-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const_apply (L53-L55)\nlemma const_apply (x y : SimplexCategory) (i : Fin (y.len + 1)) (a : Fin (x.len + 1)) :\n (const x y i).toOrderHom a = i := rfl", "-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const_comp (L57-L61)\ntheorem const_comp (x : SimplexCategory) {y z : SimplexCategory}\n (f : y \u27f6 z) (i : Fin (y.len + 1)) :\n const x y i \u226b f = const x z (f.toOrderHom i) :=\nrfl", "-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const_fac_thru_zero (L62-L65)\ntheorem const_fac_thru_zero (n m : SimplexCategory) (i : Fin (m.len + 1)) :\n const n m i = const n \u298b0\u298c 0 \u226b SimplexCategory.const \u298b0\u298c m i := by\nrw [const_comp]; rfl", "-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.Hom (L66-L69)\ntheorem Hom.ext_zero_left {n : SimplexCategory} (f g : \u298b0\u298c \u27f6 n)\n (h0 : f.toOrderHom 0 = g.toOrderHom 0 := by rfl) : f = g := by\next i; match i with | 0 => exact h0 \u25b8 rfl", "-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.eq_const_of_zero (L70-L73)\ntheorem eq_const_of_zero {n : SimplexCategory} (f : \u298b0\u298c \u27f6 n) :\n f = const _ n (f.toOrderHom 0) := by\next x; match x with | 0 => rfl", "-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.exists_eq_const_of_zero (L74-L76)\ntheorem exists_eq_const_of_zero {n : SimplexCategory} (f : \u298b0\u298c \u27f6 n) :\n \u2203 a, f = const _ n a := \u27e8_, eq_const_of_zero _\u27e9", "-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.eq_const_to_zero (L77-L81)\ntheorem eq_const_to_zero {n : SimplexCategory} (f : n \u27f6 \u298b0\u298c) :\n f = const n _ 0 := by\next : 3\n apply @Subsingleton.elim (Fin 1)", "-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.Hom (L82-L90)\ntheorem Hom.ext_one_left {n : SimplexCategory} (f g : \u298b1\u298c \u27f6 n)\n (h0 : f.toOrderHom 0 = g.toOrderHom 0 := by rfl)\n(h1 : f.toOrderHom 1 = g.toOrderHom 1 := by rfl) : f = g := by\n ext i\n match i with\n | 0 => exact h0 \u25b8 rfl\n | 1 => exact h1 \u25b8 rfl\n\nset_option backward.isDefEq.respectTransparency false in", "-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.eq_of_one_to_one (L91-L114)\ntheorem eq_of_one_to_one (f : \u298b1\u298c \u27f6 \u298b1\u298c) :\n (\u2203 a, f = const \u298b1\u298c _ a) \u2228 f = \ud835\udfd9 _ := by\nmatch e0 : f.toOrderHom 0, e1 : f.toOrderHom 1 with\n | 0, 0 | 1, 1 =>\n refine .inl \u27e8f.toOrderHom 0, ?_\u27e9\n ext i : 3\n match i with\n | 0 => rfl\n | 1 => exact e1.trans e0.symm\n | 0, 1 =>\n right\n ext i : 3\n match i with\n | 0 => exact e0\n | 1 => exact e1\n | 1, 0 =>\n have := f.toOrderHom.monotone (by decide : (0 : Fin 2) \u2264 1)\n rw [e0, e1] at this\n exact Not.elim (by decide) this\n\n/-- Make a morphism `\u298bn\u298c \u27f6 \u298bm\u298c` from a monotone map between fin's.\nThis is useful for constructing morphisms between `\u298bn\u298c` directly\nwithout identifying `n` with `\u298bn\u298c.len`.\n-/", "-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.mkHom (L116-L119)\ndef mkHom {n m : \u2115} (f : Fin (n + 1) \u2192o Fin (m + 1)) : \u298bn\u298c \u27f6 \u298bm\u298c :=\nSimplexCategory.Hom.mk f\n\n/-- The morphism `\u298b1\u298c \u27f6 \u298bn\u298c` that picks out a specified `h : i \u2264 j` in `Fin (n+1)`. -/", "-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.mkOfLe (L120-L127)\ndef mkOfLe {n} (i j : Fin (n + 1)) (h : i \u2264 j) : \u298b1\u298c \u27f6 \u298bn\u298c :=\nSimplexCategory.mkHom {\n toFun := fun | 0 => i | 1 => j\n monotone' := fun\n | 0, 0, _ | 1, 1, _ => le_rfl\n | 0, 1, _ => h\n }", "-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.mkOfLe_refl (L129-L132)\nlemma mkOfLe_refl {n} (j : Fin (n + 1)) :\n mkOfLe j j (by lia) = \u298b1\u298c.const \u298bn\u298c j := Hom.ext_one_left _ _\n/-- The morphism `\u298b1\u298c \u27f6 \u298bn\u298c` that picks out the \"diagonal composite\" edge -/", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.inclusion (L42-L43)\ndef inclusion : SimplexCategory \u2964 AugmentedSimplexCategory := WithInitial.incl", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.id_tensorHom (L136-L139)\nlemma id_tensorHom (x : AugmentedSimplexCategory) {y\u2081 y\u2082 : AugmentedSimplexCategory}\n (f : y\u2081 \u27f6 y\u2082) : \ud835\udfd9 x \u2297\u2098 f = x \u25c1 f :=\nrfl", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.tensorHom (L79-L93)\ndef tensorHom {x\u2081 y\u2081 x\u2082 y\u2082 : AugmentedSimplexCategory} (f\u2081 : x\u2081 \u27f6 y\u2081) (f\u2082 : x\u2082 \u27f6 y\u2082) :\n tensorObj x\u2081 x\u2082 \u27f6 tensorObj y\u2081 y\u2082 :=\nmatch x\u2081, y\u2081, x\u2082, y\u2082, f\u2081, f\u2082 with\n | .of _, .of _, .of _, .of _, f\u2081, f\u2082 => tensorHomOf f\u2081 f\u2082\n | .of _, .of y\u2081, .star, .of y\u2082, f\u2081, _ =>\n f\u2081 \u226b ((SimplexCategory.mkHom <| (Fin.castAddOrderEmb (y\u2082.len + 1)).toOrderHom) \u226b\n eqToHom (congrArg _ (Nat.succ_add _ _)) : \u298by\u2081.len\u298c \u27f6 \u298by\u2081.len + y\u2082.len + 1\u298c)\n | .star, .of y\u2081, .of _, .of y\u2082, _, f\u2082 =>\n f\u2082 \u226b ((SimplexCategory.mkHom <| (Fin.natAddOrderEmb (y\u2081.len + 1)).toOrderHom) \u226b\n eqToHom (congrArg _ (Nat.succ_add _ _)) : \u298by\u2082.len\u298c \u27f6 \u298by\u2081.len + y\u2082.len + 1\u298c)\n | .star, .star, .of _, .of _, _, f\u2082 => f\u2082\n | .of _, .of _, .star, .star, f\u2081, _ => f\u2081\n | .star, _, .star, _, _, _ => WithInitial.starInitial.to _\n\n/-- The unit for the monoidal structure on `AugmentedSimplexCategory` is the initial object. -/", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.inl (L157-L161)\ndef inl (x y : AugmentedSimplexCategory) : x \u27f6 x \u2297 y :=\n(\u03c1_ x).inv \u226b _ \u25c1 (WithInitial.starInitial.to y)\n\n/-- Thanks to `tensorUnit` being initial in `AugmentedSimplexCategory`, we get\na morphism `\u0394' \u27f6 \u0394 \u2297 \u0394'` for every pair of objects `\u0394, \u0394'`. -/", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedSimplicialObject (L87-L93)\ndef equivAugmentedSimplicialObject :\n (AugmentedSimplexCategory\u1d52\u1d56 \u2964 C) \u224c SimplicialObject.Augmented C :=\nWithInitial.opEquiv SimplexCategory |>.congrLeft |>.trans WithTerminal.equivComma\n\n/-- Through the equivalence `(AugmentedSimplexCategory\u1d52\u1d56 \u2964 C) \u224c SimplicialObject.Augmented C`,\ndropping the augmentation corresponds to precomposition with\n`inclusion\u1d52\u1d56 : SimplexCategory\u1d52\u1d56 \u2964 AugmentedSimplexCategory\u1d52\u1d56`. -/", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObject (L53-L59)\ndef equivAugmentedCosimplicialObject :\n (AugmentedSimplexCategory \u2964 C) \u224c CosimplicialObject.Augmented C :=\nWithInitial.equivComma\n\n/-- Through the equivalence `(AugmentedSimplexCategory \u2964 C) \u224c CosimplicialObject.Augmented C`,\ndropping the augmentation corresponds to precomposition with\n`inclusion : SimplexCategory \u2964 AugmentedSimplexCategory`. -/", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.associator (L97-L111)\ndef associator (x y z : AugmentedSimplexCategory) :\n tensorObj (tensorObj x y) z \u2245 tensorObj x (tensorObj y z) :=\nmatch x, y, z with\n | .of x, .of y, .of z =>\n eqToIso (congrArg (fun j \u21a6 WithInitial.of <| SimplexCategory.mk j)\n (by simp +arith))\n | .star, .star, .star => Iso.refl _\n | .star, .of _, .star => Iso.refl _\n | .star, .star, .of _ => Iso.refl _\n | .star, .of _, .of _ => Iso.refl _\n | .of _, .star, .star => Iso.refl _\n | .of _, .star, .of _ => Iso.refl _\n | .of _, .of _, .star => Iso.refl _\n\n/-- The left unitor isomorphism for the monoidal structure in `AugmentedSimplexCategory` -/", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.leftUnitor (L112-L118)\ndef leftUnitor (x : AugmentedSimplexCategory) :\n tensorObj tensorUnit x \u2245 x :=\nmatch x with\n | .of _ => Iso.refl _\n | .star => Iso.refl _\n\n/-- The right unitor isomorphism for the monoidal structure in `AugmentedSimplexCategory` -/", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedSimplicialObjectFunctorCompDropIso (L95-L101)\ndef equivAugmentedSimplicialObjectFunctorCompDropIso :\n equivAugmentedSimplicialObject.functor \u22d9 SimplicialObject.Augmented.drop \u2245\n (Functor.whiskeringLeft _ _ C).obj inclusion.op :=\n.refl _\n\n/-- Through the equivalence `(AugmentedSimplexCategory \u2964 C) \u224c CosimplicialObject.Augmented C`,\ntaking the point of the augmentation corresponds to evaluation at the initial object. -/", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.rightUnitor (L119-L124)\ndef rightUnitor (x : AugmentedSimplexCategory) :\n tensorObj x tensorUnit \u2245 x :=\nmatch x with\n | .of _ => Iso.refl _\n | .star => Iso.refl _", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedSimplicialObjectFunctorCompToArrowIso (L112-L118)\ndef equivAugmentedSimplicialObjectFunctorCompToArrowIso :\n equivAugmentedSimplicialObject.functor \u22d9 SimplicialObject.Augmented.toArrow \u2245\n Functor.mapArrowFunctor _ C \u22d9\n (evaluation _ _ |>.obj <| .mk <| .op <| WithInitial.homTo <| .mk 0) :=\n.refl _\n\nend AugmentedSimplexCategory", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObjectFunctorCompDropIso (L61-L67)\ndef equivAugmentedCosimplicialObjectFunctorCompDropIso :\n equivAugmentedCosimplicialObject.functor \u22d9 CosimplicialObject.Augmented.drop \u2245\n (Functor.whiskeringLeft _ _ C).obj inclusion :=\n.refl _\n\n/-- Through the equivalence `(AugmentedSimplexCategory \u2964 C) \u224c CosimplicialObject.Augmented C`,\ntaking the point of the augmentation corresponds to evaluation at the initial object. -/", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObjectFunctorCompToArrowIso (L78-L85)\ndef equivAugmentedCosimplicialObjectFunctorCompToArrowIso :\n equivAugmentedCosimplicialObject.functor \u22d9 CosimplicialObject.Augmented.toArrow \u2245\n Functor.mapArrowFunctor _ C \u22d9\n (evaluation _ _ |>.obj <| .mk <| WithInitial.homTo <| .mk 0) :=\n.refl _\n\n/-- The equivalence between functors out of `AugmentedSimplexCategory` and augmented simplicial\nobjects. -/", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObjectFunctorCompPointIso (L69-L76)\ndef equivAugmentedCosimplicialObjectFunctorCompPointIso :\n equivAugmentedCosimplicialObject.functor \u22d9 CosimplicialObject.Augmented.point \u2245\n ((evaluation _ _).obj .star : (AugmentedSimplexCategory \u2964 C) \u2964 C) :=\n.refl _\n\n/-- Through the equivalence `(AugmentedSimplexCategory \u2964 C) \u224c CosimplicialObject.Augmented C`,\nthe arrow attached to the cosimplicial object is the one obtained by evaluation at the unique arrow\n`star \u27f6 of [0]`. -/", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.AugmentedSimplexCategory (L34-L40)\nabbrev AugmentedSimplexCategory := WithInitial SimplexCategory\nnamespace AugmentedSimplexCategory\n\nvariable {C : Type*} [Category* C]\n\n/-- The canonical inclusion from `SimplexCategory` to `AugmentedSimplexCategory`. -/", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedSimplicialObjectFunctorCompPointIso (L103-L110)\ndef equivAugmentedSimplicialObjectFunctorCompPointIso :\n equivAugmentedSimplicialObject.functor \u22d9 SimplicialObject.Augmented.point \u2245\n (evaluation _ C).obj (.op .star) :=\n.refl _\n\n/-- Through the equivalence `(AugmentedSimplexCategory \u2964 C) \u224c CosimplicialObject.Augmented C`,\nthe arrow attached to the cosimplicial object is the one obtained by evaluation at the unique arrow\n`star \u27f6 of [0]`. -/", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.id_star_whiskerRight (L151-L156)\nlemma id_star_whiskerRight {x : AugmentedSimplexCategory} : \ud835\udfd9 WithInitial.star \u25b7 x = \ud835\udfd9 _ := by\ncases x <;>\n rfl\n\n/-- Thanks to `tensorUnit` being initial in `AugmentedSimplexCategory`, we get\na morphism `\u0394 \u27f6 \u0394 \u2297 \u0394'` for every pair of objects `\u0394, \u0394'`. -/", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.tensorUnit (L94-L96)\nabbrev tensorUnit : AugmentedSimplexCategory := WithInitial.star\n/-- The associator isomorphism for the monoidal structure on `AugmentedSimplexCategory` -/", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.eqToHom_toOrderHom (L40-L49)\nlemma eqToHom_toOrderHom {x y : SimplexCategory} (h : WithInitial.of x = WithInitial.of y) :\n SimplexCategory.Hom.toOrderHom (WithInitial.down <| eqToHom h) =\n (Fin.castOrderIso\n (congrArg (fun t \u21a6 t + 1) (by injection h with h; rw [h]))).toOrderEmbedding.toOrderHom :=\nSimplexCategory.eqToHom_toOrderHom (by injection h)\n\n/-- An auxiliary definition for the tensor product of two objects in `AugmentedSimplexCategory`. -/\n-- (Impl. note): This definition could easily be inlined in\n-- the definition of `tensorObjOf` below, but having it type check directly as an element\n-- of `SimplexCategory` avoids having to sprinkle `WithInitial.down` everywhere.", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.tensorHom_id (L141-L144)\nlemma tensorHom_id {x\u2081 x\u2082 : AugmentedSimplexCategory} (y : AugmentedSimplexCategory)\n (f : x\u2081 \u27f6 x\u2082) : f \u2297\u2098 \ud835\udfd9 y = f \u25b7 y :=\nrfl", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.inr (L162-L166)\ndef inr (x y : AugmentedSimplexCategory) : y \u27f6 x \u2297 y :=\n(\u03bb_ y).inv \u226b (WithInitial.starInitial.to x) \u25b7 _\n\n/-- To ease type checking, we also provide a version of inl that lives in\n`SimplexCategory`. -/", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.whiskerLeft_id_star (L146-L149)\nlemma whiskerLeft_id_star {x : AugmentedSimplexCategory} : x \u25c1 \ud835\udfd9 .star = \ud835\udfd9 _ := by\ncases x <;>\n rfl", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.tensorObjOf (L50-L52)\nabbrev tensorObjOf (m n : SimplexCategory) : SimplexCategory := .mk (m.len + n.len + 1)\n/-- The tensor product of two objects of `AugmentedSimplexCategory`. -/", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.tensorHomOf (L60-L78)\ndef tensorHomOf {x\u2081 y\u2081 x\u2082 y\u2082 : SimplexCategory} (f\u2081 : x\u2081 \u27f6 y\u2081) (f\u2082 : x\u2082 \u27f6 y\u2082) :\n tensorObjOf x\u2081 x\u2082 \u27f6 tensorObjOf y\u2081 y\u2082 :=\nletI f\u2081 : Fin ((x\u2081.len + 1) + (x\u2082.len + 1)) \u2192o Fin ((y\u2081.len + 1) + (y\u2082.len + 1)) :=\n { toFun i :=\n Fin.addCases\n (motive := fun _ \u21a6 Fin <| (y\u2081.len + 1) + (y\u2082.len + 1))\n (fun i \u21a6 (f\u2081.toOrderHom i).castAdd _)\n (fun i \u21a6 (f\u2082.toOrderHom i).natAdd _)\n i\n monotone' i j h := by\n cases i using Fin.addCases <;>\n cases j using Fin.addCases <;>\n rw [Fin.le_def] at h \u22a2 <;>\n simp at h \u22a2 <;>\n grind only [OrderHom.apply_mono] }\n (eqToHom (congrArg _ (Nat.succ_add _ _)).symm \u226b (SimplexCategory.mkHom f\u2081) \u226b\n eqToHom (congrArg _ (Nat.succ_add _ _)) : _ \u27f6 \u298by\u2081.len + y\u2082.len + 1\u298c)\n\n/-- The action of the tensor product on maps of `AugmentedSimplexCategory`. -/", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.tensorObj (L53-L59)\ndef tensorObj (m n : AugmentedSimplexCategory) : AugmentedSimplexCategory :=\nmatch m, n with\n | .of m, .of n => .of <| tensorObjOf m n\n | .star, x => x\n | x, .star => x\n\n/-- The action of the tensor product on maps coming from `SimplexCategory`. -/"], "statement": "def intervalEdge {n} (j l : \u2115) (hjl : j + l \u2264 n) : \u298b1\u298c \u27f6 \u298bn\u298c", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 16415, "declarations_count": 1543, "diagnostics_count": 0, "duplicate_fingerprint": "36541449f0f49be0", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 6156, "lean_code_chars": 14899, "lean_code_ratio": 0.9076, "length_bucket": "medium", "line_count": 454, "natural_language_chars": 1516, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 40, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplexCategory.Basic).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef intervalEdge {n} (j l : \u2115) (hjl : j + l \u2264 n) : \u298b1\u298c \u27f6 \u298bn\u298c\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.congr_toOrderHom_apply (L42-L45)\nlemma congr_toOrderHom_apply {a b : SimplexCategory} {f g : a \u27f6 b} (h : f = g)\n (x : Fin (a.len + 1)) : f.toOrderHom x = g.toOrderHom x := by rw [h]\n/-- The constant morphism from \u298b0\u298c. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const (L46-L48)\ndef const (x y : SimplexCategory) (i : Fin (y.len + 1)) : x \u27f6 y :=\nHom.mk <| \u27e8fun _ => i, by tauto\u27e9\n```\n\n-- snippet 3\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const_eq_id (L50-L51)\nlemma const_eq_id : const \u298b0\u298c \u298b0\u298c 0 = \ud835\udfd9 _ := by aesop\n```\n\n-- snippet 4\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const_apply (L53-L55)\nlemma const_apply (x y : SimplexCategory) (i : Fin (y.len + 1)) (a : Fin (x.len + 1)) :\n (const x y i).toOrderHom a = i := rfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const_comp (L57-L61)\ntheorem const_comp (x : SimplexCategory) {y z : SimplexCategory}\n (f : y \u27f6 z) (i : Fin (y.len + 1)) :\n const x y i \u226b f = const x z (f.toOrderHom i) :=\nrfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const_fac_thru_zero (L62-L65)\ntheorem const_fac_thru_zero (n m : SimplexCategory) (i : Fin (m.len + 1)) :\n const n m i = const n \u298b0\u298c 0 \u226b SimplexCategory.const \u298b0\u298c m i := by\nrw [const_comp]; rfl\n```\n\n-- snippet 7\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.Hom (L66-L69)\ntheorem Hom.ext_zero_left {n : SimplexCategory} (f g : \u298b0\u298c \u27f6 n)\n (h0 : f.toOrderHom 0 = g.toOrderHom 0 := by rfl) : f = g := by\next i; match i with | 0 => exact h0 \u25b8 rfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.eq_const_of_zero (L70-L73)\ntheorem eq_const_of_zero {n : SimplexCategory} (f : \u298b0\u298c \u27f6 n) :\n f = const _ n (f.toOrderHom 0) := by\next x; match x with | 0 => rfl\n```\n\n-- snippet 9\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.exists_eq_const_of_zero (L74-L76)\ntheorem exists_eq_const_of_zero {n : SimplexCategory} (f : \u298b0\u298c \u27f6 n) :\n \u2203 a, f = const _ n a := \u27e8_, eq_const_of_zero _\u27e9\n```\n\n-- snippet 10\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.eq_const_to_zero (L77-L81)\ntheorem eq_const_to_zero {n : SimplexCategory} (f : n \u27f6 \u298b0\u298c) :\n f = const n _ 0 := by\next : 3\n apply @Subsingleton.elim (Fin 1)\n```\n\n-- snippet 11\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.Hom (L82-L90)\ntheorem Hom.ext_one_left {n : SimplexCategory} (f g : \u298b1\u298c \u27f6 n)\n (h0 : f.toOrderHom 0 = g.toOrderHom 0 := by rfl)\n(h1 : f.toOrderHom 1 = g.toOrderHom 1 := by rfl) : f = g := by\n ext i\n match i with\n | 0 => exact h0 \u25b8 rfl\n | 1 => exact h1 \u25b8 rfl\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 12\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.eq_of_one_to_one (L91-L114)\ntheorem eq_of_one_to_one (f : \u298b1\u298c \u27f6 \u298b1\u298c) :\n (\u2203 a, f = const \u298b1\u298c _ a) \u2228 f = \ud835\udfd9 _ := by\nmatch e0 : f.toOrderHom 0, e1 : f.toOrderHom 1 with\n | 0, 0 | 1, 1 =>\n refine .inl \u27e8f.toOrderHom 0, ?_\u27e9\n ext i : 3\n match i with\n | 0 => rfl\n | 1 => exact e1.trans e0.symm\n | 0, 1 =>\n right\n ext i : 3\n match i with\n | 0 => exact e0\n | 1 => exact e1\n | 1, 0 =>\n have := f.toOrderHom.monotone (by decide : (0 : Fin 2) \u2264 1)\n rw [e0, e1] at this\n exact Not.elim (by decide) this\n\n/-- Make a morphism `\u298bn\u298c \u27f6 \u298bm\u298c` from a monotone map between fin's.\nThis is useful for constructing morphisms between `\u298bn\u298c` directly\nwithout identifying `n` with `\u298bn\u298c.len`.\n-/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.mkHom (L116-L119)\ndef mkHom {n m : \u2115} (f : Fin (n + 1) \u2192o Fin (m + 1)) : \u298bn\u298c \u27f6 \u298bm\u298c :=\nSimplexCategory.Hom.mk f\n\n/-- The morphism `\u298b1\u298c \u27f6 \u298bn\u298c` that picks out a specified `h : i \u2264 j` in `Fin (n+1)`. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.mkOfLe (L120-L127)\ndef mkOfLe {n} (i j : Fin (n + 1)) (h : i \u2264 j) : \u298b1\u298c \u27f6 \u298bn\u298c :=\nSimplexCategory.mkHom {\n toFun := fun | 0 => i | 1 => j\n monotone' := fun\n | 0, 0, _ | 1, 1, _ => le_rfl\n | 0, 1, _ => h\n }\n```\n\n-- snippet 15\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.mkOfLe_refl (L129-L132)\nlemma mkOfLe_refl {n} (j : Fin (n + 1)) :\n mkOfLe j j (by lia) = \u298b1\u298c.const \u298bn\u298c j := Hom.ext_one_left _ _\n/-- The morphism `\u298b1\u298c \u27f6 \u298bn\u298c` that picks out the \"diagonal composite\" edge -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.inclusion (L42-L43)\ndef inclusion : SimplexCategory \u2964 AugmentedSimplexCategory := WithInitial.incl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.id_tensorHom (L136-L139)\nlemma id_tensorHom (x : AugmentedSimplexCategory) {y\u2081 y\u2082 : AugmentedSimplexCategory}\n (f : y\u2081 \u27f6 y\u2082) : \ud835\udfd9 x \u2297\u2098 f = x \u25c1 f :=\nrfl\n```\n\n-- snippet 18\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.tensorHom (L79-L93)\ndef tensorHom {x\u2081 y\u2081 x\u2082 y\u2082 : AugmentedSimplexCategory} (f\u2081 : x\u2081 \u27f6 y\u2081) (f\u2082 : x\u2082 \u27f6 y\u2082) :\n tensorObj x\u2081 x\u2082 \u27f6 tensorObj y\u2081 y\u2082 :=\nmatch x\u2081, y\u2081, x\u2082, y\u2082, f\u2081, f\u2082 with\n | .of _, .of _, .of _, .of _, f\u2081, f\u2082 => tensorHomOf f\u2081 f\u2082\n | .of _, .of y\u2081, .star, .of y\u2082, f\u2081, _ =>\n f\u2081 \u226b ((SimplexCategory.mkHom <| (Fin.castAddOrderEmb (y\u2082.len + 1)).toOrderHom) \u226b\n eqToHom (congrArg _ (Nat.succ_add _ _)) : \u298by\u2081.len\u298c \u27f6 \u298by\u2081.len + y\u2082.len + 1\u298c)\n | .star, .of y\u2081, .of _, .of y\u2082, _, f\u2082 =>\n f\u2082 \u226b ((SimplexCategory.mkHom <| (Fin.natAddOrderEmb (y\u2081.len + 1)).toOrderHom) \u226b\n eqToHom (congrArg _ (Nat.succ_add _ _)) : \u298by\u2082.len\u298c \u27f6 \u298by\u2081.len + y\u2082.len + 1\u298c)\n | .star, .star, .of _, .of _, _, f\u2082 => f\u2082\n | .of _, .of _, .star, .star, f\u2081, _ => f\u2081\n | .star, _, .star, _, _, _ => WithInitial.starInitial.to _\n\n/-- The unit for the monoidal structure on `AugmentedSimplexCategory` is the initial object. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.inl (L157-L161)\ndef inl (x y : AugmentedSimplexCategory) : x \u27f6 x \u2297 y :=\n(\u03c1_ x).inv \u226b _ \u25c1 (WithInitial.starInitial.to y)\n\n/-- Thanks to `tensorUnit` being initial in `AugmentedSimplexCategory`, we get\na morphism `\u0394' \u27f6 \u0394 \u2297 \u0394'` for every pair of objects `\u0394, \u0394'`. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedSimplicialObject (L87-L93)\ndef equivAugmentedSimplicialObject :\n (AugmentedSimplexCategory\u1d52\u1d56 \u2964 C) \u224c SimplicialObject.Augmented C :=\nWithInitial.opEquiv SimplexCategory |>.congrLeft |>.trans WithTerminal.equivComma\n\n/-- Through the equivalence `(AugmentedSimplexCategory\u1d52\u1d56 \u2964 C) \u224c SimplicialObject.Augmented C`,\ndropping the augmentation corresponds to precomposition with\n`inclusion\u1d52\u1d56 : SimplexCategory\u1d52\u1d56 \u2964 AugmentedSimplexCategory\u1d52\u1d56`. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObject (L53-L59)\ndef equivAugmentedCosimplicialObject :\n (AugmentedSimplexCategory \u2964 C) \u224c CosimplicialObject.Augmented C :=\nWithInitial.equivComma\n\n/-- Through the equivalence `(AugmentedSimplexCategory \u2964 C) \u224c CosimplicialObject.Augmented C`,\ndropping the augmentation corresponds to precomposition with\n`inclusion : SimplexCategory \u2964 AugmentedSimplexCategory`. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.associator (L97-L111)\ndef associator (x y z : AugmentedSimplexCategory) :\n tensorObj (tensorObj x y) z \u2245 tensorObj x (tensorObj y z) :=\nmatch x, y, z with\n | .of x, .of y, .of z =>\n eqToIso (congrArg (fun j \u21a6 WithInitial.of <| SimplexCategory.mk j)\n (by simp +arith))\n | .star, .star, .star => Iso.refl _\n | .star, .of _, .star => Iso.refl _\n | .star, .star, .of _ => Iso.refl _\n | .star, .of _, .of _ => Iso.refl _\n | .of _, .star, .star => Iso.refl _\n | .of _, .star, .of _ => Iso.refl _\n | .of _, .of _, .star => Iso.refl _\n\n/-- The left unitor isomorphism for the monoidal structure in `AugmentedSimplexCategory` -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.leftUnitor (L112-L118)\ndef leftUnitor (x : AugmentedSimplexCategory) :\n tensorObj tensorUnit x \u2245 x :=\nmatch x with\n | .of _ => Iso.refl _\n | .star => Iso.refl _\n\n/-- The right unitor isomorphism for the monoidal structure in `AugmentedSimplexCategory` -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedSimplicialObjectFunctorCompDropIso (L95-L101)\ndef equivAugmentedSimplicialObjectFunctorCompDropIso :\n equivAugmentedSimplicialObject.functor \u22d9 SimplicialObject.Augmented.drop \u2245\n (Functor.whiskeringLeft _ _ C).obj inclusion.op :=\n.refl _\n\n/-- Through the equivalence `(AugmentedSimplexCategory \u2964 C) \u224c CosimplicialObject.Augmented C`,\ntaking the point of the augmentation corresponds to evaluation at the initial object. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.rightUnitor (L119-L124)\ndef rightUnitor (x : AugmentedSimplexCategory) :\n tensorObj x tensorUnit \u2245 x :=\nmatch x with\n | .of _ => Iso.refl _\n | .star => Iso.refl _\n```\n\n-- snippet 26\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedSimplicialObjectFunctorCompToArrowIso (L112-L118)\ndef equivAugmentedSimplicialObjectFunctorCompToArrowIso :\n equivAugmentedSimplicialObject.functor \u22d9 SimplicialObject.Augmented.toArrow \u2245\n Functor.mapArrowFunctor _ C \u22d9\n (evaluation _ _ |>.obj <| .mk <| .op <| WithInitial.homTo <| .mk 0) :=\n.refl _\n\nend AugmentedSimplexCategory\n```\n\n-- snippet 27\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObjectFunctorCompDropIso (L61-L67)\ndef equivAugmentedCosimplicialObjectFunctorCompDropIso :\n equivAugmentedCosimplicialObject.functor \u22d9 CosimplicialObject.Augmented.drop \u2245\n (Functor.whiskeringLeft _ _ C).obj inclusion :=\n.refl _\n\n/-- Through the equivalence `(AugmentedSimplexCategory \u2964 C) \u224c CosimplicialObject.Augmented C`,\ntaking the point of the augmentation corresponds to evaluation at the initial object. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObjectFunctorCompToArrowIso (L78-L85)\ndef equivAugmentedCosimplicialObjectFunctorCompToArrowIso :\n equivAugmentedCosimplicialObject.functor \u22d9 CosimplicialObject.Augmented.toArrow \u2245\n Functor.mapArrowFunctor _ C \u22d9\n (evaluation _ _ |>.obj <| .mk <| WithInitial.homTo <| .mk 0) :=\n.refl _\n\n/-- The equivalence between functors out of `AugmentedSimplexCategory` and augmented simplicial\nobjects. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObjectFunctorCompPointIso (L69-L76)\ndef equivAugmentedCosimplicialObjectFunctorCompPointIso :\n equivAugmentedCosimplicialObject.functor \u22d9 CosimplicialObject.Augmented.point \u2245\n ((evaluation _ _).obj .star : (AugmentedSimplexCategory \u2964 C) \u2964 C) :=\n.refl _\n\n/-- Through the equivalence `(AugmentedSimplexCategory \u2964 C) \u224c CosimplicialObject.Augmented C`,\nthe arrow attached to the cosimplicial object is the one obtained by evaluation at the unique arrow\n`star \u27f6 of [0]`. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.AugmentedSimplexCategory (L34-L40)\nabbrev AugmentedSimplexCategory := WithInitial SimplexCategory\nnamespace AugmentedSimplexCategory\n\nvariable {C : Type*} [Category* C]\n\n/-- The canonical inclusion from `SimplexCategory` to `AugmentedSimplexCategory`. -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedSimplicialObjectFunctorCompPointIso (L103-L110)\ndef equivAugmentedSimplicialObjectFunctorCompPointIso :\n equivAugmentedSimplicialObject.functor \u22d9 SimplicialObject.Augmented.point \u2245\n (evaluation _ C).obj (.op .star) :=\n.refl _\n\n/-- Through the equivalence `(AugmentedSimplexCategory \u2964 C) \u224c CosimplicialObject.Augmented C`,\nthe arrow attached to the cosimplicial object is the one obtained by evaluation at the unique arrow\n`star \u27f6 of [0]`. -/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.id_star_whiskerRight (L151-L156)\nlemma id_star_whiskerRight {x : AugmentedSimplexCategory} : \ud835\udfd9 WithInitial.star \u25b7 x = \ud835\udfd9 _ := by\ncases x <;>\n rfl\n\n/-- Thanks to `tensorUnit` being initial in `AugmentedSimplexCategory`, we get\na morphism `\u0394 \u27f6 \u0394 \u2297 \u0394'` for every pair of objects `\u0394, \u0394'`. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.tensorUnit (L94-L96)\nabbrev tensorUnit : AugmentedSimplexCategory := WithInitial.star\n/-- The associator isomorphism for the monoidal structure on `AugmentedSimplexCategory` -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.eqToHom_toOrderHom (L40-L49)\nlemma eqToHom_toOrderHom {x y : SimplexCategory} (h : WithInitial.of x = WithInitial.of y) :\n SimplexCategory.Hom.toOrderHom (WithInitial.down <| eqToHom h) =\n (Fin.castOrderIso\n (congrArg (fun t \u21a6 t + 1) (by injection h with h; rw [h]))).toOrderEmbedding.toOrderHom :=\nSimplexCategory.eqToHom_toOrderHom (by injection h)\n\n/-- An auxiliary definition for the tensor product of two objects in `AugmentedSimplexCategory`. -/\n-- (Impl. note): This definition could easily be inlined in\n-- the definition of `tensorObjOf` below, but having it type check directly as an element\n-- of `SimplexCategory` avoids having to sprinkle `WithInitial.down` everywhere.\n```\n\n-- snippet 35\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.tensorHom_id (L141-L144)\nlemma tensorHom_id {x\u2081 x\u2082 : AugmentedSimplexCategory} (y : AugmentedSimplexCategory)\n (f : x\u2081 \u27f6 x\u2082) : f \u2297\u2098 \ud835\udfd9 y = f \u25b7 y :=\nrfl\n```\n\n-- snippet 36\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.inr (L162-L166)\ndef inr (x y : AugmentedSimplexCategory) : y \u27f6 x \u2297 y :=\n(\u03bb_ y).inv \u226b (WithInitial.starInitial.to x) \u25b7 _\n\n/-- To ease type checking, we also provide a version of inl that lives in\n`SimplexCategory`. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.whiskerLeft_id_star (L146-L149)\nlemma whiskerLeft_id_star {x : AugmentedSimplexCategory} : x \u25c1 \ud835\udfd9 .star = \ud835\udfd9 _ := by\ncases x <;>\n rfl\n```\n\n-- snippet 38\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.tensorObjOf (L50-L52)\nabbrev tensorObjOf (m n : SimplexCategory) : SimplexCategory := .mk (m.len + n.len + 1)\n/-- The tensor product of two objects of `AugmentedSimplexCategory`. -/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.tensorHomOf (L60-L78)\ndef tensorHomOf {x\u2081 y\u2081 x\u2082 y\u2082 : SimplexCategory} (f\u2081 : x\u2081 \u27f6 y\u2081) (f\u2082 : x\u2082 \u27f6 y\u2082) :\n tensorObjOf x\u2081 x\u2082 \u27f6 tensorObjOf y\u2081 y\u2082 :=\nletI f\u2081 : Fin ((x\u2081.len + 1) + (x\u2082.len + 1)) \u2192o Fin ((y\u2081.len + 1) + (y\u2082.len + 1)) :=\n { toFun i :=\n Fin.addCases\n (motive := fun _ \u21a6 Fin <| (y\u2081.len + 1) + (y\u2082.len + 1))\n (fun i \u21a6 (f\u2081.toOrderHom i).castAdd _)\n (fun i \u21a6 (f\u2082.toOrderHom i).natAdd _)\n i\n monotone' i j h := by\n cases i using Fin.addCases <;>\n cases j using Fin.addCases <;>\n rw [Fin.le_def] at h \u22a2 <;>\n simp at h \u22a2 <;>\n grind only [OrderHom.apply_mono] }\n (eqToHom (congrArg _ (Nat.succ_add _ _)).symm \u226b (SimplexCategory.mkHom f\u2081) \u226b\n eqToHom (congrArg _ (Nat.succ_add _ _)) : _ \u27f6 \u298by\u2081.len + y\u2082.len + 1\u298c)\n\n/-- The action of the tensor product on maps of `AugmentedSimplexCategory`. -/\n```\n\n-- snippet 40\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.tensorObj (L53-L59)\ndef tensorObj (m n : AugmentedSimplexCategory) : AugmentedSimplexCategory :=\nmatch m, n with\n | .of m, .of n => .of <| tensorObjOf m n\n | .star, x => x\n | x, .star => x\n\n/-- The action of the tensor product on maps coming from `SimplexCategory`. -/\n```\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplexCategory.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 intervalEdge {n} (j l : \u2115) (hjl : j + l \u2264 n) : \u298b1\u298c \u27f6 \u298bn\u298c\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.congr_toOrderHom_apply (L42-L45)\nlemma congr_toOrderHom_apply {a b : SimplexCategory} {f g : a \u27f6 b} (h : f = g)\n (x : Fin (a.len + 1)) : f.toOrderHom x = g.toOrderHom x := by rw [h]\n/-- The constant morphism from \u298b0\u298c. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const (L46-L48)\ndef const (x y : SimplexCategory) (i : Fin (y.len + 1)) : x \u27f6 y :=\nHom.mk <| \u27e8fun _ => i, by tauto\u27e9\n```\n\n-- snippet 3\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const_eq_id (L50-L51)\nlemma const_eq_id : const \u298b0\u298c \u298b0\u298c 0 = \ud835\udfd9 _ := by aesop\n```\n\n-- snippet 4\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const_apply (L53-L55)\nlemma const_apply (x y : SimplexCategory) (i : Fin (y.len + 1)) (a : Fin (x.len + 1)) :\n (const x y i).toOrderHom a = i := rfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const_comp (L57-L61)\ntheorem const_comp (x : SimplexCategory) {y z : SimplexCategory}\n (f : y \u27f6 z) (i : Fin (y.len + 1)) :\n const x y i \u226b f = const x z (f.toOrderHom i) :=\nrfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const_fac_thru_zero (L62-L65)\ntheorem const_fac_thru_zero (n m : SimplexCategory) (i : Fin (m.len + 1)) :\n const n m i = const n \u298b0\u298c 0 \u226b SimplexCategory.const \u298b0\u298c m i := by\nrw [const_comp]; rfl\n```\n\n-- snippet 7\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.Hom (L66-L69)\ntheorem Hom.ext_zero_left {n : SimplexCategory} (f g : \u298b0\u298c \u27f6 n)\n (h0 : f.toOrderHom 0 = g.toOrderHom 0 := by rfl) : f = g := by\next i; match i with | 0 => exact h0 \u25b8 rfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.eq_const_of_zero (L70-L73)\ntheorem eq_const_of_zero {n : SimplexCategory} (f : \u298b0\u298c \u27f6 n) :\n f = const _ n (f.toOrderHom 0) := by\next x; match x with | 0 => rfl\n```\n\n-- snippet 9\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.exists_eq_const_of_zero (L74-L76)\ntheorem exists_eq_const_of_zero {n : SimplexCategory} (f : \u298b0\u298c \u27f6 n) :\n \u2203 a, f = const _ n a := \u27e8_, eq_const_of_zero _\u27e9\n```\n\n-- snippet 10\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.eq_const_to_zero (L77-L81)\ntheorem eq_const_to_zero {n : SimplexCategory} (f : n \u27f6 \u298b0\u298c) :\n f = const n _ 0 := by\next : 3\n apply @Subsingleton.elim (Fin 1)\n```\n\n-- snippet 11\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.Hom (L82-L90)\ntheorem Hom.ext_one_left {n : SimplexCategory} (f g : \u298b1\u298c \u27f6 n)\n (h0 : f.toOrderHom 0 = g.toOrderHom 0 := by rfl)\n(h1 : f.toOrderHom 1 = g.toOrderHom 1 := by rfl) : f = g := by\n ext i\n match i with\n | 0 => exact h0 \u25b8 rfl\n | 1 => exact h1 \u25b8 rfl\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 12\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.eq_of_one_to_one (L91-L114)\ntheorem eq_of_one_to_one (f : \u298b1\u298c \u27f6 \u298b1\u298c) :\n (\u2203 a, f = const \u298b1\u298c _ a) \u2228 f = \ud835\udfd9 _ := by\nmatch e0 : f.toOrderHom 0, e1 : f.toOrderHom 1 with\n | 0, 0 | 1, 1 =>\n refine .inl \u27e8f.toOrderHom 0, ?_\u27e9\n ext i : 3\n match i with\n | 0 => rfl\n | 1 => exact e1.trans e0.symm\n | 0, 1 =>\n right\n ext i : 3\n match i with\n | 0 => exact e0\n | 1 => exact e1\n | 1, 0 =>\n have := f.toOrderHom.monotone (by decide : (0 : Fin 2) \u2264 1)\n rw [e0, e1] at this\n exact Not.elim (by decide) this\n\n/-- Make a morphism `\u298bn\u298c \u27f6 \u298bm\u298c` from a monotone map between fin's.\nThis is useful for constructing morphisms between `\u298bn\u298c` directly\nwithout identifying `n` with `\u298bn\u298c.len`.\n-/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.mkHom (L116-L119)\ndef mkHom {n m : \u2115} (f : Fin (n + 1) \u2192o Fin (m + 1)) : \u298bn\u298c \u27f6 \u298bm\u298c :=\nSimplexCategory.Hom.mk f\n\n/-- The morphism `\u298b1\u298c \u27f6 \u298bn\u298c` that picks out a specified `h : i \u2264 j` in `Fin (n+1)`. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.mkOfLe (L120-L127)\ndef mkOfLe {n} (i j : Fin (n + 1)) (h : i \u2264 j) : \u298b1\u298c \u27f6 \u298bn\u298c :=\nSimplexCategory.mkHom {\n toFun := fun | 0 => i | 1 => j\n monotone' := fun\n | 0, 0, _ | 1, 1, _ => le_rfl\n | 0, 1, _ => h\n }\n```\n\n-- snippet 15\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.mkOfLe_refl (L129-L132)\nlemma mkOfLe_refl {n} (j : Fin (n + 1)) :\n mkOfLe j j (by lia) = \u298b1\u298c.const \u298bn\u298c j := Hom.ext_one_left _ _\n/-- The morphism `\u298b1\u298c \u27f6 \u298bn\u298c` that picks out the \"diagonal composite\" edge -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.inclusion (L42-L43)\ndef inclusion : SimplexCategory \u2964 AugmentedSimplexCategory := WithInitial.incl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.id_tensorHom (L136-L139)\nlemma id_tensorHom (x : AugmentedSimplexCategory) {y\u2081 y\u2082 : AugmentedSimplexCategory}\n (f : y\u2081 \u27f6 y\u2082) : \ud835\udfd9 x \u2297\u2098 f = x \u25c1 f :=\nrfl\n```\n\n-- snippet 18\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.tensorHom (L79-L93)\ndef tensorHom {x\u2081 y\u2081 x\u2082 y\u2082 : AugmentedSimplexCategory} (f\u2081 : x\u2081 \u27f6 y\u2081) (f\u2082 : x\u2082 \u27f6 y\u2082) :\n tensorObj x\u2081 x\u2082 \u27f6 tensorObj y\u2081 y\u2082 :=\nmatch x\u2081, y\u2081, x\u2082, y\u2082, f\u2081, f\u2082 with\n | .of _, .of _, .of _, .of _, f\u2081, f\u2082 => tensorHomOf f\u2081 f\u2082\n | .of _, .of y\u2081, .star, .of y\u2082, f\u2081, _ =>\n f\u2081 \u226b ((SimplexCategory.mkHom <| (Fin.castAddOrderEmb (y\u2082.len + 1)).toOrderHom) \u226b\n eqToHom (congrArg _ (Nat.succ_add _ _)) : \u298by\u2081.len\u298c \u27f6 \u298by\u2081.len + y\u2082.len + 1\u298c)\n | .star, .of y\u2081, .of _, .of y\u2082, _, f\u2082 =>\n f\u2082 \u226b ((SimplexCategory.mkHom <| (Fin.natAddOrderEmb (y\u2081.len + 1)).toOrderHom) \u226b\n eqToHom (congrArg _ (Nat.succ_add _ _)) : \u298by\u2082.len\u298c \u27f6 \u298by\u2081.len + y\u2082.len + 1\u298c)\n | .star, .star, .of _, .of _, _, f\u2082 => f\u2082\n | .of _, .of _, .star, .star, f\u2081, _ => f\u2081\n | .star, _, .star, _, _, _ => WithInitial.starInitial.to _\n\n/-- The unit for the monoidal structure on `AugmentedSimplexCategory` is the initial object. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.inl (L157-L161)\ndef inl (x y : AugmentedSimplexCategory) : x \u27f6 x \u2297 y :=\n(\u03c1_ x).inv \u226b _ \u25c1 (WithInitial.starInitial.to y)\n\n/-- Thanks to `tensorUnit` being initial in `AugmentedSimplexCategory`, we get\na morphism `\u0394' \u27f6 \u0394 \u2297 \u0394'` for every pair of objects `\u0394, \u0394'`. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedSimplicialObject (L87-L93)\ndef equivAugmentedSimplicialObject :\n (AugmentedSimplexCategory\u1d52\u1d56 \u2964 C) \u224c SimplicialObject.Augmented C :=\nWithInitial.opEquiv SimplexCategory |>.congrLeft |>.trans WithTerminal.equivComma\n\n/-- Through the equivalence `(AugmentedSimplexCategory\u1d52\u1d56 \u2964 C) \u224c SimplicialObject.Augmented C`,\ndropping the augmentation corresponds to precomposition with\n`inclusion\u1d52\u1d56 : SimplexCategory\u1d52\u1d56 \u2964 AugmentedSimplexCategory\u1d52\u1d56`. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObject (L53-L59)\ndef equivAugmentedCosimplicialObject :\n (AugmentedSimplexCategory \u2964 C) \u224c CosimplicialObject.Augmented C :=\nWithInitial.equivComma\n\n/-- Through the equivalence `(AugmentedSimplexCategory \u2964 C) \u224c CosimplicialObject.Augmented C`,\ndropping the augmentation corresponds to precomposition with\n`inclusion : SimplexCategory \u2964 AugmentedSimplexCategory`. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.associator (L97-L111)\ndef associator (x y z : AugmentedSimplexCategory) :\n tensorObj (tensorObj x y) z \u2245 tensorObj x (tensorObj y z) :=\nmatch x, y, z with\n | .of x, .of y, .of z =>\n eqToIso (congrArg (fun j \u21a6 WithInitial.of <| SimplexCategory.mk j)\n (by simp +arith))\n | .star, .star, .star => Iso.refl _\n | .star, .of _, .star => Iso.refl _\n | .star, .star, .of _ => Iso.refl _\n | .star, .of _, .of _ => Iso.refl _\n | .of _, .star, .star => Iso.refl _\n | .of _, .star, .of _ => Iso.refl _\n | .of _, .of _, .star => Iso.refl _\n\n/-- The left unitor isomorphism for the monoidal structure in `AugmentedSimplexCategory` -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.leftUnitor (L112-L118)\ndef leftUnitor (x : AugmentedSimplexCategory) :\n tensorObj tensorUnit x \u2245 x :=\nmatch x with\n | .of _ => Iso.refl _\n | .star => Iso.refl _\n\n/-- The right unitor isomorphism for the monoidal structure in `AugmentedSimplexCategory` -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedSimplicialObjectFunctorCompDropIso (L95-L101)\ndef equivAugmentedSimplicialObjectFunctorCompDropIso :\n equivAugmentedSimplicialObject.functor \u22d9 SimplicialObject.Augmented.drop \u2245\n (Functor.whiskeringLeft _ _ C).obj inclusion.op :=\n.refl _\n\n/-- Through the equivalence `(AugmentedSimplexCategory \u2964 C) \u224c CosimplicialObject.Augmented C`,\ntaking the point of the augmentation corresponds to evaluation at the initial object. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.rightUnitor (L119-L124)\ndef rightUnitor (x : AugmentedSimplexCategory) :\n tensorObj x tensorUnit \u2245 x :=\nmatch x with\n | .of _ => Iso.refl _\n | .star => Iso.refl _\n```\n\n-- snippet 26\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedSimplicialObjectFunctorCompToArrowIso (L112-L118)\ndef equivAugmentedSimplicialObjectFunctorCompToArrowIso :\n equivAugmentedSimplicialObject.functor \u22d9 SimplicialObject.Augmented.toArrow \u2245\n Functor.mapArrowFunctor _ C \u22d9\n (evaluation _ _ |>.obj <| .mk <| .op <| WithInitial.homTo <| .mk 0) :=\n.refl _\n\nend AugmentedSimplexCategory\n```\n\n-- snippet 27\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObjectFunctorCompDropIso (L61-L67)\ndef equivAugmentedCosimplicialObjectFunctorCompDropIso :\n equivAugmentedCosimplicialObject.functor \u22d9 CosimplicialObject.Augmented.drop \u2245\n (Functor.whiskeringLeft _ _ C).obj inclusion :=\n.refl _\n\n/-- Through the equivalence `(AugmentedSimplexCategory \u2964 C) \u224c CosimplicialObject.Augmented C`,\ntaking the point of the augmentation corresponds to evaluation at the initial object. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObjectFunctorCompToArrowIso (L78-L85)\ndef equivAugmentedCosimplicialObjectFunctorCompToArrowIso :\n equivAugmentedCosimplicialObject.functor \u22d9 CosimplicialObject.Augmented.toArrow \u2245\n Functor.mapArrowFunctor _ C \u22d9\n (evaluation _ _ |>.obj <| .mk <| WithInitial.homTo <| .mk 0) :=\n.refl _\n\n/-- The equivalence between functors out of `AugmentedSimplexCategory` and augmented simplicial\nobjects. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObjectFunctorCompPointIso (L69-L76)\ndef equivAugmentedCosimplicialObjectFunctorCompPointIso :\n equivAugmentedCosimplicialObject.functor \u22d9 CosimplicialObject.Augmented.point \u2245\n ((evaluation _ _).obj .star : (AugmentedSimplexCategory \u2964 C) \u2964 C) :=\n.refl _\n\n/-- Through the equivalence `(AugmentedSimplexCategory \u2964 C) \u224c CosimplicialObject.Augmented C`,\nthe arrow attached to the cosimplicial object is the one obtained by evaluation at the unique arrow\n`star \u27f6 of [0]`. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.AugmentedSimplexCategory (L34-L40)\nabbrev AugmentedSimplexCategory := WithInitial SimplexCategory\nnamespace AugmentedSimplexCategory\n\nvariable {C : Type*} [Category* C]\n\n/-- The canonical inclusion from `SimplexCategory` to `AugmentedSimplexCategory`. -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedSimplicialObjectFunctorCompPointIso (L103-L110)\ndef equivAugmentedSimplicialObjectFunctorCompPointIso :\n equivAugmentedSimplicialObject.functor \u22d9 SimplicialObject.Augmented.point \u2245\n (evaluation _ C).obj (.op .star) :=\n.refl _\n\n/-- Through the equivalence `(AugmentedSimplexCategory \u2964 C) \u224c CosimplicialObject.Augmented C`,\nthe arrow attached to the cosimplicial object is the one obtained by evaluation at the unique arrow\n`star \u27f6 of [0]`. -/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.id_star_whiskerRight (L151-L156)\nlemma id_star_whiskerRight {x : AugmentedSimplexCategory} : \ud835\udfd9 WithInitial.star \u25b7 x = \ud835\udfd9 _ := by\ncases x <;>\n rfl\n\n/-- Thanks to `tensorUnit` being initial in `AugmentedSimplexCategory`, we get\na morphism `\u0394 \u27f6 \u0394 \u2297 \u0394'` for every pair of objects `\u0394, \u0394'`. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.tensorUnit (L94-L96)\nabbrev tensorUnit : AugmentedSimplexCategory := WithInitial.star\n/-- The associator isomorphism for the monoidal structure on `AugmentedSimplexCategory` -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.eqToHom_toOrderHom (L40-L49)\nlemma eqToHom_toOrderHom {x y : SimplexCategory} (h : WithInitial.of x = WithInitial.of y) :\n SimplexCategory.Hom.toOrderHom (WithInitial.down <| eqToHom h) =\n (Fin.castOrderIso\n (congrArg (fun t \u21a6 t + 1) (by injection h with h; rw [h]))).toOrderEmbedding.toOrderHom :=\nSimplexCategory.eqToHom_toOrderHom (by injection h)\n\n/-- An auxiliary definition for the tensor product of two objects in `AugmentedSimplexCategory`. -/\n-- (Impl. note): This definition could easily be inlined in\n-- the definition of `tensorObjOf` below, but having it type check directly as an element\n-- of `SimplexCategory` avoids having to sprinkle `WithInitial.down` everywhere.\n```\n\n-- snippet 35\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.tensorHom_id (L141-L144)\nlemma tensorHom_id {x\u2081 x\u2082 : AugmentedSimplexCategory} (y : AugmentedSimplexCategory)\n (f : x\u2081 \u27f6 x\u2082) : f \u2297\u2098 \ud835\udfd9 y = f \u25b7 y :=\nrfl\n```\n\n-- snippet 36\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.inr (L162-L166)\ndef inr (x y : AugmentedSimplexCategory) : y \u27f6 x \u2297 y :=\n(\u03bb_ y).inv \u226b (WithInitial.starInitial.to x) \u25b7 _\n\n/-- To ease type checking, we also provide a version of inl that lives in\n`SimplexCategory`. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.whiskerLeft_id_star (L146-L149)\nlemma whiskerLeft_id_star {x : AugmentedSimplexCategory} : x \u25c1 \ud835\udfd9 .star = \ud835\udfd9 _ := by\ncases x <;>\n rfl\n```\n\n-- snippet 38\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.tensorObjOf (L50-L52)\nabbrev tensorObjOf (m n : SimplexCategory) : SimplexCategory := .mk (m.len + n.len + 1)\n/-- The tensor product of two objects of `AugmentedSimplexCategory`. -/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.tensorHomOf (L60-L78)\ndef tensorHomOf {x\u2081 y\u2081 x\u2082 y\u2082 : SimplexCategory} (f\u2081 : x\u2081 \u27f6 y\u2081) (f\u2082 : x\u2082 \u27f6 y\u2082) :\n tensorObjOf x\u2081 x\u2082 \u27f6 tensorObjOf y\u2081 y\u2082 :=\nletI f\u2081 : Fin ((x\u2081.len + 1) + (x\u2082.len + 1)) \u2192o Fin ((y\u2081.len + 1) + (y\u2082.len + 1)) :=\n { toFun i :=\n Fin.addCases\n (motive := fun _ \u21a6 Fin <| (y\u2081.len + 1) + (y\u2082.len + 1))\n (fun i \u21a6 (f\u2081.toOrderHom i).castAdd _)\n (fun i \u21a6 (f\u2082.toOrderHom i).natAdd _)\n i\n monotone' i j h := by\n cases i using Fin.addCases <;>\n cases j using Fin.addCases <;>\n rw [Fin.le_def] at h \u22a2 <;>\n simp at h \u22a2 <;>\n grind only [OrderHom.apply_mono] }\n (eqToHom (congrArg _ (Nat.succ_add _ _)).symm \u226b (SimplexCategory.mkHom f\u2081) \u226b\n eqToHom (congrArg _ (Nat.succ_add _ _)) : _ \u27f6 \u298by\u2081.len + y\u2082.len + 1\u298c)\n\n/-- The action of the tensor product on maps of `AugmentedSimplexCategory`. -/\n```\n\n-- snippet 40\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.tensorObj (L53-L59)\ndef tensorObj (m n : AugmentedSimplexCategory) : AugmentedSimplexCategory :=\nmatch m, n with\n | .of m, .of n => .of <| tensorObjOf m n\n | .star, x => x\n | x, .star => x\n\n/-- The action of the tensor product on maps coming from `SimplexCategory`. -/\n```\n[/INST]", "sample_id": "C-Mathlib.AlgebraicTopology.SimplexCategory.Basic.intervalEdge", "source": {"declaration": "Mathlib.AlgebraicTopology.SimplexCategory.Basic.intervalEdge", "file": "Mathlib/AlgebraicTopology/SimplexCategory/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.SimplexCategory.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/SimplexCategory/Basic.lean#L137", "span": "L137-L140"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "theorem birkhoffSum_add' (f : \u03b1 \u2192 \u03b1) (g g' : \u03b1 \u2192 M) (n : \u2115) (x : \u03b1) :\n birkhoffSum f (g + g') n x = birkhoffSum f g n x + birkhoffSum f g' n x\n:= by .someMissingNamespaceXYZ\nsimpa [birkhoffSum] using sum_add_distrib", "diagnostic": "[CompilationUnit(i_begin=0, i_end=164, 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=164, i_end=228, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]", "mutation_kind": "typeclass_instance", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1082, "declarations_count": 122, "diagnostics_count": 1, "duplicate_fingerprint": "dc37b38607ad196a", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 325, "lean_code_chars": 219, "lean_code_ratio": 0.2024, "length_bucket": "tiny", "line_count": 15, "natural_language_chars": 863, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.BirkhoffSum.Basic).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem birkhoffSum_add' (f : \u03b1 \u2192 \u03b1) (g g' : \u03b1 \u2192 M) (n : \u2115) (x : \u03b1) :\n birkhoffSum f (g + g') n x = birkhoffSum f g n x + birkhoffSum f g' n x\n:= by .someMissingNamespaceXYZ\nsimpa [birkhoffSum] using sum_add_distrib\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=164, 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=164, i_end=228, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.BirkhoffSum.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem birkhoffSum_add' (f : \u03b1 \u2192 \u03b1) (g g' : \u03b1 \u2192 M) (n : \u2115) (x : \u03b1) :\n birkhoffSum f (g + g') n x = birkhoffSum f g n x + birkhoffSum f g' n x\n:= by .someMissingNamespaceXYZ\nsimpa [birkhoffSum] using sum_add_distrib\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=164, 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=164, i_end=228, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "sample_id": "B-Mathlib.Dynamics.BirkhoffSum.Basic.birkhoffSum_add'", "source": {"declaration": "Mathlib.Dynamics.BirkhoffSum.Basic.birkhoffSum_add'", "file": "Mathlib/Dynamics/BirkhoffSum/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Dynamics.BirkhoffSum.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Dynamics/BirkhoffSum/Basic.lean#L59", "span": "L59-L62"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem Tape.move_right_mk' {\u0393} [Inhabited \u0393] (L R : ListBlank \u0393) :\n (Tape.mk' L R).move Dir.right = Tape.mk' (L.cons R.head) R.tail", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 552, "declarations_count": 61, "diagnostics_count": 0, "duplicate_fingerprint": "4b3dd6de9dbb45bb", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 169, "lean_code_chars": 136, "lean_code_ratio": 0.2464, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 416, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 1.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.TuringMachine.Tape).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem Tape.move_right_mk' {\u0393} [Inhabited \u0393] (L R : ListBlank \u0393) :\n (Tape.mk' L R).move Dir.right = Tape.mk' (L.cons R.head) R.tail\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.TuringMachine.Tape).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem Tape.move_right_mk' {\u0393} [Inhabited \u0393] (L R : ListBlank \u0393) :\n (Tape.mk' L R).move Dir.right = Tape.mk' (L.cons R.head) R.tail\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Computability.TuringMachine.Tape.Tape", "source": {"declaration": "Mathlib.Computability.TuringMachine.Tape.Tape", "file": "Mathlib/Computability/TuringMachine/Tape.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Computability.TuringMachine.Tape", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Computability/TuringMachine/Tape.lean#L484", "span": "L484-L488"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Tactic.CancelDenoms.Core.mul_subst (L44-L48)\ntheorem mul_subst {\u03b1} [CommRing \u03b1] {n1 n2 k e1 e2 t1 t2 : \u03b1}\n (h1 : n1 * e1 = t1) (h2 : n2 * e2 = t2) (h3 : n1 * n2 = k) : k * (e1 * e2) = t1 * t2", "-- Mathlib.Tactic.CancelDenoms.Core.div_subst (L49-L52)\ntheorem div_subst {\u03b1} [Field \u03b1] {n1 n2 k e1 e2 t1 : \u03b1}\n (h1 : n1 * e1 = t1) (h2 : n2 / e2 = 1) (h3 : n1 * n2 = k) : k * (e1 / e2) = t1", "-- Mathlib.Tactic.CancelDenoms.Core.cancel_factors_eq_div (L53-L56)\ntheorem cancel_factors_eq_div {\u03b1} [Field \u03b1] {n e e' : \u03b1}\n (h : n * e = e') (h2 : n \u2260 0) : e = e' / n", "-- Mathlib.Tactic.CancelDenoms.Core.add_subst (L57-L59)\ntheorem add_subst {\u03b1} [Ring \u03b1] {n e1 e2 t1 t2 : \u03b1} (h1 : n * e1 = t1) (h2 : n * e2 = t2) :\n n * (e1 + e2) = t1 + t2", "-- Mathlib.Tactic.CancelDenoms.Core.sub_subst (L60-L62)\ntheorem sub_subst {\u03b1} [Ring \u03b1] {n e1 e2 t1 t2 : \u03b1} (h1 : n * e1 = t1) (h2 : n * e2 = t2) :\n n * (e1 - e2) = t1 - t2", "-- Mathlib.Tactic.CancelDenoms.Core.neg_subst (L63-L64)\ntheorem neg_subst {\u03b1} [Ring \u03b1] {n e t : \u03b1} (h1 : n * e = t) : n * -e = -t", "-- Mathlib.Tactic.CancelDenoms.Core.pow_subst (L65-L68)\ntheorem pow_subst {\u03b1} [CommRing \u03b1] {n e1 t1 k l : \u03b1} {e2 : \u2115}\n (h1 : n * e1 = t1) (h2 : l * n ^ e2 = k) : k * (e1 ^ e2) = l * t1 ^ e2", "-- Mathlib.Tactic.CancelDenoms.Core.inv_subst (L69-L71)\ntheorem inv_subst {\u03b1} [Field \u03b1] {n k e : \u03b1} (h2 : e \u2260 0) (h3 : n * e = k) :\n k * (e \u207b\u00b9) = n"], "statement": "theorem cancel_factors_ne {\u03b1} [Field \u03b1] {a b ad bd a' b' gcd : \u03b1} (ha : ad * a = a')\n (hb : bd * b = b') (had : ad \u2260 0) (hbd : bd \u2260 0) (hgcd : gcd \u2260 0) :\n (a \u2260 b) = (1 / gcd * (bd * a') \u2260 1 / gcd * (ad * b'))", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 2249, "declarations_count": 279, "diagnostics_count": 0, "duplicate_fingerprint": "a20d3075fa955d75", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 986, "lean_code_chars": 1611, "lean_code_ratio": 0.7163, "length_bucket": "short", "line_count": 64, "natural_language_chars": 638, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 8, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.CancelDenoms.Core).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem cancel_factors_ne {\u03b1} [Field \u03b1] {a b ad bd a' b' gcd : \u03b1} (ha : ad * a = a')\n (hb : bd * b = b') (had : ad \u2260 0) (hbd : bd \u2260 0) (hgcd : gcd \u2260 0) :\n (a \u2260 b) = (1 / gcd * (bd * a') \u2260 1 / gcd * (ad * b'))\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Tactic.CancelDenoms.Core.mul_subst (L44-L48)\ntheorem mul_subst {\u03b1} [CommRing \u03b1] {n1 n2 k e1 e2 t1 t2 : \u03b1}\n (h1 : n1 * e1 = t1) (h2 : n2 * e2 = t2) (h3 : n1 * n2 = k) : k * (e1 * e2) = t1 * t2\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Tactic.CancelDenoms.Core.div_subst (L49-L52)\ntheorem div_subst {\u03b1} [Field \u03b1] {n1 n2 k e1 e2 t1 : \u03b1}\n (h1 : n1 * e1 = t1) (h2 : n2 / e2 = 1) (h3 : n1 * n2 = k) : k * (e1 / e2) = t1\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Tactic.CancelDenoms.Core.cancel_factors_eq_div (L53-L56)\ntheorem cancel_factors_eq_div {\u03b1} [Field \u03b1] {n e e' : \u03b1}\n (h : n * e = e') (h2 : n \u2260 0) : e = e' / n\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Tactic.CancelDenoms.Core.add_subst (L57-L59)\ntheorem add_subst {\u03b1} [Ring \u03b1] {n e1 e2 t1 t2 : \u03b1} (h1 : n * e1 = t1) (h2 : n * e2 = t2) :\n n * (e1 + e2) = t1 + t2\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Tactic.CancelDenoms.Core.sub_subst (L60-L62)\ntheorem sub_subst {\u03b1} [Ring \u03b1] {n e1 e2 t1 t2 : \u03b1} (h1 : n * e1 = t1) (h2 : n * e2 = t2) :\n n * (e1 - e2) = t1 - t2\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Tactic.CancelDenoms.Core.neg_subst (L63-L64)\ntheorem neg_subst {\u03b1} [Ring \u03b1] {n e t : \u03b1} (h1 : n * e = t) : n * -e = -t\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Tactic.CancelDenoms.Core.pow_subst (L65-L68)\ntheorem pow_subst {\u03b1} [CommRing \u03b1] {n e1 t1 k l : \u03b1} {e2 : \u2115}\n (h1 : n * e1 = t1) (h2 : l * n ^ e2 = k) : k * (e1 ^ e2) = l * t1 ^ e2\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Tactic.CancelDenoms.Core.inv_subst (L69-L71)\ntheorem inv_subst {\u03b1} [Field \u03b1] {n k e : \u03b1} (h2 : e \u2260 0) (h3 : n * e = k) :\n k * (e \u207b\u00b9) = n\n```\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.CancelDenoms.Core).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem cancel_factors_ne {\u03b1} [Field \u03b1] {a b ad bd a' b' gcd : \u03b1} (ha : ad * a = a')\n (hb : bd * b = b') (had : ad \u2260 0) (hbd : bd \u2260 0) (hgcd : gcd \u2260 0) :\n (a \u2260 b) = (1 / gcd * (bd * a') \u2260 1 / gcd * (ad * b'))\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Tactic.CancelDenoms.Core.mul_subst (L44-L48)\ntheorem mul_subst {\u03b1} [CommRing \u03b1] {n1 n2 k e1 e2 t1 t2 : \u03b1}\n (h1 : n1 * e1 = t1) (h2 : n2 * e2 = t2) (h3 : n1 * n2 = k) : k * (e1 * e2) = t1 * t2\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Tactic.CancelDenoms.Core.div_subst (L49-L52)\ntheorem div_subst {\u03b1} [Field \u03b1] {n1 n2 k e1 e2 t1 : \u03b1}\n (h1 : n1 * e1 = t1) (h2 : n2 / e2 = 1) (h3 : n1 * n2 = k) : k * (e1 / e2) = t1\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Tactic.CancelDenoms.Core.cancel_factors_eq_div (L53-L56)\ntheorem cancel_factors_eq_div {\u03b1} [Field \u03b1] {n e e' : \u03b1}\n (h : n * e = e') (h2 : n \u2260 0) : e = e' / n\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Tactic.CancelDenoms.Core.add_subst (L57-L59)\ntheorem add_subst {\u03b1} [Ring \u03b1] {n e1 e2 t1 t2 : \u03b1} (h1 : n * e1 = t1) (h2 : n * e2 = t2) :\n n * (e1 + e2) = t1 + t2\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Tactic.CancelDenoms.Core.sub_subst (L60-L62)\ntheorem sub_subst {\u03b1} [Ring \u03b1] {n e1 e2 t1 t2 : \u03b1} (h1 : n * e1 = t1) (h2 : n * e2 = t2) :\n n * (e1 - e2) = t1 - t2\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Tactic.CancelDenoms.Core.neg_subst (L63-L64)\ntheorem neg_subst {\u03b1} [Ring \u03b1] {n e t : \u03b1} (h1 : n * e = t) : n * -e = -t\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Tactic.CancelDenoms.Core.pow_subst (L65-L68)\ntheorem pow_subst {\u03b1} [CommRing \u03b1] {n e1 t1 k l : \u03b1} {e2 : \u2115}\n (h1 : n * e1 = t1) (h2 : l * n ^ e2 = k) : k * (e1 ^ e2) = l * t1 ^ e2\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Tactic.CancelDenoms.Core.inv_subst (L69-L71)\ntheorem inv_subst {\u03b1} [Field \u03b1] {n k e : \u03b1} (h2 : e \u2260 0) (h3 : n * e = k) :\n k * (e \u207b\u00b9) = n\n```\n[/INST]", "sample_id": "C-Mathlib.Tactic.CancelDenoms.Core.cancel_factors_ne", "source": {"declaration": "Mathlib.Tactic.CancelDenoms.Core.cancel_factors_ne", "file": "Mathlib/Tactic/CancelDenoms/Core.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.CancelDenoms.Core", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/CancelDenoms/Core.lean#L95", "span": "L95-L214"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "def entriesToMessageData (entries : Entries) : MetaM MessageData\n:= do .someMissingNamespaceXYZ\n-- ['1', '2', '3']\n let paddedLines \u2190 padRight <| entries.l.map fun entry => m!\"{entry.line!}\"\n -- [' ', '1,2', '1 ']\n let paddedDeps \u2190 padRight <| entries.l.map fun entry =>\n String.intercalate \",\" <| entry.deps.map (fun dep => (dep.map toString).getD \"_\")\n -- ['p ', 'hP ', '\u2200I ']\n let paddedThms \u2190 padRight <| entries.l.map (\u00b7.thm)\n\n rowToMessageData paddedLines paddedDeps paddedThms entries.l\n\nend Explode\n\nend Mathlib", "diagnostic": "[CompilationUnit(i_begin=0, i_end=117, messages=[Message(data=\"Function expected at\\n MetaM\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n MessageData\\n\\nHint: The identifier `MetaM` 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=64), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=117, i_end=530, messages=[Message(data=\"unexpected token 'let'; expected command\", pos=Position(line=4, column=2), pos_end=Position(line=4, column=5), 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=13, column=0), pos_end=Position(line=13, column=11), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=530, i_end=541, messages=[Message(data='Invalid `end`: There is no current scope to end\\n\\nNote: Scopes are introduced using `namespace` and `section`', pos=Position(line=15, column=0), pos_end=Position(line=15, column=11), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]", "mutation_kind": "missing_import_open_namespace", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 2677, "declarations_count": 320, "diagnostics_count": 1, "duplicate_fingerprint": "eefc0e9306c5ee27", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 753, "lean_code_chars": 533, "lean_code_ratio": 0.1991, "length_bucket": "short", "line_count": 26, "natural_language_chars": 2144, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.Explode.Pretty).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef entriesToMessageData (entries : Entries) : MetaM MessageData\n:= do .someMissingNamespaceXYZ\n-- ['1', '2', '3']\n let paddedLines \u2190 padRight <| entries.l.map fun entry => m!\"{entry.line!}\"\n -- [' ', '1,2', '1 ']\n let paddedDeps \u2190 padRight <| entries.l.map fun entry =>\n String.intercalate \",\" <| entry.deps.map (fun dep => (dep.map toString).getD \"_\")\n -- ['p ', 'hP ', '\u2200I ']\n let paddedThms \u2190 padRight <| entries.l.map (\u00b7.thm)\n\n rowToMessageData paddedLines paddedDeps paddedThms entries.l\n\nend Explode\n\nend Mathlib\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=117, messages=[Message(data=\"Function expected at\\n MetaM\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n MessageData\\n\\nHint: The identifier `MetaM` 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=64), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=117, i_end=530, messages=[Message(data=\"unexpected token 'let'; expected command\", pos=Position(line=4, column=2), pos_end=Position(line=4, column=5), 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=13, column=0), pos_end=Position(line=13, column=11), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=530, i_end=541, messages=[Message(data='Invalid `end`: There is no current scope to end\\n\\nNote: Scopes are introduced using `namespace` and `section`', pos=Position(line=15, column=0), pos_end=Position(line=15, column=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.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.Explode.Pretty).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef entriesToMessageData (entries : Entries) : MetaM MessageData\n:= do .someMissingNamespaceXYZ\n-- ['1', '2', '3']\n let paddedLines \u2190 padRight <| entries.l.map fun entry => m!\"{entry.line!}\"\n -- [' ', '1,2', '1 ']\n let paddedDeps \u2190 padRight <| entries.l.map fun entry =>\n String.intercalate \",\" <| entry.deps.map (fun dep => (dep.map toString).getD \"_\")\n -- ['p ', 'hP ', '\u2200I ']\n let paddedThms \u2190 padRight <| entries.l.map (\u00b7.thm)\n\n rowToMessageData paddedLines paddedDeps paddedThms entries.l\n\nend Explode\n\nend Mathlib\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=117, messages=[Message(data=\"Function expected at\\n MetaM\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n MessageData\\n\\nHint: The identifier `MetaM` 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=64), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=117, i_end=530, messages=[Message(data=\"unexpected token 'let'; expected command\", pos=Position(line=4, column=2), pos_end=Position(line=4, column=5), 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=13, column=0), pos_end=Position(line=13, column=11), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=530, i_end=541, messages=[Message(data='Invalid `end`: There is no current scope to end\\n\\nNote: Scopes are introduced using `namespace` and `section`', pos=Position(line=15, column=0), pos_end=Position(line=15, column=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]", "sample_id": "B-Mathlib.Tactic.Explode.Pretty.entriesToMessageData", "source": {"declaration": "Mathlib.Tactic.Explode.Pretty.entriesToMessageData", "file": "Mathlib/Tactic/Explode/Pretty.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.Explode.Pretty", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/Explode/Pretty.lean#L61", "span": "L61-L74"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem ExistsUnique.choose_eq_iff {p : \u03b1 \u2192 Prop} {a : \u03b1} (h : \u2203! x, p x) :\n h.choose = a \u2194 p a", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 501, "declarations_count": 59, "diagnostics_count": 0, "duplicate_fingerprint": "08eff802ae7642cd", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 152, "lean_code_chars": 99, "lean_code_ratio": 0.1976, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 402, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.ExistsUnique).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem ExistsUnique.choose_eq_iff {p : \u03b1 \u2192 Prop} {a : \u03b1} (h : \u2203! x, p x) :\n h.choose = a \u2194 p a\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.ExistsUnique).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem ExistsUnique.choose_eq_iff {p : \u03b1 \u2192 Prop} {a : \u03b1} (h : \u2203! x, p x) :\n h.choose = a \u2194 p a\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Logic.ExistsUnique.ExistsUnique", "source": {"declaration": "Mathlib.Logic.ExistsUnique.ExistsUnique", "file": "Mathlib/Logic/ExistsUnique.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Logic.ExistsUnique", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Logic/ExistsUnique.lean#L95", "span": "L95-L103"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"trace_states": [{"state": "def mapEquiv : f \u03b1 \u2243 f \u03b2 where\n toFun", "tactic": "convert (congr_fun (EquivFunctor.map_trans' e e.symm) x).symm"}, {"state": "", "tactic": "simp right_inv y := by"}, {"state": "", "tactic": "convert (congr_fun (EquivFunctor.map_trans' e.symm e) y).symm"}, {"state": "", "tactic": "simp"}], "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1031, "declarations_count": 126, "diagnostics_count": 0, "duplicate_fingerprint": "e7409c9d34105931", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 333, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "tiny", "line_count": 16, "natural_language_chars": 1031, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Control.EquivFunctor).", "role": "system"}, {"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.Control.EquivFunctor.mapEquiv`:\nState 0: \u22a2 def mapEquiv : f \u03b1 \u2243 f \u03b2 where\n toFun\nTactic: convert (congr_fun (EquivFunctor.map_trans' e e.symm) x).symm\nState 1: \u22a2 \nTactic: simp right_inv y := by\nState 2: \u22a2 \nTactic: convert (congr_fun (EquivFunctor.map_trans' e.symm e) y).symm\nState 3: \u22a2 \nTactic: simp\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Control.EquivFunctor).[/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.Control.EquivFunctor.mapEquiv`:\nState 0: \u22a2 def mapEquiv : f \u03b1 \u2243 f \u03b2 where\n toFun\nTactic: convert (congr_fun (EquivFunctor.map_trans' e e.symm) x).symm\nState 1: \u22a2 \nTactic: simp right_inv y := by\nState 2: \u22a2 \nTactic: convert (congr_fun (EquivFunctor.map_trans' e.symm e) y).symm\nState 3: \u22a2 \nTactic: simp\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.Control.EquivFunctor.mapEquiv", "source": {"declaration": "Mathlib.Control.EquivFunctor.mapEquiv", "file": "Mathlib/Control/EquivFunctor.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Control.EquivFunctor", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Control/EquivFunctor.lean#L50", "span": "L50-L59"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.AlgebraicTopology.ModelCategory.Homotopy.rightHomotopyRel (L63-L91)\nlemma rightHomotopyRel (h : LeftHomotopyRel f g) : RightHomotopyRel f g", "-- Mathlib.AlgebraicTopology.ModelCategory.Homotopy.leftHomotopyRel (L92-L97)\nlemma leftHomotopyRel (h : RightHomotopyRel f g) : LeftHomotopyRel f g", "-- Mathlib.AlgebraicTopology.ModelCategory.Homotopy.leftHomotopyRel_iff_rightHomotopyRel (L102-L121)\nlemma leftHomotopyRel_iff_rightHomotopyRel :\n LeftHomotopyRel f g \u2194 RightHomotopyRel f g", "-- Mathlib.AlgebraicTopology.ModelCategory.Homotopy.postcomp_bijective_of_fibration_of_weakEquivalence (L129-L152)\nlemma postcomp_bijective_of_fibration_of_weakEquivalence\n [IsCofibrant X] (g : Y \u27f6 Z) [Fibration g] [WeakEquivalence g] :\n Function.Bijective (fun (f : LeftHomotopyClass X Y) \u21a6 f.postcomp g)", "-- Mathlib.AlgebraicTopology.ModelCategory.Homotopy.postcomp_bijective_of_weakEquivalence (L153-L175)\nlemma postcomp_bijective_of_weakEquivalence\n [IsCofibrant X] (g : Y \u27f6 Z) [IsFibrant Y] [IsFibrant Z] [WeakEquivalence g] :\n Function.Bijective (fun (f : LeftHomotopyClass X Y) \u21a6 f.postcomp g)", "-- Mathlib.AlgebraicTopology.ModelCategory.Homotopy.precomp_bijective_of_cofibration_of_weakEquivalence (L176-L199)\nlemma precomp_bijective_of_cofibration_of_weakEquivalence\n [IsFibrant Z] (f : X \u27f6 Y) [Cofibration f] [WeakEquivalence f] :\n Function.Bijective (fun (g : RightHomotopyClass Y Z) \u21a6 g.precomp f)", "-- Mathlib.AlgebraicTopology.ModelCategory.Homotopy.precomp_bijective_of_weakEquivalence (L200-L215)\nlemma precomp_bijective_of_weakEquivalence\n [IsFibrant Z] (f : X \u27f6 Y) [IsCofibrant X] [IsCofibrant Y] [WeakEquivalence f] :\n Function.Bijective (fun (g : RightHomotopyClass Y Z) \u21a6 g.precomp f)", "-- Mathlib.AlgebraicTopology.ModelCategory.Homotopy.LeftHomotopyClass (L231-L236)\nlemma LeftHomotopyClass.whitehead [IsCofibrant X] [IsCofibrant Y] [IsFibrant X] [IsFibrant Y]\n (f : X \u27f6 Y) [WeakEquivalence f] :\n \u2203 (g : Y \u27f6 X), LeftHomotopyRel (f \u226b g) (\ud835\udfd9 X) \u2227 LeftHomotopyRel (g \u226b f) (\ud835\udfd9 Y)", "-- Mathlib.AlgebraicTopology.ModelCategory.Bifibrant.CofibrantObject (L43-L47)\nabbrev CofibrantObject : Type u", "-- Mathlib.AlgebraicTopology.ModelCategory.Bifibrant.homMk (L55-L57)\nabbrev homMk {X Y : C} [IsCofibrant X] [IsCofibrant Y] (f : X \u27f6 Y) :\n mk X \u27f6 mk Y", "-- Mathlib.AlgebraicTopology.ModelCategory.Basic.mk' (L126-L163)\ndef mk' [CategoryWithFibrations C] [CategoryWithCofibrations C]\n [CategoryWithWeakEquivalences C] [HasFiniteLimits C] [HasFiniteColimits C]\n [(weakEquivalences C).HasTwoOutOfThreeProperty]\n [IsWeakFactorizationSystem (cofibrations C) (trivialFibrations C)]\n [IsWeakFactorizationSystem (trivialCofibrations C) (fibrations C)] :\n ModelCategory C where\n cm3a", "-- Mathlib.AlgebraicTopology.ModelCategory.Bifibrant.mk (L48-L50)\nabbrev mk (X : C) [IsCofibrant X] : CofibrantObject C", "-- Mathlib.AlgebraicTopology.ModelCategory.Bifibrant.cofibrantObjects (L39-L42)\ndef cofibrantObjects : ObjectProperty C", "-- Mathlib.AlgebraicTopology.ModelCategory.Bifibrant.mk_surjective (L51-L54)\nlemma mk_surjective (X : CofibrantObject C) :\n \u2203 (Y : C) (_ : IsCofibrant Y), X = mk Y"], "statement": "lemma whitehead [IsCofibrant X] [IsCofibrant Y] [IsFibrant X] [IsFibrant Y]\n (f : X \u27f6 Y) [WeakEquivalence f] :\n \u2203 (g : Y \u27f6 X), RightHomotopyRel (f \u226b g) (\ud835\udfd9 X) \u2227 RightHomotopyRel (g \u226b f) (\ud835\udfd9 Y)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 4135, "declarations_count": 349, "diagnostics_count": 0, "duplicate_fingerprint": "b7fdaf27fb2ea75e", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1465, "lean_code_chars": 3320, "lean_code_ratio": 0.8029, "length_bucket": "short", "line_count": 112, "natural_language_chars": 815, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 14, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.ModelCategory.Homotopy).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma whitehead [IsCofibrant X] [IsCofibrant Y] [IsFibrant X] [IsFibrant Y]\n (f : X \u27f6 Y) [WeakEquivalence f] :\n \u2203 (g : Y \u27f6 X), RightHomotopyRel (f \u226b g) (\ud835\udfd9 X) \u2227 RightHomotopyRel (g \u226b f) (\ud835\udfd9 Y)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.AlgebraicTopology.ModelCategory.Homotopy.rightHomotopyRel (L63-L91)\nlemma rightHomotopyRel (h : LeftHomotopyRel f g) : RightHomotopyRel f g\n```\n\n-- snippet 2\n```lean\n-- Mathlib.AlgebraicTopology.ModelCategory.Homotopy.leftHomotopyRel (L92-L97)\nlemma leftHomotopyRel (h : RightHomotopyRel f g) : LeftHomotopyRel f g\n```\n\n-- snippet 3\n```lean\n-- Mathlib.AlgebraicTopology.ModelCategory.Homotopy.leftHomotopyRel_iff_rightHomotopyRel (L102-L121)\nlemma leftHomotopyRel_iff_rightHomotopyRel :\n LeftHomotopyRel f g \u2194 RightHomotopyRel f g\n```\n\n-- snippet 4\n```lean\n-- Mathlib.AlgebraicTopology.ModelCategory.Homotopy.postcomp_bijective_of_fibration_of_weakEquivalence (L129-L152)\nlemma postcomp_bijective_of_fibration_of_weakEquivalence\n [IsCofibrant X] (g : Y \u27f6 Z) [Fibration g] [WeakEquivalence g] :\n Function.Bijective (fun (f : LeftHomotopyClass X Y) \u21a6 f.postcomp g)\n```\n\n-- snippet 5\n```lean\n-- Mathlib.AlgebraicTopology.ModelCategory.Homotopy.postcomp_bijective_of_weakEquivalence (L153-L175)\nlemma postcomp_bijective_of_weakEquivalence\n [IsCofibrant X] (g : Y \u27f6 Z) [IsFibrant Y] [IsFibrant Z] [WeakEquivalence g] :\n Function.Bijective (fun (f : LeftHomotopyClass X Y) \u21a6 f.postcomp g)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.AlgebraicTopology.ModelCategory.Homotopy.precomp_bijective_of_cofibration_of_weakEquivalence (L176-L199)\nlemma precomp_bijective_of_cofibration_of_weakEquivalence\n [IsFibrant Z] (f : X \u27f6 Y) [Cofibration f] [WeakEquivalence f] :\n Function.Bijective (fun (g : RightHomotopyClass Y Z) \u21a6 g.precomp f)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.AlgebraicTopology.ModelCategory.Homotopy.precomp_bijective_of_weakEquivalence (L200-L215)\nlemma precomp_bijective_of_weakEquivalence\n [IsFibrant Z] (f : X \u27f6 Y) [IsCofibrant X] [IsCofibrant Y] [WeakEquivalence f] :\n Function.Bijective (fun (g : RightHomotopyClass Y Z) \u21a6 g.precomp f)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.AlgebraicTopology.ModelCategory.Homotopy.LeftHomotopyClass (L231-L236)\nlemma LeftHomotopyClass.whitehead [IsCofibrant X] [IsCofibrant Y] [IsFibrant X] [IsFibrant Y]\n (f : X \u27f6 Y) [WeakEquivalence f] :\n \u2203 (g : Y \u27f6 X), LeftHomotopyRel (f \u226b g) (\ud835\udfd9 X) \u2227 LeftHomotopyRel (g \u226b f) (\ud835\udfd9 Y)\n```\n\n-- snippet 9\n```lean\n-- Mathlib.AlgebraicTopology.ModelCategory.Bifibrant.CofibrantObject (L43-L47)\nabbrev CofibrantObject : Type u\n```\n\n-- snippet 10\n```lean\n-- Mathlib.AlgebraicTopology.ModelCategory.Bifibrant.homMk (L55-L57)\nabbrev homMk {X Y : C} [IsCofibrant X] [IsCofibrant Y] (f : X \u27f6 Y) :\n mk X \u27f6 mk Y\n```\n\n-- snippet 11\n```lean\n-- Mathlib.AlgebraicTopology.ModelCategory.Basic.mk' (L126-L163)\ndef mk' [CategoryWithFibrations C] [CategoryWithCofibrations C]\n [CategoryWithWeakEquivalences C] [HasFiniteLimits C] [HasFiniteColimits C]\n [(weakEquivalences C).HasTwoOutOfThreeProperty]\n [IsWeakFactorizationSystem (cofibrations C) (trivialFibrations C)]\n [IsWeakFactorizationSystem (trivialCofibrations C) (fibrations C)] :\n ModelCategory C where\n cm3a\n```\n\n-- snippet 12\n```lean\n-- Mathlib.AlgebraicTopology.ModelCategory.Bifibrant.mk (L48-L50)\nabbrev mk (X : C) [IsCofibrant X] : CofibrantObject C\n```\n\n-- snippet 13\n```lean\n-- Mathlib.AlgebraicTopology.ModelCategory.Bifibrant.cofibrantObjects (L39-L42)\ndef cofibrantObjects : ObjectProperty C\n```\n\n-- snippet 14\n```lean\n-- Mathlib.AlgebraicTopology.ModelCategory.Bifibrant.mk_surjective (L51-L54)\nlemma mk_surjective (X : CofibrantObject C) :\n \u2203 (Y : C) (_ : IsCofibrant Y), X = mk Y\n```\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.ModelCategory.Homotopy).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma whitehead [IsCofibrant X] [IsCofibrant Y] [IsFibrant X] [IsFibrant Y]\n (f : X \u27f6 Y) [WeakEquivalence f] :\n \u2203 (g : Y \u27f6 X), RightHomotopyRel (f \u226b g) (\ud835\udfd9 X) \u2227 RightHomotopyRel (g \u226b f) (\ud835\udfd9 Y)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.AlgebraicTopology.ModelCategory.Homotopy.rightHomotopyRel (L63-L91)\nlemma rightHomotopyRel (h : LeftHomotopyRel f g) : RightHomotopyRel f g\n```\n\n-- snippet 2\n```lean\n-- Mathlib.AlgebraicTopology.ModelCategory.Homotopy.leftHomotopyRel (L92-L97)\nlemma leftHomotopyRel (h : RightHomotopyRel f g) : LeftHomotopyRel f g\n```\n\n-- snippet 3\n```lean\n-- Mathlib.AlgebraicTopology.ModelCategory.Homotopy.leftHomotopyRel_iff_rightHomotopyRel (L102-L121)\nlemma leftHomotopyRel_iff_rightHomotopyRel :\n LeftHomotopyRel f g \u2194 RightHomotopyRel f g\n```\n\n-- snippet 4\n```lean\n-- Mathlib.AlgebraicTopology.ModelCategory.Homotopy.postcomp_bijective_of_fibration_of_weakEquivalence (L129-L152)\nlemma postcomp_bijective_of_fibration_of_weakEquivalence\n [IsCofibrant X] (g : Y \u27f6 Z) [Fibration g] [WeakEquivalence g] :\n Function.Bijective (fun (f : LeftHomotopyClass X Y) \u21a6 f.postcomp g)\n```\n\n-- snippet 5\n```lean\n-- Mathlib.AlgebraicTopology.ModelCategory.Homotopy.postcomp_bijective_of_weakEquivalence (L153-L175)\nlemma postcomp_bijective_of_weakEquivalence\n [IsCofibrant X] (g : Y \u27f6 Z) [IsFibrant Y] [IsFibrant Z] [WeakEquivalence g] :\n Function.Bijective (fun (f : LeftHomotopyClass X Y) \u21a6 f.postcomp g)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.AlgebraicTopology.ModelCategory.Homotopy.precomp_bijective_of_cofibration_of_weakEquivalence (L176-L199)\nlemma precomp_bijective_of_cofibration_of_weakEquivalence\n [IsFibrant Z] (f : X \u27f6 Y) [Cofibration f] [WeakEquivalence f] :\n Function.Bijective (fun (g : RightHomotopyClass Y Z) \u21a6 g.precomp f)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.AlgebraicTopology.ModelCategory.Homotopy.precomp_bijective_of_weakEquivalence (L200-L215)\nlemma precomp_bijective_of_weakEquivalence\n [IsFibrant Z] (f : X \u27f6 Y) [IsCofibrant X] [IsCofibrant Y] [WeakEquivalence f] :\n Function.Bijective (fun (g : RightHomotopyClass Y Z) \u21a6 g.precomp f)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.AlgebraicTopology.ModelCategory.Homotopy.LeftHomotopyClass (L231-L236)\nlemma LeftHomotopyClass.whitehead [IsCofibrant X] [IsCofibrant Y] [IsFibrant X] [IsFibrant Y]\n (f : X \u27f6 Y) [WeakEquivalence f] :\n \u2203 (g : Y \u27f6 X), LeftHomotopyRel (f \u226b g) (\ud835\udfd9 X) \u2227 LeftHomotopyRel (g \u226b f) (\ud835\udfd9 Y)\n```\n\n-- snippet 9\n```lean\n-- Mathlib.AlgebraicTopology.ModelCategory.Bifibrant.CofibrantObject (L43-L47)\nabbrev CofibrantObject : Type u\n```\n\n-- snippet 10\n```lean\n-- Mathlib.AlgebraicTopology.ModelCategory.Bifibrant.homMk (L55-L57)\nabbrev homMk {X Y : C} [IsCofibrant X] [IsCofibrant Y] (f : X \u27f6 Y) :\n mk X \u27f6 mk Y\n```\n\n-- snippet 11\n```lean\n-- Mathlib.AlgebraicTopology.ModelCategory.Basic.mk' (L126-L163)\ndef mk' [CategoryWithFibrations C] [CategoryWithCofibrations C]\n [CategoryWithWeakEquivalences C] [HasFiniteLimits C] [HasFiniteColimits C]\n [(weakEquivalences C).HasTwoOutOfThreeProperty]\n [IsWeakFactorizationSystem (cofibrations C) (trivialFibrations C)]\n [IsWeakFactorizationSystem (trivialCofibrations C) (fibrations C)] :\n ModelCategory C where\n cm3a\n```\n\n-- snippet 12\n```lean\n-- Mathlib.AlgebraicTopology.ModelCategory.Bifibrant.mk (L48-L50)\nabbrev mk (X : C) [IsCofibrant X] : CofibrantObject C\n```\n\n-- snippet 13\n```lean\n-- Mathlib.AlgebraicTopology.ModelCategory.Bifibrant.cofibrantObjects (L39-L42)\ndef cofibrantObjects : ObjectProperty C\n```\n\n-- snippet 14\n```lean\n-- Mathlib.AlgebraicTopology.ModelCategory.Bifibrant.mk_surjective (L51-L54)\nlemma mk_surjective (X : CofibrantObject C) :\n \u2203 (Y : C) (_ : IsCofibrant Y), X = mk Y\n```\n[/INST]", "sample_id": "C-Mathlib.AlgebraicTopology.ModelCategory.Homotopy.whitehead", "source": {"declaration": "Mathlib.AlgebraicTopology.ModelCategory.Homotopy.whitehead", "file": "Mathlib/AlgebraicTopology/ModelCategory/Homotopy.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.ModelCategory.Homotopy", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/ModelCategory/Homotopy.lean#L216", "span": "L216-L230"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "theorem div_lt_const [Semifield \u03b1] [LinearOrder \u03b1] [IsStrictOrderedRing \u03b1]\n (p : b < c) {a : \u03b1} (ha : 0 < a) : b / a < c / a\n:= _unbalancedParenXYZ\ndiv_lt_div_of_pos_right p ha", "diagnostic": "[CompilationUnit(i_begin=0, i_end=183, 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)]", "mutation_kind": "term_arg_order", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 994, "declarations_count": 102, "diagnostics_count": 1, "duplicate_fingerprint": "0f2bd76a412293ff", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 291, "lean_code_chars": 180, "lean_code_ratio": 0.1811, "length_bucket": "tiny", "line_count": 15, "natural_language_chars": 814, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.LinearCombination.Lemmas).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem div_lt_const [Semifield \u03b1] [LinearOrder \u03b1] [IsStrictOrderedRing \u03b1]\n (p : b < c) {a : \u03b1} (ha : 0 < a) : b / a < c / a\n:= _unbalancedParenXYZ\ndiv_lt_div_of_pos_right p ha\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=183, 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)]\n```\n\nReturn a corrected, compiling version of the code.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.LinearCombination.Lemmas).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem div_lt_const [Semifield \u03b1] [LinearOrder \u03b1] [IsStrictOrderedRing \u03b1]\n (p : b < c) {a : \u03b1} (ha : 0 < a) : b / a < c / a\n:= _unbalancedParenXYZ\ndiv_lt_div_of_pos_right p ha\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=183, 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)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "sample_id": "B-Mathlib.Tactic.LinearCombination.Lemmas.div_lt_const", "source": {"declaration": "Mathlib.Tactic.LinearCombination.Lemmas.div_lt_const", "file": "Mathlib/Tactic/LinearCombination/Lemmas.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.LinearCombination.Lemmas", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/LinearCombination/Lemmas.lean#L135", "span": "L135-L138"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\ndef ExProd.mkNegNat (_ : Q(Ring $\u03b1)) (n : \u2115) : (e : Q($\u03b1)) \u00d7 ExProd s\u03b1 e := let lit : Q(\u2115) := mkRawNatLit n\n \u27e8q((Int.negOfNat $lit).rawCast : $\u03b1), .const (-n) none\u27e9\n\n/--\nConstructs the expression corresponding to `.const q h` for `q = n / d`\nand `h` a proof that `(d : \u03b1) \u2260 0`.\n(The `.const` constructor does not check that the expression is correct.)\n-/\n```", "instruction": "Edit `ExProd` so it still compiles and the proof is simplified where possible. Return the full updated `ExProd` block.", "proof_is_oneliner": false, "target_span": "L271-L279", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1026, "declarations_count": 127, "diagnostics_count": 0, "duplicate_fingerprint": "55d9435796431c0c", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 343, "lean_code_chars": 356, "lean_code_ratio": 0.347, "length_bucket": "tiny", "line_count": 17, "natural_language_chars": 670, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.Ring.Common).", "role": "system"}, {"content": "You are editing a file in `Mathlib/Tactic/Ring/Common.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Tactic.Ring.Common.ExProd`, L271-L279)\n```lean\ndef ExProd.mkNegNat (_ : Q(Ring $\u03b1)) (n : \u2115) : (e : Q($\u03b1)) \u00d7 ExProd s\u03b1 e := let lit : Q(\u2115) := mkRawNatLit n\n \u27e8q((Int.negOfNat $lit).rawCast : $\u03b1), .const (-n) none\u27e9\n\n/--\nConstructs the expression corresponding to `.const q h` for `q = n / d`\nand `h` a proof that `(d : \u03b1) \u2260 0`.\n(The `.const` constructor does not check that the expression is correct.)\n-/\n```\n\n## Edit instruction\nEdit `ExProd` so it still compiles and the proof is simplified where possible. Return the full updated `ExProd` block.\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.Ring.Common).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Tactic/Ring/Common.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Tactic.Ring.Common.ExProd`, L271-L279)\n```lean\ndef ExProd.mkNegNat (_ : Q(Ring $\u03b1)) (n : \u2115) : (e : Q($\u03b1)) \u00d7 ExProd s\u03b1 e := let lit : Q(\u2115) := mkRawNatLit n\n \u27e8q((Int.negOfNat $lit).rawCast : $\u03b1), .const (-n) none\u27e9\n\n/--\nConstructs the expression corresponding to `.const q h` for `q = n / d`\nand `h` a proof that `(d : \u03b1) \u2260 0`.\n(The `.const` constructor does not check that the expression is correct.)\n-/\n```\n\n## Edit instruction\nEdit `ExProd` so it still compiles and the proof is simplified where possible. Return the full updated `ExProd` block.\n[/INST]", "sample_id": "D-Mathlib.Tactic.Ring.Common.ExProd", "source": {"declaration": "Mathlib.Tactic.Ring.Common.ExProd", "file": "Mathlib/Tactic/Ring/Common.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.Ring.Common", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/Ring/Common.lean#L271", "span": "L271-L279"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "theorem Ergodic.ae_eq_const_of_ae_eq_comp\u2080 (h : Ergodic f \u03bc) (hgm : NullMeasurable g \u03bc)\n (hg_eq : g \u2218 f =\u1d50[\u03bc] g) : \u2203 c, g =\u1d50[\u03bc] const \u03b1 c\n:= .someMissingNamespaceXYZ\nh.quasiErgodic.ae_eq_const_of_ae_eq_comp\u2080 hgm hg_eq\n\nend CountableSeparatingOnUniv\n\nvariable [TopologicalSpace X] [MetrizableSpace X] [Nonempty X] {f : \u03b1 \u2192 \u03b1}\n\nnamespace QuasiErgodic\n\n/-- Let `f : \u03b1 \u2192 \u03b1` be a quasi-ergodic map.\nLet `g : \u03b1 \u2192 X` be an a.e. strongly measurable function\nfrom `\u03b1` to a nonempty metrizable topological space.\nIf `g` is a.e.-invariant under `f`, then `g` is a.e. constant. -/", "diagnostic": "[CompilationUnit(i_begin=0, i_end=239, messages=[Message(data='`Ergodic.ae_eq_const_of_ae_eq_comp\u2080` has already been declared', pos=Position(line=1, column=8), pos_end=Position(line=1, column=42), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=239, i_end=270, 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=29), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=270, i_end=350, messages=[Message(data='invalid binder annotation, type is not a class instance\\n ?m.3\\n\\nNote: Use the command `set_option checkBinderAnnotations false` to disable the check', pos=Position(line=8, column=31), pos_end=Position(line=8, column=48), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=350, i_end=374, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=374, i_end=600, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=15, column=65), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]", "mutation_kind": "missing_import_open_namespace", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 2570, "declarations_count": 287, "diagnostics_count": 1, "duplicate_fingerprint": "701a0948501dc9de", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 779, "lean_code_chars": 572, "lean_code_ratio": 0.2226, "length_bucket": "short", "line_count": 26, "natural_language_chars": 1998, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.Ergodic.Function).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem Ergodic.ae_eq_const_of_ae_eq_comp\u2080 (h : Ergodic f \u03bc) (hgm : NullMeasurable g \u03bc)\n (hg_eq : g \u2218 f =\u1d50[\u03bc] g) : \u2203 c, g =\u1d50[\u03bc] const \u03b1 c\n:= .someMissingNamespaceXYZ\nh.quasiErgodic.ae_eq_const_of_ae_eq_comp\u2080 hgm hg_eq\n\nend CountableSeparatingOnUniv\n\nvariable [TopologicalSpace X] [MetrizableSpace X] [Nonempty X] {f : \u03b1 \u2192 \u03b1}\n\nnamespace QuasiErgodic\n\n/-- Let `f : \u03b1 \u2192 \u03b1` be a quasi-ergodic map.\nLet `g : \u03b1 \u2192 X` be an a.e. strongly measurable function\nfrom `\u03b1` to a nonempty metrizable topological space.\nIf `g` is a.e.-invariant under `f`, then `g` is a.e. constant. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=239, messages=[Message(data='`Ergodic.ae_eq_const_of_ae_eq_comp\u2080` has already been declared', pos=Position(line=1, column=8), pos_end=Position(line=1, column=42), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=239, i_end=270, 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=29), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=270, i_end=350, messages=[Message(data='invalid binder annotation, type is not a class instance\\n ?m.3\\n\\nNote: Use the command `set_option checkBinderAnnotations false` to disable the check', pos=Position(line=8, column=31), pos_end=Position(line=8, column=48), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=350, i_end=374, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=374, i_end=600, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=15, column=65), 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.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.Ergodic.Function).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem Ergodic.ae_eq_const_of_ae_eq_comp\u2080 (h : Ergodic f \u03bc) (hgm : NullMeasurable g \u03bc)\n (hg_eq : g \u2218 f =\u1d50[\u03bc] g) : \u2203 c, g =\u1d50[\u03bc] const \u03b1 c\n:= .someMissingNamespaceXYZ\nh.quasiErgodic.ae_eq_const_of_ae_eq_comp\u2080 hgm hg_eq\n\nend CountableSeparatingOnUniv\n\nvariable [TopologicalSpace X] [MetrizableSpace X] [Nonempty X] {f : \u03b1 \u2192 \u03b1}\n\nnamespace QuasiErgodic\n\n/-- Let `f : \u03b1 \u2192 \u03b1` be a quasi-ergodic map.\nLet `g : \u03b1 \u2192 X` be an a.e. strongly measurable function\nfrom `\u03b1` to a nonempty metrizable topological space.\nIf `g` is a.e.-invariant under `f`, then `g` is a.e. constant. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=239, messages=[Message(data='`Ergodic.ae_eq_const_of_ae_eq_comp\u2080` has already been declared', pos=Position(line=1, column=8), pos_end=Position(line=1, column=42), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=239, i_end=270, 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=29), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=270, i_end=350, messages=[Message(data='invalid binder annotation, type is not a class instance\\n ?m.3\\n\\nNote: Use the command `set_option checkBinderAnnotations false` to disable the check', pos=Position(line=8, column=31), pos_end=Position(line=8, column=48), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=350, i_end=374, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=374, i_end=600, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=15, column=65), 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]", "sample_id": "B-Mathlib.Dynamics.Ergodic.Function.Ergodic", "source": {"declaration": "Mathlib.Dynamics.Ergodic.Function.Ergodic", "file": "Mathlib/Dynamics/Ergodic/Function.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Dynamics.Ergodic.Function", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Dynamics/Ergodic/Function.lean#L67", "span": "L67-L80"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "F", "construction": {"instruction": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.", "statement": "lemma cofibrations_eq : cofibrations SSet.{u} = monomorphisms _", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 654, "declarations_count": 53, "diagnostics_count": 0, "duplicate_fingerprint": "0ea2c755967c1252", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 181, "lean_code_chars": 64, "lean_code_ratio": 0.0979, "length_bucket": "tiny", "line_count": 7, "natural_language_chars": 590, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplicialSet.CategoryWithFibrations).", "role": "system"}, {"content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\nlemma cofibrations_eq : cofibrations SSet.{u} = monomorphisms _\n```\n\nDeclaration: `Mathlib.AlgebraicTopology.SimplicialSet.CategoryWithFibrations.cofibrations_eq` (module Mathlib.AlgebraicTopology.SimplicialSet.CategoryWithFibrations).", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplicialSet.CategoryWithFibrations).[/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 cofibrations_eq : cofibrations SSet.{u} = monomorphisms _\n```\n\nDeclaration: `Mathlib.AlgebraicTopology.SimplicialSet.CategoryWithFibrations.cofibrations_eq` (module Mathlib.AlgebraicTopology.SimplicialSet.CategoryWithFibrations).[/INST]", "sample_id": "F-Mathlib.AlgebraicTopology.SimplicialSet.CategoryWithFibrations.cofibrations_eq", "source": {"declaration": "Mathlib.AlgebraicTopology.SimplicialSet.CategoryWithFibrations.cofibrations_eq", "file": "Mathlib/AlgebraicTopology/SimplicialSet/CategoryWithFibrations.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.SimplicialSet.CategoryWithFibrations", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/SimplicialSet/CategoryWithFibrations.lean#L75", "span": "L75-L76"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"trace_states": [{"state": "theorem pumping_lemma [Fintype \u03c3] {x : List \u03b1} (hx : x \u2208 M.accepts)\n (hlen : Fintype.card \u03c3 \u2264 List.length x) :\n \u2203 a b c,\n x = a ++ b ++ c \u2227\n a.length + b.length \u2264 Fintype.card \u03c3 \u2227 b \u2260 [] \u2227 {a} * {b}\u2217 * {c} \u2264 M.accepts", "tactic": "obtain \u27e8_, a, b, c, hx, hlen, hnil, rfl, hb, hc\u27e9 := M.evalFrom_split (s := M.start) hlen rfl"}, {"state": "", "tactic": "use a, b, c, hx, hlen, hnil"}, {"state": "", "tactic": "intro y hy"}, {"state": "", "tactic": "rw [Language.mem_mul] at hy rcases hy with \u27e8ab, hab, c', hc', rfl\u27e9"}, {"state": "", "tactic": "rw [Language.mem_mul] at hab rcases hab with \u27e8a', ha', b', hb', rfl\u27e9"}, {"state": "", "tactic": "rw [Set.mem_singleton_iff] at ha' hc' substs ha' hc'"}, {"state": "", "tactic": "have h := M.evalFrom_of_pow hb hb' rwa [mem_accepts, eval, evalFrom_of_append, evalFrom_of_append, h, hc] section Maps variable {\u03b1' \u03c3' : Type*} /-- `M.comap f` pulls back the alphabet of `M` along `f`. In other words, it applies `f` to the input before passing it to `M`. -/"}], "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1874, "declarations_count": 262, "diagnostics_count": 0, "duplicate_fingerprint": "42525c6114b002c9", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 694, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "short", "line_count": 25, "natural_language_chars": 1874, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.DFA).", "role": "system"}, {"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.Computability.DFA.pumping_lemma`:\nState 0: \u22a2 theorem pumping_lemma [Fintype \u03c3] {x : List \u03b1} (hx : x \u2208 M.accepts)\n (hlen : Fintype.card \u03c3 \u2264 List.length x) :\n \u2203 a b c,\n x = a ++ b ++ c \u2227\n a.length + b.length \u2264 Fintype.card \u03c3 \u2227 b \u2260 [] \u2227 {a} * {b}\u2217 * {c} \u2264 M.accepts\nTactic: obtain \u27e8_, a, b, c, hx, hlen, hnil, rfl, hb, hc\u27e9 := M.evalFrom_split (s := M.start) hlen rfl\nState 1: \u22a2 \nTactic: use a, b, c, hx, hlen, hnil\nState 2: \u22a2 \nTactic: intro y hy\nState 3: \u22a2 \nTactic: rw [Language.mem_mul] at hy rcases hy with \u27e8ab, hab, c', hc', rfl\u27e9\nState 4: \u22a2 \nTactic: rw [Language.mem_mul] at hab rcases hab with \u27e8a', ha', b', hb', rfl\u27e9\nState 5: \u22a2 \nTactic: rw [Set.mem_singleton_iff] at ha' hc' substs ha' hc'\nState 6: \u22a2 \nTactic: have h := M.evalFrom_of_pow hb hb' rwa [mem_accepts, eval, evalFrom_of_append, evalFrom_of_append, h, hc] section Maps variable {\u03b1' \u03c3' : Type*} /-- `M.comap f` pulls back the alphabet of `M` along `f`. In other words, it applies `f` to the input before passing it to `M`. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.DFA).[/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.Computability.DFA.pumping_lemma`:\nState 0: \u22a2 theorem pumping_lemma [Fintype \u03c3] {x : List \u03b1} (hx : x \u2208 M.accepts)\n (hlen : Fintype.card \u03c3 \u2264 List.length x) :\n \u2203 a b c,\n x = a ++ b ++ c \u2227\n a.length + b.length \u2264 Fintype.card \u03c3 \u2227 b \u2260 [] \u2227 {a} * {b}\u2217 * {c} \u2264 M.accepts\nTactic: obtain \u27e8_, a, b, c, hx, hlen, hnil, rfl, hb, hc\u27e9 := M.evalFrom_split (s := M.start) hlen rfl\nState 1: \u22a2 \nTactic: use a, b, c, hx, hlen, hnil\nState 2: \u22a2 \nTactic: intro y hy\nState 3: \u22a2 \nTactic: rw [Language.mem_mul] at hy rcases hy with \u27e8ab, hab, c', hc', rfl\u27e9\nState 4: \u22a2 \nTactic: rw [Language.mem_mul] at hab rcases hab with \u27e8a', ha', b', hb', rfl\u27e9\nState 5: \u22a2 \nTactic: rw [Set.mem_singleton_iff] at ha' hc' substs ha' hc'\nState 6: \u22a2 \nTactic: have h := M.evalFrom_of_pow hb hb' rwa [mem_accepts, eval, evalFrom_of_append, evalFrom_of_append, h, hc] section Maps variable {\u03b1' \u03c3' : Type*} /-- `M.comap f` pulls back the alphabet of `M` along `f`. In other words, it applies `f` to the input before passing it to `M`. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.Computability.DFA.pumping_lemma", "source": {"declaration": "Mathlib.Computability.DFA.pumping_lemma", "file": "Mathlib/Computability/DFA.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Computability.DFA", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Computability/DFA.lean#L173", "span": "L173-L197"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\ndef eqv (\u03b1) [Denumerable \u03b1] : \u03b1 \u2243 \u2115 := \u27e8encode, ofNat \u03b1, ofNat_encode, encode_ofNat\u27e9\n\n-- See Note [lower instance priority]\n```", "instruction": "Edit `eqv` so it still compiles and the proof is simplified where possible. Return the full updated `eqv` block.", "proof_is_oneliner": false, "target_span": "L71-L74", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 780, "declarations_count": 86, "diagnostics_count": 0, "duplicate_fingerprint": "b5bc0af0414486bf", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 250, "lean_code_chars": 124, "lean_code_ratio": 0.159, "length_bucket": "tiny", "line_count": 12, "natural_language_chars": 656, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Denumerable).", "role": "system"}, {"content": "You are editing a file in `Mathlib/Logic/Denumerable.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Logic.Denumerable.eqv`, L71-L74)\n```lean\ndef eqv (\u03b1) [Denumerable \u03b1] : \u03b1 \u2243 \u2115 := \u27e8encode, ofNat \u03b1, ofNat_encode, encode_ofNat\u27e9\n\n-- See Note [lower instance priority]\n```\n\n## Edit instruction\nEdit `eqv` so it still compiles and the proof is simplified where possible. Return the full updated `eqv` block.\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Denumerable).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Logic/Denumerable.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Logic.Denumerable.eqv`, L71-L74)\n```lean\ndef eqv (\u03b1) [Denumerable \u03b1] : \u03b1 \u2243 \u2115 := \u27e8encode, ofNat \u03b1, ofNat_encode, encode_ofNat\u27e9\n\n-- See Note [lower instance priority]\n```\n\n## Edit instruction\nEdit `eqv` so it still compiles and the proof is simplified where possible. Return the full updated `eqv` block.\n[/INST]", "sample_id": "D-Mathlib.Logic.Denumerable.eqv", "source": {"declaration": "Mathlib.Logic.Denumerable.eqv", "file": "Mathlib/Logic/Denumerable.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Logic.Denumerable", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Logic/Denumerable.lean#L71", "span": "L71-L74"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "def whenLinterActivated (opt : Lean.Option Bool) (x : CommandElab) (breakOnError\n:= true) : thisIsWrongLemmaNameXYZ\nCommandElab :=\n withSetOptionIn fun stx => whenLinterOption opt do\n unless \u2190 pure breakOnError <&&> MonadLog.hasErrors do\n x stx\n\nend Lean.Linter", "diagnostic": "[CompilationUnit(i_begin=0, i_end=257, messages=[Message(data=\"Function expected at\\n thisIsWrongLemmaNameXYZ\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n CommandElab\\n\\nHint: The identifier `thisIsWrongLemmaNameXYZ` 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=11), pos_end=Position(line=3, column=11), severity=, kind=None), Message(data='Unknown identifier `withSetOptionIn`', pos=Position(line=4, column=2), pos_end=Position(line=4, column=17), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=257, i_end=272, 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=15), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]", "mutation_kind": "rewrite_lemma_name_broken", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 2095, "declarations_count": 253, "diagnostics_count": 1, "duplicate_fingerprint": "0d3f63fcb66b36b9", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 570, "lean_code_chars": 271, "lean_code_ratio": 0.1294, "length_bucket": "short", "line_count": 19, "natural_language_chars": 1824, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Lean.Linter).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef whenLinterActivated (opt : Lean.Option Bool) (x : CommandElab) (breakOnError\n:= true) : thisIsWrongLemmaNameXYZ\nCommandElab :=\n withSetOptionIn fun stx => whenLinterOption opt do\n unless \u2190 pure breakOnError <&&> MonadLog.hasErrors do\n x stx\n\nend Lean.Linter\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=257, messages=[Message(data=\"Function expected at\\n thisIsWrongLemmaNameXYZ\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n CommandElab\\n\\nHint: The identifier `thisIsWrongLemmaNameXYZ` 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=11), pos_end=Position(line=3, column=11), severity=, kind=None), Message(data='Unknown identifier `withSetOptionIn`', pos=Position(line=4, column=2), pos_end=Position(line=4, column=17), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=257, i_end=272, 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=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.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Lean.Linter).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef whenLinterActivated (opt : Lean.Option Bool) (x : CommandElab) (breakOnError\n:= true) : thisIsWrongLemmaNameXYZ\nCommandElab :=\n withSetOptionIn fun stx => whenLinterOption opt do\n unless \u2190 pure breakOnError <&&> MonadLog.hasErrors do\n x stx\n\nend Lean.Linter\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=257, messages=[Message(data=\"Function expected at\\n thisIsWrongLemmaNameXYZ\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n CommandElab\\n\\nHint: The identifier `thisIsWrongLemmaNameXYZ` 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=11), pos_end=Position(line=3, column=11), severity=, kind=None), Message(data='Unknown identifier `withSetOptionIn`', pos=Position(line=4, column=2), pos_end=Position(line=4, column=17), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=257, i_end=272, 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=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]", "sample_id": "B-Mathlib.Lean.Linter.whenLinterActivated", "source": {"declaration": "Mathlib.Lean.Linter.whenLinterActivated", "file": "Mathlib/Lean/Linter.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Lean.Linter", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Lean/Linter.lean#L67", "span": "L67-L73"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem birkhoffSum_succ' (f : \u03b1 \u2192 \u03b1) (g : \u03b1 \u2192 M) (n : \u2115) (x : \u03b1) :\n birkhoffSum f g (n + 1) x = g x + birkhoffSum f g n (f x)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 540, "declarations_count": 66, "diagnostics_count": 0, "duplicate_fingerprint": "a3134448a58efa60", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 177, "lean_code_chars": 130, "lean_code_ratio": 0.2407, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 410, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.BirkhoffSum.Basic).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem birkhoffSum_succ' (f : \u03b1 \u2192 \u03b1) (g : \u03b1 \u2192 M) (n : \u2115) (x : \u03b1) :\n birkhoffSum f g (n + 1) x = g x + birkhoffSum f g n (f x)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.BirkhoffSum.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem birkhoffSum_succ' (f : \u03b1 \u2192 \u03b1) (g : \u03b1 \u2192 M) (n : \u2115) (x : \u03b1) :\n birkhoffSum f g (n + 1) x = g x + birkhoffSum f g n (f x)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Dynamics.BirkhoffSum.Basic.birkhoffSum_succ'", "source": {"declaration": "Mathlib.Dynamics.BirkhoffSum.Basic.birkhoffSum_succ'", "file": "Mathlib/Dynamics/BirkhoffSum/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Dynamics.BirkhoffSum.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Dynamics/BirkhoffSum/Basic.lean#L51", "span": "L51-L54"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem finSumFinEquiv_symm_last : finSumFinEquiv.symm (Fin.last n) = Sum.inr 0", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 485, "declarations_count": 52, "diagnostics_count": 0, "duplicate_fingerprint": "efbb55989533afcc", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 144, "lean_code_chars": 80, "lean_code_ratio": 0.1649, "length_bucket": "tiny", "line_count": 7, "natural_language_chars": 405, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Equiv.Fin.Basic).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem finSumFinEquiv_symm_last : finSumFinEquiv.symm (Fin.last n) = Sum.inr 0\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Equiv.Fin.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem finSumFinEquiv_symm_last : finSumFinEquiv.symm (Fin.last n) = Sum.inr 0\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Logic.Equiv.Fin.Basic.finSumFinEquiv_symm_last", "source": {"declaration": "Mathlib.Logic.Equiv.Fin.Basic.finSumFinEquiv_symm_last", "file": "Mathlib/Logic/Equiv/Fin/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Logic.Equiv.Fin.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Logic/Equiv/Fin/Basic.lean#L255", "span": "L255-L259"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem commute_int_add (n : \u2124) : Function.Commute f (n + \u00b7)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 493, "declarations_count": 52, "diagnostics_count": 0, "duplicate_fingerprint": "d98461c7f2478d8f", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 137, "lean_code_chars": 61, "lean_code_ratio": 0.1237, "length_bucket": "tiny", "line_count": 7, "natural_language_chars": 432, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 1.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.Circle.RotationNumber.TranslationNumber).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem commute_int_add (n : \u2124) : Function.Commute f (n + \u00b7)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.Circle.RotationNumber.TranslationNumber).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem commute_int_add (n : \u2124) : Function.Commute f (n + \u00b7)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Dynamics.Circle.RotationNumber.TranslationNumber.commute_int_add", "source": {"declaration": "Mathlib.Dynamics.Circle.RotationNumber.TranslationNumber.commute_int_add", "file": "Mathlib/Dynamics/Circle/RotationNumber/TranslationNumber.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Dynamics.Circle.RotationNumber.TranslationNumber", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Dynamics/Circle/RotationNumber/TranslationNumber.lean#L308", "span": "L308-L310"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\ntheorem wellFounded_of_isEmpty {\u03b1} [IsEmpty \u03b1] (r : \u03b1 \u2192 \u03b1 \u2192 Prop) : WellFounded r := \u27e8isEmptyElim\u27e9\n\nvariable (\u03b1)\n```", "instruction": "Edit `wellFounded_of_isEmpty` so it still compiles and the proof is simplified where possible. Return the full updated `wellFounded_of_isEmpty` block.", "proof_is_oneliner": false, "target_span": "L78-L82", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 832, "declarations_count": 84, "diagnostics_count": 0, "duplicate_fingerprint": "c10baf32c05c5172", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 267, "lean_code_chars": 113, "lean_code_ratio": 0.1358, "length_bucket": "tiny", "line_count": 12, "natural_language_chars": 719, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.IsEmpty.Basic).", "role": "system"}, {"content": "You are editing a file in `Mathlib/Logic/IsEmpty/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Logic.IsEmpty.Basic.wellFounded_of_isEmpty`, L78-L82)\n```lean\ntheorem wellFounded_of_isEmpty {\u03b1} [IsEmpty \u03b1] (r : \u03b1 \u2192 \u03b1 \u2192 Prop) : WellFounded r := \u27e8isEmptyElim\u27e9\n\nvariable (\u03b1)\n```\n\n## Edit instruction\nEdit `wellFounded_of_isEmpty` so it still compiles and the proof is simplified where possible. Return the full updated `wellFounded_of_isEmpty` block.\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.IsEmpty.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Logic/IsEmpty/Basic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Logic.IsEmpty.Basic.wellFounded_of_isEmpty`, L78-L82)\n```lean\ntheorem wellFounded_of_isEmpty {\u03b1} [IsEmpty \u03b1] (r : \u03b1 \u2192 \u03b1 \u2192 Prop) : WellFounded r := \u27e8isEmptyElim\u27e9\n\nvariable (\u03b1)\n```\n\n## Edit instruction\nEdit `wellFounded_of_isEmpty` so it still compiles and the proof is simplified where possible. Return the full updated `wellFounded_of_isEmpty` block.\n[/INST]", "sample_id": "D-Mathlib.Logic.IsEmpty.Basic.wellFounded_of_isEmpty", "source": {"declaration": "Mathlib.Logic.IsEmpty.Basic.wellFounded_of_isEmpty", "file": "Mathlib/Logic/IsEmpty/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Logic.IsEmpty.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Logic/IsEmpty/Basic.lean#L78", "span": "L78-L82"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "F", "construction": {"instruction": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.", "statement": "theorem FriendlyOperationClass.comp (F : \u03b3 \u2192 Seq \u03b1 \u2192 Seq \u03b1) (g : \u03b3' \u2192 \u03b3)\n [h : FriendlyOperationClass F] : FriendlyOperationClass (fun c \u21a6 F (g c))", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 733, "declarations_count": 61, "diagnostics_count": 0, "duplicate_fingerprint": "312b39816d1ea940", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 210, "lean_code_chars": 151, "lean_code_ratio": 0.206, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 582, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion).", "role": "system"}, {"content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\ntheorem FriendlyOperationClass.comp (F : \u03b3 \u2192 Seq \u03b1 \u2192 Seq \u03b1) (g : \u03b3' \u2192 \u03b3)\n [h : FriendlyOperationClass F] : FriendlyOperationClass (fun c \u21a6 F (g c))\n```\n\nDeclaration: `Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.FriendlyOperationClass` (module Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion).", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion).[/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 FriendlyOperationClass.comp (F : \u03b3 \u2192 Seq \u03b1 \u2192 Seq \u03b1) (g : \u03b3' \u2192 \u03b3)\n [h : FriendlyOperationClass F] : FriendlyOperationClass (fun c \u21a6 F (g c))\n```\n\nDeclaration: `Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.FriendlyOperationClass` (module Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion).[/INST]", "sample_id": "F-Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.FriendlyOperationClass", "source": {"declaration": "Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion.FriendlyOperationClass", "file": "Mathlib/Tactic/ComputeAsymptotics/Multiseries/Corecursion.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/ComputeAsymptotics/Multiseries/Corecursion.lean#L188", "span": "L188-L191"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem mul_eq_eval\u2081 [CommGroupWithZero M] (a\u2081 : \u2124 \u00d7 M) {a\u2082 : \u2124 \u00d7 M} {l\u2081 l\u2082 l : NF M}\n (h : l\u2081.eval * (a\u2082 ::\u1d63 l\u2082).eval = l.eval) :\n (a\u2081 ::\u1d63 l\u2081).eval * (a\u2082 ::\u1d63 l\u2082).eval = (a\u2081 ::\u1d63 l).eval", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 599, "declarations_count": 75, "diagnostics_count": 0, "duplicate_fingerprint": "7179c14e0e05c1c7", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 220, "lean_code_chars": 192, "lean_code_ratio": 0.3205, "length_bucket": "tiny", "line_count": 9, "natural_language_chars": 407, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 1.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.FieldSimp.Lemmas).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem mul_eq_eval\u2081 [CommGroupWithZero M] (a\u2081 : \u2124 \u00d7 M) {a\u2082 : \u2124 \u00d7 M} {l\u2081 l\u2082 l : NF M}\n (h : l\u2081.eval * (a\u2082 ::\u1d63 l\u2082).eval = l.eval) :\n (a\u2081 ::\u1d63 l\u2081).eval * (a\u2082 ::\u1d63 l\u2082).eval = (a\u2081 ::\u1d63 l).eval\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.FieldSimp.Lemmas).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem mul_eq_eval\u2081 [CommGroupWithZero M] (a\u2081 : \u2124 \u00d7 M) {a\u2082 : \u2124 \u00d7 M} {l\u2081 l\u2082 l : NF M}\n (h : l\u2081.eval * (a\u2082 ::\u1d63 l\u2082).eval = l.eval) :\n (a\u2081 ::\u1d63 l\u2081).eval * (a\u2082 ::\u1d63 l\u2082).eval = (a\u2081 ::\u1d63 l).eval\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Tactic.FieldSimp.Lemmas.mul_eq_eval\u2081", "source": {"declaration": "Mathlib.Tactic.FieldSimp.Lemmas.mul_eq_eval\u2081", "file": "Mathlib/Tactic/FieldSimp/Lemmas.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.FieldSimp.Lemmas", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/FieldSimp/Lemmas.lean#L228", "span": "L228-L233"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\ntheorem refl_trans : (PartialEquiv.refl \u03b1).trans e = e := PartialEquiv.ext (fun _ => rfl) (fun _ => rfl) (by simp [trans_source, preimage_id])\n```", "instruction": "Edit `refl_trans` so it still compiles and the proof is simplified where possible. Return the full updated `refl_trans` block.", "proof_is_oneliner": false, "target_span": "L641-L643", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 843, "declarations_count": 92, "diagnostics_count": 0, "duplicate_fingerprint": "4716f79bed114a89", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 273, "lean_code_chars": 143, "lean_code_ratio": 0.1696, "length_bucket": "tiny", "line_count": 10, "natural_language_chars": 700, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Equiv.PartialEquiv).", "role": "system"}, {"content": "You are editing a file in `Mathlib/Logic/Equiv/PartialEquiv.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Logic.Equiv.PartialEquiv.refl_trans`, L641-L643)\n```lean\ntheorem refl_trans : (PartialEquiv.refl \u03b1).trans e = e := PartialEquiv.ext (fun _ => rfl) (fun _ => rfl) (by simp [trans_source, preimage_id])\n```\n\n## Edit instruction\nEdit `refl_trans` so it still compiles and the proof is simplified where possible. Return the full updated `refl_trans` block.\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Equiv.PartialEquiv).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Logic/Equiv/PartialEquiv.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Logic.Equiv.PartialEquiv.refl_trans`, L641-L643)\n```lean\ntheorem refl_trans : (PartialEquiv.refl \u03b1).trans e = e := PartialEquiv.ext (fun _ => rfl) (fun _ => rfl) (by simp [trans_source, preimage_id])\n```\n\n## Edit instruction\nEdit `refl_trans` so it still compiles and the proof is simplified where possible. Return the full updated `refl_trans` block.\n[/INST]", "sample_id": "D-Mathlib.Logic.Equiv.PartialEquiv.refl_trans", "source": {"declaration": "Mathlib.Logic.Equiv.PartialEquiv.refl_trans", "file": "Mathlib/Logic/Equiv/PartialEquiv.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Logic.Equiv.PartialEquiv", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Logic/Equiv/PartialEquiv.lean#L641", "span": "L641-L643"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\ntheorem eval_bicategoricalComp\n {\u03b7 \u03b7' : f \u27f6 g} {\u03b1 : g \u2245 h} {\u03b8 \u03b8' : h \u27f6 i} {\u03b1\u03b8 : g \u27f6 i} {\u03b7\u03b1\u03b8 : f \u27f6 i}\n (e_\u03b7 : \u03b7 = \u03b7') (e_\u03b8 : \u03b8 = \u03b8') (e_\u03b1\u03b8 : \u03b1.hom \u226b \u03b8' = \u03b1\u03b8) (e_\u03b7\u03b1\u03b8 : \u03b7' \u226b \u03b1\u03b8 = \u03b7\u03b1\u03b8) :\n \u03b7 \u226b \u03b1.hom \u226b \u03b8 = \u03b7\u03b1\u03b8 := by\nsimp [e_\u03b7, e_\u03b8, e_\u03b1\u03b8, e_\u03b7\u03b1\u03b8]\n```", "instruction": "Edit `eval_bicategoricalComp` so it still compiles and the proof is simplified where possible. Return the full updated `eval_bicategoricalComp` block.", "proof_is_oneliner": false, "target_span": "L153-L158", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1038, "declarations_count": 100, "diagnostics_count": 0, "duplicate_fingerprint": "9d1f0270e0163589", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 388, "lean_code_chars": 248, "lean_code_ratio": 0.2389, "length_bucket": "tiny", "line_count": 14, "natural_language_chars": 790, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.CategoryTheory.Bicategory.Normalize).", "role": "system"}, {"content": "You are editing a file in `Mathlib/Tactic/CategoryTheory/Bicategory/Normalize.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.eval_bicategoricalComp`, L153-L158)\n```lean\ntheorem eval_bicategoricalComp\n {\u03b7 \u03b7' : f \u27f6 g} {\u03b1 : g \u2245 h} {\u03b8 \u03b8' : h \u27f6 i} {\u03b1\u03b8 : g \u27f6 i} {\u03b7\u03b1\u03b8 : f \u27f6 i}\n (e_\u03b7 : \u03b7 = \u03b7') (e_\u03b8 : \u03b8 = \u03b8') (e_\u03b1\u03b8 : \u03b1.hom \u226b \u03b8' = \u03b1\u03b8) (e_\u03b7\u03b1\u03b8 : \u03b7' \u226b \u03b1\u03b8 = \u03b7\u03b1\u03b8) :\n \u03b7 \u226b \u03b1.hom \u226b \u03b8 = \u03b7\u03b1\u03b8 := by\nsimp [e_\u03b7, e_\u03b8, e_\u03b1\u03b8, e_\u03b7\u03b1\u03b8]\n```\n\n## Edit instruction\nEdit `eval_bicategoricalComp` so it still compiles and the proof is simplified where possible. Return the full updated `eval_bicategoricalComp` block.\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.CategoryTheory.Bicategory.Normalize).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Tactic/CategoryTheory/Bicategory/Normalize.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.eval_bicategoricalComp`, L153-L158)\n```lean\ntheorem eval_bicategoricalComp\n {\u03b7 \u03b7' : f \u27f6 g} {\u03b1 : g \u2245 h} {\u03b8 \u03b8' : h \u27f6 i} {\u03b1\u03b8 : g \u27f6 i} {\u03b7\u03b1\u03b8 : f \u27f6 i}\n (e_\u03b7 : \u03b7 = \u03b7') (e_\u03b8 : \u03b8 = \u03b8') (e_\u03b1\u03b8 : \u03b1.hom \u226b \u03b8' = \u03b1\u03b8) (e_\u03b7\u03b1\u03b8 : \u03b7' \u226b \u03b1\u03b8 = \u03b7\u03b1\u03b8) :\n \u03b7 \u226b \u03b1.hom \u226b \u03b8 = \u03b7\u03b1\u03b8 := by\nsimp [e_\u03b7, e_\u03b8, e_\u03b1\u03b8, e_\u03b7\u03b1\u03b8]\n```\n\n## Edit instruction\nEdit `eval_bicategoricalComp` so it still compiles and the proof is simplified where possible. Return the full updated `eval_bicategoricalComp` block.\n[/INST]", "sample_id": "D-Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.eval_bicategoricalComp", "source": {"declaration": "Mathlib.Tactic.CategoryTheory.Bicategory.Normalize.eval_bicategoricalComp", "file": "Mathlib/Tactic/CategoryTheory/Bicategory/Normalize.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.CategoryTheory.Bicategory.Normalize", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/CategoryTheory/Bicategory/Normalize.lean#L153", "span": "L153-L158"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"trace_states": [{"state": "theorem rfind' {f} (hf : Nat.Partrec f) :\n Nat.Partrec\n (Nat.unpaired fun a m =>\n (Nat.rfind fun n => (fun m => m = 0) <$> f (Nat.pair a (n + m))).map (\u00b7 + m))", "tactic": "refine Partrec.map ((@Partrec\u2082.unpaired' fun a b : \u2115 => Nat.rfind fun n => (fun m => m = 0) <$> f (Nat.pair a (n + b))).1 ?_) (Primrec.nat_add.comp Primrec.snd <| Primrec.snd.comp Primrec.fst).to_comp.to\u2082"}, {"state": "", "tactic": "have : Nat.Partrec (fun a => Nat.rfind (fun n => (fun m => decide (m = 0)) <$> Nat.unpaired (fun a b => f (Nat.pair (Nat.unpair a).1 (b + (Nat.unpair a).2))) (Nat.pair a n))) := rfind (Partrec\u2082.unpaired'.2 ((Partrec.nat_iff.2 hf).comp (Primrec\u2082.pair.comp (Primrec.fst.comp <| Primrec.unpair.comp Primrec.fst) (Primrec.nat_add.comp Primrec.snd (Primrec.snd.comp <| Primrec.unpair.comp Primrec.fst))).to_comp))"}, {"state": " Nat.rfind (fun n => (fun m => decide (m = 0)) <$>>", "tactic": "simpa /-- Code for partial recursive functions from \u2115 to \u2115. See `Nat.Partrec.Code.eval` for the interpretation of these constructors. -/ inductive Code : Type | zero : Code | succ : Code | left : Code | right : Code | pair : Code \u2192 Code \u2192 Code | comp : Code \u2192 Code \u2192 Code | prec : Code \u2192 Code \u2192 Code | rfind' : Code \u2192 Code compile_inductive% Code end Nat.Partrec namespace Nat.Partrec.Code"}], "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1979, "declarations_count": 232, "diagnostics_count": 0, "duplicate_fingerprint": "3fd59401e8763592", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 655, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "short", "line_count": 16, "natural_language_chars": 1979, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.PartrecCode).", "role": "system"}, {"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.Computability.PartrecCode.rfind'`:\nState 0: \u22a2 theorem rfind' {f} (hf : Nat.Partrec f) :\n Nat.Partrec\n (Nat.unpaired fun a m =>\n (Nat.rfind fun n => (fun m => m = 0) <$> f (Nat.pair a (n + m))).map (\u00b7 + m))\nTactic: refine Partrec.map ((@Partrec\u2082.unpaired' fun a b : \u2115 => Nat.rfind fun n => (fun m => m = 0) <$> f (Nat.pair a (n + b))).1 ?_) (Primrec.nat_add.comp Primrec.snd <| Primrec.snd.comp Primrec.fst).to_comp.to\u2082\nState 1: \u22a2 \nTactic: have : Nat.Partrec (fun a => Nat.rfind (fun n => (fun m => decide (m = 0)) <$> Nat.unpaired (fun a b => f (Nat.pair (Nat.unpair a).1 (b + (Nat.unpair a).2))) (Nat.pair a n))) := rfind (Partrec\u2082.unpaired'.2 ((Partrec.nat_iff.2 hf).comp (Primrec\u2082.pair.comp (Primrec.fst.comp <| Primrec.unpair.comp Primrec.fst) (Primrec.nat_add.comp Primrec.snd (Primrec.snd.comp <| Primrec.unpair.comp Primrec.fst))).to_comp))\nState 2: \u22a2 Nat.rfind (fun n => (fun m => decide (m = 0)) <$>>\nTactic: simpa /-- Code for partial recursive functions from \u2115 to \u2115. See `Nat.Partrec.Code.eval` for the interpretation of these constructors. -/ inductive Code : Type | zero : Code | succ : Code | left : Code | right : Code | pair : Code \u2192 Code \u2192 Code | comp : Code \u2192 Code \u2192 Code | prec : Code \u2192 Code \u2192 Code | rfind' : Code \u2192 Code compile_inductive% Code end Nat.Partrec namespace Nat.Partrec.Code\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.PartrecCode).[/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.Computability.PartrecCode.rfind'`:\nState 0: \u22a2 theorem rfind' {f} (hf : Nat.Partrec f) :\n Nat.Partrec\n (Nat.unpaired fun a m =>\n (Nat.rfind fun n => (fun m => m = 0) <$> f (Nat.pair a (n + m))).map (\u00b7 + m))\nTactic: refine Partrec.map ((@Partrec\u2082.unpaired' fun a b : \u2115 => Nat.rfind fun n => (fun m => m = 0) <$> f (Nat.pair a (n + b))).1 ?_) (Primrec.nat_add.comp Primrec.snd <| Primrec.snd.comp Primrec.fst).to_comp.to\u2082\nState 1: \u22a2 \nTactic: have : Nat.Partrec (fun a => Nat.rfind (fun n => (fun m => decide (m = 0)) <$> Nat.unpaired (fun a b => f (Nat.pair (Nat.unpair a).1 (b + (Nat.unpair a).2))) (Nat.pair a n))) := rfind (Partrec\u2082.unpaired'.2 ((Partrec.nat_iff.2 hf).comp (Primrec\u2082.pair.comp (Primrec.fst.comp <| Primrec.unpair.comp Primrec.fst) (Primrec.nat_add.comp Primrec.snd (Primrec.snd.comp <| Primrec.unpair.comp Primrec.fst))).to_comp))\nState 2: \u22a2 Nat.rfind (fun n => (fun m => decide (m = 0)) <$>>\nTactic: simpa /-- Code for partial recursive functions from \u2115 to \u2115. See `Nat.Partrec.Code.eval` for the interpretation of these constructors. -/ inductive Code : Type | zero : Code | succ : Code | left : Code | right : Code | pair : Code \u2192 Code \u2192 Code | comp : Code \u2192 Code \u2192 Code | prec : Code \u2192 Code \u2192 Code | rfind' : Code \u2192 Code compile_inductive% Code end Nat.Partrec namespace Nat.Partrec.Code\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.Computability.PartrecCode.rfind'", "source": {"declaration": "Mathlib.Computability.PartrecCode.rfind'", "file": "Mathlib/Computability/PartrecCode.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Computability.PartrecCode", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Computability/PartrecCode.lean#L51", "span": "L51-L91"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "abbrev functor : Type (u + 1) \u2964 CondensedSet.{u}\n:= thisIsWrongLemmaNameXYZ\nCompHausLike.LocallyConstant.functor.{u, u + 1} (P := fun _ \u21a6 True)\n (hs := fun _ _ _ \u21a6 ((CompHaus.effectiveEpi_tfae _).out 0 2).mp)\n\n/--\n`CondensedSet.LocallyConstant.functor` is isomorphic to `Condensed.discrete`\n(by uniqueness of adjoints).\n-/\nnoncomputable def iso : functor \u2245 discrete (Type (u + 1)) :=\n (LocallyConstant.adjunction _ _).leftAdjointUniq (discreteUnderlyingAdj _)\n\n/-- `CondensedSet.LocallyConstant.functor` is fully faithful. -/\nnoncomputable def functorFullyFaithful : functor.FullyFaithful :=\n (LocallyConstant.adjunction.{u, u + 1} _ _).fullyFaithfulLOfIsIsoUnit\n\nnoncomputable instance : functor.Faithful := functorFullyFaithful.faithful\n\nnoncomputable instance : functor.Full := functorFullyFaithful.full", "diagnostic": "[CompilationUnit(i_begin=0, i_end=30, messages=[Message(data='expected token', pos=Position(line=1, column=30), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=30, i_end=473, messages=[Message(data=\"Function expected at\\n discrete\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n (Type (u + 1))\\n\\nHint: The identifier `discrete` 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=10, column=34), pos_end=Position(line=10, column=57), severity=, kind=None), Message(data='Unknown constant `LocallyConstant.adjunction`', pos=Position(line=11, column=3), pos_end=Position(line=11, column=29), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=473, i_end=677, messages=[Message(data='Unknown constant `functor.FullyFaithful`', pos=Position(line=14, column=41), pos_end=Position(line=14, column=62), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='unknown universe level `u`', pos=Position(line=15, column=34), pos_end=Position(line=15, column=35), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=677, i_end=753, messages=[Message(data='Unknown constant `functor.Faithful`', pos=Position(line=17, column=25), pos_end=Position(line=17, column=41), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=753, i_end=819, messages=[Message(data='Unknown constant `functor.Full`', pos=Position(line=19, column=25), pos_end=Position(line=19, column=37), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]", "mutation_kind": "rewrite_lemma_name_broken", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 3676, "declarations_count": 382, "diagnostics_count": 1, "duplicate_fingerprint": "b115056456c3ba47", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1083, "lean_code_chars": 812, "lean_code_ratio": 0.2209, "length_bucket": "short", "line_count": 30, "natural_language_chars": 2864, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Condensed.Discrete.LocallyConstant).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\nabbrev functor : Type (u + 1) \u2964 CondensedSet.{u}\n:= thisIsWrongLemmaNameXYZ\nCompHausLike.LocallyConstant.functor.{u, u + 1} (P := fun _ \u21a6 True)\n (hs := fun _ _ _ \u21a6 ((CompHaus.effectiveEpi_tfae _).out 0 2).mp)\n\n/--\n`CondensedSet.LocallyConstant.functor` is isomorphic to `Condensed.discrete`\n(by uniqueness of adjoints).\n-/\nnoncomputable def iso : functor \u2245 discrete (Type (u + 1)) :=\n (LocallyConstant.adjunction _ _).leftAdjointUniq (discreteUnderlyingAdj _)\n\n/-- `CondensedSet.LocallyConstant.functor` is fully faithful. -/\nnoncomputable def functorFullyFaithful : functor.FullyFaithful :=\n (LocallyConstant.adjunction.{u, u + 1} _ _).fullyFaithfulLOfIsIsoUnit\n\nnoncomputable instance : functor.Faithful := functorFullyFaithful.faithful\n\nnoncomputable instance : functor.Full := functorFullyFaithful.full\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=30, messages=[Message(data='expected token', pos=Position(line=1, column=30), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=30, i_end=473, messages=[Message(data=\"Function expected at\\n discrete\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n (Type (u + 1))\\n\\nHint: The identifier `discrete` 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=10, column=34), pos_end=Position(line=10, column=57), severity=, kind=None), Message(data='Unknown constant `LocallyConstant.adjunction`', pos=Position(line=11, column=3), pos_end=Position(line=11, column=29), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=473, i_end=677, messages=[Message(data='Unknown constant `functor.FullyFaithful`', pos=Position(line=14, column=41), pos_end=Position(line=14, column=62), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='unknown universe level `u`', pos=Position(line=15, column=34), pos_end=Position(line=15, column=35), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=677, i_end=753, messages=[Message(data='Unknown constant `functor.Faithful`', pos=Position(line=17, column=25), pos_end=Position(line=17, column=41), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=753, i_end=819, messages=[Message(data='Unknown constant `functor.Full`', pos=Position(line=19, column=25), pos_end=Position(line=19, column=37), 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.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Condensed.Discrete.LocallyConstant).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nabbrev functor : Type (u + 1) \u2964 CondensedSet.{u}\n:= thisIsWrongLemmaNameXYZ\nCompHausLike.LocallyConstant.functor.{u, u + 1} (P := fun _ \u21a6 True)\n (hs := fun _ _ _ \u21a6 ((CompHaus.effectiveEpi_tfae _).out 0 2).mp)\n\n/--\n`CondensedSet.LocallyConstant.functor` is isomorphic to `Condensed.discrete`\n(by uniqueness of adjoints).\n-/\nnoncomputable def iso : functor \u2245 discrete (Type (u + 1)) :=\n (LocallyConstant.adjunction _ _).leftAdjointUniq (discreteUnderlyingAdj _)\n\n/-- `CondensedSet.LocallyConstant.functor` is fully faithful. -/\nnoncomputable def functorFullyFaithful : functor.FullyFaithful :=\n (LocallyConstant.adjunction.{u, u + 1} _ _).fullyFaithfulLOfIsIsoUnit\n\nnoncomputable instance : functor.Faithful := functorFullyFaithful.faithful\n\nnoncomputable instance : functor.Full := functorFullyFaithful.full\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=30, messages=[Message(data='expected token', pos=Position(line=1, column=30), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=30, i_end=473, messages=[Message(data=\"Function expected at\\n discrete\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n (Type (u + 1))\\n\\nHint: The identifier `discrete` 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=10, column=34), pos_end=Position(line=10, column=57), severity=, kind=None), Message(data='Unknown constant `LocallyConstant.adjunction`', pos=Position(line=11, column=3), pos_end=Position(line=11, column=29), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=473, i_end=677, messages=[Message(data='Unknown constant `functor.FullyFaithful`', pos=Position(line=14, column=41), pos_end=Position(line=14, column=62), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='unknown universe level `u`', pos=Position(line=15, column=34), pos_end=Position(line=15, column=35), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=677, i_end=753, messages=[Message(data='Unknown constant `functor.Faithful`', pos=Position(line=17, column=25), pos_end=Position(line=17, column=41), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=753, i_end=819, messages=[Message(data='Unknown constant `functor.Full`', pos=Position(line=19, column=25), pos_end=Position(line=19, column=37), 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]", "sample_id": "B-Mathlib.Condensed.Discrete.LocallyConstant.functor", "source": {"declaration": "Mathlib.Condensed.Discrete.LocallyConstant.functor", "file": "Mathlib/Condensed/Discrete/LocallyConstant.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Condensed.Discrete.LocallyConstant", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Condensed/Discrete/LocallyConstant.lean#L367", "span": "L367-L385"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "def truncation (n : \u2115) : SimplicialObject C \u2964 SimplicialObject.Truncated C n", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 501, "declarations_count": 54, "diagnostics_count": 0, "duplicate_fingerprint": "fc954c539c761ef0", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 145, "lean_code_chars": 77, "lean_code_ratio": 0.1537, "length_bucket": "tiny", "line_count": 7, "natural_language_chars": 424, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplicialObject.Basic).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ndef truncation (n : \u2115) : SimplicialObject C \u2964 SimplicialObject.Truncated C n\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplicialObject.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ndef truncation (n : \u2115) : SimplicialObject C \u2964 SimplicialObject.Truncated C n\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.AlgebraicTopology.SimplicialObject.Basic.truncation", "source": {"declaration": "Mathlib.AlgebraicTopology.SimplicialObject.Basic.truncation", "file": "Mathlib/AlgebraicTopology/SimplicialObject/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.SimplicialObject.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/SimplicialObject/Basic.lean#L275", "span": "L275-L278"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "theorem functor_comp_id {F} [AF : Functor F] [LawfulFunctor F] :\n Comp.functor (G\n:= Id) = AF := thisIsWrongLemmaNameXYZ\n@Functor.ext F _ AF (Comp.lawfulFunctor (G := Id)) _ fun _ _ _ _ => rfl", "diagnostic": "[CompilationUnit(i_begin=0, i_end=195, messages=[Message(data='Unknown identifier `Comp.functor`', pos=Position(line=2, column=4), pos_end=Position(line=2, column=16), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `thisIsWrongLemmaNameXYZ`', pos=Position(line=3, column=15), pos_end=Position(line=3, column=38), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]", "mutation_kind": "rewrite_lemma_name_broken", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1192, "declarations_count": 127, "diagnostics_count": 1, "duplicate_fingerprint": "1c3f30eedb1805fd", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 346, "lean_code_chars": 196, "lean_code_ratio": 0.1644, "length_bucket": "tiny", "line_count": 15, "natural_language_chars": 996, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Control.Functor).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem functor_comp_id {F} [AF : Functor F] [LawfulFunctor F] :\n Comp.functor (G\n:= Id) = AF := thisIsWrongLemmaNameXYZ\n@Functor.ext F _ AF (Comp.lawfulFunctor (G := Id)) _ fun _ _ _ _ => rfl\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=195, messages=[Message(data='Unknown identifier `Comp.functor`', pos=Position(line=2, column=4), pos_end=Position(line=2, column=16), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `thisIsWrongLemmaNameXYZ`', pos=Position(line=3, column=15), pos_end=Position(line=3, column=38), 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.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Control.Functor).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem functor_comp_id {F} [AF : Functor F] [LawfulFunctor F] :\n Comp.functor (G\n:= Id) = AF := thisIsWrongLemmaNameXYZ\n@Functor.ext F _ AF (Comp.lawfulFunctor (G := Id)) _ fun _ _ _ _ => rfl\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=195, messages=[Message(data='Unknown identifier `Comp.functor`', pos=Position(line=2, column=4), pos_end=Position(line=2, column=16), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `thisIsWrongLemmaNameXYZ`', pos=Position(line=3, column=15), pos_end=Position(line=3, column=38), 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]", "sample_id": "B-Mathlib.Control.Functor.functor_comp_id", "source": {"declaration": "Mathlib.Control.Functor.functor_comp_id", "file": "Mathlib/Control/Functor.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Control.Functor", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Control/Functor.lean#L187", "span": "L187-L190"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\ntheorem N\u2082\u0393\u2082_inv_app_f_f (X : Karoubi (ChainComplex C \u2115)) (n : \u2115) :\n (N\u2082\u0393\u2082.inv.app X).f.f n =\n X.p.f n \u226b ((\u0393\u2080.splitting X.X).cofan _).inj (Splitting.IndexSet.id (op \u298bn\u298c)) := by\ndsimp [N\u2082\u0393\u2082]\n simp only [whiskeringLeft_obj_preimage_app, NatTrans.comp_app, Functor.comp_map,\n Karoubi.comp_f, N\u2082\u0393\u2082ToKaroubiIso_inv_app, HomologicalComplex.comp_f,\n N\u2081\u0393\u2080_inv_app_f_f, toKaroubi_obj_X, Splitting.toKaroubiNondegComplexIsoN\u2081_hom_f_f,\n PInfty_on_\u0393\u2080_splitting_summand_eq_self, N\u2082_map_f_f, \u0393\u2082_map_f_app, unop_op, Karoubi.decompId_p_f,\n PInfty_on_\u0393\u2080_splitting_summand_eq_self_assoc, Splitting.IndexSet.id_fst, SimplexCategory.len_mk,\n Splitting.\u03b9_desc]\n apply Karoubi.HomologicalComplex.p_idem_assoc\n```", "instruction": "Edit `N\u2082\u0393\u2082_inv_app_f_f` so it still compiles and the proof is simplified where possible. Return the full updated `N\u2082\u0393\u2082_inv_app_f_f` block.", "proof_is_oneliner": false, "target_span": "L160-L171", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1466, "declarations_count": 133, "diagnostics_count": 0, "duplicate_fingerprint": "a7f54520bf88bcbe", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 531, "lean_code_chars": 712, "lean_code_ratio": 0.4857, "length_bucket": "short", "line_count": 20, "natural_language_chars": 754, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.DoldKan.GammaCompN).", "role": "system"}, {"content": "You are editing a file in `Mathlib/AlgebraicTopology/DoldKan/GammaCompN.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.AlgebraicTopology.DoldKan.GammaCompN.N\u2082\u0393\u2082_inv_app_f_f`, L160-L171)\n```lean\ntheorem N\u2082\u0393\u2082_inv_app_f_f (X : Karoubi (ChainComplex C \u2115)) (n : \u2115) :\n (N\u2082\u0393\u2082.inv.app X).f.f n =\n X.p.f n \u226b ((\u0393\u2080.splitting X.X).cofan _).inj (Splitting.IndexSet.id (op \u298bn\u298c)) := by\ndsimp [N\u2082\u0393\u2082]\n simp only [whiskeringLeft_obj_preimage_app, NatTrans.comp_app, Functor.comp_map,\n Karoubi.comp_f, N\u2082\u0393\u2082ToKaroubiIso_inv_app, HomologicalComplex.comp_f,\n N\u2081\u0393\u2080_inv_app_f_f, toKaroubi_obj_X, Splitting.toKaroubiNondegComplexIsoN\u2081_hom_f_f,\n PInfty_on_\u0393\u2080_splitting_summand_eq_self, N\u2082_map_f_f, \u0393\u2082_map_f_app, unop_op, Karoubi.decompId_p_f,\n PInfty_on_\u0393\u2080_splitting_summand_eq_self_assoc, Splitting.IndexSet.id_fst, SimplexCategory.len_mk,\n Splitting.\u03b9_desc]\n apply Karoubi.HomologicalComplex.p_idem_assoc\n```\n\n## Edit instruction\nEdit `N\u2082\u0393\u2082_inv_app_f_f` so it still compiles and the proof is simplified where possible. Return the full updated `N\u2082\u0393\u2082_inv_app_f_f` block.\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.DoldKan.GammaCompN).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/AlgebraicTopology/DoldKan/GammaCompN.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.AlgebraicTopology.DoldKan.GammaCompN.N\u2082\u0393\u2082_inv_app_f_f`, L160-L171)\n```lean\ntheorem N\u2082\u0393\u2082_inv_app_f_f (X : Karoubi (ChainComplex C \u2115)) (n : \u2115) :\n (N\u2082\u0393\u2082.inv.app X).f.f n =\n X.p.f n \u226b ((\u0393\u2080.splitting X.X).cofan _).inj (Splitting.IndexSet.id (op \u298bn\u298c)) := by\ndsimp [N\u2082\u0393\u2082]\n simp only [whiskeringLeft_obj_preimage_app, NatTrans.comp_app, Functor.comp_map,\n Karoubi.comp_f, N\u2082\u0393\u2082ToKaroubiIso_inv_app, HomologicalComplex.comp_f,\n N\u2081\u0393\u2080_inv_app_f_f, toKaroubi_obj_X, Splitting.toKaroubiNondegComplexIsoN\u2081_hom_f_f,\n PInfty_on_\u0393\u2080_splitting_summand_eq_self, N\u2082_map_f_f, \u0393\u2082_map_f_app, unop_op, Karoubi.decompId_p_f,\n PInfty_on_\u0393\u2080_splitting_summand_eq_self_assoc, Splitting.IndexSet.id_fst, SimplexCategory.len_mk,\n Splitting.\u03b9_desc]\n apply Karoubi.HomologicalComplex.p_idem_assoc\n```\n\n## Edit instruction\nEdit `N\u2082\u0393\u2082_inv_app_f_f` so it still compiles and the proof is simplified where possible. Return the full updated `N\u2082\u0393\u2082_inv_app_f_f` block.\n[/INST]", "sample_id": "D-Mathlib.AlgebraicTopology.DoldKan.GammaCompN.N\u2082\u0393\u2082_inv_app_f_f", "source": {"declaration": "Mathlib.AlgebraicTopology.DoldKan.GammaCompN.N\u2082\u0393\u2082_inv_app_f_f", "file": "Mathlib/AlgebraicTopology/DoldKan/GammaCompN.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.DoldKan.GammaCompN", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/DoldKan/GammaCompN.lean#L160", "span": "L160-L171"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "def pureCoherence (mvarId : MVarId) : MetaM (List MVarId)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 486, "declarations_count": 53, "diagnostics_count": 0, "duplicate_fingerprint": "5c430f60faa00952", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 138, "lean_code_chars": 58, "lean_code_ratio": 0.1193, "length_bucket": "tiny", "line_count": 7, "natural_language_chars": 428, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.CategoryTheory.Monoidal.PureCoherence).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ndef pureCoherence (mvarId : MVarId) : MetaM (List MVarId)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.CategoryTheory.Monoidal.PureCoherence).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ndef pureCoherence (mvarId : MVarId) : MetaM (List MVarId)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Tactic.CategoryTheory.Monoidal.PureCoherence.pureCoherence", "source": {"declaration": "Mathlib.Tactic.CategoryTheory.Monoidal.PureCoherence.pureCoherence", "file": "Mathlib/Tactic/CategoryTheory/Monoidal/PureCoherence.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.CategoryTheory.Monoidal.PureCoherence", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/CategoryTheory/Monoidal/PureCoherence.lean#L275", "span": "L275-L277"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "theorem foo : True\n:= by \u27e8\u27e9\u27e8\u27e9\n-- These cases are fine.\n obtain := trivial\n obtain h := trivial\n obtain : True := trivial\n obtain h : True := trivial\n -- These are linted against.\n obtain : True\n \u00b7 trivial\n obtain h : True\n \u00b7 trivial\n```\nWe allow the first four (since an explicit proof is provided), but lint against the last two.\n\n## Why is this bad?\n\nThis is similar to removing all uses of `Tactic.Replace` and `Tactic.Have`\nfrom mathlib: in summary,\n- this version is a Lean3-ism, which can be unlearned now\n- the syntax `obtain foo : type := proof` is slightly shorter;\n particularly so when the first tactic of the proof is `exact`\n- when using the old syntax as `obtain foo : type; \u00b7 proof`, there is an intermediate state with\n multiple goals right before the focusing dot. This can be confusing.\n (This gets amplified with the in-flight \"multiple goal linter\", which seems generally desired ---\n for many reasons, including teachability. Granted, the linter could be tweaked to not lint in this\n case... but by now, the \"old\" syntax is not clearly better.)\n- the old syntax *could* be slightly nicer when deferring goals: however, this is rare.\n In the 30 replacements of the last PR, this occurred twice. In both cases, the `suffices` tactic\n could also be used, as was in fact clearer.\n-/\n\nmeta section\n\nopen Lean Elab Linter\n\nnamespace Mathlib.Linter.Style\n\n/-- Whether a syntax element is an `obtain` tactic call without a provided proof. -/", "diagnostic": "[CompilationUnit(i_begin=0, i_end=25, messages=[Message(data=\"unexpected token '\u27e8'; expected '{' or tactic\", pos=Position(line=2, column=5), pos_end=Position(line=2, column=7), severity=, kind=None), Message(data='unsolved goals\\n\u22a2 True', pos=Position(line=2, column=3), pos_end=Position(line=2, column=5), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=25, i_end=544, messages=[Message(data='unexpected token; expected identifier or stx', pos=Position(line=21, column=12), pos_end=Position(line=21, column=20), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=544, i_end=689, messages=[Message(data=\"unexpected token; expected ':' or ':='\", pos=Position(line=23, column=30), pos_end=Position(line=23, column=38), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=689, i_end=1088, messages=[Message(data=\"unexpected token '.'; expected ':'\", pos=Position(line=27, column=60), pos_end=Position(line=27, column=61), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=1088, i_end=1108, messages=[Message(data=\"unexpected token '*'; expected identifier or stx\", pos=Position(line=28, column=16), pos_end=Position(line=28, column=18), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=1108, i_end=1342, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=1342, i_end=1365, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=1365, i_end=1397, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=1397, i_end=1481, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=39, column=84), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]", "mutation_kind": "syntax_binder_mismatch", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 4330, "declarations_count": 518, "diagnostics_count": 1, "duplicate_fingerprint": "0ec9ecc06c38fe30", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1218, "lean_code_chars": 242, "lean_code_ratio": 0.0559, "length_bucket": "short", "line_count": 50, "natural_language_chars": 4088, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.Linter.OldObtain).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem foo : True\n:= by \u27e8\u27e9\u27e8\u27e9\n-- These cases are fine.\n obtain := trivial\n obtain h := trivial\n obtain : True := trivial\n obtain h : True := trivial\n -- These are linted against.\n obtain : True\n \u00b7 trivial\n obtain h : True\n \u00b7 trivial\n```\nWe allow the first four (since an explicit proof is provided), but lint against the last two.\n\n## Why is this bad?\n\nThis is similar to removing all uses of `Tactic.Replace` and `Tactic.Have`\nfrom mathlib: in summary,\n- this version is a Lean3-ism, which can be unlearned now\n- the syntax `obtain foo : type := proof` is slightly shorter;\n particularly so when the first tactic of the proof is `exact`\n- when using the old syntax as `obtain foo : type; \u00b7 proof`, there is an intermediate state with\n multiple goals right before the focusing dot. This can be confusing.\n (This gets amplified with the in-flight \"multiple goal linter\", which seems generally desired ---\n for many reasons, including teachability. Granted, the linter could be tweaked to not lint in this\n case... but by now, the \"old\" syntax is not clearly better.)\n- the old syntax *could* be slightly nicer when deferring goals: however, this is rare.\n In the 30 replacements of the last PR, this occurred twice. In both cases, the `suffices` tactic\n could also be used, as was in fact clearer.\n-/\n\nmeta section\n\nopen Lean Elab Linter\n\nnamespace Mathlib.Linter.Style\n\n/-- Whether a syntax element is an `obtain` tactic call without a provided proof. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=25, messages=[Message(data=\"unexpected token '\u27e8'; expected '{' or tactic\", pos=Position(line=2, column=5), pos_end=Position(line=2, column=7), severity=, kind=None), Message(data='unsolved goals\\n\u22a2 True', pos=Position(line=2, column=3), pos_end=Position(line=2, column=5), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=25, i_end=544, messages=[Message(data='unexpected token; expected identifier or stx', pos=Position(line=21, column=12), pos_end=Position(line=21, column=20), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=544, i_end=689, messages=[Message(data=\"unexpected token; expected ':' or ':='\", pos=Position(line=23, column=30), pos_end=Position(line=23, column=38), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=689, i_end=1088, messages=[Message(data=\"unexpected token '.'; expected ':'\", pos=Position(line=27, column=60), pos_end=Position(line=27, column=61), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=1088, i_end=1108, messages=[Message(data=\"unexpected token '*'; expected identifier or stx\", pos=Position(line=28, column=16), pos_end=Position(line=28, column=18), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=1108, i_end=1342, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=1342, i_end=1365, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=1365, i_end=1397, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=1397, i_end=1481, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=39, column=84), 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.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.Linter.OldObtain).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem foo : True\n:= by \u27e8\u27e9\u27e8\u27e9\n-- These cases are fine.\n obtain := trivial\n obtain h := trivial\n obtain : True := trivial\n obtain h : True := trivial\n -- These are linted against.\n obtain : True\n \u00b7 trivial\n obtain h : True\n \u00b7 trivial\n```\nWe allow the first four (since an explicit proof is provided), but lint against the last two.\n\n## Why is this bad?\n\nThis is similar to removing all uses of `Tactic.Replace` and `Tactic.Have`\nfrom mathlib: in summary,\n- this version is a Lean3-ism, which can be unlearned now\n- the syntax `obtain foo : type := proof` is slightly shorter;\n particularly so when the first tactic of the proof is `exact`\n- when using the old syntax as `obtain foo : type; \u00b7 proof`, there is an intermediate state with\n multiple goals right before the focusing dot. This can be confusing.\n (This gets amplified with the in-flight \"multiple goal linter\", which seems generally desired ---\n for many reasons, including teachability. Granted, the linter could be tweaked to not lint in this\n case... but by now, the \"old\" syntax is not clearly better.)\n- the old syntax *could* be slightly nicer when deferring goals: however, this is rare.\n In the 30 replacements of the last PR, this occurred twice. In both cases, the `suffices` tactic\n could also be used, as was in fact clearer.\n-/\n\nmeta section\n\nopen Lean Elab Linter\n\nnamespace Mathlib.Linter.Style\n\n/-- Whether a syntax element is an `obtain` tactic call without a provided proof. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=25, messages=[Message(data=\"unexpected token '\u27e8'; expected '{' or tactic\", pos=Position(line=2, column=5), pos_end=Position(line=2, column=7), severity=, kind=None), Message(data='unsolved goals\\n\u22a2 True', pos=Position(line=2, column=3), pos_end=Position(line=2, column=5), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=25, i_end=544, messages=[Message(data='unexpected token; expected identifier or stx', pos=Position(line=21, column=12), pos_end=Position(line=21, column=20), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=544, i_end=689, messages=[Message(data=\"unexpected token; expected ':' or ':='\", pos=Position(line=23, column=30), pos_end=Position(line=23, column=38), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=689, i_end=1088, messages=[Message(data=\"unexpected token '.'; expected ':'\", pos=Position(line=27, column=60), pos_end=Position(line=27, column=61), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=1088, i_end=1108, messages=[Message(data=\"unexpected token '*'; expected identifier or stx\", pos=Position(line=28, column=16), pos_end=Position(line=28, column=18), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=1108, i_end=1342, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=1342, i_end=1365, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=1365, i_end=1397, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=1397, i_end=1481, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=39, column=84), 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]", "sample_id": "B-Mathlib.Tactic.Linter.OldObtain.foo", "source": {"declaration": "Mathlib.Tactic.Linter.OldObtain.foo", "file": "Mathlib/Tactic/Linter/OldObtain.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.Linter.OldObtain", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/Linter/OldObtain.lean#L24", "span": "L24-L61"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\ntheorem optionToList : Primrec (Option.toList : Option \u03b1 \u2192 List \u03b1) := (option_casesOn Primrec.id (const [])\n ((list_cons.comp Primrec.id (const [])).comp\u2082 Primrec\u2082.right)).of_eq\n (fun o => by rcases o <;> simp)\n```", "instruction": "Edit `optionToList` so it still compiles and the proof is simplified where possible. Return the full updated `optionToList` block.", "proof_is_oneliner": false, "target_span": "L243-L247", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 927, "declarations_count": 97, "diagnostics_count": 0, "duplicate_fingerprint": "fb55de16db65f4f8", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 287, "lean_code_chars": 215, "lean_code_ratio": 0.2319, "length_bucket": "tiny", "line_count": 12, "natural_language_chars": 712, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.Primrec.List).", "role": "system"}, {"content": "You are editing a file in `Mathlib/Computability/Primrec/List.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Computability.Primrec.List.optionToList`, L243-L247)\n```lean\ntheorem optionToList : Primrec (Option.toList : Option \u03b1 \u2192 List \u03b1) := (option_casesOn Primrec.id (const [])\n ((list_cons.comp Primrec.id (const [])).comp\u2082 Primrec\u2082.right)).of_eq\n (fun o => by rcases o <;> simp)\n```\n\n## Edit instruction\nEdit `optionToList` so it still compiles and the proof is simplified where possible. Return the full updated `optionToList` block.\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.Primrec.List).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Computability/Primrec/List.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Computability.Primrec.List.optionToList`, L243-L247)\n```lean\ntheorem optionToList : Primrec (Option.toList : Option \u03b1 \u2192 List \u03b1) := (option_casesOn Primrec.id (const [])\n ((list_cons.comp Primrec.id (const [])).comp\u2082 Primrec\u2082.right)).of_eq\n (fun o => by rcases o <;> simp)\n```\n\n## Edit instruction\nEdit `optionToList` so it still compiles and the proof is simplified where possible. Return the full updated `optionToList` block.\n[/INST]", "sample_id": "D-Mathlib.Computability.Primrec.List.optionToList", "source": {"declaration": "Mathlib.Computability.Primrec.List.optionToList", "file": "Mathlib/Computability/Primrec/List.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Computability.Primrec.List", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Computability/Primrec/List.lean#L243", "span": "L243-L247"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem evalFrom_cons (S : Set \u03c3) (a : \u03b1) (x : List \u03b1) :\n M.evalFrom S (a :: x) = M.evalFrom (M.stepSet S a) x", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 515, "declarations_count": 62, "diagnostics_count": 0, "duplicate_fingerprint": "3811b627ffa19eed", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 155, "lean_code_chars": 114, "lean_code_ratio": 0.2214, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 401, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 1.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.NFA).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem evalFrom_cons (S : Set \u03c3) (a : \u03b1) (x : List \u03b1) :\n M.evalFrom S (a :: x) = M.evalFrom (M.stepSet S a) x\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.NFA).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem evalFrom_cons (S : Set \u03c3) (a : \u03b1) (x : List \u03b1) :\n M.evalFrom S (a :: x) = M.evalFrom (M.stepSet S a) x\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Computability.NFA.evalFrom_cons", "source": {"declaration": "Mathlib.Computability.NFA.evalFrom_cons", "file": "Mathlib/Computability/NFA.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Computability.NFA", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Computability/NFA.lean#L112", "span": "L112-L116"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "theorem dense_of_nonempty_smul_invariant [IsMinimal M \u03b1] {s : Set \u03b1} (hne : s.Nonempty)\n (hsmul : \u2200 c : M, c \u2022 s \u2286 s) : Dense s\n:= .someMissingNamespaceXYZ\nlet \u27e8x, hx\u27e9 := hne\n (MulAction.dense_orbit M x).mono (range_subset_iff.2 fun c \u21a6 hsmul c \u27e8x, hx, rfl\u27e9)", "diagnostic": "[CompilationUnit(i_begin=0, i_end=167, messages=[Message(data='`dense_of_nonempty_smul_invariant` 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), CompilationUnit(i_begin=167, i_end=280, messages=[Message(data=\"unexpected token 'let'; expected command\", pos=Position(line=4, column=0), pos_end=Position(line=4, column=3), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]", "mutation_kind": "typeclass_instance", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1350, "declarations_count": 149, "diagnostics_count": 1, "duplicate_fingerprint": "ff845264bedea43a", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 415, "lean_code_chars": 263, "lean_code_ratio": 0.1948, "length_bucket": "tiny", "line_count": 16, "natural_language_chars": 1087, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.Minimal).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem dense_of_nonempty_smul_invariant [IsMinimal M \u03b1] {s : Set \u03b1} (hne : s.Nonempty)\n (hsmul : \u2200 c : M, c \u2022 s \u2286 s) : Dense s\n:= .someMissingNamespaceXYZ\nlet \u27e8x, hx\u27e9 := hne\n (MulAction.dense_orbit M x).mono (range_subset_iff.2 fun c \u21a6 hsmul c \u27e8x, hx, rfl\u27e9)\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=167, messages=[Message(data='`dense_of_nonempty_smul_invariant` 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), CompilationUnit(i_begin=167, i_end=280, messages=[Message(data=\"unexpected token 'let'; expected command\", pos=Position(line=4, column=0), pos_end=Position(line=4, column=3), 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.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.Minimal).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem dense_of_nonempty_smul_invariant [IsMinimal M \u03b1] {s : Set \u03b1} (hne : s.Nonempty)\n (hsmul : \u2200 c : M, c \u2022 s \u2286 s) : Dense s\n:= .someMissingNamespaceXYZ\nlet \u27e8x, hx\u27e9 := hne\n (MulAction.dense_orbit M x).mono (range_subset_iff.2 fun c \u21a6 hsmul c \u27e8x, hx, rfl\u27e9)\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=167, messages=[Message(data='`dense_of_nonempty_smul_invariant` 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), CompilationUnit(i_begin=167, i_end=280, messages=[Message(data=\"unexpected token 'let'; expected command\", pos=Position(line=4, column=0), pos_end=Position(line=4, column=3), 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]", "sample_id": "B-Mathlib.Dynamics.Minimal.dense_of_nonempty_smul_invariant", "source": {"declaration": "Mathlib.Dynamics.Minimal.dense_of_nonempty_smul_invariant", "file": "Mathlib/Dynamics/Minimal.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Dynamics.Minimal", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Dynamics/Minimal.lean#L88", "span": "L88-L92"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.AlgebraicTopology.DoldKan.Normalized.HigherFacesVanish (L47-L52)\ntheorem HigherFacesVanish.inclusionOfMooreComplexMap (n : \u2115) :\n HigherFacesVanish (n + 1) ((inclusionOfMooreComplexMap X).f (n + 1))", "-- Mathlib.AlgebraicTopology.DoldKan.Normalized.factors_normalizedMooreComplex_PInfty (L53-L63)\ntheorem factors_normalizedMooreComplex_PInfty (n : \u2115) :\n Subobject.Factors (NormalizedMooreComplex.objX X n) (PInfty.f n)", "-- Mathlib.AlgebraicTopology.DoldKan.Normalized.PInftyToNormalizedMooreComplex_comp_inclusionOfMooreComplexMap (L75-L78)\ntheorem PInftyToNormalizedMooreComplex_comp_inclusionOfMooreComplexMap (X : SimplicialObject A) :\n PInftyToNormalizedMooreComplex X \u226b inclusionOfMooreComplexMap X = PInfty", "-- Mathlib.AlgebraicTopology.DoldKan.Normalized.PInftyToNormalizedMooreComplex_naturality (L80-L85)\ntheorem PInftyToNormalizedMooreComplex_naturality {X Y : SimplicialObject A} (f : X \u27f6 Y) :\n AlternatingFaceMapComplex.map f \u226b PInftyToNormalizedMooreComplex Y =\n PInftyToNormalizedMooreComplex X \u226b NormalizedMooreComplex.map f", "-- Mathlib.AlgebraicTopology.DoldKan.Normalized.PInfty_comp_PInftyToNormalizedMooreComplex (L87-L89)\ntheorem PInfty_comp_PInftyToNormalizedMooreComplex (X : SimplicialObject A) :\n PInfty \u226b PInftyToNormalizedMooreComplex X = PInftyToNormalizedMooreComplex X", "-- Mathlib.AlgebraicTopology.DoldKan.Normalized.inclusionOfMooreComplexMap_comp_PInfty (L91-L97)\ntheorem inclusionOfMooreComplexMap_comp_PInfty (X : SimplicialObject A) :\n inclusionOfMooreComplexMap X \u226b PInfty = inclusionOfMooreComplexMap X", "-- Mathlib.AlgebraicTopology.DoldKan.Normalized.splitMonoInclusionOfMooreComplexMap (L107-L121)\ndef splitMonoInclusionOfMooreComplexMap (X : SimplicialObject A) :\n SplitMono (inclusionOfMooreComplexMap X) where\n retraction", "-- Mathlib.AlgebraicTopology.DoldKan.Normalized.N\u2081_iso_normalizedMooreComplex_comp_toKaroubi (L122-L142)\ndef N\u2081_iso_normalizedMooreComplex_comp_toKaroubi : N\u2081 \u2245 normalizedMooreComplex A \u22d9 toKaroubi _ where\n hom", "-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081UnitIso (L92-L102)\ndef equivalence\u2081UnitIso : \ud835\udfed A \u2245 F \u22d9 e'.inverse \u22d9 eA.inverse", "-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081CounitIso_eq (L86-L90)\ntheorem equivalence\u2081CounitIso_eq : (equivalence\u2081 hF).counitIso = equivalence\u2081CounitIso hF", "-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081CounitIso (L75-L85)\ndef equivalence\u2081CounitIso : (e'.inverse \u22d9 eA.inverse) \u22d9 F \u2245 \ud835\udfed B'", "-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081 (L68-L69)\ndef equivalence\u2081 : A \u224c B'", "-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2080 (L60-L66)\ndef equivalence\u2080 : A \u224c B'", "-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081_inverse (L70-L73)\ntheorem equivalence\u2081_inverse : (equivalence\u2081 hF).inverse = e'.inverse \u22d9 eA.inverse"], "statement": "def PInftyToNormalizedMooreComplex (X : SimplicialObject A) : K[X] \u27f6 N[X]", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 3722, "declarations_count": 255, "diagnostics_count": 0, "duplicate_fingerprint": "064d779478369c2a", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1284, "lean_code_chars": 2911, "lean_code_ratio": 0.7821, "length_bucket": "short", "line_count": 101, "natural_language_chars": 811, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 14, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.DoldKan.Normalized).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef PInftyToNormalizedMooreComplex (X : SimplicialObject A) : K[X] \u27f6 N[X]\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Normalized.HigherFacesVanish (L47-L52)\ntheorem HigherFacesVanish.inclusionOfMooreComplexMap (n : \u2115) :\n HigherFacesVanish (n + 1) ((inclusionOfMooreComplexMap X).f (n + 1))\n```\n\n-- snippet 2\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Normalized.factors_normalizedMooreComplex_PInfty (L53-L63)\ntheorem factors_normalizedMooreComplex_PInfty (n : \u2115) :\n Subobject.Factors (NormalizedMooreComplex.objX X n) (PInfty.f n)\n```\n\n-- snippet 3\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Normalized.PInftyToNormalizedMooreComplex_comp_inclusionOfMooreComplexMap (L75-L78)\ntheorem PInftyToNormalizedMooreComplex_comp_inclusionOfMooreComplexMap (X : SimplicialObject A) :\n PInftyToNormalizedMooreComplex X \u226b inclusionOfMooreComplexMap X = PInfty\n```\n\n-- snippet 4\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Normalized.PInftyToNormalizedMooreComplex_naturality (L80-L85)\ntheorem PInftyToNormalizedMooreComplex_naturality {X Y : SimplicialObject A} (f : X \u27f6 Y) :\n AlternatingFaceMapComplex.map f \u226b PInftyToNormalizedMooreComplex Y =\n PInftyToNormalizedMooreComplex X \u226b NormalizedMooreComplex.map f\n```\n\n-- snippet 5\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Normalized.PInfty_comp_PInftyToNormalizedMooreComplex (L87-L89)\ntheorem PInfty_comp_PInftyToNormalizedMooreComplex (X : SimplicialObject A) :\n PInfty \u226b PInftyToNormalizedMooreComplex X = PInftyToNormalizedMooreComplex X\n```\n\n-- snippet 6\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Normalized.inclusionOfMooreComplexMap_comp_PInfty (L91-L97)\ntheorem inclusionOfMooreComplexMap_comp_PInfty (X : SimplicialObject A) :\n inclusionOfMooreComplexMap X \u226b PInfty = inclusionOfMooreComplexMap X\n```\n\n-- snippet 7\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Normalized.splitMonoInclusionOfMooreComplexMap (L107-L121)\ndef splitMonoInclusionOfMooreComplexMap (X : SimplicialObject A) :\n SplitMono (inclusionOfMooreComplexMap X) where\n retraction\n```\n\n-- snippet 8\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Normalized.N\u2081_iso_normalizedMooreComplex_comp_toKaroubi (L122-L142)\ndef N\u2081_iso_normalizedMooreComplex_comp_toKaroubi : N\u2081 \u2245 normalizedMooreComplex A \u22d9 toKaroubi _ where\n hom\n```\n\n-- snippet 9\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081UnitIso (L92-L102)\ndef equivalence\u2081UnitIso : \ud835\udfed A \u2245 F \u22d9 e'.inverse \u22d9 eA.inverse\n```\n\n-- snippet 10\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081CounitIso_eq (L86-L90)\ntheorem equivalence\u2081CounitIso_eq : (equivalence\u2081 hF).counitIso = equivalence\u2081CounitIso hF\n```\n\n-- snippet 11\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081CounitIso (L75-L85)\ndef equivalence\u2081CounitIso : (e'.inverse \u22d9 eA.inverse) \u22d9 F \u2245 \ud835\udfed B'\n```\n\n-- snippet 12\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081 (L68-L69)\ndef equivalence\u2081 : A \u224c B'\n```\n\n-- snippet 13\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2080 (L60-L66)\ndef equivalence\u2080 : A \u224c B'\n```\n\n-- snippet 14\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081_inverse (L70-L73)\ntheorem equivalence\u2081_inverse : (equivalence\u2081 hF).inverse = e'.inverse \u22d9 eA.inverse\n```\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.DoldKan.Normalized).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef PInftyToNormalizedMooreComplex (X : SimplicialObject A) : K[X] \u27f6 N[X]\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Normalized.HigherFacesVanish (L47-L52)\ntheorem HigherFacesVanish.inclusionOfMooreComplexMap (n : \u2115) :\n HigherFacesVanish (n + 1) ((inclusionOfMooreComplexMap X).f (n + 1))\n```\n\n-- snippet 2\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Normalized.factors_normalizedMooreComplex_PInfty (L53-L63)\ntheorem factors_normalizedMooreComplex_PInfty (n : \u2115) :\n Subobject.Factors (NormalizedMooreComplex.objX X n) (PInfty.f n)\n```\n\n-- snippet 3\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Normalized.PInftyToNormalizedMooreComplex_comp_inclusionOfMooreComplexMap (L75-L78)\ntheorem PInftyToNormalizedMooreComplex_comp_inclusionOfMooreComplexMap (X : SimplicialObject A) :\n PInftyToNormalizedMooreComplex X \u226b inclusionOfMooreComplexMap X = PInfty\n```\n\n-- snippet 4\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Normalized.PInftyToNormalizedMooreComplex_naturality (L80-L85)\ntheorem PInftyToNormalizedMooreComplex_naturality {X Y : SimplicialObject A} (f : X \u27f6 Y) :\n AlternatingFaceMapComplex.map f \u226b PInftyToNormalizedMooreComplex Y =\n PInftyToNormalizedMooreComplex X \u226b NormalizedMooreComplex.map f\n```\n\n-- snippet 5\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Normalized.PInfty_comp_PInftyToNormalizedMooreComplex (L87-L89)\ntheorem PInfty_comp_PInftyToNormalizedMooreComplex (X : SimplicialObject A) :\n PInfty \u226b PInftyToNormalizedMooreComplex X = PInftyToNormalizedMooreComplex X\n```\n\n-- snippet 6\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Normalized.inclusionOfMooreComplexMap_comp_PInfty (L91-L97)\ntheorem inclusionOfMooreComplexMap_comp_PInfty (X : SimplicialObject A) :\n inclusionOfMooreComplexMap X \u226b PInfty = inclusionOfMooreComplexMap X\n```\n\n-- snippet 7\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Normalized.splitMonoInclusionOfMooreComplexMap (L107-L121)\ndef splitMonoInclusionOfMooreComplexMap (X : SimplicialObject A) :\n SplitMono (inclusionOfMooreComplexMap X) where\n retraction\n```\n\n-- snippet 8\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Normalized.N\u2081_iso_normalizedMooreComplex_comp_toKaroubi (L122-L142)\ndef N\u2081_iso_normalizedMooreComplex_comp_toKaroubi : N\u2081 \u2245 normalizedMooreComplex A \u22d9 toKaroubi _ where\n hom\n```\n\n-- snippet 9\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081UnitIso (L92-L102)\ndef equivalence\u2081UnitIso : \ud835\udfed A \u2245 F \u22d9 e'.inverse \u22d9 eA.inverse\n```\n\n-- snippet 10\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081CounitIso_eq (L86-L90)\ntheorem equivalence\u2081CounitIso_eq : (equivalence\u2081 hF).counitIso = equivalence\u2081CounitIso hF\n```\n\n-- snippet 11\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081CounitIso (L75-L85)\ndef equivalence\u2081CounitIso : (e'.inverse \u22d9 eA.inverse) \u22d9 F \u2245 \ud835\udfed B'\n```\n\n-- snippet 12\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081 (L68-L69)\ndef equivalence\u2081 : A \u224c B'\n```\n\n-- snippet 13\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2080 (L60-L66)\ndef equivalence\u2080 : A \u224c B'\n```\n\n-- snippet 14\n```lean\n-- Mathlib.AlgebraicTopology.DoldKan.Compatibility.equivalence\u2081_inverse (L70-L73)\ntheorem equivalence\u2081_inverse : (equivalence\u2081 hF).inverse = e'.inverse \u22d9 eA.inverse\n```\n[/INST]", "sample_id": "C-Mathlib.AlgebraicTopology.DoldKan.Normalized.PInftyToNormalizedMooreComplex", "source": {"declaration": "Mathlib.AlgebraicTopology.DoldKan.Normalized.PInftyToNormalizedMooreComplex", "file": "Mathlib/AlgebraicTopology/DoldKan/Normalized.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.DoldKan.Normalized", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/DoldKan/Normalized.lean#L65", "span": "L65-L73"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "abbrev \u03b9\u2083 : \u0394[2] \u27f6 \u039b[3, 2]", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 455, "declarations_count": 47, "diagnostics_count": 0, "duplicate_fingerprint": "6be734e03ce32788", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 138, "lean_code_chars": 27, "lean_code_ratio": 0.0593, "length_bucket": "tiny", "line_count": 7, "natural_language_chars": 428, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplicialSet.HornColimits).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\nabbrev \u03b9\u2083 : \u0394[2] \u27f6 \u039b[3, 2]\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplicialSet.HornColimits).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nabbrev \u03b9\u2083 : \u0394[2] \u27f6 \u039b[3, 2]\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.AlgebraicTopology.SimplicialSet.HornColimits.\u03b9\u2083", "source": {"declaration": "Mathlib.AlgebraicTopology.SimplicialSet.HornColimits.\u03b9\u2083", "file": "Mathlib/AlgebraicTopology/SimplicialSet/HornColimits.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.SimplicialSet.HornColimits", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/SimplicialSet/HornColimits.lean#L251", "span": "L251-L259"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.OneTruncation\u2082 (L51-L52)\ndef OneTruncation\u2082 (S : SSet.Truncated 2)", "-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.reflQuiver (L59-L62)\ninstance reflQuiver (S : SSet.Truncated 2) : ReflQuiver (OneTruncation\u2082 S) where\n Hom", "-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.hom_ext (L64-L68)\nlemma hom_ext\n {S : SSet.Truncated 2} {x y : OneTruncation\u2082 S} {f g : x \u27f6 y}\n (h : f.edge = g.edge) : f = g", "-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.id_edge (L70-L75)\nlemma id_edge {S : SSet.Truncated 2} (x : OneTruncation\u2082 S) :\n Truncated.Edge.edge (\ud835\udfd9rq x) = S.map (\u03c3\u2082 0).op x", "-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.map (L77-L85)\ndef map {S T : SSet.Truncated 2} (f : S \u27f6 T) :\n OneTruncation\u2082 S \u2964rq OneTruncation\u2082 T where\n obj x", "-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.oneTruncation\u2082 (L87-L92)\ndef oneTruncation\u2082 : SSet.Truncated.{u} 2 \u2964 ReflQuiv.{u, u} where\n obj S", "-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.homOfEq_edge (L94-L100)\nlemma homOfEq_edge\n {X : SSet.Truncated.{u} 2} {x\u2081 y\u2081 x\u2082 y\u2082 : OneTruncation\u2082 X}\n (f : x\u2081 \u27f6 y\u2081) (hx : x\u2081 = x\u2082) (hy : y\u2081 = y\u2082) :\n (Quiver.homOfEq f hx hy).edge = f.edge", "-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.nerveEquiv (L107-L110)\ndef nerveEquiv : OneTruncation\u2082 ((SSet.truncation 2).obj (nerve C)) \u2243 C", "-- Mathlib.AlgebraicTopology.SimplicialSet.AnodyneExtensions.IsUniquelyCodimOneFace.IsUniquelyCodimOneFace (L37-L41)\ndef IsUniquelyCodimOneFace : Prop", "-- Mathlib.AlgebraicTopology.SimplicialSet.AnodyneExtensions.IsUniquelyCodimOneFace.\u03b4_index (L80-L83)\nlemma \u03b4_index :\n X.\u03b4 (hxy.index hd) (y.cast (by rw [hxy.dim_eq, hd])).simplex = (x.cast hd).simplex", "-- Mathlib.AlgebraicTopology.SimplicialSet.AnodyneExtensions.IsUniquelyCodimOneFace.cast (L65-L67)\nlemma cast : IsUniquelyCodimOneFace (x.cast hd) (y.cast (by rw [hxy.dim_eq, hd]))", "-- Mathlib.AlgebraicTopology.SimplicialSet.AnodyneExtensions.IsUniquelyCodimOneFace.dim_eq (L58-L59)\nlemma dim_eq : y.dim = x.dim + 1", "-- Mathlib.AlgebraicTopology.SimplicialSet.AnodyneExtensions.IsUniquelyCodimOneFace.existsUnique_\u03b4_cast_simplex (L68-L79)\nlemma existsUnique_\u03b4_cast_simplex :\n \u2203! (i : Fin (d + 2)), X.\u03b4 i (y.cast (by rw [hxy.dim_eq, hd])).simplex =\n (x.cast hd).simplex", "-- Mathlib.AlgebraicTopology.SimplicialSet.AnodyneExtensions.IsUniquelyCodimOneFace.iff (L42-L57)\nlemma iff {d : \u2115} (x : X _\u298bd\u298c) (y : X _\u298bd + 1\u298c) :\n IsUniquelyCodimOneFace (S.mk x) (S.mk y) \u2194\n \u2203! (i : Fin (d + 2)), X.\u03b4 i y = x"], "statement": "instance subsingleton_hom (X : Truncated.{u} 2) [Unique (X _\u298b0\u298c\u2082)] [Subsingleton (X _\u298b1\u298c\u2082)]\n (x y : X.HomotopyCategory) :\n Subsingleton (x \u27f6 y)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 3524, "declarations_count": 310, "diagnostics_count": 0, "duplicate_fingerprint": "52ef90a32494da64", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1400, "lean_code_chars": 2706, "lean_code_ratio": 0.7679, "length_bucket": "short", "line_count": 108, "natural_language_chars": 818, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 14, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ninstance subsingleton_hom (X : Truncated.{u} 2) [Unique (X _\u298b0\u298c\u2082)] [Subsingleton (X _\u298b1\u298c\u2082)]\n (x y : X.HomotopyCategory) :\n Subsingleton (x \u27f6 y)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.OneTruncation\u2082 (L51-L52)\ndef OneTruncation\u2082 (S : SSet.Truncated 2)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.reflQuiver (L59-L62)\ninstance reflQuiver (S : SSet.Truncated 2) : ReflQuiver (OneTruncation\u2082 S) where\n Hom\n```\n\n-- snippet 3\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.hom_ext (L64-L68)\nlemma hom_ext\n {S : SSet.Truncated 2} {x y : OneTruncation\u2082 S} {f g : x \u27f6 y}\n (h : f.edge = g.edge) : f = g\n```\n\n-- snippet 4\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.id_edge (L70-L75)\nlemma id_edge {S : SSet.Truncated 2} (x : OneTruncation\u2082 S) :\n Truncated.Edge.edge (\ud835\udfd9rq x) = S.map (\u03c3\u2082 0).op x\n```\n\n-- snippet 5\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.map (L77-L85)\ndef map {S T : SSet.Truncated 2} (f : S \u27f6 T) :\n OneTruncation\u2082 S \u2964rq OneTruncation\u2082 T where\n obj x\n```\n\n-- snippet 6\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.oneTruncation\u2082 (L87-L92)\ndef oneTruncation\u2082 : SSet.Truncated.{u} 2 \u2964 ReflQuiv.{u, u} where\n obj S\n```\n\n-- snippet 7\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.homOfEq_edge (L94-L100)\nlemma homOfEq_edge\n {X : SSet.Truncated.{u} 2} {x\u2081 y\u2081 x\u2082 y\u2082 : OneTruncation\u2082 X}\n (f : x\u2081 \u27f6 y\u2081) (hx : x\u2081 = x\u2082) (hy : y\u2081 = y\u2082) :\n (Quiver.homOfEq f hx hy).edge = f.edge\n```\n\n-- snippet 8\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.nerveEquiv (L107-L110)\ndef nerveEquiv : OneTruncation\u2082 ((SSet.truncation 2).obj (nerve C)) \u2243 C\n```\n\n-- snippet 9\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.AnodyneExtensions.IsUniquelyCodimOneFace.IsUniquelyCodimOneFace (L37-L41)\ndef IsUniquelyCodimOneFace : Prop\n```\n\n-- snippet 10\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.AnodyneExtensions.IsUniquelyCodimOneFace.\u03b4_index (L80-L83)\nlemma \u03b4_index :\n X.\u03b4 (hxy.index hd) (y.cast (by rw [hxy.dim_eq, hd])).simplex = (x.cast hd).simplex\n```\n\n-- snippet 11\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.AnodyneExtensions.IsUniquelyCodimOneFace.cast (L65-L67)\nlemma cast : IsUniquelyCodimOneFace (x.cast hd) (y.cast (by rw [hxy.dim_eq, hd]))\n```\n\n-- snippet 12\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.AnodyneExtensions.IsUniquelyCodimOneFace.dim_eq (L58-L59)\nlemma dim_eq : y.dim = x.dim + 1\n```\n\n-- snippet 13\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.AnodyneExtensions.IsUniquelyCodimOneFace.existsUnique_\u03b4_cast_simplex (L68-L79)\nlemma existsUnique_\u03b4_cast_simplex :\n \u2203! (i : Fin (d + 2)), X.\u03b4 i (y.cast (by rw [hxy.dim_eq, hd])).simplex =\n (x.cast hd).simplex\n```\n\n-- snippet 14\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.AnodyneExtensions.IsUniquelyCodimOneFace.iff (L42-L57)\nlemma iff {d : \u2115} (x : X _\u298bd\u298c) (y : X _\u298bd + 1\u298c) :\n IsUniquelyCodimOneFace (S.mk x) (S.mk y) \u2194\n \u2203! (i : Fin (d + 2)), X.\u03b4 i y = x\n```\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ninstance subsingleton_hom (X : Truncated.{u} 2) [Unique (X _\u298b0\u298c\u2082)] [Subsingleton (X _\u298b1\u298c\u2082)]\n (x y : X.HomotopyCategory) :\n Subsingleton (x \u27f6 y)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.OneTruncation\u2082 (L51-L52)\ndef OneTruncation\u2082 (S : SSet.Truncated 2)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.reflQuiver (L59-L62)\ninstance reflQuiver (S : SSet.Truncated 2) : ReflQuiver (OneTruncation\u2082 S) where\n Hom\n```\n\n-- snippet 3\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.hom_ext (L64-L68)\nlemma hom_ext\n {S : SSet.Truncated 2} {x y : OneTruncation\u2082 S} {f g : x \u27f6 y}\n (h : f.edge = g.edge) : f = g\n```\n\n-- snippet 4\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.id_edge (L70-L75)\nlemma id_edge {S : SSet.Truncated 2} (x : OneTruncation\u2082 S) :\n Truncated.Edge.edge (\ud835\udfd9rq x) = S.map (\u03c3\u2082 0).op x\n```\n\n-- snippet 5\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.map (L77-L85)\ndef map {S T : SSet.Truncated 2} (f : S \u27f6 T) :\n OneTruncation\u2082 S \u2964rq OneTruncation\u2082 T where\n obj x\n```\n\n-- snippet 6\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.oneTruncation\u2082 (L87-L92)\ndef oneTruncation\u2082 : SSet.Truncated.{u} 2 \u2964 ReflQuiv.{u, u} where\n obj S\n```\n\n-- snippet 7\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.homOfEq_edge (L94-L100)\nlemma homOfEq_edge\n {X : SSet.Truncated.{u} 2} {x\u2081 y\u2081 x\u2082 y\u2082 : OneTruncation\u2082 X}\n (f : x\u2081 \u27f6 y\u2081) (hx : x\u2081 = x\u2082) (hy : y\u2081 = y\u2082) :\n (Quiver.homOfEq f hx hy).edge = f.edge\n```\n\n-- snippet 8\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.nerveEquiv (L107-L110)\ndef nerveEquiv : OneTruncation\u2082 ((SSet.truncation 2).obj (nerve C)) \u2243 C\n```\n\n-- snippet 9\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.AnodyneExtensions.IsUniquelyCodimOneFace.IsUniquelyCodimOneFace (L37-L41)\ndef IsUniquelyCodimOneFace : Prop\n```\n\n-- snippet 10\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.AnodyneExtensions.IsUniquelyCodimOneFace.\u03b4_index (L80-L83)\nlemma \u03b4_index :\n X.\u03b4 (hxy.index hd) (y.cast (by rw [hxy.dim_eq, hd])).simplex = (x.cast hd).simplex\n```\n\n-- snippet 11\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.AnodyneExtensions.IsUniquelyCodimOneFace.cast (L65-L67)\nlemma cast : IsUniquelyCodimOneFace (x.cast hd) (y.cast (by rw [hxy.dim_eq, hd]))\n```\n\n-- snippet 12\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.AnodyneExtensions.IsUniquelyCodimOneFace.dim_eq (L58-L59)\nlemma dim_eq : y.dim = x.dim + 1\n```\n\n-- snippet 13\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.AnodyneExtensions.IsUniquelyCodimOneFace.existsUnique_\u03b4_cast_simplex (L68-L79)\nlemma existsUnique_\u03b4_cast_simplex :\n \u2203! (i : Fin (d + 2)), X.\u03b4 i (y.cast (by rw [hxy.dim_eq, hd])).simplex =\n (x.cast hd).simplex\n```\n\n-- snippet 14\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.AnodyneExtensions.IsUniquelyCodimOneFace.iff (L42-L57)\nlemma iff {d : \u2115} (x : X _\u298bd\u298c) (y : X _\u298bd + 1\u298c) :\n IsUniquelyCodimOneFace (S.mk x) (S.mk y) \u2194\n \u2203! (i : Fin (d + 2)), X.\u03b4 i y = x\n```\n[/INST]", "sample_id": "C-Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.subsingleton_hom", "source": {"declaration": "Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.subsingleton_hom", "file": "Mathlib/AlgebraicTopology/SimplicialSet/HomotopyCat.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/SimplicialSet/HomotopyCat.lean#L467", "span": "L467-L474"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "def sumArrowEquivProdArrow (\u03b1 \u03b2 \u03b3 : Type*) : (\u03b1 \u2295 \u03b2 \u2192 \u03b3) \u2243 (\u03b1 \u2192 \u03b3) \u00d7 (\u03b2 \u2192 \u03b3)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 477, "declarations_count": 49, "diagnostics_count": 0, "duplicate_fingerprint": "596e6faaca6f468d", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 148, "lean_code_chars": 77, "lean_code_ratio": 0.1614, "length_bucket": "tiny", "line_count": 7, "natural_language_chars": 400, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Equiv.Prod).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ndef sumArrowEquivProdArrow (\u03b1 \u03b2 \u03b3 : Type*) : (\u03b1 \u2295 \u03b2 \u2192 \u03b3) \u2243 (\u03b1 \u2192 \u03b3) \u00d7 (\u03b2 \u2192 \u03b3)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Equiv.Prod).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ndef sumArrowEquivProdArrow (\u03b1 \u03b2 \u03b3 : Type*) : (\u03b1 \u2295 \u03b2 \u2192 \u03b3) \u2243 (\u03b1 \u2192 \u03b3) \u00d7 (\u03b2 \u2192 \u03b3)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Logic.Equiv.Prod.sumArrowEquivProdArrow", "source": {"declaration": "Mathlib.Logic.Equiv.Prod.sumArrowEquivProdArrow", "file": "Mathlib/Logic/Equiv/Prod.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Logic.Equiv.Prod", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Logic/Equiv/Prod.lean#L367", "span": "L367-L371"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Tactic.CongrExclamation.Congr (L188-L194)\ndef Congr!.Config.unfoldSameFun : Congr!.Config where\n partialApp", "-- Mathlib.Tactic.CongrExclamation.Congr (L195-L198)\ndef Congr!.Config.numArgsOk (config : Config) (numArgs : Nat) : Bool", "-- Mathlib.Tactic.CongrExclamation.Congr (L199-L234)\ndef Congr!.Config.maxArgsFor (config : Config) (numArgs : Nat) : Nat", "-- Mathlib.Tactic.CongrExclamation.Congr (L235-L271)\ndef Congr!.plausiblyEqualTypes (ty1 ty2 : Expr) (maxDepth : Nat", "-- Mathlib.Tactic.CongrExclamation.for (L500-L503)\ninstance for both the LHS and the RHS.\n\nIf successful, this reduces proving `@HEq \u03b1 x \u03b2 y` to proving `\u03b1 = \u03b2`.\n-/", "-- Mathlib.Tactic.CongrExclamation.CongrMetaM (L557-L559)\nabbrev CongrMetaM", "-- Mathlib.Tactic.CongrExclamation.CongrMetaM (L560-L588)\ndef CongrMetaM.nextPattern : CongrMetaM (Option (TSyntax `rcasesPat))"], "statement": "def Lean.MVarId.userCongr? (config : Congr!.Config) (mvarId : MVarId) :\n MetaM (Option (List MVarId))", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1566, "declarations_count": 150, "diagnostics_count": 0, "duplicate_fingerprint": "04bc8a69e4b22e42", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 520, "lean_code_chars": 955, "lean_code_ratio": 0.6098, "length_bucket": "short", "line_count": 54, "natural_language_chars": 611, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 7, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.CongrExclamation).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef Lean.MVarId.userCongr? (config : Congr!.Config) (mvarId : MVarId) :\n MetaM (Option (List MVarId))\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Tactic.CongrExclamation.Congr (L188-L194)\ndef Congr!.Config.unfoldSameFun : Congr!.Config where\n partialApp\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Tactic.CongrExclamation.Congr (L195-L198)\ndef Congr!.Config.numArgsOk (config : Config) (numArgs : Nat) : Bool\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Tactic.CongrExclamation.Congr (L199-L234)\ndef Congr!.Config.maxArgsFor (config : Config) (numArgs : Nat) : Nat\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Tactic.CongrExclamation.Congr (L235-L271)\ndef Congr!.plausiblyEqualTypes (ty1 ty2 : Expr) (maxDepth : Nat\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Tactic.CongrExclamation.for (L500-L503)\ninstance for both the LHS and the RHS.\n\nIf successful, this reduces proving `@HEq \u03b1 x \u03b2 y` to proving `\u03b1 = \u03b2`.\n-/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Tactic.CongrExclamation.CongrMetaM (L557-L559)\nabbrev CongrMetaM\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Tactic.CongrExclamation.CongrMetaM (L560-L588)\ndef CongrMetaM.nextPattern : CongrMetaM (Option (TSyntax `rcasesPat))\n```\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.CongrExclamation).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef Lean.MVarId.userCongr? (config : Congr!.Config) (mvarId : MVarId) :\n MetaM (Option (List MVarId))\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Tactic.CongrExclamation.Congr (L188-L194)\ndef Congr!.Config.unfoldSameFun : Congr!.Config where\n partialApp\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Tactic.CongrExclamation.Congr (L195-L198)\ndef Congr!.Config.numArgsOk (config : Config) (numArgs : Nat) : Bool\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Tactic.CongrExclamation.Congr (L199-L234)\ndef Congr!.Config.maxArgsFor (config : Config) (numArgs : Nat) : Nat\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Tactic.CongrExclamation.Congr (L235-L271)\ndef Congr!.plausiblyEqualTypes (ty1 ty2 : Expr) (maxDepth : Nat\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Tactic.CongrExclamation.for (L500-L503)\ninstance for both the LHS and the RHS.\n\nIf successful, this reduces proving `@HEq \u03b1 x \u03b2 y` to proving `\u03b1 = \u03b2`.\n-/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Tactic.CongrExclamation.CongrMetaM (L557-L559)\nabbrev CongrMetaM\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Tactic.CongrExclamation.CongrMetaM (L560-L588)\ndef CongrMetaM.nextPattern : CongrMetaM (Option (TSyntax `rcasesPat))\n```\n[/INST]", "sample_id": "C-Mathlib.Tactic.CongrExclamation.Lean", "source": {"declaration": "Mathlib.Tactic.CongrExclamation.Lean", "file": "Mathlib/Tactic/CongrExclamation.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.CongrExclamation", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/CongrExclamation.lean#L420", "span": "L420-L452"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "lemma RightHomotopyClass.mk_surjective [CategoryWithWeakEquivalences C] :\n Function.Surjective (mk : (X \u27f6 Y) \u2192 _)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 546, "declarations_count": 55, "diagnostics_count": 0, "duplicate_fingerprint": "2f6afabd47213a6c", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 154, "lean_code_chars": 117, "lean_code_ratio": 0.2143, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 429, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.ModelCategory.RightHomotopy).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\nlemma RightHomotopyClass.mk_surjective [CategoryWithWeakEquivalences C] :\n Function.Surjective (mk : (X \u27f6 Y) \u2192 _)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.ModelCategory.RightHomotopy).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma RightHomotopyClass.mk_surjective [CategoryWithWeakEquivalences C] :\n Function.Surjective (mk : (X \u27f6 Y) \u2192 _)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.AlgebraicTopology.ModelCategory.RightHomotopy.RightHomotopyClass", "source": {"declaration": "Mathlib.AlgebraicTopology.ModelCategory.RightHomotopy.RightHomotopyClass", "file": "Mathlib/AlgebraicTopology/ModelCategory/RightHomotopy.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.ModelCategory.RightHomotopy", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/ModelCategory/RightHomotopy.lean#L285", "span": "L285-L290"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "F", "construction": {"instruction": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.", "statement": "lemma Shrink.rec_equivShrink {\u03b1 : Type*} [Small.{w} \u03b1] {F : Shrink \u03b1 \u2192 Sort v}\n {f : (a : \u03b1) \u2192 F (equivShrink \u03b1 a)} (a : \u03b1) : Shrink.rec f (equivShrink _ a) = f a", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 633, "declarations_count": 68, "diagnostics_count": 0, "duplicate_fingerprint": "21aa13aef1a2be7b", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 202, "lean_code_chars": 166, "lean_code_ratio": 0.2622, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 467, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Small.Defs).", "role": "system"}, {"content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\nlemma Shrink.rec_equivShrink {\u03b1 : Type*} [Small.{w} \u03b1] {F : Shrink \u03b1 \u2192 Sort v}\n {f : (a : \u03b1) \u2192 F (equivShrink \u03b1 a)} (a : \u03b1) : Shrink.rec f (equivShrink _ a) = f a\n```\n\nDeclaration: `Mathlib.Logic.Small.Defs.Shrink` (module Mathlib.Logic.Small.Defs).", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Small.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\nlemma Shrink.rec_equivShrink {\u03b1 : Type*} [Small.{w} \u03b1] {F : Shrink \u03b1 \u2192 Sort v}\n {f : (a : \u03b1) \u2192 F (equivShrink \u03b1 a)} (a : \u03b1) : Shrink.rec f (equivShrink _ a) = f a\n```\n\nDeclaration: `Mathlib.Logic.Small.Defs.Shrink` (module Mathlib.Logic.Small.Defs).[/INST]", "sample_id": "F-Mathlib.Logic.Small.Defs.Shrink", "source": {"declaration": "Mathlib.Logic.Small.Defs.Shrink", "file": "Mathlib/Logic/Small/Defs.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Logic.Small.Defs", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Logic/Small/Defs.lean#L72", "span": "L72-L76"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "instance fixedPoints.decidable [DecidableEq \u03b1] (f : \u03b1 \u2192 \u03b1) (x : \u03b1) :\n Decidable (x \u2208 fixedPoints f)\n:= thisIsWrongLemmaNameXYZ\nIsFixedPt.decidable", "diagnostic": "[CompilationUnit(i_begin=0, i_end=157, messages=[Message(data=\"Function expected at\\n fixedPoints\\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 `fixedPoints` 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=19), pos_end=Position(line=2, column=32), 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)]", "mutation_kind": "rewrite_lemma_name_broken", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1592, "declarations_count": 194, "diagnostics_count": 1, "duplicate_fingerprint": "de097dd0f271933c", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 423, "lean_code_chars": 150, "lean_code_ratio": 0.0942, "length_bucket": "tiny", "line_count": 15, "natural_language_chars": 1442, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.FixedPoints.Basic).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ninstance fixedPoints.decidable [DecidableEq \u03b1] (f : \u03b1 \u2192 \u03b1) (x : \u03b1) :\n Decidable (x \u2208 fixedPoints f)\n:= thisIsWrongLemmaNameXYZ\nIsFixedPt.decidable\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=157, messages=[Message(data=\"Function expected at\\n fixedPoints\\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 `fixedPoints` 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=19), pos_end=Position(line=2, column=32), 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.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.FixedPoints.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ninstance fixedPoints.decidable [DecidableEq \u03b1] (f : \u03b1 \u2192 \u03b1) (x : \u03b1) :\n Decidable (x \u2208 fixedPoints f)\n:= thisIsWrongLemmaNameXYZ\nIsFixedPt.decidable\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=157, messages=[Message(data=\"Function expected at\\n fixedPoints\\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 `fixedPoints` 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=19), pos_end=Position(line=2, column=32), 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]", "sample_id": "B-Mathlib.Dynamics.FixedPoints.Basic.fixedPoints", "source": {"declaration": "Mathlib.Dynamics.FixedPoints.Basic.fixedPoints", "file": "Mathlib/Dynamics/FixedPoints/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Dynamics.FixedPoints.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Dynamics/FixedPoints/Basic.lean#L121", "span": "L121-L124"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Computability.DFA.evalFrom (L74-L76)\ndef evalFrom (s : \u03c3) : List \u03b1 \u2192 \u03c3 :=\nList.foldl M.step s", "-- Mathlib.Computability.DFA.evalFrom_nil (L78-L80)\ntheorem evalFrom_nil (s : \u03c3) : M.evalFrom s [] = s :=\nrfl", "-- Mathlib.Computability.DFA.evalFrom_cons (L82-L85)\ntheorem evalFrom_cons (s : \u03c3) (a : \u03b1) (x : List \u03b1) :\n M.evalFrom s (a :: x) = M.evalFrom (M.step s a) x :=\nrfl", "-- Mathlib.Computability.DFA.evalFrom_singleton (L87-L89)\ntheorem evalFrom_singleton (s : \u03c3) (a : \u03b1) : M.evalFrom s [a] = M.step s a :=\nrfl", "-- Mathlib.Computability.DFA.evalFrom_append_singleton (L91-L95)\ntheorem evalFrom_append_singleton (s : \u03c3) (x : List \u03b1) (a : \u03b1) :\n M.evalFrom s (x ++ [a]) = M.step (M.evalFrom s x) a := by\nsimp only [evalFrom, List.foldl_append, List.foldl_cons, List.foldl_nil]\n\n/-- `M.eval x` evaluates `M` with input `x` starting from the state `M.start`. -/", "-- Mathlib.Computability.DFA.eval (L96-L98)\ndef eval : List \u03b1 \u2192 \u03c3 :=\nM.evalFrom M.start", "-- Mathlib.Computability.DFA.eval_nil (L100-L102)\ntheorem eval_nil : M.eval [] = M.start :=\nrfl", "-- Mathlib.Computability.DFA.eval_singleton (L104-L106)\ntheorem eval_singleton (a : \u03b1) : M.eval [a] = M.step M.start a :=\nrfl", "-- Mathlib.Computability.DFA.eval_append_singleton (L108-L110)\ntheorem eval_append_singleton (x : List \u03b1) (a : \u03b1) : M.eval (x ++ [a]) = M.step (M.eval x) a :=\nevalFrom_append_singleton _ _ _ _", "-- Mathlib.Computability.DFA.acceptsFrom (L118-L119)\ndef acceptsFrom (s : \u03c3) : Language \u03b1 := {x | M.evalFrom s x \u2208 M.accept}", "-- Mathlib.Computability.DFA.mem_acceptsFrom (L120-L123)\ntheorem mem_acceptsFrom {s : \u03c3} {x : List \u03b1} :\n x \u2208 M.acceptsFrom s \u2194 M.evalFrom s x \u2208 M.accept := by rfl\n/-- `M.accepts` is the language of `x` such that `M.eval x` is an accept state. -/", "-- Mathlib.Computability.DFA.accepts (L124-L125)\ndef accepts : Language \u03b1 := M.acceptsFrom M.start", "-- Mathlib.Computability.DFA.mem_accepts (L126-L127)\ntheorem mem_accepts {x : List \u03b1} : x \u2208 M.accepts \u2194 M.eval x \u2208 M.accept := by rfl", "-- Mathlib.Computability.DFA.evalFrom_split (L128-L157)\ntheorem evalFrom_split [Fintype \u03c3] {x : List \u03b1} {s t : \u03c3} (hlen : Fintype.card \u03c3 \u2264 x.length)\n (hx : M.evalFrom s x = t) :\n \u2203 q a b c,\n x = a ++ b ++ c \u2227\n a.length + b.length \u2264 Fintype.card \u03c3 \u2227\n b \u2260 [] \u2227 M.evalFrom s a = q \u2227 M.evalFrom q b = q \u2227 M.evalFrom q c = t := by\nobtain \u27e8n, m, hneq, heq\u27e9 :=\n Fintype.exists_ne_map_eq_of_card_lt\n (fun n : Fin (Fintype.card \u03c3 + 1) => M.evalFrom s (x.take n)) (by simp)\n wlog hle : (n : \u2115) \u2264 m generalizing n m\n \u00b7 exact this m n hneq.symm heq.symm (le_of_not_ge hle)\n refine\n \u27e8M.evalFrom s ((x.take m).take n), (x.take m).take n, (x.take m).drop n,\n x.drop m, ?_, ?_, ?_, by rfl, ?_\u27e9\n \u00b7 rw [List.take_append_drop, List.take_append_drop]\n \u00b7 simp only [List.length_drop, List.length_take]\n omega\n \u00b7 intro h\n have hlen' := congr_arg List.length h\n simp only [List.length_drop, List.length, List.length_take] at hlen'\n omega\n have hq : M.evalFrom (M.evalFrom s ((x.take m).take n)) ((x.take m).drop n) =\n M.evalFrom s ((x.take m).take n) := by\n rw [List.take_take, min_eq_left hle, \u2190 evalFrom_of_append, heq, \u2190 min_eq_left hle, \u2190\n List.take_take, min_eq_left hle, List.take_append_drop]\n use hq\n rwa [\u2190 hq, \u2190 evalFrom_of_append, \u2190 evalFrom_of_append, \u2190 List.append_assoc,\n List.take_append_drop, List.take_append_drop]\n\nset_option backward.isDefEq.respectTransparency false in", "-- Mathlib.Computability.DFA.evalFrom_of_pow (L158-L172)\ntheorem evalFrom_of_pow {x y : List \u03b1} {s : \u03c3} (hx : M.evalFrom s x = s)\n (hy : y \u2208 ({x} : Language \u03b1)\u2217) : M.evalFrom s y = s := by\nrw [Language.mem_kstar] at hy\n rcases hy with \u27e8S, rfl, hS\u27e9\n induction S with\n | nil => rfl\n | cons a S ih =>\n have ha := hS a List.mem_cons_self\n rw [Set.mem_singleton_iff] at ha\n rw [List.flatten_cons, evalFrom_of_append, ha, hx]\n apply ih\n intro z hz\n exact hS z (List.mem_cons_of_mem a hz)\n\nset_option backward.isDefEq.respectTransparency false in"], "statement": "theorem evalFrom_of_append (start : \u03c3) (x y : List \u03b1) :\n M.evalFrom start (x ++ y) = M.evalFrom (M.evalFrom start x) y", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 4947, "declarations_count": 531, "diagnostics_count": 0, "duplicate_fingerprint": "8b37a1f4f87dba27", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1783, "lean_code_chars": 4128, "lean_code_ratio": 0.8344, "length_bucket": "short", "line_count": 156, "natural_language_chars": 819, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 15, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.DFA).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem evalFrom_of_append (start : \u03c3) (x y : List \u03b1) :\n M.evalFrom start (x ++ y) = M.evalFrom (M.evalFrom start x) y\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Computability.DFA.evalFrom (L74-L76)\ndef evalFrom (s : \u03c3) : List \u03b1 \u2192 \u03c3 :=\nList.foldl M.step s\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Computability.DFA.evalFrom_nil (L78-L80)\ntheorem evalFrom_nil (s : \u03c3) : M.evalFrom s [] = s :=\nrfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Computability.DFA.evalFrom_cons (L82-L85)\ntheorem evalFrom_cons (s : \u03c3) (a : \u03b1) (x : List \u03b1) :\n M.evalFrom s (a :: x) = M.evalFrom (M.step s a) x :=\nrfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Computability.DFA.evalFrom_singleton (L87-L89)\ntheorem evalFrom_singleton (s : \u03c3) (a : \u03b1) : M.evalFrom s [a] = M.step s a :=\nrfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Computability.DFA.evalFrom_append_singleton (L91-L95)\ntheorem evalFrom_append_singleton (s : \u03c3) (x : List \u03b1) (a : \u03b1) :\n M.evalFrom s (x ++ [a]) = M.step (M.evalFrom s x) a := by\nsimp only [evalFrom, List.foldl_append, List.foldl_cons, List.foldl_nil]\n\n/-- `M.eval x` evaluates `M` with input `x` starting from the state `M.start`. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Computability.DFA.eval (L96-L98)\ndef eval : List \u03b1 \u2192 \u03c3 :=\nM.evalFrom M.start\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Computability.DFA.eval_nil (L100-L102)\ntheorem eval_nil : M.eval [] = M.start :=\nrfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Computability.DFA.eval_singleton (L104-L106)\ntheorem eval_singleton (a : \u03b1) : M.eval [a] = M.step M.start a :=\nrfl\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Computability.DFA.eval_append_singleton (L108-L110)\ntheorem eval_append_singleton (x : List \u03b1) (a : \u03b1) : M.eval (x ++ [a]) = M.step (M.eval x) a :=\nevalFrom_append_singleton _ _ _ _\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Computability.DFA.acceptsFrom (L118-L119)\ndef acceptsFrom (s : \u03c3) : Language \u03b1 := {x | M.evalFrom s x \u2208 M.accept}\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Computability.DFA.mem_acceptsFrom (L120-L123)\ntheorem mem_acceptsFrom {s : \u03c3} {x : List \u03b1} :\n x \u2208 M.acceptsFrom s \u2194 M.evalFrom s x \u2208 M.accept := by rfl\n/-- `M.accepts` is the language of `x` such that `M.eval x` is an accept state. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Computability.DFA.accepts (L124-L125)\ndef accepts : Language \u03b1 := M.acceptsFrom M.start\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Computability.DFA.mem_accepts (L126-L127)\ntheorem mem_accepts {x : List \u03b1} : x \u2208 M.accepts \u2194 M.eval x \u2208 M.accept := by rfl\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Computability.DFA.evalFrom_split (L128-L157)\ntheorem evalFrom_split [Fintype \u03c3] {x : List \u03b1} {s t : \u03c3} (hlen : Fintype.card \u03c3 \u2264 x.length)\n (hx : M.evalFrom s x = t) :\n \u2203 q a b c,\n x = a ++ b ++ c \u2227\n a.length + b.length \u2264 Fintype.card \u03c3 \u2227\n b \u2260 [] \u2227 M.evalFrom s a = q \u2227 M.evalFrom q b = q \u2227 M.evalFrom q c = t := by\nobtain \u27e8n, m, hneq, heq\u27e9 :=\n Fintype.exists_ne_map_eq_of_card_lt\n (fun n : Fin (Fintype.card \u03c3 + 1) => M.evalFrom s (x.take n)) (by simp)\n wlog hle : (n : \u2115) \u2264 m generalizing n m\n \u00b7 exact this m n hneq.symm heq.symm (le_of_not_ge hle)\n refine\n \u27e8M.evalFrom s ((x.take m).take n), (x.take m).take n, (x.take m).drop n,\n x.drop m, ?_, ?_, ?_, by rfl, ?_\u27e9\n \u00b7 rw [List.take_append_drop, List.take_append_drop]\n \u00b7 simp only [List.length_drop, List.length_take]\n omega\n \u00b7 intro h\n have hlen' := congr_arg List.length h\n simp only [List.length_drop, List.length, List.length_take] at hlen'\n omega\n have hq : M.evalFrom (M.evalFrom s ((x.take m).take n)) ((x.take m).drop n) =\n M.evalFrom s ((x.take m).take n) := by\n rw [List.take_take, min_eq_left hle, \u2190 evalFrom_of_append, heq, \u2190 min_eq_left hle, \u2190\n List.take_take, min_eq_left hle, List.take_append_drop]\n use hq\n rwa [\u2190 hq, \u2190 evalFrom_of_append, \u2190 evalFrom_of_append, \u2190 List.append_assoc,\n List.take_append_drop, List.take_append_drop]\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Computability.DFA.evalFrom_of_pow (L158-L172)\ntheorem evalFrom_of_pow {x y : List \u03b1} {s : \u03c3} (hx : M.evalFrom s x = s)\n (hy : y \u2208 ({x} : Language \u03b1)\u2217) : M.evalFrom s y = s := by\nrw [Language.mem_kstar] at hy\n rcases hy with \u27e8S, rfl, hS\u27e9\n induction S with\n | nil => rfl\n | cons a S ih =>\n have ha := hS a List.mem_cons_self\n rw [Set.mem_singleton_iff] at ha\n rw [List.flatten_cons, evalFrom_of_append, ha, hx]\n apply ih\n intro z hz\n exact hS z (List.mem_cons_of_mem a hz)\n\nset_option backward.isDefEq.respectTransparency false in\n```\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.DFA).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem evalFrom_of_append (start : \u03c3) (x y : List \u03b1) :\n M.evalFrom start (x ++ y) = M.evalFrom (M.evalFrom start x) y\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Computability.DFA.evalFrom (L74-L76)\ndef evalFrom (s : \u03c3) : List \u03b1 \u2192 \u03c3 :=\nList.foldl M.step s\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Computability.DFA.evalFrom_nil (L78-L80)\ntheorem evalFrom_nil (s : \u03c3) : M.evalFrom s [] = s :=\nrfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Computability.DFA.evalFrom_cons (L82-L85)\ntheorem evalFrom_cons (s : \u03c3) (a : \u03b1) (x : List \u03b1) :\n M.evalFrom s (a :: x) = M.evalFrom (M.step s a) x :=\nrfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Computability.DFA.evalFrom_singleton (L87-L89)\ntheorem evalFrom_singleton (s : \u03c3) (a : \u03b1) : M.evalFrom s [a] = M.step s a :=\nrfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Computability.DFA.evalFrom_append_singleton (L91-L95)\ntheorem evalFrom_append_singleton (s : \u03c3) (x : List \u03b1) (a : \u03b1) :\n M.evalFrom s (x ++ [a]) = M.step (M.evalFrom s x) a := by\nsimp only [evalFrom, List.foldl_append, List.foldl_cons, List.foldl_nil]\n\n/-- `M.eval x` evaluates `M` with input `x` starting from the state `M.start`. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Computability.DFA.eval (L96-L98)\ndef eval : List \u03b1 \u2192 \u03c3 :=\nM.evalFrom M.start\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Computability.DFA.eval_nil (L100-L102)\ntheorem eval_nil : M.eval [] = M.start :=\nrfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Computability.DFA.eval_singleton (L104-L106)\ntheorem eval_singleton (a : \u03b1) : M.eval [a] = M.step M.start a :=\nrfl\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Computability.DFA.eval_append_singleton (L108-L110)\ntheorem eval_append_singleton (x : List \u03b1) (a : \u03b1) : M.eval (x ++ [a]) = M.step (M.eval x) a :=\nevalFrom_append_singleton _ _ _ _\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Computability.DFA.acceptsFrom (L118-L119)\ndef acceptsFrom (s : \u03c3) : Language \u03b1 := {x | M.evalFrom s x \u2208 M.accept}\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Computability.DFA.mem_acceptsFrom (L120-L123)\ntheorem mem_acceptsFrom {s : \u03c3} {x : List \u03b1} :\n x \u2208 M.acceptsFrom s \u2194 M.evalFrom s x \u2208 M.accept := by rfl\n/-- `M.accepts` is the language of `x` such that `M.eval x` is an accept state. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Computability.DFA.accepts (L124-L125)\ndef accepts : Language \u03b1 := M.acceptsFrom M.start\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Computability.DFA.mem_accepts (L126-L127)\ntheorem mem_accepts {x : List \u03b1} : x \u2208 M.accepts \u2194 M.eval x \u2208 M.accept := by rfl\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Computability.DFA.evalFrom_split (L128-L157)\ntheorem evalFrom_split [Fintype \u03c3] {x : List \u03b1} {s t : \u03c3} (hlen : Fintype.card \u03c3 \u2264 x.length)\n (hx : M.evalFrom s x = t) :\n \u2203 q a b c,\n x = a ++ b ++ c \u2227\n a.length + b.length \u2264 Fintype.card \u03c3 \u2227\n b \u2260 [] \u2227 M.evalFrom s a = q \u2227 M.evalFrom q b = q \u2227 M.evalFrom q c = t := by\nobtain \u27e8n, m, hneq, heq\u27e9 :=\n Fintype.exists_ne_map_eq_of_card_lt\n (fun n : Fin (Fintype.card \u03c3 + 1) => M.evalFrom s (x.take n)) (by simp)\n wlog hle : (n : \u2115) \u2264 m generalizing n m\n \u00b7 exact this m n hneq.symm heq.symm (le_of_not_ge hle)\n refine\n \u27e8M.evalFrom s ((x.take m).take n), (x.take m).take n, (x.take m).drop n,\n x.drop m, ?_, ?_, ?_, by rfl, ?_\u27e9\n \u00b7 rw [List.take_append_drop, List.take_append_drop]\n \u00b7 simp only [List.length_drop, List.length_take]\n omega\n \u00b7 intro h\n have hlen' := congr_arg List.length h\n simp only [List.length_drop, List.length, List.length_take] at hlen'\n omega\n have hq : M.evalFrom (M.evalFrom s ((x.take m).take n)) ((x.take m).drop n) =\n M.evalFrom s ((x.take m).take n) := by\n rw [List.take_take, min_eq_left hle, \u2190 evalFrom_of_append, heq, \u2190 min_eq_left hle, \u2190\n List.take_take, min_eq_left hle, List.take_append_drop]\n use hq\n rwa [\u2190 hq, \u2190 evalFrom_of_append, \u2190 evalFrom_of_append, \u2190 List.append_assoc,\n List.take_append_drop, List.take_append_drop]\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Computability.DFA.evalFrom_of_pow (L158-L172)\ntheorem evalFrom_of_pow {x y : List \u03b1} {s : \u03c3} (hx : M.evalFrom s x = s)\n (hy : y \u2208 ({x} : Language \u03b1)\u2217) : M.evalFrom s y = s := by\nrw [Language.mem_kstar] at hy\n rcases hy with \u27e8S, rfl, hS\u27e9\n induction S with\n | nil => rfl\n | cons a S ih =>\n have ha := hS a List.mem_cons_self\n rw [Set.mem_singleton_iff] at ha\n rw [List.flatten_cons, evalFrom_of_append, ha, hx]\n apply ih\n intro z hz\n exact hS z (List.mem_cons_of_mem a hz)\n\nset_option backward.isDefEq.respectTransparency false in\n```\n[/INST]", "sample_id": "C-Mathlib.Computability.DFA.evalFrom_of_append", "source": {"declaration": "Mathlib.Computability.DFA.evalFrom_of_append", "file": "Mathlib/Computability/DFA.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Computability.DFA", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Computability/DFA.lean#L111", "span": "L111-L117"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\ntheorem map_sub_nat (x : \u211d) (n : \u2115) : f (x - n) = f x - n := f.map_sub_int x n\n```", "instruction": "Edit `map_sub_nat` so it still compiles and the proof is simplified where possible. Return the full updated `map_sub_nat` block.", "proof_is_oneliner": false, "target_span": "L336-L338", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 854, "declarations_count": 89, "diagnostics_count": 0, "duplicate_fingerprint": "139bb1dd0fb31743", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 267, "lean_code_chars": 79, "lean_code_ratio": 0.0925, "length_bucket": "tiny", "line_count": 10, "natural_language_chars": 775, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.Circle.RotationNumber.TranslationNumber).", "role": "system"}, {"content": "You are editing a file in `Mathlib/Dynamics/Circle/RotationNumber/TranslationNumber.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Dynamics.Circle.RotationNumber.TranslationNumber.map_sub_nat`, L336-L338)\n```lean\ntheorem map_sub_nat (x : \u211d) (n : \u2115) : f (x - n) = f x - n := f.map_sub_int x n\n```\n\n## Edit instruction\nEdit `map_sub_nat` so it still compiles and the proof is simplified where possible. Return the full updated `map_sub_nat` block.\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.Circle.RotationNumber.TranslationNumber).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Dynamics/Circle/RotationNumber/TranslationNumber.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Dynamics.Circle.RotationNumber.TranslationNumber.map_sub_nat`, L336-L338)\n```lean\ntheorem map_sub_nat (x : \u211d) (n : \u2115) : f (x - n) = f x - n := f.map_sub_int x n\n```\n\n## Edit instruction\nEdit `map_sub_nat` so it still compiles and the proof is simplified where possible. Return the full updated `map_sub_nat` block.\n[/INST]", "sample_id": "D-Mathlib.Dynamics.Circle.RotationNumber.TranslationNumber.map_sub_nat", "source": {"declaration": "Mathlib.Dynamics.Circle.RotationNumber.TranslationNumber.map_sub_nat", "file": "Mathlib/Dynamics/Circle/RotationNumber/TranslationNumber.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Dynamics.Circle.RotationNumber.TranslationNumber", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Dynamics/Circle/RotationNumber/TranslationNumber.lean#L336", "span": "L336-L338"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.congr_toOrderHom_apply (L42-L45)\nlemma congr_toOrderHom_apply {a b : SimplexCategory} {f g : a \u27f6 b} (h : f = g)\n (x : Fin (a.len + 1)) : f.toOrderHom x = g.toOrderHom x", "-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const (L46-L48)\ndef const (x y : SimplexCategory) (i : Fin (y.len + 1)) : x \u27f6 y", "-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const_eq_id (L50-L51)\nlemma const_eq_id : const \u298b0\u298c \u298b0\u298c 0 = \ud835\udfd9 _", "-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const_apply (L53-L55)\nlemma const_apply (x y : SimplexCategory) (i : Fin (y.len + 1)) (a : Fin (x.len + 1)) :\n (const x y i).toOrderHom a = i", "-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const_comp (L57-L61)\ntheorem const_comp (x : SimplexCategory) {y z : SimplexCategory}\n (f : y \u27f6 z) (i : Fin (y.len + 1)) :\n const x y i \u226b f = const x z (f.toOrderHom i)", "-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const_fac_thru_zero (L62-L65)\ntheorem const_fac_thru_zero (n m : SimplexCategory) (i : Fin (m.len + 1)) :\n const n m i = const n \u298b0\u298c 0 \u226b SimplexCategory.const \u298b0\u298c m i", "-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.Hom (L66-L69)\ntheorem Hom.ext_zero_left {n : SimplexCategory} (f g : \u298b0\u298c \u27f6 n)\n (h0 : f.toOrderHom 0 = g.toOrderHom 0", "-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.eq_const_of_zero (L70-L73)\ntheorem eq_const_of_zero {n : SimplexCategory} (f : \u298b0\u298c \u27f6 n) :\n f = const _ n (f.toOrderHom 0)", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.AugmentedSimplexCategory (L34-L40)\nabbrev AugmentedSimplexCategory", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.inclusion (L42-L43)\ndef inclusion : SimplexCategory \u2964 AugmentedSimplexCategory", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObjectFunctorCompDropIso (L61-L67)\ndef equivAugmentedCosimplicialObjectFunctorCompDropIso :\n equivAugmentedCosimplicialObject.functor \u22d9 CosimplicialObject.Augmented.drop \u2245\n (Functor.whiskeringLeft _ _ C).obj inclusion", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObjectFunctorCompPointIso (L69-L76)\ndef equivAugmentedCosimplicialObjectFunctorCompPointIso :\n equivAugmentedCosimplicialObject.functor \u22d9 CosimplicialObject.Augmented.point \u2245\n ((evaluation _ _).obj .star : (AugmentedSimplexCategory \u2964 C) \u2964 C)", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObject (L53-L59)\ndef equivAugmentedCosimplicialObject :\n (AugmentedSimplexCategory \u2964 C) \u224c CosimplicialObject.Augmented C", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObjectFunctorCompToArrowIso (L78-L85)\ndef equivAugmentedCosimplicialObjectFunctorCompToArrowIso :\n equivAugmentedCosimplicialObject.functor \u22d9 CosimplicialObject.Augmented.toArrow \u2245\n Functor.mapArrowFunctor _ C \u22d9\n (evaluation _ _ |>.obj <| .mk <| WithInitial.homTo <| .mk 0)"], "statement": "theorem image_\u03b9_eq {\u0394 \u0394'' : SimplexCategory} {\u03c6 : \u0394 \u27f6 \u0394''} {e : \u0394 \u27f6 image \u03c6} [Epi e]\n {i : image \u03c6 \u27f6 \u0394''} [Mono i] (fac : e \u226b i = \u03c6) : image.\u03b9 \u03c6 = i", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 3922, "declarations_count": 294, "diagnostics_count": 0, "duplicate_fingerprint": "6f0938b825af8b78", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1412, "lean_code_chars": 3108, "lean_code_ratio": 0.7925, "length_bucket": "short", "line_count": 107, "natural_language_chars": 814, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 14, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplexCategory.Basic).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem image_\u03b9_eq {\u0394 \u0394'' : SimplexCategory} {\u03c6 : \u0394 \u27f6 \u0394''} {e : \u0394 \u27f6 image \u03c6} [Epi e]\n {i : image \u03c6 \u27f6 \u0394''} [Mono i] (fac : e \u226b i = \u03c6) : image.\u03b9 \u03c6 = i\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.congr_toOrderHom_apply (L42-L45)\nlemma congr_toOrderHom_apply {a b : SimplexCategory} {f g : a \u27f6 b} (h : f = g)\n (x : Fin (a.len + 1)) : f.toOrderHom x = g.toOrderHom x\n```\n\n-- snippet 2\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const (L46-L48)\ndef const (x y : SimplexCategory) (i : Fin (y.len + 1)) : x \u27f6 y\n```\n\n-- snippet 3\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const_eq_id (L50-L51)\nlemma const_eq_id : const \u298b0\u298c \u298b0\u298c 0 = \ud835\udfd9 _\n```\n\n-- snippet 4\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const_apply (L53-L55)\nlemma const_apply (x y : SimplexCategory) (i : Fin (y.len + 1)) (a : Fin (x.len + 1)) :\n (const x y i).toOrderHom a = i\n```\n\n-- snippet 5\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const_comp (L57-L61)\ntheorem const_comp (x : SimplexCategory) {y z : SimplexCategory}\n (f : y \u27f6 z) (i : Fin (y.len + 1)) :\n const x y i \u226b f = const x z (f.toOrderHom i)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const_fac_thru_zero (L62-L65)\ntheorem const_fac_thru_zero (n m : SimplexCategory) (i : Fin (m.len + 1)) :\n const n m i = const n \u298b0\u298c 0 \u226b SimplexCategory.const \u298b0\u298c m i\n```\n\n-- snippet 7\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.Hom (L66-L69)\ntheorem Hom.ext_zero_left {n : SimplexCategory} (f g : \u298b0\u298c \u27f6 n)\n (h0 : f.toOrderHom 0 = g.toOrderHom 0\n```\n\n-- snippet 8\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.eq_const_of_zero (L70-L73)\ntheorem eq_const_of_zero {n : SimplexCategory} (f : \u298b0\u298c \u27f6 n) :\n f = const _ n (f.toOrderHom 0)\n```\n\n-- snippet 9\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.AugmentedSimplexCategory (L34-L40)\nabbrev AugmentedSimplexCategory\n```\n\n-- snippet 10\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.inclusion (L42-L43)\ndef inclusion : SimplexCategory \u2964 AugmentedSimplexCategory\n```\n\n-- snippet 11\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObjectFunctorCompDropIso (L61-L67)\ndef equivAugmentedCosimplicialObjectFunctorCompDropIso :\n equivAugmentedCosimplicialObject.functor \u22d9 CosimplicialObject.Augmented.drop \u2245\n (Functor.whiskeringLeft _ _ C).obj inclusion\n```\n\n-- snippet 12\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObjectFunctorCompPointIso (L69-L76)\ndef equivAugmentedCosimplicialObjectFunctorCompPointIso :\n equivAugmentedCosimplicialObject.functor \u22d9 CosimplicialObject.Augmented.point \u2245\n ((evaluation _ _).obj .star : (AugmentedSimplexCategory \u2964 C) \u2964 C)\n```\n\n-- snippet 13\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObject (L53-L59)\ndef equivAugmentedCosimplicialObject :\n (AugmentedSimplexCategory \u2964 C) \u224c CosimplicialObject.Augmented C\n```\n\n-- snippet 14\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObjectFunctorCompToArrowIso (L78-L85)\ndef equivAugmentedCosimplicialObjectFunctorCompToArrowIso :\n equivAugmentedCosimplicialObject.functor \u22d9 CosimplicialObject.Augmented.toArrow \u2245\n Functor.mapArrowFunctor _ C \u22d9\n (evaluation _ _ |>.obj <| .mk <| WithInitial.homTo <| .mk 0)\n```\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplexCategory.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 image_\u03b9_eq {\u0394 \u0394'' : SimplexCategory} {\u03c6 : \u0394 \u27f6 \u0394''} {e : \u0394 \u27f6 image \u03c6} [Epi e]\n {i : image \u03c6 \u27f6 \u0394''} [Mono i] (fac : e \u226b i = \u03c6) : image.\u03b9 \u03c6 = i\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.congr_toOrderHom_apply (L42-L45)\nlemma congr_toOrderHom_apply {a b : SimplexCategory} {f g : a \u27f6 b} (h : f = g)\n (x : Fin (a.len + 1)) : f.toOrderHom x = g.toOrderHom x\n```\n\n-- snippet 2\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const (L46-L48)\ndef const (x y : SimplexCategory) (i : Fin (y.len + 1)) : x \u27f6 y\n```\n\n-- snippet 3\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const_eq_id (L50-L51)\nlemma const_eq_id : const \u298b0\u298c \u298b0\u298c 0 = \ud835\udfd9 _\n```\n\n-- snippet 4\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const_apply (L53-L55)\nlemma const_apply (x y : SimplexCategory) (i : Fin (y.len + 1)) (a : Fin (x.len + 1)) :\n (const x y i).toOrderHom a = i\n```\n\n-- snippet 5\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const_comp (L57-L61)\ntheorem const_comp (x : SimplexCategory) {y z : SimplexCategory}\n (f : y \u27f6 z) (i : Fin (y.len + 1)) :\n const x y i \u226b f = const x z (f.toOrderHom i)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.const_fac_thru_zero (L62-L65)\ntheorem const_fac_thru_zero (n m : SimplexCategory) (i : Fin (m.len + 1)) :\n const n m i = const n \u298b0\u298c 0 \u226b SimplexCategory.const \u298b0\u298c m i\n```\n\n-- snippet 7\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.Hom (L66-L69)\ntheorem Hom.ext_zero_left {n : SimplexCategory} (f g : \u298b0\u298c \u27f6 n)\n (h0 : f.toOrderHom 0 = g.toOrderHom 0\n```\n\n-- snippet 8\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Basic.eq_const_of_zero (L70-L73)\ntheorem eq_const_of_zero {n : SimplexCategory} (f : \u298b0\u298c \u27f6 n) :\n f = const _ n (f.toOrderHom 0)\n```\n\n-- snippet 9\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.AugmentedSimplexCategory (L34-L40)\nabbrev AugmentedSimplexCategory\n```\n\n-- snippet 10\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.inclusion (L42-L43)\ndef inclusion : SimplexCategory \u2964 AugmentedSimplexCategory\n```\n\n-- snippet 11\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObjectFunctorCompDropIso (L61-L67)\ndef equivAugmentedCosimplicialObjectFunctorCompDropIso :\n equivAugmentedCosimplicialObject.functor \u22d9 CosimplicialObject.Augmented.drop \u2245\n (Functor.whiskeringLeft _ _ C).obj inclusion\n```\n\n-- snippet 12\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObjectFunctorCompPointIso (L69-L76)\ndef equivAugmentedCosimplicialObjectFunctorCompPointIso :\n equivAugmentedCosimplicialObject.functor \u22d9 CosimplicialObject.Augmented.point \u2245\n ((evaluation _ _).obj .star : (AugmentedSimplexCategory \u2964 C) \u2964 C)\n```\n\n-- snippet 13\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObject (L53-L59)\ndef equivAugmentedCosimplicialObject :\n (AugmentedSimplexCategory \u2964 C) \u224c CosimplicialObject.Augmented C\n```\n\n-- snippet 14\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObjectFunctorCompToArrowIso (L78-L85)\ndef equivAugmentedCosimplicialObjectFunctorCompToArrowIso :\n equivAugmentedCosimplicialObject.functor \u22d9 CosimplicialObject.Augmented.toArrow \u2245\n Functor.mapArrowFunctor _ C \u22d9\n (evaluation _ _ |>.obj <| .mk <| WithInitial.homTo <| .mk 0)\n```\n[/INST]", "sample_id": "C-Mathlib.AlgebraicTopology.SimplexCategory.Basic.image_\u03b9_eq", "source": {"declaration": "Mathlib.AlgebraicTopology.SimplexCategory.Basic.image_\u03b9_eq", "file": "Mathlib/AlgebraicTopology/SimplexCategory/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.SimplexCategory.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/SimplexCategory/Basic.lean#L863", "span": "L863-L868"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"trace_states": [{"state": "theorem isDiscrete_tfae (X : LightCondSet.{u}) :\n TFAE\n [ X.IsDiscrete\n , IsIso ((LightCondensed.discreteUnderlyingAdj _).counit.app X)\n , (LightCondensed.discrete _).essImage X\n , LightCondSet.LocallyConstant.functor.essImage X\n , IsIso (LightCondSet.LocallyConstant.adjunction.counit.app X)\n , \u2200 S : LightProfinite.{u}, Nonempty\n (IsColimit <| X.obj.mapCocone (coconeRightOpOfCone S.asLimitCone))\n ]", "tactic": "have : functor.Faithful := inferInstance"}, {"state": "", "tactic": "have : functor.Full := inferInstance -- These `have` statements above shouldn't be needed, but they are. Sheaf.isConstant_iff_isIso_counit_app' _ LightProfinite.isTerminalPUnit adjunction X tfae_have 6 \u2192 4 := fun h \u21a6 mem_locallyConstant_essImage_of_isColimit_mapCocone X (fun S \u21a6 (h S).some) tfae_have 4 \u2192 6 := fun \u27e8Y, \u27e8i\u27e9\u27e9 S \u21a6 \u27e8IsColimit.mapCoconeEquiv ((sheafToPresheaf _ _).mapIso i) (LightCondensed.isColimitLocallyConstantPresheafDiagram Y S)\u27e9 tfae_finish end LightCondSet namespace LightCondMod variable (R : Type u) [Ring R]"}], "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1741, "declarations_count": 166, "diagnostics_count": 0, "duplicate_fingerprint": "e9a2b429929f15a9", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 553, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "short", "line_count": 20, "natural_language_chars": 1741, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Condensed.Discrete.Characterization).", "role": "system"}, {"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.Condensed.Discrete.Characterization.isDiscrete_tfae`:\nState 0: \u22a2 theorem isDiscrete_tfae (X : LightCondSet.{u}) :\n TFAE\n [ X.IsDiscrete\n , IsIso ((LightCondensed.discreteUnderlyingAdj _).counit.app X)\n , (LightCondensed.discrete _).essImage X\n , LightCondSet.LocallyConstant.functor.essImage X\n , IsIso (LightCondSet.LocallyConstant.adjunction.counit.app X)\n , \u2200 S : LightProfinite.{u}, Nonempty\n (IsColimit <| X.obj.mapCocone (coconeRightOpOfCone S.asLimitCone))\n ]\nTactic: have : functor.Faithful := inferInstance\nState 1: \u22a2 \nTactic: have : functor.Full := inferInstance -- These `have` statements above shouldn't be needed, but they are. Sheaf.isConstant_iff_isIso_counit_app' _ LightProfinite.isTerminalPUnit adjunction X tfae_have 6 \u2192 4 := fun h \u21a6 mem_locallyConstant_essImage_of_isColimit_mapCocone X (fun S \u21a6 (h S).some) tfae_have 4 \u2192 6 := fun \u27e8Y, \u27e8i\u27e9\u27e9 S \u21a6 \u27e8IsColimit.mapCoconeEquiv ((sheafToPresheaf _ _).mapIso i) (LightCondensed.isColimitLocallyConstantPresheafDiagram Y S)\u27e9 tfae_finish end LightCondSet namespace LightCondMod variable (R : Type u) [Ring R]\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Condensed.Discrete.Characterization).[/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.Condensed.Discrete.Characterization.isDiscrete_tfae`:\nState 0: \u22a2 theorem isDiscrete_tfae (X : LightCondSet.{u}) :\n TFAE\n [ X.IsDiscrete\n , IsIso ((LightCondensed.discreteUnderlyingAdj _).counit.app X)\n , (LightCondensed.discrete _).essImage X\n , LightCondSet.LocallyConstant.functor.essImage X\n , IsIso (LightCondSet.LocallyConstant.adjunction.counit.app X)\n , \u2200 S : LightProfinite.{u}, Nonempty\n (IsColimit <| X.obj.mapCocone (coconeRightOpOfCone S.asLimitCone))\n ]\nTactic: have : functor.Faithful := inferInstance\nState 1: \u22a2 \nTactic: have : functor.Full := inferInstance -- These `have` statements above shouldn't be needed, but they are. Sheaf.isConstant_iff_isIso_counit_app' _ LightProfinite.isTerminalPUnit adjunction X tfae_have 6 \u2192 4 := fun h \u21a6 mem_locallyConstant_essImage_of_isColimit_mapCocone X (fun S \u21a6 (h S).some) tfae_have 4 \u2192 6 := fun \u27e8Y, \u27e8i\u27e9\u27e9 S \u21a6 \u27e8IsColimit.mapCoconeEquiv ((sheafToPresheaf _ _).mapIso i) (LightCondensed.isColimitLocallyConstantPresheafDiagram Y S)\u27e9 tfae_finish end LightCondSet namespace LightCondMod variable (R : Type u) [Ring R]\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.Condensed.Discrete.Characterization.isDiscrete_tfae", "source": {"declaration": "Mathlib.Condensed.Discrete.Characterization.isDiscrete_tfae", "file": "Mathlib/Condensed/Discrete/Characterization.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Condensed.Discrete.Characterization", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Condensed/Discrete/Characterization.lean#L198", "span": "L198-L228"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem symm_symm_apply (f : \u03b1 \u2243 \u03b2) (b : \u03b1) : f.symm.symm b = f b", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 466, "declarations_count": 54, "diagnostics_count": 0, "duplicate_fingerprint": "840a1886d4c2fc1a", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 145, "lean_code_chars": 66, "lean_code_ratio": 0.1416, "length_bucket": "tiny", "line_count": 7, "natural_language_chars": 400, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Equiv.Defs).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem symm_symm_apply (f : \u03b1 \u2243 \u03b2) (b : \u03b1) : f.symm.symm b = f b\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Equiv.Defs).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem symm_symm_apply (f : \u03b1 \u2243 \u03b2) (b : \u03b1) : f.symm.symm b = f b\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Logic.Equiv.Defs.symm_symm_apply", "source": {"declaration": "Mathlib.Logic.Equiv.Defs.symm_symm_apply", "file": "Mathlib/Logic/Equiv/Defs.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Logic.Equiv.Defs", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Logic/Equiv/Defs.lean#L275", "span": "L275-L276"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\ntheorem union_apply_left {\u03b1} {s t : Set \u03b1} [DecidablePred fun x => x \u2208 s] (H : Disjoint s t)\n {a : (s \u222a t : Set \u03b1)} (ha : \u2191a \u2208 s) : Equiv.Set.union H a = Sum.inl \u27e8a, ha\u27e9 := dif_pos ha\n```", "instruction": "Edit `union_apply_left` so it still compiles and the proof is simplified where possible. Return the full updated `union_apply_left` block.", "proof_is_oneliner": false, "target_span": "L236-L239", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 878, "declarations_count": 104, "diagnostics_count": 0, "duplicate_fingerprint": "3b31b8b0865f9d70", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 299, "lean_code_chars": 187, "lean_code_ratio": 0.213, "length_bucket": "tiny", "line_count": 11, "natural_language_chars": 691, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Equiv.Set).", "role": "system"}, {"content": "You are editing a file in `Mathlib/Logic/Equiv/Set.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Logic.Equiv.Set.union_apply_left`, L236-L239)\n```lean\ntheorem union_apply_left {\u03b1} {s t : Set \u03b1} [DecidablePred fun x => x \u2208 s] (H : Disjoint s t)\n {a : (s \u222a t : Set \u03b1)} (ha : \u2191a \u2208 s) : Equiv.Set.union H a = Sum.inl \u27e8a, ha\u27e9 := dif_pos ha\n```\n\n## Edit instruction\nEdit `union_apply_left` so it still compiles and the proof is simplified where possible. Return the full updated `union_apply_left` block.\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Equiv.Set).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Logic/Equiv/Set.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Logic.Equiv.Set.union_apply_left`, L236-L239)\n```lean\ntheorem union_apply_left {\u03b1} {s t : Set \u03b1} [DecidablePred fun x => x \u2208 s] (H : Disjoint s t)\n {a : (s \u222a t : Set \u03b1)} (ha : \u2191a \u2208 s) : Equiv.Set.union H a = Sum.inl \u27e8a, ha\u27e9 := dif_pos ha\n```\n\n## Edit instruction\nEdit `union_apply_left` so it still compiles and the proof is simplified where possible. Return the full updated `union_apply_left` block.\n[/INST]", "sample_id": "D-Mathlib.Logic.Equiv.Set.union_apply_left", "source": {"declaration": "Mathlib.Logic.Equiv.Set.union_apply_left", "file": "Mathlib/Logic/Equiv/Set.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Logic.Equiv.Set", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Logic/Equiv/Set.lean#L236", "span": "L236-L239"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "def mapCechConerve {f g : Arrow C}\n [\u2200 n : \u2115, HasWidePushout f.left (fun _ : Fin (n + 1) => f.right) fun _ => f.hom]\n [\u2200 n : \u2115, HasWidePushout g.left (fun _ : Fin (n + 1) => g.right) fun _ => g.hom] (F : f \u27f6 g) :\n f.cechConerve \u27f6 g.cechConerve where\n app n", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 678, "declarations_count": 82, "diagnostics_count": 0, "duplicate_fingerprint": "79243022529453b3", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 230, "lean_code_chars": 267, "lean_code_ratio": 0.3938, "length_bucket": "tiny", "line_count": 11, "natural_language_chars": 411, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.CechNerve).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ndef mapCechConerve {f g : Arrow C}\n [\u2200 n : \u2115, HasWidePushout f.left (fun _ : Fin (n + 1) => f.right) fun _ => f.hom]\n [\u2200 n : \u2115, HasWidePushout g.left (fun _ : Fin (n + 1) => g.right) fun _ => g.hom] (F : f \u27f6 g) :\n f.cechConerve \u27f6 g.cechConerve where\n app n\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.CechNerve).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ndef mapCechConerve {f g : Arrow C}\n [\u2200 n : \u2115, HasWidePushout f.left (fun _ : Fin (n + 1) => f.right) fun _ => f.hom]\n [\u2200 n : \u2115, HasWidePushout g.left (fun _ : Fin (n + 1) => g.right) fun _ => g.hom] (F : f \u27f6 g) :\n f.cechConerve \u27f6 g.cechConerve where\n app n\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.AlgebraicTopology.CechNerve.mapCechConerve", "source": {"declaration": "Mathlib.AlgebraicTopology.CechNerve.mapCechConerve", "file": "Mathlib/AlgebraicTopology/CechNerve.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.CechNerve", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/CechNerve.lean#L196", "span": "L196-L205"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "def decodeBool : List Bool \u2192 Bool\n | b :: _ => b\n | _ => Inhabited.default", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 483, "declarations_count": 56, "diagnostics_count": 0, "duplicate_fingerprint": "eb508ea1369f7374", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 135, "lean_code_chars": 77, "lean_code_ratio": 0.1594, "length_bucket": "tiny", "line_count": 9, "natural_language_chars": 406, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.Encoding).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ndef decodeBool : List Bool \u2192 Bool\n | b :: _ => b\n | _ => Inhabited.default\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.Encoding).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ndef decodeBool : List Bool \u2192 Bool\n | b :: _ => b\n | _ => Inhabited.default\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Computability.Encoding.decodeBool", "source": {"declaration": "Mathlib.Computability.Encoding.decodeBool", "file": "Mathlib/Computability/Encoding.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Computability.Encoding", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Computability/Encoding.lean#L189", "span": "L189-L192"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "theorem up_down {f : Type u\u2080 \u2192 Type u\u2081} {g : Type max u\u2080 v\u2080 \u2192 Type v\u2081} [ULiftable f g] {\u03b1}\n (x : g (ULift.{v\u2080} \u03b1)) : up (down x : f \u03b1) = x\n:= thisIsWrongLemmaNameXYZ\n(ULiftable.congr Equiv.ulift.symm).right_inv _", "diagnostic": "[CompilationUnit(i_begin=0, i_end=234, messages=[Message(data=\"Function expected at\\n up\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n (down x : f \u03b1)\\n\\nHint: The identifier `up` 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=46), 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)]", "mutation_kind": "rewrite_lemma_name_broken", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1644, "declarations_count": 216, "diagnostics_count": 1, "duplicate_fingerprint": "281b608da471ceb4", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 474, "lean_code_chars": 216, "lean_code_ratio": 0.1314, "length_bucket": "tiny", "line_count": 15, "natural_language_chars": 1428, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Control.ULiftable).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem up_down {f : Type u\u2080 \u2192 Type u\u2081} {g : Type max u\u2080 v\u2080 \u2192 Type v\u2081} [ULiftable f g] {\u03b1}\n (x : g (ULift.{v\u2080} \u03b1)) : up (down x : f \u03b1) = x\n:= thisIsWrongLemmaNameXYZ\n(ULiftable.congr Equiv.ulift.symm).right_inv _\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=234, messages=[Message(data=\"Function expected at\\n up\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n (down x : f \u03b1)\\n\\nHint: The identifier `up` 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=46), 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.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Control.ULiftable).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem up_down {f : Type u\u2080 \u2192 Type u\u2081} {g : Type max u\u2080 v\u2080 \u2192 Type v\u2081} [ULiftable f g] {\u03b1}\n (x : g (ULift.{v\u2080} \u03b1)) : up (down x : f \u03b1) = x\n:= thisIsWrongLemmaNameXYZ\n(ULiftable.congr Equiv.ulift.symm).right_inv _\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=234, messages=[Message(data=\"Function expected at\\n up\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n (down x : f \u03b1)\\n\\nHint: The identifier `up` 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=46), 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]", "sample_id": "B-Mathlib.Control.ULiftable.up_down", "source": {"declaration": "Mathlib.Control.ULiftable.up_down", "file": "Mathlib/Control/ULiftable.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Control.ULiftable", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Control/ULiftable.lean#L108", "span": "L108-L111"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem map_birkhoffSum {F N : Type*} [AddCommMonoid N] [FunLike F M N] [AddMonoidHomClass F M N]\n (g' : F) (f : \u03b1 \u2192 \u03b1) (g : \u03b1 \u2192 M) (n : \u2115) (x : \u03b1) :\n g' (birkhoffSum f g n x) = birkhoffSum f (g' \u2218 g) n x", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 621, "declarations_count": 80, "diagnostics_count": 0, "duplicate_fingerprint": "1ed8457098b855db", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 213, "lean_code_chars": 211, "lean_code_ratio": 0.3398, "length_bucket": "tiny", "line_count": 9, "natural_language_chars": 410, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.BirkhoffSum.Basic).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem map_birkhoffSum {F N : Type*} [AddCommMonoid N] [FunLike F M N] [AddMonoidHomClass F M N]\n (g' : F) (f : \u03b1 \u2192 \u03b1) (g : \u03b1 \u2192 M) (n : \u2115) (x : \u03b1) :\n g' (birkhoffSum f g n x) = birkhoffSum f (g' \u2218 g) n x\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.BirkhoffSum.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem map_birkhoffSum {F N : Type*} [AddCommMonoid N] [FunLike F M N] [AddMonoidHomClass F M N]\n (g' : F) (f : \u03b1 \u2192 \u03b1) (g : \u03b1 \u2192 M) (n : \u2115) (x : \u03b1) :\n g' (birkhoffSum f g n x) = birkhoffSum f (g' \u2218 g) n x\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Dynamics.BirkhoffSum.Basic.map_birkhoffSum", "source": {"declaration": "Mathlib.Dynamics.BirkhoffSum.Basic.map_birkhoffSum", "file": "Mathlib/Dynamics/BirkhoffSum/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Dynamics.BirkhoffSum.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Dynamics/BirkhoffSum/Basic.lean#L67", "span": "L67-L73"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem jacobiSymNat.zero_right (a : \u2115) : jacobiSymNat a 0 = 1", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 476, "declarations_count": 51, "diagnostics_count": 0, "duplicate_fingerprint": "61bcfa0f4714619d", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 141, "lean_code_chars": 63, "lean_code_ratio": 0.1324, "length_bucket": "tiny", "line_count": 7, "natural_language_chars": 413, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.NormNum.LegendreSymbol).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem jacobiSymNat.zero_right (a : \u2115) : jacobiSymNat a 0 = 1\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.NormNum.LegendreSymbol).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem jacobiSymNat.zero_right (a : \u2115) : jacobiSymNat a 0 = 1\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Tactic.NormNum.LegendreSymbol.jacobiSymNat", "source": {"declaration": "Mathlib.Tactic.NormNum.LegendreSymbol.jacobiSymNat", "file": "Mathlib/Tactic/NormNum/LegendreSymbol.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.NormNum.LegendreSymbol", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/NormNum/LegendreSymbol.lean#L70", "span": "L70-L72"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem eval_append_singleton (x : List \u03b1) (a : \u03b1) : M.eval (x ++ [a]) = M.stepSet (M.eval x) a", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 504, "declarations_count": 58, "diagnostics_count": 0, "duplicate_fingerprint": "0b34e697bc938dea", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 148, "lean_code_chars": 96, "lean_code_ratio": 0.1905, "length_bucket": "tiny", "line_count": 7, "natural_language_chars": 408, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.EpsilonNFA).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem eval_append_singleton (x : List \u03b1) (a : \u03b1) : M.eval (x ++ [a]) = M.stepSet (M.eval x) a\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.EpsilonNFA).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem eval_append_singleton (x : List \u03b1) (a : \u03b1) : M.eval (x ++ [a]) = M.stepSet (M.eval x) a\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Computability.EpsilonNFA.eval_append_singleton", "source": {"declaration": "Mathlib.Computability.EpsilonNFA.eval_append_singleton", "file": "Mathlib/Computability/EpsilonNFA.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Computability.EpsilonNFA", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Computability/EpsilonNFA.lean#L145", "span": "L145-L148"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.AlgebraicTopology.Quasicategory.StrictSegal.quasicategory (L33-L97)\ntheorem quasicategory {X : SSet.{u}} (sx : StrictSegal X) : Quasicategory X := by\napply quasicategory_of_filler X\n intro n i \u03c3\u2080 h\u2080 h\u2099\n use sx.spineToSimplex <| Path.map (horn.spineId i h\u2080 h\u2099) \u03c3\u2080\n intro j hj\n apply sx.spineInjective\n ext k\n dsimp only [spineEquiv, spine_arrow, Function.comp_apply, Equiv.coe_fn_mk]\n rw [\u2190 types_comp_apply (\u03c3\u2080.app _) (X.map _), \u2190 \u03c3\u2080.naturality]\n let ksucc := k.succ.castSucc\n obtain hlt | hgt | heq : ksucc < j \u2228 j < ksucc \u2228 j = ksucc := by lia\n \u00b7 rw [\u2190 spine_arrow, spine_\u03b4_arrow_lt sx _ hlt]\n dsimp only [Path.map_arrow, spine_arrow, Fin.coe_eq_castSucc]\n apply congr_arg\n apply Subtype.ext\n dsimp [horn.face, CosimplicialObject.\u03b4]\n rw [Subcomplex.yonedaEquiv_coe, Subfunctor.lift_\u03b9, stdSimplex.map_apply,\n Quiver.Hom.unop_op, stdSimplex.yonedaEquiv_map, Equiv.apply_symm_apply,\n mkOfSucc_\u03b4_lt hlt]\n rfl\n \u00b7 rw [\u2190 spine_arrow, spine_\u03b4_arrow_gt sx _ hgt]\n dsimp only [Path.map_arrow, spine_arrow, Fin.coe_eq_castSucc]\n apply congr_arg\n apply Subtype.ext\n dsimp [horn.face, CosimplicialObject.\u03b4]\n rw [Subcomplex.yonedaEquiv_coe, Subfunctor.lift_\u03b9, stdSimplex.map_apply,\n Quiver.Hom.unop_op, stdSimplex.yonedaEquiv_map, Equiv.apply_symm_apply,\n mkOfSucc_\u03b4_gt hgt]\n rfl\n \u00b7 obtain _ | n := n\n \u00b7 /- The only inner horn of `\u0394[2]` does not contain the diagonal edge. -/\n obtain rfl : k = 0 := by omega\n fin_cases i <;> contradiction\n \u00b7 /- We construct the triangle in the standard simplex as a 2-simplex in\n the horn. While the triangle is not contained in the inner horn `\u039b[2, 1]`,\n it suffices to inhabit `\u039b[n + 3, i] _\u298b2\u298c`. -/\n let triangle : (\u039b[n + 3, i] : SSet.{u}) _\u298b2\u298c :=\n horn.primitiveTriangle i h\u2080 h\u2099 k (by lia)\n /- The interval spanning from `k` to `k + 2` is equivalently the spine\n of the triangle with vertices `k`, `k + 1`, and `k + 2`. -/\n have hi : ((horn.spineId i h\u2080 h\u2099).map \u03c3\u2080).interval k 2 (by lia) =\n X.spine 2 (\u03c3\u2080.app _ triangle) := by\n ext m\n dsimp [spine_arrow, Path.map_interval, Path.map_arrow]\n rw [\u2190 types_comp_apply (\u03c3\u2080.app _) (X.map _), \u2190 \u03c3\u2080.naturality]\n apply congr_arg\n apply Subtype.ext\n ext a : 1\n fin_cases a <;> fin_cases m <;> rfl\n rw [\u2190 spine_arrow, spine_\u03b4_arrow_eq sx _ heq, hi]\n simp only [spineToDiagonal, diagonal, spineToSimplex_spine_apply]\n rw [\u2190 types_comp_apply (\u03c3\u2080.app _) (X.map _), \u2190 \u03c3\u2080.naturality, types_comp_apply]\n apply congr_arg\n apply Subtype.ext\n ext z : 1\n dsimp [horn.face]\n rw [Subcomplex.yonedaEquiv_coe, Subfunctor.lift_\u03b9, stdSimplex.map_apply,\n Quiver.Hom.unop_op, stdSimplex.map_apply, Quiver.Hom.unop_op]\n dsimp [CosimplicialObject.\u03b4]\n rw [stdSimplex.yonedaEquiv_map]\n simp only [Equiv.apply_symm_apply, triangle]\n rw [mkOfSucc_\u03b4_eq heq]\n fin_cases z <;> rfl\n\n/-- Any simplicial set satisfying `IsStrictSegal` is a `Quasicategory`. -/", "-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.homotopicL_iff_homotopicR (L155-L168)\ntheorem homotopicL_iff_homotopicR [Quasicategory\u2082 X] {x y : X _\u298b0\u298c\u2082} {f g : Edge x y} :\n HomotopicL f g \u2194 HomotopicR f g :=\n\u27e8HomotopicL.homotopicR, HomotopicR.homotopicL\u27e9\n\nend homotopy_eqrel\n\nsection homotopy_category\n\nvariable {A : Truncated 2} [Quasicategory\u2082 A] {x y z : A _\u298b0\u298c\u2082}\n\n/--\nGiven `CompStruct f g h` and `CompStruct f' g' h'` with the same vertices and edges such\nthat `f` \u2243 `f'` and `g` \u2243 `g'`, then the long diagonal edges `h` and `h'` are also homotopic.\n-/", "-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.homMk_surjective (L245-L250)\nlemma homMk_surjective : Function.Surjective (homMk : Edge x y \u2192 _) := Quotient.mk_surjective\n/--\nThe trivial (degenerate) edge at a vertex `x` is a representative for the\nidentity morphism `x \u27f6 x`.\n-/", "-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.HomotopicR (L86-L94)\nabbrev HomotopicR {X : Truncated 2} {x y : X _\u298b0\u298c\u2082} (f g : Edge x y) :=\nNonempty (CompStruct (id x) f g)\n\nsection homotopy_eqrel\nvariable {X : Truncated 2}\n\n/--\nThe left homotopy relation is reflexive.\n-/", "-- Mathlib.AlgebraicTopology.Quasicategory.Basic.quasicategory_of_filler (L61-L74)\nlemma quasicategory_of_filler (S : SSet)\n (filler : \u2200 \u2983n : \u2115\u2984 \u2983i : Fin (n + 3)\u2984 (\u03c3\u2080 : (\u039b[n + 2, i] : SSet) \u27f6 S)\n (_h0 : 0 < i) (_hn : i < Fin.last (n + 2)),\n \u2203 \u03c3 : S _\u298bn + 2\u298c, \u2200 (j) (h : j \u2260 i), S.\u03b4 j \u03c3 = \u03c3\u2080.app _ (horn.face i j h)) :\n Quasicategory S where\n hornFilling' n i \u03c3\u2080 h\u2080 h\u2099 := by\nobtain \u27e8\u03c3, h\u27e9 := filler \u03c3\u2080 h\u2080 h\u2099\n refine \u27e8yonedaEquiv.symm \u03c3, ?_\u27e9\n apply horn.hom_ext\n intro j hj\n rw [\u2190 h j hj, NatTrans.comp_app]\n rfl\n\nend SSet", "-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.Hom (L213-L219)\ndef Hom (x y : HomotopyCategory\u2082 A) := Quotient (instSetoidEdge x.pt y.pt)\n/--\nComposition of morphisms in `HomotopyCategory\u2082 A` is given by lifting the edge\nchosen by `composeEdges`.\n-/\nnoncomputable", "-- Mathlib.AlgebraicTopology.Quasicategory.Basic.Quasicategory (L44-L56)\nlemma Quasicategory.hornFilling {S : SSet} [Quasicategory S] \u2983n : \u2115\u2984 \u2983i : Fin (n + 1)\u2984\n (h0 : 0 < i) (hn : i < Fin.last n)\n (\u03c3\u2080 : (\u039b[n, i] : SSet) \u27f6 S) : \u2203 \u03c3 : \u0394[n] \u27f6 S, \u03c3\u2080 = \u039b[n, i].\u03b9 \u226b \u03c3 := by\ncases n using Nat.casesAuxOn with\n | zero => simp [Fin.lt_def] at hn\n | succ n =>\n cases n using Nat.casesAuxOn with\n | zero =>\n simp only [Fin.lt_def, Fin.val_zero, Fin.val_last, zero_add, Nat.lt_one_iff] at h0 hn\n simp [hn] at h0\n | succ n => exact Quasicategory.hornFilling' \u03c3\u2080 h0 hn\n\n/-- Every Kan complex is a quasicategory. -/", "-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.homMk (L239-L244)\ndef homMk (f : Edge x y) : mk x \u27f6 mk y := \u27e6f\u27e7\n/--\nEvery morphism in the homotopy category `HomotopyCategory\u2082 A` is the equivalence class of\nan edge of `A`.\n-/", "-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.mk_surjective (L232-L238)\nlemma mk_surjective : Function.Surjective (mk : A _\u298b0\u298c\u2082 \u2192 _) :=\nfun \u27e8x\u27e9 \u21a6 \u27e8x, rfl\u27e9\n\n/--\nAny edge in the 2-truncated simplicial set `A` defines a morphism in the homotopy category\nby taking its equivalence class.\n-/", "-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.HomotopicL (L78-L85)\nabbrev HomotopicL {X : Truncated 2} {x y : X _\u298b0\u298c\u2082} (f g : Edge x y) :=\nNonempty (CompStruct f (id y) g)\n\n/--\nTwo edges `f` and `g` are right homotopic if there is a `CompStruct` with\n(0, 1)-edge `Edge.id`, (1, 2)-edge `f`, and (0, 2)-edge `g`. We use `Nonempty` to\nhave a `Prop` valued `HomotopicR`.\n-/", "-- Mathlib.AlgebraicTopology.Quasicategory.StrictBicategory.QCat (L51-L54)\nabbrev QCat := ObjectProperty.FullSubcategory Quasicategory\n/-- `QCat` obtains a `Cat`-enriched ordinary category structure by applying `hoFunctor` to the\nhom objects in its `SSet`-enriched ordinary structure. -/", "-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.Edge (L169-L202)\nlemma Edge.CompStruct.comp_unique {f f' : Edge x y} {g g' : Edge y z} {h h' : Edge x z}\n (s : CompStruct f g h) (s' : CompStruct f' g' h')\n (hf : HomotopicL f f') (hg : HomotopicL g g') : HomotopicL h h' := by\nrcases hg.homotopicR with \u27e8hg\u27e9\n rcases hf with \u27e8hf\u27e9\n let \u27e8s\u2081\u27e9 := Quasicategory\u2082.fill32 hf (idComp g') s'\n let \u27e8s\u2082\u27e9 := Quasicategory\u2082.fill31 (compId f) hg s\u2081\n exact Quasicategory\u2082.fill31 s (compId g) s\u2082\n\n/--\nGiven two consecutive edges `f`, `g` in a 2-truncated quasicategory, nonconstructively choose\nan edge that is the diagonal of a 2-simplex with spine given by `f` and `g`. The `CompStruct`\nwitnessing this property is given by `Edge.composeStruct`.\n-/\nnoncomputable def Edge.comp (f : Edge x y) (g : Edge y z) : Edge x z :=\n (Quasicategory\u2082.fill21 f g).some.1\n\n/--\nSee `Edge.comp`\n-/\nnoncomputable def Edge.compStruct (f : Edge x y) (g : Edge y z) : CompStruct f g (f.comp g) :=\n (Quasicategory\u2082.fill21 f g).some.2\n\n/--\nThe homotopy category of a 2-truncated quasicategory `A` has as objects the vertices of `A`\n-/\nstructure HomotopyCategory\u2082 (A : Truncated 2) where\n /-- An object of the homotopy category is a vertex of `A`. -/\n pt : A _\u298b0\u298c\u2082\n\n/--\nLeft homotopy is an equivalence relation on the edges of `A`.\nRemark: We could have equivalently chosen right homotopy, as shown by `homotopicL_iff_homotopicR`.\n-/", "-- Mathlib.AlgebraicTopology.Quasicategory.Nerve.quasicategory (L32-L34)\ninstance quasicategory {C : Type u} [Category.{v} C] : Quasicategory (nerve C) := inferInstance\nend CategoryTheory.Nerve", "-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.homMk_id (L252-L260)\nlemma homMk_id (x : HomotopyCategory\u2082 A) : homMk (Edge.id x.pt) = \ud835\udfd9 x := rfl\nend HomotopyCategory\u2082\n\nopen HomotopyCategory\u2082\n\n/--\nLeft homotopic edges represent the same morphism in the homotopy category.\n-/", "-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.instSetoidEdge (L203-L212)\ninstance instSetoidEdge (x y : A _\u298b0\u298c\u2082) : Setoid (Edge x y) where\n r := HomotopicL\niseqv := \u27e8fun _ \u21a6 HomotopicL.refl, HomotopicL.symm, HomotopicL.trans\u27e9\n\nnamespace HomotopyCategory\u2082\n\n/--\nThe morphisms between two vertices `x`, `y` in `HomotopyCategory\u2082 A` are homotopy classes\nof edges between `x` and `y`.\n-/"], "statement": "instance quasicategory' (X : SSet.{u}) [IsStrictSegal X] : Quasicategory X", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 10047, "declarations_count": 1141, "diagnostics_count": 0, "duplicate_fingerprint": "1cd378a46bdb3c7b", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 3759, "lean_code_chars": 9202, "lean_code_ratio": 0.9159, "length_bucket": "medium", "line_count": 285, "natural_language_chars": 845, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 15, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.Quasicategory.StrictSegal).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ninstance quasicategory' (X : SSet.{u}) [IsStrictSegal X] : Quasicategory X\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.StrictSegal.quasicategory (L33-L97)\ntheorem quasicategory {X : SSet.{u}} (sx : StrictSegal X) : Quasicategory X := by\napply quasicategory_of_filler X\n intro n i \u03c3\u2080 h\u2080 h\u2099\n use sx.spineToSimplex <| Path.map (horn.spineId i h\u2080 h\u2099) \u03c3\u2080\n intro j hj\n apply sx.spineInjective\n ext k\n dsimp only [spineEquiv, spine_arrow, Function.comp_apply, Equiv.coe_fn_mk]\n rw [\u2190 types_comp_apply (\u03c3\u2080.app _) (X.map _), \u2190 \u03c3\u2080.naturality]\n let ksucc := k.succ.castSucc\n obtain hlt | hgt | heq : ksucc < j \u2228 j < ksucc \u2228 j = ksucc := by lia\n \u00b7 rw [\u2190 spine_arrow, spine_\u03b4_arrow_lt sx _ hlt]\n dsimp only [Path.map_arrow, spine_arrow, Fin.coe_eq_castSucc]\n apply congr_arg\n apply Subtype.ext\n dsimp [horn.face, CosimplicialObject.\u03b4]\n rw [Subcomplex.yonedaEquiv_coe, Subfunctor.lift_\u03b9, stdSimplex.map_apply,\n Quiver.Hom.unop_op, stdSimplex.yonedaEquiv_map, Equiv.apply_symm_apply,\n mkOfSucc_\u03b4_lt hlt]\n rfl\n \u00b7 rw [\u2190 spine_arrow, spine_\u03b4_arrow_gt sx _ hgt]\n dsimp only [Path.map_arrow, spine_arrow, Fin.coe_eq_castSucc]\n apply congr_arg\n apply Subtype.ext\n dsimp [horn.face, CosimplicialObject.\u03b4]\n rw [Subcomplex.yonedaEquiv_coe, Subfunctor.lift_\u03b9, stdSimplex.map_apply,\n Quiver.Hom.unop_op, stdSimplex.yonedaEquiv_map, Equiv.apply_symm_apply,\n mkOfSucc_\u03b4_gt hgt]\n rfl\n \u00b7 obtain _ | n := n\n \u00b7 /- The only inner horn of `\u0394[2]` does not contain the diagonal edge. -/\n obtain rfl : k = 0 := by omega\n fin_cases i <;> contradiction\n \u00b7 /- We construct the triangle in the standard simplex as a 2-simplex in\n the horn. While the triangle is not contained in the inner horn `\u039b[2, 1]`,\n it suffices to inhabit `\u039b[n + 3, i] _\u298b2\u298c`. -/\n let triangle : (\u039b[n + 3, i] : SSet.{u}) _\u298b2\u298c :=\n horn.primitiveTriangle i h\u2080 h\u2099 k (by lia)\n /- The interval spanning from `k` to `k + 2` is equivalently the spine\n of the triangle with vertices `k`, `k + 1`, and `k + 2`. -/\n have hi : ((horn.spineId i h\u2080 h\u2099).map \u03c3\u2080).interval k 2 (by lia) =\n X.spine 2 (\u03c3\u2080.app _ triangle) := by\n ext m\n dsimp [spine_arrow, Path.map_interval, Path.map_arrow]\n rw [\u2190 types_comp_apply (\u03c3\u2080.app _) (X.map _), \u2190 \u03c3\u2080.naturality]\n apply congr_arg\n apply Subtype.ext\n ext a : 1\n fin_cases a <;> fin_cases m <;> rfl\n rw [\u2190 spine_arrow, spine_\u03b4_arrow_eq sx _ heq, hi]\n simp only [spineToDiagonal, diagonal, spineToSimplex_spine_apply]\n rw [\u2190 types_comp_apply (\u03c3\u2080.app _) (X.map _), \u2190 \u03c3\u2080.naturality, types_comp_apply]\n apply congr_arg\n apply Subtype.ext\n ext z : 1\n dsimp [horn.face]\n rw [Subcomplex.yonedaEquiv_coe, Subfunctor.lift_\u03b9, stdSimplex.map_apply,\n Quiver.Hom.unop_op, stdSimplex.map_apply, Quiver.Hom.unop_op]\n dsimp [CosimplicialObject.\u03b4]\n rw [stdSimplex.yonedaEquiv_map]\n simp only [Equiv.apply_symm_apply, triangle]\n rw [mkOfSucc_\u03b4_eq heq]\n fin_cases z <;> rfl\n\n/-- Any simplicial set satisfying `IsStrictSegal` is a `Quasicategory`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.homotopicL_iff_homotopicR (L155-L168)\ntheorem homotopicL_iff_homotopicR [Quasicategory\u2082 X] {x y : X _\u298b0\u298c\u2082} {f g : Edge x y} :\n HomotopicL f g \u2194 HomotopicR f g :=\n\u27e8HomotopicL.homotopicR, HomotopicR.homotopicL\u27e9\n\nend homotopy_eqrel\n\nsection homotopy_category\n\nvariable {A : Truncated 2} [Quasicategory\u2082 A] {x y z : A _\u298b0\u298c\u2082}\n\n/--\nGiven `CompStruct f g h` and `CompStruct f' g' h'` with the same vertices and edges such\nthat `f` \u2243 `f'` and `g` \u2243 `g'`, then the long diagonal edges `h` and `h'` are also homotopic.\n-/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.homMk_surjective (L245-L250)\nlemma homMk_surjective : Function.Surjective (homMk : Edge x y \u2192 _) := Quotient.mk_surjective\n/--\nThe trivial (degenerate) edge at a vertex `x` is a representative for the\nidentity morphism `x \u27f6 x`.\n-/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.HomotopicR (L86-L94)\nabbrev HomotopicR {X : Truncated 2} {x y : X _\u298b0\u298c\u2082} (f g : Edge x y) :=\nNonempty (CompStruct (id x) f g)\n\nsection homotopy_eqrel\nvariable {X : Truncated 2}\n\n/--\nThe left homotopy relation is reflexive.\n-/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.Basic.quasicategory_of_filler (L61-L74)\nlemma quasicategory_of_filler (S : SSet)\n (filler : \u2200 \u2983n : \u2115\u2984 \u2983i : Fin (n + 3)\u2984 (\u03c3\u2080 : (\u039b[n + 2, i] : SSet) \u27f6 S)\n (_h0 : 0 < i) (_hn : i < Fin.last (n + 2)),\n \u2203 \u03c3 : S _\u298bn + 2\u298c, \u2200 (j) (h : j \u2260 i), S.\u03b4 j \u03c3 = \u03c3\u2080.app _ (horn.face i j h)) :\n Quasicategory S where\n hornFilling' n i \u03c3\u2080 h\u2080 h\u2099 := by\nobtain \u27e8\u03c3, h\u27e9 := filler \u03c3\u2080 h\u2080 h\u2099\n refine \u27e8yonedaEquiv.symm \u03c3, ?_\u27e9\n apply horn.hom_ext\n intro j hj\n rw [\u2190 h j hj, NatTrans.comp_app]\n rfl\n\nend SSet\n```\n\n-- snippet 6\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.Hom (L213-L219)\ndef Hom (x y : HomotopyCategory\u2082 A) := Quotient (instSetoidEdge x.pt y.pt)\n/--\nComposition of morphisms in `HomotopyCategory\u2082 A` is given by lifting the edge\nchosen by `composeEdges`.\n-/\nnoncomputable\n```\n\n-- snippet 7\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.Basic.Quasicategory (L44-L56)\nlemma Quasicategory.hornFilling {S : SSet} [Quasicategory S] \u2983n : \u2115\u2984 \u2983i : Fin (n + 1)\u2984\n (h0 : 0 < i) (hn : i < Fin.last n)\n (\u03c3\u2080 : (\u039b[n, i] : SSet) \u27f6 S) : \u2203 \u03c3 : \u0394[n] \u27f6 S, \u03c3\u2080 = \u039b[n, i].\u03b9 \u226b \u03c3 := by\ncases n using Nat.casesAuxOn with\n | zero => simp [Fin.lt_def] at hn\n | succ n =>\n cases n using Nat.casesAuxOn with\n | zero =>\n simp only [Fin.lt_def, Fin.val_zero, Fin.val_last, zero_add, Nat.lt_one_iff] at h0 hn\n simp [hn] at h0\n | succ n => exact Quasicategory.hornFilling' \u03c3\u2080 h0 hn\n\n/-- Every Kan complex is a quasicategory. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.homMk (L239-L244)\ndef homMk (f : Edge x y) : mk x \u27f6 mk y := \u27e6f\u27e7\n/--\nEvery morphism in the homotopy category `HomotopyCategory\u2082 A` is the equivalence class of\nan edge of `A`.\n-/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.mk_surjective (L232-L238)\nlemma mk_surjective : Function.Surjective (mk : A _\u298b0\u298c\u2082 \u2192 _) :=\nfun \u27e8x\u27e9 \u21a6 \u27e8x, rfl\u27e9\n\n/--\nAny edge in the 2-truncated simplicial set `A` defines a morphism in the homotopy category\nby taking its equivalence class.\n-/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.HomotopicL (L78-L85)\nabbrev HomotopicL {X : Truncated 2} {x y : X _\u298b0\u298c\u2082} (f g : Edge x y) :=\nNonempty (CompStruct f (id y) g)\n\n/--\nTwo edges `f` and `g` are right homotopic if there is a `CompStruct` with\n(0, 1)-edge `Edge.id`, (1, 2)-edge `f`, and (0, 2)-edge `g`. We use `Nonempty` to\nhave a `Prop` valued `HomotopicR`.\n-/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.StrictBicategory.QCat (L51-L54)\nabbrev QCat := ObjectProperty.FullSubcategory Quasicategory\n/-- `QCat` obtains a `Cat`-enriched ordinary category structure by applying `hoFunctor` to the\nhom objects in its `SSet`-enriched ordinary structure. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.Edge (L169-L202)\nlemma Edge.CompStruct.comp_unique {f f' : Edge x y} {g g' : Edge y z} {h h' : Edge x z}\n (s : CompStruct f g h) (s' : CompStruct f' g' h')\n (hf : HomotopicL f f') (hg : HomotopicL g g') : HomotopicL h h' := by\nrcases hg.homotopicR with \u27e8hg\u27e9\n rcases hf with \u27e8hf\u27e9\n let \u27e8s\u2081\u27e9 := Quasicategory\u2082.fill32 hf (idComp g') s'\n let \u27e8s\u2082\u27e9 := Quasicategory\u2082.fill31 (compId f) hg s\u2081\n exact Quasicategory\u2082.fill31 s (compId g) s\u2082\n\n/--\nGiven two consecutive edges `f`, `g` in a 2-truncated quasicategory, nonconstructively choose\nan edge that is the diagonal of a 2-simplex with spine given by `f` and `g`. The `CompStruct`\nwitnessing this property is given by `Edge.composeStruct`.\n-/\nnoncomputable def Edge.comp (f : Edge x y) (g : Edge y z) : Edge x z :=\n (Quasicategory\u2082.fill21 f g).some.1\n\n/--\nSee `Edge.comp`\n-/\nnoncomputable def Edge.compStruct (f : Edge x y) (g : Edge y z) : CompStruct f g (f.comp g) :=\n (Quasicategory\u2082.fill21 f g).some.2\n\n/--\nThe homotopy category of a 2-truncated quasicategory `A` has as objects the vertices of `A`\n-/\nstructure HomotopyCategory\u2082 (A : Truncated 2) where\n /-- An object of the homotopy category is a vertex of `A`. -/\n pt : A _\u298b0\u298c\u2082\n\n/--\nLeft homotopy is an equivalence relation on the edges of `A`.\nRemark: We could have equivalently chosen right homotopy, as shown by `homotopicL_iff_homotopicR`.\n-/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.Nerve.quasicategory (L32-L34)\ninstance quasicategory {C : Type u} [Category.{v} C] : Quasicategory (nerve C) := inferInstance\nend CategoryTheory.Nerve\n```\n\n-- snippet 14\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.homMk_id (L252-L260)\nlemma homMk_id (x : HomotopyCategory\u2082 A) : homMk (Edge.id x.pt) = \ud835\udfd9 x := rfl\nend HomotopyCategory\u2082\n\nopen HomotopyCategory\u2082\n\n/--\nLeft homotopic edges represent the same morphism in the homotopy category.\n-/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.instSetoidEdge (L203-L212)\ninstance instSetoidEdge (x y : A _\u298b0\u298c\u2082) : Setoid (Edge x y) where\n r := HomotopicL\niseqv := \u27e8fun _ \u21a6 HomotopicL.refl, HomotopicL.symm, HomotopicL.trans\u27e9\n\nnamespace HomotopyCategory\u2082\n\n/--\nThe morphisms between two vertices `x`, `y` in `HomotopyCategory\u2082 A` are homotopy classes\nof edges between `x` and `y`.\n-/\n```\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.Quasicategory.StrictSegal).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ninstance quasicategory' (X : SSet.{u}) [IsStrictSegal X] : Quasicategory X\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.StrictSegal.quasicategory (L33-L97)\ntheorem quasicategory {X : SSet.{u}} (sx : StrictSegal X) : Quasicategory X := by\napply quasicategory_of_filler X\n intro n i \u03c3\u2080 h\u2080 h\u2099\n use sx.spineToSimplex <| Path.map (horn.spineId i h\u2080 h\u2099) \u03c3\u2080\n intro j hj\n apply sx.spineInjective\n ext k\n dsimp only [spineEquiv, spine_arrow, Function.comp_apply, Equiv.coe_fn_mk]\n rw [\u2190 types_comp_apply (\u03c3\u2080.app _) (X.map _), \u2190 \u03c3\u2080.naturality]\n let ksucc := k.succ.castSucc\n obtain hlt | hgt | heq : ksucc < j \u2228 j < ksucc \u2228 j = ksucc := by lia\n \u00b7 rw [\u2190 spine_arrow, spine_\u03b4_arrow_lt sx _ hlt]\n dsimp only [Path.map_arrow, spine_arrow, Fin.coe_eq_castSucc]\n apply congr_arg\n apply Subtype.ext\n dsimp [horn.face, CosimplicialObject.\u03b4]\n rw [Subcomplex.yonedaEquiv_coe, Subfunctor.lift_\u03b9, stdSimplex.map_apply,\n Quiver.Hom.unop_op, stdSimplex.yonedaEquiv_map, Equiv.apply_symm_apply,\n mkOfSucc_\u03b4_lt hlt]\n rfl\n \u00b7 rw [\u2190 spine_arrow, spine_\u03b4_arrow_gt sx _ hgt]\n dsimp only [Path.map_arrow, spine_arrow, Fin.coe_eq_castSucc]\n apply congr_arg\n apply Subtype.ext\n dsimp [horn.face, CosimplicialObject.\u03b4]\n rw [Subcomplex.yonedaEquiv_coe, Subfunctor.lift_\u03b9, stdSimplex.map_apply,\n Quiver.Hom.unop_op, stdSimplex.yonedaEquiv_map, Equiv.apply_symm_apply,\n mkOfSucc_\u03b4_gt hgt]\n rfl\n \u00b7 obtain _ | n := n\n \u00b7 /- The only inner horn of `\u0394[2]` does not contain the diagonal edge. -/\n obtain rfl : k = 0 := by omega\n fin_cases i <;> contradiction\n \u00b7 /- We construct the triangle in the standard simplex as a 2-simplex in\n the horn. While the triangle is not contained in the inner horn `\u039b[2, 1]`,\n it suffices to inhabit `\u039b[n + 3, i] _\u298b2\u298c`. -/\n let triangle : (\u039b[n + 3, i] : SSet.{u}) _\u298b2\u298c :=\n horn.primitiveTriangle i h\u2080 h\u2099 k (by lia)\n /- The interval spanning from `k` to `k + 2` is equivalently the spine\n of the triangle with vertices `k`, `k + 1`, and `k + 2`. -/\n have hi : ((horn.spineId i h\u2080 h\u2099).map \u03c3\u2080).interval k 2 (by lia) =\n X.spine 2 (\u03c3\u2080.app _ triangle) := by\n ext m\n dsimp [spine_arrow, Path.map_interval, Path.map_arrow]\n rw [\u2190 types_comp_apply (\u03c3\u2080.app _) (X.map _), \u2190 \u03c3\u2080.naturality]\n apply congr_arg\n apply Subtype.ext\n ext a : 1\n fin_cases a <;> fin_cases m <;> rfl\n rw [\u2190 spine_arrow, spine_\u03b4_arrow_eq sx _ heq, hi]\n simp only [spineToDiagonal, diagonal, spineToSimplex_spine_apply]\n rw [\u2190 types_comp_apply (\u03c3\u2080.app _) (X.map _), \u2190 \u03c3\u2080.naturality, types_comp_apply]\n apply congr_arg\n apply Subtype.ext\n ext z : 1\n dsimp [horn.face]\n rw [Subcomplex.yonedaEquiv_coe, Subfunctor.lift_\u03b9, stdSimplex.map_apply,\n Quiver.Hom.unop_op, stdSimplex.map_apply, Quiver.Hom.unop_op]\n dsimp [CosimplicialObject.\u03b4]\n rw [stdSimplex.yonedaEquiv_map]\n simp only [Equiv.apply_symm_apply, triangle]\n rw [mkOfSucc_\u03b4_eq heq]\n fin_cases z <;> rfl\n\n/-- Any simplicial set satisfying `IsStrictSegal` is a `Quasicategory`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.homotopicL_iff_homotopicR (L155-L168)\ntheorem homotopicL_iff_homotopicR [Quasicategory\u2082 X] {x y : X _\u298b0\u298c\u2082} {f g : Edge x y} :\n HomotopicL f g \u2194 HomotopicR f g :=\n\u27e8HomotopicL.homotopicR, HomotopicR.homotopicL\u27e9\n\nend homotopy_eqrel\n\nsection homotopy_category\n\nvariable {A : Truncated 2} [Quasicategory\u2082 A] {x y z : A _\u298b0\u298c\u2082}\n\n/--\nGiven `CompStruct f g h` and `CompStruct f' g' h'` with the same vertices and edges such\nthat `f` \u2243 `f'` and `g` \u2243 `g'`, then the long diagonal edges `h` and `h'` are also homotopic.\n-/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.homMk_surjective (L245-L250)\nlemma homMk_surjective : Function.Surjective (homMk : Edge x y \u2192 _) := Quotient.mk_surjective\n/--\nThe trivial (degenerate) edge at a vertex `x` is a representative for the\nidentity morphism `x \u27f6 x`.\n-/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.HomotopicR (L86-L94)\nabbrev HomotopicR {X : Truncated 2} {x y : X _\u298b0\u298c\u2082} (f g : Edge x y) :=\nNonempty (CompStruct (id x) f g)\n\nsection homotopy_eqrel\nvariable {X : Truncated 2}\n\n/--\nThe left homotopy relation is reflexive.\n-/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.Basic.quasicategory_of_filler (L61-L74)\nlemma quasicategory_of_filler (S : SSet)\n (filler : \u2200 \u2983n : \u2115\u2984 \u2983i : Fin (n + 3)\u2984 (\u03c3\u2080 : (\u039b[n + 2, i] : SSet) \u27f6 S)\n (_h0 : 0 < i) (_hn : i < Fin.last (n + 2)),\n \u2203 \u03c3 : S _\u298bn + 2\u298c, \u2200 (j) (h : j \u2260 i), S.\u03b4 j \u03c3 = \u03c3\u2080.app _ (horn.face i j h)) :\n Quasicategory S where\n hornFilling' n i \u03c3\u2080 h\u2080 h\u2099 := by\nobtain \u27e8\u03c3, h\u27e9 := filler \u03c3\u2080 h\u2080 h\u2099\n refine \u27e8yonedaEquiv.symm \u03c3, ?_\u27e9\n apply horn.hom_ext\n intro j hj\n rw [\u2190 h j hj, NatTrans.comp_app]\n rfl\n\nend SSet\n```\n\n-- snippet 6\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.Hom (L213-L219)\ndef Hom (x y : HomotopyCategory\u2082 A) := Quotient (instSetoidEdge x.pt y.pt)\n/--\nComposition of morphisms in `HomotopyCategory\u2082 A` is given by lifting the edge\nchosen by `composeEdges`.\n-/\nnoncomputable\n```\n\n-- snippet 7\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.Basic.Quasicategory (L44-L56)\nlemma Quasicategory.hornFilling {S : SSet} [Quasicategory S] \u2983n : \u2115\u2984 \u2983i : Fin (n + 1)\u2984\n (h0 : 0 < i) (hn : i < Fin.last n)\n (\u03c3\u2080 : (\u039b[n, i] : SSet) \u27f6 S) : \u2203 \u03c3 : \u0394[n] \u27f6 S, \u03c3\u2080 = \u039b[n, i].\u03b9 \u226b \u03c3 := by\ncases n using Nat.casesAuxOn with\n | zero => simp [Fin.lt_def] at hn\n | succ n =>\n cases n using Nat.casesAuxOn with\n | zero =>\n simp only [Fin.lt_def, Fin.val_zero, Fin.val_last, zero_add, Nat.lt_one_iff] at h0 hn\n simp [hn] at h0\n | succ n => exact Quasicategory.hornFilling' \u03c3\u2080 h0 hn\n\n/-- Every Kan complex is a quasicategory. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.homMk (L239-L244)\ndef homMk (f : Edge x y) : mk x \u27f6 mk y := \u27e6f\u27e7\n/--\nEvery morphism in the homotopy category `HomotopyCategory\u2082 A` is the equivalence class of\nan edge of `A`.\n-/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.mk_surjective (L232-L238)\nlemma mk_surjective : Function.Surjective (mk : A _\u298b0\u298c\u2082 \u2192 _) :=\nfun \u27e8x\u27e9 \u21a6 \u27e8x, rfl\u27e9\n\n/--\nAny edge in the 2-truncated simplicial set `A` defines a morphism in the homotopy category\nby taking its equivalence class.\n-/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.HomotopicL (L78-L85)\nabbrev HomotopicL {X : Truncated 2} {x y : X _\u298b0\u298c\u2082} (f g : Edge x y) :=\nNonempty (CompStruct f (id y) g)\n\n/--\nTwo edges `f` and `g` are right homotopic if there is a `CompStruct` with\n(0, 1)-edge `Edge.id`, (1, 2)-edge `f`, and (0, 2)-edge `g`. We use `Nonempty` to\nhave a `Prop` valued `HomotopicR`.\n-/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.StrictBicategory.QCat (L51-L54)\nabbrev QCat := ObjectProperty.FullSubcategory Quasicategory\n/-- `QCat` obtains a `Cat`-enriched ordinary category structure by applying `hoFunctor` to the\nhom objects in its `SSet`-enriched ordinary structure. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.Edge (L169-L202)\nlemma Edge.CompStruct.comp_unique {f f' : Edge x y} {g g' : Edge y z} {h h' : Edge x z}\n (s : CompStruct f g h) (s' : CompStruct f' g' h')\n (hf : HomotopicL f f') (hg : HomotopicL g g') : HomotopicL h h' := by\nrcases hg.homotopicR with \u27e8hg\u27e9\n rcases hf with \u27e8hf\u27e9\n let \u27e8s\u2081\u27e9 := Quasicategory\u2082.fill32 hf (idComp g') s'\n let \u27e8s\u2082\u27e9 := Quasicategory\u2082.fill31 (compId f) hg s\u2081\n exact Quasicategory\u2082.fill31 s (compId g) s\u2082\n\n/--\nGiven two consecutive edges `f`, `g` in a 2-truncated quasicategory, nonconstructively choose\nan edge that is the diagonal of a 2-simplex with spine given by `f` and `g`. The `CompStruct`\nwitnessing this property is given by `Edge.composeStruct`.\n-/\nnoncomputable def Edge.comp (f : Edge x y) (g : Edge y z) : Edge x z :=\n (Quasicategory\u2082.fill21 f g).some.1\n\n/--\nSee `Edge.comp`\n-/\nnoncomputable def Edge.compStruct (f : Edge x y) (g : Edge y z) : CompStruct f g (f.comp g) :=\n (Quasicategory\u2082.fill21 f g).some.2\n\n/--\nThe homotopy category of a 2-truncated quasicategory `A` has as objects the vertices of `A`\n-/\nstructure HomotopyCategory\u2082 (A : Truncated 2) where\n /-- An object of the homotopy category is a vertex of `A`. -/\n pt : A _\u298b0\u298c\u2082\n\n/--\nLeft homotopy is an equivalence relation on the edges of `A`.\nRemark: We could have equivalently chosen right homotopy, as shown by `homotopicL_iff_homotopicR`.\n-/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.Nerve.quasicategory (L32-L34)\ninstance quasicategory {C : Type u} [Category.{v} C] : Quasicategory (nerve C) := inferInstance\nend CategoryTheory.Nerve\n```\n\n-- snippet 14\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.homMk_id (L252-L260)\nlemma homMk_id (x : HomotopyCategory\u2082 A) : homMk (Edge.id x.pt) = \ud835\udfd9 x := rfl\nend HomotopyCategory\u2082\n\nopen HomotopyCategory\u2082\n\n/--\nLeft homotopic edges represent the same morphism in the homotopy category.\n-/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.AlgebraicTopology.Quasicategory.TwoTruncated.instSetoidEdge (L203-L212)\ninstance instSetoidEdge (x y : A _\u298b0\u298c\u2082) : Setoid (Edge x y) where\n r := HomotopicL\niseqv := \u27e8fun _ \u21a6 HomotopicL.refl, HomotopicL.symm, HomotopicL.trans\u27e9\n\nnamespace HomotopyCategory\u2082\n\n/--\nThe morphisms between two vertices `x`, `y` in `HomotopyCategory\u2082 A` are homotopy classes\nof edges between `x` and `y`.\n-/\n```\n[/INST]", "sample_id": "C-Mathlib.AlgebraicTopology.Quasicategory.StrictSegal.quasicategory'", "source": {"declaration": "Mathlib.AlgebraicTopology.Quasicategory.StrictSegal.quasicategory'", "file": "Mathlib/AlgebraicTopology/Quasicategory/StrictSegal.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.Quasicategory.StrictSegal", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/Quasicategory/StrictSegal.lean#L98", "span": "L98-L101"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "theorem comp_H\u03c3_eq_zero {Y : C} {n q : \u2115} {\u03c6 : Y \u27f6 X _\u298bn + 1\u298c} (v : HigherFacesVanish q \u03c6)\n (hqn : n < q) : \u03c6 \u226b (H\u03c3 q).f (n + 1) = 0\n:= by .someMissingNamespaceXYZ\nsimp only [H\u03c3, Homotopy.nullHomotopicMap'_f (c_mk (n + 2) (n + 1) rfl) (c_mk (n + 1) n rfl)]\n rw [h\u03c3'_eq_zero hqn (c_mk (n + 1) n rfl), comp_zero, zero_add]\n by_cases hqn' : n + 1 < q\n \u00b7 rw [h\u03c3'_eq_zero hqn' (c_mk (n + 2) (n + 1) rfl), zero_comp, comp_zero]\n \u00b7 simp only [h\u03c3'_eq (show n + 1 = 0 + q by lia) (c_mk (n + 2) (n + 1) rfl), pow_zero,\n Fin.mk_zero, one_zsmul, eqToHom_refl, comp_id, comp_sum,\n AlternatingFaceMapComplex.obj_d_eq]\n -- All terms of the sum but the first two are zeros\n rw [Fin.sum_univ_succ, Fin.sum_univ_succ, Fintype.sum_eq_zero, add_zero]\n \u00b7 simp only [Fin.val_zero, Fin.val_succ, Fin.val_castSucc, zero_add, pow_zero, one_smul,\n pow_one, neg_smul, comp_neg, \u2190 Fin.castSucc_zero (n := n + 2), \u03b4_comp_\u03c3_self, \u03b4_comp_\u03c3_succ,\n add_neg_cancel]\n \u00b7 intro j\n rw [comp_zsmul, comp_zsmul, \u03b4_comp_\u03c3_of_gt', v.comp_\u03b4_eq_zero_assoc, zero_comp, zsmul_zero]\n \u00b7 simp [Fin.succ_ne_zero]\n \u00b7 dsimp\n lia\n \u00b7 simp only [Fin.succ_lt_succ_iff, j.succ_pos]\n\nset_option backward.isDefEq.respectTransparency false in", "diagnostic": "[CompilationUnit(i_begin=0, i_end=60, messages=[Message(data='expected token', pos=Position(line=1, column=54), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=60, i_end=1287, messages=[Message(data='unexpected end of input', pos=Position(line=23, column=56), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]", "mutation_kind": "missing_import_open_namespace", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 2249, "declarations_count": 245, "diagnostics_count": 1, "duplicate_fingerprint": "a07fb29a5a68ec14", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 803, "lean_code_chars": 1253, "lean_code_ratio": 0.5571, "length_bucket": "short", "line_count": 34, "natural_language_chars": 996, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.DoldKan.Faces).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem comp_H\u03c3_eq_zero {Y : C} {n q : \u2115} {\u03c6 : Y \u27f6 X _\u298bn + 1\u298c} (v : HigherFacesVanish q \u03c6)\n (hqn : n < q) : \u03c6 \u226b (H\u03c3 q).f (n + 1) = 0\n:= by .someMissingNamespaceXYZ\nsimp only [H\u03c3, Homotopy.nullHomotopicMap'_f (c_mk (n + 2) (n + 1) rfl) (c_mk (n + 1) n rfl)]\n rw [h\u03c3'_eq_zero hqn (c_mk (n + 1) n rfl), comp_zero, zero_add]\n by_cases hqn' : n + 1 < q\n \u00b7 rw [h\u03c3'_eq_zero hqn' (c_mk (n + 2) (n + 1) rfl), zero_comp, comp_zero]\n \u00b7 simp only [h\u03c3'_eq (show n + 1 = 0 + q by lia) (c_mk (n + 2) (n + 1) rfl), pow_zero,\n Fin.mk_zero, one_zsmul, eqToHom_refl, comp_id, comp_sum,\n AlternatingFaceMapComplex.obj_d_eq]\n -- All terms of the sum but the first two are zeros\n rw [Fin.sum_univ_succ, Fin.sum_univ_succ, Fintype.sum_eq_zero, add_zero]\n \u00b7 simp only [Fin.val_zero, Fin.val_succ, Fin.val_castSucc, zero_add, pow_zero, one_smul,\n pow_one, neg_smul, comp_neg, \u2190 Fin.castSucc_zero (n := n + 2), \u03b4_comp_\u03c3_self, \u03b4_comp_\u03c3_succ,\n add_neg_cancel]\n \u00b7 intro j\n rw [comp_zsmul, comp_zsmul, \u03b4_comp_\u03c3_of_gt', v.comp_\u03b4_eq_zero_assoc, zero_comp, zsmul_zero]\n \u00b7 simp [Fin.succ_ne_zero]\n \u00b7 dsimp\n lia\n \u00b7 simp only [Fin.succ_lt_succ_iff, j.succ_pos]\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=60, messages=[Message(data='expected token', pos=Position(line=1, column=54), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=60, i_end=1287, messages=[Message(data='unexpected end of input', pos=Position(line=23, 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.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.DoldKan.Faces).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem comp_H\u03c3_eq_zero {Y : C} {n q : \u2115} {\u03c6 : Y \u27f6 X _\u298bn + 1\u298c} (v : HigherFacesVanish q \u03c6)\n (hqn : n < q) : \u03c6 \u226b (H\u03c3 q).f (n + 1) = 0\n:= by .someMissingNamespaceXYZ\nsimp only [H\u03c3, Homotopy.nullHomotopicMap'_f (c_mk (n + 2) (n + 1) rfl) (c_mk (n + 1) n rfl)]\n rw [h\u03c3'_eq_zero hqn (c_mk (n + 1) n rfl), comp_zero, zero_add]\n by_cases hqn' : n + 1 < q\n \u00b7 rw [h\u03c3'_eq_zero hqn' (c_mk (n + 2) (n + 1) rfl), zero_comp, comp_zero]\n \u00b7 simp only [h\u03c3'_eq (show n + 1 = 0 + q by lia) (c_mk (n + 2) (n + 1) rfl), pow_zero,\n Fin.mk_zero, one_zsmul, eqToHom_refl, comp_id, comp_sum,\n AlternatingFaceMapComplex.obj_d_eq]\n -- All terms of the sum but the first two are zeros\n rw [Fin.sum_univ_succ, Fin.sum_univ_succ, Fintype.sum_eq_zero, add_zero]\n \u00b7 simp only [Fin.val_zero, Fin.val_succ, Fin.val_castSucc, zero_add, pow_zero, one_smul,\n pow_one, neg_smul, comp_neg, \u2190 Fin.castSucc_zero (n := n + 2), \u03b4_comp_\u03c3_self, \u03b4_comp_\u03c3_succ,\n add_neg_cancel]\n \u00b7 intro j\n rw [comp_zsmul, comp_zsmul, \u03b4_comp_\u03c3_of_gt', v.comp_\u03b4_eq_zero_assoc, zero_comp, zsmul_zero]\n \u00b7 simp [Fin.succ_ne_zero]\n \u00b7 dsimp\n lia\n \u00b7 simp only [Fin.succ_lt_succ_iff, j.succ_pos]\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=60, messages=[Message(data='expected token', pos=Position(line=1, column=54), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=60, i_end=1287, messages=[Message(data='unexpected end of input', pos=Position(line=23, 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]", "sample_id": "B-Mathlib.AlgebraicTopology.DoldKan.Faces.comp_H\u03c3_eq_zero", "source": {"declaration": "Mathlib.AlgebraicTopology.DoldKan.Faces.comp_H\u03c3_eq_zero", "file": "Mathlib/AlgebraicTopology/DoldKan/Faces.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.DoldKan.Faces", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/DoldKan/Faces.lean#L138", "span": "L138-L159"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "lemma toMk\u2081_of_castSucc_lt {n : \u2115} (i : Fin (n + 2)) (j : Fin (n + 1)) (h : j.castSucc < i) :\n dsimp% toMk\u2081 i j = 0", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 544, "declarations_count": 63, "diagnostics_count": 0, "duplicate_fingerprint": "0f14235d56d54a7a", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 180, "lean_code_chars": 119, "lean_code_ratio": 0.2188, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 425, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplexCategory.ToMkOne).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\nlemma toMk\u2081_of_castSucc_lt {n : \u2115} (i : Fin (n + 2)) (j : Fin (n + 1)) (h : j.castSucc < i) :\n dsimp% toMk\u2081 i j = 0\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplexCategory.ToMkOne).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma toMk\u2081_of_castSucc_lt {n : \u2115} (i : Fin (n + 2)) (j : Fin (n + 1)) (h : j.castSucc < i) :\n dsimp% toMk\u2081 i j = 0\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.AlgebraicTopology.SimplexCategory.ToMkOne.toMk\u2081_of_castSucc_lt", "source": {"declaration": "Mathlib.AlgebraicTopology.SimplexCategory.ToMkOne.toMk\u2081_of_castSucc_lt", "file": "Mathlib/AlgebraicTopology/SimplexCategory/ToMkOne.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.SimplexCategory.ToMkOne", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/SimplexCategory/ToMkOne.lean#L45", "span": "L45-L48"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "def Nat.divModEquiv (n : \u2115) [NeZero n] : \u2115 \u2243 \u2115 \u00d7 Fin n where\n toFun a\n:= (a / n, Fin.ofNat n a) thisIsWrongLemmaNameXYZ\ninvFun p := p.1 * n + \u2191p.2\n -- TODO: is there a canonical order of `*` and `+` here?\n left_inv _ := Nat.div_add_mod' _ _\n right_inv p := by\n refine Prod.ext ?_ (Fin.ext <| Nat.mul_add_mod_of_lt p.2.is_lt)\n dsimp only\n rw [Nat.add_comm, Nat.add_mul_div_right _ _ n.pos_of_neZero, Nat.div_eq_of_lt p.2.is_lt,\n Nat.zero_add]\n\n/-- The equivalence induced by `a \u21a6 (a / n, a % n)` for nonzero `n`.\nSee `Int.ediv_emod_unique` for a similar propositional statement. -/", "diagnostic": "[CompilationUnit(i_begin=0, i_end=130, messages=[Message(data='`Nat.divModEquiv` has already been declared', pos=Position(line=1, column=4), pos_end=Position(line=1, column=19), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=130, i_end=611, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=4, column=0), pos_end=Position(line=4, column=6), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=14, column=68), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]", "mutation_kind": "rewrite_lemma_name_broken", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1821, "declarations_count": 207, "diagnostics_count": 1, "duplicate_fingerprint": "5b9d683aa4f34703", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 559, "lean_code_chars": 599, "lean_code_ratio": 0.3289, "length_bucket": "short", "line_count": 25, "natural_language_chars": 1222, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Equiv.Fin.Basic).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef Nat.divModEquiv (n : \u2115) [NeZero n] : \u2115 \u2243 \u2115 \u00d7 Fin n where\n toFun a\n:= (a / n, Fin.ofNat n a) thisIsWrongLemmaNameXYZ\ninvFun p := p.1 * n + \u2191p.2\n -- TODO: is there a canonical order of `*` and `+` here?\n left_inv _ := Nat.div_add_mod' _ _\n right_inv p := by\n refine Prod.ext ?_ (Fin.ext <| Nat.mul_add_mod_of_lt p.2.is_lt)\n dsimp only\n rw [Nat.add_comm, Nat.add_mul_div_right _ _ n.pos_of_neZero, Nat.div_eq_of_lt p.2.is_lt,\n Nat.zero_add]\n\n/-- The equivalence induced by `a \u21a6 (a / n, a % n)` for nonzero `n`.\nSee `Int.ediv_emod_unique` for a similar propositional statement. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=130, messages=[Message(data='`Nat.divModEquiv` has already been declared', pos=Position(line=1, column=4), pos_end=Position(line=1, column=19), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=130, i_end=611, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=4, column=0), pos_end=Position(line=4, column=6), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=14, column=68), 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.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Equiv.Fin.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef Nat.divModEquiv (n : \u2115) [NeZero n] : \u2115 \u2243 \u2115 \u00d7 Fin n where\n toFun a\n:= (a / n, Fin.ofNat n a) thisIsWrongLemmaNameXYZ\ninvFun p := p.1 * n + \u2191p.2\n -- TODO: is there a canonical order of `*` and `+` here?\n left_inv _ := Nat.div_add_mod' _ _\n right_inv p := by\n refine Prod.ext ?_ (Fin.ext <| Nat.mul_add_mod_of_lt p.2.is_lt)\n dsimp only\n rw [Nat.add_comm, Nat.add_mul_div_right _ _ n.pos_of_neZero, Nat.div_eq_of_lt p.2.is_lt,\n Nat.zero_add]\n\n/-- The equivalence induced by `a \u21a6 (a / n, a % n)` for nonzero `n`.\nSee `Int.ediv_emod_unique` for a similar propositional statement. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=130, messages=[Message(data='`Nat.divModEquiv` has already been declared', pos=Position(line=1, column=4), pos_end=Position(line=1, column=19), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=130, i_end=611, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=4, column=0), pos_end=Position(line=4, column=6), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=14, column=68), 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]", "sample_id": "B-Mathlib.Logic.Equiv.Fin.Basic.Nat", "source": {"declaration": "Mathlib.Logic.Equiv.Fin.Basic.Nat", "file": "Mathlib/Logic/Equiv/Fin/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Logic.Equiv.Fin.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Logic/Equiv/Fin/Basic.lean#L357", "span": "L357-L369"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "def fromTypes_fin_const_equiv (\u03b1 \u03b2 : Type u) (n : \u2115) :\n FromTypes (fun (_ : Fin n) => \u03b1) \u03b2 \u2243 OfArity \u03b1 \u03b2 n", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 516, "declarations_count": 58, "diagnostics_count": 0, "duplicate_fingerprint": "0905bb3b37c6134d", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 156, "lean_code_chars": 110, "lean_code_ratio": 0.2132, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 406, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Function.OfArity).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ndef fromTypes_fin_const_equiv (\u03b1 \u03b2 : Type u) (n : \u2115) :\n FromTypes (fun (_ : Fin n) => \u03b1) \u03b2 \u2243 OfArity \u03b1 \u03b2 n\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Function.OfArity).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ndef fromTypes_fin_const_equiv (\u03b1 \u03b2 : Type u) (n : \u2115) :\n FromTypes (fun (_ : Fin n) => \u03b1) \u03b2 \u2243 OfArity \u03b1 \u03b2 n\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Logic.Function.OfArity.fromTypes_fin_const_equiv", "source": {"declaration": "Mathlib.Logic.Function.OfArity.fromTypes_fin_const_equiv", "file": "Mathlib/Logic/Function/OfArity.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Logic.Function.OfArity", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Logic/Function/OfArity.lean#L70", "span": "L70-L75"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem floor_sub_le_translationNumber (x : \u211d) : \u2191\u230af x - x\u230b \u2264 \u03c4 f", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 498, "declarations_count": 53, "diagnostics_count": 0, "duplicate_fingerprint": "20323768f0790bc5", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 144, "lean_code_chars": 66, "lean_code_ratio": 0.1325, "length_bucket": "tiny", "line_count": 7, "natural_language_chars": 432, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.Circle.RotationNumber.TranslationNumber).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem floor_sub_le_translationNumber (x : \u211d) : \u2191\u230af x - x\u230b \u2264 \u03c4 f\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.Circle.RotationNumber.TranslationNumber).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem floor_sub_le_translationNumber (x : \u211d) : \u2191\u230af x - x\u230b \u2264 \u03c4 f\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Dynamics.Circle.RotationNumber.TranslationNumber.floor_sub_le_translationNumber", "source": {"declaration": "Mathlib.Dynamics.Circle.RotationNumber.TranslationNumber.floor_sub_le_translationNumber", "file": "Mathlib/Dynamics/Circle/RotationNumber/TranslationNumber.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Dynamics.Circle.RotationNumber.TranslationNumber", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Dynamics/Circle/RotationNumber/TranslationNumber.lean#L732", "span": "L732-L734"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Computability.Partrec.rfindX (L65-L90)\ndef rfindX : { n // true \u2208 p n \u2227 \u2200 m < n, false \u2208 p m } :=\nsuffices \u2200 k, (\u2200 n < k, false \u2208 p n) \u2192 { n // true \u2208 p n \u2227 \u2200 m < n, false \u2208 p m } from\n this 0 fun _ => (Nat.not_lt_zero _).elim\n @WellFounded.fix _ _ (lbp p) (wf_lbp p H)\n (by\n intro m IH al\n have pm : (p m).Dom := by\n rcases H with \u27e8n, h\u2081, h\u2082\u27e9\n rcases lt_trichotomy m n with (h\u2083 | h\u2083 | h\u2083)\n \u00b7 exact h\u2082 _ h\u2083\n \u00b7 rw [h\u2083]\n exact h\u2081.fst\n \u00b7 injection mem_unique h\u2081 (al _ h\u2083)\n cases e : (p m).get pm\n \u00b7 suffices \u2200\u1d49 k \u2264 m, false \u2208 p k from IH _ \u27e8rfl, this\u27e9 fun n h => this _ (le_of_lt_succ h)\n intro n h\n rcases h.lt_or_eq_dec with h | h\n \u00b7 exact al _ h\n \u00b7 rw [h]\n exact \u27e8_, e\u27e9\n \u00b7 exact \u27e8m, \u27e8_, e\u27e9, al\u27e9)\n\nend Rfind\n\n/-- Find the smallest `n` satisfying `p n`, where all `p k` for `k < n` are defined as false.\nReturns a `Part`. -/", "-- Mathlib.Computability.Partrec.rfind (L91-L93)\ndef rfind (p : \u2115 \u2192. Bool) : Part \u2115 :=\n\u27e8_, fun h => (rfindX p h).1\u27e9", "-- Mathlib.Computability.Partrec.rfind_spec (L94-L96)\ntheorem rfind_spec {p : \u2115 \u2192. Bool} {n : \u2115} (h : n \u2208 rfind p) : true \u2208 p n :=\nh.snd \u25b8 (rfindX p h.fst).2.1", "-- Mathlib.Computability.Partrec.rfind_min (L97-L99)\ntheorem rfind_min {p : \u2115 \u2192. Bool} {n : \u2115} (h : n \u2208 rfind p) : \u2200 {m : \u2115}, m < n \u2192 false \u2208 p m :=\n@(h.snd \u25b8 @((rfindX p h.fst).2.2))", "-- Mathlib.Computability.Partrec.rfind_dom (L101-L104)\ntheorem rfind_dom {p : \u2115 \u2192. Bool} :\n (rfind p).Dom \u2194 \u2203 n, true \u2208 p n \u2227 \u2200 {m : \u2115}, m < n \u2192 (p m).Dom :=\nIff.rfl", "-- Mathlib.Computability.Partrec.rfind_dom' (L105-L111)\ntheorem rfind_dom' {p : \u2115 \u2192. Bool} :\n (rfind p).Dom \u2194 \u2203 n, true \u2208 p n \u2227 \u2200 {m : \u2115}, m \u2264 n \u2192 (p m).Dom :=\nexists_congr fun _ =>\n and_congr_right fun pn =>\n \u27e8fun H _ h => (Decidable.eq_or_lt_of_le h).elim (fun e => e.symm \u25b8 pn.fst) (H _), fun H _ h =>\n H (le_of_lt h)\u27e9", "-- Mathlib.Computability.Partrec.mem_rfind (L113-L121)\ntheorem mem_rfind {p : \u2115 \u2192. Bool} {n : \u2115} :\n n \u2208 rfind p \u2194 true \u2208 p n \u2227 \u2200 {m : \u2115}, m < n \u2192 false \u2208 p m :=\n\u27e8fun h => \u27e8rfind_spec h, @rfind_min _ _ h\u27e9, fun \u27e8h\u2081, h\u2082\u27e9 => by\n let \u27e8m, hm\u27e9 := dom_iff_mem.1 <| (@rfind_dom p).2 \u27e8_, h\u2081, fun {m} mn => (h\u2082 mn).fst\u27e9\n rcases lt_trichotomy m n with (h | h | h)\n \u00b7 injection mem_unique (h\u2082 h) (rfind_spec hm)\n \u00b7 rwa [\u2190 h]\n \u00b7 injection mem_unique h\u2081 (rfind_min hm h)\u27e9", "-- Mathlib.Computability.Partrec.rfind_min' (L122-L126)\ntheorem rfind_min' {p : \u2115 \u2192 Bool} {m : \u2115} (pm : p m) : \u2203 n \u2208 rfind p, n \u2264 m :=\nhave : true \u2208 (p : \u2115 \u2192. Bool) m := \u27e8trivial, pm\u27e9\n let \u27e8n, hn\u27e9 := dom_iff_mem.1 <| (@rfind_dom p).2 \u27e8m, this, fun {_} _ => \u27e8\u27e9\u27e9\n \u27e8n, hn, not_lt.1 fun h => by injection mem_unique this (rfind_min hn h)\u27e9", "-- Mathlib.Computability.Partrec.rfind_zero_none (L127-L133)\ntheorem rfind_zero_none (p : \u2115 \u2192. Bool) (p0 : p 0 = Part.none) : rfind p = Part.none :=\neq_none_iff.2 fun _ h =>\n let \u27e8_, _, h\u2082\u27e9 := rfind_dom'.1 h.fst\n (p0 \u25b8 h\u2082 (zero_le _) : (@Part.none Bool).Dom)\n\n/-- Find the smallest `n` satisfying `f n`, where all `f k` for `k < n` are defined as false.\nReturns a `Part`. -/", "-- Mathlib.Computability.Partrec.rfindOpt (L134-L136)\ndef rfindOpt {\u03b1} (f : \u2115 \u2192 Option \u03b1) : Part \u03b1 :=\n(rfind fun n => (f n).isSome).bind fun n => f n", "-- Mathlib.Computability.Partrec.rfindOpt_spec (L137-L140)\ntheorem rfindOpt_spec {\u03b1} {f : \u2115 \u2192 Option \u03b1} {a} (h : a \u2208 rfindOpt f) : \u2203 n, a \u2208 f n :=\nlet \u27e8n, _, h\u2082\u27e9 := mem_bind_iff.1 h\n \u27e8n, mem_coe.1 h\u2082\u27e9", "-- Mathlib.Computability.Partrec.rfindOpt_dom (L141-L150)\ntheorem rfindOpt_dom {\u03b1} {f : \u2115 \u2192 Option \u03b1} : (rfindOpt f).Dom \u2194 \u2203 n a, a \u2208 f n :=\n\u27e8fun h => (rfindOpt_spec \u27e8h, rfl\u27e9).imp fun _ h => \u27e8_, h\u27e9, fun h => by\n have h' : \u2203 n, (f n).isSome := h.imp fun n => Option.isSome_iff_exists.2\n have s := Nat.find_spec h'\n have fd : (rfind fun n => (f n).isSome).Dom :=\n \u27e8Nat.find h', by simpa using s.symm, fun _ _ => trivial\u27e9\n refine \u27e8fd, ?_\u27e9\n have := rfind_spec (get_mem fd)\n simpa using this\u27e9", "-- Mathlib.Computability.Partrec.rfindOpt_mono (L151-L173)\ntheorem rfindOpt_mono {\u03b1} {f : \u2115 \u2192 Option \u03b1} (H : \u2200 {a m n}, m \u2264 n \u2192 a \u2208 f m \u2192 a \u2208 f n) {a} :\n a \u2208 rfindOpt f \u2194 \u2203 n, a \u2208 f n :=\n\u27e8rfindOpt_spec, fun \u27e8n, h\u27e9 => by\n have h' := rfindOpt_dom.2 \u27e8_, _, h\u27e9\n obtain \u27e8k, hk\u27e9 := rfindOpt_spec \u27e8h', rfl\u27e9\n have := (H (le_max_left _ _) h).symm.trans (H (le_max_right _ _) hk)\n simp at this; simp [this, get_mem]\u27e9\n\n/-- `Nat.Partrec f` means that the partial function `f : \u2115 \u2192. \u2115` is partially recursive. -/\nprotected inductive Partrec : (\u2115 \u2192. \u2115) \u2192 Prop\n | zero : Nat.Partrec (pure 0)\n | succ : Nat.Partrec succ\n | left : Nat.Partrec \u2191fun n : \u2115 => n.unpair.1\n | right : Nat.Partrec \u2191fun n : \u2115 => n.unpair.2\n | pair {f g} : Nat.Partrec f \u2192 Nat.Partrec g \u2192 Nat.Partrec fun n => pair <$> f n <*> g n\n | comp {f g} : Nat.Partrec f \u2192 Nat.Partrec g \u2192 Nat.Partrec fun n => g n >>= f\n | prec {f g} : Nat.Partrec f \u2192 Nat.Partrec g \u2192 Nat.Partrec (unpaired fun a n =>\n n.rec (f a) fun y IH => do let i \u2190 IH; g (pair a (pair y i)))\n | rfind {f} : Nat.Partrec f \u2192\n Nat.Partrec fun a => rfind fun n => (fun m => m = 0) <$> f (pair a n)\n\nnamespace Partrec", "-- Mathlib.Computability.Partrec.of_eq (L174-L176)\ntheorem of_eq {f g : \u2115 \u2192. \u2115} (hf : Nat.Partrec f) (H : \u2200 n, f n = g n) : Nat.Partrec g :=\n(funext H : f = g) \u25b8 hf", "-- Mathlib.Computability.Partrec.of_eq_tot (L177-L180)\ntheorem of_eq_tot {f : \u2115 \u2192. \u2115} {g : \u2115 \u2192 \u2115} (hf : Nat.Partrec f) (H : \u2200 n, g n \u2208 f n) :\n Nat.Partrec g :=\nhf.of_eq fun n => eq_some_iff.2 (H n)", "-- Mathlib.Computability.Partrec.of_primrec (L181-L203)\ntheorem of_primrec {f : \u2115 \u2192 \u2115} (hf : Nat.Primrec f) : Nat.Partrec f := by\ninduction hf with\n | zero => exact zero\n | succ => exact succ\n | left => exact left\n | right => exact right\n | pair _ _ pf pg =>\n refine (pf.pair pg).of_eq_tot fun n => ?_\n simp [Seq.seq]\n | comp _ _ pf pg =>\n refine (pf.comp pg).of_eq_tot fun n => (by simp)\n | prec _ _ pf pg =>\n refine (pf.prec pg).of_eq_tot fun n => ?_\n simp only [unpaired, PFun.coe_val, bind_eq_bind]\n induction n.unpair.2 with\n | zero => simp\n | succ m IH =>\n simp only [mem_bind_iff, mem_some_iff]\n exact \u27e8_, IH, rfl\u27e9\n\nprotected theorem some : Nat.Partrec some :=\n of_primrec Primrec.id", "-- Mathlib.Computability.Partrec.none (L204-L207)\ntheorem none : Nat.Partrec fun _ => none :=\n(of_primrec (Nat.Primrec.const 1)).rfind.of_eq fun _ =>\n eq_none_iff.2 fun _ \u27e8h, _\u27e9 => by simp at h", "-- Mathlib.Computability.Partrec.prec' (L208-L213)\ntheorem prec' {f g h} (hf : Nat.Partrec f) (hg : Nat.Partrec g) (hh : Nat.Partrec h) :\n Nat.Partrec fun a => (f a).bind fun n => n.rec (g a)\n fun y IH => do {let i \u2190 IH; h (Nat.pair a (Nat.pair y i))} :=\n((prec hg hh).comp (pair Partrec.some hf)).of_eq fun a =>\n ext fun s => by simp [Seq.seq]", "-- Mathlib.Computability.Partrec.ppred (L214-L229)\ntheorem ppred : Nat.Partrec fun n => ppred n :=\nhave : Primrec\u2082 fun n m => if n = Nat.succ m then 0 else 1 :=\n (Primrec.ite\n (@PrimrecRel.comp _ _ _ _ _ _ _ _ _\n Primrec.eq Primrec.fst (_root_.Primrec.succ.comp Primrec.snd))\n (_root_.Primrec.const 0) (_root_.Primrec.const 1)).to\u2082\n (of_primrec (Primrec\u2082.unpaired'.2 this)).rfind.of_eq fun n => by\n cases n\n \u00b7 exact eq_none_iff.2 (by simp)\n \u00b7 exact eq_some_iff.2 (by simp; lia)\n\nend Partrec\n\nend Nat\n\n/-- Partially recursive partial functions `\u03b1 \u2192 \u03c3` between `Primcodable` types -/", "-- Mathlib.Computability.Partrec.Partrec (L230-L233)\ndef Partrec {\u03b1 \u03c3} [Primcodable \u03b1] [Primcodable \u03c3] (f : \u03b1 \u2192. \u03c3) :=\nNat.Partrec fun n => Part.bind (decode (\u03b1 := \u03b1) n) fun a => (f a).map encode\n\n/-- Partially recursive partial functions `\u03b1 \u2192 \u03b2 \u2192 \u03c3` between `Primcodable` types -/", "-- Mathlib.Computability.Partrec.Partrec\u2082 (L234-L238)\ndef Partrec\u2082 {\u03b1 \u03b2 \u03c3} [Primcodable \u03b1] [Primcodable \u03b2] [Primcodable \u03c3] (f : \u03b1 \u2192 \u03b2 \u2192. \u03c3) :=\nPartrec fun p : \u03b1 \u00d7 \u03b2 => f p.1 p.2\n\n/-- Computable functions `\u03b1 \u2192 \u03c3` between `Primcodable` types:\n a function is computable if and only if it is partially recursive (as a partial function) -/", "-- Mathlib.Computability.Partrec.Computable (L239-L242)\ndef Computable {\u03b1 \u03c3} [Primcodable \u03b1] [Primcodable \u03c3] (f : \u03b1 \u2192 \u03c3) :=\nPartrec (f : \u03b1 \u2192. \u03c3)\n\n/-- Computable functions `\u03b1 \u2192 \u03b2 \u2192 \u03c3` between `Primcodable` types -/", "-- Mathlib.Computability.Partrec.Computable\u2082 (L243-L245)\ndef Computable\u2082 {\u03b1 \u03b2 \u03c3} [Primcodable \u03b1] [Primcodable \u03b2] [Primcodable \u03c3] (f : \u03b1 \u2192 \u03b2 \u2192 \u03c3) :=\nComputable fun p : \u03b1 \u00d7 \u03b2 => f p.1 p.2", "-- Mathlib.Computability.Partrec.Primrec (L246-L267)\ntheorem Primrec.to_comp {\u03b1 \u03c3} [Primcodable \u03b1] [Primcodable \u03c3] {f : \u03b1 \u2192 \u03c3} (hf : Primrec f) :\n Computable f :=\n(Nat.Partrec.ppred.comp (Nat.Partrec.of_primrec hf)).of_eq fun n => by\n simp; cases decode (\u03b1 := \u03b1) n <;> simp\n\nnonrec theorem Primrec\u2082.to_comp {\u03b1 \u03b2 \u03c3} [Primcodable \u03b1] [Primcodable \u03b2] [Primcodable \u03c3]\n {f : \u03b1 \u2192 \u03b2 \u2192 \u03c3} (hf : Primrec\u2082 f) : Computable\u2082 f :=\n hf.to_comp\n\nprotected theorem Computable.partrec {\u03b1 \u03c3} [Primcodable \u03b1] [Primcodable \u03c3] {f : \u03b1 \u2192 \u03c3}\n (hf : Computable f) : Partrec (f : \u03b1 \u2192. \u03c3) :=\n hf\n\nprotected theorem Computable\u2082.partrec\u2082 {\u03b1 \u03b2 \u03c3} [Primcodable \u03b1] [Primcodable \u03b2] [Primcodable \u03c3]\n {f : \u03b1 \u2192 \u03b2 \u2192 \u03c3} (hf : Computable\u2082 f) : Partrec\u2082 fun a => (f a : \u03b2 \u2192. \u03c3) :=\n hf\n\nnamespace Computable\n\nvariable {\u03b1 : Type*} {\u03b2 : Type*} {\u03b3 : Type*} {\u03c3 : Type*}\nvariable [Primcodable \u03b1] [Primcodable \u03b2] [Primcodable \u03b3] [Primcodable \u03c3]", "-- Mathlib.Computability.Partrec.of_eq (L268-L270)\ntheorem of_eq {f g : \u03b1 \u2192 \u03c3} (hf : Computable f) (H : \u2200 n, f n = g n) : Computable g :=\n(funext H : f = g) \u25b8 hf"], "statement": "theorem option_some : Computable (@Option.some \u03b1)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 10638, "declarations_count": 1312, "diagnostics_count": 0, "duplicate_fingerprint": "0cd1a7fd4235e729", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 4302, "lean_code_chars": 9545, "lean_code_ratio": 0.8973, "length_bucket": "medium", "line_count": 317, "natural_language_chars": 1093, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 25, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.Partrec).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem option_some : Computable (@Option.some \u03b1)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Computability.Partrec.rfindX (L65-L90)\ndef rfindX : { n // true \u2208 p n \u2227 \u2200 m < n, false \u2208 p m } :=\nsuffices \u2200 k, (\u2200 n < k, false \u2208 p n) \u2192 { n // true \u2208 p n \u2227 \u2200 m < n, false \u2208 p m } from\n this 0 fun _ => (Nat.not_lt_zero _).elim\n @WellFounded.fix _ _ (lbp p) (wf_lbp p H)\n (by\n intro m IH al\n have pm : (p m).Dom := by\n rcases H with \u27e8n, h\u2081, h\u2082\u27e9\n rcases lt_trichotomy m n with (h\u2083 | h\u2083 | h\u2083)\n \u00b7 exact h\u2082 _ h\u2083\n \u00b7 rw [h\u2083]\n exact h\u2081.fst\n \u00b7 injection mem_unique h\u2081 (al _ h\u2083)\n cases e : (p m).get pm\n \u00b7 suffices \u2200\u1d49 k \u2264 m, false \u2208 p k from IH _ \u27e8rfl, this\u27e9 fun n h => this _ (le_of_lt_succ h)\n intro n h\n rcases h.lt_or_eq_dec with h | h\n \u00b7 exact al _ h\n \u00b7 rw [h]\n exact \u27e8_, e\u27e9\n \u00b7 exact \u27e8m, \u27e8_, e\u27e9, al\u27e9)\n\nend Rfind\n\n/-- Find the smallest `n` satisfying `p n`, where all `p k` for `k < n` are defined as false.\nReturns a `Part`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Computability.Partrec.rfind (L91-L93)\ndef rfind (p : \u2115 \u2192. Bool) : Part \u2115 :=\n\u27e8_, fun h => (rfindX p h).1\u27e9\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Computability.Partrec.rfind_spec (L94-L96)\ntheorem rfind_spec {p : \u2115 \u2192. Bool} {n : \u2115} (h : n \u2208 rfind p) : true \u2208 p n :=\nh.snd \u25b8 (rfindX p h.fst).2.1\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Computability.Partrec.rfind_min (L97-L99)\ntheorem rfind_min {p : \u2115 \u2192. Bool} {n : \u2115} (h : n \u2208 rfind p) : \u2200 {m : \u2115}, m < n \u2192 false \u2208 p m :=\n@(h.snd \u25b8 @((rfindX p h.fst).2.2))\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Computability.Partrec.rfind_dom (L101-L104)\ntheorem rfind_dom {p : \u2115 \u2192. Bool} :\n (rfind p).Dom \u2194 \u2203 n, true \u2208 p n \u2227 \u2200 {m : \u2115}, m < n \u2192 (p m).Dom :=\nIff.rfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Computability.Partrec.rfind_dom' (L105-L111)\ntheorem rfind_dom' {p : \u2115 \u2192. Bool} :\n (rfind p).Dom \u2194 \u2203 n, true \u2208 p n \u2227 \u2200 {m : \u2115}, m \u2264 n \u2192 (p m).Dom :=\nexists_congr fun _ =>\n and_congr_right fun pn =>\n \u27e8fun H _ h => (Decidable.eq_or_lt_of_le h).elim (fun e => e.symm \u25b8 pn.fst) (H _), fun H _ h =>\n H (le_of_lt h)\u27e9\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Computability.Partrec.mem_rfind (L113-L121)\ntheorem mem_rfind {p : \u2115 \u2192. Bool} {n : \u2115} :\n n \u2208 rfind p \u2194 true \u2208 p n \u2227 \u2200 {m : \u2115}, m < n \u2192 false \u2208 p m :=\n\u27e8fun h => \u27e8rfind_spec h, @rfind_min _ _ h\u27e9, fun \u27e8h\u2081, h\u2082\u27e9 => by\n let \u27e8m, hm\u27e9 := dom_iff_mem.1 <| (@rfind_dom p).2 \u27e8_, h\u2081, fun {m} mn => (h\u2082 mn).fst\u27e9\n rcases lt_trichotomy m n with (h | h | h)\n \u00b7 injection mem_unique (h\u2082 h) (rfind_spec hm)\n \u00b7 rwa [\u2190 h]\n \u00b7 injection mem_unique h\u2081 (rfind_min hm h)\u27e9\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Computability.Partrec.rfind_min' (L122-L126)\ntheorem rfind_min' {p : \u2115 \u2192 Bool} {m : \u2115} (pm : p m) : \u2203 n \u2208 rfind p, n \u2264 m :=\nhave : true \u2208 (p : \u2115 \u2192. Bool) m := \u27e8trivial, pm\u27e9\n let \u27e8n, hn\u27e9 := dom_iff_mem.1 <| (@rfind_dom p).2 \u27e8m, this, fun {_} _ => \u27e8\u27e9\u27e9\n \u27e8n, hn, not_lt.1 fun h => by injection mem_unique this (rfind_min hn h)\u27e9\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Computability.Partrec.rfind_zero_none (L127-L133)\ntheorem rfind_zero_none (p : \u2115 \u2192. Bool) (p0 : p 0 = Part.none) : rfind p = Part.none :=\neq_none_iff.2 fun _ h =>\n let \u27e8_, _, h\u2082\u27e9 := rfind_dom'.1 h.fst\n (p0 \u25b8 h\u2082 (zero_le _) : (@Part.none Bool).Dom)\n\n/-- Find the smallest `n` satisfying `f n`, where all `f k` for `k < n` are defined as false.\nReturns a `Part`. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Computability.Partrec.rfindOpt (L134-L136)\ndef rfindOpt {\u03b1} (f : \u2115 \u2192 Option \u03b1) : Part \u03b1 :=\n(rfind fun n => (f n).isSome).bind fun n => f n\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Computability.Partrec.rfindOpt_spec (L137-L140)\ntheorem rfindOpt_spec {\u03b1} {f : \u2115 \u2192 Option \u03b1} {a} (h : a \u2208 rfindOpt f) : \u2203 n, a \u2208 f n :=\nlet \u27e8n, _, h\u2082\u27e9 := mem_bind_iff.1 h\n \u27e8n, mem_coe.1 h\u2082\u27e9\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Computability.Partrec.rfindOpt_dom (L141-L150)\ntheorem rfindOpt_dom {\u03b1} {f : \u2115 \u2192 Option \u03b1} : (rfindOpt f).Dom \u2194 \u2203 n a, a \u2208 f n :=\n\u27e8fun h => (rfindOpt_spec \u27e8h, rfl\u27e9).imp fun _ h => \u27e8_, h\u27e9, fun h => by\n have h' : \u2203 n, (f n).isSome := h.imp fun n => Option.isSome_iff_exists.2\n have s := Nat.find_spec h'\n have fd : (rfind fun n => (f n).isSome).Dom :=\n \u27e8Nat.find h', by simpa using s.symm, fun _ _ => trivial\u27e9\n refine \u27e8fd, ?_\u27e9\n have := rfind_spec (get_mem fd)\n simpa using this\u27e9\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Computability.Partrec.rfindOpt_mono (L151-L173)\ntheorem rfindOpt_mono {\u03b1} {f : \u2115 \u2192 Option \u03b1} (H : \u2200 {a m n}, m \u2264 n \u2192 a \u2208 f m \u2192 a \u2208 f n) {a} :\n a \u2208 rfindOpt f \u2194 \u2203 n, a \u2208 f n :=\n\u27e8rfindOpt_spec, fun \u27e8n, h\u27e9 => by\n have h' := rfindOpt_dom.2 \u27e8_, _, h\u27e9\n obtain \u27e8k, hk\u27e9 := rfindOpt_spec \u27e8h', rfl\u27e9\n have := (H (le_max_left _ _) h).symm.trans (H (le_max_right _ _) hk)\n simp at this; simp [this, get_mem]\u27e9\n\n/-- `Nat.Partrec f` means that the partial function `f : \u2115 \u2192. \u2115` is partially recursive. -/\nprotected inductive Partrec : (\u2115 \u2192. \u2115) \u2192 Prop\n | zero : Nat.Partrec (pure 0)\n | succ : Nat.Partrec succ\n | left : Nat.Partrec \u2191fun n : \u2115 => n.unpair.1\n | right : Nat.Partrec \u2191fun n : \u2115 => n.unpair.2\n | pair {f g} : Nat.Partrec f \u2192 Nat.Partrec g \u2192 Nat.Partrec fun n => pair <$> f n <*> g n\n | comp {f g} : Nat.Partrec f \u2192 Nat.Partrec g \u2192 Nat.Partrec fun n => g n >>= f\n | prec {f g} : Nat.Partrec f \u2192 Nat.Partrec g \u2192 Nat.Partrec (unpaired fun a n =>\n n.rec (f a) fun y IH => do let i \u2190 IH; g (pair a (pair y i)))\n | rfind {f} : Nat.Partrec f \u2192\n Nat.Partrec fun a => rfind fun n => (fun m => m = 0) <$> f (pair a n)\n\nnamespace Partrec\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Computability.Partrec.of_eq (L174-L176)\ntheorem of_eq {f g : \u2115 \u2192. \u2115} (hf : Nat.Partrec f) (H : \u2200 n, f n = g n) : Nat.Partrec g :=\n(funext H : f = g) \u25b8 hf\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Computability.Partrec.of_eq_tot (L177-L180)\ntheorem of_eq_tot {f : \u2115 \u2192. \u2115} {g : \u2115 \u2192 \u2115} (hf : Nat.Partrec f) (H : \u2200 n, g n \u2208 f n) :\n Nat.Partrec g :=\nhf.of_eq fun n => eq_some_iff.2 (H n)\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Computability.Partrec.of_primrec (L181-L203)\ntheorem of_primrec {f : \u2115 \u2192 \u2115} (hf : Nat.Primrec f) : Nat.Partrec f := by\ninduction hf with\n | zero => exact zero\n | succ => exact succ\n | left => exact left\n | right => exact right\n | pair _ _ pf pg =>\n refine (pf.pair pg).of_eq_tot fun n => ?_\n simp [Seq.seq]\n | comp _ _ pf pg =>\n refine (pf.comp pg).of_eq_tot fun n => (by simp)\n | prec _ _ pf pg =>\n refine (pf.prec pg).of_eq_tot fun n => ?_\n simp only [unpaired, PFun.coe_val, bind_eq_bind]\n induction n.unpair.2 with\n | zero => simp\n | succ m IH =>\n simp only [mem_bind_iff, mem_some_iff]\n exact \u27e8_, IH, rfl\u27e9\n\nprotected theorem some : Nat.Partrec some :=\n of_primrec Primrec.id\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Computability.Partrec.none (L204-L207)\ntheorem none : Nat.Partrec fun _ => none :=\n(of_primrec (Nat.Primrec.const 1)).rfind.of_eq fun _ =>\n eq_none_iff.2 fun _ \u27e8h, _\u27e9 => by simp at h\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Computability.Partrec.prec' (L208-L213)\ntheorem prec' {f g h} (hf : Nat.Partrec f) (hg : Nat.Partrec g) (hh : Nat.Partrec h) :\n Nat.Partrec fun a => (f a).bind fun n => n.rec (g a)\n fun y IH => do {let i \u2190 IH; h (Nat.pair a (Nat.pair y i))} :=\n((prec hg hh).comp (pair Partrec.some hf)).of_eq fun a =>\n ext fun s => by simp [Seq.seq]\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Computability.Partrec.ppred (L214-L229)\ntheorem ppred : Nat.Partrec fun n => ppred n :=\nhave : Primrec\u2082 fun n m => if n = Nat.succ m then 0 else 1 :=\n (Primrec.ite\n (@PrimrecRel.comp _ _ _ _ _ _ _ _ _\n Primrec.eq Primrec.fst (_root_.Primrec.succ.comp Primrec.snd))\n (_root_.Primrec.const 0) (_root_.Primrec.const 1)).to\u2082\n (of_primrec (Primrec\u2082.unpaired'.2 this)).rfind.of_eq fun n => by\n cases n\n \u00b7 exact eq_none_iff.2 (by simp)\n \u00b7 exact eq_some_iff.2 (by simp; lia)\n\nend Partrec\n\nend Nat\n\n/-- Partially recursive partial functions `\u03b1 \u2192 \u03c3` between `Primcodable` types -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Computability.Partrec.Partrec (L230-L233)\ndef Partrec {\u03b1 \u03c3} [Primcodable \u03b1] [Primcodable \u03c3] (f : \u03b1 \u2192. \u03c3) :=\nNat.Partrec fun n => Part.bind (decode (\u03b1 := \u03b1) n) fun a => (f a).map encode\n\n/-- Partially recursive partial functions `\u03b1 \u2192 \u03b2 \u2192 \u03c3` between `Primcodable` types -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Computability.Partrec.Partrec\u2082 (L234-L238)\ndef Partrec\u2082 {\u03b1 \u03b2 \u03c3} [Primcodable \u03b1] [Primcodable \u03b2] [Primcodable \u03c3] (f : \u03b1 \u2192 \u03b2 \u2192. \u03c3) :=\nPartrec fun p : \u03b1 \u00d7 \u03b2 => f p.1 p.2\n\n/-- Computable functions `\u03b1 \u2192 \u03c3` between `Primcodable` types:\n a function is computable if and only if it is partially recursive (as a partial function) -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Computability.Partrec.Computable (L239-L242)\ndef Computable {\u03b1 \u03c3} [Primcodable \u03b1] [Primcodable \u03c3] (f : \u03b1 \u2192 \u03c3) :=\nPartrec (f : \u03b1 \u2192. \u03c3)\n\n/-- Computable functions `\u03b1 \u2192 \u03b2 \u2192 \u03c3` between `Primcodable` types -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Computability.Partrec.Computable\u2082 (L243-L245)\ndef Computable\u2082 {\u03b1 \u03b2 \u03c3} [Primcodable \u03b1] [Primcodable \u03b2] [Primcodable \u03c3] (f : \u03b1 \u2192 \u03b2 \u2192 \u03c3) :=\nComputable fun p : \u03b1 \u00d7 \u03b2 => f p.1 p.2\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Computability.Partrec.Primrec (L246-L267)\ntheorem Primrec.to_comp {\u03b1 \u03c3} [Primcodable \u03b1] [Primcodable \u03c3] {f : \u03b1 \u2192 \u03c3} (hf : Primrec f) :\n Computable f :=\n(Nat.Partrec.ppred.comp (Nat.Partrec.of_primrec hf)).of_eq fun n => by\n simp; cases decode (\u03b1 := \u03b1) n <;> simp\n\nnonrec theorem Primrec\u2082.to_comp {\u03b1 \u03b2 \u03c3} [Primcodable \u03b1] [Primcodable \u03b2] [Primcodable \u03c3]\n {f : \u03b1 \u2192 \u03b2 \u2192 \u03c3} (hf : Primrec\u2082 f) : Computable\u2082 f :=\n hf.to_comp\n\nprotected theorem Computable.partrec {\u03b1 \u03c3} [Primcodable \u03b1] [Primcodable \u03c3] {f : \u03b1 \u2192 \u03c3}\n (hf : Computable f) : Partrec (f : \u03b1 \u2192. \u03c3) :=\n hf\n\nprotected theorem Computable\u2082.partrec\u2082 {\u03b1 \u03b2 \u03c3} [Primcodable \u03b1] [Primcodable \u03b2] [Primcodable \u03c3]\n {f : \u03b1 \u2192 \u03b2 \u2192 \u03c3} (hf : Computable\u2082 f) : Partrec\u2082 fun a => (f a : \u03b2 \u2192. \u03c3) :=\n hf\n\nnamespace Computable\n\nvariable {\u03b1 : Type*} {\u03b2 : Type*} {\u03b3 : Type*} {\u03c3 : Type*}\nvariable [Primcodable \u03b1] [Primcodable \u03b2] [Primcodable \u03b3] [Primcodable \u03c3]\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Computability.Partrec.of_eq (L268-L270)\ntheorem of_eq {f g : \u03b1 \u2192 \u03c3} (hf : Computable f) (H : \u2200 n, f n = g n) : Computable g :=\n(funext H : f = g) \u25b8 hf\n```\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.Partrec).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem option_some : Computable (@Option.some \u03b1)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Computability.Partrec.rfindX (L65-L90)\ndef rfindX : { n // true \u2208 p n \u2227 \u2200 m < n, false \u2208 p m } :=\nsuffices \u2200 k, (\u2200 n < k, false \u2208 p n) \u2192 { n // true \u2208 p n \u2227 \u2200 m < n, false \u2208 p m } from\n this 0 fun _ => (Nat.not_lt_zero _).elim\n @WellFounded.fix _ _ (lbp p) (wf_lbp p H)\n (by\n intro m IH al\n have pm : (p m).Dom := by\n rcases H with \u27e8n, h\u2081, h\u2082\u27e9\n rcases lt_trichotomy m n with (h\u2083 | h\u2083 | h\u2083)\n \u00b7 exact h\u2082 _ h\u2083\n \u00b7 rw [h\u2083]\n exact h\u2081.fst\n \u00b7 injection mem_unique h\u2081 (al _ h\u2083)\n cases e : (p m).get pm\n \u00b7 suffices \u2200\u1d49 k \u2264 m, false \u2208 p k from IH _ \u27e8rfl, this\u27e9 fun n h => this _ (le_of_lt_succ h)\n intro n h\n rcases h.lt_or_eq_dec with h | h\n \u00b7 exact al _ h\n \u00b7 rw [h]\n exact \u27e8_, e\u27e9\n \u00b7 exact \u27e8m, \u27e8_, e\u27e9, al\u27e9)\n\nend Rfind\n\n/-- Find the smallest `n` satisfying `p n`, where all `p k` for `k < n` are defined as false.\nReturns a `Part`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Computability.Partrec.rfind (L91-L93)\ndef rfind (p : \u2115 \u2192. Bool) : Part \u2115 :=\n\u27e8_, fun h => (rfindX p h).1\u27e9\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Computability.Partrec.rfind_spec (L94-L96)\ntheorem rfind_spec {p : \u2115 \u2192. Bool} {n : \u2115} (h : n \u2208 rfind p) : true \u2208 p n :=\nh.snd \u25b8 (rfindX p h.fst).2.1\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Computability.Partrec.rfind_min (L97-L99)\ntheorem rfind_min {p : \u2115 \u2192. Bool} {n : \u2115} (h : n \u2208 rfind p) : \u2200 {m : \u2115}, m < n \u2192 false \u2208 p m :=\n@(h.snd \u25b8 @((rfindX p h.fst).2.2))\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Computability.Partrec.rfind_dom (L101-L104)\ntheorem rfind_dom {p : \u2115 \u2192. Bool} :\n (rfind p).Dom \u2194 \u2203 n, true \u2208 p n \u2227 \u2200 {m : \u2115}, m < n \u2192 (p m).Dom :=\nIff.rfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Computability.Partrec.rfind_dom' (L105-L111)\ntheorem rfind_dom' {p : \u2115 \u2192. Bool} :\n (rfind p).Dom \u2194 \u2203 n, true \u2208 p n \u2227 \u2200 {m : \u2115}, m \u2264 n \u2192 (p m).Dom :=\nexists_congr fun _ =>\n and_congr_right fun pn =>\n \u27e8fun H _ h => (Decidable.eq_or_lt_of_le h).elim (fun e => e.symm \u25b8 pn.fst) (H _), fun H _ h =>\n H (le_of_lt h)\u27e9\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Computability.Partrec.mem_rfind (L113-L121)\ntheorem mem_rfind {p : \u2115 \u2192. Bool} {n : \u2115} :\n n \u2208 rfind p \u2194 true \u2208 p n \u2227 \u2200 {m : \u2115}, m < n \u2192 false \u2208 p m :=\n\u27e8fun h => \u27e8rfind_spec h, @rfind_min _ _ h\u27e9, fun \u27e8h\u2081, h\u2082\u27e9 => by\n let \u27e8m, hm\u27e9 := dom_iff_mem.1 <| (@rfind_dom p).2 \u27e8_, h\u2081, fun {m} mn => (h\u2082 mn).fst\u27e9\n rcases lt_trichotomy m n with (h | h | h)\n \u00b7 injection mem_unique (h\u2082 h) (rfind_spec hm)\n \u00b7 rwa [\u2190 h]\n \u00b7 injection mem_unique h\u2081 (rfind_min hm h)\u27e9\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Computability.Partrec.rfind_min' (L122-L126)\ntheorem rfind_min' {p : \u2115 \u2192 Bool} {m : \u2115} (pm : p m) : \u2203 n \u2208 rfind p, n \u2264 m :=\nhave : true \u2208 (p : \u2115 \u2192. Bool) m := \u27e8trivial, pm\u27e9\n let \u27e8n, hn\u27e9 := dom_iff_mem.1 <| (@rfind_dom p).2 \u27e8m, this, fun {_} _ => \u27e8\u27e9\u27e9\n \u27e8n, hn, not_lt.1 fun h => by injection mem_unique this (rfind_min hn h)\u27e9\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Computability.Partrec.rfind_zero_none (L127-L133)\ntheorem rfind_zero_none (p : \u2115 \u2192. Bool) (p0 : p 0 = Part.none) : rfind p = Part.none :=\neq_none_iff.2 fun _ h =>\n let \u27e8_, _, h\u2082\u27e9 := rfind_dom'.1 h.fst\n (p0 \u25b8 h\u2082 (zero_le _) : (@Part.none Bool).Dom)\n\n/-- Find the smallest `n` satisfying `f n`, where all `f k` for `k < n` are defined as false.\nReturns a `Part`. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Computability.Partrec.rfindOpt (L134-L136)\ndef rfindOpt {\u03b1} (f : \u2115 \u2192 Option \u03b1) : Part \u03b1 :=\n(rfind fun n => (f n).isSome).bind fun n => f n\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Computability.Partrec.rfindOpt_spec (L137-L140)\ntheorem rfindOpt_spec {\u03b1} {f : \u2115 \u2192 Option \u03b1} {a} (h : a \u2208 rfindOpt f) : \u2203 n, a \u2208 f n :=\nlet \u27e8n, _, h\u2082\u27e9 := mem_bind_iff.1 h\n \u27e8n, mem_coe.1 h\u2082\u27e9\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Computability.Partrec.rfindOpt_dom (L141-L150)\ntheorem rfindOpt_dom {\u03b1} {f : \u2115 \u2192 Option \u03b1} : (rfindOpt f).Dom \u2194 \u2203 n a, a \u2208 f n :=\n\u27e8fun h => (rfindOpt_spec \u27e8h, rfl\u27e9).imp fun _ h => \u27e8_, h\u27e9, fun h => by\n have h' : \u2203 n, (f n).isSome := h.imp fun n => Option.isSome_iff_exists.2\n have s := Nat.find_spec h'\n have fd : (rfind fun n => (f n).isSome).Dom :=\n \u27e8Nat.find h', by simpa using s.symm, fun _ _ => trivial\u27e9\n refine \u27e8fd, ?_\u27e9\n have := rfind_spec (get_mem fd)\n simpa using this\u27e9\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Computability.Partrec.rfindOpt_mono (L151-L173)\ntheorem rfindOpt_mono {\u03b1} {f : \u2115 \u2192 Option \u03b1} (H : \u2200 {a m n}, m \u2264 n \u2192 a \u2208 f m \u2192 a \u2208 f n) {a} :\n a \u2208 rfindOpt f \u2194 \u2203 n, a \u2208 f n :=\n\u27e8rfindOpt_spec, fun \u27e8n, h\u27e9 => by\n have h' := rfindOpt_dom.2 \u27e8_, _, h\u27e9\n obtain \u27e8k, hk\u27e9 := rfindOpt_spec \u27e8h', rfl\u27e9\n have := (H (le_max_left _ _) h).symm.trans (H (le_max_right _ _) hk)\n simp at this; simp [this, get_mem]\u27e9\n\n/-- `Nat.Partrec f` means that the partial function `f : \u2115 \u2192. \u2115` is partially recursive. -/\nprotected inductive Partrec : (\u2115 \u2192. \u2115) \u2192 Prop\n | zero : Nat.Partrec (pure 0)\n | succ : Nat.Partrec succ\n | left : Nat.Partrec \u2191fun n : \u2115 => n.unpair.1\n | right : Nat.Partrec \u2191fun n : \u2115 => n.unpair.2\n | pair {f g} : Nat.Partrec f \u2192 Nat.Partrec g \u2192 Nat.Partrec fun n => pair <$> f n <*> g n\n | comp {f g} : Nat.Partrec f \u2192 Nat.Partrec g \u2192 Nat.Partrec fun n => g n >>= f\n | prec {f g} : Nat.Partrec f \u2192 Nat.Partrec g \u2192 Nat.Partrec (unpaired fun a n =>\n n.rec (f a) fun y IH => do let i \u2190 IH; g (pair a (pair y i)))\n | rfind {f} : Nat.Partrec f \u2192\n Nat.Partrec fun a => rfind fun n => (fun m => m = 0) <$> f (pair a n)\n\nnamespace Partrec\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Computability.Partrec.of_eq (L174-L176)\ntheorem of_eq {f g : \u2115 \u2192. \u2115} (hf : Nat.Partrec f) (H : \u2200 n, f n = g n) : Nat.Partrec g :=\n(funext H : f = g) \u25b8 hf\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Computability.Partrec.of_eq_tot (L177-L180)\ntheorem of_eq_tot {f : \u2115 \u2192. \u2115} {g : \u2115 \u2192 \u2115} (hf : Nat.Partrec f) (H : \u2200 n, g n \u2208 f n) :\n Nat.Partrec g :=\nhf.of_eq fun n => eq_some_iff.2 (H n)\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Computability.Partrec.of_primrec (L181-L203)\ntheorem of_primrec {f : \u2115 \u2192 \u2115} (hf : Nat.Primrec f) : Nat.Partrec f := by\ninduction hf with\n | zero => exact zero\n | succ => exact succ\n | left => exact left\n | right => exact right\n | pair _ _ pf pg =>\n refine (pf.pair pg).of_eq_tot fun n => ?_\n simp [Seq.seq]\n | comp _ _ pf pg =>\n refine (pf.comp pg).of_eq_tot fun n => (by simp)\n | prec _ _ pf pg =>\n refine (pf.prec pg).of_eq_tot fun n => ?_\n simp only [unpaired, PFun.coe_val, bind_eq_bind]\n induction n.unpair.2 with\n | zero => simp\n | succ m IH =>\n simp only [mem_bind_iff, mem_some_iff]\n exact \u27e8_, IH, rfl\u27e9\n\nprotected theorem some : Nat.Partrec some :=\n of_primrec Primrec.id\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Computability.Partrec.none (L204-L207)\ntheorem none : Nat.Partrec fun _ => none :=\n(of_primrec (Nat.Primrec.const 1)).rfind.of_eq fun _ =>\n eq_none_iff.2 fun _ \u27e8h, _\u27e9 => by simp at h\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Computability.Partrec.prec' (L208-L213)\ntheorem prec' {f g h} (hf : Nat.Partrec f) (hg : Nat.Partrec g) (hh : Nat.Partrec h) :\n Nat.Partrec fun a => (f a).bind fun n => n.rec (g a)\n fun y IH => do {let i \u2190 IH; h (Nat.pair a (Nat.pair y i))} :=\n((prec hg hh).comp (pair Partrec.some hf)).of_eq fun a =>\n ext fun s => by simp [Seq.seq]\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Computability.Partrec.ppred (L214-L229)\ntheorem ppred : Nat.Partrec fun n => ppred n :=\nhave : Primrec\u2082 fun n m => if n = Nat.succ m then 0 else 1 :=\n (Primrec.ite\n (@PrimrecRel.comp _ _ _ _ _ _ _ _ _\n Primrec.eq Primrec.fst (_root_.Primrec.succ.comp Primrec.snd))\n (_root_.Primrec.const 0) (_root_.Primrec.const 1)).to\u2082\n (of_primrec (Primrec\u2082.unpaired'.2 this)).rfind.of_eq fun n => by\n cases n\n \u00b7 exact eq_none_iff.2 (by simp)\n \u00b7 exact eq_some_iff.2 (by simp; lia)\n\nend Partrec\n\nend Nat\n\n/-- Partially recursive partial functions `\u03b1 \u2192 \u03c3` between `Primcodable` types -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Computability.Partrec.Partrec (L230-L233)\ndef Partrec {\u03b1 \u03c3} [Primcodable \u03b1] [Primcodable \u03c3] (f : \u03b1 \u2192. \u03c3) :=\nNat.Partrec fun n => Part.bind (decode (\u03b1 := \u03b1) n) fun a => (f a).map encode\n\n/-- Partially recursive partial functions `\u03b1 \u2192 \u03b2 \u2192 \u03c3` between `Primcodable` types -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Computability.Partrec.Partrec\u2082 (L234-L238)\ndef Partrec\u2082 {\u03b1 \u03b2 \u03c3} [Primcodable \u03b1] [Primcodable \u03b2] [Primcodable \u03c3] (f : \u03b1 \u2192 \u03b2 \u2192. \u03c3) :=\nPartrec fun p : \u03b1 \u00d7 \u03b2 => f p.1 p.2\n\n/-- Computable functions `\u03b1 \u2192 \u03c3` between `Primcodable` types:\n a function is computable if and only if it is partially recursive (as a partial function) -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Computability.Partrec.Computable (L239-L242)\ndef Computable {\u03b1 \u03c3} [Primcodable \u03b1] [Primcodable \u03c3] (f : \u03b1 \u2192 \u03c3) :=\nPartrec (f : \u03b1 \u2192. \u03c3)\n\n/-- Computable functions `\u03b1 \u2192 \u03b2 \u2192 \u03c3` between `Primcodable` types -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Computability.Partrec.Computable\u2082 (L243-L245)\ndef Computable\u2082 {\u03b1 \u03b2 \u03c3} [Primcodable \u03b1] [Primcodable \u03b2] [Primcodable \u03c3] (f : \u03b1 \u2192 \u03b2 \u2192 \u03c3) :=\nComputable fun p : \u03b1 \u00d7 \u03b2 => f p.1 p.2\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Computability.Partrec.Primrec (L246-L267)\ntheorem Primrec.to_comp {\u03b1 \u03c3} [Primcodable \u03b1] [Primcodable \u03c3] {f : \u03b1 \u2192 \u03c3} (hf : Primrec f) :\n Computable f :=\n(Nat.Partrec.ppred.comp (Nat.Partrec.of_primrec hf)).of_eq fun n => by\n simp; cases decode (\u03b1 := \u03b1) n <;> simp\n\nnonrec theorem Primrec\u2082.to_comp {\u03b1 \u03b2 \u03c3} [Primcodable \u03b1] [Primcodable \u03b2] [Primcodable \u03c3]\n {f : \u03b1 \u2192 \u03b2 \u2192 \u03c3} (hf : Primrec\u2082 f) : Computable\u2082 f :=\n hf.to_comp\n\nprotected theorem Computable.partrec {\u03b1 \u03c3} [Primcodable \u03b1] [Primcodable \u03c3] {f : \u03b1 \u2192 \u03c3}\n (hf : Computable f) : Partrec (f : \u03b1 \u2192. \u03c3) :=\n hf\n\nprotected theorem Computable\u2082.partrec\u2082 {\u03b1 \u03b2 \u03c3} [Primcodable \u03b1] [Primcodable \u03b2] [Primcodable \u03c3]\n {f : \u03b1 \u2192 \u03b2 \u2192 \u03c3} (hf : Computable\u2082 f) : Partrec\u2082 fun a => (f a : \u03b2 \u2192. \u03c3) :=\n hf\n\nnamespace Computable\n\nvariable {\u03b1 : Type*} {\u03b2 : Type*} {\u03b3 : Type*} {\u03c3 : Type*}\nvariable [Primcodable \u03b1] [Primcodable \u03b2] [Primcodable \u03b3] [Primcodable \u03c3]\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Computability.Partrec.of_eq (L268-L270)\ntheorem of_eq {f g : \u03b1 \u2192 \u03c3} (hf : Computable f) (H : \u2200 n, f n = g n) : Computable g :=\n(funext H : f = g) \u25b8 hf\n```\n[/INST]", "sample_id": "C-Mathlib.Computability.Partrec.option_some", "source": {"declaration": "Mathlib.Computability.Partrec.option_some", "file": "Mathlib/Computability/Partrec.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Computability.Partrec", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Computability/Partrec.lean#L370", "span": "L370-L380"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Computability.Language.Language (L65-L70)\ndef Language (\u03b1) :=\nSet (List \u03b1)\nderiving CompleteAtomicBooleanAlgebra\n\nnamespace Language", "-- Mathlib.Computability.Language.zero_def (L100-L102)\ntheorem zero_def : (0 : Language \u03b1) = (\u2205 : Set _) :=\nrfl", "-- Mathlib.Computability.Language.one_def (L103-L105)\ntheorem one_def : (1 : Language \u03b1) = ({[]} : Set (List \u03b1)) :=\nrfl", "-- Mathlib.Computability.Language.add_def (L106-L108)\ntheorem add_def (l m : Language \u03b1) : l + m = (l \u222a m : Set (List \u03b1)) :=\nrfl", "-- Mathlib.Computability.Language.sub_def (L109-L111)\ntheorem sub_def (l m : Language \u03b1) : l - m = (l \\ m : Set (List \u03b1)) :=\nrfl", "-- Mathlib.Computability.Language.mul_def (L112-L116)\ntheorem mul_def (l m : Language \u03b1) : l * m = image2 (\u00b7 ++ \u00b7) l m :=\nrfl\n\n/-- The Kleene star of a language `L` is the set of all strings which can be written by\nconcatenating strings from `L`. -/", "-- Mathlib.Computability.Language.kstar_def (L119-L121)\nlemma kstar_def (l : Language \u03b1) : l\u2217 = {x | \u2203 L : List (List \u03b1), x = L.flatten \u2227 \u2200 y \u2208 L, y \u2208 l} :=\nrfl", "-- Mathlib.Computability.Language.ext (L123-L125)\ntheorem ext {l m : Language \u03b1} (h : \u2200 (x : List \u03b1), x \u2208 l \u2194 x \u2208 m) : l = m :=\nSet.ext h", "-- Mathlib.Computability.Language.notMem_zero (L127-L129)\ntheorem notMem_zero (x : List \u03b1) : x \u2209 (0 : Language \u03b1) :=\nid", "-- Mathlib.Computability.Language.mem_one (L131-L132)\ntheorem mem_one (x : List \u03b1) : x \u2208 (1 : Language \u03b1) \u2194 x = [] := by rfl", "-- Mathlib.Computability.Language.nil_mem_one (L133-L135)\ntheorem nil_mem_one : [] \u2208 (1 : Language \u03b1) :=\nSet.mem_singleton _", "-- Mathlib.Computability.Language.mem_add (L136-L138)\ntheorem mem_add (l m : Language \u03b1) (x : List \u03b1) : x \u2208 l + m \u2194 x \u2208 l \u2228 x \u2208 m :=\nIff.rfl", "-- Mathlib.Computability.Language.mem_sub (L139-L141)\ntheorem mem_sub (l m : Language \u03b1) (x : List \u03b1) : x \u2208 l - m \u2194 x \u2208 l \u2227 x \u2209 m :=\nIff.rfl", "-- Mathlib.Computability.Language.mem_mul (L142-L144)\ntheorem mem_mul : x \u2208 l * m \u2194 \u2203 a \u2208 l, \u2203 b \u2208 m, a ++ b = x :=\nmem_image2", "-- Mathlib.Computability.Language.append_mem_mul (L145-L147)\ntheorem append_mem_mul : a \u2208 l \u2192 b \u2208 m \u2192 a ++ b \u2208 l * m :=\nmem_image2_of_mem"], "statement": "instance instSemiring : Semiring (Language \u03b1) where\n add_assoc", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 2988, "declarations_count": 312, "diagnostics_count": 0, "duplicate_fingerprint": "bf9e2cb4d27444e5", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1086, "lean_code_chars": 2164, "lean_code_ratio": 0.7242, "length_bucket": "short", "line_count": 118, "natural_language_chars": 824, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 15, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.Language).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ninstance instSemiring : Semiring (Language \u03b1) where\n add_assoc\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Computability.Language.Language (L65-L70)\ndef Language (\u03b1) :=\nSet (List \u03b1)\nderiving CompleteAtomicBooleanAlgebra\n\nnamespace Language\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Computability.Language.zero_def (L100-L102)\ntheorem zero_def : (0 : Language \u03b1) = (\u2205 : Set _) :=\nrfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Computability.Language.one_def (L103-L105)\ntheorem one_def : (1 : Language \u03b1) = ({[]} : Set (List \u03b1)) :=\nrfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Computability.Language.add_def (L106-L108)\ntheorem add_def (l m : Language \u03b1) : l + m = (l \u222a m : Set (List \u03b1)) :=\nrfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Computability.Language.sub_def (L109-L111)\ntheorem sub_def (l m : Language \u03b1) : l - m = (l \\ m : Set (List \u03b1)) :=\nrfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Computability.Language.mul_def (L112-L116)\ntheorem mul_def (l m : Language \u03b1) : l * m = image2 (\u00b7 ++ \u00b7) l m :=\nrfl\n\n/-- The Kleene star of a language `L` is the set of all strings which can be written by\nconcatenating strings from `L`. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Computability.Language.kstar_def (L119-L121)\nlemma kstar_def (l : Language \u03b1) : l\u2217 = {x | \u2203 L : List (List \u03b1), x = L.flatten \u2227 \u2200 y \u2208 L, y \u2208 l} :=\nrfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Computability.Language.ext (L123-L125)\ntheorem ext {l m : Language \u03b1} (h : \u2200 (x : List \u03b1), x \u2208 l \u2194 x \u2208 m) : l = m :=\nSet.ext h\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Computability.Language.notMem_zero (L127-L129)\ntheorem notMem_zero (x : List \u03b1) : x \u2209 (0 : Language \u03b1) :=\nid\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Computability.Language.mem_one (L131-L132)\ntheorem mem_one (x : List \u03b1) : x \u2208 (1 : Language \u03b1) \u2194 x = [] := by rfl\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Computability.Language.nil_mem_one (L133-L135)\ntheorem nil_mem_one : [] \u2208 (1 : Language \u03b1) :=\nSet.mem_singleton _\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Computability.Language.mem_add (L136-L138)\ntheorem mem_add (l m : Language \u03b1) (x : List \u03b1) : x \u2208 l + m \u2194 x \u2208 l \u2228 x \u2208 m :=\nIff.rfl\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Computability.Language.mem_sub (L139-L141)\ntheorem mem_sub (l m : Language \u03b1) (x : List \u03b1) : x \u2208 l - m \u2194 x \u2208 l \u2227 x \u2209 m :=\nIff.rfl\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Computability.Language.mem_mul (L142-L144)\ntheorem mem_mul : x \u2208 l * m \u2194 \u2203 a \u2208 l, \u2203 b \u2208 m, a ++ b = x :=\nmem_image2\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Computability.Language.append_mem_mul (L145-L147)\ntheorem append_mem_mul : a \u2208 l \u2192 b \u2208 m \u2192 a ++ b \u2208 l * m :=\nmem_image2_of_mem\n```\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.Language).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ninstance instSemiring : Semiring (Language \u03b1) where\n add_assoc\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Computability.Language.Language (L65-L70)\ndef Language (\u03b1) :=\nSet (List \u03b1)\nderiving CompleteAtomicBooleanAlgebra\n\nnamespace Language\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Computability.Language.zero_def (L100-L102)\ntheorem zero_def : (0 : Language \u03b1) = (\u2205 : Set _) :=\nrfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Computability.Language.one_def (L103-L105)\ntheorem one_def : (1 : Language \u03b1) = ({[]} : Set (List \u03b1)) :=\nrfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Computability.Language.add_def (L106-L108)\ntheorem add_def (l m : Language \u03b1) : l + m = (l \u222a m : Set (List \u03b1)) :=\nrfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Computability.Language.sub_def (L109-L111)\ntheorem sub_def (l m : Language \u03b1) : l - m = (l \\ m : Set (List \u03b1)) :=\nrfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Computability.Language.mul_def (L112-L116)\ntheorem mul_def (l m : Language \u03b1) : l * m = image2 (\u00b7 ++ \u00b7) l m :=\nrfl\n\n/-- The Kleene star of a language `L` is the set of all strings which can be written by\nconcatenating strings from `L`. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Computability.Language.kstar_def (L119-L121)\nlemma kstar_def (l : Language \u03b1) : l\u2217 = {x | \u2203 L : List (List \u03b1), x = L.flatten \u2227 \u2200 y \u2208 L, y \u2208 l} :=\nrfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Computability.Language.ext (L123-L125)\ntheorem ext {l m : Language \u03b1} (h : \u2200 (x : List \u03b1), x \u2208 l \u2194 x \u2208 m) : l = m :=\nSet.ext h\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Computability.Language.notMem_zero (L127-L129)\ntheorem notMem_zero (x : List \u03b1) : x \u2209 (0 : Language \u03b1) :=\nid\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Computability.Language.mem_one (L131-L132)\ntheorem mem_one (x : List \u03b1) : x \u2208 (1 : Language \u03b1) \u2194 x = [] := by rfl\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Computability.Language.nil_mem_one (L133-L135)\ntheorem nil_mem_one : [] \u2208 (1 : Language \u03b1) :=\nSet.mem_singleton _\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Computability.Language.mem_add (L136-L138)\ntheorem mem_add (l m : Language \u03b1) (x : List \u03b1) : x \u2208 l + m \u2194 x \u2208 l \u2228 x \u2208 m :=\nIff.rfl\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Computability.Language.mem_sub (L139-L141)\ntheorem mem_sub (l m : Language \u03b1) (x : List \u03b1) : x \u2208 l - m \u2194 x \u2208 l \u2227 x \u2209 m :=\nIff.rfl\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Computability.Language.mem_mul (L142-L144)\ntheorem mem_mul : x \u2208 l * m \u2194 \u2203 a \u2208 l, \u2203 b \u2208 m, a ++ b = x :=\nmem_image2\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Computability.Language.append_mem_mul (L145-L147)\ntheorem append_mem_mul : a \u2208 l \u2192 b \u2208 m \u2192 a ++ b \u2208 l * m :=\nmem_image2_of_mem\n```\n[/INST]", "sample_id": "C-Mathlib.Computability.Language.instSemiring", "source": {"declaration": "Mathlib.Computability.Language.instSemiring", "file": "Mathlib/Computability/Language.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Computability.Language", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Computability/Language.lean#L160", "span": "L160-L176"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "theorem option_some_iff {f : \u03b1 \u2192 \u03c3} : (Computable fun a => Option.some (f a)) \u2194 Computable f\n:= .someMissingNamespaceXYZ\n\u27e8fun h => encode_iff.1 <| Primrec.pred.to_comp.comp <| encode_iff.2 h, option_some.comp\u27e9", "diagnostic": "[CompilationUnit(i_begin=0, i_end=219, messages=[Message(data='failed to synthesize instance of type class\\n Primcodable \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=39), pos_end=Position(line=1, column=76), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Primcodable \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=80), pos_end=Position(line=1, column=92), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]", "mutation_kind": "missing_import_open_namespace", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1514, "declarations_count": 163, "diagnostics_count": 1, "duplicate_fingerprint": "9d05b74f490474cb", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 414, "lean_code_chars": 210, "lean_code_ratio": 0.1387, "length_bucket": "tiny", "line_count": 14, "natural_language_chars": 1304, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.Partrec).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem option_some_iff {f : \u03b1 \u2192 \u03c3} : (Computable fun a => Option.some (f a)) \u2194 Computable f\n:= .someMissingNamespaceXYZ\n\u27e8fun h => encode_iff.1 <| Primrec.pred.to_comp.comp <| encode_iff.2 h, option_some.comp\u27e9\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=219, messages=[Message(data='failed to synthesize instance of type class\\n Primcodable \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=39), pos_end=Position(line=1, column=76), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Primcodable \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=80), pos_end=Position(line=1, column=92), 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.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.Partrec).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem option_some_iff {f : \u03b1 \u2192 \u03c3} : (Computable fun a => Option.some (f a)) \u2194 Computable f\n:= .someMissingNamespaceXYZ\n\u27e8fun h => encode_iff.1 <| Primrec.pred.to_comp.comp <| encode_iff.2 h, option_some.comp\u27e9\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=219, messages=[Message(data='failed to synthesize instance of type class\\n Primcodable \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=39), pos_end=Position(line=1, column=76), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Primcodable \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=80), pos_end=Position(line=1, column=92), 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]", "sample_id": "B-Mathlib.Computability.Partrec.option_some_iff", "source": {"declaration": "Mathlib.Computability.Partrec.option_some_iff", "file": "Mathlib/Computability/Partrec.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Computability.Partrec", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Computability/Partrec.lean#L551", "span": "L551-L553"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "def monotoneCurry [(x y : _) \u2192 Preorder <| \u03b3 x y] :\n (\u2200 x : \u03a3 a, \u03b2 a, \u03b3 x.1 x.2) \u2192o \u2200 (a) (b : \u03b2 a), \u03b3 a b where\n toFun\n:= curry .someMissingNamespaceXYZ\nmonotone' _x _y h a b := h \u27e8a, b\u27e9\n\n/-- `Sigma.uncurry` as a monotone function. -/", "diagnostic": "[CompilationUnit(i_begin=0, i_end=172, messages=[Message(data=\"Function expected at\\n \u03b3\\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 `\u03b3` 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=48), severity=, kind=None), Message(data=\"Function expected at\\n \u03b2\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n a\\n\\nHint: The identifier `\u03b2` 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=16), pos_end=Position(line=2, column=19), severity=, kind=None), Message(data=\"Function expected at\\n \u03b3\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n x.1\\n\\nHint: The identifier `\u03b3` 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=21), pos_end=Position(line=2, column=30), severity=, kind=None), Message(data=\"Function expected at\\n \u03b2\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n a\\n\\nHint: The identifier `\u03b2` 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=46), pos_end=Position(line=2, column=49), severity=, kind=None), Message(data=\"Function expected at\\n \u03b3\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n a\\n\\nHint: The identifier `\u03b3` 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=52), pos_end=Position(line=2, column=57), severity=, kind=None), Message(data='stuck at solving universe constraint\\n imax ?u.74 ?u.77 ?u.80 =?= ?u.57+1\\nwhile trying to unify\\n Sort (imax ?u.74 ?u.77 ?u.80) : Type (imax ?u.74 ?u.77 ?u.80)\\nwith\\n Type ?u.57 : Type (?u.57 + 1)', pos=Position(line=1, column=0), pos_end=Position(line=2, column=57), severity=, kind=None), Message(data='stuck at solving universe constraint\\n imax (max (?u.60+1) (?u.61+1)) ?u.70 =?= ?u.58+1\\nwhile trying to unify\\n Sort (imax (max (?u.60 + 1) (?u.61 + 1)) ?u.70) : Type (imax (max (?u.60 + 1) (?u.61 + 1)) ?u.70)\\nwith\\n Type ?u.58 : Type (?u.58 + 1)', pos=Position(line=1, column=0), pos_end=Position(line=2, column=57), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=172, i_end=257, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=5, column=0), pos_end=Position(line=5, column=9), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=7, column=46), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]", "mutation_kind": "missing_import_open_namespace", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 5041, "declarations_count": 736, "diagnostics_count": 1, "duplicate_fingerprint": "2f8ce330c03e8ab2", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1479, "lean_code_chars": 240, "lean_code_ratio": 0.0476, "length_bucket": "short", "line_count": 18, "natural_language_chars": 4801, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Control.LawfulFix).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef monotoneCurry [(x y : _) \u2192 Preorder <| \u03b3 x y] :\n (\u2200 x : \u03a3 a, \u03b2 a, \u03b3 x.1 x.2) \u2192o \u2200 (a) (b : \u03b2 a), \u03b3 a b where\n toFun\n:= curry .someMissingNamespaceXYZ\nmonotone' _x _y h a b := h \u27e8a, b\u27e9\n\n/-- `Sigma.uncurry` as a monotone function. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=172, messages=[Message(data=\"Function expected at\\n \u03b3\\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 `\u03b3` 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=48), severity=, kind=None), Message(data=\"Function expected at\\n \u03b2\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n a\\n\\nHint: The identifier `\u03b2` 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=16), pos_end=Position(line=2, column=19), severity=, kind=None), Message(data=\"Function expected at\\n \u03b3\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n x.1\\n\\nHint: The identifier `\u03b3` 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=21), pos_end=Position(line=2, column=30), severity=, kind=None), Message(data=\"Function expected at\\n \u03b2\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n a\\n\\nHint: The identifier `\u03b2` 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=46), pos_end=Position(line=2, column=49), severity=, kind=None), Message(data=\"Function expected at\\n \u03b3\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n a\\n\\nHint: The identifier `\u03b3` 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=52), pos_end=Position(line=2, column=57), severity=, kind=None), Message(data='stuck at solving universe constraint\\n imax ?u.74 ?u.77 ?u.80 =?= ?u.57+1\\nwhile trying to unify\\n Sort (imax ?u.74 ?u.77 ?u.80) : Type (imax ?u.74 ?u.77 ?u.80)\\nwith\\n Type ?u.57 : Type (?u.57 + 1)', pos=Position(line=1, column=0), pos_end=Position(line=2, column=57), severity=, kind=None), Message(data='stuck at solving universe constraint\\n imax (max (?u.60+1) (?u.61+1)) ?u.70 =?= ?u.58+1\\nwhile trying to unify\\n Sort (imax (max (?u.60 + 1) (?u.61 + 1)) ?u.70) : Type (imax (max (?u.60 + 1) (?u.61 + 1)) ?u.70)\\nwith\\n Type ?u.58 : Type (?u.58 + 1)', pos=Position(line=1, column=0), pos_end=Position(line=2, column=57), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=172, i_end=257, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=5, column=0), pos_end=Position(line=5, column=9), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=7, column=46), 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.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Control.LawfulFix).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef monotoneCurry [(x y : _) \u2192 Preorder <| \u03b3 x y] :\n (\u2200 x : \u03a3 a, \u03b2 a, \u03b3 x.1 x.2) \u2192o \u2200 (a) (b : \u03b2 a), \u03b3 a b where\n toFun\n:= curry .someMissingNamespaceXYZ\nmonotone' _x _y h a b := h \u27e8a, b\u27e9\n\n/-- `Sigma.uncurry` as a monotone function. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=172, messages=[Message(data=\"Function expected at\\n \u03b3\\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 `\u03b3` 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=48), severity=, kind=None), Message(data=\"Function expected at\\n \u03b2\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n a\\n\\nHint: The identifier `\u03b2` 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=16), pos_end=Position(line=2, column=19), severity=, kind=None), Message(data=\"Function expected at\\n \u03b3\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n x.1\\n\\nHint: The identifier `\u03b3` 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=21), pos_end=Position(line=2, column=30), severity=, kind=None), Message(data=\"Function expected at\\n \u03b2\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n a\\n\\nHint: The identifier `\u03b2` 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=46), pos_end=Position(line=2, column=49), severity=, kind=None), Message(data=\"Function expected at\\n \u03b3\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n a\\n\\nHint: The identifier `\u03b3` 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=52), pos_end=Position(line=2, column=57), severity=, kind=None), Message(data='stuck at solving universe constraint\\n imax ?u.74 ?u.77 ?u.80 =?= ?u.57+1\\nwhile trying to unify\\n Sort (imax ?u.74 ?u.77 ?u.80) : Type (imax ?u.74 ?u.77 ?u.80)\\nwith\\n Type ?u.57 : Type (?u.57 + 1)', pos=Position(line=1, column=0), pos_end=Position(line=2, column=57), severity=, kind=None), Message(data='stuck at solving universe constraint\\n imax (max (?u.60+1) (?u.61+1)) ?u.70 =?= ?u.58+1\\nwhile trying to unify\\n Sort (imax (max (?u.60 + 1) (?u.61 + 1)) ?u.70) : Type (imax (max (?u.60 + 1) (?u.61 + 1)) ?u.70)\\nwith\\n Type ?u.58 : Type (?u.58 + 1)', pos=Position(line=1, column=0), pos_end=Position(line=2, column=57), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=172, i_end=257, messages=[Message(data='unexpected identifier; expected command', pos=Position(line=5, column=0), pos_end=Position(line=5, column=9), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=7, column=46), 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]", "sample_id": "B-Mathlib.Control.LawfulFix.monotoneCurry", "source": {"declaration": "Mathlib.Control.LawfulFix.monotoneCurry", "file": "Mathlib/Control/LawfulFix.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Control.LawfulFix", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Control/LawfulFix.lean#L207", "span": "L207-L212"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.Basic.FreeSimplexQuiver (L25-L27)\ndef FreeSimplexQuiver", "-- Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.Basic.FreeSimplexQuiver (L28-L30)\ndef FreeSimplexQuiver.mk (n : \u2115) : FreeSimplexQuiver", "-- Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.Basic.FreeSimplexQuiver (L31-L39)\ndef FreeSimplexQuiver.len (x : FreeSimplexQuiver) : \u2115", "-- Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.Basic.quiv (L40-L43)\ninstance quiv : Quiver FreeSimplexQuiver where\n Hom", "-- Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.Basic.\u03b4 (L44-L47)\nabbrev \u03b4 {n : \u2115} (i : Fin (n + 2)) : FreeSimplexQuiver.mk n \u27f6 .mk (n + 1)", "-- Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.Basic.\u03c3 (L48-L74)\nabbrev \u03c3 {n : \u2115} (i : Fin (n + 1)) : FreeSimplexQuiver.mk (n + 1) \u27f6 .mk n", "-- Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.Basic.SimplexCategoryGenRel (L75-L78)\ndef SimplexCategoryGenRel", "-- Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.Basic.SimplexCategoryGenRel (L79-L84)\ndef SimplexCategoryGenRel.mk (n : \u2115) : SimplexCategoryGenRel where\n as", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.inclusion (L42-L43)\ndef inclusion : SimplexCategory \u2964 AugmentedSimplexCategory", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObjectFunctorCompToArrowIso (L78-L85)\ndef equivAugmentedCosimplicialObjectFunctorCompToArrowIso :\n equivAugmentedCosimplicialObject.functor \u22d9 CosimplicialObject.Augmented.toArrow \u2245\n Functor.mapArrowFunctor _ C \u22d9\n (evaluation _ _ |>.obj <| .mk <| WithInitial.homTo <| .mk 0)", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObject (L53-L59)\ndef equivAugmentedCosimplicialObject :\n (AugmentedSimplexCategory \u2964 C) \u224c CosimplicialObject.Augmented C", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObjectFunctorCompDropIso (L61-L67)\ndef equivAugmentedCosimplicialObjectFunctorCompDropIso :\n equivAugmentedCosimplicialObject.functor \u22d9 CosimplicialObject.Augmented.drop \u2245\n (Functor.whiskeringLeft _ _ C).obj inclusion", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.AugmentedSimplexCategory (L34-L40)\nabbrev AugmentedSimplexCategory", "-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObjectFunctorCompPointIso (L69-L76)\ndef equivAugmentedCosimplicialObjectFunctorCompPointIso :\n equivAugmentedCosimplicialObject.functor \u22d9 CosimplicialObject.Augmented.point \u2245\n ((evaluation _ _).obj .star : (AugmentedSimplexCategory \u2964 C) \u2964 C)"], "statement": "lemma ext {x y : SimplexCategoryGenRel} (h : x.len = y.len) : x = y", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 3582, "declarations_count": 217, "diagnostics_count": 0, "duplicate_fingerprint": "f86d72ba30e57119", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1219, "lean_code_chars": 2748, "lean_code_ratio": 0.7672, "length_bucket": "short", "line_count": 101, "natural_language_chars": 834, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 14, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.Basic).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma ext {x y : SimplexCategoryGenRel} (h : x.len = y.len) : x = y\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.Basic.FreeSimplexQuiver (L25-L27)\ndef FreeSimplexQuiver\n```\n\n-- snippet 2\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.Basic.FreeSimplexQuiver (L28-L30)\ndef FreeSimplexQuiver.mk (n : \u2115) : FreeSimplexQuiver\n```\n\n-- snippet 3\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.Basic.FreeSimplexQuiver (L31-L39)\ndef FreeSimplexQuiver.len (x : FreeSimplexQuiver) : \u2115\n```\n\n-- snippet 4\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.Basic.quiv (L40-L43)\ninstance quiv : Quiver FreeSimplexQuiver where\n Hom\n```\n\n-- snippet 5\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.Basic.\u03b4 (L44-L47)\nabbrev \u03b4 {n : \u2115} (i : Fin (n + 2)) : FreeSimplexQuiver.mk n \u27f6 .mk (n + 1)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.Basic.\u03c3 (L48-L74)\nabbrev \u03c3 {n : \u2115} (i : Fin (n + 1)) : FreeSimplexQuiver.mk (n + 1) \u27f6 .mk n\n```\n\n-- snippet 7\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.Basic.SimplexCategoryGenRel (L75-L78)\ndef SimplexCategoryGenRel\n```\n\n-- snippet 8\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.Basic.SimplexCategoryGenRel (L79-L84)\ndef SimplexCategoryGenRel.mk (n : \u2115) : SimplexCategoryGenRel where\n as\n```\n\n-- snippet 9\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.inclusion (L42-L43)\ndef inclusion : SimplexCategory \u2964 AugmentedSimplexCategory\n```\n\n-- snippet 10\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObjectFunctorCompToArrowIso (L78-L85)\ndef equivAugmentedCosimplicialObjectFunctorCompToArrowIso :\n equivAugmentedCosimplicialObject.functor \u22d9 CosimplicialObject.Augmented.toArrow \u2245\n Functor.mapArrowFunctor _ C \u22d9\n (evaluation _ _ |>.obj <| .mk <| WithInitial.homTo <| .mk 0)\n```\n\n-- snippet 11\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObject (L53-L59)\ndef equivAugmentedCosimplicialObject :\n (AugmentedSimplexCategory \u2964 C) \u224c CosimplicialObject.Augmented C\n```\n\n-- snippet 12\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObjectFunctorCompDropIso (L61-L67)\ndef equivAugmentedCosimplicialObjectFunctorCompDropIso :\n equivAugmentedCosimplicialObject.functor \u22d9 CosimplicialObject.Augmented.drop \u2245\n (Functor.whiskeringLeft _ _ C).obj inclusion\n```\n\n-- snippet 13\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.AugmentedSimplexCategory (L34-L40)\nabbrev AugmentedSimplexCategory\n```\n\n-- snippet 14\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObjectFunctorCompPointIso (L69-L76)\ndef equivAugmentedCosimplicialObjectFunctorCompPointIso :\n equivAugmentedCosimplicialObject.functor \u22d9 CosimplicialObject.Augmented.point \u2245\n ((evaluation _ _).obj .star : (AugmentedSimplexCategory \u2964 C) \u2964 C)\n```\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.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 ext {x y : SimplexCategoryGenRel} (h : x.len = y.len) : x = y\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.Basic.FreeSimplexQuiver (L25-L27)\ndef FreeSimplexQuiver\n```\n\n-- snippet 2\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.Basic.FreeSimplexQuiver (L28-L30)\ndef FreeSimplexQuiver.mk (n : \u2115) : FreeSimplexQuiver\n```\n\n-- snippet 3\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.Basic.FreeSimplexQuiver (L31-L39)\ndef FreeSimplexQuiver.len (x : FreeSimplexQuiver) : \u2115\n```\n\n-- snippet 4\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.Basic.quiv (L40-L43)\ninstance quiv : Quiver FreeSimplexQuiver where\n Hom\n```\n\n-- snippet 5\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.Basic.\u03b4 (L44-L47)\nabbrev \u03b4 {n : \u2115} (i : Fin (n + 2)) : FreeSimplexQuiver.mk n \u27f6 .mk (n + 1)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.Basic.\u03c3 (L48-L74)\nabbrev \u03c3 {n : \u2115} (i : Fin (n + 1)) : FreeSimplexQuiver.mk (n + 1) \u27f6 .mk n\n```\n\n-- snippet 7\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.Basic.SimplexCategoryGenRel (L75-L78)\ndef SimplexCategoryGenRel\n```\n\n-- snippet 8\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.Basic.SimplexCategoryGenRel (L79-L84)\ndef SimplexCategoryGenRel.mk (n : \u2115) : SimplexCategoryGenRel where\n as\n```\n\n-- snippet 9\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.inclusion (L42-L43)\ndef inclusion : SimplexCategory \u2964 AugmentedSimplexCategory\n```\n\n-- snippet 10\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObjectFunctorCompToArrowIso (L78-L85)\ndef equivAugmentedCosimplicialObjectFunctorCompToArrowIso :\n equivAugmentedCosimplicialObject.functor \u22d9 CosimplicialObject.Augmented.toArrow \u2245\n Functor.mapArrowFunctor _ C \u22d9\n (evaluation _ _ |>.obj <| .mk <| WithInitial.homTo <| .mk 0)\n```\n\n-- snippet 11\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObject (L53-L59)\ndef equivAugmentedCosimplicialObject :\n (AugmentedSimplexCategory \u2964 C) \u224c CosimplicialObject.Augmented C\n```\n\n-- snippet 12\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObjectFunctorCompDropIso (L61-L67)\ndef equivAugmentedCosimplicialObjectFunctorCompDropIso :\n equivAugmentedCosimplicialObject.functor \u22d9 CosimplicialObject.Augmented.drop \u2245\n (Functor.whiskeringLeft _ _ C).obj inclusion\n```\n\n-- snippet 13\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.AugmentedSimplexCategory (L34-L40)\nabbrev AugmentedSimplexCategory\n```\n\n-- snippet 14\n```lean\n-- Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Basic.equivAugmentedCosimplicialObjectFunctorCompPointIso (L69-L76)\ndef equivAugmentedCosimplicialObjectFunctorCompPointIso :\n equivAugmentedCosimplicialObject.functor \u22d9 CosimplicialObject.Augmented.point \u2245\n ((evaluation _ _).obj .star : (AugmentedSimplexCategory \u2964 C) \u2964 C)\n```\n[/INST]", "sample_id": "C-Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.Basic.ext", "source": {"declaration": "Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.Basic.ext", "file": "Mathlib/AlgebraicTopology/SimplexCategory/GeneratorsRelations/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/SimplexCategory/GeneratorsRelations/Basic.lean#L193", "span": "L193-L202"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "theorem IsSymmOp.flip_eq (op : \u03b1 \u2192 \u03b1 \u2192 \u03b2) [IsSymmOp op] : flip op = op\n:= \u27e8\u27e9\u27e8\u27e9\nfunext fun a \u21a6 funext fun b \u21a6 (IsSymmOp.symm_op a b).symm", "diagnostic": "[CompilationUnit(i_begin=0, i_end=87, messages=[Message(data='`IsSymmOp.flip_eq` has already been declared', pos=Position(line=1, column=8), pos_end=Position(line=1, column=24), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=87, i_end=155, 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)]", "mutation_kind": "syntax_binder_mismatch", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1201, "declarations_count": 133, "diagnostics_count": 1, "duplicate_fingerprint": "7f9a0841cff605f4", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 369, "lean_code_chars": 137, "lean_code_ratio": 0.1141, "length_bucket": "tiny", "line_count": 14, "natural_language_chars": 1064, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.OpClass).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem IsSymmOp.flip_eq (op : \u03b1 \u2192 \u03b1 \u2192 \u03b2) [IsSymmOp op] : flip op = op\n:= \u27e8\u27e9\u27e8\u27e9\nfunext fun a \u21a6 funext fun b \u21a6 (IsSymmOp.symm_op a b).symm\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=87, messages=[Message(data='`IsSymmOp.flip_eq` has already been declared', pos=Position(line=1, column=8), pos_end=Position(line=1, column=24), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=87, i_end=155, 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.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.OpClass).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem IsSymmOp.flip_eq (op : \u03b1 \u2192 \u03b1 \u2192 \u03b2) [IsSymmOp op] : flip op = op\n:= \u27e8\u27e9\u27e8\u27e9\nfunext fun a \u21a6 funext fun b \u21a6 (IsSymmOp.symm_op a b).symm\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=87, messages=[Message(data='`IsSymmOp.flip_eq` has already been declared', pos=Position(line=1, column=8), pos_end=Position(line=1, column=24), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=87, i_end=155, 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]", "sample_id": "B-Mathlib.Logic.OpClass.IsSymmOp", "source": {"declaration": "Mathlib.Logic.OpClass.IsSymmOp", "file": "Mathlib/Logic/OpClass.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Logic.OpClass", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Logic/OpClass.lean#L52", "span": "L52-L54"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "def sigmaCongrRight {\u03b1} {\u03b2\u2081 \u03b2\u2082 : \u03b1 \u2192 Type*} (F : \u2200 a, \u03b2\u2081 a \u2243 \u03b2\u2082 a) : (\u03a3 a, \u03b2\u2081 a) \u2243 \u03a3 a, \u03b2\u2082 a where\n toFun a", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 509, "declarations_count": 60, "diagnostics_count": 0, "duplicate_fingerprint": "c47fd0d1f99f5af9", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 172, "lean_code_chars": 109, "lean_code_ratio": 0.2141, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 400, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Equiv.Defs).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ndef sigmaCongrRight {\u03b1} {\u03b2\u2081 \u03b2\u2082 : \u03b1 \u2192 Type*} (F : \u2200 a, \u03b2\u2081 a \u2243 \u03b2\u2082 a) : (\u03a3 a, \u03b2\u2081 a) \u2243 \u03a3 a, \u03b2\u2082 a where\n toFun a\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Equiv.Defs).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ndef sigmaCongrRight {\u03b1} {\u03b2\u2081 \u03b2\u2082 : \u03b1 \u2192 Type*} (F : \u2200 a, \u03b2\u2081 a \u2243 \u03b2\u2082 a) : (\u03a3 a, \u03b2\u2081 a) \u2243 \u03a3 a, \u03b2\u2082 a where\n toFun a\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Logic.Equiv.Defs.sigmaCongrRight", "source": {"declaration": "Mathlib.Logic.Equiv.Defs.sigmaCongrRight", "file": "Mathlib/Logic/Equiv/Defs.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Logic.Equiv.Defs", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Logic/Equiv/Defs.lean#L626", "span": "L626-L631"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"source_grounded_context_enriched": false, "trace_states": [{"state": "lemma inr_comp_inl_comp_associator (x y z : AugmentedSimplexCategory) :\n inr _ _ \u226b inl _ _ \u226b (\u03b1_ x y z).hom = inl _ _ \u226b inr _ _", "tactic": "ext i : 3 dsimp [MonoidalCategoryStruct.associator, associator]"}, {"state": "", "tactic": "have e\u2081 := inl'_eval y z i"}, {"state": "", "tactic": "have e\u2082 := inr'_eval x y i"}, {"state": "", "tactic": "have e\u2083 := inl'_eval (tensorObjOf x y) z <| Fin.cast (by simp +arith) <| i.natAdd (x.len + 1)"}, {"state": "", "tactic": "have e\u2084 := inr'_eval x (tensorObjOf y z) <| Fin.cast (by simp +arith) <| i.castAdd (z.len + 1)"}, {"state": "", "tactic": "simp only [SimplexCategory.len_mk] at e\u2081 e\u2082 e\u2083 e\u2084"}, {"state": "", "tactic": "rw [e\u2081, e\u2082, e\u2083, e\u2084]"}, {"state": "", "tactic": "ext; simp +arith | .star, _, _ => by cat_disch | _, .star, _ => by cat_disch | _, _, .star => by cat_disch"}], "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 1864, "declarations_count": 252, "diagnostics_count": 0, "duplicate_fingerprint": "4f10125ba1b596fa", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 719, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "short", "line_count": 24, "natural_language_chars": 1864, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal).", "role": "system"}, {"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.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.inr_comp_inl_comp_associator`:\nState 0: \u22a2 lemma inr_comp_inl_comp_associator (x y z : AugmentedSimplexCategory) :\n inr _ _ \u226b inl _ _ \u226b (\u03b1_ x y z).hom = inl _ _ \u226b inr _ _\nTactic: ext i : 3 dsimp [MonoidalCategoryStruct.associator, associator]\nState 1: \u22a2 \nTactic: have e\u2081 := inl'_eval y z i\nState 2: \u22a2 \nTactic: have e\u2082 := inr'_eval x y i\nState 3: \u22a2 \nTactic: have e\u2083 := inl'_eval (tensorObjOf x y) z <| Fin.cast (by simp +arith) <| i.natAdd (x.len + 1)\nState 4: \u22a2 \nTactic: have e\u2084 := inr'_eval x (tensorObjOf y z) <| Fin.cast (by simp +arith) <| i.castAdd (z.len + 1)\nState 5: \u22a2 \nTactic: simp only [SimplexCategory.len_mk] at e\u2081 e\u2082 e\u2083 e\u2084\nState 6: \u22a2 \nTactic: rw [e\u2081, e\u2082, e\u2083, e\u2084]\nState 7: \u22a2 \nTactic: ext; simp +arith | .star, _, _ => by cat_disch | _, .star, _ => by cat_disch | _, _, .star => by cat_disch\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal).[/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.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.inr_comp_inl_comp_associator`:\nState 0: \u22a2 lemma inr_comp_inl_comp_associator (x y z : AugmentedSimplexCategory) :\n inr _ _ \u226b inl _ _ \u226b (\u03b1_ x y z).hom = inl _ _ \u226b inr _ _\nTactic: ext i : 3 dsimp [MonoidalCategoryStruct.associator, associator]\nState 1: \u22a2 \nTactic: have e\u2081 := inl'_eval y z i\nState 2: \u22a2 \nTactic: have e\u2082 := inr'_eval x y i\nState 3: \u22a2 \nTactic: have e\u2083 := inl'_eval (tensorObjOf x y) z <| Fin.cast (by simp +arith) <| i.natAdd (x.len + 1)\nState 4: \u22a2 \nTactic: have e\u2084 := inr'_eval x (tensorObjOf y z) <| Fin.cast (by simp +arith) <| i.castAdd (z.len + 1)\nState 5: \u22a2 \nTactic: simp only [SimplexCategory.len_mk] at e\u2081 e\u2082 e\u2083 e\u2084\nState 6: \u22a2 \nTactic: rw [e\u2081, e\u2082, e\u2083, e\u2084]\nState 7: \u22a2 \nTactic: ext; simp +arith | .star, _, _ => by cat_disch | _, .star, _ => by cat_disch | _, _, .star => by cat_disch\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.inr_comp_inl_comp_associator", "source": {"declaration": "Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal.inr_comp_inl_comp_associator", "file": "Mathlib/AlgebraicTopology/SimplexCategory/Augmented/Monoidal.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.SimplexCategory.Augmented.Monoidal", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/SimplexCategory/Augmented/Monoidal.lean#L318", "span": "L318-L335"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "instance ReaderT.instULiftableULiftULift {m m'} [ULiftable m m'] :\n ULiftable (ReaderT (ULift.{max v\u2080 u\u2080} s) m) (ReaderT (ULift.{max v\u2081 u\u2080} s) m')\n:= thisIsWrongLemmaNameXYZ\nReaderT.uliftable' <| Equiv.ulift.trans Equiv.ulift.symm\n\n/-- for specific continuation passing monads, this function helps to create a uliftable instance -/", "diagnostic": "[CompilationUnit(i_begin=0, i_end=243, messages=[Message(data='`ReaderT.instULiftableULiftULift` has already been declared', pos=Position(line=1, column=9), pos_end=Position(line=1, column=40), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=243, i_end=342, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=6, column=99), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]", "mutation_kind": "rewrite_lemma_name_broken", "source_grounded_context_enriched": false, "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 1402, "declarations_count": 154, "diagnostics_count": 1, "duplicate_fingerprint": "37d2e417b31b8ab6", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 414, "lean_code_chars": 335, "lean_code_ratio": 0.2389, "length_bucket": "tiny", "line_count": 17, "natural_language_chars": 1067, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Control.ULiftable).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ninstance ReaderT.instULiftableULiftULift {m m'} [ULiftable m m'] :\n ULiftable (ReaderT (ULift.{max v\u2080 u\u2080} s) m) (ReaderT (ULift.{max v\u2081 u\u2080} s) m')\n:= thisIsWrongLemmaNameXYZ\nReaderT.uliftable' <| Equiv.ulift.trans Equiv.ulift.symm\n\n/-- for specific continuation passing monads, this function helps to create a uliftable instance -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=243, messages=[Message(data='`ReaderT.instULiftableULiftULift` has already been declared', pos=Position(line=1, column=9), pos_end=Position(line=1, column=40), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=243, i_end=342, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=6, column=99), 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.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Control.ULiftable).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ninstance ReaderT.instULiftableULiftULift {m m'} [ULiftable m m'] :\n ULiftable (ReaderT (ULift.{max v\u2080 u\u2080} s) m) (ReaderT (ULift.{max v\u2081 u\u2080} s) m')\n:= thisIsWrongLemmaNameXYZ\nReaderT.uliftable' <| Equiv.ulift.trans Equiv.ulift.symm\n\n/-- for specific continuation passing monads, this function helps to create a uliftable instance -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=243, messages=[Message(data='`ReaderT.instULiftableULiftULift` has already been declared', pos=Position(line=1, column=9), pos_end=Position(line=1, column=40), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=243, i_end=342, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=6, column=99), 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]", "sample_id": "B-Mathlib.Control.ULiftable.ReaderT", "source": {"declaration": "Mathlib.Control.ULiftable.ReaderT", "file": "Mathlib/Control/ULiftable.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Control.ULiftable", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Control/ULiftable.lean#L146", "span": "L146-L150"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"source_grounded_context_enriched": false, "trace_states": [{"state": "def lanPresheafNatIso\n (hF : \u2200 S : LightProfinite, IsColimit <| F.mapCocone (coconeRightOpOfCone S.asLimitCone)) :\n lanPresheaf F \u2245 F", "tactic": "refine NatIso.ofComponents (fun \u27e8S\u27e9 \u21a6 (lanPresheafIso (hF S))) fun _ \u21a6 ?_"}, {"state": "", "tactic": "simp only [lanPresheaf, pointwiseLeftKanExtension_obj, pointwiseLeftKanExtension_map, lanPresheafIso_hom, Opposite.op_unop]"}, {"state": "", "tactic": "exact colimit.hom_ext fun _ \u21a6 (by simp)"}], "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 1192, "declarations_count": 124, "diagnostics_count": 0, "duplicate_fingerprint": "ffe7b224da6b7eae", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 379, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "tiny", "line_count": 15, "natural_language_chars": 1192, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Condensed.Discrete.Colimit).", "role": "system"}, {"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.Condensed.Discrete.Colimit.lanPresheafNatIso`:\nState 0: \u22a2 def lanPresheafNatIso\n (hF : \u2200 S : LightProfinite, IsColimit <| F.mapCocone (coconeRightOpOfCone S.asLimitCone)) :\n lanPresheaf F \u2245 F\nTactic: refine NatIso.ofComponents (fun \u27e8S\u27e9 \u21a6 (lanPresheafIso (hF S))) fun _ \u21a6 ?_\nState 1: \u22a2 \nTactic: simp only [lanPresheaf, pointwiseLeftKanExtension_obj, pointwiseLeftKanExtension_map, lanPresheafIso_hom, Opposite.op_unop]\nState 2: \u22a2 \nTactic: exact colimit.hom_ext fun _ \u21a6 (by simp)\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Condensed.Discrete.Colimit).[/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.Condensed.Discrete.Colimit.lanPresheafNatIso`:\nState 0: \u22a2 def lanPresheafNatIso\n (hF : \u2200 S : LightProfinite, IsColimit <| F.mapCocone (coconeRightOpOfCone S.asLimitCone)) :\n lanPresheaf F \u2245 F\nTactic: refine NatIso.ofComponents (fun \u27e8S\u27e9 \u21a6 (lanPresheafIso (hF S))) fun _ \u21a6 ?_\nState 1: \u22a2 \nTactic: simp only [lanPresheaf, pointwiseLeftKanExtension_obj, pointwiseLeftKanExtension_map, lanPresheafIso_hom, Opposite.op_unop]\nState 2: \u22a2 \nTactic: exact colimit.hom_ext fun _ \u21a6 (by simp)\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.Condensed.Discrete.Colimit.lanPresheafNatIso", "source": {"declaration": "Mathlib.Condensed.Discrete.Colimit.lanPresheafNatIso", "file": "Mathlib/Condensed/Discrete/Colimit.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Condensed.Discrete.Colimit", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Condensed/Discrete/Colimit.lean#L422", "span": "L422-L430"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "F", "construction": {"context_enriched": true, "instruction": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.", "source_grounded_context_enriched": true, "statement": "theorem fish_assoc {\u03b1 \u03b2 \u03b3 \u03c6} (f : \u03b1 \u2192 m \u03b2) (g : \u03b2 \u2192 m \u03b3) (h : \u03b3 \u2192 m \u03c6) :\n (f >=> g) >=> h = f >=> g >=> h", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 571, "declarations_count": 60, "diagnostics_count": 0, "duplicate_fingerprint": "476f0b97d6af0375", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 483, "lean_code_chars": 109, "lean_code_ratio": 0.1909, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 462, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Control.Basic).", "role": "system"}, {"content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n## Imports\n```lean\nimport Mathlib.Tactic.Attr.Register\n```\n\n## Surrounding context in Mathlib/Control/Basic.lean\n```lean\n-- Mathlib.Control.Basic.zipWithM (L37-L41)\ndef zipWithM {\u03b1\u2081 \u03b1\u2082 \u03c6 : Type u} (f : \u03b1\u2081 \u2192 \u03b1\u2082 \u2192 F \u03c6) : \u2200 (_ : List \u03b1\u2081) (_ : List \u03b1\u2082), F (List \u03c6)\n | x :: xs, y :: ys => (\u00b7 :: \u00b7) <$> f x y <*> zipWithM f xs ys\n | _, _ => pure []\n\n/-- Like `zipWithM` but evaluates the result as it traverses the lists using `*>`. -/\n\n-- Mathlib.Control.Basic.zipWithM' (L42-L48)\ndef zipWithM' (f : \u03b1 \u2192 \u03b2 \u2192 F \u03b3) : List \u03b1 \u2192 List \u03b2 \u2192 F PUnit\n | x :: xs, y :: ys => f x y *> zipWithM' f xs ys\n | [], _ => pure PUnit.unit\n | _, [] => pure PUnit.unit\n\nvariable [LawfulApplicative F]\n\n-- Mathlib.Control.Basic.pure_id'_seq (L50-L52)\ntheorem pure_id'_seq (x : F \u03b1) : (pure fun x => x) <*> x = x\n```\n\n```lean\ntheorem fish_assoc {\u03b1 \u03b2 \u03b3 \u03c6} (f : \u03b1 \u2192 m \u03b2) (g : \u03b2 \u2192 m \u03b3) (h : \u03b3 \u2192 m \u03c6) :\n (f >=> g) >=> h = f >=> g >=> h\n```\n\nDeclaration: `Mathlib.Control.Basic.fish_assoc` (module Mathlib.Control.Basic).", "role": "user"}], "rendered_text": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Control.Basic).\n\nExplain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n## Imports\n```lean\nimport Mathlib.Tactic.Attr.Register\n```\n\n## Surrounding context in Mathlib/Control/Basic.lean\n```lean\n-- Mathlib.Control.Basic.zipWithM (L37-L41)\ndef zipWithM {\u03b1\u2081 \u03b1\u2082 \u03c6 : Type u} (f : \u03b1\u2081 \u2192 \u03b1\u2082 \u2192 F \u03c6) : \u2200 (_ : List \u03b1\u2081) (_ : List \u03b1\u2082), F (List \u03c6)\n | x :: xs, y :: ys => (\u00b7 :: \u00b7) <$> f x y <*> zipWithM f xs ys\n | _, _ => pure []\n\n/-- Like `zipWithM` but evaluates the result as it traverses the lists using `*>`. -/\n\n-- Mathlib.Control.Basic.zipWithM' (L42-L48)\ndef zipWithM' (f : \u03b1 \u2192 \u03b2 \u2192 F \u03b3) : List \u03b1 \u2192 List \u03b2 \u2192 F PUnit\n | x :: xs, y :: ys => f x y *> zipWithM' f xs ys\n | [], _ => pure PUnit.unit\n | _, [] => pure PUnit.unit\n\nvariable [LawfulApplicative F]\n\n-- Mathlib.Control.Basic.pure_id'_seq (L50-L52)\ntheorem pure_id'_seq (x : F \u03b1) : (pure fun x => x) <*> x = x\n```\n\n```lean\ntheorem fish_assoc {\u03b1 \u03b2 \u03b3 \u03c6} (f : \u03b1 \u2192 m \u03b2) (g : \u03b2 \u2192 m \u03b3) (h : \u03b3 \u2192 m \u03c6) :\n (f >=> g) >=> h = f >=> g >=> h\n```\n\nDeclaration: `Mathlib.Control.Basic.fish_assoc` (module Mathlib.Control.Basic).", "sample_id": "F-Mathlib.Control.Basic.fish_assoc", "source": {"declaration": "Mathlib.Control.Basic.fish_assoc", "file": "Mathlib/Control/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Control.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Control/Basic.lean#L88", "span": "L88-L96"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "F", "construction": {"context_enriched": true, "instruction": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.", "source_grounded_context_enriched": true, "statement": "theorem minimalPeriod_piMap :\n minimalPeriod (Pi.map f) x = sInf { n > 0 | \u2200 i, minimalPeriod (f i) (x i) \u2223 n }", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 628, "declarations_count": 61, "diagnostics_count": 0, "duplicate_fingerprint": "538fdcf19fb32e85", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 424, "lean_code_chars": 115, "lean_code_ratio": 0.1831, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 513, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.PeriodicPts.Lemmas).", "role": "system"}, {"content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\nOpen namespaces: Nat, Set, Function, (Commute), Fintype\n\n## Surrounding context in Mathlib/Dynamics/PeriodicPts/Lemmas.lean\n```lean\n-- Mathlib.Dynamics.PeriodicPts.Lemmas.directed_ptsOfPeriod_pnat (L31-L34)\ntheorem directed_ptsOfPeriod_pnat (f : \u03b1 \u2192 \u03b1) : Directed (\u00b7 \u2286 \u00b7) fun n : \u2115+ => ptsOfPeriod f n\n\n-- Mathlib.Dynamics.PeriodicPts.Lemmas.bijOn_periodicPts (L35-L38)\ntheorem bijOn_periodicPts : BijOn f (periodicPts f) (periodicPts f)\n\n-- Mathlib.Dynamics.PeriodicPts.Lemmas.minimalPeriod_eq_prime_iff (L39-L45)\ntheorem minimalPeriod_eq_prime_iff {p : \u2115} [hp : Fact p.Prime] :\n minimalPeriod f x = p \u2194 IsPeriodicPt f p x \u2227 \u00acIsFixedPt f x\n```\n\n```lean\ntheorem minimalPeriod_piMap :\n minimalPeriod (Pi.map f) x = sInf { n > 0 | \u2200 i, minimalPeriod (f i) (x i) \u2223 n }\n```\n\nDeclaration: `Mathlib.Dynamics.PeriodicPts.Lemmas.minimalPeriod_piMap` (module Mathlib.Dynamics.PeriodicPts.Lemmas).", "role": "user"}], "rendered_text": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.PeriodicPts.Lemmas).\n\nExplain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\nOpen namespaces: Nat, Set, Function, (Commute), Fintype\n\n## Surrounding context in Mathlib/Dynamics/PeriodicPts/Lemmas.lean\n```lean\n-- Mathlib.Dynamics.PeriodicPts.Lemmas.directed_ptsOfPeriod_pnat (L31-L34)\ntheorem directed_ptsOfPeriod_pnat (f : \u03b1 \u2192 \u03b1) : Directed (\u00b7 \u2286 \u00b7) fun n : \u2115+ => ptsOfPeriod f n\n\n-- Mathlib.Dynamics.PeriodicPts.Lemmas.bijOn_periodicPts (L35-L38)\ntheorem bijOn_periodicPts : BijOn f (periodicPts f) (periodicPts f)\n\n-- Mathlib.Dynamics.PeriodicPts.Lemmas.minimalPeriod_eq_prime_iff (L39-L45)\ntheorem minimalPeriod_eq_prime_iff {p : \u2115} [hp : Fact p.Prime] :\n minimalPeriod f x = p \u2194 IsPeriodicPt f p x \u2227 \u00acIsFixedPt f x\n```\n\n```lean\ntheorem minimalPeriod_piMap :\n minimalPeriod (Pi.map f) x = sInf { n > 0 | \u2200 i, minimalPeriod (f i) (x i) \u2223 n }\n```\n\nDeclaration: `Mathlib.Dynamics.PeriodicPts.Lemmas.minimalPeriod_piMap` (module Mathlib.Dynamics.PeriodicPts.Lemmas).", "sample_id": "F-Mathlib.Dynamics.PeriodicPts.Lemmas.minimalPeriod_piMap", "source": {"declaration": "Mathlib.Dynamics.PeriodicPts.Lemmas.minimalPeriod_piMap", "file": "Mathlib/Dynamics/PeriodicPts/Lemmas.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Dynamics.PeriodicPts.Lemmas", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Dynamics/PeriodicPts/Lemmas.lean#L143", "span": "L143-L147"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "def runTacticCapturingInfoTree (ctx : ContextInfo) (i : TacticInfo) (goal : MVarId)\n (x : MVarId \u2192 MetaM \u03b1) : CommandElabM (\u03b1 \u00d7 PersistentArray InfoTree)\n:= do thisIsWrongLemmaNameXYZ\nif !i.goalsBefore.contains goal then\n panic!\"ContextInfo.runTacticCapturingInfoTree: `goal` must be an element of `i.goalsBefore`\"\n let mctx := i.mctxBefore\n let lctx := (mctx.decls.find! goal).2\n ctx.runMetaMCapturingInfoTree lctx do\n let type \u2190 goal.getType\n let goal \u2190 Meta.mkFreshExprSyntheticOpaqueMVar type\n x goal.mvarId!\n\n/-- Run tactic code in the context of an infotree node, capturing InfoTrees for suggestion extraction.\n\nReturns both the resulting goals and the InfoTrees produced during tactic execution.\nUse `collectTryThisSuggestions` from `Mathlib.Lean.Elab.InfoTree` to extract suggestions. -/", "diagnostic": "[CompilationUnit(i_begin=0, i_end=192, messages=[Message(data=\"Function expected at\\n MetaM\\nbut this term has type\\n ?m.4\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03b1\\n\\nHint: The identifier `MetaM` 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=18), pos_end=Position(line=2, column=25), severity=, kind=None), Message(data=\"Function expected at\\n CommandElabM\\nbut this term has type\\n ?m.5\\n\\nNote: Expected a function because this term is being applied to the argument\\n (\u03b1 \u00d7 PersistentArray InfoTree)\\n\\nHint: The identifier `CommandElabM` 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=72), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=192, i_end=822, messages=[Message(data=\"unexpected token 'if'; expected command\", pos=Position(line=4, column=0), pos_end=Position(line=4, column=2), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=16, column=92), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]", "mutation_kind": "rewrite_lemma_name_broken", "source_grounded_context_enriched": false, "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 3137, "declarations_count": 397, "diagnostics_count": 1, "duplicate_fingerprint": "22070c4f9c5f89f2", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 848, "lean_code_chars": 814, "lean_code_ratio": 0.2595, "length_bucket": "short", "line_count": 27, "natural_language_chars": 2323, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Lean.ContextInfo).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef runTacticCapturingInfoTree (ctx : ContextInfo) (i : TacticInfo) (goal : MVarId)\n (x : MVarId \u2192 MetaM \u03b1) : CommandElabM (\u03b1 \u00d7 PersistentArray InfoTree)\n:= do thisIsWrongLemmaNameXYZ\nif !i.goalsBefore.contains goal then\n panic!\"ContextInfo.runTacticCapturingInfoTree: `goal` must be an element of `i.goalsBefore`\"\n let mctx := i.mctxBefore\n let lctx := (mctx.decls.find! goal).2\n ctx.runMetaMCapturingInfoTree lctx do\n let type \u2190 goal.getType\n let goal \u2190 Meta.mkFreshExprSyntheticOpaqueMVar type\n x goal.mvarId!\n\n/-- Run tactic code in the context of an infotree node, capturing InfoTrees for suggestion extraction.\n\nReturns both the resulting goals and the InfoTrees produced during tactic execution.\nUse `collectTryThisSuggestions` from `Mathlib.Lean.Elab.InfoTree` to extract suggestions. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=192, messages=[Message(data=\"Function expected at\\n MetaM\\nbut this term has type\\n ?m.4\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03b1\\n\\nHint: The identifier `MetaM` 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=18), pos_end=Position(line=2, column=25), severity=, kind=None), Message(data=\"Function expected at\\n CommandElabM\\nbut this term has type\\n ?m.5\\n\\nNote: Expected a function because this term is being applied to the argument\\n (\u03b1 \u00d7 PersistentArray InfoTree)\\n\\nHint: The identifier `CommandElabM` 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=72), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=192, i_end=822, messages=[Message(data=\"unexpected token 'if'; expected command\", pos=Position(line=4, column=0), pos_end=Position(line=4, column=2), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=16, column=92), 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.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Lean.ContextInfo).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef runTacticCapturingInfoTree (ctx : ContextInfo) (i : TacticInfo) (goal : MVarId)\n (x : MVarId \u2192 MetaM \u03b1) : CommandElabM (\u03b1 \u00d7 PersistentArray InfoTree)\n:= do thisIsWrongLemmaNameXYZ\nif !i.goalsBefore.contains goal then\n panic!\"ContextInfo.runTacticCapturingInfoTree: `goal` must be an element of `i.goalsBefore`\"\n let mctx := i.mctxBefore\n let lctx := (mctx.decls.find! goal).2\n ctx.runMetaMCapturingInfoTree lctx do\n let type \u2190 goal.getType\n let goal \u2190 Meta.mkFreshExprSyntheticOpaqueMVar type\n x goal.mvarId!\n\n/-- Run tactic code in the context of an infotree node, capturing InfoTrees for suggestion extraction.\n\nReturns both the resulting goals and the InfoTrees produced during tactic execution.\nUse `collectTryThisSuggestions` from `Mathlib.Lean.Elab.InfoTree` to extract suggestions. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=192, messages=[Message(data=\"Function expected at\\n MetaM\\nbut this term has type\\n ?m.4\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03b1\\n\\nHint: The identifier `MetaM` 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=18), pos_end=Position(line=2, column=25), severity=, kind=None), Message(data=\"Function expected at\\n CommandElabM\\nbut this term has type\\n ?m.5\\n\\nNote: Expected a function because this term is being applied to the argument\\n (\u03b1 \u00d7 PersistentArray InfoTree)\\n\\nHint: The identifier `CommandElabM` 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=72), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=192, i_end=822, messages=[Message(data=\"unexpected token 'if'; expected command\", pos=Position(line=4, column=0), pos_end=Position(line=4, column=2), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=16, column=92), 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]", "sample_id": "B-Mathlib.Lean.ContextInfo.runTacticCapturingInfoTree", "source": {"declaration": "Mathlib.Lean.ContextInfo.runTacticCapturingInfoTree", "file": "Mathlib/Lean/ContextInfo.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Lean.ContextInfo", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Lean/ContextInfo.lean#L122", "span": "L122-L136"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_add (L39-L47)\ntheorem zpow'_add (a : \u03b1) (m n : \u2124) :\n zpow' a (m + n) = zpow' a m * zpow' a n := by\nby_cases ha : a = 0\n \u00b7 simp [zpow', ha]\n by_cases hn : n = 0\n \u00b7 simp +contextual [hn, zero_zpow]\n \u00b7 simp +contextual [hn, zero_zpow]\n \u00b7 simp [zpow', ha, zpow_add\u2080]", "-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_of_ne_zero_right (L48-L50)\ntheorem zpow'_of_ne_zero_right (a : \u03b1) (n : \u2124) (hn : n \u2260 0) : zpow' a n = a ^ n := by\nsimp [zpow', hn]", "-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_of_ne_zero_left (L51-L53)\ntheorem zpow'_of_ne_zero_left (a : \u03b1) (n : \u2124) (ha : a \u2260 0) : zpow' a n = a ^ n := by\nsimp [zpow', ha]", "-- Mathlib.Tactic.FieldSimp.Lemmas.zero_zpow' (L55-L59)\nlemma zero_zpow' (n : \u2124) : zpow' (0 : \u03b1) n = 0 := by\nsimp +contextual only [zpow', true_and, ite_eq_left_iff]\n intro hn\n exact zero_zpow n hn", "-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_eq_zero_iff (L60-L65)\nlemma zpow'_eq_zero_iff (a : \u03b1) (n : \u2124) : zpow' a n = 0 \u2194 a = 0 := by\nobtain rfl | hn := eq_or_ne n 0\n \u00b7 simp [zpow']\n \u00b7 simp [zpow', zpow_eq_zero_iff hn]\n tauto", "-- Mathlib.Tactic.FieldSimp.Lemmas.one_zpow' (L67-L69)\nlemma one_zpow' (n : \u2124) : zpow' (1 : \u03b1) n = 1 := by\nsimp [zpow']", "-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_one (L71-L73)\nlemma zpow'_one (a : \u03b1) : zpow' a 1 = a := by\nsimp [zpow']", "-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_zero_eq_div (L74-L79)\nlemma zpow'_zero_eq_div (a : \u03b1) : zpow' a 0 = a / a := by\nsimp [zpow']\n by_cases h : a = 0\n \u00b7 simp [h]\n \u00b7 simp [h]", "-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_zero_of_ne_zero (L80-L81)\nlemma zpow'_zero_of_ne_zero {a : \u03b1} (ha : a \u2260 0) : zpow' a 0 = 1 := by simp [zpow', ha]", "-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_neg (L82-L87)\nlemma zpow'_neg (a : \u03b1) (n : \u2124) : zpow' a (-n) = (zpow' a n)\u207b\u00b9 := by\nsimp +contextual [zpow', apply_ite]\n split_ifs with h\n \u00b7 tauto\n \u00b7 tauto", "-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_mul (L88-L98)\nlemma zpow'_mul (a : \u03b1) (m n : \u2124) : zpow' a (m * n) = zpow' (zpow' a m) n := by\nby_cases ha : a = 0\n \u00b7 simp [ha]\n by_cases hn : n = 0\n \u00b7 rw [hn]\n simp [zpow', ha, zpow_ne_zero ]\n by_cases hm : m = 0\n \u00b7 rw [hm]\n simp [zpow', ha]\n simpa [zpow', ha, hm, hn] using zpow_mul a m n", "-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_ofNat (L99-L103)\nlemma zpow'_ofNat (a : \u03b1) {n : \u2115} (hn : n \u2260 0) : zpow' a n = a ^ n := by\nrw [zpow'_of_ne_zero_right]\n \u00b7 simp\n exact_mod_cast hn", "-- Mathlib.Tactic.FieldSimp.Lemmas.mul_zpow' (L106-L113)\nlemma mul_zpow' [CommGroupWithZero \u03b1] (n : \u2124) (a b : \u03b1) :\n zpow' (a * b) n = zpow' a n * zpow' b n := by\nby_cases ha : a = 0\n \u00b7 simp [ha]\n by_cases hb : b = 0\n \u00b7 simp [hb]\n simpa [zpow', ha, hb] using mul_zpow a b n", "-- Mathlib.Tactic.FieldSimp.Lemmas.list_prod_zpow' (L114-L120)\ntheorem list_prod_zpow' [CommGroupWithZero \u03b1] {r : \u2124} {l : List \u03b1} :\n zpow' (prod l) r = prod (map (fun x \u21a6 zpow' x r) l) :=\nlet fr : \u03b1 \u2192* \u03b1 := \u27e8\u27e8fun b \u21a6 zpow' b r, one_zpow' r\u27e9, (mul_zpow' r)\u27e9\n map_list_prod fr l\n\nend zpow'", "-- Mathlib.Tactic.FieldSimp.Lemmas.subst_add (L121-L126)\ntheorem subst_add {M : Type*} [Semiring M] {x\u2081 x\u2082 X\u2081 X\u2082 Y y a : M}\n (h\u2081 : x\u2081 = a * X\u2081) (h\u2082 : x\u2082 = a * X\u2082) (H_atom : X\u2081 + X\u2082 = Y) (hy : a * Y = y) :\n x\u2081 + x\u2082 = y := by\nsubst h\u2081 h\u2082 H_atom hy\n simp [mul_add]", "-- Mathlib.Tactic.FieldSimp.Lemmas.subst_sub (L127-L132)\ntheorem subst_sub {M : Type*} [Ring M] {x\u2081 x\u2082 X\u2081 X\u2082 Y y a : M}\n (h\u2081 : x\u2081 = a * X\u2081) (h\u2082 : x\u2082 = a * X\u2082) (H_atom : X\u2081 - X\u2082 = Y) (hy : a * Y = y) :\n x\u2081 - x\u2082 = y := by\nsubst h\u2081 h\u2082 H_atom hy\n simp [mul_sub]", "-- Mathlib.Tactic.FieldSimp.Lemmas.eq_div_of_eq_one_of_subst (L133-L137)\ntheorem eq_div_of_eq_one_of_subst {M : Type*} [DivInvOneMonoid M] {l l_n n : M} (h : l = l_n / 1)\n (hn : l_n = n) :\n l = n := by\nrw [h, hn, div_one]", "-- Mathlib.Tactic.FieldSimp.Lemmas.eq_div_of_eq_one_of_subst' (L138-L142)\ntheorem eq_div_of_eq_one_of_subst' {M : Type*} [DivInvOneMonoid M] {l l_d d : M} (h : l = 1 / l_d)\n (hn : l_d = d) :\n l = d\u207b\u00b9 := by\nrw [h, hn, one_div]", "-- Mathlib.Tactic.FieldSimp.Lemmas.eq_div_of_subst (L143-L147)\ntheorem eq_div_of_subst {M : Type*} [Div M] {l l_n l_d n d : M} (h : l = l_n / l_d) (hn : l_n = n)\n (hd : l_d = d) :\n l = n / d := by\nrw [h, hn, hd]", "-- Mathlib.Tactic.FieldSimp.Lemmas.eq_mul_of_eq_eq_eq_mul (L148-L152)\ntheorem eq_mul_of_eq_eq_eq_mul {M : Type*} [Mul M] {a b c D e f : M}\n (h\u2081 : a = b) (h\u2082 : b = c) (h\u2083 : c = D * e) (h\u2084 : e = f) :\n a = D * f := by\nrw [h\u2081, h\u2082, h\u2083, h\u2084]", "-- Mathlib.Tactic.FieldSimp.Lemmas.eq_eq_cancel_eq (L153-L158)\ntheorem eq_eq_cancel_eq {M : Type*} [MonoidWithZero M] [IsLeftCancelMulZero M] {e\u2081 e\u2082 f\u2081 f\u2082 L : M}\n (H\u2081 : e\u2081 = L * f\u2081) (H\u2082 : e\u2082 = L * f\u2082) (HL : L \u2260 0) :\n (e\u2081 = e\u2082) = (f\u2081 = f\u2082) := by\nsubst H\u2081 H\u2082\n rw [mul_right_inj' HL]", "-- Mathlib.Tactic.FieldSimp.Lemmas.le_eq_cancel_le (L159-L166)\ntheorem le_eq_cancel_le {M : Type*} [MonoidWithZero M] [PartialOrder M] [PosMulMono M]\n [PosMulReflectLE M] {e\u2081 e\u2082 f\u2081 f\u2082 L : M}\n (H\u2081 : e\u2081 = L * f\u2081) (H\u2082 : e\u2082 = L * f\u2082) (HL : 0 < L) :\n (e\u2081 \u2264 e\u2082) = (f\u2081 \u2264 f\u2082) := by\nsubst H\u2081 H\u2082\n apply Iff.eq\n exact mul_le_mul_iff_right\u2080 HL", "-- Mathlib.Tactic.FieldSimp.Lemmas.NF (L185-L191)\ndef NF (M : Type*) := List (\u2124 \u00d7 M)\nnamespace NF\nvariable {M : Type*}\n\n/-- Augment a `FieldSimp.NF M` object `l`, i.e. a list of pairs in `\u2124 \u00d7 M`, by prepending another\npair `p : \u2124 \u00d7 M`. -/", "-- Mathlib.Tactic.FieldSimp.Lemmas.cons (L193-L194)\ndef cons (p : \u2124 \u00d7 M) (l : NF M) : NF M := p :: l", "-- Mathlib.Tactic.FieldSimp.Lemmas.cons_ne_zero (L208-L213)\ntheorem cons_ne_zero [GroupWithZero M] (r : \u2124) {x : M} (hx : x \u2260 0) {l : NF M} (hl : l.eval \u2260 0) :\n ((r, x) ::\u1d63 l).eval \u2260 0 := by\nunfold eval cons\n apply mul_ne_zero ?_ hl\n simp [zpow'_eq_zero_iff, hx]"], "source_grounded_context_enriched": false, "statement": "theorem lt_eq_cancel_lt {M : Type*} [MonoidWithZero M] [PartialOrder M] [PosMulStrictMono M]\n [PosMulReflectLT M] {e\u2081 e\u2082 f\u2081 f\u2082 L : M}\n (H\u2081 : e\u2081 = L * f\u2081) (H\u2082 : e\u2082 = L * f\u2082) (HL : 0 < L) :\n (e\u2081 < e\u2082) = (f\u2081 < f\u2082)", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 6966, "declarations_count": 848, "diagnostics_count": 0, "duplicate_fingerprint": "eb8bb0c079defcb7", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 3113, "lean_code_chars": 5871, "lean_code_ratio": 0.8428, "length_bucket": "medium", "line_count": 248, "natural_language_chars": 1095, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 25, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.FieldSimp.Lemmas).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem lt_eq_cancel_lt {M : Type*} [MonoidWithZero M] [PartialOrder M] [PosMulStrictMono M]\n [PosMulReflectLT M] {e\u2081 e\u2082 f\u2081 f\u2082 L : M}\n (H\u2081 : e\u2081 = L * f\u2081) (H\u2082 : e\u2082 = L * f\u2082) (HL : 0 < L) :\n (e\u2081 < e\u2082) = (f\u2081 < f\u2082)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_add (L39-L47)\ntheorem zpow'_add (a : \u03b1) (m n : \u2124) :\n zpow' a (m + n) = zpow' a m * zpow' a n := by\nby_cases ha : a = 0\n \u00b7 simp [zpow', ha]\n by_cases hn : n = 0\n \u00b7 simp +contextual [hn, zero_zpow]\n \u00b7 simp +contextual [hn, zero_zpow]\n \u00b7 simp [zpow', ha, zpow_add\u2080]\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_of_ne_zero_right (L48-L50)\ntheorem zpow'_of_ne_zero_right (a : \u03b1) (n : \u2124) (hn : n \u2260 0) : zpow' a n = a ^ n := by\nsimp [zpow', hn]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_of_ne_zero_left (L51-L53)\ntheorem zpow'_of_ne_zero_left (a : \u03b1) (n : \u2124) (ha : a \u2260 0) : zpow' a n = a ^ n := by\nsimp [zpow', ha]\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.zero_zpow' (L55-L59)\nlemma zero_zpow' (n : \u2124) : zpow' (0 : \u03b1) n = 0 := by\nsimp +contextual only [zpow', true_and, ite_eq_left_iff]\n intro hn\n exact zero_zpow n hn\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_eq_zero_iff (L60-L65)\nlemma zpow'_eq_zero_iff (a : \u03b1) (n : \u2124) : zpow' a n = 0 \u2194 a = 0 := by\nobtain rfl | hn := eq_or_ne n 0\n \u00b7 simp [zpow']\n \u00b7 simp [zpow', zpow_eq_zero_iff hn]\n tauto\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.one_zpow' (L67-L69)\nlemma one_zpow' (n : \u2124) : zpow' (1 : \u03b1) n = 1 := by\nsimp [zpow']\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_one (L71-L73)\nlemma zpow'_one (a : \u03b1) : zpow' a 1 = a := by\nsimp [zpow']\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_zero_eq_div (L74-L79)\nlemma zpow'_zero_eq_div (a : \u03b1) : zpow' a 0 = a / a := by\nsimp [zpow']\n by_cases h : a = 0\n \u00b7 simp [h]\n \u00b7 simp [h]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_zero_of_ne_zero (L80-L81)\nlemma zpow'_zero_of_ne_zero {a : \u03b1} (ha : a \u2260 0) : zpow' a 0 = 1 := by simp [zpow', ha]\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_neg (L82-L87)\nlemma zpow'_neg (a : \u03b1) (n : \u2124) : zpow' a (-n) = (zpow' a n)\u207b\u00b9 := by\nsimp +contextual [zpow', apply_ite]\n split_ifs with h\n \u00b7 tauto\n \u00b7 tauto\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_mul (L88-L98)\nlemma zpow'_mul (a : \u03b1) (m n : \u2124) : zpow' a (m * n) = zpow' (zpow' a m) n := by\nby_cases ha : a = 0\n \u00b7 simp [ha]\n by_cases hn : n = 0\n \u00b7 rw [hn]\n simp [zpow', ha, zpow_ne_zero ]\n by_cases hm : m = 0\n \u00b7 rw [hm]\n simp [zpow', ha]\n simpa [zpow', ha, hm, hn] using zpow_mul a m n\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_ofNat (L99-L103)\nlemma zpow'_ofNat (a : \u03b1) {n : \u2115} (hn : n \u2260 0) : zpow' a n = a ^ n := by\nrw [zpow'_of_ne_zero_right]\n \u00b7 simp\n exact_mod_cast hn\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.mul_zpow' (L106-L113)\nlemma mul_zpow' [CommGroupWithZero \u03b1] (n : \u2124) (a b : \u03b1) :\n zpow' (a * b) n = zpow' a n * zpow' b n := by\nby_cases ha : a = 0\n \u00b7 simp [ha]\n by_cases hb : b = 0\n \u00b7 simp [hb]\n simpa [zpow', ha, hb] using mul_zpow a b n\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.list_prod_zpow' (L114-L120)\ntheorem list_prod_zpow' [CommGroupWithZero \u03b1] {r : \u2124} {l : List \u03b1} :\n zpow' (prod l) r = prod (map (fun x \u21a6 zpow' x r) l) :=\nlet fr : \u03b1 \u2192* \u03b1 := \u27e8\u27e8fun b \u21a6 zpow' b r, one_zpow' r\u27e9, (mul_zpow' r)\u27e9\n map_list_prod fr l\n\nend zpow'\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.subst_add (L121-L126)\ntheorem subst_add {M : Type*} [Semiring M] {x\u2081 x\u2082 X\u2081 X\u2082 Y y a : M}\n (h\u2081 : x\u2081 = a * X\u2081) (h\u2082 : x\u2082 = a * X\u2082) (H_atom : X\u2081 + X\u2082 = Y) (hy : a * Y = y) :\n x\u2081 + x\u2082 = y := by\nsubst h\u2081 h\u2082 H_atom hy\n simp [mul_add]\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.subst_sub (L127-L132)\ntheorem subst_sub {M : Type*} [Ring M] {x\u2081 x\u2082 X\u2081 X\u2082 Y y a : M}\n (h\u2081 : x\u2081 = a * X\u2081) (h\u2082 : x\u2082 = a * X\u2082) (H_atom : X\u2081 - X\u2082 = Y) (hy : a * Y = y) :\n x\u2081 - x\u2082 = y := by\nsubst h\u2081 h\u2082 H_atom hy\n simp [mul_sub]\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.eq_div_of_eq_one_of_subst (L133-L137)\ntheorem eq_div_of_eq_one_of_subst {M : Type*} [DivInvOneMonoid M] {l l_n n : M} (h : l = l_n / 1)\n (hn : l_n = n) :\n l = n := by\nrw [h, hn, div_one]\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.eq_div_of_eq_one_of_subst' (L138-L142)\ntheorem eq_div_of_eq_one_of_subst' {M : Type*} [DivInvOneMonoid M] {l l_d d : M} (h : l = 1 / l_d)\n (hn : l_d = d) :\n l = d\u207b\u00b9 := by\nrw [h, hn, one_div]\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.eq_div_of_subst (L143-L147)\ntheorem eq_div_of_subst {M : Type*} [Div M] {l l_n l_d n d : M} (h : l = l_n / l_d) (hn : l_n = n)\n (hd : l_d = d) :\n l = n / d := by\nrw [h, hn, hd]\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.eq_mul_of_eq_eq_eq_mul (L148-L152)\ntheorem eq_mul_of_eq_eq_eq_mul {M : Type*} [Mul M] {a b c D e f : M}\n (h\u2081 : a = b) (h\u2082 : b = c) (h\u2083 : c = D * e) (h\u2084 : e = f) :\n a = D * f := by\nrw [h\u2081, h\u2082, h\u2083, h\u2084]\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.eq_eq_cancel_eq (L153-L158)\ntheorem eq_eq_cancel_eq {M : Type*} [MonoidWithZero M] [IsLeftCancelMulZero M] {e\u2081 e\u2082 f\u2081 f\u2082 L : M}\n (H\u2081 : e\u2081 = L * f\u2081) (H\u2082 : e\u2082 = L * f\u2082) (HL : L \u2260 0) :\n (e\u2081 = e\u2082) = (f\u2081 = f\u2082) := by\nsubst H\u2081 H\u2082\n rw [mul_right_inj' HL]\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.le_eq_cancel_le (L159-L166)\ntheorem le_eq_cancel_le {M : Type*} [MonoidWithZero M] [PartialOrder M] [PosMulMono M]\n [PosMulReflectLE M] {e\u2081 e\u2082 f\u2081 f\u2082 L : M}\n (H\u2081 : e\u2081 = L * f\u2081) (H\u2082 : e\u2082 = L * f\u2082) (HL : 0 < L) :\n (e\u2081 \u2264 e\u2082) = (f\u2081 \u2264 f\u2082) := by\nsubst H\u2081 H\u2082\n apply Iff.eq\n exact mul_le_mul_iff_right\u2080 HL\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.NF (L185-L191)\ndef NF (M : Type*) := List (\u2124 \u00d7 M)\nnamespace NF\nvariable {M : Type*}\n\n/-- Augment a `FieldSimp.NF M` object `l`, i.e. a list of pairs in `\u2124 \u00d7 M`, by prepending another\npair `p : \u2124 \u00d7 M`. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.cons (L193-L194)\ndef cons (p : \u2124 \u00d7 M) (l : NF M) : NF M := p :: l\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.cons_ne_zero (L208-L213)\ntheorem cons_ne_zero [GroupWithZero M] (r : \u2124) {x : M} (hx : x \u2260 0) {l : NF M} (hl : l.eval \u2260 0) :\n ((r, x) ::\u1d63 l).eval \u2260 0 := by\nunfold eval cons\n apply mul_ne_zero ?_ hl\n simp [zpow'_eq_zero_iff, hx]\n```\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.FieldSimp.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 lt_eq_cancel_lt {M : Type*} [MonoidWithZero M] [PartialOrder M] [PosMulStrictMono M]\n [PosMulReflectLT M] {e\u2081 e\u2082 f\u2081 f\u2082 L : M}\n (H\u2081 : e\u2081 = L * f\u2081) (H\u2082 : e\u2082 = L * f\u2082) (HL : 0 < L) :\n (e\u2081 < e\u2082) = (f\u2081 < f\u2082)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_add (L39-L47)\ntheorem zpow'_add (a : \u03b1) (m n : \u2124) :\n zpow' a (m + n) = zpow' a m * zpow' a n := by\nby_cases ha : a = 0\n \u00b7 simp [zpow', ha]\n by_cases hn : n = 0\n \u00b7 simp +contextual [hn, zero_zpow]\n \u00b7 simp +contextual [hn, zero_zpow]\n \u00b7 simp [zpow', ha, zpow_add\u2080]\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_of_ne_zero_right (L48-L50)\ntheorem zpow'_of_ne_zero_right (a : \u03b1) (n : \u2124) (hn : n \u2260 0) : zpow' a n = a ^ n := by\nsimp [zpow', hn]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_of_ne_zero_left (L51-L53)\ntheorem zpow'_of_ne_zero_left (a : \u03b1) (n : \u2124) (ha : a \u2260 0) : zpow' a n = a ^ n := by\nsimp [zpow', ha]\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.zero_zpow' (L55-L59)\nlemma zero_zpow' (n : \u2124) : zpow' (0 : \u03b1) n = 0 := by\nsimp +contextual only [zpow', true_and, ite_eq_left_iff]\n intro hn\n exact zero_zpow n hn\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_eq_zero_iff (L60-L65)\nlemma zpow'_eq_zero_iff (a : \u03b1) (n : \u2124) : zpow' a n = 0 \u2194 a = 0 := by\nobtain rfl | hn := eq_or_ne n 0\n \u00b7 simp [zpow']\n \u00b7 simp [zpow', zpow_eq_zero_iff hn]\n tauto\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.one_zpow' (L67-L69)\nlemma one_zpow' (n : \u2124) : zpow' (1 : \u03b1) n = 1 := by\nsimp [zpow']\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_one (L71-L73)\nlemma zpow'_one (a : \u03b1) : zpow' a 1 = a := by\nsimp [zpow']\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_zero_eq_div (L74-L79)\nlemma zpow'_zero_eq_div (a : \u03b1) : zpow' a 0 = a / a := by\nsimp [zpow']\n by_cases h : a = 0\n \u00b7 simp [h]\n \u00b7 simp [h]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_zero_of_ne_zero (L80-L81)\nlemma zpow'_zero_of_ne_zero {a : \u03b1} (ha : a \u2260 0) : zpow' a 0 = 1 := by simp [zpow', ha]\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_neg (L82-L87)\nlemma zpow'_neg (a : \u03b1) (n : \u2124) : zpow' a (-n) = (zpow' a n)\u207b\u00b9 := by\nsimp +contextual [zpow', apply_ite]\n split_ifs with h\n \u00b7 tauto\n \u00b7 tauto\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_mul (L88-L98)\nlemma zpow'_mul (a : \u03b1) (m n : \u2124) : zpow' a (m * n) = zpow' (zpow' a m) n := by\nby_cases ha : a = 0\n \u00b7 simp [ha]\n by_cases hn : n = 0\n \u00b7 rw [hn]\n simp [zpow', ha, zpow_ne_zero ]\n by_cases hm : m = 0\n \u00b7 rw [hm]\n simp [zpow', ha]\n simpa [zpow', ha, hm, hn] using zpow_mul a m n\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.zpow'_ofNat (L99-L103)\nlemma zpow'_ofNat (a : \u03b1) {n : \u2115} (hn : n \u2260 0) : zpow' a n = a ^ n := by\nrw [zpow'_of_ne_zero_right]\n \u00b7 simp\n exact_mod_cast hn\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.mul_zpow' (L106-L113)\nlemma mul_zpow' [CommGroupWithZero \u03b1] (n : \u2124) (a b : \u03b1) :\n zpow' (a * b) n = zpow' a n * zpow' b n := by\nby_cases ha : a = 0\n \u00b7 simp [ha]\n by_cases hb : b = 0\n \u00b7 simp [hb]\n simpa [zpow', ha, hb] using mul_zpow a b n\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.list_prod_zpow' (L114-L120)\ntheorem list_prod_zpow' [CommGroupWithZero \u03b1] {r : \u2124} {l : List \u03b1} :\n zpow' (prod l) r = prod (map (fun x \u21a6 zpow' x r) l) :=\nlet fr : \u03b1 \u2192* \u03b1 := \u27e8\u27e8fun b \u21a6 zpow' b r, one_zpow' r\u27e9, (mul_zpow' r)\u27e9\n map_list_prod fr l\n\nend zpow'\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.subst_add (L121-L126)\ntheorem subst_add {M : Type*} [Semiring M] {x\u2081 x\u2082 X\u2081 X\u2082 Y y a : M}\n (h\u2081 : x\u2081 = a * X\u2081) (h\u2082 : x\u2082 = a * X\u2082) (H_atom : X\u2081 + X\u2082 = Y) (hy : a * Y = y) :\n x\u2081 + x\u2082 = y := by\nsubst h\u2081 h\u2082 H_atom hy\n simp [mul_add]\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.subst_sub (L127-L132)\ntheorem subst_sub {M : Type*} [Ring M] {x\u2081 x\u2082 X\u2081 X\u2082 Y y a : M}\n (h\u2081 : x\u2081 = a * X\u2081) (h\u2082 : x\u2082 = a * X\u2082) (H_atom : X\u2081 - X\u2082 = Y) (hy : a * Y = y) :\n x\u2081 - x\u2082 = y := by\nsubst h\u2081 h\u2082 H_atom hy\n simp [mul_sub]\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.eq_div_of_eq_one_of_subst (L133-L137)\ntheorem eq_div_of_eq_one_of_subst {M : Type*} [DivInvOneMonoid M] {l l_n n : M} (h : l = l_n / 1)\n (hn : l_n = n) :\n l = n := by\nrw [h, hn, div_one]\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.eq_div_of_eq_one_of_subst' (L138-L142)\ntheorem eq_div_of_eq_one_of_subst' {M : Type*} [DivInvOneMonoid M] {l l_d d : M} (h : l = 1 / l_d)\n (hn : l_d = d) :\n l = d\u207b\u00b9 := by\nrw [h, hn, one_div]\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.eq_div_of_subst (L143-L147)\ntheorem eq_div_of_subst {M : Type*} [Div M] {l l_n l_d n d : M} (h : l = l_n / l_d) (hn : l_n = n)\n (hd : l_d = d) :\n l = n / d := by\nrw [h, hn, hd]\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.eq_mul_of_eq_eq_eq_mul (L148-L152)\ntheorem eq_mul_of_eq_eq_eq_mul {M : Type*} [Mul M] {a b c D e f : M}\n (h\u2081 : a = b) (h\u2082 : b = c) (h\u2083 : c = D * e) (h\u2084 : e = f) :\n a = D * f := by\nrw [h\u2081, h\u2082, h\u2083, h\u2084]\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.eq_eq_cancel_eq (L153-L158)\ntheorem eq_eq_cancel_eq {M : Type*} [MonoidWithZero M] [IsLeftCancelMulZero M] {e\u2081 e\u2082 f\u2081 f\u2082 L : M}\n (H\u2081 : e\u2081 = L * f\u2081) (H\u2082 : e\u2082 = L * f\u2082) (HL : L \u2260 0) :\n (e\u2081 = e\u2082) = (f\u2081 = f\u2082) := by\nsubst H\u2081 H\u2082\n rw [mul_right_inj' HL]\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.le_eq_cancel_le (L159-L166)\ntheorem le_eq_cancel_le {M : Type*} [MonoidWithZero M] [PartialOrder M] [PosMulMono M]\n [PosMulReflectLE M] {e\u2081 e\u2082 f\u2081 f\u2082 L : M}\n (H\u2081 : e\u2081 = L * f\u2081) (H\u2082 : e\u2082 = L * f\u2082) (HL : 0 < L) :\n (e\u2081 \u2264 e\u2082) = (f\u2081 \u2264 f\u2082) := by\nsubst H\u2081 H\u2082\n apply Iff.eq\n exact mul_le_mul_iff_right\u2080 HL\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.NF (L185-L191)\ndef NF (M : Type*) := List (\u2124 \u00d7 M)\nnamespace NF\nvariable {M : Type*}\n\n/-- Augment a `FieldSimp.NF M` object `l`, i.e. a list of pairs in `\u2124 \u00d7 M`, by prepending another\npair `p : \u2124 \u00d7 M`. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.cons (L193-L194)\ndef cons (p : \u2124 \u00d7 M) (l : NF M) : NF M := p :: l\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Tactic.FieldSimp.Lemmas.cons_ne_zero (L208-L213)\ntheorem cons_ne_zero [GroupWithZero M] (r : \u2124) {x : M} (hx : x \u2260 0) {l : NF M} (hl : l.eval \u2260 0) :\n ((r, x) ::\u1d63 l).eval \u2260 0 := by\nunfold eval cons\n apply mul_ne_zero ?_ hl\n simp [zpow'_eq_zero_iff, hx]\n```\n[/INST]", "sample_id": "C-Mathlib.Tactic.FieldSimp.Lemmas.lt_eq_cancel_lt", "source": {"declaration": "Mathlib.Tactic.FieldSimp.Lemmas.lt_eq_cancel_lt", "file": "Mathlib/Tactic/FieldSimp/Lemmas.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.FieldSimp.Lemmas", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/FieldSimp/Lemmas.lean#L167", "span": "L167-L184"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"context_enriched": true, "source_grounded_context_enriched": true, "statement": "theorem coverEntropy_image_of_comap (u : UniformSpace Y) {S : X \u2192 X} {T : Y \u2192 Y} {\u03c6 : X \u2192 Y}\n (h : Semiconj \u03c6 S T) (F : Set X) :\n coverEntropy T (\u03c6 '' F) = @coverEntropy X (comap \u03c6 u) S F", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 614, "declarations_count": 75, "diagnostics_count": 0, "duplicate_fingerprint": "618639119a722c0d", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 582, "lean_code_chars": 194, "lean_code_ratio": 0.316, "length_bucket": "short", "line_count": 9, "natural_language_chars": 420, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.TopologicalEntropy.Semiconj).", "role": "system"}, {"content": "Complete the following proof.\n\nOpen namespaces: Function, Prod, Set, Uniformity, UniformSpace, scoped, SetRel, ENNReal\n\n## Surrounding context in Mathlib/Dynamics/TopologicalEntropy/Semiconj.lean\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.IsDynCoverOf (L65-L71)\nlemma IsDynCoverOf.image (h : Semiconj \u03c6 S T) (h' : IsDynCoverOf S F (map \u03c6 \u03c6 \u207b\u00b9' V) n s) :\n IsDynCoverOf T (\u03c6 '' F) V n (\u03c6 '' s)\n\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.IsDynCoverOf (L72-L92)\nlemma IsDynCoverOf.preimage (h : Semiconj \u03c6 S T) [V.IsSymm] {t : Finset Y}\n (h' : IsDynCoverOf T (\u03c6 '' F) V n t) :\n \u2203 s : Finset X, IsDynCoverOf S F ((map \u03c6 \u03c6) \u207b\u00b9' (V \u25cb V)) n s \u2227 s.card \u2264 t.card\n\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.le_coverMincard_image (L93-L101)\nlemma le_coverMincard_image (h : Semiconj \u03c6 S T) (F : Set X) [V.IsSymm] (n : \u2115) :\n coverMincard S F ((map \u03c6 \u03c6) \u207b\u00b9' (V \u25cb V)) n \u2264 coverMincard T (\u03c6 '' F) V n\n```\n\nRelevant lemmas available in scope: `le_antisymm`, `coverEntropyEntourage_le_coverEntropy`\n\n```lean\ntheorem coverEntropy_image_of_comap (u : UniformSpace Y) {S : X \u2192 X} {T : Y \u2192 Y} {\u03c6 : X \u2192 Y}\n (h : Semiconj \u03c6 S T) (F : Set X) :\n coverEntropy T (\u03c6 '' F) = @coverEntropy X (comap \u03c6 u) S F\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.TopologicalEntropy.Semiconj).\n\nComplete the following proof.\n\nOpen namespaces: Function, Prod, Set, Uniformity, UniformSpace, scoped, SetRel, ENNReal\n\n## Surrounding context in Mathlib/Dynamics/TopologicalEntropy/Semiconj.lean\n```lean\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.IsDynCoverOf (L65-L71)\nlemma IsDynCoverOf.image (h : Semiconj \u03c6 S T) (h' : IsDynCoverOf S F (map \u03c6 \u03c6 \u207b\u00b9' V) n s) :\n IsDynCoverOf T (\u03c6 '' F) V n (\u03c6 '' s)\n\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.IsDynCoverOf (L72-L92)\nlemma IsDynCoverOf.preimage (h : Semiconj \u03c6 S T) [V.IsSymm] {t : Finset Y}\n (h' : IsDynCoverOf T (\u03c6 '' F) V n t) :\n \u2203 s : Finset X, IsDynCoverOf S F ((map \u03c6 \u03c6) \u207b\u00b9' (V \u25cb V)) n s \u2227 s.card \u2264 t.card\n\n-- Mathlib.Dynamics.TopologicalEntropy.Semiconj.le_coverMincard_image (L93-L101)\nlemma le_coverMincard_image (h : Semiconj \u03c6 S T) (F : Set X) [V.IsSymm] (n : \u2115) :\n coverMincard S F ((map \u03c6 \u03c6) \u207b\u00b9' (V \u25cb V)) n \u2264 coverMincard T (\u03c6 '' F) V n\n```\n\nRelevant lemmas available in scope: `le_antisymm`, `coverEntropyEntourage_le_coverEntropy`\n\n```lean\ntheorem coverEntropy_image_of_comap (u : UniformSpace Y) {S : X \u2192 X} {T : Y \u2192 Y} {\u03c6 : X \u2192 Y}\n (h : Semiconj \u03c6 S T) (F : Set X) :\n coverEntropy T (\u03c6 '' F) = @coverEntropy X (comap \u03c6 u) S F\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "sample_id": "A-Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropy_image_of_comap", "source": {"declaration": "Mathlib.Dynamics.TopologicalEntropy.Semiconj.coverEntropy_image_of_comap", "file": "Mathlib/Dynamics/TopologicalEntropy/Semiconj.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Dynamics.TopologicalEntropy.Semiconj", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Dynamics/TopologicalEntropy/Semiconj.lean#L133", "span": "L133-L153"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Tactic.NormNum.Prime.not_prime_mul_of_ble (L37-L42)\ntheorem not_prime_mul_of_ble (a b n : \u2115) (h : a * b = n) (h\u2081 : a.ble 1 = false)\n (h\u2082 : b.ble 1 = false) : \u00ac n.Prime :=\nnot_prime_of_mul_eq h (ble_eq_false.mp h\u2081).ne' (ble_eq_false.mp h\u2082).ne'\n\n/-- Produce a proof that `n` is not prime from a factor `1 < d < n`. `en` should be the expression\n that is the natural number literal `n`. -/", "-- Mathlib.Tactic.NormNum.Prime.deriveNotPrime (L43-L50)\ndef deriveNotPrime (n d : \u2115) (en : Q(\u2115)) : Q(\u00ac Nat.Prime $en) := Id.run do\nlet d' : \u2115 := n / d\n let prf : Q($d * $d' = $en) := (q(Eq.refl $en) : Expr)\n let r : Q(Nat.ble $d 1 = false) := (q(Eq.refl false) : Expr)\n let r' : Q(Nat.ble $d' 1 = false) := (q(Eq.refl false) : Expr)\n return q(not_prime_mul_of_ble _ _ _ $prf $r $r')\n\n/-- A predicate representing partial progress in a proof of `minFac`. -/", "-- Mathlib.Tactic.NormNum.Prime.MinFacHelper (L51-L53)\ndef MinFacHelper (n k : \u2115) : Prop :=\n2 < k \u2227 k % 2 = 1 \u2227 k \u2264 minFac n", "-- Mathlib.Tactic.NormNum.Prime.MinFacHelper (L54-L61)\ntheorem MinFacHelper.one_lt {n k : \u2115} (h : MinFacHelper n k) : 1 < n := by\nhave : 2 < minFac n := h.1.trans_le h.2.2\n obtain rfl | h := n.eq_zero_or_pos\n \u00b7 contradiction\n rcases (succ_le_of_lt h).eq_or_lt with rfl | h\n \u00b7 simp_all\n exact h", "-- Mathlib.Tactic.NormNum.Prime.minFacHelper_0 (L62-L70)\ntheorem minFacHelper_0 (n : \u2115)\n (h1 : Nat.ble (nat_lit 2) n = true) (h2 : nat_lit 1 = n % (nat_lit 2)) :\n MinFacHelper n (nat_lit 3) := by\nrefine \u27e8by simp, by simp, ?_\u27e9\n refine (le_minFac'.mpr fun p hp hpn \u21a6 ?_).resolve_left (Nat.ne_of_gt (Nat.le_of_ble_eq_true h1))\n rcases hp.eq_or_lt with rfl | h\n \u00b7 simp [(Nat.dvd_iff_mod_eq_zero ..).1 hpn] at h2\n \u00b7 exact h", "-- Mathlib.Tactic.NormNum.Prime.minFacHelper_1 (L71-L87)\ntheorem minFacHelper_1 {n k k' : \u2115} (e : k + 2 = k') (h : MinFacHelper n k)\n (np : minFac n \u2260 k) : MinFacHelper n k' := by\nrw [\u2190 e]\n refine \u27e8Nat.lt_add_right _ h.1, ?_, ?_\u27e9\n \u00b7 rw [add_mod, mod_self, add_zero, mod_mod]\n exact h.2.1\n rcases h.2.2.eq_or_lt with rfl | h2\n \u00b7 exact (np rfl).elim\n rcases (succ_le_of_lt h2).eq_or_lt with h2|h2\n \u00b7 refine ((h.1.trans_le h.2.2).ne ?_).elim\n have h3 : 2 \u2223 minFac n := by\n rw [Nat.dvd_iff_mod_eq_zero, \u2190 h2, succ_eq_add_one, add_mod, h.2.1]\n rw [dvd_prime <| minFac_prime h.one_lt.ne'] at h3\n norm_num at h3\n exact h3\n exact h2", "-- Mathlib.Tactic.NormNum.Prime.minFacHelper_2 (L88-L93)\ntheorem minFacHelper_2 {n k k' : \u2115} (e : k + 2 = k') (nk : \u00ac Nat.Prime k)\n (h : MinFacHelper n k) : MinFacHelper n k' := by\nrefine minFacHelper_1 e h fun h2 \u21a6 ?_\n rw [\u2190 h2] at nk\n exact nk <| minFac_prime h.one_lt.ne'", "-- Mathlib.Tactic.NormNum.Prime.minFacHelper_3 (L94-L100)\ntheorem minFacHelper_3 {n k k' : \u2115} (e : k + 2 = k') (nk : (n % k).beq 0 = false)\n (h : MinFacHelper n k) : MinFacHelper n k' := by\nrefine minFacHelper_1 e h fun h2 \u21a6 ?_\n have nk := Nat.ne_of_beq_eq_false nk\n rw [\u2190 Nat.dvd_iff_mod_eq_zero, \u2190 h2] at nk\n exact nk <| minFac_dvd n", "-- Mathlib.Tactic.NormNum.Prime.isNat_minFac_1 (L101-L103)\ntheorem isNat_minFac_1 : {a : \u2115} \u2192 IsNat a (nat_lit 1) \u2192 IsNat a.minFac 1\n | _, \u27e8rfl\u27e9 => \u27e8minFac_one\u27e9", "-- Mathlib.Tactic.NormNum.Prime.isNat_minFac_3 (L107-L112)\ntheorem isNat_minFac_3 : {n n' : \u2115} \u2192 (k : \u2115) \u2192\n IsNat n n' \u2192 MinFacHelper n' k \u2192 nat_lit 0 = n' % k \u2192 IsNat (minFac n) k\n | n, _, k, \u27e8rfl\u27e9, h1, h2 => by\n rw [eq_comm, \u2190 Nat.dvd_iff_mod_eq_zero] at h2\n exact \u27e8le_antisymm (minFac_le_of_dvd h1.1.le h2) h1.2.2\u27e9", "-- Mathlib.Tactic.NormNum.Prime.isNat_minFac_4 (L113-L125)\ntheorem isNat_minFac_4 : {n n' k : \u2115} \u2192\n IsNat n n' \u2192 MinFacHelper n' k \u2192 (k * k).ble n' = false \u2192 IsNat (minFac n) n'\n | n, _, k, \u27e8rfl\u27e9, h1, h2 => by\n refine \u27e8(Nat.prime_def_minFac.mp ?_).2\u27e9\n rw [Nat.prime_def_le_sqrt]\n refine \u27e8h1.one_lt, fun m hm hmn h2mn \u21a6 ?_\u27e9\n exact lt_irrefl m <| calc\n m \u2264 sqrt n := hmn\n_ < k := sqrt_lt.mpr (ble_eq_false.mp h2)\n _ \u2264 n.minFac := h1.2.2\n _ \u2264 m := Nat.minFac_le_of_dvd hm h2mn\n\n/-- The `norm_num` extension which identifies expressions of the form `minFac n`. -/", "-- Mathlib.Tactic.NormNum.Prime.isNat_prime_0 (L170-L172)\ntheorem isNat_prime_0 : {n : \u2115} \u2192 IsNat n (nat_lit 0) \u2192 \u00ac n.Prime\n | _, \u27e8rfl\u27e9 => not_prime_zero", "-- Mathlib.Tactic.NormNum.Prime.isNat_prime_1 (L173-L175)\ntheorem isNat_prime_1 : {n : \u2115} \u2192 IsNat n (nat_lit 1) \u2192 \u00ac n.Prime\n | _, \u27e8rfl\u27e9 => not_prime_one", "-- Mathlib.Tactic.NormNum.Prime.isNat_prime_2 (L176-L179)\ntheorem isNat_prime_2 : {n n' : \u2115} \u2192\n IsNat n n' \u2192 Nat.ble 2 n' = true \u2192 IsNat (minFac n') n' \u2192 n.Prime\n | _, _, \u27e8rfl\u27e9, h1, \u27e8h2\u27e9 => prime_def_minFac.mpr \u27e8ble_eq.mp h1, h2\u27e9", "-- Mathlib.Tactic.NormNum.Prime.isNat_not_prime (L180-L182)\ntheorem isNat_not_prime {n n' : \u2115} (h : IsNat n n') : \u00acn'.Prime \u2192 \u00acn.Prime := isNat.natElim h\n/-- The `norm_num` extension which identifies expressions of the form `Nat.Prime n`. -/", "-- Mathlib.Tactic.NormNum.Basic.isInt_negOfNat (L101-L106)\ntheorem isInt_negOfNat (m n : \u2115) (h : IsNat m n) : IsInt (Int.negOfNat m) (.negOfNat n) :=\n\u27e8congr_arg Int.negOfNat h.1\u27e9\n\n/-- `norm_num` extension for `Int.negOfNat`.\n\nIt's useful for calling `derive` with the numerator of an `.isNegNNRat` branch. -/", "-- Mathlib.Tactic.NormNum.Basic.isRat_mul (L464-L483)\ntheorem isRat_mul {\u03b1} [Ring \u03b1] {f : \u03b1 \u2192 \u03b1 \u2192 \u03b1} {a b : \u03b1} {na nb nc : \u2124} {da db dc k : \u2115} :\n f = HMul.hMul \u2192 IsRat a na da \u2192 IsRat b nb db \u2192\n Int.mul na nb = Int.mul k nc \u2192\n Nat.mul da db = Nat.mul k dc \u2192\n IsRat (f a b) nc dc := by\nrintro rfl \u27e8_, rfl\u27e9 \u27e8_, rfl\u27e9 (h\u2081 : na * nb = k * nc) (h\u2082 : da * db = k * dc)\n have : Invertible (\u2191(da * db) : \u03b1) := by simpa using invertibleMul (da:\u03b1) db\n have := invertibleOfMul' (\u03b1 := \u03b1) h\u2082\n refine \u27e8this, ?_\u27e9\n have H := (Nat.cast_commute (\u03b1 := \u03b1) da db).invOf_left.invOf_right.right_comm\n have h\u2081 := congr_arg (Int.cast (R := \u03b1)) h\u2081\n simp only [Int.cast_mul, Int.cast_natCast] at h\u2081\n simp only [\u2190 mul_assoc, (Nat.cast_commute (\u03b1 := \u03b1) da nb).invOf_left.right_comm, h\u2081]\n have h\u2082 := congr_arg (\u2191nc * \u2191\u00b7 * (\u215f\u2191da * \u215f\u2191db * \u215f\u2191dc : \u03b1)) h\u2082\n simp only [Nat.cast_mul, \u2190 mul_assoc] at h\u2082; rw [H] at h\u2082\n simp only [mul_invOf_cancel_right'] at h\u2082; rw [h\u2082, Nat.cast_commute]\n simp only [mul_invOf_cancel_right,\n (Nat.cast_commute (\u03b1 := \u03b1) da dc).invOf_left.invOf_right.right_comm,\n (Nat.cast_commute (\u03b1 := \u03b1) db dc).invOf_left.invOf_right.right_comm]", "-- Mathlib.Tactic.NormNum.Abs.isNNRat_abs_nonneg (L36-L44)\ntheorem isNNRat_abs_nonneg {\u03b1 : Type*} [DivisionRing \u03b1] [LinearOrder \u03b1]\n [IsStrictOrderedRing \u03b1] {a : \u03b1} {num den : \u2115} (ra : IsNNRat a num den) :\n IsNNRat |a| num den := by\nobtain \u27e8ha1, rfl\u27e9 := ra\n refine \u27e8ha1, abs_of_nonneg ?_\u27e9\n apply mul_nonneg\n \u00b7 exact Nat.cast_nonneg' num\n \u00b7 simp only [invOf_eq_inv, inv_nonneg, Nat.cast_nonneg]", "-- Mathlib.Tactic.NormNum.Basic.isNat_zero (L56-L59)\ntheorem isNat_zero (\u03b1) [AddMonoidWithOne \u03b1] : IsNat (Zero.zero : \u03b1) (nat_lit 0) :=\n\u27e8Nat.cast_zero.symm\u27e9\n\n/-- The `norm_num` extension which identifies the expression `Zero.zero`, returning `0`. -/", "-- Mathlib.Tactic.NormNum.Basic.inferDivisionSemiring (L563-L566)\ndef inferDivisionSemiring {u : Level} (\u03b1 : Q(Type u)) : MetaM Q(DivisionSemiring $\u03b1) :=\nreturn \u2190 synthInstanceQ q(DivisionSemiring $\u03b1) <|> throwError \"not a division semiring\"\n\n/-- Helper function to synthesize a typed `DivisionRing \u03b1` expression. -/", "-- Mathlib.Tactic.NormNum.Basic.evalNegOfNat (L108-L114)\ndef evalNegOfNat : NormNumExt where eval {u \u03b1Z} e := do\nmatch u, \u03b1Z, e with\n | 0, ~q(\u2124), ~q(Int.negOfNat $a) =>\n let \u27e8n, pn\u27e9 \u2190 deriveNat (u := 0) a q(inferInstance)\n return .isNegNat q(inferInstance) n q(isInt_negOfNat $a $n $pn)\n | _ => failure", "-- Mathlib.Tactic.NormNum.Basic.isNat_intCast (L147-L149)\ntheorem isNat_intCast {R} [Ring R] (n : \u2124) (m : \u2115) :\n IsNat n m \u2192 IsNat (n : R) m := by rintro \u27e8\u27e8\u27e9\u27e9; exact \u27e8by simp\u27e9", "-- Mathlib.Tactic.NormNum.Basic.IsInt (L48-L55)\ntheorem IsInt.raw_refl (n : \u2124) : IsInt n n := \u27e8rfl\u27e9\nmeta section\n\nopen Lean Meta Qq\n\n/-! ### Constructors and constants -/", "-- Mathlib.Tactic.NormNum.Abs.isNat_abs_neg (L30-L35)\ntheorem isNat_abs_neg {\u03b1 : Type*} [Ring \u03b1] [Lattice \u03b1] [IsOrderedRing \u03b1]\n {a : \u03b1} {na : \u2115} (pa : IsInt a (.negOfNat na)) : IsNat |a| na := by\nrw [pa.out]\n constructor\n simp", "-- Mathlib.Tactic.NormNum.Basic.isNat_ofNat (L73-L76)\ntheorem isNat_ofNat (\u03b1 : Type u) [AddMonoidWithOne \u03b1] {a : \u03b1} {n : \u2115}\n (h : n = a) : IsNat a n := \u27e8h.symm\u27e9\n/-- The `norm_num` extension which identifies an expression `OfNat.ofNat n`, returning `n`. -/", "-- Mathlib.Tactic.NormNum.Basic.eq_of_true (L630-L630)\ntheorem eq_of_true {a b : Prop} (ha : a) (hb : b) : a = b := propext (iff_of_true ha hb)", "-- Mathlib.Tactic.NormNum.Basic.isRat_add (L218-L238)\ntheorem isRat_add {\u03b1} [Ring \u03b1] {f : \u03b1 \u2192 \u03b1 \u2192 \u03b1} {a b : \u03b1} {na nb nc : \u2124} {da db dc k : \u2115} :\n f = HAdd.hAdd \u2192 IsRat a na da \u2192 IsRat b nb db \u2192\n Int.add (Int.mul na db) (Int.mul nb da) = Int.mul k nc \u2192\n Nat.mul da db = Nat.mul k dc \u2192\n IsRat (f a b) nc dc := by\nrintro rfl \u27e8_, rfl\u27e9 \u27e8_, rfl\u27e9 (h\u2081 : na * db + nb * da = k * nc) (h\u2082 : da * db = k * dc)\n have : Invertible (\u2191(da * db) : \u03b1) := by simpa using invertibleMul (da:\u03b1) db\n have := invertibleOfMul' (\u03b1 := \u03b1) h\u2082\n use this\n have H := (Nat.cast_commute (\u03b1 := \u03b1) da db).invOf_left.invOf_right.right_comm\n have h\u2081 := congr_arg (\u2191\u00b7 * (\u215f\u2191da * \u215f\u2191db : \u03b1)) h\u2081\n simp only [Int.cast_add, Int.cast_mul, Int.cast_natCast, \u2190 mul_assoc,\n add_mul, mul_invOf_cancel_right] at h\u2081\n have h\u2082 := congr_arg (\u2191nc * \u2191\u00b7 * (\u215f\u2191da * \u215f\u2191db * \u215f\u2191dc : \u03b1)) h\u2082\n simp only [H, mul_invOf_cancel_right', Nat.cast_mul, \u2190 mul_assoc] at h\u2081 h\u2082\n rw [h\u2081, h\u2082, Nat.cast_commute]\n simp only [mul_invOf_cancel_right,\n (Nat.cast_commute (\u03b1 := \u03b1) da dc).invOf_left.invOf_right.right_comm,\n (Nat.cast_commute (\u03b1 := \u03b1) db dc).invOf_left.invOf_right.right_comm]\n\n/-- Consider an `Option` as an object in the `MetaM` monad, by throwing an error on `none`. -/", "-- Mathlib.Tactic.NormNum.Basic.isNat_one (L65-L67)\ntheorem isNat_one (\u03b1) [AddMonoidWithOne \u03b1] : IsNat (One.one : \u03b1) (nat_lit 1) := \u27e8Nat.cast_one.symm\u27e9\n/-- The `norm_num` extension which identifies the expression `One.one`, returning `1`. -/", "-- Mathlib.Tactic.NormNum.Basic.isNNRat_mul (L444-L463)\ntheorem isNNRat_mul {\u03b1} [Semiring \u03b1] {f : \u03b1 \u2192 \u03b1 \u2192 \u03b1} {a b : \u03b1} {na nb nc : \u2115} {da db dc k : \u2115} :\n f = HMul.hMul \u2192 IsNNRat a na da \u2192 IsNNRat b nb db \u2192\n Nat.mul na nb = Nat.mul k nc \u2192\n Nat.mul da db = Nat.mul k dc \u2192\n IsNNRat (f a b) nc dc := by\nrintro rfl \u27e8_, rfl\u27e9 \u27e8_, rfl\u27e9 (h\u2081 : na * nb = k * nc) (h\u2082 : da * db = k * dc)\n have : Invertible (\u2191(da * db) : \u03b1) := by simpa using invertibleMul (da:\u03b1) db\n have := invertibleOfMul' (\u03b1 := \u03b1) h\u2082\n refine \u27e8this, ?_\u27e9\n have H := (Nat.cast_commute (\u03b1 := \u03b1) da db).invOf_left.invOf_right.right_comm\n have h\u2081 := congr_arg (Nat.cast (R := \u03b1)) h\u2081\n simp only [Nat.cast_mul] at h\u2081\n simp only [\u2190 mul_assoc, (Nat.cast_commute (\u03b1 := \u03b1) da nb).invOf_left.right_comm, h\u2081]\n have h\u2082 := congr_arg (\u2191nc * \u2191\u00b7 * (\u215f\u2191da * \u215f\u2191db * \u215f\u2191dc : \u03b1)) h\u2082\n simp only [Nat.cast_mul, \u2190 mul_assoc] at h\u2082; rw [H] at h\u2082\n simp only [mul_invOf_cancel_right'] at h\u2082; rw [h\u2082, Nat.cast_commute]\n simp only [mul_invOf_cancel_right',\n (Nat.cast_commute (\u03b1 := \u03b1) da dc).invOf_left.invOf_right.right_comm,\n (Nat.cast_commute (\u03b1 := \u03b1) db dc).invOf_left.invOf_right.right_comm]", "-- Mathlib.Tactic.NormNum.Basic.isNNRat_add (L196-L217)\ntheorem isNNRat_add {\u03b1} [Semiring \u03b1] {f : \u03b1 \u2192 \u03b1 \u2192 \u03b1} {a b : \u03b1} {na nb nc : \u2115} {da db dc k : \u2115} :\n f = HAdd.hAdd \u2192 IsNNRat a na da \u2192 IsNNRat b nb db \u2192\n Nat.add (Nat.mul na db) (Nat.mul nb da) = Nat.mul k nc \u2192\n Nat.mul da db = Nat.mul k dc \u2192\n IsNNRat (f a b) nc dc := by\nrintro rfl \u27e8_, rfl\u27e9 \u27e8_, rfl\u27e9 (h\u2081 : na * db + nb * da = k * nc) (h\u2082 : da * db = k * dc)\n have : Invertible (\u2191(da * db) : \u03b1) := by simpa using invertibleMul (da:\u03b1) db\n have := invertibleOfMul' (\u03b1 := \u03b1) h\u2082\n use this\n have H := (Nat.cast_commute (\u03b1 := \u03b1) da db).invOf_left.invOf_right.right_comm\n have h\u2081 := congr_arg (\u2191\u00b7 * (\u215f\u2191da * \u215f\u2191db : \u03b1)) h\u2081\n simp only [Nat.cast_add, Nat.cast_mul, \u2190 mul_assoc,\n add_mul, mul_invOf_cancel_right] at h\u2081\n have h\u2082 := congr_arg (\u2191nc * \u2191\u00b7 * (\u215f\u2191da * \u215f\u2191db * \u215f\u2191dc : \u03b1)) h\u2082\n simp only [H, mul_invOf_cancel_right', Nat.cast_mul, \u2190 mul_assoc] at h\u2081 h\u2082\n rw [h\u2081, h\u2082, Nat.cast_commute]\n simp only [mul_invOf_cancel_right,\n (Nat.cast_commute (\u03b1 := \u03b1) da dc).invOf_left.invOf_right.right_comm,\n (Nat.cast_commute (\u03b1 := \u03b1) db dc).invOf_left.invOf_right.right_comm]\n\n-- TODO: clean up and move it somewhere in mathlib? It's a bit much for this file\n-- see note [norm_num lemma function equality]", "-- Mathlib.Tactic.NormNum.Basic.ne_of_false_of_true (L631-L631)\ntheorem ne_of_false_of_true {a b : Prop} (ha : \u00aca) (hb : b) : a \u2260 b := mt (\u00b7 \u25b8 hb) ha", "-- Mathlib.Tactic.NormNum.Basic.isRat_sub (L377-L385)\ntheorem isRat_sub {\u03b1} [Ring \u03b1] {f : \u03b1 \u2192 \u03b1 \u2192 \u03b1} {a b : \u03b1} {na nb nc : \u2124} {da db dc k : \u2115}\n (hf : f = HSub.hSub) (ra : IsRat a na da) (rb : IsRat b nb db)\n (h\u2081 : Int.sub (Int.mul na db) (Int.mul nb da) = Int.mul k nc)\n (h\u2082 : Nat.mul da db = Nat.mul k dc) :\n IsRat (f a b) nc dc := by\nrw [hf, sub_eq_add_neg]\n refine isRat_add rfl ra (isRat_neg (n' := -nb) rfl rb rfl) (k := k) (nc := nc) ?_ h\u2082\n rw [show Int.mul (-nb) _ = _ from neg_mul ..]; exact h\u2081", "-- Mathlib.Tactic.NormNum.Abs.isNNRat_abs_neg (L45-L55)\ntheorem isNNRat_abs_neg {\u03b1 : Type*} [DivisionRing \u03b1] [LinearOrder \u03b1] [IsStrictOrderedRing \u03b1]\n {a : \u03b1} {num den : \u2115} (ra : IsRat a (.negOfNat num) den) : IsNNRat |a| num den := by\nobtain \u27e8ha1, rfl\u27e9 := ra\n simp only [Int.cast_negOfNat, neg_mul, abs_neg]\n refine \u27e8ha1, abs_of_nonneg ?_\u27e9\n apply mul_nonneg\n \u00b7 exact Nat.cast_nonneg' num\n \u00b7 simp only [invOf_eq_inv, inv_nonneg, Nat.cast_nonneg]\n\n/-- The `norm_num` extension which identifies expressions of the form `|a|`,\nsuch that `norm_num` successfully recognises `a`. -/", "-- Mathlib.Tactic.NormNum.Basic.isNat_natCast (L135-L138)\ntheorem isNat_natCast {R} [AddMonoidWithOne R] (n m : \u2115) :\n IsNat n m \u2192 IsNat (n : R) m := by rintro \u27e8\u27e8\u27e9\u27e9; exact \u27e8rfl\u27e9\n/-- The `norm_num` extension which identifies an expression `Nat.cast n`, returning `n`. -/", "-- Mathlib.Tactic.NormNum.Basic.inferDivisionRing (L567-L569)\ndef inferDivisionRing {u : Level} (\u03b1 : Q(Type u)) : MetaM Q(DivisionRing $\u03b1) :=\nreturn \u2190 synthInstanceQ q(DivisionRing $\u03b1) <|> throwError \"not a division ring\"", "-- Mathlib.Tactic.NormNum.Abs.isNat_abs_nonneg (L24-L29)\ntheorem isNat_abs_nonneg {\u03b1 : Type*} [Ring \u03b1] [Lattice \u03b1] [IsOrderedRing \u03b1]\n {a : \u03b1} {na : \u2115} (pa : IsNat a na) : IsNat |a| na := by\nrw [pa.out, Nat.abs_cast]\n constructor\n rfl", "-- Mathlib.Tactic.NormNum.Basic.Result (L247-L304)\ndef Result.add {u : Level} {\u03b1 : Q(Type u)} {a b : Q($\u03b1)} (ra : Result q($a)) (rb : Result q($b))\n (inst : Q(Add $\u03b1) := by exact q(delta% inferInstance)) :\nMetaM (Result q($a + $b)) := do\n let rec intArm (r\u03b1 : Q(Ring $\u03b1)) := do\n assumeInstancesCommute\n let \u27e8za, na, pa\u27e9 \u2190 ra.toInt _; let \u27e8zb, nb, pb\u27e9 \u2190 rb.toInt _\n let zc := za + zb\n have c := mkRawIntLit zc\n haveI' : Int.add $na $nb =Q $c := \u27e8\u27e9\n return .isInt r\u03b1 c zc q(isInt_add (.refl _) $pa $pb (.refl $c))\n let rec nnratArm (ds\u03b1 : Q(DivisionSemiring $\u03b1)) : MetaM (Result _) := do\n assumeInstancesCommute\n let \u27e8qa, na, da, pa\u27e9 \u2190 ra.toNNRat' ds\u03b1; let \u27e8qb, nb, db, pb\u27e9 \u2190 rb.toNNRat' ds\u03b1\n let qc := qa + qb\n let dd := qa.den * qb.den\n let k := dd / qc.den\n have t1 : Q(\u2115) := mkRawNatLit (k * qc.num.toNat)\n have t2 : Q(\u2115) := mkRawNatLit dd\n have nc : Q(\u2115) := mkRawNatLit qc.num.toNat\n have dc : Q(\u2115) := mkRawNatLit qc.den\n have k : Q(\u2115) := mkRawNatLit k\n let r1 : Q(Nat.add (Nat.mul $na $db) (Nat.mul $nb $da) = Nat.mul $k $nc) :=\n (q(Eq.refl $t1) : Expr)\n let r2 : Q(Nat.mul $da $db = Nat.mul $k $dc) := (q(Eq.refl $t2) : Expr)\n return .isNNRat' ds\u03b1 qc nc dc q(isNNRat_add (.refl _) $pa $pb $r1 $r2)\n let rec ratArm (d\u03b1 : Q(DivisionRing $\u03b1)) : MetaM (Result _) := do\n assumeInstancesCommute\n let \u27e8qa, na, da, pa\u27e9 \u2190 ra.toRat' d\u03b1; let \u27e8qb, nb, db, pb\u27e9 \u2190 rb.toRat' d\u03b1\n let qc := qa + qb\n let dd := qa.den * qb.den\n let k := dd / qc.den\n have t1 : Q(\u2124) := mkRawIntLit (k * qc.num)\n have t2 : Q(\u2115) := mkRawNatLit dd\n have nc : Q(\u2124) := mkRawIntLit qc.num\n have dc : Q(\u2115) := mkRawNatLit qc.den\n have k : Q(\u2115) := mkRawNatLit k\n let r1 : Q(Int.add (Int.mul $na $db) (Int.mul $nb $da) = Int.mul $k $nc) :=\n (q(Eq.refl $t1) : Expr)\n let r2 : Q(Nat.mul $da $db = Nat.mul $k $dc) := (q(Eq.refl $t2) : Expr)\n return .isRat d\u03b1 qc nc dc q(isRat_add (.refl _) $pa $pb $r1 $r2)\n match ra, rb with\n | .isBool .., _ | _, .isBool .. => failure\n | .isNegNNRat d\u03b1 .., _ | _, .isNegNNRat d\u03b1 .. => ratArm d\u03b1\n -- mixing positive rationals and negative naturals means we need to use the full rat handler\n | .isNNRat _ds\u03b1 .., .isNegNat _r\u03b1 .. | .isNegNat _r\u03b1 .., .isNNRat _ds\u03b1 .. =>\n -- could alternatively try to combine `r\u03b1` and `ds\u03b1` here, but we'd have to do a defeq check\n -- so would still need to be in `MetaM`.\n let d\u03b1 \u2190 synthInstanceQ q(DivisionRing $\u03b1)\n assumeInstancesCommute\n ratArm q($d\u03b1)\n | .isNNRat ds\u03b1 .., _ | _, .isNNRat ds\u03b1 .. => nnratArm ds\u03b1\n | .isNegNat r\u03b1 .., _ | _, .isNegNat r\u03b1 .. => intArm r\u03b1\n | .isNat _ na pa, .isNat s\u03b1 nb pb =>\n assumeInstancesCommute\n have c : Q(\u2115) := mkRawNatLit (na.natLit! + nb.natLit!)\n haveI' : Nat.add $na $nb =Q $c := \u27e8\u27e9\n return .isNat s\u03b1 c q(isNat_add (.refl _) $pa $pb (.refl $c))", "-- Mathlib.Tactic.NormNum.Basic.ble_eq_false (L616-L618)\ntheorem ble_eq_false {x y : \u2115} : x.ble y = false \u2194 y < x := by\nrw [\u2190 Nat.not_le, \u2190 Bool.not_eq_true, Nat.ble_eq]", "-- Mathlib.Tactic.NormNum.Basic.invertibleOfMul' (L45-L47)\ndef invertibleOfMul' {\u03b1} [Semiring \u03b1] {a k b : \u2115} [Invertible (a : \u03b1)]\n (h : a = k * b) : Invertible (b : \u03b1) := invertibleOfMul k (b:\u03b1) \u2191a (by simp [h])", "-- Mathlib.Tactic.NormNum.Basic.isintCast (L150-L153)\ntheorem isintCast {R} [Ring R] (n m : \u2124) :\n IsInt n m \u2192 IsInt (n : R) m := by rintro \u27e8\u27e8\u27e9\u27e9; exact \u27e8rfl\u27e9\n/-- The `norm_num` extension which identifies an expression `Int.cast n`, returning `n`. -/"], "source_grounded_context_enriched": false, "statement": "theorem isNat_minFac_2 : {a a' : \u2115} \u2192 IsNat a a' \u2192 a' % 2 = 0 \u2192 IsNat a.minFac 2\n | a, _, \u27e8rfl\u27e9, h => \u27e8by rw [cast_ofNat, minFac_eq_two_iff, Nat.dvd_iff_mod_eq_zero, h]\u27e9", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 19645, "declarations_count": 2347, "diagnostics_count": 1, "duplicate_fingerprint": "666650f63f945db6", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 8257, "lean_code_chars": 18148, "lean_code_ratio": 0.9238, "length_bucket": "long", "line_count": 517, "natural_language_chars": 1497, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 40, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.NormNum.Prime).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem isNat_minFac_2 : {a a' : \u2115} \u2192 IsNat a a' \u2192 a' % 2 = 0 \u2192 IsNat a.minFac 2\n | a, _, \u27e8rfl\u27e9, h => \u27e8by rw [cast_ofNat, minFac_eq_two_iff, Nat.dvd_iff_mod_eq_zero, h]\u27e9\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Tactic.NormNum.Prime.not_prime_mul_of_ble (L37-L42)\ntheorem not_prime_mul_of_ble (a b n : \u2115) (h : a * b = n) (h\u2081 : a.ble 1 = false)\n (h\u2082 : b.ble 1 = false) : \u00ac n.Prime :=\nnot_prime_of_mul_eq h (ble_eq_false.mp h\u2081).ne' (ble_eq_false.mp h\u2082).ne'\n\n/-- Produce a proof that `n` is not prime from a factor `1 < d < n`. `en` should be the expression\n that is the natural number literal `n`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Tactic.NormNum.Prime.deriveNotPrime (L43-L50)\ndef deriveNotPrime (n d : \u2115) (en : Q(\u2115)) : Q(\u00ac Nat.Prime $en) := Id.run do\nlet d' : \u2115 := n / d\n let prf : Q($d * $d' = $en) := (q(Eq.refl $en) : Expr)\n let r : Q(Nat.ble $d 1 = false) := (q(Eq.refl false) : Expr)\n let r' : Q(Nat.ble $d' 1 = false) := (q(Eq.refl false) : Expr)\n return q(not_prime_mul_of_ble _ _ _ $prf $r $r')\n\n/-- A predicate representing partial progress in a proof of `minFac`. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Tactic.NormNum.Prime.MinFacHelper (L51-L53)\ndef MinFacHelper (n k : \u2115) : Prop :=\n2 < k \u2227 k % 2 = 1 \u2227 k \u2264 minFac n\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Tactic.NormNum.Prime.MinFacHelper (L54-L61)\ntheorem MinFacHelper.one_lt {n k : \u2115} (h : MinFacHelper n k) : 1 < n := by\nhave : 2 < minFac n := h.1.trans_le h.2.2\n obtain rfl | h := n.eq_zero_or_pos\n \u00b7 contradiction\n rcases (succ_le_of_lt h).eq_or_lt with rfl | h\n \u00b7 simp_all\n exact h\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Tactic.NormNum.Prime.minFacHelper_0 (L62-L70)\ntheorem minFacHelper_0 (n : \u2115)\n (h1 : Nat.ble (nat_lit 2) n = true) (h2 : nat_lit 1 = n % (nat_lit 2)) :\n MinFacHelper n (nat_lit 3) := by\nrefine \u27e8by simp, by simp, ?_\u27e9\n refine (le_minFac'.mpr fun p hp hpn \u21a6 ?_).resolve_left (Nat.ne_of_gt (Nat.le_of_ble_eq_true h1))\n rcases hp.eq_or_lt with rfl | h\n \u00b7 simp [(Nat.dvd_iff_mod_eq_zero ..).1 hpn] at h2\n \u00b7 exact h\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Tactic.NormNum.Prime.minFacHelper_1 (L71-L87)\ntheorem minFacHelper_1 {n k k' : \u2115} (e : k + 2 = k') (h : MinFacHelper n k)\n (np : minFac n \u2260 k) : MinFacHelper n k' := by\nrw [\u2190 e]\n refine \u27e8Nat.lt_add_right _ h.1, ?_, ?_\u27e9\n \u00b7 rw [add_mod, mod_self, add_zero, mod_mod]\n exact h.2.1\n rcases h.2.2.eq_or_lt with rfl | h2\n \u00b7 exact (np rfl).elim\n rcases (succ_le_of_lt h2).eq_or_lt with h2|h2\n \u00b7 refine ((h.1.trans_le h.2.2).ne ?_).elim\n have h3 : 2 \u2223 minFac n := by\n rw [Nat.dvd_iff_mod_eq_zero, \u2190 h2, succ_eq_add_one, add_mod, h.2.1]\n rw [dvd_prime <| minFac_prime h.one_lt.ne'] at h3\n norm_num at h3\n exact h3\n exact h2\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Tactic.NormNum.Prime.minFacHelper_2 (L88-L93)\ntheorem minFacHelper_2 {n k k' : \u2115} (e : k + 2 = k') (nk : \u00ac Nat.Prime k)\n (h : MinFacHelper n k) : MinFacHelper n k' := by\nrefine minFacHelper_1 e h fun h2 \u21a6 ?_\n rw [\u2190 h2] at nk\n exact nk <| minFac_prime h.one_lt.ne'\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Tactic.NormNum.Prime.minFacHelper_3 (L94-L100)\ntheorem minFacHelper_3 {n k k' : \u2115} (e : k + 2 = k') (nk : (n % k).beq 0 = false)\n (h : MinFacHelper n k) : MinFacHelper n k' := by\nrefine minFacHelper_1 e h fun h2 \u21a6 ?_\n have nk := Nat.ne_of_beq_eq_false nk\n rw [\u2190 Nat.dvd_iff_mod_eq_zero, \u2190 h2] at nk\n exact nk <| minFac_dvd n\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Tactic.NormNum.Prime.isNat_minFac_1 (L101-L103)\ntheorem isNat_minFac_1 : {a : \u2115} \u2192 IsNat a (nat_lit 1) \u2192 IsNat a.minFac 1\n | _, \u27e8rfl\u27e9 => \u27e8minFac_one\u27e9\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Tactic.NormNum.Prime.isNat_minFac_3 (L107-L112)\ntheorem isNat_minFac_3 : {n n' : \u2115} \u2192 (k : \u2115) \u2192\n IsNat n n' \u2192 MinFacHelper n' k \u2192 nat_lit 0 = n' % k \u2192 IsNat (minFac n) k\n | n, _, k, \u27e8rfl\u27e9, h1, h2 => by\n rw [eq_comm, \u2190 Nat.dvd_iff_mod_eq_zero] at h2\n exact \u27e8le_antisymm (minFac_le_of_dvd h1.1.le h2) h1.2.2\u27e9\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Tactic.NormNum.Prime.isNat_minFac_4 (L113-L125)\ntheorem isNat_minFac_4 : {n n' k : \u2115} \u2192\n IsNat n n' \u2192 MinFacHelper n' k \u2192 (k * k).ble n' = false \u2192 IsNat (minFac n) n'\n | n, _, k, \u27e8rfl\u27e9, h1, h2 => by\n refine \u27e8(Nat.prime_def_minFac.mp ?_).2\u27e9\n rw [Nat.prime_def_le_sqrt]\n refine \u27e8h1.one_lt, fun m hm hmn h2mn \u21a6 ?_\u27e9\n exact lt_irrefl m <| calc\n m \u2264 sqrt n := hmn\n_ < k := sqrt_lt.mpr (ble_eq_false.mp h2)\n _ \u2264 n.minFac := h1.2.2\n _ \u2264 m := Nat.minFac_le_of_dvd hm h2mn\n\n/-- The `norm_num` extension which identifies expressions of the form `minFac n`. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Tactic.NormNum.Prime.isNat_prime_0 (L170-L172)\ntheorem isNat_prime_0 : {n : \u2115} \u2192 IsNat n (nat_lit 0) \u2192 \u00ac n.Prime\n | _, \u27e8rfl\u27e9 => not_prime_zero\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Tactic.NormNum.Prime.isNat_prime_1 (L173-L175)\ntheorem isNat_prime_1 : {n : \u2115} \u2192 IsNat n (nat_lit 1) \u2192 \u00ac n.Prime\n | _, \u27e8rfl\u27e9 => not_prime_one\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Tactic.NormNum.Prime.isNat_prime_2 (L176-L179)\ntheorem isNat_prime_2 : {n n' : \u2115} \u2192\n IsNat n n' \u2192 Nat.ble 2 n' = true \u2192 IsNat (minFac n') n' \u2192 n.Prime\n | _, _, \u27e8rfl\u27e9, h1, \u27e8h2\u27e9 => prime_def_minFac.mpr \u27e8ble_eq.mp h1, h2\u27e9\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Tactic.NormNum.Prime.isNat_not_prime (L180-L182)\ntheorem isNat_not_prime {n n' : \u2115} (h : IsNat n n') : \u00acn'.Prime \u2192 \u00acn.Prime := isNat.natElim h\n/-- The `norm_num` extension which identifies expressions of the form `Nat.Prime n`. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Tactic.NormNum.Basic.isInt_negOfNat (L101-L106)\ntheorem isInt_negOfNat (m n : \u2115) (h : IsNat m n) : IsInt (Int.negOfNat m) (.negOfNat n) :=\n\u27e8congr_arg Int.negOfNat h.1\u27e9\n\n/-- `norm_num` extension for `Int.negOfNat`.\n\nIt's useful for calling `derive` with the numerator of an `.isNegNNRat` branch. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Tactic.NormNum.Basic.isRat_mul (L464-L483)\ntheorem isRat_mul {\u03b1} [Ring \u03b1] {f : \u03b1 \u2192 \u03b1 \u2192 \u03b1} {a b : \u03b1} {na nb nc : \u2124} {da db dc k : \u2115} :\n f = HMul.hMul \u2192 IsRat a na da \u2192 IsRat b nb db \u2192\n Int.mul na nb = Int.mul k nc \u2192\n Nat.mul da db = Nat.mul k dc \u2192\n IsRat (f a b) nc dc := by\nrintro rfl \u27e8_, rfl\u27e9 \u27e8_, rfl\u27e9 (h\u2081 : na * nb = k * nc) (h\u2082 : da * db = k * dc)\n have : Invertible (\u2191(da * db) : \u03b1) := by simpa using invertibleMul (da:\u03b1) db\n have := invertibleOfMul' (\u03b1 := \u03b1) h\u2082\n refine \u27e8this, ?_\u27e9\n have H := (Nat.cast_commute (\u03b1 := \u03b1) da db).invOf_left.invOf_right.right_comm\n have h\u2081 := congr_arg (Int.cast (R := \u03b1)) h\u2081\n simp only [Int.cast_mul, Int.cast_natCast] at h\u2081\n simp only [\u2190 mul_assoc, (Nat.cast_commute (\u03b1 := \u03b1) da nb).invOf_left.right_comm, h\u2081]\n have h\u2082 := congr_arg (\u2191nc * \u2191\u00b7 * (\u215f\u2191da * \u215f\u2191db * \u215f\u2191dc : \u03b1)) h\u2082\n simp only [Nat.cast_mul, \u2190 mul_assoc] at h\u2082; rw [H] at h\u2082\n simp only [mul_invOf_cancel_right'] at h\u2082; rw [h\u2082, Nat.cast_commute]\n simp only [mul_invOf_cancel_right,\n (Nat.cast_commute (\u03b1 := \u03b1) da dc).invOf_left.invOf_right.right_comm,\n (Nat.cast_commute (\u03b1 := \u03b1) db dc).invOf_left.invOf_right.right_comm]\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Tactic.NormNum.Abs.isNNRat_abs_nonneg (L36-L44)\ntheorem isNNRat_abs_nonneg {\u03b1 : Type*} [DivisionRing \u03b1] [LinearOrder \u03b1]\n [IsStrictOrderedRing \u03b1] {a : \u03b1} {num den : \u2115} (ra : IsNNRat a num den) :\n IsNNRat |a| num den := by\nobtain \u27e8ha1, rfl\u27e9 := ra\n refine \u27e8ha1, abs_of_nonneg ?_\u27e9\n apply mul_nonneg\n \u00b7 exact Nat.cast_nonneg' num\n \u00b7 simp only [invOf_eq_inv, inv_nonneg, Nat.cast_nonneg]\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Tactic.NormNum.Basic.isNat_zero (L56-L59)\ntheorem isNat_zero (\u03b1) [AddMonoidWithOne \u03b1] : IsNat (Zero.zero : \u03b1) (nat_lit 0) :=\n\u27e8Nat.cast_zero.symm\u27e9\n\n/-- The `norm_num` extension which identifies the expression `Zero.zero`, returning `0`. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Tactic.NormNum.Basic.inferDivisionSemiring (L563-L566)\ndef inferDivisionSemiring {u : Level} (\u03b1 : Q(Type u)) : MetaM Q(DivisionSemiring $\u03b1) :=\nreturn \u2190 synthInstanceQ q(DivisionSemiring $\u03b1) <|> throwError \"not a division semiring\"\n\n/-- Helper function to synthesize a typed `DivisionRing \u03b1` expression. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Tactic.NormNum.Basic.evalNegOfNat (L108-L114)\ndef evalNegOfNat : NormNumExt where eval {u \u03b1Z} e := do\nmatch u, \u03b1Z, e with\n | 0, ~q(\u2124), ~q(Int.negOfNat $a) =>\n let \u27e8n, pn\u27e9 \u2190 deriveNat (u := 0) a q(inferInstance)\n return .isNegNat q(inferInstance) n q(isInt_negOfNat $a $n $pn)\n | _ => failure\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Tactic.NormNum.Basic.isNat_intCast (L147-L149)\ntheorem isNat_intCast {R} [Ring R] (n : \u2124) (m : \u2115) :\n IsNat n m \u2192 IsNat (n : R) m := by rintro \u27e8\u27e8\u27e9\u27e9; exact \u27e8by simp\u27e9\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Tactic.NormNum.Basic.IsInt (L48-L55)\ntheorem IsInt.raw_refl (n : \u2124) : IsInt n n := \u27e8rfl\u27e9\nmeta section\n\nopen Lean Meta Qq\n\n/-! ### Constructors and constants -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Tactic.NormNum.Abs.isNat_abs_neg (L30-L35)\ntheorem isNat_abs_neg {\u03b1 : Type*} [Ring \u03b1] [Lattice \u03b1] [IsOrderedRing \u03b1]\n {a : \u03b1} {na : \u2115} (pa : IsInt a (.negOfNat na)) : IsNat |a| na := by\nrw [pa.out]\n constructor\n simp\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Tactic.NormNum.Basic.isNat_ofNat (L73-L76)\ntheorem isNat_ofNat (\u03b1 : Type u) [AddMonoidWithOne \u03b1] {a : \u03b1} {n : \u2115}\n (h : n = a) : IsNat a n := \u27e8h.symm\u27e9\n/-- The `norm_num` extension which identifies an expression `OfNat.ofNat n`, returning `n`. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Tactic.NormNum.Basic.eq_of_true (L630-L630)\ntheorem eq_of_true {a b : Prop} (ha : a) (hb : b) : a = b := propext (iff_of_true ha hb)\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Tactic.NormNum.Basic.isRat_add (L218-L238)\ntheorem isRat_add {\u03b1} [Ring \u03b1] {f : \u03b1 \u2192 \u03b1 \u2192 \u03b1} {a b : \u03b1} {na nb nc : \u2124} {da db dc k : \u2115} :\n f = HAdd.hAdd \u2192 IsRat a na da \u2192 IsRat b nb db \u2192\n Int.add (Int.mul na db) (Int.mul nb da) = Int.mul k nc \u2192\n Nat.mul da db = Nat.mul k dc \u2192\n IsRat (f a b) nc dc := by\nrintro rfl \u27e8_, rfl\u27e9 \u27e8_, rfl\u27e9 (h\u2081 : na * db + nb * da = k * nc) (h\u2082 : da * db = k * dc)\n have : Invertible (\u2191(da * db) : \u03b1) := by simpa using invertibleMul (da:\u03b1) db\n have := invertibleOfMul' (\u03b1 := \u03b1) h\u2082\n use this\n have H := (Nat.cast_commute (\u03b1 := \u03b1) da db).invOf_left.invOf_right.right_comm\n have h\u2081 := congr_arg (\u2191\u00b7 * (\u215f\u2191da * \u215f\u2191db : \u03b1)) h\u2081\n simp only [Int.cast_add, Int.cast_mul, Int.cast_natCast, \u2190 mul_assoc,\n add_mul, mul_invOf_cancel_right] at h\u2081\n have h\u2082 := congr_arg (\u2191nc * \u2191\u00b7 * (\u215f\u2191da * \u215f\u2191db * \u215f\u2191dc : \u03b1)) h\u2082\n simp only [H, mul_invOf_cancel_right', Nat.cast_mul, \u2190 mul_assoc] at h\u2081 h\u2082\n rw [h\u2081, h\u2082, Nat.cast_commute]\n simp only [mul_invOf_cancel_right,\n (Nat.cast_commute (\u03b1 := \u03b1) da dc).invOf_left.invOf_right.right_comm,\n (Nat.cast_commute (\u03b1 := \u03b1) db dc).invOf_left.invOf_right.right_comm]\n\n/-- Consider an `Option` as an object in the `MetaM` monad, by throwing an error on `none`. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Tactic.NormNum.Basic.isNat_one (L65-L67)\ntheorem isNat_one (\u03b1) [AddMonoidWithOne \u03b1] : IsNat (One.one : \u03b1) (nat_lit 1) := \u27e8Nat.cast_one.symm\u27e9\n/-- The `norm_num` extension which identifies the expression `One.one`, returning `1`. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Tactic.NormNum.Basic.isNNRat_mul (L444-L463)\ntheorem isNNRat_mul {\u03b1} [Semiring \u03b1] {f : \u03b1 \u2192 \u03b1 \u2192 \u03b1} {a b : \u03b1} {na nb nc : \u2115} {da db dc k : \u2115} :\n f = HMul.hMul \u2192 IsNNRat a na da \u2192 IsNNRat b nb db \u2192\n Nat.mul na nb = Nat.mul k nc \u2192\n Nat.mul da db = Nat.mul k dc \u2192\n IsNNRat (f a b) nc dc := by\nrintro rfl \u27e8_, rfl\u27e9 \u27e8_, rfl\u27e9 (h\u2081 : na * nb = k * nc) (h\u2082 : da * db = k * dc)\n have : Invertible (\u2191(da * db) : \u03b1) := by simpa using invertibleMul (da:\u03b1) db\n have := invertibleOfMul' (\u03b1 := \u03b1) h\u2082\n refine \u27e8this, ?_\u27e9\n have H := (Nat.cast_commute (\u03b1 := \u03b1) da db).invOf_left.invOf_right.right_comm\n have h\u2081 := congr_arg (Nat.cast (R := \u03b1)) h\u2081\n simp only [Nat.cast_mul] at h\u2081\n simp only [\u2190 mul_assoc, (Nat.cast_commute (\u03b1 := \u03b1) da nb).invOf_left.right_comm, h\u2081]\n have h\u2082 := congr_arg (\u2191nc * \u2191\u00b7 * (\u215f\u2191da * \u215f\u2191db * \u215f\u2191dc : \u03b1)) h\u2082\n simp only [Nat.cast_mul, \u2190 mul_assoc] at h\u2082; rw [H] at h\u2082\n simp only [mul_invOf_cancel_right'] at h\u2082; rw [h\u2082, Nat.cast_commute]\n simp only [mul_invOf_cancel_right',\n (Nat.cast_commute (\u03b1 := \u03b1) da dc).invOf_left.invOf_right.right_comm,\n (Nat.cast_commute (\u03b1 := \u03b1) db dc).invOf_left.invOf_right.right_comm]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Tactic.NormNum.Basic.isNNRat_add (L196-L217)\ntheorem isNNRat_add {\u03b1} [Semiring \u03b1] {f : \u03b1 \u2192 \u03b1 \u2192 \u03b1} {a b : \u03b1} {na nb nc : \u2115} {da db dc k : \u2115} :\n f = HAdd.hAdd \u2192 IsNNRat a na da \u2192 IsNNRat b nb db \u2192\n Nat.add (Nat.mul na db) (Nat.mul nb da) = Nat.mul k nc \u2192\n Nat.mul da db = Nat.mul k dc \u2192\n IsNNRat (f a b) nc dc := by\nrintro rfl \u27e8_, rfl\u27e9 \u27e8_, rfl\u27e9 (h\u2081 : na * db + nb * da = k * nc) (h\u2082 : da * db = k * dc)\n have : Invertible (\u2191(da * db) : \u03b1) := by simpa using invertibleMul (da:\u03b1) db\n have := invertibleOfMul' (\u03b1 := \u03b1) h\u2082\n use this\n have H := (Nat.cast_commute (\u03b1 := \u03b1) da db).invOf_left.invOf_right.right_comm\n have h\u2081 := congr_arg (\u2191\u00b7 * (\u215f\u2191da * \u215f\u2191db : \u03b1)) h\u2081\n simp only [Nat.cast_add, Nat.cast_mul, \u2190 mul_assoc,\n add_mul, mul_invOf_cancel_right] at h\u2081\n have h\u2082 := congr_arg (\u2191nc * \u2191\u00b7 * (\u215f\u2191da * \u215f\u2191db * \u215f\u2191dc : \u03b1)) h\u2082\n simp only [H, mul_invOf_cancel_right', Nat.cast_mul, \u2190 mul_assoc] at h\u2081 h\u2082\n rw [h\u2081, h\u2082, Nat.cast_commute]\n simp only [mul_invOf_cancel_right,\n (Nat.cast_commute (\u03b1 := \u03b1) da dc).invOf_left.invOf_right.right_comm,\n (Nat.cast_commute (\u03b1 := \u03b1) db dc).invOf_left.invOf_right.right_comm]\n\n-- TODO: clean up and move it somewhere in mathlib? It's a bit much for this file\n-- see note [norm_num lemma function equality]\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Tactic.NormNum.Basic.ne_of_false_of_true (L631-L631)\ntheorem ne_of_false_of_true {a b : Prop} (ha : \u00aca) (hb : b) : a \u2260 b := mt (\u00b7 \u25b8 hb) ha\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Tactic.NormNum.Basic.isRat_sub (L377-L385)\ntheorem isRat_sub {\u03b1} [Ring \u03b1] {f : \u03b1 \u2192 \u03b1 \u2192 \u03b1} {a b : \u03b1} {na nb nc : \u2124} {da db dc k : \u2115}\n (hf : f = HSub.hSub) (ra : IsRat a na da) (rb : IsRat b nb db)\n (h\u2081 : Int.sub (Int.mul na db) (Int.mul nb da) = Int.mul k nc)\n (h\u2082 : Nat.mul da db = Nat.mul k dc) :\n IsRat (f a b) nc dc := by\nrw [hf, sub_eq_add_neg]\n refine isRat_add rfl ra (isRat_neg (n' := -nb) rfl rb rfl) (k := k) (nc := nc) ?_ h\u2082\n rw [show Int.mul (-nb) _ = _ from neg_mul ..]; exact h\u2081\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Tactic.NormNum.Abs.isNNRat_abs_neg (L45-L55)\ntheorem isNNRat_abs_neg {\u03b1 : Type*} [DivisionRing \u03b1] [LinearOrder \u03b1] [IsStrictOrderedRing \u03b1]\n {a : \u03b1} {num den : \u2115} (ra : IsRat a (.negOfNat num) den) : IsNNRat |a| num den := by\nobtain \u27e8ha1, rfl\u27e9 := ra\n simp only [Int.cast_negOfNat, neg_mul, abs_neg]\n refine \u27e8ha1, abs_of_nonneg ?_\u27e9\n apply mul_nonneg\n \u00b7 exact Nat.cast_nonneg' num\n \u00b7 simp only [invOf_eq_inv, inv_nonneg, Nat.cast_nonneg]\n\n/-- The `norm_num` extension which identifies expressions of the form `|a|`,\nsuch that `norm_num` successfully recognises `a`. -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Tactic.NormNum.Basic.isNat_natCast (L135-L138)\ntheorem isNat_natCast {R} [AddMonoidWithOne R] (n m : \u2115) :\n IsNat n m \u2192 IsNat (n : R) m := by rintro \u27e8\u27e8\u27e9\u27e9; exact \u27e8rfl\u27e9\n/-- The `norm_num` extension which identifies an expression `Nat.cast n`, returning `n`. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Tactic.NormNum.Basic.inferDivisionRing (L567-L569)\ndef inferDivisionRing {u : Level} (\u03b1 : Q(Type u)) : MetaM Q(DivisionRing $\u03b1) :=\nreturn \u2190 synthInstanceQ q(DivisionRing $\u03b1) <|> throwError \"not a division ring\"\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Tactic.NormNum.Abs.isNat_abs_nonneg (L24-L29)\ntheorem isNat_abs_nonneg {\u03b1 : Type*} [Ring \u03b1] [Lattice \u03b1] [IsOrderedRing \u03b1]\n {a : \u03b1} {na : \u2115} (pa : IsNat a na) : IsNat |a| na := by\nrw [pa.out, Nat.abs_cast]\n constructor\n rfl\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Tactic.NormNum.Basic.Result (L247-L304)\ndef Result.add {u : Level} {\u03b1 : Q(Type u)} {a b : Q($\u03b1)} (ra : Result q($a)) (rb : Result q($b))\n (inst : Q(Add $\u03b1) := by exact q(delta% inferInstance)) :\nMetaM (Result q($a + $b)) := do\n let rec intArm (r\u03b1 : Q(Ring $\u03b1)) := do\n assumeInstancesCommute\n let \u27e8za, na, pa\u27e9 \u2190 ra.toInt _; let \u27e8zb, nb, pb\u27e9 \u2190 rb.toInt _\n let zc := za + zb\n have c := mkRawIntLit zc\n haveI' : Int.add $na $nb =Q $c := \u27e8\u27e9\n return .isInt r\u03b1 c zc q(isInt_add (.refl _) $pa $pb (.refl $c))\n let rec nnratArm (ds\u03b1 : Q(DivisionSemiring $\u03b1)) : MetaM (Result _) := do\n assumeInstancesCommute\n let \u27e8qa, na, da, pa\u27e9 \u2190 ra.toNNRat' ds\u03b1; let \u27e8qb, nb, db, pb\u27e9 \u2190 rb.toNNRat' ds\u03b1\n let qc := qa + qb\n let dd := qa.den * qb.den\n let k := dd / qc.den\n have t1 : Q(\u2115) := mkRawNatLit (k * qc.num.toNat)\n have t2 : Q(\u2115) := mkRawNatLit dd\n have nc : Q(\u2115) := mkRawNatLit qc.num.toNat\n have dc : Q(\u2115) := mkRawNatLit qc.den\n have k : Q(\u2115) := mkRawNatLit k\n let r1 : Q(Nat.add (Nat.mul $na $db) (Nat.mul $nb $da) = Nat.mul $k $nc) :=\n (q(Eq.refl $t1) : Expr)\n let r2 : Q(Nat.mul $da $db = Nat.mul $k $dc) := (q(Eq.refl $t2) : Expr)\n return .isNNRat' ds\u03b1 qc nc dc q(isNNRat_add (.refl _) $pa $pb $r1 $r2)\n let rec ratArm (d\u03b1 : Q(DivisionRing $\u03b1)) : MetaM (Result _) := do\n assumeInstancesCommute\n let \u27e8qa, na, da, pa\u27e9 \u2190 ra.toRat' d\u03b1; let \u27e8qb, nb, db, pb\u27e9 \u2190 rb.toRat' d\u03b1\n let qc := qa + qb\n let dd := qa.den * qb.den\n let k := dd / qc.den\n have t1 : Q(\u2124) := mkRawIntLit (k * qc.num)\n have t2 : Q(\u2115) := mkRawNatLit dd\n have nc : Q(\u2124) := mkRawIntLit qc.num\n have dc : Q(\u2115) := mkRawNatLit qc.den\n have k : Q(\u2115) := mkRawNatLit k\n let r1 : Q(Int.add (Int.mul $na $db) (Int.mul $nb $da) = Int.mul $k $nc) :=\n (q(Eq.refl $t1) : Expr)\n let r2 : Q(Nat.mul $da $db = Nat.mul $k $dc) := (q(Eq.refl $t2) : Expr)\n return .isRat d\u03b1 qc nc dc q(isRat_add (.refl _) $pa $pb $r1 $r2)\n match ra, rb with\n | .isBool .., _ | _, .isBool .. => failure\n | .isNegNNRat d\u03b1 .., _ | _, .isNegNNRat d\u03b1 .. => ratArm d\u03b1\n -- mixing positive rationals and negative naturals means we need to use the full rat handler\n | .isNNRat _ds\u03b1 .., .isNegNat _r\u03b1 .. | .isNegNat _r\u03b1 .., .isNNRat _ds\u03b1 .. =>\n -- could alternatively try to combine `r\u03b1` and `ds\u03b1` here, but we'd have to do a defeq check\n -- so would still need to be in `MetaM`.\n let d\u03b1 \u2190 synthInstanceQ q(DivisionRing $\u03b1)\n assumeInstancesCommute\n ratArm q($d\u03b1)\n | .isNNRat ds\u03b1 .., _ | _, .isNNRat ds\u03b1 .. => nnratArm ds\u03b1\n | .isNegNat r\u03b1 .., _ | _, .isNegNat r\u03b1 .. => intArm r\u03b1\n | .isNat _ na pa, .isNat s\u03b1 nb pb =>\n assumeInstancesCommute\n have c : Q(\u2115) := mkRawNatLit (na.natLit! + nb.natLit!)\n haveI' : Nat.add $na $nb =Q $c := \u27e8\u27e9\n return .isNat s\u03b1 c q(isNat_add (.refl _) $pa $pb (.refl $c))\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Tactic.NormNum.Basic.ble_eq_false (L616-L618)\ntheorem ble_eq_false {x y : \u2115} : x.ble y = false \u2194 y < x := by\nrw [\u2190 Nat.not_le, \u2190 Bool.not_eq_true, Nat.ble_eq]\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Tactic.NormNum.Basic.invertibleOfMul' (L45-L47)\ndef invertibleOfMul' {\u03b1} [Semiring \u03b1] {a k b : \u2115} [Invertible (a : \u03b1)]\n (h : a = k * b) : Invertible (b : \u03b1) := invertibleOfMul k (b:\u03b1) \u2191a (by simp [h])\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Tactic.NormNum.Basic.isintCast (L150-L153)\ntheorem isintCast {R} [Ring R] (n m : \u2124) :\n IsInt n m \u2192 IsInt (n : R) m := by rintro \u27e8\u27e8\u27e9\u27e9; exact \u27e8rfl\u27e9\n/-- The `norm_num` extension which identifies an expression `Int.cast n`, returning `n`. -/\n```\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.NormNum.Prime).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem isNat_minFac_2 : {a a' : \u2115} \u2192 IsNat a a' \u2192 a' % 2 = 0 \u2192 IsNat a.minFac 2\n | a, _, \u27e8rfl\u27e9, h => \u27e8by rw [cast_ofNat, minFac_eq_two_iff, Nat.dvd_iff_mod_eq_zero, h]\u27e9\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Tactic.NormNum.Prime.not_prime_mul_of_ble (L37-L42)\ntheorem not_prime_mul_of_ble (a b n : \u2115) (h : a * b = n) (h\u2081 : a.ble 1 = false)\n (h\u2082 : b.ble 1 = false) : \u00ac n.Prime :=\nnot_prime_of_mul_eq h (ble_eq_false.mp h\u2081).ne' (ble_eq_false.mp h\u2082).ne'\n\n/-- Produce a proof that `n` is not prime from a factor `1 < d < n`. `en` should be the expression\n that is the natural number literal `n`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Tactic.NormNum.Prime.deriveNotPrime (L43-L50)\ndef deriveNotPrime (n d : \u2115) (en : Q(\u2115)) : Q(\u00ac Nat.Prime $en) := Id.run do\nlet d' : \u2115 := n / d\n let prf : Q($d * $d' = $en) := (q(Eq.refl $en) : Expr)\n let r : Q(Nat.ble $d 1 = false) := (q(Eq.refl false) : Expr)\n let r' : Q(Nat.ble $d' 1 = false) := (q(Eq.refl false) : Expr)\n return q(not_prime_mul_of_ble _ _ _ $prf $r $r')\n\n/-- A predicate representing partial progress in a proof of `minFac`. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Tactic.NormNum.Prime.MinFacHelper (L51-L53)\ndef MinFacHelper (n k : \u2115) : Prop :=\n2 < k \u2227 k % 2 = 1 \u2227 k \u2264 minFac n\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Tactic.NormNum.Prime.MinFacHelper (L54-L61)\ntheorem MinFacHelper.one_lt {n k : \u2115} (h : MinFacHelper n k) : 1 < n := by\nhave : 2 < minFac n := h.1.trans_le h.2.2\n obtain rfl | h := n.eq_zero_or_pos\n \u00b7 contradiction\n rcases (succ_le_of_lt h).eq_or_lt with rfl | h\n \u00b7 simp_all\n exact h\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Tactic.NormNum.Prime.minFacHelper_0 (L62-L70)\ntheorem minFacHelper_0 (n : \u2115)\n (h1 : Nat.ble (nat_lit 2) n = true) (h2 : nat_lit 1 = n % (nat_lit 2)) :\n MinFacHelper n (nat_lit 3) := by\nrefine \u27e8by simp, by simp, ?_\u27e9\n refine (le_minFac'.mpr fun p hp hpn \u21a6 ?_).resolve_left (Nat.ne_of_gt (Nat.le_of_ble_eq_true h1))\n rcases hp.eq_or_lt with rfl | h\n \u00b7 simp [(Nat.dvd_iff_mod_eq_zero ..).1 hpn] at h2\n \u00b7 exact h\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Tactic.NormNum.Prime.minFacHelper_1 (L71-L87)\ntheorem minFacHelper_1 {n k k' : \u2115} (e : k + 2 = k') (h : MinFacHelper n k)\n (np : minFac n \u2260 k) : MinFacHelper n k' := by\nrw [\u2190 e]\n refine \u27e8Nat.lt_add_right _ h.1, ?_, ?_\u27e9\n \u00b7 rw [add_mod, mod_self, add_zero, mod_mod]\n exact h.2.1\n rcases h.2.2.eq_or_lt with rfl | h2\n \u00b7 exact (np rfl).elim\n rcases (succ_le_of_lt h2).eq_or_lt with h2|h2\n \u00b7 refine ((h.1.trans_le h.2.2).ne ?_).elim\n have h3 : 2 \u2223 minFac n := by\n rw [Nat.dvd_iff_mod_eq_zero, \u2190 h2, succ_eq_add_one, add_mod, h.2.1]\n rw [dvd_prime <| minFac_prime h.one_lt.ne'] at h3\n norm_num at h3\n exact h3\n exact h2\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Tactic.NormNum.Prime.minFacHelper_2 (L88-L93)\ntheorem minFacHelper_2 {n k k' : \u2115} (e : k + 2 = k') (nk : \u00ac Nat.Prime k)\n (h : MinFacHelper n k) : MinFacHelper n k' := by\nrefine minFacHelper_1 e h fun h2 \u21a6 ?_\n rw [\u2190 h2] at nk\n exact nk <| minFac_prime h.one_lt.ne'\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Tactic.NormNum.Prime.minFacHelper_3 (L94-L100)\ntheorem minFacHelper_3 {n k k' : \u2115} (e : k + 2 = k') (nk : (n % k).beq 0 = false)\n (h : MinFacHelper n k) : MinFacHelper n k' := by\nrefine minFacHelper_1 e h fun h2 \u21a6 ?_\n have nk := Nat.ne_of_beq_eq_false nk\n rw [\u2190 Nat.dvd_iff_mod_eq_zero, \u2190 h2] at nk\n exact nk <| minFac_dvd n\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Tactic.NormNum.Prime.isNat_minFac_1 (L101-L103)\ntheorem isNat_minFac_1 : {a : \u2115} \u2192 IsNat a (nat_lit 1) \u2192 IsNat a.minFac 1\n | _, \u27e8rfl\u27e9 => \u27e8minFac_one\u27e9\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Tactic.NormNum.Prime.isNat_minFac_3 (L107-L112)\ntheorem isNat_minFac_3 : {n n' : \u2115} \u2192 (k : \u2115) \u2192\n IsNat n n' \u2192 MinFacHelper n' k \u2192 nat_lit 0 = n' % k \u2192 IsNat (minFac n) k\n | n, _, k, \u27e8rfl\u27e9, h1, h2 => by\n rw [eq_comm, \u2190 Nat.dvd_iff_mod_eq_zero] at h2\n exact \u27e8le_antisymm (minFac_le_of_dvd h1.1.le h2) h1.2.2\u27e9\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Tactic.NormNum.Prime.isNat_minFac_4 (L113-L125)\ntheorem isNat_minFac_4 : {n n' k : \u2115} \u2192\n IsNat n n' \u2192 MinFacHelper n' k \u2192 (k * k).ble n' = false \u2192 IsNat (minFac n) n'\n | n, _, k, \u27e8rfl\u27e9, h1, h2 => by\n refine \u27e8(Nat.prime_def_minFac.mp ?_).2\u27e9\n rw [Nat.prime_def_le_sqrt]\n refine \u27e8h1.one_lt, fun m hm hmn h2mn \u21a6 ?_\u27e9\n exact lt_irrefl m <| calc\n m \u2264 sqrt n := hmn\n_ < k := sqrt_lt.mpr (ble_eq_false.mp h2)\n _ \u2264 n.minFac := h1.2.2\n _ \u2264 m := Nat.minFac_le_of_dvd hm h2mn\n\n/-- The `norm_num` extension which identifies expressions of the form `minFac n`. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Tactic.NormNum.Prime.isNat_prime_0 (L170-L172)\ntheorem isNat_prime_0 : {n : \u2115} \u2192 IsNat n (nat_lit 0) \u2192 \u00ac n.Prime\n | _, \u27e8rfl\u27e9 => not_prime_zero\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Tactic.NormNum.Prime.isNat_prime_1 (L173-L175)\ntheorem isNat_prime_1 : {n : \u2115} \u2192 IsNat n (nat_lit 1) \u2192 \u00ac n.Prime\n | _, \u27e8rfl\u27e9 => not_prime_one\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Tactic.NormNum.Prime.isNat_prime_2 (L176-L179)\ntheorem isNat_prime_2 : {n n' : \u2115} \u2192\n IsNat n n' \u2192 Nat.ble 2 n' = true \u2192 IsNat (minFac n') n' \u2192 n.Prime\n | _, _, \u27e8rfl\u27e9, h1, \u27e8h2\u27e9 => prime_def_minFac.mpr \u27e8ble_eq.mp h1, h2\u27e9\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Tactic.NormNum.Prime.isNat_not_prime (L180-L182)\ntheorem isNat_not_prime {n n' : \u2115} (h : IsNat n n') : \u00acn'.Prime \u2192 \u00acn.Prime := isNat.natElim h\n/-- The `norm_num` extension which identifies expressions of the form `Nat.Prime n`. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Tactic.NormNum.Basic.isInt_negOfNat (L101-L106)\ntheorem isInt_negOfNat (m n : \u2115) (h : IsNat m n) : IsInt (Int.negOfNat m) (.negOfNat n) :=\n\u27e8congr_arg Int.negOfNat h.1\u27e9\n\n/-- `norm_num` extension for `Int.negOfNat`.\n\nIt's useful for calling `derive` with the numerator of an `.isNegNNRat` branch. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Tactic.NormNum.Basic.isRat_mul (L464-L483)\ntheorem isRat_mul {\u03b1} [Ring \u03b1] {f : \u03b1 \u2192 \u03b1 \u2192 \u03b1} {a b : \u03b1} {na nb nc : \u2124} {da db dc k : \u2115} :\n f = HMul.hMul \u2192 IsRat a na da \u2192 IsRat b nb db \u2192\n Int.mul na nb = Int.mul k nc \u2192\n Nat.mul da db = Nat.mul k dc \u2192\n IsRat (f a b) nc dc := by\nrintro rfl \u27e8_, rfl\u27e9 \u27e8_, rfl\u27e9 (h\u2081 : na * nb = k * nc) (h\u2082 : da * db = k * dc)\n have : Invertible (\u2191(da * db) : \u03b1) := by simpa using invertibleMul (da:\u03b1) db\n have := invertibleOfMul' (\u03b1 := \u03b1) h\u2082\n refine \u27e8this, ?_\u27e9\n have H := (Nat.cast_commute (\u03b1 := \u03b1) da db).invOf_left.invOf_right.right_comm\n have h\u2081 := congr_arg (Int.cast (R := \u03b1)) h\u2081\n simp only [Int.cast_mul, Int.cast_natCast] at h\u2081\n simp only [\u2190 mul_assoc, (Nat.cast_commute (\u03b1 := \u03b1) da nb).invOf_left.right_comm, h\u2081]\n have h\u2082 := congr_arg (\u2191nc * \u2191\u00b7 * (\u215f\u2191da * \u215f\u2191db * \u215f\u2191dc : \u03b1)) h\u2082\n simp only [Nat.cast_mul, \u2190 mul_assoc] at h\u2082; rw [H] at h\u2082\n simp only [mul_invOf_cancel_right'] at h\u2082; rw [h\u2082, Nat.cast_commute]\n simp only [mul_invOf_cancel_right,\n (Nat.cast_commute (\u03b1 := \u03b1) da dc).invOf_left.invOf_right.right_comm,\n (Nat.cast_commute (\u03b1 := \u03b1) db dc).invOf_left.invOf_right.right_comm]\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Tactic.NormNum.Abs.isNNRat_abs_nonneg (L36-L44)\ntheorem isNNRat_abs_nonneg {\u03b1 : Type*} [DivisionRing \u03b1] [LinearOrder \u03b1]\n [IsStrictOrderedRing \u03b1] {a : \u03b1} {num den : \u2115} (ra : IsNNRat a num den) :\n IsNNRat |a| num den := by\nobtain \u27e8ha1, rfl\u27e9 := ra\n refine \u27e8ha1, abs_of_nonneg ?_\u27e9\n apply mul_nonneg\n \u00b7 exact Nat.cast_nonneg' num\n \u00b7 simp only [invOf_eq_inv, inv_nonneg, Nat.cast_nonneg]\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Tactic.NormNum.Basic.isNat_zero (L56-L59)\ntheorem isNat_zero (\u03b1) [AddMonoidWithOne \u03b1] : IsNat (Zero.zero : \u03b1) (nat_lit 0) :=\n\u27e8Nat.cast_zero.symm\u27e9\n\n/-- The `norm_num` extension which identifies the expression `Zero.zero`, returning `0`. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Tactic.NormNum.Basic.inferDivisionSemiring (L563-L566)\ndef inferDivisionSemiring {u : Level} (\u03b1 : Q(Type u)) : MetaM Q(DivisionSemiring $\u03b1) :=\nreturn \u2190 synthInstanceQ q(DivisionSemiring $\u03b1) <|> throwError \"not a division semiring\"\n\n/-- Helper function to synthesize a typed `DivisionRing \u03b1` expression. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Tactic.NormNum.Basic.evalNegOfNat (L108-L114)\ndef evalNegOfNat : NormNumExt where eval {u \u03b1Z} e := do\nmatch u, \u03b1Z, e with\n | 0, ~q(\u2124), ~q(Int.negOfNat $a) =>\n let \u27e8n, pn\u27e9 \u2190 deriveNat (u := 0) a q(inferInstance)\n return .isNegNat q(inferInstance) n q(isInt_negOfNat $a $n $pn)\n | _ => failure\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Tactic.NormNum.Basic.isNat_intCast (L147-L149)\ntheorem isNat_intCast {R} [Ring R] (n : \u2124) (m : \u2115) :\n IsNat n m \u2192 IsNat (n : R) m := by rintro \u27e8\u27e8\u27e9\u27e9; exact \u27e8by simp\u27e9\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Tactic.NormNum.Basic.IsInt (L48-L55)\ntheorem IsInt.raw_refl (n : \u2124) : IsInt n n := \u27e8rfl\u27e9\nmeta section\n\nopen Lean Meta Qq\n\n/-! ### Constructors and constants -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Tactic.NormNum.Abs.isNat_abs_neg (L30-L35)\ntheorem isNat_abs_neg {\u03b1 : Type*} [Ring \u03b1] [Lattice \u03b1] [IsOrderedRing \u03b1]\n {a : \u03b1} {na : \u2115} (pa : IsInt a (.negOfNat na)) : IsNat |a| na := by\nrw [pa.out]\n constructor\n simp\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Tactic.NormNum.Basic.isNat_ofNat (L73-L76)\ntheorem isNat_ofNat (\u03b1 : Type u) [AddMonoidWithOne \u03b1] {a : \u03b1} {n : \u2115}\n (h : n = a) : IsNat a n := \u27e8h.symm\u27e9\n/-- The `norm_num` extension which identifies an expression `OfNat.ofNat n`, returning `n`. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Tactic.NormNum.Basic.eq_of_true (L630-L630)\ntheorem eq_of_true {a b : Prop} (ha : a) (hb : b) : a = b := propext (iff_of_true ha hb)\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Tactic.NormNum.Basic.isRat_add (L218-L238)\ntheorem isRat_add {\u03b1} [Ring \u03b1] {f : \u03b1 \u2192 \u03b1 \u2192 \u03b1} {a b : \u03b1} {na nb nc : \u2124} {da db dc k : \u2115} :\n f = HAdd.hAdd \u2192 IsRat a na da \u2192 IsRat b nb db \u2192\n Int.add (Int.mul na db) (Int.mul nb da) = Int.mul k nc \u2192\n Nat.mul da db = Nat.mul k dc \u2192\n IsRat (f a b) nc dc := by\nrintro rfl \u27e8_, rfl\u27e9 \u27e8_, rfl\u27e9 (h\u2081 : na * db + nb * da = k * nc) (h\u2082 : da * db = k * dc)\n have : Invertible (\u2191(da * db) : \u03b1) := by simpa using invertibleMul (da:\u03b1) db\n have := invertibleOfMul' (\u03b1 := \u03b1) h\u2082\n use this\n have H := (Nat.cast_commute (\u03b1 := \u03b1) da db).invOf_left.invOf_right.right_comm\n have h\u2081 := congr_arg (\u2191\u00b7 * (\u215f\u2191da * \u215f\u2191db : \u03b1)) h\u2081\n simp only [Int.cast_add, Int.cast_mul, Int.cast_natCast, \u2190 mul_assoc,\n add_mul, mul_invOf_cancel_right] at h\u2081\n have h\u2082 := congr_arg (\u2191nc * \u2191\u00b7 * (\u215f\u2191da * \u215f\u2191db * \u215f\u2191dc : \u03b1)) h\u2082\n simp only [H, mul_invOf_cancel_right', Nat.cast_mul, \u2190 mul_assoc] at h\u2081 h\u2082\n rw [h\u2081, h\u2082, Nat.cast_commute]\n simp only [mul_invOf_cancel_right,\n (Nat.cast_commute (\u03b1 := \u03b1) da dc).invOf_left.invOf_right.right_comm,\n (Nat.cast_commute (\u03b1 := \u03b1) db dc).invOf_left.invOf_right.right_comm]\n\n/-- Consider an `Option` as an object in the `MetaM` monad, by throwing an error on `none`. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Tactic.NormNum.Basic.isNat_one (L65-L67)\ntheorem isNat_one (\u03b1) [AddMonoidWithOne \u03b1] : IsNat (One.one : \u03b1) (nat_lit 1) := \u27e8Nat.cast_one.symm\u27e9\n/-- The `norm_num` extension which identifies the expression `One.one`, returning `1`. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Tactic.NormNum.Basic.isNNRat_mul (L444-L463)\ntheorem isNNRat_mul {\u03b1} [Semiring \u03b1] {f : \u03b1 \u2192 \u03b1 \u2192 \u03b1} {a b : \u03b1} {na nb nc : \u2115} {da db dc k : \u2115} :\n f = HMul.hMul \u2192 IsNNRat a na da \u2192 IsNNRat b nb db \u2192\n Nat.mul na nb = Nat.mul k nc \u2192\n Nat.mul da db = Nat.mul k dc \u2192\n IsNNRat (f a b) nc dc := by\nrintro rfl \u27e8_, rfl\u27e9 \u27e8_, rfl\u27e9 (h\u2081 : na * nb = k * nc) (h\u2082 : da * db = k * dc)\n have : Invertible (\u2191(da * db) : \u03b1) := by simpa using invertibleMul (da:\u03b1) db\n have := invertibleOfMul' (\u03b1 := \u03b1) h\u2082\n refine \u27e8this, ?_\u27e9\n have H := (Nat.cast_commute (\u03b1 := \u03b1) da db).invOf_left.invOf_right.right_comm\n have h\u2081 := congr_arg (Nat.cast (R := \u03b1)) h\u2081\n simp only [Nat.cast_mul] at h\u2081\n simp only [\u2190 mul_assoc, (Nat.cast_commute (\u03b1 := \u03b1) da nb).invOf_left.right_comm, h\u2081]\n have h\u2082 := congr_arg (\u2191nc * \u2191\u00b7 * (\u215f\u2191da * \u215f\u2191db * \u215f\u2191dc : \u03b1)) h\u2082\n simp only [Nat.cast_mul, \u2190 mul_assoc] at h\u2082; rw [H] at h\u2082\n simp only [mul_invOf_cancel_right'] at h\u2082; rw [h\u2082, Nat.cast_commute]\n simp only [mul_invOf_cancel_right',\n (Nat.cast_commute (\u03b1 := \u03b1) da dc).invOf_left.invOf_right.right_comm,\n (Nat.cast_commute (\u03b1 := \u03b1) db dc).invOf_left.invOf_right.right_comm]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Tactic.NormNum.Basic.isNNRat_add (L196-L217)\ntheorem isNNRat_add {\u03b1} [Semiring \u03b1] {f : \u03b1 \u2192 \u03b1 \u2192 \u03b1} {a b : \u03b1} {na nb nc : \u2115} {da db dc k : \u2115} :\n f = HAdd.hAdd \u2192 IsNNRat a na da \u2192 IsNNRat b nb db \u2192\n Nat.add (Nat.mul na db) (Nat.mul nb da) = Nat.mul k nc \u2192\n Nat.mul da db = Nat.mul k dc \u2192\n IsNNRat (f a b) nc dc := by\nrintro rfl \u27e8_, rfl\u27e9 \u27e8_, rfl\u27e9 (h\u2081 : na * db + nb * da = k * nc) (h\u2082 : da * db = k * dc)\n have : Invertible (\u2191(da * db) : \u03b1) := by simpa using invertibleMul (da:\u03b1) db\n have := invertibleOfMul' (\u03b1 := \u03b1) h\u2082\n use this\n have H := (Nat.cast_commute (\u03b1 := \u03b1) da db).invOf_left.invOf_right.right_comm\n have h\u2081 := congr_arg (\u2191\u00b7 * (\u215f\u2191da * \u215f\u2191db : \u03b1)) h\u2081\n simp only [Nat.cast_add, Nat.cast_mul, \u2190 mul_assoc,\n add_mul, mul_invOf_cancel_right] at h\u2081\n have h\u2082 := congr_arg (\u2191nc * \u2191\u00b7 * (\u215f\u2191da * \u215f\u2191db * \u215f\u2191dc : \u03b1)) h\u2082\n simp only [H, mul_invOf_cancel_right', Nat.cast_mul, \u2190 mul_assoc] at h\u2081 h\u2082\n rw [h\u2081, h\u2082, Nat.cast_commute]\n simp only [mul_invOf_cancel_right,\n (Nat.cast_commute (\u03b1 := \u03b1) da dc).invOf_left.invOf_right.right_comm,\n (Nat.cast_commute (\u03b1 := \u03b1) db dc).invOf_left.invOf_right.right_comm]\n\n-- TODO: clean up and move it somewhere in mathlib? It's a bit much for this file\n-- see note [norm_num lemma function equality]\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Tactic.NormNum.Basic.ne_of_false_of_true (L631-L631)\ntheorem ne_of_false_of_true {a b : Prop} (ha : \u00aca) (hb : b) : a \u2260 b := mt (\u00b7 \u25b8 hb) ha\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Tactic.NormNum.Basic.isRat_sub (L377-L385)\ntheorem isRat_sub {\u03b1} [Ring \u03b1] {f : \u03b1 \u2192 \u03b1 \u2192 \u03b1} {a b : \u03b1} {na nb nc : \u2124} {da db dc k : \u2115}\n (hf : f = HSub.hSub) (ra : IsRat a na da) (rb : IsRat b nb db)\n (h\u2081 : Int.sub (Int.mul na db) (Int.mul nb da) = Int.mul k nc)\n (h\u2082 : Nat.mul da db = Nat.mul k dc) :\n IsRat (f a b) nc dc := by\nrw [hf, sub_eq_add_neg]\n refine isRat_add rfl ra (isRat_neg (n' := -nb) rfl rb rfl) (k := k) (nc := nc) ?_ h\u2082\n rw [show Int.mul (-nb) _ = _ from neg_mul ..]; exact h\u2081\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Tactic.NormNum.Abs.isNNRat_abs_neg (L45-L55)\ntheorem isNNRat_abs_neg {\u03b1 : Type*} [DivisionRing \u03b1] [LinearOrder \u03b1] [IsStrictOrderedRing \u03b1]\n {a : \u03b1} {num den : \u2115} (ra : IsRat a (.negOfNat num) den) : IsNNRat |a| num den := by\nobtain \u27e8ha1, rfl\u27e9 := ra\n simp only [Int.cast_negOfNat, neg_mul, abs_neg]\n refine \u27e8ha1, abs_of_nonneg ?_\u27e9\n apply mul_nonneg\n \u00b7 exact Nat.cast_nonneg' num\n \u00b7 simp only [invOf_eq_inv, inv_nonneg, Nat.cast_nonneg]\n\n/-- The `norm_num` extension which identifies expressions of the form `|a|`,\nsuch that `norm_num` successfully recognises `a`. -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Tactic.NormNum.Basic.isNat_natCast (L135-L138)\ntheorem isNat_natCast {R} [AddMonoidWithOne R] (n m : \u2115) :\n IsNat n m \u2192 IsNat (n : R) m := by rintro \u27e8\u27e8\u27e9\u27e9; exact \u27e8rfl\u27e9\n/-- The `norm_num` extension which identifies an expression `Nat.cast n`, returning `n`. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Tactic.NormNum.Basic.inferDivisionRing (L567-L569)\ndef inferDivisionRing {u : Level} (\u03b1 : Q(Type u)) : MetaM Q(DivisionRing $\u03b1) :=\nreturn \u2190 synthInstanceQ q(DivisionRing $\u03b1) <|> throwError \"not a division ring\"\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Tactic.NormNum.Abs.isNat_abs_nonneg (L24-L29)\ntheorem isNat_abs_nonneg {\u03b1 : Type*} [Ring \u03b1] [Lattice \u03b1] [IsOrderedRing \u03b1]\n {a : \u03b1} {na : \u2115} (pa : IsNat a na) : IsNat |a| na := by\nrw [pa.out, Nat.abs_cast]\n constructor\n rfl\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Tactic.NormNum.Basic.Result (L247-L304)\ndef Result.add {u : Level} {\u03b1 : Q(Type u)} {a b : Q($\u03b1)} (ra : Result q($a)) (rb : Result q($b))\n (inst : Q(Add $\u03b1) := by exact q(delta% inferInstance)) :\nMetaM (Result q($a + $b)) := do\n let rec intArm (r\u03b1 : Q(Ring $\u03b1)) := do\n assumeInstancesCommute\n let \u27e8za, na, pa\u27e9 \u2190 ra.toInt _; let \u27e8zb, nb, pb\u27e9 \u2190 rb.toInt _\n let zc := za + zb\n have c := mkRawIntLit zc\n haveI' : Int.add $na $nb =Q $c := \u27e8\u27e9\n return .isInt r\u03b1 c zc q(isInt_add (.refl _) $pa $pb (.refl $c))\n let rec nnratArm (ds\u03b1 : Q(DivisionSemiring $\u03b1)) : MetaM (Result _) := do\n assumeInstancesCommute\n let \u27e8qa, na, da, pa\u27e9 \u2190 ra.toNNRat' ds\u03b1; let \u27e8qb, nb, db, pb\u27e9 \u2190 rb.toNNRat' ds\u03b1\n let qc := qa + qb\n let dd := qa.den * qb.den\n let k := dd / qc.den\n have t1 : Q(\u2115) := mkRawNatLit (k * qc.num.toNat)\n have t2 : Q(\u2115) := mkRawNatLit dd\n have nc : Q(\u2115) := mkRawNatLit qc.num.toNat\n have dc : Q(\u2115) := mkRawNatLit qc.den\n have k : Q(\u2115) := mkRawNatLit k\n let r1 : Q(Nat.add (Nat.mul $na $db) (Nat.mul $nb $da) = Nat.mul $k $nc) :=\n (q(Eq.refl $t1) : Expr)\n let r2 : Q(Nat.mul $da $db = Nat.mul $k $dc) := (q(Eq.refl $t2) : Expr)\n return .isNNRat' ds\u03b1 qc nc dc q(isNNRat_add (.refl _) $pa $pb $r1 $r2)\n let rec ratArm (d\u03b1 : Q(DivisionRing $\u03b1)) : MetaM (Result _) := do\n assumeInstancesCommute\n let \u27e8qa, na, da, pa\u27e9 \u2190 ra.toRat' d\u03b1; let \u27e8qb, nb, db, pb\u27e9 \u2190 rb.toRat' d\u03b1\n let qc := qa + qb\n let dd := qa.den * qb.den\n let k := dd / qc.den\n have t1 : Q(\u2124) := mkRawIntLit (k * qc.num)\n have t2 : Q(\u2115) := mkRawNatLit dd\n have nc : Q(\u2124) := mkRawIntLit qc.num\n have dc : Q(\u2115) := mkRawNatLit qc.den\n have k : Q(\u2115) := mkRawNatLit k\n let r1 : Q(Int.add (Int.mul $na $db) (Int.mul $nb $da) = Int.mul $k $nc) :=\n (q(Eq.refl $t1) : Expr)\n let r2 : Q(Nat.mul $da $db = Nat.mul $k $dc) := (q(Eq.refl $t2) : Expr)\n return .isRat d\u03b1 qc nc dc q(isRat_add (.refl _) $pa $pb $r1 $r2)\n match ra, rb with\n | .isBool .., _ | _, .isBool .. => failure\n | .isNegNNRat d\u03b1 .., _ | _, .isNegNNRat d\u03b1 .. => ratArm d\u03b1\n -- mixing positive rationals and negative naturals means we need to use the full rat handler\n | .isNNRat _ds\u03b1 .., .isNegNat _r\u03b1 .. | .isNegNat _r\u03b1 .., .isNNRat _ds\u03b1 .. =>\n -- could alternatively try to combine `r\u03b1` and `ds\u03b1` here, but we'd have to do a defeq check\n -- so would still need to be in `MetaM`.\n let d\u03b1 \u2190 synthInstanceQ q(DivisionRing $\u03b1)\n assumeInstancesCommute\n ratArm q($d\u03b1)\n | .isNNRat ds\u03b1 .., _ | _, .isNNRat ds\u03b1 .. => nnratArm ds\u03b1\n | .isNegNat r\u03b1 .., _ | _, .isNegNat r\u03b1 .. => intArm r\u03b1\n | .isNat _ na pa, .isNat s\u03b1 nb pb =>\n assumeInstancesCommute\n have c : Q(\u2115) := mkRawNatLit (na.natLit! + nb.natLit!)\n haveI' : Nat.add $na $nb =Q $c := \u27e8\u27e9\n return .isNat s\u03b1 c q(isNat_add (.refl _) $pa $pb (.refl $c))\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Tactic.NormNum.Basic.ble_eq_false (L616-L618)\ntheorem ble_eq_false {x y : \u2115} : x.ble y = false \u2194 y < x := by\nrw [\u2190 Nat.not_le, \u2190 Bool.not_eq_true, Nat.ble_eq]\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Tactic.NormNum.Basic.invertibleOfMul' (L45-L47)\ndef invertibleOfMul' {\u03b1} [Semiring \u03b1] {a k b : \u2115} [Invertible (a : \u03b1)]\n (h : a = k * b) : Invertible (b : \u03b1) := invertibleOfMul k (b:\u03b1) \u2191a (by simp [h])\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Tactic.NormNum.Basic.isintCast (L150-L153)\ntheorem isintCast {R} [Ring R] (n m : \u2124) :\n IsInt n m \u2192 IsInt (n : R) m := by rintro \u27e8\u27e8\u27e9\u27e9; exact \u27e8rfl\u27e9\n/-- The `norm_num` extension which identifies an expression `Int.cast n`, returning `n`. -/\n```\n[/INST]", "sample_id": "C-Mathlib.Tactic.NormNum.Prime.isNat_minFac_2", "source": {"declaration": "Mathlib.Tactic.NormNum.Prime.isNat_minFac_2", "file": "Mathlib/Tactic/NormNum/Prime.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.NormNum.Prime", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/NormNum/Prime.lean#L104", "span": "L104-L106"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"context_enriched": true, "excerpt": "```lean\nlemma isEquivalent_deriv_rpow_p_mul_one_add_smoothingFn {p : \u211d} (hp : p \u2260 0) :\n deriv (fun z => z ^ p * (1 + \u03b5 z)) ~[atTop] fun z => p * z ^ (p - 1) := calc deriv (fun z => z ^ p * (1 + \u03b5 z))\n _ =\u1da0[atTop] fun z => p * z ^ (p - 1) * (1 + \u03b5 z) - z ^ (p - 1) / (log z ^ 2) :=\n eventually_deriv_rpow_p_mul_one_add_smoothingFn p\n _ ~[atTop] fun z => p * z ^ (p - 1) := by\n refine IsEquivalent.add_isLittleO ?one ?two\n case one => calc\n (fun z => p * z ^ (p - 1) * (1 + \u03b5 z)) ~[atTop] fun z => p * z ^ (p - 1) * 1 :=\n IsEquivalent.mul IsEquivalent.refl isEquivalent_one_add_smoothingFn_one\n _ = fun z => p * z ^ (p - 1) := by ext; ring\n case two => calc\n (fun z => -(z ^ (p - 1) / (log z ^ 2))) =o[atTop] fun z => z ^ (p - 1) / 1 := by\n simp_rw [isLittleO_neg_left, div_eq_mul_inv]\n refine IsBigO.mul_isLittleO (isBigO_refl _ _)\n (IsLittleO.inv_rev ?_ (by simp))\n rw [isLittleO_const_left]\n refine Or.inr <| Tendsto.comp tendsto_norm_atTop_atTop ?_\n exact Tendsto.comp (g := fun z => z ^ 2)\n (tendsto_pow_atTop (by norm_num)) tendsto_log_atTop\n _ = fun z => z ^ (p - 1) := by ext; simp\n _ =\u0398[atTop] fun z => p * z ^ (p - 1) := IsTheta.const_mul_right hp <| isTheta_refl _ _\n```", "instruction": "Edit `isEquivalent_deriv_rpow_p_mul_one_add_smoothingFn` so it still compiles and the proof is simplified where possible. Return the full updated `isEquivalent_deriv_rpow_p_mul_one_add_smoothingFn` block.", "proof_is_oneliner": false, "source_grounded_context_enriched": true, "target_span": "L139-L161", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 2170, "declarations_count": 217, "diagnostics_count": 0, "duplicate_fingerprint": "2b42bb1a1cfea2c8", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1349, "lean_code_chars": 1326, "lean_code_ratio": 0.6111, "length_bucket": "short", "line_count": 30, "natural_language_chars": 844, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.AkraBazzi.AkraBazzi).", "role": "system"}, {"content": "You are editing a file in `Mathlib/Computability/AkraBazzi/AkraBazzi.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Computability.AkraBazzi.AkraBazzi.isEquivalent_deriv_rpow_p_mul_one_add_smoothingFn`, L139-L161)\n## Imports\n```lean\nimport Mathlib.Analysis.SpecialFunctions.Pow.Deriv\n```\n\nOpen namespaces: Finset, Real, Filter, Asymptotics, scoped, Topology\n\n## Surrounding context in Mathlib/Computability/AkraBazzi/AkraBazzi.lean\n```lean\n-- Mathlib.Computability.AkraBazzi.AkraBazzi.of (L21-L60)\ninstance of the problem of size `n`, into `k` smaller instances, where the `i`-th instance is of\nsize roughly `b_i n`, and calling itself recursively on those smaller instances. `T(n)` then\nrepresents the running time of the algorithm, and `g(n)` represents the running time required to\ndivide the instance and process the answers produced by the recursive calls. Since virtually all\nsuch algorithms produce instances that are only approximately of size `b_i n` (they must round up\nor down, at the very least), we allow the instance sizes to be given by a function `r_i(n)` that\napproximates `b_i n`.\n\nThe Akra-Bazzi theorem gives the asymptotic order of such a recurrence: it states that\n`T(n) \u2208 \u0398(n^p (1 + \u2211_{u=0}^{n-1} g(n) / u^{p+1}))`,\n\n-- Mathlib.Computability.AkraBazzi.AkraBazzi.eventually_deriv_rpow_p_mul_one_sub_smoothingFn (L82-L98)\nlemma eventually_deriv_rpow_p_mul_one_sub_smoothingFn (p : \u211d) :\n deriv (fun z => z ^ p * (1 - \u03b5 z))\n =\u1da0[atTop] fun z => p * z ^ (p - 1) * (1 - \u03b5 z) + z ^ (p - 1) / (log z ^ 2)\n\n-- Mathlib.Computability.AkraBazzi.AkraBazzi.eventually_deriv_rpow_p_mul_one_add_smoothingFn (L99-L115)\nlemma eventually_deriv_rpow_p_mul_one_add_smoothingFn (p : \u211d) :\n deriv (fun z => z ^ p * (1 + \u03b5 z))\n =\u1da0[atTop] fun z => p * z ^ (p - 1) * (1 + \u03b5 z) - z ^ (p - 1) / (log z ^ 2)\n```\n\nRelevant lemmas available in scope: `Tendsto.comp`\n\n```lean\nlemma isEquivalent_deriv_rpow_p_mul_one_add_smoothingFn {p : \u211d} (hp : p \u2260 0) :\n deriv (fun z => z ^ p * (1 + \u03b5 z)) ~[atTop] fun z => p * z ^ (p - 1) := calc deriv (fun z => z ^ p * (1 + \u03b5 z))\n _ =\u1da0[atTop] fun z => p * z ^ (p - 1) * (1 + \u03b5 z) - z ^ (p - 1) / (log z ^ 2) :=\n eventually_deriv_rpow_p_mul_one_add_smoothingFn p\n _ ~[atTop] fun z => p * z ^ (p - 1) := by\n refine IsEquivalent.add_isLittleO ?one ?two\n case one => calc\n (fun z => p * z ^ (p - 1) * (1 + \u03b5 z)) ~[atTop] fun z => p * z ^ (p - 1) * 1 :=\n IsEquivalent.mul IsEquivalent.refl isEquivalent_one_add_smoothingFn_one\n _ = fun z => p * z ^ (p - 1) := by ext; ring\n case two => calc\n (fun z => -(z ^ (p - 1) / (log z ^ 2))) =o[atTop] fun z => z ^ (p - 1) / 1 := by\n simp_rw [isLittleO_neg_left, div_eq_mul_inv]\n refine IsBigO.mul_isLittleO (isBigO_refl _ _)\n (IsLittleO.inv_rev ?_ (by simp))\n rw [isLittleO_const_left]\n refine Or.inr <| Tendsto.comp tendsto_norm_atTop_atTop ?_\n exact Tendsto.comp (g := fun z => z ^ 2)\n (tendsto_pow_atTop (by norm_num)) tendsto_log_atTop\n _ = fun z => z ^ (p - 1) := by ext; simp\n _ =\u0398[atTop] fun z => p * z ^ (p - 1) := IsTheta.const_mul_right hp <| isTheta_refl _ _\n```\n\n## Edit instruction\nEdit `isEquivalent_deriv_rpow_p_mul_one_add_smoothingFn` so it still compiles and the proof is simplified where possible. Return the full updated `isEquivalent_deriv_rpow_p_mul_one_add_smoothingFn` block.\n", "role": "user"}], "rendered_text": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.AkraBazzi.AkraBazzi).\n\nYou are editing a file in `Mathlib/Computability/AkraBazzi/AkraBazzi.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Computability.AkraBazzi.AkraBazzi.isEquivalent_deriv_rpow_p_mul_one_add_smoothingFn`, L139-L161)\n## Imports\n```lean\nimport Mathlib.Analysis.SpecialFunctions.Pow.Deriv\n```\n\nOpen namespaces: Finset, Real, Filter, Asymptotics, scoped, Topology\n\n## Surrounding context in Mathlib/Computability/AkraBazzi/AkraBazzi.lean\n```lean\n-- Mathlib.Computability.AkraBazzi.AkraBazzi.of (L21-L60)\ninstance of the problem of size `n`, into `k` smaller instances, where the `i`-th instance is of\nsize roughly `b_i n`, and calling itself recursively on those smaller instances. `T(n)` then\nrepresents the running time of the algorithm, and `g(n)` represents the running time required to\ndivide the instance and process the answers produced by the recursive calls. Since virtually all\nsuch algorithms produce instances that are only approximately of size `b_i n` (they must round up\nor down, at the very least), we allow the instance sizes to be given by a function `r_i(n)` that\napproximates `b_i n`.\n\nThe Akra-Bazzi theorem gives the asymptotic order of such a recurrence: it states that\n`T(n) \u2208 \u0398(n^p (1 + \u2211_{u=0}^{n-1} g(n) / u^{p+1}))`,\n\n-- Mathlib.Computability.AkraBazzi.AkraBazzi.eventually_deriv_rpow_p_mul_one_sub_smoothingFn (L82-L98)\nlemma eventually_deriv_rpow_p_mul_one_sub_smoothingFn (p : \u211d) :\n deriv (fun z => z ^ p * (1 - \u03b5 z))\n =\u1da0[atTop] fun z => p * z ^ (p - 1) * (1 - \u03b5 z) + z ^ (p - 1) / (log z ^ 2)\n\n-- Mathlib.Computability.AkraBazzi.AkraBazzi.eventually_deriv_rpow_p_mul_one_add_smoothingFn (L99-L115)\nlemma eventually_deriv_rpow_p_mul_one_add_smoothingFn (p : \u211d) :\n deriv (fun z => z ^ p * (1 + \u03b5 z))\n =\u1da0[atTop] fun z => p * z ^ (p - 1) * (1 + \u03b5 z) - z ^ (p - 1) / (log z ^ 2)\n```\n\nRelevant lemmas available in scope: `Tendsto.comp`\n\n```lean\nlemma isEquivalent_deriv_rpow_p_mul_one_add_smoothingFn {p : \u211d} (hp : p \u2260 0) :\n deriv (fun z => z ^ p * (1 + \u03b5 z)) ~[atTop] fun z => p * z ^ (p - 1) := calc deriv (fun z => z ^ p * (1 + \u03b5 z))\n _ =\u1da0[atTop] fun z => p * z ^ (p - 1) * (1 + \u03b5 z) - z ^ (p - 1) / (log z ^ 2) :=\n eventually_deriv_rpow_p_mul_one_add_smoothingFn p\n _ ~[atTop] fun z => p * z ^ (p - 1) := by\n refine IsEquivalent.add_isLittleO ?one ?two\n case one => calc\n (fun z => p * z ^ (p - 1) * (1 + \u03b5 z)) ~[atTop] fun z => p * z ^ (p - 1) * 1 :=\n IsEquivalent.mul IsEquivalent.refl isEquivalent_one_add_smoothingFn_one\n _ = fun z => p * z ^ (p - 1) := by ext; ring\n case two => calc\n (fun z => -(z ^ (p - 1) / (log z ^ 2))) =o[atTop] fun z => z ^ (p - 1) / 1 := by\n simp_rw [isLittleO_neg_left, div_eq_mul_inv]\n refine IsBigO.mul_isLittleO (isBigO_refl _ _)\n (IsLittleO.inv_rev ?_ (by simp))\n rw [isLittleO_const_left]\n refine Or.inr <| Tendsto.comp tendsto_norm_atTop_atTop ?_\n exact Tendsto.comp (g := fun z => z ^ 2)\n (tendsto_pow_atTop (by norm_num)) tendsto_log_atTop\n _ = fun z => z ^ (p - 1) := by ext; simp\n _ =\u0398[atTop] fun z => p * z ^ (p - 1) := IsTheta.const_mul_right hp <| isTheta_refl _ _\n```\n\n## Edit instruction\nEdit `isEquivalent_deriv_rpow_p_mul_one_add_smoothingFn` so it still compiles and the proof is simplified where possible. Return the full updated `isEquivalent_deriv_rpow_p_mul_one_add_smoothingFn` block.\n", "sample_id": "D-Mathlib.Computability.AkraBazzi.AkraBazzi.isEquivalent_deriv_rpow_p_mul_one_add_smoothingFn", "source": {"declaration": "Mathlib.Computability.AkraBazzi.AkraBazzi.isEquivalent_deriv_rpow_p_mul_one_add_smoothingFn", "file": "Mathlib/Computability/AkraBazzi/AkraBazzi.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Computability.AkraBazzi.AkraBazzi", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Computability/AkraBazzi/AkraBazzi.lean#L139", "span": "L139-L161"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"context_enriched": true, "source_grounded_context_enriched": true, "statement": "def Mor\u2082Iso.tgtM {m : Type \u2192 Type} [Monad m] [MonadMor\u2081 m] : Mor\u2082Iso \u2192 m Mor\u2081\n | .structuralAtom \u03b1 => \u03b1.tgtM\n | .comp _ _ _ h .. => return h\n | .whiskerLeft _ f _ h _ => do comp\u2081M f h\n | .whiskerRight _ _ g _ h => do comp\u2081M g h\n | .horizontalComp _ _ g\u2081 _ g\u2082 _ _ => do comp\u2081M g\u2081 g\u2082\n | .inv _ f _ _ => return f\n | .coherenceComp _ _ _ _ i .. => return i\n | .of \u03b7 => return \u03b7.tgt\n\n/-- A monad equipped with the ability to construct `Mor\u2082Iso` terms. -/\nclass MonadMor\u2082Iso (m : Type \u2192 Type) where\n /-- The expression for the associator `\u03b1_ f g h`. -/\n associatorM (f g h : Mor\u2081) : m StructuralAtom\n /-- The expression for the left unitor `\u03bb_ f`. -/\n leftUnitorM (f : Mor\u2081) : m StructuralAtom\n /-- The expression for the right unitor `\u03c1_ f`. -/\n rightUnitorM (f : Mor\u2081) : m StructuralAtom\n /-- The expression for the identity `Iso.refl f`. -/\n id\u2082M (f : Mor\u2081) : m StructuralAtom\n /-- The expression for the coherence isomorphism `\u2297\ud835\udfd9 : f \u27f6 g`. -/\n coherenceHomM (f g : Mor\u2081) (inst : Expr) : m CoherenceHom\n /-- The expression for the composition `\u03b7 \u226a\u226b \u03b8`. -/\n comp\u2082M (\u03b7 \u03b8 : Mor\u2082Iso) : m Mor\u2082Iso\n /-- The expression for the left whiskering `whiskerLeftIso f \u03b7`. -/\n whiskerLeftM (f : Mor\u2081) (\u03b7 : Mor\u2082Iso) : m Mor\u2082Iso\n /-- The expression for the right whiskering `whiskerRightIso \u03b7 h`. -/\n whiskerRightM (\u03b7 : Mor\u2082Iso) (h : Mor\u2081) : m Mor\u2082Iso\n /-- The expression for the horizontal composition `\u03b7 \u25eb \u03b8`. -/\n horizontalCompM (\u03b7 \u03b8 : Mor\u2082Iso) : m Mor\u2082Iso\n /-- The expression for the inverse `Iso.symm \u03b7`. -/\n symmM (\u03b7 : Mor\u2082Iso) : m Mor\u2082Iso\n /-- The expression for the coherence composition `\u03b7 \u226a\u2297\u226b \u03b8", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 2039, "declarations_count": 285, "diagnostics_count": 0, "duplicate_fingerprint": "967d79047efa0be9", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 977, "lean_code_chars": 1614, "lean_code_ratio": 0.7916, "length_bucket": "short", "line_count": 39, "natural_language_chars": 425, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.CategoryTheory.Coherence.Datatypes).", "role": "system"}, {"content": "Complete the following proof.\n\nOpen namespaces: Lean, Meta, MonadMor\u2081\n\n## Surrounding context in Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean\n```lean\n-- Mathlib.Tactic.CategoryTheory.Coherence.Datatypes.Obj (L55-L88)\ndef Obj.e (a : Obj) : Expr\n\n-- Mathlib.Tactic.CategoryTheory.Coherence.Datatypes.Mor\u2081 (L89-L94)\ndef Mor\u2081.e : Mor\u2081 \u2192 Expr\n | .id e _ => e\n | .comp e _ _ => e\n | .of a => a.e\n\n/-- The domain of a 1-morphism. -/\n\n-- Mathlib.Tactic.CategoryTheory.Coherence.Datatypes.Mor\u2081 (L95-L100)\ndef Mor\u2081.src : Mor\u2081 \u2192 Obj\n | .id _ a => a\n | .comp _ f _ => f.src\n | .of f => f.src\n\n/-- The codomain of a 1-morphism. -/\n```\n\n```lean\ndef Mor\u2082Iso.tgtM {m : Type \u2192 Type} [Monad m] [MonadMor\u2081 m] : Mor\u2082Iso \u2192 m Mor\u2081\n | .structuralAtom \u03b1 => \u03b1.tgtM\n | .comp _ _ _ h .. => return h\n | .whiskerLeft _ f _ h _ => do comp\u2081M f h\n | .whiskerRight _ _ g _ h => do comp\u2081M g h\n | .horizontalComp _ _ g\u2081 _ g\u2082 _ _ => do comp\u2081M g\u2081 g\u2082\n | .inv _ f _ _ => return f\n | .coherenceComp _ _ _ _ i .. => return i\n | .of \u03b7 => return \u03b7.tgt\n\n/-- A monad equipped with the ability to construct `Mor\u2082Iso` terms. -/\nclass MonadMor\u2082Iso (m : Type \u2192 Type) where\n /-- The expression for the associator `\u03b1_ f g h`. -/\n associatorM (f g h : Mor\u2081) : m StructuralAtom\n /-- The expression for the left unitor `\u03bb_ f`. -/\n leftUnitorM (f : Mor\u2081) : m StructuralAtom\n /-- The expression for the right unitor `\u03c1_ f`. -/\n rightUnitorM (f : Mor\u2081) : m StructuralAtom\n /-- The expression for the identity `Iso.refl f`. -/\n id\u2082M (f : Mor\u2081) : m StructuralAtom\n /-- The expression for the coherence isomorphism `\u2297\ud835\udfd9 : f \u27f6 g`. -/\n coherenceHomM (f g : Mor\u2081) (inst : Expr) : m CoherenceHom\n /-- The expression for the composition `\u03b7 \u226a\u226b \u03b8`. -/\n comp\u2082M (\u03b7 \u03b8 : Mor\u2082Iso) : m Mor\u2082Iso\n /-- The expression for the left whiskering `whiskerLeftIso f \u03b7`. -/\n whiskerLeftM (f : Mor\u2081) (\u03b7 : Mor\u2082Iso) : m Mor\u2082Iso\n /-- The expression for the right whiskering `whiskerRightIso \u03b7 h`. -/\n whiskerRightM (\u03b7 : Mor\u2082Iso) (h : Mor\u2081) : m Mor\u2082Iso\n /-- The expression for the horizontal composition `\u03b7 \u25eb \u03b8`. -/\n horizontalCompM (\u03b7 \u03b8 : Mor\u2082Iso) : m Mor\u2082Iso\n /-- The expression for the inverse `Iso.symm \u03b7`. -/\n symmM (\u03b7 : Mor\u2082Iso) : m Mor\u2082Iso\n /-- The expression for the coherence composition `\u03b7 \u226a\u2297\u226b \u03b8\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Tactic.CategoryTheory.Coherence.Datatypes).\n\nComplete the following proof.\n\nOpen namespaces: Lean, Meta, MonadMor\u2081\n\n## Surrounding context in Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean\n```lean\n-- Mathlib.Tactic.CategoryTheory.Coherence.Datatypes.Obj (L55-L88)\ndef Obj.e (a : Obj) : Expr\n\n-- Mathlib.Tactic.CategoryTheory.Coherence.Datatypes.Mor\u2081 (L89-L94)\ndef Mor\u2081.e : Mor\u2081 \u2192 Expr\n | .id e _ => e\n | .comp e _ _ => e\n | .of a => a.e\n\n/-- The domain of a 1-morphism. -/\n\n-- Mathlib.Tactic.CategoryTheory.Coherence.Datatypes.Mor\u2081 (L95-L100)\ndef Mor\u2081.src : Mor\u2081 \u2192 Obj\n | .id _ a => a\n | .comp _ f _ => f.src\n | .of f => f.src\n\n/-- The codomain of a 1-morphism. -/\n```\n\n```lean\ndef Mor\u2082Iso.tgtM {m : Type \u2192 Type} [Monad m] [MonadMor\u2081 m] : Mor\u2082Iso \u2192 m Mor\u2081\n | .structuralAtom \u03b1 => \u03b1.tgtM\n | .comp _ _ _ h .. => return h\n | .whiskerLeft _ f _ h _ => do comp\u2081M f h\n | .whiskerRight _ _ g _ h => do comp\u2081M g h\n | .horizontalComp _ _ g\u2081 _ g\u2082 _ _ => do comp\u2081M g\u2081 g\u2082\n | .inv _ f _ _ => return f\n | .coherenceComp _ _ _ _ i .. => return i\n | .of \u03b7 => return \u03b7.tgt\n\n/-- A monad equipped with the ability to construct `Mor\u2082Iso` terms. -/\nclass MonadMor\u2082Iso (m : Type \u2192 Type) where\n /-- The expression for the associator `\u03b1_ f g h`. -/\n associatorM (f g h : Mor\u2081) : m StructuralAtom\n /-- The expression for the left unitor `\u03bb_ f`. -/\n leftUnitorM (f : Mor\u2081) : m StructuralAtom\n /-- The expression for the right unitor `\u03c1_ f`. -/\n rightUnitorM (f : Mor\u2081) : m StructuralAtom\n /-- The expression for the identity `Iso.refl f`. -/\n id\u2082M (f : Mor\u2081) : m StructuralAtom\n /-- The expression for the coherence isomorphism `\u2297\ud835\udfd9 : f \u27f6 g`. -/\n coherenceHomM (f g : Mor\u2081) (inst : Expr) : m CoherenceHom\n /-- The expression for the composition `\u03b7 \u226a\u226b \u03b8`. -/\n comp\u2082M (\u03b7 \u03b8 : Mor\u2082Iso) : m Mor\u2082Iso\n /-- The expression for the left whiskering `whiskerLeftIso f \u03b7`. -/\n whiskerLeftM (f : Mor\u2081) (\u03b7 : Mor\u2082Iso) : m Mor\u2082Iso\n /-- The expression for the right whiskering `whiskerRightIso \u03b7 h`. -/\n whiskerRightM (\u03b7 : Mor\u2082Iso) (h : Mor\u2081) : m Mor\u2082Iso\n /-- The expression for the horizontal composition `\u03b7 \u25eb \u03b8`. -/\n horizontalCompM (\u03b7 \u03b8 : Mor\u2082Iso) : m Mor\u2082Iso\n /-- The expression for the inverse `Iso.symm \u03b7`. -/\n symmM (\u03b7 : Mor\u2082Iso) : m Mor\u2082Iso\n /-- The expression for the coherence composition `\u03b7 \u226a\u2297\u226b \u03b8\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "sample_id": "A-Mathlib.Tactic.CategoryTheory.Coherence.Datatypes.Mor\u2082Iso", "source": {"declaration": "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes.Mor\u2082Iso", "file": "Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.CategoryTheory.Coherence.Datatypes", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/CategoryTheory/Coherence/Datatypes.lean#L224", "span": "L224-L263"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"context_enriched": true, "source_grounded_context_enriched": true, "statement": "theorem preErgodic_conjugate_iff {e : \u03b1 \u2243\u1d50 \u03b2} (h : MeasurePreserving e \u03bc \u03bc') :\n PreErgodic (e \u2218 f \u2218 e.symm) \u03bc' \u2194 PreErgodic f \u03bc", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 539, "declarations_count": 58, "diagnostics_count": 0, "duplicate_fingerprint": "f527d31926d55524", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 515, "lean_code_chars": 131, "lean_code_ratio": 0.243, "length_bucket": "short", "line_count": 8, "natural_language_chars": 408, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.Ergodic.Ergodic).", "role": "system"}, {"content": "Complete the following proof.\n\nOpen namespaces: Set, Function, Filter, MeasureTheory, MeasureTheory.Measure, ENNReal\n\n## Surrounding context in Mathlib/Dynamics/Ergodic/Ergodic.lean\n```lean\n-- Mathlib.Dynamics.Ergodic.Ergodic.ae_empty_or_univ (L62-L65)\ntheorem ae_empty_or_univ (hf : PreErgodic f \u03bc) (hs : MeasurableSet s) (hfs : f \u207b\u00b9' s = s) :\n s =\u1d50[\u03bc] (\u2205 : Set \u03b1) \u2228 s =\u1d50[\u03bc] univ\n\n-- Mathlib.Dynamics.Ergodic.Ergodic.measure_self_or_compl_eq_zero (L66-L69)\ntheorem measure_self_or_compl_eq_zero (hf : PreErgodic f \u03bc) (hs : MeasurableSet s)\n (hs' : f \u207b\u00b9' s = s) : \u03bc s = 0 \u2228 \u03bc s\u1d9c = 0\n\n-- Mathlib.Dynamics.Ergodic.Ergodic.ae_mem_or_ae_notMem (L70-L74)\ntheorem ae_mem_or_ae_notMem (hf : PreErgodic f \u03bc) (hsm : MeasurableSet s) (hs : f \u207b\u00b9' s = s) :\n (\u2200\u1d50 x \u2202\u03bc, x \u2208 s) \u2228 \u2200\u1d50 x \u2202\u03bc, x \u2209 s\n```\n\n```lean\ntheorem preErgodic_conjugate_iff {e : \u03b1 \u2243\u1d50 \u03b2} (h : MeasurePreserving e \u03bc \u03bc') :\n PreErgodic (e \u2218 f \u2218 e.symm) \u03bc' \u2194 PreErgodic f \u03bc\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Dynamics.Ergodic.Ergodic).\n\nComplete the following proof.\n\nOpen namespaces: Set, Function, Filter, MeasureTheory, MeasureTheory.Measure, ENNReal\n\n## Surrounding context in Mathlib/Dynamics/Ergodic/Ergodic.lean\n```lean\n-- Mathlib.Dynamics.Ergodic.Ergodic.ae_empty_or_univ (L62-L65)\ntheorem ae_empty_or_univ (hf : PreErgodic f \u03bc) (hs : MeasurableSet s) (hfs : f \u207b\u00b9' s = s) :\n s =\u1d50[\u03bc] (\u2205 : Set \u03b1) \u2228 s =\u1d50[\u03bc] univ\n\n-- Mathlib.Dynamics.Ergodic.Ergodic.measure_self_or_compl_eq_zero (L66-L69)\ntheorem measure_self_or_compl_eq_zero (hf : PreErgodic f \u03bc) (hs : MeasurableSet s)\n (hs' : f \u207b\u00b9' s = s) : \u03bc s = 0 \u2228 \u03bc s\u1d9c = 0\n\n-- Mathlib.Dynamics.Ergodic.Ergodic.ae_mem_or_ae_notMem (L70-L74)\ntheorem ae_mem_or_ae_notMem (hf : PreErgodic f \u03bc) (hsm : MeasurableSet s) (hs : f \u207b\u00b9' s = s) :\n (\u2200\u1d50 x \u2202\u03bc, x \u2208 s) \u2228 \u2200\u1d50 x \u2202\u03bc, x \u2209 s\n```\n\n```lean\ntheorem preErgodic_conjugate_iff {e : \u03b1 \u2243\u1d50 \u03b2} (h : MeasurePreserving e \u03bc \u03bc') :\n PreErgodic (e \u2218 f \u2218 e.symm) \u03bc' \u2194 PreErgodic f \u03bc\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "sample_id": "A-Mathlib.Dynamics.Ergodic.Ergodic.preErgodic_conjugate_iff", "source": {"declaration": "Mathlib.Dynamics.Ergodic.Ergodic.preErgodic_conjugate_iff", "file": "Mathlib/Dynamics/Ergodic/Ergodic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Dynamics.Ergodic.Ergodic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Dynamics/Ergodic/Ergodic.lean#L110", "span": "L110-L116"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Computability.ContextFreeGrammar.Rewrites (L68-L79)\nlemma Rewrites.exists_parts (hr : r.Rewrites u v) :\n \u2203 p q : List (Symbol T N),\n u = p ++ [Symbol.nonterminal r.input] ++ q \u2227 v = p ++ r.output ++ q := by\ninduction hr with\n | head s =>\n use [], s\n simp\n | cons x _ ih =>\n rcases ih with \u27e8p', q', rfl, rfl\u27e9\n use x :: p', q'\n simp", "-- Mathlib.Computability.ContextFreeGrammar.Rewrites (L80-L82)\nlemma Rewrites.input_output : r.Rewrites [.nonterminal r.input] r.output := by\nsimpa using head []", "-- Mathlib.Computability.ContextFreeGrammar.rewrites_of_exists_parts (L83-L91)\nlemma rewrites_of_exists_parts (r : ContextFreeRule T N) (p q : List (Symbol T N)) :\n r.Rewrites (p ++ [Symbol.nonterminal r.input] ++ q) (p ++ r.output ++ q) := by\ninduction p with\n | nil => exact Rewrites.head q\n | cons d l ih => exact Rewrites.cons d ih\n\n/-- Rule `r` rewrites string `u` is to string `v` iff they share both a prefix `p` and postfix `q`\nsuch that the remaining middle part of `u` is the input of `r` and the remaining middle part\nof `u` is the output of `r`. -/", "-- Mathlib.Computability.ContextFreeGrammar.rewrites_iff (L92-L96)\ntheorem rewrites_iff :\n r.Rewrites u v \u2194 \u2203 p q : List (Symbol T N),\n u = p ++ [Symbol.nonterminal r.input] ++ q \u2227 v = p ++ r.output ++ q :=\n\u27e8Rewrites.exists_parts, by rintro \u27e8p, q, rfl, rfl\u27e9; apply rewrites_of_exists_parts\u27e9", "-- Mathlib.Computability.ContextFreeGrammar.Rewrites (L97-L100)\nlemma Rewrites.nonterminal_input_mem : r.Rewrites u v \u2192 .nonterminal r.input \u2208 u := by\nsimp +contextual [rewrites_iff, List.append_assoc]\n\n/-- Add extra prefix to context-free rewriting. -/", "-- Mathlib.Computability.ContextFreeGrammar.Rewrites (L101-L108)\nlemma Rewrites.append_left (hvw : r.Rewrites u v) (p : List (Symbol T N)) :\n r.Rewrites (p ++ u) (p ++ v) := by\nrw [rewrites_iff] at *\n rcases hvw with \u27e8x, y, hxy\u27e9\n use p ++ x, y\n simp_all\n\n/-- Add extra postfix to context-free rewriting. -/", "-- Mathlib.Computability.ContextFreeGrammar.Rewrites (L109-L122)\nlemma Rewrites.append_right (hvw : r.Rewrites u v) (p : List (Symbol T N)) :\n r.Rewrites (u ++ p) (v ++ p) := by\nrw [rewrites_iff] at *\n rcases hvw with \u27e8x, y, hxy\u27e9\n use x, y ++ p\n simp_all\n\nend ContextFreeRule\n\nnamespace ContextFreeGrammar\n\n/-- Given a context-free grammar `g` and strings `u` and `v`\n`g.Produces u v` means that one step of a context-free transformation by a rule from `g` sends\n`u` to `v`. -/", "-- Mathlib.Computability.ContextFreeGrammar.Produces (L123-L127)\ndef Produces (g : ContextFreeGrammar T) (u v : List (Symbol T g.NT)) : Prop :=\n\u2203 r \u2208 g.rules, r.Rewrites u v\n\n/-- Given a context-free grammar `g` and strings `u` and `v`\n`g.Derives u v` means that `g` can transform `u` to `v` in some number of rewriting steps. -/", "-- Mathlib.Computability.ContextFreeGrammar.Derives (L128-L134)\nabbrev Derives (g : ContextFreeGrammar T) :\n List (Symbol T g.NT) \u2192 List (Symbol T g.NT) \u2192 Prop :=\nRelation.ReflTransGen g.Produces\n\n/-- Given a context-free grammar `g` and a string `s`\n`g.Generates s` means that `g` can transform its initial nonterminal to `s` in some number of\nrewriting steps. -/", "-- Mathlib.Computability.ContextFreeGrammar.Generates (L135-L138)\ndef Generates (g : ContextFreeGrammar T) (s : List (Symbol T g.NT)) : Prop :=\ng.Derives [Symbol.nonterminal g.initial] s\n\n/-- The language (set of words) that can be generated by a given context-free grammar `g`. -/", "-- Mathlib.Computability.ContextFreeGrammar.language (L139-L144)\ndef language (g : ContextFreeGrammar T) : Language T :=\n{ w : List T | g.Generates (w.map Symbol.terminal) }\n\n/-- A given word `w` belongs to the language generated by a given context-free grammar `g` iff\n`g` can derive the word `w` (wrapped as a string) from the initial nonterminal of `g` in some\nnumber of steps. -/", "-- Mathlib.Computability.ContextFreeGrammar.Derives (L153-L155)\nlemma Derives.refl (w : List (Symbol T g.NT)) : g.Derives w w :=\nRelation.ReflTransGen.refl", "-- Mathlib.Computability.ContextFreeGrammar.Produces (L156-L158)\nlemma Produces.single {v w : List (Symbol T g.NT)} (hvw : g.Produces v w) : g.Derives v w :=\nRelation.ReflTransGen.single hvw", "-- Mathlib.Computability.ContextFreeGrammar.Derives (L160-L163)\nlemma Derives.trans {u v w : List (Symbol T g.NT)} (huv : g.Derives u v) (hvw : g.Derives v w) :\n g.Derives u w :=\nRelation.ReflTransGen.trans huv hvw", "-- Mathlib.Computability.ContextFreeGrammar.Derives (L164-L168)\nlemma Derives.trans_produces {u v w : List (Symbol T g.NT)}\n (huv : g.Derives u v) (hvw : g.Produces v w) :\n g.Derives u w :=\nhuv.trans hvw.single"], "source_grounded_context_enriched": false, "statement": "lemma mem_language_iff (g : ContextFreeGrammar T) (w : List T) :\n w \u2208 g.language \u2194 g.Derives [Symbol.nonterminal g.initial] (w.map Symbol.terminal)", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 5576, "declarations_count": 671, "diagnostics_count": 0, "duplicate_fingerprint": "7506d689c193737c", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1883, "lean_code_chars": 4742, "lean_code_ratio": 0.8504, "length_bucket": "short", "line_count": 168, "natural_language_chars": 834, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 15, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.ContextFreeGrammar).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma mem_language_iff (g : ContextFreeGrammar T) (w : List T) :\n w \u2208 g.language \u2194 g.Derives [Symbol.nonterminal g.initial] (w.map Symbol.terminal)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.Rewrites (L68-L79)\nlemma Rewrites.exists_parts (hr : r.Rewrites u v) :\n \u2203 p q : List (Symbol T N),\n u = p ++ [Symbol.nonterminal r.input] ++ q \u2227 v = p ++ r.output ++ q := by\ninduction hr with\n | head s =>\n use [], s\n simp\n | cons x _ ih =>\n rcases ih with \u27e8p', q', rfl, rfl\u27e9\n use x :: p', q'\n simp\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.Rewrites (L80-L82)\nlemma Rewrites.input_output : r.Rewrites [.nonterminal r.input] r.output := by\nsimpa using head []\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.rewrites_of_exists_parts (L83-L91)\nlemma rewrites_of_exists_parts (r : ContextFreeRule T N) (p q : List (Symbol T N)) :\n r.Rewrites (p ++ [Symbol.nonterminal r.input] ++ q) (p ++ r.output ++ q) := by\ninduction p with\n | nil => exact Rewrites.head q\n | cons d l ih => exact Rewrites.cons d ih\n\n/-- Rule `r` rewrites string `u` is to string `v` iff they share both a prefix `p` and postfix `q`\nsuch that the remaining middle part of `u` is the input of `r` and the remaining middle part\nof `u` is the output of `r`. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.rewrites_iff (L92-L96)\ntheorem rewrites_iff :\n r.Rewrites u v \u2194 \u2203 p q : List (Symbol T N),\n u = p ++ [Symbol.nonterminal r.input] ++ q \u2227 v = p ++ r.output ++ q :=\n\u27e8Rewrites.exists_parts, by rintro \u27e8p, q, rfl, rfl\u27e9; apply rewrites_of_exists_parts\u27e9\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.Rewrites (L97-L100)\nlemma Rewrites.nonterminal_input_mem : r.Rewrites u v \u2192 .nonterminal r.input \u2208 u := by\nsimp +contextual [rewrites_iff, List.append_assoc]\n\n/-- Add extra prefix to context-free rewriting. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.Rewrites (L101-L108)\nlemma Rewrites.append_left (hvw : r.Rewrites u v) (p : List (Symbol T N)) :\n r.Rewrites (p ++ u) (p ++ v) := by\nrw [rewrites_iff] at *\n rcases hvw with \u27e8x, y, hxy\u27e9\n use p ++ x, y\n simp_all\n\n/-- Add extra postfix to context-free rewriting. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.Rewrites (L109-L122)\nlemma Rewrites.append_right (hvw : r.Rewrites u v) (p : List (Symbol T N)) :\n r.Rewrites (u ++ p) (v ++ p) := by\nrw [rewrites_iff] at *\n rcases hvw with \u27e8x, y, hxy\u27e9\n use x, y ++ p\n simp_all\n\nend ContextFreeRule\n\nnamespace ContextFreeGrammar\n\n/-- Given a context-free grammar `g` and strings `u` and `v`\n`g.Produces u v` means that one step of a context-free transformation by a rule from `g` sends\n`u` to `v`. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.Produces (L123-L127)\ndef Produces (g : ContextFreeGrammar T) (u v : List (Symbol T g.NT)) : Prop :=\n\u2203 r \u2208 g.rules, r.Rewrites u v\n\n/-- Given a context-free grammar `g` and strings `u` and `v`\n`g.Derives u v` means that `g` can transform `u` to `v` in some number of rewriting steps. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.Derives (L128-L134)\nabbrev Derives (g : ContextFreeGrammar T) :\n List (Symbol T g.NT) \u2192 List (Symbol T g.NT) \u2192 Prop :=\nRelation.ReflTransGen g.Produces\n\n/-- Given a context-free grammar `g` and a string `s`\n`g.Generates s` means that `g` can transform its initial nonterminal to `s` in some number of\nrewriting steps. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.Generates (L135-L138)\ndef Generates (g : ContextFreeGrammar T) (s : List (Symbol T g.NT)) : Prop :=\ng.Derives [Symbol.nonterminal g.initial] s\n\n/-- The language (set of words) that can be generated by a given context-free grammar `g`. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.language (L139-L144)\ndef language (g : ContextFreeGrammar T) : Language T :=\n{ w : List T | g.Generates (w.map Symbol.terminal) }\n\n/-- A given word `w` belongs to the language generated by a given context-free grammar `g` iff\n`g` can derive the word `w` (wrapped as a string) from the initial nonterminal of `g` in some\nnumber of steps. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.Derives (L153-L155)\nlemma Derives.refl (w : List (Symbol T g.NT)) : g.Derives w w :=\nRelation.ReflTransGen.refl\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.Produces (L156-L158)\nlemma Produces.single {v w : List (Symbol T g.NT)} (hvw : g.Produces v w) : g.Derives v w :=\nRelation.ReflTransGen.single hvw\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.Derives (L160-L163)\nlemma Derives.trans {u v w : List (Symbol T g.NT)} (huv : g.Derives u v) (hvw : g.Derives v w) :\n g.Derives u w :=\nRelation.ReflTransGen.trans huv hvw\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.Derives (L164-L168)\nlemma Derives.trans_produces {u v w : List (Symbol T g.NT)}\n (huv : g.Derives u v) (hvw : g.Produces v w) :\n g.Derives u w :=\nhuv.trans hvw.single\n```\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.ContextFreeGrammar).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma mem_language_iff (g : ContextFreeGrammar T) (w : List T) :\n w \u2208 g.language \u2194 g.Derives [Symbol.nonterminal g.initial] (w.map Symbol.terminal)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.Rewrites (L68-L79)\nlemma Rewrites.exists_parts (hr : r.Rewrites u v) :\n \u2203 p q : List (Symbol T N),\n u = p ++ [Symbol.nonterminal r.input] ++ q \u2227 v = p ++ r.output ++ q := by\ninduction hr with\n | head s =>\n use [], s\n simp\n | cons x _ ih =>\n rcases ih with \u27e8p', q', rfl, rfl\u27e9\n use x :: p', q'\n simp\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.Rewrites (L80-L82)\nlemma Rewrites.input_output : r.Rewrites [.nonterminal r.input] r.output := by\nsimpa using head []\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.rewrites_of_exists_parts (L83-L91)\nlemma rewrites_of_exists_parts (r : ContextFreeRule T N) (p q : List (Symbol T N)) :\n r.Rewrites (p ++ [Symbol.nonterminal r.input] ++ q) (p ++ r.output ++ q) := by\ninduction p with\n | nil => exact Rewrites.head q\n | cons d l ih => exact Rewrites.cons d ih\n\n/-- Rule `r` rewrites string `u` is to string `v` iff they share both a prefix `p` and postfix `q`\nsuch that the remaining middle part of `u` is the input of `r` and the remaining middle part\nof `u` is the output of `r`. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.rewrites_iff (L92-L96)\ntheorem rewrites_iff :\n r.Rewrites u v \u2194 \u2203 p q : List (Symbol T N),\n u = p ++ [Symbol.nonterminal r.input] ++ q \u2227 v = p ++ r.output ++ q :=\n\u27e8Rewrites.exists_parts, by rintro \u27e8p, q, rfl, rfl\u27e9; apply rewrites_of_exists_parts\u27e9\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.Rewrites (L97-L100)\nlemma Rewrites.nonterminal_input_mem : r.Rewrites u v \u2192 .nonterminal r.input \u2208 u := by\nsimp +contextual [rewrites_iff, List.append_assoc]\n\n/-- Add extra prefix to context-free rewriting. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.Rewrites (L101-L108)\nlemma Rewrites.append_left (hvw : r.Rewrites u v) (p : List (Symbol T N)) :\n r.Rewrites (p ++ u) (p ++ v) := by\nrw [rewrites_iff] at *\n rcases hvw with \u27e8x, y, hxy\u27e9\n use p ++ x, y\n simp_all\n\n/-- Add extra postfix to context-free rewriting. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.Rewrites (L109-L122)\nlemma Rewrites.append_right (hvw : r.Rewrites u v) (p : List (Symbol T N)) :\n r.Rewrites (u ++ p) (v ++ p) := by\nrw [rewrites_iff] at *\n rcases hvw with \u27e8x, y, hxy\u27e9\n use x, y ++ p\n simp_all\n\nend ContextFreeRule\n\nnamespace ContextFreeGrammar\n\n/-- Given a context-free grammar `g` and strings `u` and `v`\n`g.Produces u v` means that one step of a context-free transformation by a rule from `g` sends\n`u` to `v`. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.Produces (L123-L127)\ndef Produces (g : ContextFreeGrammar T) (u v : List (Symbol T g.NT)) : Prop :=\n\u2203 r \u2208 g.rules, r.Rewrites u v\n\n/-- Given a context-free grammar `g` and strings `u` and `v`\n`g.Derives u v` means that `g` can transform `u` to `v` in some number of rewriting steps. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.Derives (L128-L134)\nabbrev Derives (g : ContextFreeGrammar T) :\n List (Symbol T g.NT) \u2192 List (Symbol T g.NT) \u2192 Prop :=\nRelation.ReflTransGen g.Produces\n\n/-- Given a context-free grammar `g` and a string `s`\n`g.Generates s` means that `g` can transform its initial nonterminal to `s` in some number of\nrewriting steps. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.Generates (L135-L138)\ndef Generates (g : ContextFreeGrammar T) (s : List (Symbol T g.NT)) : Prop :=\ng.Derives [Symbol.nonterminal g.initial] s\n\n/-- The language (set of words) that can be generated by a given context-free grammar `g`. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.language (L139-L144)\ndef language (g : ContextFreeGrammar T) : Language T :=\n{ w : List T | g.Generates (w.map Symbol.terminal) }\n\n/-- A given word `w` belongs to the language generated by a given context-free grammar `g` iff\n`g` can derive the word `w` (wrapped as a string) from the initial nonterminal of `g` in some\nnumber of steps. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.Derives (L153-L155)\nlemma Derives.refl (w : List (Symbol T g.NT)) : g.Derives w w :=\nRelation.ReflTransGen.refl\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.Produces (L156-L158)\nlemma Produces.single {v w : List (Symbol T g.NT)} (hvw : g.Produces v w) : g.Derives v w :=\nRelation.ReflTransGen.single hvw\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.Derives (L160-L163)\nlemma Derives.trans {u v w : List (Symbol T g.NT)} (huv : g.Derives u v) (hvw : g.Derives v w) :\n g.Derives u w :=\nRelation.ReflTransGen.trans huv hvw\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Computability.ContextFreeGrammar.Derives (L164-L168)\nlemma Derives.trans_produces {u v w : List (Symbol T g.NT)}\n (huv : g.Derives u v) (hvw : g.Produces v w) :\n g.Derives u w :=\nhuv.trans hvw.single\n```\n[/INST]", "sample_id": "C-Mathlib.Computability.ContextFreeGrammar.mem_language_iff", "source": {"declaration": "Mathlib.Computability.ContextFreeGrammar.mem_language_iff", "file": "Mathlib/Computability/ContextFreeGrammar.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Computability.ContextFreeGrammar", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Computability/ContextFreeGrammar.lean#L146", "span": "L146-L151"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"context_enriched": true, "source_grounded_context_enriched": true, "statement": "def quotientFunctor :\n Cat.FreeRefl (OneTruncation\u2082 V) \u2964 V.HomotopyCategory", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 506, "declarations_count": 52, "diagnostics_count": 0, "duplicate_fingerprint": "c0655d65d4d0da7d", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 404, "lean_code_chars": 79, "lean_code_ratio": 0.1561, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 427, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat).", "role": "system"}, {"content": "Complete the following proof.\n\nOpen namespaces: CategoryTheory, Category, Limits, Functor, Opposite, Simplicial, Nerve, SimplexCategory.Truncated\n\n## Surrounding context in Mathlib/AlgebraicTopology/SimplicialSet/HomotopyCat.lean\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.OneTruncation\u2082 (L51-L52)\ndef OneTruncation\u2082 (S : SSet.Truncated 2)\n\n-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.reflQuiver (L59-L62)\ninstance reflQuiver (S : SSet.Truncated 2) : ReflQuiver (OneTruncation\u2082 S) where\n Hom\n\n-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.hom_ext (L64-L68)\nlemma hom_ext\n {S : SSet.Truncated 2} {x y : OneTruncation\u2082 S} {f g : x \u27f6 y}\n (h : f.edge = g.edge) : f = g\n```\n\n```lean\ndef quotientFunctor :\n Cat.FreeRefl (OneTruncation\u2082 V) \u2964 V.HomotopyCategory\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "role": "user"}], "rendered_text": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat).\n\nComplete the following proof.\n\nOpen namespaces: CategoryTheory, Category, Limits, Functor, Opposite, Simplicial, Nerve, SimplexCategory.Truncated\n\n## Surrounding context in Mathlib/AlgebraicTopology/SimplicialSet/HomotopyCat.lean\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.OneTruncation\u2082 (L51-L52)\ndef OneTruncation\u2082 (S : SSet.Truncated 2)\n\n-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.reflQuiver (L59-L62)\ninstance reflQuiver (S : SSet.Truncated 2) : ReflQuiver (OneTruncation\u2082 S) where\n Hom\n\n-- Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.hom_ext (L64-L68)\nlemma hom_ext\n {S : SSet.Truncated 2} {x y : OneTruncation\u2082 S} {f g : x \u27f6 y}\n (h : f.edge = g.edge) : f = g\n```\n\n```lean\ndef quotientFunctor :\n Cat.FreeRefl (OneTruncation\u2082 V) \u2964 V.HomotopyCategory\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "sample_id": "A-Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.quotientFunctor", "source": {"declaration": "Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat.quotientFunctor", "file": "Mathlib/AlgebraicTopology/SimplicialSet/HomotopyCat.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/SimplicialSet/HomotopyCat.lean#L265", "span": "L265-L268"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Logic.Equiv.PartialEquiv.Simps (L161-L165)\ndef Simps.symm_apply (e : PartialEquiv \u03b1 \u03b2) : \u03b2 \u2192 \u03b1 :=\ne.symm\n\ninitialize_simps_projections PartialEquiv (toFun \u2192 apply, invFun \u2192 symm_apply)", "-- Mathlib.Logic.Equiv.PartialEquiv.coe_mk (L166-L168)\ntheorem coe_mk (f : \u03b1 \u2192 \u03b2) (g s t ml mr il ir) :\n (PartialEquiv.mk f g s t ml mr il ir : \u03b1 \u2192 \u03b2) = f := rfl", "-- Mathlib.Logic.Equiv.PartialEquiv.coe_symm_mk (L170-L173)\ntheorem coe_symm_mk (f : \u03b1 \u2192 \u03b2) (g s t ml mr il ir) :\n ((PartialEquiv.mk f g s t ml mr il ir).symm : \u03b2 \u2192 \u03b1) = g :=\nrfl", "-- Mathlib.Logic.Equiv.PartialEquiv.invFun_as_coe (L175-L177)\ntheorem invFun_as_coe : e.invFun = e.symm :=\nrfl", "-- Mathlib.Logic.Equiv.PartialEquiv.map_source (L179-L182)\ntheorem map_source {x : \u03b1} (h : x \u2208 e.source) : e x \u2208 e.target :=\ne.map_source' h\n\n/-- Variant of `e.map_source` and `map_source'`, stated for images of subsets of `source`. -/", "-- Mathlib.Logic.Equiv.PartialEquiv.map_source'' (L183-L185)\nlemma map_source'' : e '' e.source \u2286 e.target :=\nfun _ \u27e8_, hx, hex\u27e9 \u21a6 mem_of_eq_of_mem (id hex.symm) (e.map_source' hx)", "-- Mathlib.Logic.Equiv.PartialEquiv.map_target (L187-L189)\ntheorem map_target {x : \u03b2} (h : x \u2208 e.target) : e.symm x \u2208 e.source :=\ne.map_target' h", "-- Mathlib.Logic.Equiv.PartialEquiv.left_inv (L191-L193)\ntheorem left_inv {x : \u03b1} (h : x \u2208 e.source) : e.symm (e x) = x :=\ne.left_inv' h", "-- Mathlib.Logic.Equiv.PartialEquiv.right_inv (L195-L197)\ntheorem right_inv {x : \u03b2} (h : x \u2208 e.target) : e (e.symm x) = x :=\ne.right_inv' h", "-- Mathlib.Logic.Equiv.PartialEquiv.target_subset_range (L198-L200)\ntheorem target_subset_range : e.target \u2286 range e :=\nfun x hx \u21a6 \u27e8e.symm x, right_inv e hx\u27e9", "-- Mathlib.Logic.Equiv.PartialEquiv.eq_symm_apply (L201-L206)\ntheorem eq_symm_apply {x : \u03b1} {y : \u03b2} (hx : x \u2208 e.source) (hy : y \u2208 e.target) :\n x = e.symm y \u2194 e x = y :=\n\u27e8fun h => by rw [\u2190 e.right_inv hy, h], fun h => by rw [\u2190 e.left_inv hx, h]\u27e9\n\nprotected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source", "-- Mathlib.Logic.Equiv.PartialEquiv.symm_mapsTo (L207-L227)\ntheorem symm_mapsTo : MapsTo e.symm e.target e.source :=\ne.symm.mapsTo\n\nprotected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv\n\nprotected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv\n\nprotected theorem invOn : InvOn e.symm e e.source e.target :=\n \u27e8e.leftInvOn, e.rightInvOn\u27e9\n\nprotected theorem injOn : InjOn e e.source :=\n e.leftInvOn.injOn\n\nprotected theorem bijOn : BijOn e e.source e.target :=\n e.invOn.bijOn e.mapsTo e.symm_mapsTo\n\nprotected theorem surjOn : SurjOn e e.source e.target :=\n e.bijOn.surjOn\n\n/-- Interpret an `Equiv` as a `PartialEquiv` by restricting it to `s` in the domain\nand to `t` in the codomain. -/", "-- Mathlib.Logic.Equiv.PartialEquiv.inhabitedOfEmpty (L248-L251)\ninstance inhabitedOfEmpty [IsEmpty \u03b1] [IsEmpty \u03b2] : Inhabited (PartialEquiv \u03b1 \u03b2) :=\n\u27e8((Equiv.equivEmpty \u03b1).trans (Equiv.equivEmpty \u03b2).symm).toPartialEquiv\u27e9\n\n/-- Create a copy of a `PartialEquiv` providing better definitional equalities. -/", "-- Mathlib.Logic.Equiv.PartialEquiv.copy (L253-L264)\ndef copy (e : PartialEquiv \u03b1 \u03b2) (f : \u03b1 \u2192 \u03b2) (hf : \u21d1e = f) (g : \u03b2 \u2192 \u03b1) (hg : \u21d1e.symm = g) (s : Set \u03b1)\n (hs : e.source = s) (t : Set \u03b2) (ht : e.target = t) :\n PartialEquiv \u03b1 \u03b2 where\n toFun := f\ninvFun := g\n source := s\n target := t\n map_source' _ := ht \u25b8 hs \u25b8 hf \u25b8 e.map_source\n map_target' _ := hs \u25b8 ht \u25b8 hg \u25b8 e.map_target\n left_inv' _ := hs \u25b8 hf \u25b8 hg \u25b8 e.left_inv\n right_inv' _ := ht \u25b8 hf \u25b8 hg \u25b8 e.right_inv", "-- Mathlib.Logic.Equiv.PartialEquiv.copy_eq (L265-L278)\ntheorem copy_eq (e : PartialEquiv \u03b1 \u03b2) (f : \u03b1 \u2192 \u03b2) (hf : \u21d1e = f) (g : \u03b2 \u2192 \u03b1) (hg : \u21d1e.symm = g)\n (s : Set \u03b1) (hs : e.source = s) (t : Set \u03b2) (ht : e.target = t) :\n e.copy f hf g hg s hs t ht = e := by\nsubsts f g s t\n cases e\n rfl\n\n/-- Associate to a `PartialEquiv` an `Equiv` between the source and the target. -/\nprotected def toEquiv : e.source \u2243 e.target where\n toFun x := \u27e8e x, e.map_source x.mem\u27e9\n invFun y := \u27e8e.symm y, e.map_target y.mem\u27e9\n left_inv := fun \u27e8_, hx\u27e9 => Subtype.ext <| e.left_inv hx\n right_inv := fun \u27e8_, hy\u27e9 => Subtype.ext <| e.right_inv hy", "-- Mathlib.Logic.Equiv.PartialEquiv.symm_source (L280-L282)\ntheorem symm_source : e.symm.source = e.target :=\nrfl", "-- Mathlib.Logic.Equiv.PartialEquiv.symm_target (L284-L286)\ntheorem symm_target : e.symm.target = e.source :=\nrfl", "-- Mathlib.Logic.Equiv.PartialEquiv.symm_symm (L288-L289)\ntheorem symm_symm : e.symm.symm = e := rfl", "-- Mathlib.Logic.Equiv.PartialEquiv.symm_bijective (L290-L293)\ntheorem symm_bijective :\n Function.Bijective (PartialEquiv.symm : PartialEquiv \u03b1 \u03b2 \u2192 PartialEquiv \u03b2 \u03b1) :=\nFunction.bijective_iff_has_inverse.mpr \u27e8_, symm_symm, symm_symm\u27e9", "-- Mathlib.Logic.Equiv.PartialEquiv.image_source_eq_target (L294-L296)\ntheorem image_source_eq_target : e '' e.source = e.target :=\ne.bijOn.image_eq", "-- Mathlib.Logic.Equiv.PartialEquiv.forall_mem_target (L297-L299)\ntheorem forall_mem_target {p : \u03b2 \u2192 Prop} : (\u2200 y \u2208 e.target, p y) \u2194 \u2200 x \u2208 e.source, p (e x) := by\nrw [\u2190 image_source_eq_target, forall_mem_image]", "-- Mathlib.Logic.Equiv.PartialEquiv.exists_mem_target (L300-L309)\ntheorem exists_mem_target {p : \u03b2 \u2192 Prop} : (\u2203 y \u2208 e.target, p y) \u2194 \u2203 x \u2208 e.source, p (e x) := by\nrw [\u2190 image_source_eq_target, exists_mem_image]\n\n/-- We say that `t : Set \u03b2` is an image of `s : Set \u03b1` under a partial equivalence if\nany of the following equivalent conditions hold:\n\n* `e '' (e.source \u2229 s) = e.target \u2229 t`;\n* `e.source \u2229 e \u207b\u00b9 t = e.source \u2229 s`;\n* `\u2200 x \u2208 e.source, e x \u2208 t \u2194 x \u2208 s` (this one is used in the definition).\n-/", "-- Mathlib.Logic.Equiv.PartialEquiv.IsImage (L310-L316)\ndef IsImage (s : Set \u03b1) (t : Set \u03b2) : Prop :=\n\u2200 \u2983x\u2984, x \u2208 e.source \u2192 (e x \u2208 t \u2194 x \u2208 s)\n\nnamespace IsImage\n\nvariable {e} {s : Set \u03b1} {t : Set \u03b2} {x : \u03b1}", "-- Mathlib.Logic.Equiv.PartialEquiv.apply_mem_iff (L317-L319)\ntheorem apply_mem_iff (h : e.IsImage s t) (hx : x \u2208 e.source) : e x \u2208 t \u2194 x \u2208 s :=\nh hx", "-- Mathlib.Logic.Equiv.PartialEquiv.symm_apply_mem_iff (L320-L325)\ntheorem symm_apply_mem_iff (h : e.IsImage s t) : \u2200 \u2983y\u2984, y \u2208 e.target \u2192 (e.symm y \u2208 s \u2194 y \u2208 t) :=\ne.forall_mem_target.mpr fun x hx => by rw [e.left_inv hx, h hx]\n\nprotected theorem symm (h : e.IsImage s t) : e.symm.IsImage t s :=\n h.symm_apply_mem_iff", "-- Mathlib.Logic.Equiv.Basic.sigmaSigmaSubtype (L448-L457)\ndef sigmaSigmaSubtype {\u03b1 : Type*} {\u03b2 : \u03b1 \u2192 Type*} {\u03b3 : (a : \u03b1) \u2192 \u03b2 a \u2192 Type*}\n (p : (a : \u03b1) \u00d7 \u03b2 a \u2192 Prop) [uniq : Unique {ab // p ab}] {a : \u03b1} {b : \u03b2 a} (h : p \u27e8a, b\u27e9) :\n {s : (a : \u03b1) \u00d7 (b : \u03b2 a) \u00d7 \u03b3 a b // p \u27e8s.1, s.2.1\u27e9} \u2243 \u03b3 a b :=\ncalc {s : (a : \u03b1) \u00d7 (b : \u03b2 a) \u00d7 \u03b3 a b // p \u27e8s.1, s.2.1\u27e9}\n _ \u2243 _ := subtypeEquiv (p := fun \u27e8a, b, c\u27e9 \u21a6 p \u27e8a, b\u27e9) (q := (p \u00b7.1))\n (sigmaAssoc \u03b3).symm fun s \u21a6 by simp [sigmaAssoc]\n _ \u2243 _ := subtypeSigmaEquiv _ _\n _ \u2243 _ := uniqueSigma (fun ab \u21a6 \u03b3 (Sigma.fst <| Subtype.val ab) (Sigma.snd <| Subtype.val ab))\n _ \u2243 \u03b3 a b := Equiv.cast <| by rw [\u2190 show \u27e8\u27e8a, b\u27e9, h\u27e9 = uniq.default from uniq.uniq _]", "-- Mathlib.Logic.Equiv.Basic.swap_comm (L642-L644)\ntheorem swap_comm (a b : \u03b1) : swap a b = swap b a :=\next fun r => swapCore_comm r _ _", "-- Mathlib.Logic.Equiv.Basic.swap_comp_apply (L676-L680)\ntheorem swap_comp_apply {a b x : \u03b1} (\u03c0 : Perm \u03b1) :\n \u03c0.trans (swap a b) x = if \u03c0 x = a then b else if \u03c0 x = b then a else \u03c0 x := by\ncases \u03c0\n rfl", "-- Mathlib.Logic.Equiv.Basic.subtypeSubtypeEquivSubtype (L340-L345)\ndef subtypeSubtypeEquivSubtype {\u03b1} {p q : \u03b1 \u2192 Prop} (h : \u2200 {x}, q x \u2192 p x) :\n { x : Subtype p // q x.1 } \u2243 Subtype q :=\n(subtypeSubtypeEquivSubtypeInter p _).trans <| subtypeEquivRight fun _ => and_iff_right_of_imp h\n\n/-- If a proposition holds for all elements, then the subtype is\nequivalent to the original type. -/", "-- Mathlib.Logic.Equiv.Basic.subtypePreimage_symm_apply_coe_pos (L128-L131)\ntheorem subtypePreimage_symm_apply_coe_pos (x : { a // \u00acp a } \u2192 \u03b2) (a : \u03b1) (h : p a) :\n ((subtypePreimage p x\u2080).symm x : \u03b1 \u2192 \u03b2) a = x\u2080 \u27e8a, h\u27e9 :=\ndif_pos h", "-- Mathlib.Logic.Equiv.Basic.subtypeEquivProp (L316-L320)\ndef subtypeEquivProp {p q : \u03b1 \u2192 Prop} (h : p = q) : Subtype p \u2243 Subtype q :=\nsubtypeEquiv (Equiv.refl \u03b1) fun _ => h \u25b8 Iff.rfl\n\n/-- A subtype of a subtype is equivalent to the subtype of elements satisfying both predicates. This\nversion allows the \u201cinner\u201d predicate to depend on `h : p a`. -/", "-- Mathlib.Logic.Equiv.Basic.subtypeEquiv_symm (L281-L284)\ntheorem subtypeEquiv_symm {p : \u03b1 \u2192 Prop} {q : \u03b2 \u2192 Prop} (e : \u03b1 \u2243 \u03b2) (h : \u2200 a : \u03b1, p a \u2194 q (e a)) :\n (e.subtypeEquiv h).symm = e.symm.subtypeEquiv (by as_aux_lemma => grind) :=\nrfl", "-- Mathlib.Logic.Equiv.Basic.piCongrRight_refl (L148-L152)\nlemma piCongrRight_refl {\u03b2 : \u03b1 \u2192 Sort*} : piCongrRight (fun a \u21a6 .refl (\u03b2 a)) = .refl (\u2200 a, \u03b2 a) :=\nrfl\n\n/-- Given `\u03c6 : \u03b1 \u2192 \u03b2 \u2192 Sort*`, we have an equivalence between `\u2200 a b, \u03c6 a b` and `\u2200 b a, \u03c6 a b`.\nThis is `Function.swap` as an `Equiv`. -/", "-- Mathlib.Logic.Equiv.Basic.eq_or_eq_of_swap_apply_ne_self (L660-L663)\ntheorem eq_or_eq_of_swap_apply_ne_self {a b x : \u03b1} (h : swap a b x \u2260 x) : x = a \u2228 x = b := by\ncontrapose! h\n exact swap_apply_of_ne_of_ne h.1 h.2", "-- Mathlib.Logic.Equiv.Basic.ofFiberEquiv_map (L195-L200)\ntheorem ofFiberEquiv_map {\u03b1 \u03b2 \u03b3} {f : \u03b1 \u2192 \u03b3} {g : \u03b2 \u2192 \u03b3}\n (e : \u2200 c, { a // f a = c } \u2243 { b // g b = c }) (a : \u03b1) : g (ofFiberEquiv e a) = f a :=\n(_ : { b // g b = _ }).property\n\nend prodCongr", "-- Mathlib.Logic.Equiv.Basic.subtypeSigmaEquiv (L351-L357)\ndef subtypeSigmaEquiv {\u03b1} (p : \u03b1 \u2192 Type v) (q : \u03b1 \u2192 Prop) : { y : Sigma p // q y.1 } \u2243 \u03a3 x :\n Subtype q, p x.1 :=\n\u27e8fun x => \u27e8\u27e8x.1.1, x.2\u27e9, x.1.2\u27e9, fun x => \u27e8\u27e8x.1.1, x.2\u27e9, x.1.2\u27e9, fun _ => rfl,\n fun _ => rfl\u27e9\n\n/-- A sigma type over a subtype is equivalent to the sigma set over the original type,\nif the fiber is empty outside of the subset -/", "-- Mathlib.Logic.Equiv.Basic.swap_self (L639-L641)\ntheorem swap_self (a : \u03b1) : swap a a = Equiv.refl _ :=\next fun r => swapCore_self r a", "-- Mathlib.Logic.Equiv.Basic.sigmaSigmaSubtypeEq_symm_apply (L482-L485)\nlemma sigmaSigmaSubtypeEq_symm_apply {\u03b1 \u03b2 : Type*} {\u03b3 : \u03b1 \u2192 \u03b2 \u2192 Type*} {a : \u03b1} {b : \u03b2} (c : \u03b3 a b) :\n (sigmaSigmaSubtypeEq a b).symm c = \u27e8\u27e8a, \u27e8b, c\u27e9\u27e9, \u27e8rfl, rfl\u27e9\u27e9 := by\nsimp [sigmaSigmaSubtypeEq]", "-- Mathlib.Logic.Equiv.Basic.swap_eq_refl_iff (L673-L675)\ntheorem swap_eq_refl_iff {x y : \u03b1} : swap x y = Equiv.refl _ \u2194 x = y :=\n\u27e8fun h => (Equiv.refl _).injective (by grind), by grind\u27e9", "-- Mathlib.Logic.Equiv.Basic.subtypeEquiv (L262-L268)\ndef subtypeEquiv {p : \u03b1 \u2192 Prop} {q : \u03b2 \u2192 Prop} (e : \u03b1 \u2243 \u03b2) (h : \u2200 a, p a \u2194 q (e a)) :\n { a : \u03b1 // p a } \u2243 { b : \u03b2 // q b } where\n toFun a := \u27e8e a, (h _).mp a.property\u27e9\ninvFun b := \u27e8e.symm b, (h _).mpr ((e.apply_symm_apply b).symm \u25b8 b.property)\u27e9\n left_inv a := Subtype.ext <| by simp\n right_inv b := Subtype.ext <| by simp", "-- Mathlib.Logic.Equiv.Basic.subtypeCongr (L54-L62)\ndef subtypeCongr {\u03b1} {p q : \u03b1 \u2192 Prop} [DecidablePred p] [DecidablePred q]\n (e : { x // p x } \u2243 { x // q x }) (f : { x // \u00acp x } \u2243 { x // \u00acq x }) : Perm \u03b1 :=\n(sumCompl p).symm.trans ((sumCongr e f).trans (sumCompl q))\n\nvariable {\u03b5 : Type*} {p : \u03b5 \u2192 Prop} [DecidablePred p]\nvariable (ep ep' : Perm { a // p a }) (en en' : Perm { a // \u00acp a })\n\n/-- Combining permutations on `\u03b5` that permute only inside or outside the subtype\nsplit induced by `p : \u03b5 \u2192 Prop` constructs a permutation on `\u03b5`. -/", "-- Mathlib.Logic.Equiv.Basic.swap_apply_right (L654-L656)\ntheorem swap_apply_right (a b : \u03b1) : swap a b b = a := by\ngrind", "-- Mathlib.Logic.Equiv.Basic.symm_trans_swap_trans (L689-L692)\ntheorem symm_trans_swap_trans [DecidableEq \u03b2] (a b : \u03b1) (e : \u03b1 \u2243 \u03b2) :\n (e.symm.trans (swap a b)).trans e = swap (e a) (e b) := by\ngrind", "-- Mathlib.Logic.Equiv.Basic.subtypePreimage (L112-L127)\ndef subtypePreimage : { x : \u03b1 \u2192 \u03b2 // x \u2218 Subtype.val = x\u2080 } \u2243 ({ a // \u00acp a } \u2192 \u03b2) where\n toFun (x : { x : \u03b1 \u2192 \u03b2 // x \u2218 Subtype.val = x\u2080 }) a := (x : \u03b1 \u2192 \u03b2) a\ninvFun x := \u27e8fun a => if h : p a then x\u2080 \u27e8a, h\u27e9 else x \u27e8a, h\u27e9, funext fun \u27e8_, h\u27e9 => dif_pos h\u27e9\n left_inv := fun \u27e8x, hx\u27e9 =>\n Subtype.val_injective <|\n funext fun a => by\n dsimp only\n split_ifs\n \u00b7 rw [\u2190 hx]; rfl\n \u00b7 rfl\n right_inv x :=\n funext fun \u27e8a, h\u27e9 =>\n show dite (p a) _ _ = _ by\n dsimp only\n rw [dif_neg h]", "-- Mathlib.Logic.Equiv.Basic.subtypePreimage_symm_apply_coe_neg (L132-L137)\ntheorem subtypePreimage_symm_apply_coe_neg (x : { a // \u00acp a } \u2192 \u03b2) (a : \u03b1) (h : \u00acp a) :\n ((subtypePreimage p x\u2080).symm x : \u03b1 \u2192 \u03b2) a = x \u27e8a, h\u27e9 :=\ndif_neg h\n\nend subtypePreimage", "-- Mathlib.Logic.Equiv.Basic.piComm (L154-L156)\ndef piComm (\u03c6 : \u03b1 \u2192 \u03b2 \u2192 Sort*) : (\u2200 a b, \u03c6 a b) \u2243 \u2200 b a, \u03c6 a b :=\n\u27e8swap, swap, fun _ => rfl, fun _ => rfl\u27e9", "-- Mathlib.Logic.Equiv.Basic.subtypeEquivRight (L295-L297)\ndef subtypeEquivRight {p q : \u03b1 \u2192 Prop} (e : \u2200 x, p x \u2194 q x) : { x // p x } \u2243 { x // q x } :=\nsubtypeEquiv (Equiv.refl _) e", "-- Mathlib.Logic.Equiv.Basic.natSumPUnitEquivNat (L228-L231)\ndef natSumPUnitEquivNat : \u2115 \u2295 PUnit \u2243 \u2115 :=\nnatEquivNatSumPUnit.symm\n\n/-- The type of integer numbers is equivalent to `\u2115 \u2295 \u2115`. -/", "-- Mathlib.Logic.Equiv.Basic.subtypeEquivRight_apply (L298-L300)\nlemma subtypeEquivRight_apply {p q : \u03b1 \u2192 Prop} (e : \u2200 x, p x \u2194 q x)\n (z : { x // p x }) : subtypeEquivRight e z = \u27e8z, (e z.1).mp z.2\u27e9 := rfl", "-- Mathlib.Logic.Equiv.Basic.sigmaSubtypeEquivOfSubset (L358-L363)\ndef sigmaSubtypeEquivOfSubset {\u03b1} (p : \u03b1 \u2192 Type v) (q : \u03b1 \u2192 Prop) (h : \u2200 x, p x \u2192 q x) :\n (\u03a3 x : Subtype q, p x) \u2243 \u03a3 x : \u03b1, p x :=\n(subtypeSigmaEquiv p q).symm.trans <| subtypeUnivEquiv fun x => h x.1 x.2\n\n/-- If a predicate `p : \u03b2 \u2192 Prop` is true on the range of a map `f : \u03b1 \u2192 \u03b2`, then\n`\u03a3 y : {y // p y}, {x // f x = y}` is equivalent to `\u03b1`. -/", "-- Mathlib.Logic.Equiv.Basic.coe_subtypeEquiv_eq_map (L269-L272)\nlemma coe_subtypeEquiv_eq_map {X Y} {p : X \u2192 Prop} {q : Y \u2192 Prop} (e : X \u2243 Y)\n (h : \u2200 x, p x \u2194 q (e x)) : \u21d1(e.subtypeEquiv h) = Subtype.map e (h \u00b7 |>.mp) :=\nrfl", "-- Mathlib.Logic.Equiv.Basic.comp_swap_eq_update (L684-L687)\ntheorem comp_swap_eq_update (i j : \u03b1) (f : \u03b1 \u2192 \u03b2) :\n f \u2218 Equiv.swap i j = update (update f j (f i)) i (f j) := by\ngrind", "-- Mathlib.Logic.Equiv.Basic.swap_eq_update (L681-L683)\ntheorem swap_eq_update (i j : \u03b1) : (Equiv.swap i j : \u03b1 \u2192 \u03b1) = update (update id j i) i j := by\ngrind", "-- Mathlib.Logic.Equiv.Basic.subtypeQuotientEquivQuotientSubtype_mk (L601-L606)\ntheorem subtypeQuotientEquivQuotientSubtype_mk (p\u2081 : \u03b1 \u2192 Prop)\n [s\u2081 : Setoid \u03b1] [s\u2082 : Setoid (Subtype p\u2081)] (p\u2082 : Quotient s\u2081 \u2192 Prop) (hp\u2082 : \u2200 a, p\u2081 a \u2194 p\u2082 \u27e6a\u27e7)\n (h : \u2200 x y : Subtype p\u2081, s\u2082 x y \u2194 (x : \u03b1) \u2248 y)\n (x hx) : subtypeQuotientEquivQuotientSubtype p\u2081 p\u2082 hp\u2082 h \u27e8\u27e6x\u27e7, hx\u27e9 = \u27e6\u27e8x, (hp\u2082 _).2 hx\u27e9\u27e7 :=\nrfl", "-- Mathlib.Logic.Equiv.Basic.piCongrRight (L143-L146)\ndef piCongrRight {\u03b2\u2081 \u03b2\u2082 : \u03b1 \u2192 Sort*} (F : \u2200 a, \u03b2\u2081 a \u2243 \u03b2\u2082 a) : (\u2200 a, \u03b2\u2081 a) \u2243 (\u2200 a, \u03b2\u2082 a) :=\n\u27e8Pi.map fun a \u21a6 F a, Pi.map fun a \u21a6 (F a).symm, fun H => funext <| by simp,\n fun H => funext <| by simp\u27e9", "-- Mathlib.Logic.Equiv.Basic.piEquivSubtypeSigma (L402-L411)\ndef piEquivSubtypeSigma (\u03b9) (\u03c0 : \u03b9 \u2192 Type*) :\n (\u2200 i, \u03c0 i) \u2243 { f : \u03b9 \u2192 \u03a3 i, \u03c0 i // \u2200 i, (f i).1 = i } where\n toFun := fun f => \u27e8fun i => \u27e8i, f i\u27e9, fun _ => rfl\u27e9\ninvFun := fun f i => by rw [\u2190 f.2 i]; exact (f.1 i).2\n right_inv := fun \u27e8f, hf\u27e9 =>\n Subtype.ext <| funext fun i =>\n Sigma.eq (hf i).symm <| eq_of_heq <| rec_heq_of_heq _ <| by simp\n\n/-- The type of functions `f : \u2200 a, \u03b2 a` such that for all `a` we have `p a (f a)` is equivalent\nto the type of functions `\u2200 a, {b : \u03b2 a // p a b}`. -/", "-- Mathlib.Logic.Equiv.Basic.swapCore_self (L622-L625)\ntheorem swapCore_self (r a : \u03b1) : swapCore a a r = r := by\nunfold swapCore\n split_ifs <;> simp [*]", "-- Mathlib.Logic.Equiv.Basic.sigmaSubtypeFiberEquivSubtype (L372-L387)\ndef sigmaSubtypeFiberEquivSubtype {\u03b1 \u03b2 : Type*} (f : \u03b1 \u2192 \u03b2) {p : \u03b1 \u2192 Prop} {q : \u03b2 \u2192 Prop}\n (h : \u2200 x, p x \u2194 q (f x)) : (\u03a3 y : Subtype q, { x : \u03b1 // f x = y }) \u2243 Subtype p :=\ncalc\n (\u03a3 y : Subtype q, { x : \u03b1 // f x = y }) \u2243 \u03a3 y :\n Subtype q, { x : Subtype p // Subtype.mk (f x) ((h x).1 x.2) = y } := by {\n apply sigmaCongrRight\n intro y\n apply Equiv.symm\n refine (subtypeSubtypeEquivSubtypeExists _ _).trans (subtypeEquivRight ?_)\n intro x\n exact \u27e8fun \u27e8hp, h'\u27e9 => congr_arg Subtype.val h', fun h' => \u27e8(h x).2 (h'.symm \u25b8 y.2),\n Subtype.ext h'\u27e9\u27e9 }\n _ \u2243 Subtype p := sigmaFiberEquiv fun x : Subtype p => (\u27e8f x, (h x).1 x.property\u27e9 : Subtype q)\n\n/-- A sigma type over an `Option` is equivalent to the sigma set over the original type,\nif the fiber is empty at none. -/", "-- Mathlib.Logic.Equiv.Basic.swap_apply_def (L646-L648)\ntheorem swap_apply_def (a b x : \u03b1) : swap a b x = if x = a then b else if x = b then a else x :=\nrfl", "-- Mathlib.Logic.Equiv.Basic.piCurry (L165-L172)\ndef piCurry {\u03b1} {\u03b2 : \u03b1 \u2192 Type*} (\u03b3 : \u2200 a, \u03b2 a \u2192 Type*) :\n (\u2200 x : \u03a3 i, \u03b2 i, \u03b3 x.1 x.2) \u2243 \u2200 a b, \u03b3 a b where\n toFun := Sigma.curry\ninvFun := Sigma.uncurry\n left_inv := Sigma.uncurry_curry\n right_inv := Sigma.curry_uncurry\n\n-- `simps` overapplies these but `simps -fullyApplied` under-applies them", "-- Mathlib.Logic.Equiv.Basic.swap_apply_left (L650-L652)\ntheorem swap_apply_left (a b : \u03b1) : swap a b a = b :=\nif_pos rfl", "-- Mathlib.Logic.Equiv.Basic.subtypeQuotientEquivQuotientSubtype_symm_mk (L608-L618)\ntheorem subtypeQuotientEquivQuotientSubtype_symm_mk (p\u2081 : \u03b1 \u2192 Prop)\n [s\u2081 : Setoid \u03b1] [s\u2082 : Setoid (Subtype p\u2081)] (p\u2082 : Quotient s\u2081 \u2192 Prop) (hp\u2082 : \u2200 a, p\u2081 a \u2194 p\u2082 \u27e6a\u27e7)\n (h : \u2200 x y : Subtype p\u2081, s\u2082 x y \u2194 (x : \u03b1) \u2248 y) (x) :\n (subtypeQuotientEquivQuotientSubtype p\u2081 p\u2082 hp\u2082 h).symm \u27e6x\u27e7 = \u27e8\u27e6x\u27e7, (hp\u2082 _).1 x.property\u27e9 :=\nrfl\n\nsection Swap\n\nvariable [DecidableEq \u03b1]\n\n/-- A helper function for `Equiv.swap`. -/", "-- Mathlib.Logic.Equiv.Basic.subtypeEquivCodomain_apply (L513-L516)\ntheorem subtypeEquivCodomain_apply (f : { x' // x' \u2260 x } \u2192 Y) (g) :\n subtypeEquivCodomain f g = (g : X \u2192 Y) x :=\nrfl", "-- Mathlib.Logic.Equiv.Basic.subtypeUnivEquiv (L347-L350)\ndef subtypeUnivEquiv {\u03b1} {p : \u03b1 \u2192 Prop} (h : \u2200 x, p x) : Subtype p \u2243 \u03b1 :=\n\u27e8fun x => x, fun x => \u27e8x, h x\u27e9, fun _ => Subtype.ext rfl, fun _ => rfl\u27e9\n\n/-- A subtype of a sigma-type is a sigma-type over a subtype. -/", "-- Mathlib.Logic.Equiv.Basic.subtypeEquivCodomain (L496-L505)\ndef subtypeEquivCodomain (f : { x' // x' \u2260 x } \u2192 Y) :\n { g : X \u2192 Y // g \u2218 (\u2191) = f } \u2243 Y :=\n(subtypePreimage _ f).trans <|\n @funUnique { x' // \u00acx' \u2260 x } _ <|\n show Unique { x' // \u00acx' \u2260 x } from\n @Equiv.unique _ _\n (show Unique { x' // x' = x } from {\n default := \u27e8x, rfl\u27e9, uniq := fun \u27e8_, h\u27e9 => Subtype.val_injective h })\n (subtypeEquivRight fun _ => not_not)", "-- Mathlib.Logic.Equiv.Basic.subtypeQuotientEquivQuotientSubtype (L583-L599)\ndef subtypeQuotientEquivQuotientSubtype (p\u2081 : \u03b1 \u2192 Prop) {s\u2081 : Setoid \u03b1} {s\u2082 : Setoid (Subtype p\u2081)}\n (p\u2082 : Quotient s\u2081 \u2192 Prop) (hp\u2082 : \u2200 a, p\u2081 a \u2194 p\u2082 \u27e6a\u27e7)\n (h : \u2200 x y : Subtype p\u2081, s\u2082.r x y \u2194 s\u2081.r x y) : {x // p\u2082 x} \u2243 Quotient s\u2082 where\n toFun a :=\nQuotient.hrecOn a.1 (fun a h => \u27e6\u27e8a, (hp\u2082 _).2 h\u27e9\u27e7)\n (fun a b hab => hfunext (by rw [Quotient.sound hab]) fun _ _ _ =>\n heq_of_eq (Quotient.sound ((h _ _).2 hab)))\n a.2\n invFun a :=\n Quotient.liftOn a (fun a => (\u27e8\u27e6a.1\u27e7, (hp\u2082 _).1 a.2\u27e9 : { x // p\u2082 x })) fun _ _ hab =>\n Subtype.ext (Quotient.sound ((h _ _).1 hab))\n left_inv a := by\n obtain \u27e8a, ha\u27e9 := a\n induction a using Quotient.inductionOn\n rfl\n right_inv a := by induction a using Quotient.inductionOn; rfl", "-- Mathlib.Logic.Equiv.Basic.coe_subtypeEquivCodomain_symm (L517-L521)\ntheorem coe_subtypeEquivCodomain_symm (f : { x' // x' \u2260 x } \u2192 Y) :\n ((subtypeEquivCodomain f).symm : Y \u2192 _) = fun y =>\n \u27e8fun x' => if h : x' \u2260 x then f \u27e8x', h\u27e9 else y, by grind\u27e9 :=\nrfl", "-- Mathlib.Logic.Equiv.Basic.swapCore_swapCore (L626-L628)\ntheorem swapCore_swapCore (r a b : \u03b1) : swapCore a b (swapCore a b r) = r := by\nunfold swapCore; split_ifs <;> grind", "-- Mathlib.Logic.Equiv.Array.for (L31-L49)\ninstance for `array` was)\n\n2. belong in `Mathlib/Control/Traversable/Instances.lean` instead of this file. -/\n\n-- namespace Array'\n\n-- open Function\n\n-- variable {n : \u2115}\n-- instance : Traversable (Array' n) :=\n-- @Equiv.traversable (flip Vector n) _ (fun \u03b1 => Equiv.vectorEquivArray \u03b1 n) _\n\n-- instance : LawfulTraversable (Array' n) :=\n-- @Equiv.isLawfulTraversable (flip Vector n) _ (fun \u03b1 => Equiv.vectorEquivArray \u03b1 n) _ _\n\n-- end Array'\n\n/-- If `\u03b1` is encodable, then so is `Array \u03b1`. -/", "-- Mathlib.Logic.Equiv.Basic.swap (L634-L637)\ndef swap (a b : \u03b1) : Perm \u03b1 :=\n\u27e8swapCore a b, swapCore a b, fun r => swapCore_swapCore r a b,\n fun r => swapCore_swapCore r a b\u27e9", "-- Mathlib.Logic.Equiv.Basic.subtypeEquiv_trans (L286-L293)\ntheorem subtypeEquiv_trans {p : \u03b1 \u2192 Prop} {q : \u03b2 \u2192 Prop} {r : \u03b3 \u2192 Prop} (e : \u03b1 \u2243 \u03b2) (f : \u03b2 \u2243 \u03b3)\n (h : \u2200 a : \u03b1, p a \u2194 q (e a)) (h' : \u2200 b : \u03b2, q b \u2194 r (f b)) :\n (e.subtypeEquiv h).trans (f.subtypeEquiv h')\n = (e.trans f).subtypeEquiv (by as_aux_lemma => exact fun a => (h a).trans (h' <| e a)) :=\nrfl\n\n/-- If two predicates `p` and `q` are pointwise equivalent, then `{x // p x}` is equivalent to\n`{x // q x}`. -/", "-- Mathlib.Logic.Equiv.Basic.subtypeSubtypeEquivSubtypeExists (L322-L330)\ndef subtypeSubtypeEquivSubtypeExists (p : \u03b1 \u2192 Prop) (q : Subtype p \u2192 Prop) :\n Subtype q \u2243 { a : \u03b1 // \u2203 h : p a, q \u27e8a, h\u27e9 } :=\n\u27e8fun a =>\n \u27e8a.1, a.1.2, by\n rcases a with \u27e8\u27e8a, hap\u27e9, haq\u27e9\n exact haq\u27e9,\n fun a => \u27e8\u27e8a, a.2.fst\u27e9, a.2.snd\u27e9, fun \u27e8\u27e8_, _\u27e9, _\u27e9 => rfl, fun \u27e8_, _, _\u27e9 => rfl\u27e9\n\n/-- A subtype of a subtype is equivalent to the subtype of elements satisfying both predicates. -/", "-- Mathlib.Logic.Equiv.Basic.subtypePiEquivPi (L412-L425)\ndef subtypePiEquivPi {\u03b2 : \u03b1 \u2192 Sort v} {p : \u2200 a, \u03b2 a \u2192 Prop} :\n { f : \u2200 a, \u03b2 a // \u2200 a, p a (f a) } \u2243 \u2200 a, { b : \u03b2 a // p a b } where\n toFun := fun f a => \u27e8f.1 a, f.2 a\u27e9\ninvFun := fun f => \u27e8fun a => (f a).1, fun a => (f a).2\u27e9\n left_inv := by\n rintro \u27e8f, h\u27e9\n rfl\n right_inv := by\n rintro f\n funext a\n exact Subtype.ext rfl\n\n/-- A sigma of a sigma whose second base does not depend on the first is equivalent\nto a sigma whose base is a product. -/", "-- Mathlib.Logic.Equiv.Basic.sigmaSubtype (L434-L441)\ndef sigmaSubtype {\u03b1 : Type*} {\u03b2 : \u03b1 \u2192 Type*} (a : \u03b1) :\n {s : Sigma \u03b2 // s.1 = a} \u2243 \u03b2 a where\n toFun := fun \u27e8\u27e8_, b\u27e9, h\u27e9 => h \u25b8 b\ninvFun b := \u27e8\u27e8a, b\u27e9, rfl\u27e9\n left_inv := fun \u27e8a, h\u27e9 \u21a6 by cases h; simp\n right_inv b := by simp", "-- Mathlib.Logic.Equiv.Basic.subtypeEquivRight_symm_apply (L301-L305)\nlemma subtypeEquivRight_symm_apply {p q : \u03b1 \u2192 Prop} (e : \u2200 x, p x \u2194 q x)\n (z : { x // q x }) : (subtypeEquivRight e).symm z = \u27e8z, (e z.1).mpr z.2\u27e9 := rfl\n/-- If `\u03b1 \u2243 \u03b2`, then for any predicate `p : \u03b2 \u2192 Prop` the subtype `{a // p (e a)}` is equivalent\nto the subtype `{b // p b}`. -/", "-- Mathlib.Logic.Equiv.Basic.subtypeEquivCodomain_symm_apply (L523-L526)\ntheorem subtypeEquivCodomain_symm_apply (f : { x' // x' \u2260 x } \u2192 Y) (y : Y) (x' : X) :\n ((subtypeEquivCodomain f).symm y : X \u2192 Y) x' = if h : x' \u2260 x then f \u27e8x', h\u27e9 else y :=\nrfl", "-- Mathlib.Logic.Equiv.Basic.subtypeEquivCodomain_symm_apply_ne (L531-L537)\ntheorem subtypeEquivCodomain_symm_apply_ne\n (f : { x' // x' \u2260 x } \u2192 Y) (y : Y) (x' : X) (h : x' \u2260 x) :\n ((subtypeEquivCodomain f).symm y : X \u2192 Y) x' = f \u27e8x', h\u27e9 :=\ndif_pos h\n\nend subtypeEquivCodomain", "-- Mathlib.Logic.Equiv.Basic.uniqueCongr (L241-L247)\ndef uniqueCongr (e : \u03b1 \u2243 \u03b2) : Unique \u03b1 \u2243 Unique \u03b2 where\n toFun h := @Equiv.unique _ _ h e.symm\ninvFun h := @Equiv.unique _ _ h e\n left_inv _ := Subsingleton.elim _ _\n right_inv _ := Subsingleton.elim _ _\n\n/-- If `\u03b1` is equivalent to `\u03b2`, then `IsEmpty \u03b1` is equivalent to `IsEmpty \u03b2`. -/", "-- Mathlib.Logic.Equiv.Basic.swapCore (L619-L621)\ndef swapCore (a b r : \u03b1) : \u03b1 :=\nif r = a then b else if r = b then a else r", "-- Mathlib.Logic.Equiv.Basic.piComm_symm (L158-L164)\ntheorem piComm_symm {\u03c6 : \u03b1 \u2192 \u03b2 \u2192 Sort*} : (piComm \u03c6).symm = (piComm <| swap \u03c6) :=\nrfl\n\n/-- Dependent `curry` equivalence: the type of dependent functions on `\u03a3 i, \u03b2 i` is equivalent\nto the type of dependent functions of two arguments (i.e., functions to the space of functions).\n\nThis is `Sigma.curry` and `Sigma.uncurry` together as an equiv. -/", "-- Mathlib.Logic.Equiv.Basic.subtypeSubtypeEquivSubtypeInter (L332-L338)\ndef subtypeSubtypeEquivSubtypeInter {\u03b1 : Type u} (p q : \u03b1 \u2192 Prop) :\n { x : Subtype p // q x.1 } \u2243 Subtype fun x => p x \u2227 q x :=\n(subtypeSubtypeEquivSubtypeExists p _).trans <|\n subtypeEquivRight fun x => @exists_prop (q x) (p x)\n\n/-- If the outer subtype has more restrictive predicate than the inner one,\nthen we can drop the latter. -/", "-- Mathlib.Logic.Equiv.Basic.sigmaSubtypeFiberEquiv (L364-L371)\ndef sigmaSubtypeFiberEquiv {\u03b1 \u03b2 : Type*} (f : \u03b1 \u2192 \u03b2) (p : \u03b2 \u2192 Prop) (h : \u2200 x, p (f x)) :\n (\u03a3 y : Subtype p, { x : \u03b1 // f x = y }) \u2243 \u03b1 :=\ncalc\n _ \u2243 \u03a3 y : \u03b2, { x : \u03b1 // f x = y } := sigmaSubtypeEquivOfSubset _ p fun _ \u27e8x, h'\u27e9 => h' \u25b8 h x\n _ \u2243 \u03b1 := sigmaFiberEquiv f\n\n/-- If for each `x` we have `p x \u2194 q (f x)`, then `\u03a3 y : {y // q y}, f \u207b\u00b9' {y}` is equivalent\nto `{x // p x}`. -/", "-- Mathlib.Logic.Equiv.Basic.subtypeEquiv_refl (L274-L279)\ntheorem subtypeEquiv_refl {p : \u03b1 \u2192 Prop} (h : \u2200 a, p a \u2194 p (Equiv.refl _ a) := fun _ => Iff.rfl) :\n(Equiv.refl \u03b1).subtypeEquiv h = Equiv.refl { a : \u03b1 // p a } := by\n ext\n rfl\n\n-- We use `as_aux_lemma` here to avoid creating large proof terms when using `simp`", "-- Mathlib.Logic.Equiv.Basic.sigmaSigmaSubtype_symm_apply (L459-L467)\nlemma sigmaSigmaSubtype_symm_apply {\u03b1 : Type*} {\u03b2 : \u03b1 \u2192 Type*} {\u03b3 : (a : \u03b1) \u2192 \u03b2 a \u2192 Type*}\n (p : (a : \u03b1) \u00d7 \u03b2 a \u2192 Prop) [uniq : Unique {ab // p ab}]\n {a : \u03b1} {b : \u03b2 a} (c : \u03b3 a b) (h : p \u27e8a, b\u27e9) :\n (sigmaSigmaSubtype p h).symm c = \u27e8\u27e8a, \u27e8b, c\u27e9\u27e9, h\u27e9 := by\nrw [Equiv.symm_apply_eq]; simp\n\n/-- A specialization of `sigmaSigmaSubtype` to the case where the second base\ndoes not depend on the first, and the property being checked for is simple\nequality. Useful e.g. when `\u03b3` is `Hom` inside a category. -/", "-- Mathlib.Logic.Equiv.Basic.Perm (L63-L65)\ndef Perm.subtypeCongr : Equiv.Perm \u03b5 :=\npermCongr (sumCompl p) (sumCongr ep en)", "-- Mathlib.Logic.Equiv.Basic.intEquivNatSumNat (L232-L237)\ndef intEquivNatSumNat : \u2124 \u2243 \u2115 \u2295 \u2115 where\n toFun z := Int.casesOn z inl inr\ninvFun := Sum.elim Int.ofNat Int.negSucc\n left_inv := by rintro (m | n) <;> rfl\n right_inv := by rintro (m | n) <;> rfl", "-- Mathlib.Logic.Equiv.Basic.swap_swap (L665-L667)\ntheorem swap_swap (a b : \u03b1) : (swap a b).trans (swap a b) = Equiv.refl _ :=\next fun _ => swapCore_swapCore _ _ _", "-- Mathlib.Logic.Equiv.Basic.swap_apply_of_ne_of_ne (L657-L659)\ntheorem swap_apply_of_ne_of_ne {a b x : \u03b1} : x \u2260 a \u2192 x \u2260 b \u2192 swap a b x = x := by\ngrind", "-- Mathlib.Logic.Equiv.Basic.ofFiberEquiv (L191-L194)\ndef ofFiberEquiv {\u03b1 \u03b2 \u03b3} {f : \u03b1 \u2192 \u03b3} {g : \u03b2 \u2192 \u03b3}\n (e : \u2200 c, { a // f a = c } \u2243 { b // g b = c }) : \u03b1 \u2243 \u03b2 :=\n(sigmaFiberEquiv f).symm.trans <| (Equiv.sigmaCongrRight e).trans (sigmaFiberEquiv g)", "-- Mathlib.Logic.Equiv.Basic.subtypeEquivOfSubtype' (L311-L315)\ndef subtypeEquivOfSubtype' {p : \u03b1 \u2192 Prop} (e : \u03b1 \u2243 \u03b2) :\n { a : \u03b1 // p a } \u2243 { b : \u03b2 // p (e.symm b) } :=\ne.symm.subtypeEquivOfSubtype.symm\n\n/-- If two predicates are equal, then the corresponding subtypes are equivalent. -/", "-- Mathlib.Logic.Equiv.Basic.swapCore_comm (L629-L633)\ntheorem swapCore_comm (r a b : \u03b1) : swapCore a b r = swapCore b a r := by\nunfold swapCore; split_ifs <;> grind\n\n/-- `swap a b` is the permutation that swaps `a` and `b` and\n leaves other values as is. -/", "-- Mathlib.Logic.Equiv.Basic.isEmpty_congr (L248-L253)\ntheorem isEmpty_congr (e : \u03b1 \u2243 \u03b2) : IsEmpty \u03b1 \u2194 IsEmpty \u03b2 :=\n\u27e8fun h => @Function.isEmpty _ _ h e.symm, fun h => @Function.isEmpty _ _ h e\u27e9\n\nprotected theorem isEmpty (e : \u03b1 \u2243 \u03b2) [IsEmpty \u03b2] : IsEmpty \u03b1 :=\n e.isEmpty_congr.mpr \u2039_\u203a", "-- Mathlib.Logic.Equiv.Basic.piOptionEquivProd (L44-L53)\ndef piOptionEquivProd {\u03b1} {\u03b2 : Option \u03b1 \u2192 Type*} :\n (\u2200 a : Option \u03b1, \u03b2 a) \u2243 \u03b2 none \u00d7 \u2200 a : \u03b1, \u03b2 (some a) where\n toFun f := (f none, fun a => f (some a))\ninvFun x a := Option.casesOn a x.fst x.snd\n left_inv f := funext fun a => by cases a <;> rfl\n\nsection subtypeCongr\n\n/-- Combines an `Equiv` between two subtypes with an `Equiv` between their complements to form a\n permutation. -/", "-- Mathlib.Logic.Equiv.Basic.subtypeEquivOfSubtype (L306-L310)\ndef subtypeEquivOfSubtype {p : \u03b2 \u2192 Prop} (e : \u03b1 \u2243 \u03b2) : { a : \u03b1 // p (e a) } \u2243 { b : \u03b2 // p b } :=\nsubtypeEquiv e <| by simp\n\n/-- If `\u03b1 \u2243 \u03b2`, then for any predicate `p : \u03b1 \u2192 Prop` the subtype `{a // p a}` is equivalent\nto the subtype `{b // p (e.symm b)}`. This version is used by `equiv_rw`. -/", "-- Mathlib.Logic.Equiv.Basic.sigmaOptionEquivOfSome (L388-L401)\ndef sigmaOptionEquivOfSome {\u03b1} (p : Option \u03b1 \u2192 Type v) (h : p none \u2192 False) :\n (\u03a3 x : Option \u03b1, p x) \u2243 \u03a3 x : \u03b1, p (some x) :=\nhaveI h' : \u2200 x, p x \u2192 x.isSome := by\n intro x\n cases x\n \u00b7 intro n\n exfalso\n exact h n\n \u00b7 intro _\n exact rfl\n (sigmaSubtypeEquivOfSubset _ _ h').symm.trans (sigmaCongrLeft' (optionIsSomeEquiv \u03b1))\n\n/-- The `Pi`-type `\u2200 i, \u03c0 i` is equivalent to the type of sections `f : \u03b9 \u2192 \u03a3 i, \u03c0 i` of the\n`Sigma` type such that for all `i` we have `(f i).fst = i`. -/", "-- Mathlib.Logic.Equiv.Basic.sigmaSigmaSubtypeEq (L468-L474)\ndef sigmaSigmaSubtypeEq {\u03b1 \u03b2 : Type*} {\u03b3 : \u03b1 \u2192 \u03b2 \u2192 Type*} (a : \u03b1) (b : \u03b2) :\n {s : (a : \u03b1) \u00d7 (b : \u03b2) \u00d7 \u03b3 a b // s.1 = a \u2227 s.2.1 = b} \u2243 \u03b3 a b :=\nhave : Unique (@Subtype ((_ : \u03b1) \u00d7 \u03b2) (fun \u27e8a', b'\u27e9 \u21a6 a' = a \u2227 b' = b)) := {\n default := \u27e8\u27e8a, b\u27e9, \u27e8rfl, rfl\u27e9\u27e9\n uniq := by rintro \u27e8\u27e8a', b'\u27e9, \u27e8rfl, rfl\u27e9\u27e9; rfl }\n sigmaSigmaSubtype (fun \u27e8a', b'\u27e9 \u21a6 a' = a \u2227 b' = b) \u27e8rfl, rfl\u27e9", "-- Mathlib.Logic.Equiv.Basic.coe_subtypeEquivCodomain (L507-L511)\ntheorem coe_subtypeEquivCodomain (f : { x' // x' \u2260 x } \u2192 Y) :\n (subtypeEquivCodomain f : _ \u2192 Y) =\n fun g : { g : X \u2192 Y // g \u2218 (\u2191) = f } => (g : X \u2192 Y) x :=\nrfl", "-- Mathlib.Logic.Equiv.Array.Array (L50-L53)\ninstance Array.encodable {\u03b1} [Encodable \u03b1] : Encodable (Array \u03b1) :=\nEncodable.ofEquiv _ (Equiv.arrayEquivList _)\n\n/-- If `\u03b1` is countable, then so is `Array \u03b1`. -/", "-- Mathlib.Logic.Equiv.Basic.subtypeEquivCodomain_symm_apply_eq (L527-L530)\ntheorem subtypeEquivCodomain_symm_apply_eq (f : { x' // x' \u2260 x } \u2192 Y) (y : Y) :\n ((subtypeEquivCodomain f).symm y : X \u2192 Y) x = y :=\ndif_neg (not_not.mpr rfl)", "-- Mathlib.Logic.Equiv.Array.arrayEquivList (L20-L30)\ndef arrayEquivList (\u03b1 : Type*) : Array \u03b1 \u2243 List \u03b1 where\n toFun := Array.toList\ninvFun := Array.mk\n\nend Equiv\n\n/- Porting note: removed instances for what would be ported as `Traversable (Array \u03b1)` and\n`LawfulTraversable (Array \u03b1)`. These would\n\n1. be implemented directly in terms of `Array` functionality for efficiency, rather than being the\ntraversal of some other type transported along an equivalence to `Array \u03b1` (as the traversable", "-- Mathlib.Logic.Equiv.Basic.sigmaNatSucc (L206-L213)\ndef sigmaNatSucc (f : \u2115 \u2192 Type u) : (\u03a3 n, f n) \u2243 f 0 \u2295 \u03a3 n, f (n + 1) :=\n\u27e8fun x =>\n @Sigma.casesOn \u2115 f (fun _ => f 0 \u2295 \u03a3 n, f (n + 1)) x fun n =>\n @Nat.casesOn (fun i => f i \u2192 f 0 \u2295 \u03a3 n : \u2115, f (n + 1)) n (fun x : f 0 => Sum.inl x)\n fun (n : \u2115) (x : f n.succ) => Sum.inr \u27e8n, x\u27e9,\n Sum.elim (Sigma.mk 0) (Sigma.map Nat.succ fun _ => id), by rintro \u27e8n | n, x\u27e9 <;> rfl, by\n rintro (x | \u27e8n, x\u27e9) <;> rfl\u27e9", "-- Mathlib.Logic.Equiv.Basic.symm_swap (L669-L671)\ntheorem symm_swap (a b : \u03b1) : (swap a b).symm = swap a b :=\nrfl", "-- Mathlib.Logic.Equiv.Basic.sigmaAssocProd (L427-L432)\ndef sigmaAssocProd {\u03b1 \u03b2 : Type*} {\u03b3 : \u03b1 \u2192 \u03b2 \u2192 Type*} :\n (ab : \u03b1 \u00d7 \u03b2) \u00d7 \u03b3 ab.1 ab.2 \u2243 (a : \u03b1) \u00d7 (b : \u03b2) \u00d7 \u03b3 a b :=\nsigmaCongrLeft' (sigmaEquivProd _ _).symm |>.trans <| sigmaAssoc \u03b3\n\n/-- A subtype of a sigma which pins down the base of the sigma is equivalent to\nthe respective fiber. -/", "-- Mathlib.Logic.Equiv.Basic.sigmaSigmaSubtypeEq_apply (L476-L480)\nlemma sigmaSigmaSubtypeEq_apply {\u03b1 \u03b2 : Type*} {\u03b3 : \u03b1 \u2192 \u03b2 \u2192 Type*} {a : \u03b1} {b : \u03b2}\n (s : {s : (a : \u03b1) \u00d7 (b : \u03b2) \u00d7 \u03b3 a b // s.1 = a \u2227 s.2.1 = b}) :\n sigmaSigmaSubtypeEq a b s = cast (congrArg\u2082 \u03b3 s.2.1 s.2.2) s.1.2.2 := by\nsimp [sigmaSigmaSubtypeEq]", "-- Mathlib.Logic.Equiv.Basic.natEquivNatSumPUnit (L221-L227)\ndef natEquivNatSumPUnit : \u2115 \u2243 \u2115 \u2295 PUnit where\n toFun n := Nat.casesOn n (inr PUnit.unit) inl\ninvFun := Sum.elim Nat.succ fun _ => 0\n left_inv n := by cases n <;> rfl\n right_inv := by rintro (_ | _) <;> rfl\n\n/-- `\u2115 \u2295 PUnit` is equivalent to `\u2115`. -/"], "source_grounded_context_enriched": false, "statement": "theorem refl_coe : (PartialEquiv.refl \u03b1 : \u03b1 \u2192 \u03b1) = id", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 35348, "declarations_count": 4219, "diagnostics_count": 0, "duplicate_fingerprint": "86b151501bc764ea", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 14577, "lean_code_chars": 32086, "lean_code_ratio": 0.9077, "length_bucket": "long", "line_count": 1096, "natural_language_chars": 3262, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 105, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Equiv.PartialEquiv).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem refl_coe : (PartialEquiv.refl \u03b1 : \u03b1 \u2192 \u03b1) = id\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.Simps (L161-L165)\ndef Simps.symm_apply (e : PartialEquiv \u03b1 \u03b2) : \u03b2 \u2192 \u03b1 :=\ne.symm\n\ninitialize_simps_projections PartialEquiv (toFun \u2192 apply, invFun \u2192 symm_apply)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.coe_mk (L166-L168)\ntheorem coe_mk (f : \u03b1 \u2192 \u03b2) (g s t ml mr il ir) :\n (PartialEquiv.mk f g s t ml mr il ir : \u03b1 \u2192 \u03b2) = f := rfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.coe_symm_mk (L170-L173)\ntheorem coe_symm_mk (f : \u03b1 \u2192 \u03b2) (g s t ml mr il ir) :\n ((PartialEquiv.mk f g s t ml mr il ir).symm : \u03b2 \u2192 \u03b1) = g :=\nrfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.invFun_as_coe (L175-L177)\ntheorem invFun_as_coe : e.invFun = e.symm :=\nrfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.map_source (L179-L182)\ntheorem map_source {x : \u03b1} (h : x \u2208 e.source) : e x \u2208 e.target :=\ne.map_source' h\n\n/-- Variant of `e.map_source` and `map_source'`, stated for images of subsets of `source`. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.map_source'' (L183-L185)\nlemma map_source'' : e '' e.source \u2286 e.target :=\nfun _ \u27e8_, hx, hex\u27e9 \u21a6 mem_of_eq_of_mem (id hex.symm) (e.map_source' hx)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.map_target (L187-L189)\ntheorem map_target {x : \u03b2} (h : x \u2208 e.target) : e.symm x \u2208 e.source :=\ne.map_target' h\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.left_inv (L191-L193)\ntheorem left_inv {x : \u03b1} (h : x \u2208 e.source) : e.symm (e x) = x :=\ne.left_inv' h\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.right_inv (L195-L197)\ntheorem right_inv {x : \u03b2} (h : x \u2208 e.target) : e (e.symm x) = x :=\ne.right_inv' h\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.target_subset_range (L198-L200)\ntheorem target_subset_range : e.target \u2286 range e :=\nfun x hx \u21a6 \u27e8e.symm x, right_inv e hx\u27e9\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.eq_symm_apply (L201-L206)\ntheorem eq_symm_apply {x : \u03b1} {y : \u03b2} (hx : x \u2208 e.source) (hy : y \u2208 e.target) :\n x = e.symm y \u2194 e x = y :=\n\u27e8fun h => by rw [\u2190 e.right_inv hy, h], fun h => by rw [\u2190 e.left_inv hx, h]\u27e9\n\nprotected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.symm_mapsTo (L207-L227)\ntheorem symm_mapsTo : MapsTo e.symm e.target e.source :=\ne.symm.mapsTo\n\nprotected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv\n\nprotected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv\n\nprotected theorem invOn : InvOn e.symm e e.source e.target :=\n \u27e8e.leftInvOn, e.rightInvOn\u27e9\n\nprotected theorem injOn : InjOn e e.source :=\n e.leftInvOn.injOn\n\nprotected theorem bijOn : BijOn e e.source e.target :=\n e.invOn.bijOn e.mapsTo e.symm_mapsTo\n\nprotected theorem surjOn : SurjOn e e.source e.target :=\n e.bijOn.surjOn\n\n/-- Interpret an `Equiv` as a `PartialEquiv` by restricting it to `s` in the domain\nand to `t` in the codomain. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.inhabitedOfEmpty (L248-L251)\ninstance inhabitedOfEmpty [IsEmpty \u03b1] [IsEmpty \u03b2] : Inhabited (PartialEquiv \u03b1 \u03b2) :=\n\u27e8((Equiv.equivEmpty \u03b1).trans (Equiv.equivEmpty \u03b2).symm).toPartialEquiv\u27e9\n\n/-- Create a copy of a `PartialEquiv` providing better definitional equalities. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.copy (L253-L264)\ndef copy (e : PartialEquiv \u03b1 \u03b2) (f : \u03b1 \u2192 \u03b2) (hf : \u21d1e = f) (g : \u03b2 \u2192 \u03b1) (hg : \u21d1e.symm = g) (s : Set \u03b1)\n (hs : e.source = s) (t : Set \u03b2) (ht : e.target = t) :\n PartialEquiv \u03b1 \u03b2 where\n toFun := f\ninvFun := g\n source := s\n target := t\n map_source' _ := ht \u25b8 hs \u25b8 hf \u25b8 e.map_source\n map_target' _ := hs \u25b8 ht \u25b8 hg \u25b8 e.map_target\n left_inv' _ := hs \u25b8 hf \u25b8 hg \u25b8 e.left_inv\n right_inv' _ := ht \u25b8 hf \u25b8 hg \u25b8 e.right_inv\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.copy_eq (L265-L278)\ntheorem copy_eq (e : PartialEquiv \u03b1 \u03b2) (f : \u03b1 \u2192 \u03b2) (hf : \u21d1e = f) (g : \u03b2 \u2192 \u03b1) (hg : \u21d1e.symm = g)\n (s : Set \u03b1) (hs : e.source = s) (t : Set \u03b2) (ht : e.target = t) :\n e.copy f hf g hg s hs t ht = e := by\nsubsts f g s t\n cases e\n rfl\n\n/-- Associate to a `PartialEquiv` an `Equiv` between the source and the target. -/\nprotected def toEquiv : e.source \u2243 e.target where\n toFun x := \u27e8e x, e.map_source x.mem\u27e9\n invFun y := \u27e8e.symm y, e.map_target y.mem\u27e9\n left_inv := fun \u27e8_, hx\u27e9 => Subtype.ext <| e.left_inv hx\n right_inv := fun \u27e8_, hy\u27e9 => Subtype.ext <| e.right_inv hy\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.symm_source (L280-L282)\ntheorem symm_source : e.symm.source = e.target :=\nrfl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.symm_target (L284-L286)\ntheorem symm_target : e.symm.target = e.source :=\nrfl\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.symm_symm (L288-L289)\ntheorem symm_symm : e.symm.symm = e := rfl\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.symm_bijective (L290-L293)\ntheorem symm_bijective :\n Function.Bijective (PartialEquiv.symm : PartialEquiv \u03b1 \u03b2 \u2192 PartialEquiv \u03b2 \u03b1) :=\nFunction.bijective_iff_has_inverse.mpr \u27e8_, symm_symm, symm_symm\u27e9\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.image_source_eq_target (L294-L296)\ntheorem image_source_eq_target : e '' e.source = e.target :=\ne.bijOn.image_eq\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.forall_mem_target (L297-L299)\ntheorem forall_mem_target {p : \u03b2 \u2192 Prop} : (\u2200 y \u2208 e.target, p y) \u2194 \u2200 x \u2208 e.source, p (e x) := by\nrw [\u2190 image_source_eq_target, forall_mem_image]\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.exists_mem_target (L300-L309)\ntheorem exists_mem_target {p : \u03b2 \u2192 Prop} : (\u2203 y \u2208 e.target, p y) \u2194 \u2203 x \u2208 e.source, p (e x) := by\nrw [\u2190 image_source_eq_target, exists_mem_image]\n\n/-- We say that `t : Set \u03b2` is an image of `s : Set \u03b1` under a partial equivalence if\nany of the following equivalent conditions hold:\n\n* `e '' (e.source \u2229 s) = e.target \u2229 t`;\n* `e.source \u2229 e \u207b\u00b9 t = e.source \u2229 s`;\n* `\u2200 x \u2208 e.source, e x \u2208 t \u2194 x \u2208 s` (this one is used in the definition).\n-/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.IsImage (L310-L316)\ndef IsImage (s : Set \u03b1) (t : Set \u03b2) : Prop :=\n\u2200 \u2983x\u2984, x \u2208 e.source \u2192 (e x \u2208 t \u2194 x \u2208 s)\n\nnamespace IsImage\n\nvariable {e} {s : Set \u03b1} {t : Set \u03b2} {x : \u03b1}\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.apply_mem_iff (L317-L319)\ntheorem apply_mem_iff (h : e.IsImage s t) (hx : x \u2208 e.source) : e x \u2208 t \u2194 x \u2208 s :=\nh hx\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.symm_apply_mem_iff (L320-L325)\ntheorem symm_apply_mem_iff (h : e.IsImage s t) : \u2200 \u2983y\u2984, y \u2208 e.target \u2192 (e.symm y \u2208 s \u2194 y \u2208 t) :=\ne.forall_mem_target.mpr fun x hx => by rw [e.left_inv hx, h hx]\n\nprotected theorem symm (h : e.IsImage s t) : e.symm.IsImage t s :=\n h.symm_apply_mem_iff\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Logic.Equiv.Basic.sigmaSigmaSubtype (L448-L457)\ndef sigmaSigmaSubtype {\u03b1 : Type*} {\u03b2 : \u03b1 \u2192 Type*} {\u03b3 : (a : \u03b1) \u2192 \u03b2 a \u2192 Type*}\n (p : (a : \u03b1) \u00d7 \u03b2 a \u2192 Prop) [uniq : Unique {ab // p ab}] {a : \u03b1} {b : \u03b2 a} (h : p \u27e8a, b\u27e9) :\n {s : (a : \u03b1) \u00d7 (b : \u03b2 a) \u00d7 \u03b3 a b // p \u27e8s.1, s.2.1\u27e9} \u2243 \u03b3 a b :=\ncalc {s : (a : \u03b1) \u00d7 (b : \u03b2 a) \u00d7 \u03b3 a b // p \u27e8s.1, s.2.1\u27e9}\n _ \u2243 _ := subtypeEquiv (p := fun \u27e8a, b, c\u27e9 \u21a6 p \u27e8a, b\u27e9) (q := (p \u00b7.1))\n (sigmaAssoc \u03b3).symm fun s \u21a6 by simp [sigmaAssoc]\n _ \u2243 _ := subtypeSigmaEquiv _ _\n _ \u2243 _ := uniqueSigma (fun ab \u21a6 \u03b3 (Sigma.fst <| Subtype.val ab) (Sigma.snd <| Subtype.val ab))\n _ \u2243 \u03b3 a b := Equiv.cast <| by rw [\u2190 show \u27e8\u27e8a, b\u27e9, h\u27e9 = uniq.default from uniq.uniq _]\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Logic.Equiv.Basic.swap_comm (L642-L644)\ntheorem swap_comm (a b : \u03b1) : swap a b = swap b a :=\next fun r => swapCore_comm r _ _\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Logic.Equiv.Basic.swap_comp_apply (L676-L680)\ntheorem swap_comp_apply {a b x : \u03b1} (\u03c0 : Perm \u03b1) :\n \u03c0.trans (swap a b) x = if \u03c0 x = a then b else if \u03c0 x = b then a else \u03c0 x := by\ncases \u03c0\n rfl\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeSubtypeEquivSubtype (L340-L345)\ndef subtypeSubtypeEquivSubtype {\u03b1} {p q : \u03b1 \u2192 Prop} (h : \u2200 {x}, q x \u2192 p x) :\n { x : Subtype p // q x.1 } \u2243 Subtype q :=\n(subtypeSubtypeEquivSubtypeInter p _).trans <| subtypeEquivRight fun _ => and_iff_right_of_imp h\n\n/-- If a proposition holds for all elements, then the subtype is\nequivalent to the original type. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypePreimage_symm_apply_coe_pos (L128-L131)\ntheorem subtypePreimage_symm_apply_coe_pos (x : { a // \u00acp a } \u2192 \u03b2) (a : \u03b1) (h : p a) :\n ((subtypePreimage p x\u2080).symm x : \u03b1 \u2192 \u03b2) a = x\u2080 \u27e8a, h\u27e9 :=\ndif_pos h\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquivProp (L316-L320)\ndef subtypeEquivProp {p q : \u03b1 \u2192 Prop} (h : p = q) : Subtype p \u2243 Subtype q :=\nsubtypeEquiv (Equiv.refl \u03b1) fun _ => h \u25b8 Iff.rfl\n\n/-- A subtype of a subtype is equivalent to the subtype of elements satisfying both predicates. This\nversion allows the \u201cinner\u201d predicate to depend on `h : p a`. -/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquiv_symm (L281-L284)\ntheorem subtypeEquiv_symm {p : \u03b1 \u2192 Prop} {q : \u03b2 \u2192 Prop} (e : \u03b1 \u2243 \u03b2) (h : \u2200 a : \u03b1, p a \u2194 q (e a)) :\n (e.subtypeEquiv h).symm = e.symm.subtypeEquiv (by as_aux_lemma => grind) :=\nrfl\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Logic.Equiv.Basic.piCongrRight_refl (L148-L152)\nlemma piCongrRight_refl {\u03b2 : \u03b1 \u2192 Sort*} : piCongrRight (fun a \u21a6 .refl (\u03b2 a)) = .refl (\u2200 a, \u03b2 a) :=\nrfl\n\n/-- Given `\u03c6 : \u03b1 \u2192 \u03b2 \u2192 Sort*`, we have an equivalence between `\u2200 a b, \u03c6 a b` and `\u2200 b a, \u03c6 a b`.\nThis is `Function.swap` as an `Equiv`. -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Logic.Equiv.Basic.eq_or_eq_of_swap_apply_ne_self (L660-L663)\ntheorem eq_or_eq_of_swap_apply_ne_self {a b x : \u03b1} (h : swap a b x \u2260 x) : x = a \u2228 x = b := by\ncontrapose! h\n exact swap_apply_of_ne_of_ne h.1 h.2\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Logic.Equiv.Basic.ofFiberEquiv_map (L195-L200)\ntheorem ofFiberEquiv_map {\u03b1 \u03b2 \u03b3} {f : \u03b1 \u2192 \u03b3} {g : \u03b2 \u2192 \u03b3}\n (e : \u2200 c, { a // f a = c } \u2243 { b // g b = c }) (a : \u03b1) : g (ofFiberEquiv e a) = f a :=\n(_ : { b // g b = _ }).property\n\nend prodCongr\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeSigmaEquiv (L351-L357)\ndef subtypeSigmaEquiv {\u03b1} (p : \u03b1 \u2192 Type v) (q : \u03b1 \u2192 Prop) : { y : Sigma p // q y.1 } \u2243 \u03a3 x :\n Subtype q, p x.1 :=\n\u27e8fun x => \u27e8\u27e8x.1.1, x.2\u27e9, x.1.2\u27e9, fun x => \u27e8\u27e8x.1.1, x.2\u27e9, x.1.2\u27e9, fun _ => rfl,\n fun _ => rfl\u27e9\n\n/-- A sigma type over a subtype is equivalent to the sigma set over the original type,\nif the fiber is empty outside of the subset -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Logic.Equiv.Basic.swap_self (L639-L641)\ntheorem swap_self (a : \u03b1) : swap a a = Equiv.refl _ :=\next fun r => swapCore_self r a\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Logic.Equiv.Basic.sigmaSigmaSubtypeEq_symm_apply (L482-L485)\nlemma sigmaSigmaSubtypeEq_symm_apply {\u03b1 \u03b2 : Type*} {\u03b3 : \u03b1 \u2192 \u03b2 \u2192 Type*} {a : \u03b1} {b : \u03b2} (c : \u03b3 a b) :\n (sigmaSigmaSubtypeEq a b).symm c = \u27e8\u27e8a, \u27e8b, c\u27e9\u27e9, \u27e8rfl, rfl\u27e9\u27e9 := by\nsimp [sigmaSigmaSubtypeEq]\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Logic.Equiv.Basic.swap_eq_refl_iff (L673-L675)\ntheorem swap_eq_refl_iff {x y : \u03b1} : swap x y = Equiv.refl _ \u2194 x = y :=\n\u27e8fun h => (Equiv.refl _).injective (by grind), by grind\u27e9\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquiv (L262-L268)\ndef subtypeEquiv {p : \u03b1 \u2192 Prop} {q : \u03b2 \u2192 Prop} (e : \u03b1 \u2243 \u03b2) (h : \u2200 a, p a \u2194 q (e a)) :\n { a : \u03b1 // p a } \u2243 { b : \u03b2 // q b } where\n toFun a := \u27e8e a, (h _).mp a.property\u27e9\ninvFun b := \u27e8e.symm b, (h _).mpr ((e.apply_symm_apply b).symm \u25b8 b.property)\u27e9\n left_inv a := Subtype.ext <| by simp\n right_inv b := Subtype.ext <| by simp\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeCongr (L54-L62)\ndef subtypeCongr {\u03b1} {p q : \u03b1 \u2192 Prop} [DecidablePred p] [DecidablePred q]\n (e : { x // p x } \u2243 { x // q x }) (f : { x // \u00acp x } \u2243 { x // \u00acq x }) : Perm \u03b1 :=\n(sumCompl p).symm.trans ((sumCongr e f).trans (sumCompl q))\n\nvariable {\u03b5 : Type*} {p : \u03b5 \u2192 Prop} [DecidablePred p]\nvariable (ep ep' : Perm { a // p a }) (en en' : Perm { a // \u00acp a })\n\n/-- Combining permutations on `\u03b5` that permute only inside or outside the subtype\nsplit induced by `p : \u03b5 \u2192 Prop` constructs a permutation on `\u03b5`. -/\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Logic.Equiv.Basic.swap_apply_right (L654-L656)\ntheorem swap_apply_right (a b : \u03b1) : swap a b b = a := by\ngrind\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Logic.Equiv.Basic.symm_trans_swap_trans (L689-L692)\ntheorem symm_trans_swap_trans [DecidableEq \u03b2] (a b : \u03b1) (e : \u03b1 \u2243 \u03b2) :\n (e.symm.trans (swap a b)).trans e = swap (e a) (e b) := by\ngrind\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypePreimage (L112-L127)\ndef subtypePreimage : { x : \u03b1 \u2192 \u03b2 // x \u2218 Subtype.val = x\u2080 } \u2243 ({ a // \u00acp a } \u2192 \u03b2) where\n toFun (x : { x : \u03b1 \u2192 \u03b2 // x \u2218 Subtype.val = x\u2080 }) a := (x : \u03b1 \u2192 \u03b2) a\ninvFun x := \u27e8fun a => if h : p a then x\u2080 \u27e8a, h\u27e9 else x \u27e8a, h\u27e9, funext fun \u27e8_, h\u27e9 => dif_pos h\u27e9\n left_inv := fun \u27e8x, hx\u27e9 =>\n Subtype.val_injective <|\n funext fun a => by\n dsimp only\n split_ifs\n \u00b7 rw [\u2190 hx]; rfl\n \u00b7 rfl\n right_inv x :=\n funext fun \u27e8a, h\u27e9 =>\n show dite (p a) _ _ = _ by\n dsimp only\n rw [dif_neg h]\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypePreimage_symm_apply_coe_neg (L132-L137)\ntheorem subtypePreimage_symm_apply_coe_neg (x : { a // \u00acp a } \u2192 \u03b2) (a : \u03b1) (h : \u00acp a) :\n ((subtypePreimage p x\u2080).symm x : \u03b1 \u2192 \u03b2) a = x \u27e8a, h\u27e9 :=\ndif_neg h\n\nend subtypePreimage\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Logic.Equiv.Basic.piComm (L154-L156)\ndef piComm (\u03c6 : \u03b1 \u2192 \u03b2 \u2192 Sort*) : (\u2200 a b, \u03c6 a b) \u2243 \u2200 b a, \u03c6 a b :=\n\u27e8swap, swap, fun _ => rfl, fun _ => rfl\u27e9\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquivRight (L295-L297)\ndef subtypeEquivRight {p q : \u03b1 \u2192 Prop} (e : \u2200 x, p x \u2194 q x) : { x // p x } \u2243 { x // q x } :=\nsubtypeEquiv (Equiv.refl _) e\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Logic.Equiv.Basic.natSumPUnitEquivNat (L228-L231)\ndef natSumPUnitEquivNat : \u2115 \u2295 PUnit \u2243 \u2115 :=\nnatEquivNatSumPUnit.symm\n\n/-- The type of integer numbers is equivalent to `\u2115 \u2295 \u2115`. -/\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquivRight_apply (L298-L300)\nlemma subtypeEquivRight_apply {p q : \u03b1 \u2192 Prop} (e : \u2200 x, p x \u2194 q x)\n (z : { x // p x }) : subtypeEquivRight e z = \u27e8z, (e z.1).mp z.2\u27e9 := rfl\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Logic.Equiv.Basic.sigmaSubtypeEquivOfSubset (L358-L363)\ndef sigmaSubtypeEquivOfSubset {\u03b1} (p : \u03b1 \u2192 Type v) (q : \u03b1 \u2192 Prop) (h : \u2200 x, p x \u2192 q x) :\n (\u03a3 x : Subtype q, p x) \u2243 \u03a3 x : \u03b1, p x :=\n(subtypeSigmaEquiv p q).symm.trans <| subtypeUnivEquiv fun x => h x.1 x.2\n\n/-- If a predicate `p : \u03b2 \u2192 Prop` is true on the range of a map `f : \u03b1 \u2192 \u03b2`, then\n`\u03a3 y : {y // p y}, {x // f x = y}` is equivalent to `\u03b1`. -/\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Logic.Equiv.Basic.coe_subtypeEquiv_eq_map (L269-L272)\nlemma coe_subtypeEquiv_eq_map {X Y} {p : X \u2192 Prop} {q : Y \u2192 Prop} (e : X \u2243 Y)\n (h : \u2200 x, p x \u2194 q (e x)) : \u21d1(e.subtypeEquiv h) = Subtype.map e (h \u00b7 |>.mp) :=\nrfl\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Logic.Equiv.Basic.comp_swap_eq_update (L684-L687)\ntheorem comp_swap_eq_update (i j : \u03b1) (f : \u03b1 \u2192 \u03b2) :\n f \u2218 Equiv.swap i j = update (update f j (f i)) i (f j) := by\ngrind\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Logic.Equiv.Basic.swap_eq_update (L681-L683)\ntheorem swap_eq_update (i j : \u03b1) : (Equiv.swap i j : \u03b1 \u2192 \u03b1) = update (update id j i) i j := by\ngrind\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeQuotientEquivQuotientSubtype_mk (L601-L606)\ntheorem subtypeQuotientEquivQuotientSubtype_mk (p\u2081 : \u03b1 \u2192 Prop)\n [s\u2081 : Setoid \u03b1] [s\u2082 : Setoid (Subtype p\u2081)] (p\u2082 : Quotient s\u2081 \u2192 Prop) (hp\u2082 : \u2200 a, p\u2081 a \u2194 p\u2082 \u27e6a\u27e7)\n (h : \u2200 x y : Subtype p\u2081, s\u2082 x y \u2194 (x : \u03b1) \u2248 y)\n (x hx) : subtypeQuotientEquivQuotientSubtype p\u2081 p\u2082 hp\u2082 h \u27e8\u27e6x\u27e7, hx\u27e9 = \u27e6\u27e8x, (hp\u2082 _).2 hx\u27e9\u27e7 :=\nrfl\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Logic.Equiv.Basic.piCongrRight (L143-L146)\ndef piCongrRight {\u03b2\u2081 \u03b2\u2082 : \u03b1 \u2192 Sort*} (F : \u2200 a, \u03b2\u2081 a \u2243 \u03b2\u2082 a) : (\u2200 a, \u03b2\u2081 a) \u2243 (\u2200 a, \u03b2\u2082 a) :=\n\u27e8Pi.map fun a \u21a6 F a, Pi.map fun a \u21a6 (F a).symm, fun H => funext <| by simp,\n fun H => funext <| by simp\u27e9\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Logic.Equiv.Basic.piEquivSubtypeSigma (L402-L411)\ndef piEquivSubtypeSigma (\u03b9) (\u03c0 : \u03b9 \u2192 Type*) :\n (\u2200 i, \u03c0 i) \u2243 { f : \u03b9 \u2192 \u03a3 i, \u03c0 i // \u2200 i, (f i).1 = i } where\n toFun := fun f => \u27e8fun i => \u27e8i, f i\u27e9, fun _ => rfl\u27e9\ninvFun := fun f i => by rw [\u2190 f.2 i]; exact (f.1 i).2\n right_inv := fun \u27e8f, hf\u27e9 =>\n Subtype.ext <| funext fun i =>\n Sigma.eq (hf i).symm <| eq_of_heq <| rec_heq_of_heq _ <| by simp\n\n/-- The type of functions `f : \u2200 a, \u03b2 a` such that for all `a` we have `p a (f a)` is equivalent\nto the type of functions `\u2200 a, {b : \u03b2 a // p a b}`. -/\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Logic.Equiv.Basic.swapCore_self (L622-L625)\ntheorem swapCore_self (r a : \u03b1) : swapCore a a r = r := by\nunfold swapCore\n split_ifs <;> simp [*]\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Logic.Equiv.Basic.sigmaSubtypeFiberEquivSubtype (L372-L387)\ndef sigmaSubtypeFiberEquivSubtype {\u03b1 \u03b2 : Type*} (f : \u03b1 \u2192 \u03b2) {p : \u03b1 \u2192 Prop} {q : \u03b2 \u2192 Prop}\n (h : \u2200 x, p x \u2194 q (f x)) : (\u03a3 y : Subtype q, { x : \u03b1 // f x = y }) \u2243 Subtype p :=\ncalc\n (\u03a3 y : Subtype q, { x : \u03b1 // f x = y }) \u2243 \u03a3 y :\n Subtype q, { x : Subtype p // Subtype.mk (f x) ((h x).1 x.2) = y } := by {\n apply sigmaCongrRight\n intro y\n apply Equiv.symm\n refine (subtypeSubtypeEquivSubtypeExists _ _).trans (subtypeEquivRight ?_)\n intro x\n exact \u27e8fun \u27e8hp, h'\u27e9 => congr_arg Subtype.val h', fun h' => \u27e8(h x).2 (h'.symm \u25b8 y.2),\n Subtype.ext h'\u27e9\u27e9 }\n _ \u2243 Subtype p := sigmaFiberEquiv fun x : Subtype p => (\u27e8f x, (h x).1 x.property\u27e9 : Subtype q)\n\n/-- A sigma type over an `Option` is equivalent to the sigma set over the original type,\nif the fiber is empty at none. -/\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Logic.Equiv.Basic.swap_apply_def (L646-L648)\ntheorem swap_apply_def (a b x : \u03b1) : swap a b x = if x = a then b else if x = b then a else x :=\nrfl\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Logic.Equiv.Basic.piCurry (L165-L172)\ndef piCurry {\u03b1} {\u03b2 : \u03b1 \u2192 Type*} (\u03b3 : \u2200 a, \u03b2 a \u2192 Type*) :\n (\u2200 x : \u03a3 i, \u03b2 i, \u03b3 x.1 x.2) \u2243 \u2200 a b, \u03b3 a b where\n toFun := Sigma.curry\ninvFun := Sigma.uncurry\n left_inv := Sigma.uncurry_curry\n right_inv := Sigma.curry_uncurry\n\n-- `simps` overapplies these but `simps -fullyApplied` under-applies them\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Logic.Equiv.Basic.swap_apply_left (L650-L652)\ntheorem swap_apply_left (a b : \u03b1) : swap a b a = b :=\nif_pos rfl\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeQuotientEquivQuotientSubtype_symm_mk (L608-L618)\ntheorem subtypeQuotientEquivQuotientSubtype_symm_mk (p\u2081 : \u03b1 \u2192 Prop)\n [s\u2081 : Setoid \u03b1] [s\u2082 : Setoid (Subtype p\u2081)] (p\u2082 : Quotient s\u2081 \u2192 Prop) (hp\u2082 : \u2200 a, p\u2081 a \u2194 p\u2082 \u27e6a\u27e7)\n (h : \u2200 x y : Subtype p\u2081, s\u2082 x y \u2194 (x : \u03b1) \u2248 y) (x) :\n (subtypeQuotientEquivQuotientSubtype p\u2081 p\u2082 hp\u2082 h).symm \u27e6x\u27e7 = \u27e8\u27e6x\u27e7, (hp\u2082 _).1 x.property\u27e9 :=\nrfl\n\nsection Swap\n\nvariable [DecidableEq \u03b1]\n\n/-- A helper function for `Equiv.swap`. -/\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquivCodomain_apply (L513-L516)\ntheorem subtypeEquivCodomain_apply (f : { x' // x' \u2260 x } \u2192 Y) (g) :\n subtypeEquivCodomain f g = (g : X \u2192 Y) x :=\nrfl\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeUnivEquiv (L347-L350)\ndef subtypeUnivEquiv {\u03b1} {p : \u03b1 \u2192 Prop} (h : \u2200 x, p x) : Subtype p \u2243 \u03b1 :=\n\u27e8fun x => x, fun x => \u27e8x, h x\u27e9, fun _ => Subtype.ext rfl, fun _ => rfl\u27e9\n\n/-- A subtype of a sigma-type is a sigma-type over a subtype. -/\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquivCodomain (L496-L505)\ndef subtypeEquivCodomain (f : { x' // x' \u2260 x } \u2192 Y) :\n { g : X \u2192 Y // g \u2218 (\u2191) = f } \u2243 Y :=\n(subtypePreimage _ f).trans <|\n @funUnique { x' // \u00acx' \u2260 x } _ <|\n show Unique { x' // \u00acx' \u2260 x } from\n @Equiv.unique _ _\n (show Unique { x' // x' = x } from {\n default := \u27e8x, rfl\u27e9, uniq := fun \u27e8_, h\u27e9 => Subtype.val_injective h })\n (subtypeEquivRight fun _ => not_not)\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeQuotientEquivQuotientSubtype (L583-L599)\ndef subtypeQuotientEquivQuotientSubtype (p\u2081 : \u03b1 \u2192 Prop) {s\u2081 : Setoid \u03b1} {s\u2082 : Setoid (Subtype p\u2081)}\n (p\u2082 : Quotient s\u2081 \u2192 Prop) (hp\u2082 : \u2200 a, p\u2081 a \u2194 p\u2082 \u27e6a\u27e7)\n (h : \u2200 x y : Subtype p\u2081, s\u2082.r x y \u2194 s\u2081.r x y) : {x // p\u2082 x} \u2243 Quotient s\u2082 where\n toFun a :=\nQuotient.hrecOn a.1 (fun a h => \u27e6\u27e8a, (hp\u2082 _).2 h\u27e9\u27e7)\n (fun a b hab => hfunext (by rw [Quotient.sound hab]) fun _ _ _ =>\n heq_of_eq (Quotient.sound ((h _ _).2 hab)))\n a.2\n invFun a :=\n Quotient.liftOn a (fun a => (\u27e8\u27e6a.1\u27e7, (hp\u2082 _).1 a.2\u27e9 : { x // p\u2082 x })) fun _ _ hab =>\n Subtype.ext (Quotient.sound ((h _ _).1 hab))\n left_inv a := by\n obtain \u27e8a, ha\u27e9 := a\n induction a using Quotient.inductionOn\n rfl\n right_inv a := by induction a using Quotient.inductionOn; rfl\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Logic.Equiv.Basic.coe_subtypeEquivCodomain_symm (L517-L521)\ntheorem coe_subtypeEquivCodomain_symm (f : { x' // x' \u2260 x } \u2192 Y) :\n ((subtypeEquivCodomain f).symm : Y \u2192 _) = fun y =>\n \u27e8fun x' => if h : x' \u2260 x then f \u27e8x', h\u27e9 else y, by grind\u27e9 :=\nrfl\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Logic.Equiv.Basic.swapCore_swapCore (L626-L628)\ntheorem swapCore_swapCore (r a b : \u03b1) : swapCore a b (swapCore a b r) = r := by\nunfold swapCore; split_ifs <;> grind\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Logic.Equiv.Array.for (L31-L49)\ninstance for `array` was)\n\n2. belong in `Mathlib/Control/Traversable/Instances.lean` instead of this file. -/\n\n-- namespace Array'\n\n-- open Function\n\n-- variable {n : \u2115}\n-- instance : Traversable (Array' n) :=\n-- @Equiv.traversable (flip Vector n) _ (fun \u03b1 => Equiv.vectorEquivArray \u03b1 n) _\n\n-- instance : LawfulTraversable (Array' n) :=\n-- @Equiv.isLawfulTraversable (flip Vector n) _ (fun \u03b1 => Equiv.vectorEquivArray \u03b1 n) _ _\n\n-- end Array'\n\n/-- If `\u03b1` is encodable, then so is `Array \u03b1`. -/\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Logic.Equiv.Basic.swap (L634-L637)\ndef swap (a b : \u03b1) : Perm \u03b1 :=\n\u27e8swapCore a b, swapCore a b, fun r => swapCore_swapCore r a b,\n fun r => swapCore_swapCore r a b\u27e9\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquiv_trans (L286-L293)\ntheorem subtypeEquiv_trans {p : \u03b1 \u2192 Prop} {q : \u03b2 \u2192 Prop} {r : \u03b3 \u2192 Prop} (e : \u03b1 \u2243 \u03b2) (f : \u03b2 \u2243 \u03b3)\n (h : \u2200 a : \u03b1, p a \u2194 q (e a)) (h' : \u2200 b : \u03b2, q b \u2194 r (f b)) :\n (e.subtypeEquiv h).trans (f.subtypeEquiv h')\n = (e.trans f).subtypeEquiv (by as_aux_lemma => exact fun a => (h a).trans (h' <| e a)) :=\nrfl\n\n/-- If two predicates `p` and `q` are pointwise equivalent, then `{x // p x}` is equivalent to\n`{x // q x}`. -/\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeSubtypeEquivSubtypeExists (L322-L330)\ndef subtypeSubtypeEquivSubtypeExists (p : \u03b1 \u2192 Prop) (q : Subtype p \u2192 Prop) :\n Subtype q \u2243 { a : \u03b1 // \u2203 h : p a, q \u27e8a, h\u27e9 } :=\n\u27e8fun a =>\n \u27e8a.1, a.1.2, by\n rcases a with \u27e8\u27e8a, hap\u27e9, haq\u27e9\n exact haq\u27e9,\n fun a => \u27e8\u27e8a, a.2.fst\u27e9, a.2.snd\u27e9, fun \u27e8\u27e8_, _\u27e9, _\u27e9 => rfl, fun \u27e8_, _, _\u27e9 => rfl\u27e9\n\n/-- A subtype of a subtype is equivalent to the subtype of elements satisfying both predicates. -/\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypePiEquivPi (L412-L425)\ndef subtypePiEquivPi {\u03b2 : \u03b1 \u2192 Sort v} {p : \u2200 a, \u03b2 a \u2192 Prop} :\n { f : \u2200 a, \u03b2 a // \u2200 a, p a (f a) } \u2243 \u2200 a, { b : \u03b2 a // p a b } where\n toFun := fun f a => \u27e8f.1 a, f.2 a\u27e9\ninvFun := fun f => \u27e8fun a => (f a).1, fun a => (f a).2\u27e9\n left_inv := by\n rintro \u27e8f, h\u27e9\n rfl\n right_inv := by\n rintro f\n funext a\n exact Subtype.ext rfl\n\n/-- A sigma of a sigma whose second base does not depend on the first is equivalent\nto a sigma whose base is a product. -/\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Logic.Equiv.Basic.sigmaSubtype (L434-L441)\ndef sigmaSubtype {\u03b1 : Type*} {\u03b2 : \u03b1 \u2192 Type*} (a : \u03b1) :\n {s : Sigma \u03b2 // s.1 = a} \u2243 \u03b2 a where\n toFun := fun \u27e8\u27e8_, b\u27e9, h\u27e9 => h \u25b8 b\ninvFun b := \u27e8\u27e8a, b\u27e9, rfl\u27e9\n left_inv := fun \u27e8a, h\u27e9 \u21a6 by cases h; simp\n right_inv b := by simp\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquivRight_symm_apply (L301-L305)\nlemma subtypeEquivRight_symm_apply {p q : \u03b1 \u2192 Prop} (e : \u2200 x, p x \u2194 q x)\n (z : { x // q x }) : (subtypeEquivRight e).symm z = \u27e8z, (e z.1).mpr z.2\u27e9 := rfl\n/-- If `\u03b1 \u2243 \u03b2`, then for any predicate `p : \u03b2 \u2192 Prop` the subtype `{a // p (e a)}` is equivalent\nto the subtype `{b // p b}`. -/\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquivCodomain_symm_apply (L523-L526)\ntheorem subtypeEquivCodomain_symm_apply (f : { x' // x' \u2260 x } \u2192 Y) (y : Y) (x' : X) :\n ((subtypeEquivCodomain f).symm y : X \u2192 Y) x' = if h : x' \u2260 x then f \u27e8x', h\u27e9 else y :=\nrfl\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquivCodomain_symm_apply_ne (L531-L537)\ntheorem subtypeEquivCodomain_symm_apply_ne\n (f : { x' // x' \u2260 x } \u2192 Y) (y : Y) (x' : X) (h : x' \u2260 x) :\n ((subtypeEquivCodomain f).symm y : X \u2192 Y) x' = f \u27e8x', h\u27e9 :=\ndif_pos h\n\nend subtypeEquivCodomain\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Logic.Equiv.Basic.uniqueCongr (L241-L247)\ndef uniqueCongr (e : \u03b1 \u2243 \u03b2) : Unique \u03b1 \u2243 Unique \u03b2 where\n toFun h := @Equiv.unique _ _ h e.symm\ninvFun h := @Equiv.unique _ _ h e\n left_inv _ := Subsingleton.elim _ _\n right_inv _ := Subsingleton.elim _ _\n\n/-- If `\u03b1` is equivalent to `\u03b2`, then `IsEmpty \u03b1` is equivalent to `IsEmpty \u03b2`. -/\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Logic.Equiv.Basic.swapCore (L619-L621)\ndef swapCore (a b r : \u03b1) : \u03b1 :=\nif r = a then b else if r = b then a else r\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Logic.Equiv.Basic.piComm_symm (L158-L164)\ntheorem piComm_symm {\u03c6 : \u03b1 \u2192 \u03b2 \u2192 Sort*} : (piComm \u03c6).symm = (piComm <| swap \u03c6) :=\nrfl\n\n/-- Dependent `curry` equivalence: the type of dependent functions on `\u03a3 i, \u03b2 i` is equivalent\nto the type of dependent functions of two arguments (i.e., functions to the space of functions).\n\nThis is `Sigma.curry` and `Sigma.uncurry` together as an equiv. -/\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeSubtypeEquivSubtypeInter (L332-L338)\ndef subtypeSubtypeEquivSubtypeInter {\u03b1 : Type u} (p q : \u03b1 \u2192 Prop) :\n { x : Subtype p // q x.1 } \u2243 Subtype fun x => p x \u2227 q x :=\n(subtypeSubtypeEquivSubtypeExists p _).trans <|\n subtypeEquivRight fun x => @exists_prop (q x) (p x)\n\n/-- If the outer subtype has more restrictive predicate than the inner one,\nthen we can drop the latter. -/\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Logic.Equiv.Basic.sigmaSubtypeFiberEquiv (L364-L371)\ndef sigmaSubtypeFiberEquiv {\u03b1 \u03b2 : Type*} (f : \u03b1 \u2192 \u03b2) (p : \u03b2 \u2192 Prop) (h : \u2200 x, p (f x)) :\n (\u03a3 y : Subtype p, { x : \u03b1 // f x = y }) \u2243 \u03b1 :=\ncalc\n _ \u2243 \u03a3 y : \u03b2, { x : \u03b1 // f x = y } := sigmaSubtypeEquivOfSubset _ p fun _ \u27e8x, h'\u27e9 => h' \u25b8 h x\n _ \u2243 \u03b1 := sigmaFiberEquiv f\n\n/-- If for each `x` we have `p x \u2194 q (f x)`, then `\u03a3 y : {y // q y}, f \u207b\u00b9' {y}` is equivalent\nto `{x // p x}`. -/\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquiv_refl (L274-L279)\ntheorem subtypeEquiv_refl {p : \u03b1 \u2192 Prop} (h : \u2200 a, p a \u2194 p (Equiv.refl _ a) := fun _ => Iff.rfl) :\n(Equiv.refl \u03b1).subtypeEquiv h = Equiv.refl { a : \u03b1 // p a } := by\n ext\n rfl\n\n-- We use `as_aux_lemma` here to avoid creating large proof terms when using `simp`\n```\n\n-- snippet 84\n```lean\n-- Mathlib.Logic.Equiv.Basic.sigmaSigmaSubtype_symm_apply (L459-L467)\nlemma sigmaSigmaSubtype_symm_apply {\u03b1 : Type*} {\u03b2 : \u03b1 \u2192 Type*} {\u03b3 : (a : \u03b1) \u2192 \u03b2 a \u2192 Type*}\n (p : (a : \u03b1) \u00d7 \u03b2 a \u2192 Prop) [uniq : Unique {ab // p ab}]\n {a : \u03b1} {b : \u03b2 a} (c : \u03b3 a b) (h : p \u27e8a, b\u27e9) :\n (sigmaSigmaSubtype p h).symm c = \u27e8\u27e8a, \u27e8b, c\u27e9\u27e9, h\u27e9 := by\nrw [Equiv.symm_apply_eq]; simp\n\n/-- A specialization of `sigmaSigmaSubtype` to the case where the second base\ndoes not depend on the first, and the property being checked for is simple\nequality. Useful e.g. when `\u03b3` is `Hom` inside a category. -/\n```\n\n-- snippet 85\n```lean\n-- Mathlib.Logic.Equiv.Basic.Perm (L63-L65)\ndef Perm.subtypeCongr : Equiv.Perm \u03b5 :=\npermCongr (sumCompl p) (sumCongr ep en)\n```\n\n-- snippet 86\n```lean\n-- Mathlib.Logic.Equiv.Basic.intEquivNatSumNat (L232-L237)\ndef intEquivNatSumNat : \u2124 \u2243 \u2115 \u2295 \u2115 where\n toFun z := Int.casesOn z inl inr\ninvFun := Sum.elim Int.ofNat Int.negSucc\n left_inv := by rintro (m | n) <;> rfl\n right_inv := by rintro (m | n) <;> rfl\n```\n\n-- snippet 87\n```lean\n-- Mathlib.Logic.Equiv.Basic.swap_swap (L665-L667)\ntheorem swap_swap (a b : \u03b1) : (swap a b).trans (swap a b) = Equiv.refl _ :=\next fun _ => swapCore_swapCore _ _ _\n```\n\n-- snippet 88\n```lean\n-- Mathlib.Logic.Equiv.Basic.swap_apply_of_ne_of_ne (L657-L659)\ntheorem swap_apply_of_ne_of_ne {a b x : \u03b1} : x \u2260 a \u2192 x \u2260 b \u2192 swap a b x = x := by\ngrind\n```\n\n-- snippet 89\n```lean\n-- Mathlib.Logic.Equiv.Basic.ofFiberEquiv (L191-L194)\ndef ofFiberEquiv {\u03b1 \u03b2 \u03b3} {f : \u03b1 \u2192 \u03b3} {g : \u03b2 \u2192 \u03b3}\n (e : \u2200 c, { a // f a = c } \u2243 { b // g b = c }) : \u03b1 \u2243 \u03b2 :=\n(sigmaFiberEquiv f).symm.trans <| (Equiv.sigmaCongrRight e).trans (sigmaFiberEquiv g)\n```\n\n-- snippet 90\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquivOfSubtype' (L311-L315)\ndef subtypeEquivOfSubtype' {p : \u03b1 \u2192 Prop} (e : \u03b1 \u2243 \u03b2) :\n { a : \u03b1 // p a } \u2243 { b : \u03b2 // p (e.symm b) } :=\ne.symm.subtypeEquivOfSubtype.symm\n\n/-- If two predicates are equal, then the corresponding subtypes are equivalent. -/\n```\n\n-- snippet 91\n```lean\n-- Mathlib.Logic.Equiv.Basic.swapCore_comm (L629-L633)\ntheorem swapCore_comm (r a b : \u03b1) : swapCore a b r = swapCore b a r := by\nunfold swapCore; split_ifs <;> grind\n\n/-- `swap a b` is the permutation that swaps `a` and `b` and\n leaves other values as is. -/\n```\n\n-- snippet 92\n```lean\n-- Mathlib.Logic.Equiv.Basic.isEmpty_congr (L248-L253)\ntheorem isEmpty_congr (e : \u03b1 \u2243 \u03b2) : IsEmpty \u03b1 \u2194 IsEmpty \u03b2 :=\n\u27e8fun h => @Function.isEmpty _ _ h e.symm, fun h => @Function.isEmpty _ _ h e\u27e9\n\nprotected theorem isEmpty (e : \u03b1 \u2243 \u03b2) [IsEmpty \u03b2] : IsEmpty \u03b1 :=\n e.isEmpty_congr.mpr \u2039_\u203a\n```\n\n-- snippet 93\n```lean\n-- Mathlib.Logic.Equiv.Basic.piOptionEquivProd (L44-L53)\ndef piOptionEquivProd {\u03b1} {\u03b2 : Option \u03b1 \u2192 Type*} :\n (\u2200 a : Option \u03b1, \u03b2 a) \u2243 \u03b2 none \u00d7 \u2200 a : \u03b1, \u03b2 (some a) where\n toFun f := (f none, fun a => f (some a))\ninvFun x a := Option.casesOn a x.fst x.snd\n left_inv f := funext fun a => by cases a <;> rfl\n\nsection subtypeCongr\n\n/-- Combines an `Equiv` between two subtypes with an `Equiv` between their complements to form a\n permutation. -/\n```\n\n-- snippet 94\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquivOfSubtype (L306-L310)\ndef subtypeEquivOfSubtype {p : \u03b2 \u2192 Prop} (e : \u03b1 \u2243 \u03b2) : { a : \u03b1 // p (e a) } \u2243 { b : \u03b2 // p b } :=\nsubtypeEquiv e <| by simp\n\n/-- If `\u03b1 \u2243 \u03b2`, then for any predicate `p : \u03b1 \u2192 Prop` the subtype `{a // p a}` is equivalent\nto the subtype `{b // p (e.symm b)}`. This version is used by `equiv_rw`. -/\n```\n\n-- snippet 95\n```lean\n-- Mathlib.Logic.Equiv.Basic.sigmaOptionEquivOfSome (L388-L401)\ndef sigmaOptionEquivOfSome {\u03b1} (p : Option \u03b1 \u2192 Type v) (h : p none \u2192 False) :\n (\u03a3 x : Option \u03b1, p x) \u2243 \u03a3 x : \u03b1, p (some x) :=\nhaveI h' : \u2200 x, p x \u2192 x.isSome := by\n intro x\n cases x\n \u00b7 intro n\n exfalso\n exact h n\n \u00b7 intro _\n exact rfl\n (sigmaSubtypeEquivOfSubset _ _ h').symm.trans (sigmaCongrLeft' (optionIsSomeEquiv \u03b1))\n\n/-- The `Pi`-type `\u2200 i, \u03c0 i` is equivalent to the type of sections `f : \u03b9 \u2192 \u03a3 i, \u03c0 i` of the\n`Sigma` type such that for all `i` we have `(f i).fst = i`. -/\n```\n\n-- snippet 96\n```lean\n-- Mathlib.Logic.Equiv.Basic.sigmaSigmaSubtypeEq (L468-L474)\ndef sigmaSigmaSubtypeEq {\u03b1 \u03b2 : Type*} {\u03b3 : \u03b1 \u2192 \u03b2 \u2192 Type*} (a : \u03b1) (b : \u03b2) :\n {s : (a : \u03b1) \u00d7 (b : \u03b2) \u00d7 \u03b3 a b // s.1 = a \u2227 s.2.1 = b} \u2243 \u03b3 a b :=\nhave : Unique (@Subtype ((_ : \u03b1) \u00d7 \u03b2) (fun \u27e8a', b'\u27e9 \u21a6 a' = a \u2227 b' = b)) := {\n default := \u27e8\u27e8a, b\u27e9, \u27e8rfl, rfl\u27e9\u27e9\n uniq := by rintro \u27e8\u27e8a', b'\u27e9, \u27e8rfl, rfl\u27e9\u27e9; rfl }\n sigmaSigmaSubtype (fun \u27e8a', b'\u27e9 \u21a6 a' = a \u2227 b' = b) \u27e8rfl, rfl\u27e9\n```\n\n-- snippet 97\n```lean\n-- Mathlib.Logic.Equiv.Basic.coe_subtypeEquivCodomain (L507-L511)\ntheorem coe_subtypeEquivCodomain (f : { x' // x' \u2260 x } \u2192 Y) :\n (subtypeEquivCodomain f : _ \u2192 Y) =\n fun g : { g : X \u2192 Y // g \u2218 (\u2191) = f } => (g : X \u2192 Y) x :=\nrfl\n```\n\n-- snippet 98\n```lean\n-- Mathlib.Logic.Equiv.Array.Array (L50-L53)\ninstance Array.encodable {\u03b1} [Encodable \u03b1] : Encodable (Array \u03b1) :=\nEncodable.ofEquiv _ (Equiv.arrayEquivList _)\n\n/-- If `\u03b1` is countable, then so is `Array \u03b1`. -/\n```\n\n-- snippet 99\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquivCodomain_symm_apply_eq (L527-L530)\ntheorem subtypeEquivCodomain_symm_apply_eq (f : { x' // x' \u2260 x } \u2192 Y) (y : Y) :\n ((subtypeEquivCodomain f).symm y : X \u2192 Y) x = y :=\ndif_neg (not_not.mpr rfl)\n```\n\n-- snippet 100\n```lean\n-- Mathlib.Logic.Equiv.Array.arrayEquivList (L20-L30)\ndef arrayEquivList (\u03b1 : Type*) : Array \u03b1 \u2243 List \u03b1 where\n toFun := Array.toList\ninvFun := Array.mk\n\nend Equiv\n\n/- Porting note: removed instances for what would be ported as `Traversable (Array \u03b1)` and\n`LawfulTraversable (Array \u03b1)`. These would\n\n1. be implemented directly in terms of `Array` functionality for efficiency, rather than being the\ntraversal of some other type transported along an equivalence to `Array \u03b1` (as the traversable\n```\n\n-- snippet 101\n```lean\n-- Mathlib.Logic.Equiv.Basic.sigmaNatSucc (L206-L213)\ndef sigmaNatSucc (f : \u2115 \u2192 Type u) : (\u03a3 n, f n) \u2243 f 0 \u2295 \u03a3 n, f (n + 1) :=\n\u27e8fun x =>\n @Sigma.casesOn \u2115 f (fun _ => f 0 \u2295 \u03a3 n, f (n + 1)) x fun n =>\n @Nat.casesOn (fun i => f i \u2192 f 0 \u2295 \u03a3 n : \u2115, f (n + 1)) n (fun x : f 0 => Sum.inl x)\n fun (n : \u2115) (x : f n.succ) => Sum.inr \u27e8n, x\u27e9,\n Sum.elim (Sigma.mk 0) (Sigma.map Nat.succ fun _ => id), by rintro \u27e8n | n, x\u27e9 <;> rfl, by\n rintro (x | \u27e8n, x\u27e9) <;> rfl\u27e9\n```\n\n-- snippet 102\n```lean\n-- Mathlib.Logic.Equiv.Basic.symm_swap (L669-L671)\ntheorem symm_swap (a b : \u03b1) : (swap a b).symm = swap a b :=\nrfl\n```\n\n-- snippet 103\n```lean\n-- Mathlib.Logic.Equiv.Basic.sigmaAssocProd (L427-L432)\ndef sigmaAssocProd {\u03b1 \u03b2 : Type*} {\u03b3 : \u03b1 \u2192 \u03b2 \u2192 Type*} :\n (ab : \u03b1 \u00d7 \u03b2) \u00d7 \u03b3 ab.1 ab.2 \u2243 (a : \u03b1) \u00d7 (b : \u03b2) \u00d7 \u03b3 a b :=\nsigmaCongrLeft' (sigmaEquivProd _ _).symm |>.trans <| sigmaAssoc \u03b3\n\n/-- A subtype of a sigma which pins down the base of the sigma is equivalent to\nthe respective fiber. -/\n```\n\n-- snippet 104\n```lean\n-- Mathlib.Logic.Equiv.Basic.sigmaSigmaSubtypeEq_apply (L476-L480)\nlemma sigmaSigmaSubtypeEq_apply {\u03b1 \u03b2 : Type*} {\u03b3 : \u03b1 \u2192 \u03b2 \u2192 Type*} {a : \u03b1} {b : \u03b2}\n (s : {s : (a : \u03b1) \u00d7 (b : \u03b2) \u00d7 \u03b3 a b // s.1 = a \u2227 s.2.1 = b}) :\n sigmaSigmaSubtypeEq a b s = cast (congrArg\u2082 \u03b3 s.2.1 s.2.2) s.1.2.2 := by\nsimp [sigmaSigmaSubtypeEq]\n```\n\n-- snippet 105\n```lean\n-- Mathlib.Logic.Equiv.Basic.natEquivNatSumPUnit (L221-L227)\ndef natEquivNatSumPUnit : \u2115 \u2243 \u2115 \u2295 PUnit where\n toFun n := Nat.casesOn n (inr PUnit.unit) inl\ninvFun := Sum.elim Nat.succ fun _ => 0\n left_inv n := by cases n <;> rfl\n right_inv := by rintro (_ | _) <;> rfl\n\n/-- `\u2115 \u2295 PUnit` is equivalent to `\u2115`. -/\n```\n", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.Equiv.PartialEquiv).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem refl_coe : (PartialEquiv.refl \u03b1 : \u03b1 \u2192 \u03b1) = id\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.Simps (L161-L165)\ndef Simps.symm_apply (e : PartialEquiv \u03b1 \u03b2) : \u03b2 \u2192 \u03b1 :=\ne.symm\n\ninitialize_simps_projections PartialEquiv (toFun \u2192 apply, invFun \u2192 symm_apply)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.coe_mk (L166-L168)\ntheorem coe_mk (f : \u03b1 \u2192 \u03b2) (g s t ml mr il ir) :\n (PartialEquiv.mk f g s t ml mr il ir : \u03b1 \u2192 \u03b2) = f := rfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.coe_symm_mk (L170-L173)\ntheorem coe_symm_mk (f : \u03b1 \u2192 \u03b2) (g s t ml mr il ir) :\n ((PartialEquiv.mk f g s t ml mr il ir).symm : \u03b2 \u2192 \u03b1) = g :=\nrfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.invFun_as_coe (L175-L177)\ntheorem invFun_as_coe : e.invFun = e.symm :=\nrfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.map_source (L179-L182)\ntheorem map_source {x : \u03b1} (h : x \u2208 e.source) : e x \u2208 e.target :=\ne.map_source' h\n\n/-- Variant of `e.map_source` and `map_source'`, stated for images of subsets of `source`. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.map_source'' (L183-L185)\nlemma map_source'' : e '' e.source \u2286 e.target :=\nfun _ \u27e8_, hx, hex\u27e9 \u21a6 mem_of_eq_of_mem (id hex.symm) (e.map_source' hx)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.map_target (L187-L189)\ntheorem map_target {x : \u03b2} (h : x \u2208 e.target) : e.symm x \u2208 e.source :=\ne.map_target' h\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.left_inv (L191-L193)\ntheorem left_inv {x : \u03b1} (h : x \u2208 e.source) : e.symm (e x) = x :=\ne.left_inv' h\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.right_inv (L195-L197)\ntheorem right_inv {x : \u03b2} (h : x \u2208 e.target) : e (e.symm x) = x :=\ne.right_inv' h\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.target_subset_range (L198-L200)\ntheorem target_subset_range : e.target \u2286 range e :=\nfun x hx \u21a6 \u27e8e.symm x, right_inv e hx\u27e9\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.eq_symm_apply (L201-L206)\ntheorem eq_symm_apply {x : \u03b1} {y : \u03b2} (hx : x \u2208 e.source) (hy : y \u2208 e.target) :\n x = e.symm y \u2194 e x = y :=\n\u27e8fun h => by rw [\u2190 e.right_inv hy, h], fun h => by rw [\u2190 e.left_inv hx, h]\u27e9\n\nprotected theorem mapsTo : MapsTo e e.source e.target := fun _ => e.map_source\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.symm_mapsTo (L207-L227)\ntheorem symm_mapsTo : MapsTo e.symm e.target e.source :=\ne.symm.mapsTo\n\nprotected theorem leftInvOn : LeftInvOn e.symm e e.source := fun _ => e.left_inv\n\nprotected theorem rightInvOn : RightInvOn e.symm e e.target := fun _ => e.right_inv\n\nprotected theorem invOn : InvOn e.symm e e.source e.target :=\n \u27e8e.leftInvOn, e.rightInvOn\u27e9\n\nprotected theorem injOn : InjOn e e.source :=\n e.leftInvOn.injOn\n\nprotected theorem bijOn : BijOn e e.source e.target :=\n e.invOn.bijOn e.mapsTo e.symm_mapsTo\n\nprotected theorem surjOn : SurjOn e e.source e.target :=\n e.bijOn.surjOn\n\n/-- Interpret an `Equiv` as a `PartialEquiv` by restricting it to `s` in the domain\nand to `t` in the codomain. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.inhabitedOfEmpty (L248-L251)\ninstance inhabitedOfEmpty [IsEmpty \u03b1] [IsEmpty \u03b2] : Inhabited (PartialEquiv \u03b1 \u03b2) :=\n\u27e8((Equiv.equivEmpty \u03b1).trans (Equiv.equivEmpty \u03b2).symm).toPartialEquiv\u27e9\n\n/-- Create a copy of a `PartialEquiv` providing better definitional equalities. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.copy (L253-L264)\ndef copy (e : PartialEquiv \u03b1 \u03b2) (f : \u03b1 \u2192 \u03b2) (hf : \u21d1e = f) (g : \u03b2 \u2192 \u03b1) (hg : \u21d1e.symm = g) (s : Set \u03b1)\n (hs : e.source = s) (t : Set \u03b2) (ht : e.target = t) :\n PartialEquiv \u03b1 \u03b2 where\n toFun := f\ninvFun := g\n source := s\n target := t\n map_source' _ := ht \u25b8 hs \u25b8 hf \u25b8 e.map_source\n map_target' _ := hs \u25b8 ht \u25b8 hg \u25b8 e.map_target\n left_inv' _ := hs \u25b8 hf \u25b8 hg \u25b8 e.left_inv\n right_inv' _ := ht \u25b8 hf \u25b8 hg \u25b8 e.right_inv\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.copy_eq (L265-L278)\ntheorem copy_eq (e : PartialEquiv \u03b1 \u03b2) (f : \u03b1 \u2192 \u03b2) (hf : \u21d1e = f) (g : \u03b2 \u2192 \u03b1) (hg : \u21d1e.symm = g)\n (s : Set \u03b1) (hs : e.source = s) (t : Set \u03b2) (ht : e.target = t) :\n e.copy f hf g hg s hs t ht = e := by\nsubsts f g s t\n cases e\n rfl\n\n/-- Associate to a `PartialEquiv` an `Equiv` between the source and the target. -/\nprotected def toEquiv : e.source \u2243 e.target where\n toFun x := \u27e8e x, e.map_source x.mem\u27e9\n invFun y := \u27e8e.symm y, e.map_target y.mem\u27e9\n left_inv := fun \u27e8_, hx\u27e9 => Subtype.ext <| e.left_inv hx\n right_inv := fun \u27e8_, hy\u27e9 => Subtype.ext <| e.right_inv hy\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.symm_source (L280-L282)\ntheorem symm_source : e.symm.source = e.target :=\nrfl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.symm_target (L284-L286)\ntheorem symm_target : e.symm.target = e.source :=\nrfl\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.symm_symm (L288-L289)\ntheorem symm_symm : e.symm.symm = e := rfl\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.symm_bijective (L290-L293)\ntheorem symm_bijective :\n Function.Bijective (PartialEquiv.symm : PartialEquiv \u03b1 \u03b2 \u2192 PartialEquiv \u03b2 \u03b1) :=\nFunction.bijective_iff_has_inverse.mpr \u27e8_, symm_symm, symm_symm\u27e9\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.image_source_eq_target (L294-L296)\ntheorem image_source_eq_target : e '' e.source = e.target :=\ne.bijOn.image_eq\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.forall_mem_target (L297-L299)\ntheorem forall_mem_target {p : \u03b2 \u2192 Prop} : (\u2200 y \u2208 e.target, p y) \u2194 \u2200 x \u2208 e.source, p (e x) := by\nrw [\u2190 image_source_eq_target, forall_mem_image]\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.exists_mem_target (L300-L309)\ntheorem exists_mem_target {p : \u03b2 \u2192 Prop} : (\u2203 y \u2208 e.target, p y) \u2194 \u2203 x \u2208 e.source, p (e x) := by\nrw [\u2190 image_source_eq_target, exists_mem_image]\n\n/-- We say that `t : Set \u03b2` is an image of `s : Set \u03b1` under a partial equivalence if\nany of the following equivalent conditions hold:\n\n* `e '' (e.source \u2229 s) = e.target \u2229 t`;\n* `e.source \u2229 e \u207b\u00b9 t = e.source \u2229 s`;\n* `\u2200 x \u2208 e.source, e x \u2208 t \u2194 x \u2208 s` (this one is used in the definition).\n-/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.IsImage (L310-L316)\ndef IsImage (s : Set \u03b1) (t : Set \u03b2) : Prop :=\n\u2200 \u2983x\u2984, x \u2208 e.source \u2192 (e x \u2208 t \u2194 x \u2208 s)\n\nnamespace IsImage\n\nvariable {e} {s : Set \u03b1} {t : Set \u03b2} {x : \u03b1}\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.apply_mem_iff (L317-L319)\ntheorem apply_mem_iff (h : e.IsImage s t) (hx : x \u2208 e.source) : e x \u2208 t \u2194 x \u2208 s :=\nh hx\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Logic.Equiv.PartialEquiv.symm_apply_mem_iff (L320-L325)\ntheorem symm_apply_mem_iff (h : e.IsImage s t) : \u2200 \u2983y\u2984, y \u2208 e.target \u2192 (e.symm y \u2208 s \u2194 y \u2208 t) :=\ne.forall_mem_target.mpr fun x hx => by rw [e.left_inv hx, h hx]\n\nprotected theorem symm (h : e.IsImage s t) : e.symm.IsImage t s :=\n h.symm_apply_mem_iff\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Logic.Equiv.Basic.sigmaSigmaSubtype (L448-L457)\ndef sigmaSigmaSubtype {\u03b1 : Type*} {\u03b2 : \u03b1 \u2192 Type*} {\u03b3 : (a : \u03b1) \u2192 \u03b2 a \u2192 Type*}\n (p : (a : \u03b1) \u00d7 \u03b2 a \u2192 Prop) [uniq : Unique {ab // p ab}] {a : \u03b1} {b : \u03b2 a} (h : p \u27e8a, b\u27e9) :\n {s : (a : \u03b1) \u00d7 (b : \u03b2 a) \u00d7 \u03b3 a b // p \u27e8s.1, s.2.1\u27e9} \u2243 \u03b3 a b :=\ncalc {s : (a : \u03b1) \u00d7 (b : \u03b2 a) \u00d7 \u03b3 a b // p \u27e8s.1, s.2.1\u27e9}\n _ \u2243 _ := subtypeEquiv (p := fun \u27e8a, b, c\u27e9 \u21a6 p \u27e8a, b\u27e9) (q := (p \u00b7.1))\n (sigmaAssoc \u03b3).symm fun s \u21a6 by simp [sigmaAssoc]\n _ \u2243 _ := subtypeSigmaEquiv _ _\n _ \u2243 _ := uniqueSigma (fun ab \u21a6 \u03b3 (Sigma.fst <| Subtype.val ab) (Sigma.snd <| Subtype.val ab))\n _ \u2243 \u03b3 a b := Equiv.cast <| by rw [\u2190 show \u27e8\u27e8a, b\u27e9, h\u27e9 = uniq.default from uniq.uniq _]\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Logic.Equiv.Basic.swap_comm (L642-L644)\ntheorem swap_comm (a b : \u03b1) : swap a b = swap b a :=\next fun r => swapCore_comm r _ _\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Logic.Equiv.Basic.swap_comp_apply (L676-L680)\ntheorem swap_comp_apply {a b x : \u03b1} (\u03c0 : Perm \u03b1) :\n \u03c0.trans (swap a b) x = if \u03c0 x = a then b else if \u03c0 x = b then a else \u03c0 x := by\ncases \u03c0\n rfl\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeSubtypeEquivSubtype (L340-L345)\ndef subtypeSubtypeEquivSubtype {\u03b1} {p q : \u03b1 \u2192 Prop} (h : \u2200 {x}, q x \u2192 p x) :\n { x : Subtype p // q x.1 } \u2243 Subtype q :=\n(subtypeSubtypeEquivSubtypeInter p _).trans <| subtypeEquivRight fun _ => and_iff_right_of_imp h\n\n/-- If a proposition holds for all elements, then the subtype is\nequivalent to the original type. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypePreimage_symm_apply_coe_pos (L128-L131)\ntheorem subtypePreimage_symm_apply_coe_pos (x : { a // \u00acp a } \u2192 \u03b2) (a : \u03b1) (h : p a) :\n ((subtypePreimage p x\u2080).symm x : \u03b1 \u2192 \u03b2) a = x\u2080 \u27e8a, h\u27e9 :=\ndif_pos h\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquivProp (L316-L320)\ndef subtypeEquivProp {p q : \u03b1 \u2192 Prop} (h : p = q) : Subtype p \u2243 Subtype q :=\nsubtypeEquiv (Equiv.refl \u03b1) fun _ => h \u25b8 Iff.rfl\n\n/-- A subtype of a subtype is equivalent to the subtype of elements satisfying both predicates. This\nversion allows the \u201cinner\u201d predicate to depend on `h : p a`. -/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquiv_symm (L281-L284)\ntheorem subtypeEquiv_symm {p : \u03b1 \u2192 Prop} {q : \u03b2 \u2192 Prop} (e : \u03b1 \u2243 \u03b2) (h : \u2200 a : \u03b1, p a \u2194 q (e a)) :\n (e.subtypeEquiv h).symm = e.symm.subtypeEquiv (by as_aux_lemma => grind) :=\nrfl\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Logic.Equiv.Basic.piCongrRight_refl (L148-L152)\nlemma piCongrRight_refl {\u03b2 : \u03b1 \u2192 Sort*} : piCongrRight (fun a \u21a6 .refl (\u03b2 a)) = .refl (\u2200 a, \u03b2 a) :=\nrfl\n\n/-- Given `\u03c6 : \u03b1 \u2192 \u03b2 \u2192 Sort*`, we have an equivalence between `\u2200 a b, \u03c6 a b` and `\u2200 b a, \u03c6 a b`.\nThis is `Function.swap` as an `Equiv`. -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Logic.Equiv.Basic.eq_or_eq_of_swap_apply_ne_self (L660-L663)\ntheorem eq_or_eq_of_swap_apply_ne_self {a b x : \u03b1} (h : swap a b x \u2260 x) : x = a \u2228 x = b := by\ncontrapose! h\n exact swap_apply_of_ne_of_ne h.1 h.2\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Logic.Equiv.Basic.ofFiberEquiv_map (L195-L200)\ntheorem ofFiberEquiv_map {\u03b1 \u03b2 \u03b3} {f : \u03b1 \u2192 \u03b3} {g : \u03b2 \u2192 \u03b3}\n (e : \u2200 c, { a // f a = c } \u2243 { b // g b = c }) (a : \u03b1) : g (ofFiberEquiv e a) = f a :=\n(_ : { b // g b = _ }).property\n\nend prodCongr\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeSigmaEquiv (L351-L357)\ndef subtypeSigmaEquiv {\u03b1} (p : \u03b1 \u2192 Type v) (q : \u03b1 \u2192 Prop) : { y : Sigma p // q y.1 } \u2243 \u03a3 x :\n Subtype q, p x.1 :=\n\u27e8fun x => \u27e8\u27e8x.1.1, x.2\u27e9, x.1.2\u27e9, fun x => \u27e8\u27e8x.1.1, x.2\u27e9, x.1.2\u27e9, fun _ => rfl,\n fun _ => rfl\u27e9\n\n/-- A sigma type over a subtype is equivalent to the sigma set over the original type,\nif the fiber is empty outside of the subset -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Logic.Equiv.Basic.swap_self (L639-L641)\ntheorem swap_self (a : \u03b1) : swap a a = Equiv.refl _ :=\next fun r => swapCore_self r a\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Logic.Equiv.Basic.sigmaSigmaSubtypeEq_symm_apply (L482-L485)\nlemma sigmaSigmaSubtypeEq_symm_apply {\u03b1 \u03b2 : Type*} {\u03b3 : \u03b1 \u2192 \u03b2 \u2192 Type*} {a : \u03b1} {b : \u03b2} (c : \u03b3 a b) :\n (sigmaSigmaSubtypeEq a b).symm c = \u27e8\u27e8a, \u27e8b, c\u27e9\u27e9, \u27e8rfl, rfl\u27e9\u27e9 := by\nsimp [sigmaSigmaSubtypeEq]\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Logic.Equiv.Basic.swap_eq_refl_iff (L673-L675)\ntheorem swap_eq_refl_iff {x y : \u03b1} : swap x y = Equiv.refl _ \u2194 x = y :=\n\u27e8fun h => (Equiv.refl _).injective (by grind), by grind\u27e9\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquiv (L262-L268)\ndef subtypeEquiv {p : \u03b1 \u2192 Prop} {q : \u03b2 \u2192 Prop} (e : \u03b1 \u2243 \u03b2) (h : \u2200 a, p a \u2194 q (e a)) :\n { a : \u03b1 // p a } \u2243 { b : \u03b2 // q b } where\n toFun a := \u27e8e a, (h _).mp a.property\u27e9\ninvFun b := \u27e8e.symm b, (h _).mpr ((e.apply_symm_apply b).symm \u25b8 b.property)\u27e9\n left_inv a := Subtype.ext <| by simp\n right_inv b := Subtype.ext <| by simp\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeCongr (L54-L62)\ndef subtypeCongr {\u03b1} {p q : \u03b1 \u2192 Prop} [DecidablePred p] [DecidablePred q]\n (e : { x // p x } \u2243 { x // q x }) (f : { x // \u00acp x } \u2243 { x // \u00acq x }) : Perm \u03b1 :=\n(sumCompl p).symm.trans ((sumCongr e f).trans (sumCompl q))\n\nvariable {\u03b5 : Type*} {p : \u03b5 \u2192 Prop} [DecidablePred p]\nvariable (ep ep' : Perm { a // p a }) (en en' : Perm { a // \u00acp a })\n\n/-- Combining permutations on `\u03b5` that permute only inside or outside the subtype\nsplit induced by `p : \u03b5 \u2192 Prop` constructs a permutation on `\u03b5`. -/\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Logic.Equiv.Basic.swap_apply_right (L654-L656)\ntheorem swap_apply_right (a b : \u03b1) : swap a b b = a := by\ngrind\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Logic.Equiv.Basic.symm_trans_swap_trans (L689-L692)\ntheorem symm_trans_swap_trans [DecidableEq \u03b2] (a b : \u03b1) (e : \u03b1 \u2243 \u03b2) :\n (e.symm.trans (swap a b)).trans e = swap (e a) (e b) := by\ngrind\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypePreimage (L112-L127)\ndef subtypePreimage : { x : \u03b1 \u2192 \u03b2 // x \u2218 Subtype.val = x\u2080 } \u2243 ({ a // \u00acp a } \u2192 \u03b2) where\n toFun (x : { x : \u03b1 \u2192 \u03b2 // x \u2218 Subtype.val = x\u2080 }) a := (x : \u03b1 \u2192 \u03b2) a\ninvFun x := \u27e8fun a => if h : p a then x\u2080 \u27e8a, h\u27e9 else x \u27e8a, h\u27e9, funext fun \u27e8_, h\u27e9 => dif_pos h\u27e9\n left_inv := fun \u27e8x, hx\u27e9 =>\n Subtype.val_injective <|\n funext fun a => by\n dsimp only\n split_ifs\n \u00b7 rw [\u2190 hx]; rfl\n \u00b7 rfl\n right_inv x :=\n funext fun \u27e8a, h\u27e9 =>\n show dite (p a) _ _ = _ by\n dsimp only\n rw [dif_neg h]\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypePreimage_symm_apply_coe_neg (L132-L137)\ntheorem subtypePreimage_symm_apply_coe_neg (x : { a // \u00acp a } \u2192 \u03b2) (a : \u03b1) (h : \u00acp a) :\n ((subtypePreimage p x\u2080).symm x : \u03b1 \u2192 \u03b2) a = x \u27e8a, h\u27e9 :=\ndif_neg h\n\nend subtypePreimage\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Logic.Equiv.Basic.piComm (L154-L156)\ndef piComm (\u03c6 : \u03b1 \u2192 \u03b2 \u2192 Sort*) : (\u2200 a b, \u03c6 a b) \u2243 \u2200 b a, \u03c6 a b :=\n\u27e8swap, swap, fun _ => rfl, fun _ => rfl\u27e9\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquivRight (L295-L297)\ndef subtypeEquivRight {p q : \u03b1 \u2192 Prop} (e : \u2200 x, p x \u2194 q x) : { x // p x } \u2243 { x // q x } :=\nsubtypeEquiv (Equiv.refl _) e\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Logic.Equiv.Basic.natSumPUnitEquivNat (L228-L231)\ndef natSumPUnitEquivNat : \u2115 \u2295 PUnit \u2243 \u2115 :=\nnatEquivNatSumPUnit.symm\n\n/-- The type of integer numbers is equivalent to `\u2115 \u2295 \u2115`. -/\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquivRight_apply (L298-L300)\nlemma subtypeEquivRight_apply {p q : \u03b1 \u2192 Prop} (e : \u2200 x, p x \u2194 q x)\n (z : { x // p x }) : subtypeEquivRight e z = \u27e8z, (e z.1).mp z.2\u27e9 := rfl\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Logic.Equiv.Basic.sigmaSubtypeEquivOfSubset (L358-L363)\ndef sigmaSubtypeEquivOfSubset {\u03b1} (p : \u03b1 \u2192 Type v) (q : \u03b1 \u2192 Prop) (h : \u2200 x, p x \u2192 q x) :\n (\u03a3 x : Subtype q, p x) \u2243 \u03a3 x : \u03b1, p x :=\n(subtypeSigmaEquiv p q).symm.trans <| subtypeUnivEquiv fun x => h x.1 x.2\n\n/-- If a predicate `p : \u03b2 \u2192 Prop` is true on the range of a map `f : \u03b1 \u2192 \u03b2`, then\n`\u03a3 y : {y // p y}, {x // f x = y}` is equivalent to `\u03b1`. -/\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Logic.Equiv.Basic.coe_subtypeEquiv_eq_map (L269-L272)\nlemma coe_subtypeEquiv_eq_map {X Y} {p : X \u2192 Prop} {q : Y \u2192 Prop} (e : X \u2243 Y)\n (h : \u2200 x, p x \u2194 q (e x)) : \u21d1(e.subtypeEquiv h) = Subtype.map e (h \u00b7 |>.mp) :=\nrfl\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Logic.Equiv.Basic.comp_swap_eq_update (L684-L687)\ntheorem comp_swap_eq_update (i j : \u03b1) (f : \u03b1 \u2192 \u03b2) :\n f \u2218 Equiv.swap i j = update (update f j (f i)) i (f j) := by\ngrind\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Logic.Equiv.Basic.swap_eq_update (L681-L683)\ntheorem swap_eq_update (i j : \u03b1) : (Equiv.swap i j : \u03b1 \u2192 \u03b1) = update (update id j i) i j := by\ngrind\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeQuotientEquivQuotientSubtype_mk (L601-L606)\ntheorem subtypeQuotientEquivQuotientSubtype_mk (p\u2081 : \u03b1 \u2192 Prop)\n [s\u2081 : Setoid \u03b1] [s\u2082 : Setoid (Subtype p\u2081)] (p\u2082 : Quotient s\u2081 \u2192 Prop) (hp\u2082 : \u2200 a, p\u2081 a \u2194 p\u2082 \u27e6a\u27e7)\n (h : \u2200 x y : Subtype p\u2081, s\u2082 x y \u2194 (x : \u03b1) \u2248 y)\n (x hx) : subtypeQuotientEquivQuotientSubtype p\u2081 p\u2082 hp\u2082 h \u27e8\u27e6x\u27e7, hx\u27e9 = \u27e6\u27e8x, (hp\u2082 _).2 hx\u27e9\u27e7 :=\nrfl\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Logic.Equiv.Basic.piCongrRight (L143-L146)\ndef piCongrRight {\u03b2\u2081 \u03b2\u2082 : \u03b1 \u2192 Sort*} (F : \u2200 a, \u03b2\u2081 a \u2243 \u03b2\u2082 a) : (\u2200 a, \u03b2\u2081 a) \u2243 (\u2200 a, \u03b2\u2082 a) :=\n\u27e8Pi.map fun a \u21a6 F a, Pi.map fun a \u21a6 (F a).symm, fun H => funext <| by simp,\n fun H => funext <| by simp\u27e9\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Logic.Equiv.Basic.piEquivSubtypeSigma (L402-L411)\ndef piEquivSubtypeSigma (\u03b9) (\u03c0 : \u03b9 \u2192 Type*) :\n (\u2200 i, \u03c0 i) \u2243 { f : \u03b9 \u2192 \u03a3 i, \u03c0 i // \u2200 i, (f i).1 = i } where\n toFun := fun f => \u27e8fun i => \u27e8i, f i\u27e9, fun _ => rfl\u27e9\ninvFun := fun f i => by rw [\u2190 f.2 i]; exact (f.1 i).2\n right_inv := fun \u27e8f, hf\u27e9 =>\n Subtype.ext <| funext fun i =>\n Sigma.eq (hf i).symm <| eq_of_heq <| rec_heq_of_heq _ <| by simp\n\n/-- The type of functions `f : \u2200 a, \u03b2 a` such that for all `a` we have `p a (f a)` is equivalent\nto the type of functions `\u2200 a, {b : \u03b2 a // p a b}`. -/\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Logic.Equiv.Basic.swapCore_self (L622-L625)\ntheorem swapCore_self (r a : \u03b1) : swapCore a a r = r := by\nunfold swapCore\n split_ifs <;> simp [*]\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Logic.Equiv.Basic.sigmaSubtypeFiberEquivSubtype (L372-L387)\ndef sigmaSubtypeFiberEquivSubtype {\u03b1 \u03b2 : Type*} (f : \u03b1 \u2192 \u03b2) {p : \u03b1 \u2192 Prop} {q : \u03b2 \u2192 Prop}\n (h : \u2200 x, p x \u2194 q (f x)) : (\u03a3 y : Subtype q, { x : \u03b1 // f x = y }) \u2243 Subtype p :=\ncalc\n (\u03a3 y : Subtype q, { x : \u03b1 // f x = y }) \u2243 \u03a3 y :\n Subtype q, { x : Subtype p // Subtype.mk (f x) ((h x).1 x.2) = y } := by {\n apply sigmaCongrRight\n intro y\n apply Equiv.symm\n refine (subtypeSubtypeEquivSubtypeExists _ _).trans (subtypeEquivRight ?_)\n intro x\n exact \u27e8fun \u27e8hp, h'\u27e9 => congr_arg Subtype.val h', fun h' => \u27e8(h x).2 (h'.symm \u25b8 y.2),\n Subtype.ext h'\u27e9\u27e9 }\n _ \u2243 Subtype p := sigmaFiberEquiv fun x : Subtype p => (\u27e8f x, (h x).1 x.property\u27e9 : Subtype q)\n\n/-- A sigma type over an `Option` is equivalent to the sigma set over the original type,\nif the fiber is empty at none. -/\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Logic.Equiv.Basic.swap_apply_def (L646-L648)\ntheorem swap_apply_def (a b x : \u03b1) : swap a b x = if x = a then b else if x = b then a else x :=\nrfl\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Logic.Equiv.Basic.piCurry (L165-L172)\ndef piCurry {\u03b1} {\u03b2 : \u03b1 \u2192 Type*} (\u03b3 : \u2200 a, \u03b2 a \u2192 Type*) :\n (\u2200 x : \u03a3 i, \u03b2 i, \u03b3 x.1 x.2) \u2243 \u2200 a b, \u03b3 a b where\n toFun := Sigma.curry\ninvFun := Sigma.uncurry\n left_inv := Sigma.uncurry_curry\n right_inv := Sigma.curry_uncurry\n\n-- `simps` overapplies these but `simps -fullyApplied` under-applies them\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Logic.Equiv.Basic.swap_apply_left (L650-L652)\ntheorem swap_apply_left (a b : \u03b1) : swap a b a = b :=\nif_pos rfl\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeQuotientEquivQuotientSubtype_symm_mk (L608-L618)\ntheorem subtypeQuotientEquivQuotientSubtype_symm_mk (p\u2081 : \u03b1 \u2192 Prop)\n [s\u2081 : Setoid \u03b1] [s\u2082 : Setoid (Subtype p\u2081)] (p\u2082 : Quotient s\u2081 \u2192 Prop) (hp\u2082 : \u2200 a, p\u2081 a \u2194 p\u2082 \u27e6a\u27e7)\n (h : \u2200 x y : Subtype p\u2081, s\u2082 x y \u2194 (x : \u03b1) \u2248 y) (x) :\n (subtypeQuotientEquivQuotientSubtype p\u2081 p\u2082 hp\u2082 h).symm \u27e6x\u27e7 = \u27e8\u27e6x\u27e7, (hp\u2082 _).1 x.property\u27e9 :=\nrfl\n\nsection Swap\n\nvariable [DecidableEq \u03b1]\n\n/-- A helper function for `Equiv.swap`. -/\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquivCodomain_apply (L513-L516)\ntheorem subtypeEquivCodomain_apply (f : { x' // x' \u2260 x } \u2192 Y) (g) :\n subtypeEquivCodomain f g = (g : X \u2192 Y) x :=\nrfl\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeUnivEquiv (L347-L350)\ndef subtypeUnivEquiv {\u03b1} {p : \u03b1 \u2192 Prop} (h : \u2200 x, p x) : Subtype p \u2243 \u03b1 :=\n\u27e8fun x => x, fun x => \u27e8x, h x\u27e9, fun _ => Subtype.ext rfl, fun _ => rfl\u27e9\n\n/-- A subtype of a sigma-type is a sigma-type over a subtype. -/\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquivCodomain (L496-L505)\ndef subtypeEquivCodomain (f : { x' // x' \u2260 x } \u2192 Y) :\n { g : X \u2192 Y // g \u2218 (\u2191) = f } \u2243 Y :=\n(subtypePreimage _ f).trans <|\n @funUnique { x' // \u00acx' \u2260 x } _ <|\n show Unique { x' // \u00acx' \u2260 x } from\n @Equiv.unique _ _\n (show Unique { x' // x' = x } from {\n default := \u27e8x, rfl\u27e9, uniq := fun \u27e8_, h\u27e9 => Subtype.val_injective h })\n (subtypeEquivRight fun _ => not_not)\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeQuotientEquivQuotientSubtype (L583-L599)\ndef subtypeQuotientEquivQuotientSubtype (p\u2081 : \u03b1 \u2192 Prop) {s\u2081 : Setoid \u03b1} {s\u2082 : Setoid (Subtype p\u2081)}\n (p\u2082 : Quotient s\u2081 \u2192 Prop) (hp\u2082 : \u2200 a, p\u2081 a \u2194 p\u2082 \u27e6a\u27e7)\n (h : \u2200 x y : Subtype p\u2081, s\u2082.r x y \u2194 s\u2081.r x y) : {x // p\u2082 x} \u2243 Quotient s\u2082 where\n toFun a :=\nQuotient.hrecOn a.1 (fun a h => \u27e6\u27e8a, (hp\u2082 _).2 h\u27e9\u27e7)\n (fun a b hab => hfunext (by rw [Quotient.sound hab]) fun _ _ _ =>\n heq_of_eq (Quotient.sound ((h _ _).2 hab)))\n a.2\n invFun a :=\n Quotient.liftOn a (fun a => (\u27e8\u27e6a.1\u27e7, (hp\u2082 _).1 a.2\u27e9 : { x // p\u2082 x })) fun _ _ hab =>\n Subtype.ext (Quotient.sound ((h _ _).1 hab))\n left_inv a := by\n obtain \u27e8a, ha\u27e9 := a\n induction a using Quotient.inductionOn\n rfl\n right_inv a := by induction a using Quotient.inductionOn; rfl\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Logic.Equiv.Basic.coe_subtypeEquivCodomain_symm (L517-L521)\ntheorem coe_subtypeEquivCodomain_symm (f : { x' // x' \u2260 x } \u2192 Y) :\n ((subtypeEquivCodomain f).symm : Y \u2192 _) = fun y =>\n \u27e8fun x' => if h : x' \u2260 x then f \u27e8x', h\u27e9 else y, by grind\u27e9 :=\nrfl\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Logic.Equiv.Basic.swapCore_swapCore (L626-L628)\ntheorem swapCore_swapCore (r a b : \u03b1) : swapCore a b (swapCore a b r) = r := by\nunfold swapCore; split_ifs <;> grind\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Logic.Equiv.Array.for (L31-L49)\ninstance for `array` was)\n\n2. belong in `Mathlib/Control/Traversable/Instances.lean` instead of this file. -/\n\n-- namespace Array'\n\n-- open Function\n\n-- variable {n : \u2115}\n-- instance : Traversable (Array' n) :=\n-- @Equiv.traversable (flip Vector n) _ (fun \u03b1 => Equiv.vectorEquivArray \u03b1 n) _\n\n-- instance : LawfulTraversable (Array' n) :=\n-- @Equiv.isLawfulTraversable (flip Vector n) _ (fun \u03b1 => Equiv.vectorEquivArray \u03b1 n) _ _\n\n-- end Array'\n\n/-- If `\u03b1` is encodable, then so is `Array \u03b1`. -/\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Logic.Equiv.Basic.swap (L634-L637)\ndef swap (a b : \u03b1) : Perm \u03b1 :=\n\u27e8swapCore a b, swapCore a b, fun r => swapCore_swapCore r a b,\n fun r => swapCore_swapCore r a b\u27e9\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquiv_trans (L286-L293)\ntheorem subtypeEquiv_trans {p : \u03b1 \u2192 Prop} {q : \u03b2 \u2192 Prop} {r : \u03b3 \u2192 Prop} (e : \u03b1 \u2243 \u03b2) (f : \u03b2 \u2243 \u03b3)\n (h : \u2200 a : \u03b1, p a \u2194 q (e a)) (h' : \u2200 b : \u03b2, q b \u2194 r (f b)) :\n (e.subtypeEquiv h).trans (f.subtypeEquiv h')\n = (e.trans f).subtypeEquiv (by as_aux_lemma => exact fun a => (h a).trans (h' <| e a)) :=\nrfl\n\n/-- If two predicates `p` and `q` are pointwise equivalent, then `{x // p x}` is equivalent to\n`{x // q x}`. -/\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeSubtypeEquivSubtypeExists (L322-L330)\ndef subtypeSubtypeEquivSubtypeExists (p : \u03b1 \u2192 Prop) (q : Subtype p \u2192 Prop) :\n Subtype q \u2243 { a : \u03b1 // \u2203 h : p a, q \u27e8a, h\u27e9 } :=\n\u27e8fun a =>\n \u27e8a.1, a.1.2, by\n rcases a with \u27e8\u27e8a, hap\u27e9, haq\u27e9\n exact haq\u27e9,\n fun a => \u27e8\u27e8a, a.2.fst\u27e9, a.2.snd\u27e9, fun \u27e8\u27e8_, _\u27e9, _\u27e9 => rfl, fun \u27e8_, _, _\u27e9 => rfl\u27e9\n\n/-- A subtype of a subtype is equivalent to the subtype of elements satisfying both predicates. -/\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypePiEquivPi (L412-L425)\ndef subtypePiEquivPi {\u03b2 : \u03b1 \u2192 Sort v} {p : \u2200 a, \u03b2 a \u2192 Prop} :\n { f : \u2200 a, \u03b2 a // \u2200 a, p a (f a) } \u2243 \u2200 a, { b : \u03b2 a // p a b } where\n toFun := fun f a => \u27e8f.1 a, f.2 a\u27e9\ninvFun := fun f => \u27e8fun a => (f a).1, fun a => (f a).2\u27e9\n left_inv := by\n rintro \u27e8f, h\u27e9\n rfl\n right_inv := by\n rintro f\n funext a\n exact Subtype.ext rfl\n\n/-- A sigma of a sigma whose second base does not depend on the first is equivalent\nto a sigma whose base is a product. -/\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Logic.Equiv.Basic.sigmaSubtype (L434-L441)\ndef sigmaSubtype {\u03b1 : Type*} {\u03b2 : \u03b1 \u2192 Type*} (a : \u03b1) :\n {s : Sigma \u03b2 // s.1 = a} \u2243 \u03b2 a where\n toFun := fun \u27e8\u27e8_, b\u27e9, h\u27e9 => h \u25b8 b\ninvFun b := \u27e8\u27e8a, b\u27e9, rfl\u27e9\n left_inv := fun \u27e8a, h\u27e9 \u21a6 by cases h; simp\n right_inv b := by simp\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquivRight_symm_apply (L301-L305)\nlemma subtypeEquivRight_symm_apply {p q : \u03b1 \u2192 Prop} (e : \u2200 x, p x \u2194 q x)\n (z : { x // q x }) : (subtypeEquivRight e).symm z = \u27e8z, (e z.1).mpr z.2\u27e9 := rfl\n/-- If `\u03b1 \u2243 \u03b2`, then for any predicate `p : \u03b2 \u2192 Prop` the subtype `{a // p (e a)}` is equivalent\nto the subtype `{b // p b}`. -/\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquivCodomain_symm_apply (L523-L526)\ntheorem subtypeEquivCodomain_symm_apply (f : { x' // x' \u2260 x } \u2192 Y) (y : Y) (x' : X) :\n ((subtypeEquivCodomain f).symm y : X \u2192 Y) x' = if h : x' \u2260 x then f \u27e8x', h\u27e9 else y :=\nrfl\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquivCodomain_symm_apply_ne (L531-L537)\ntheorem subtypeEquivCodomain_symm_apply_ne\n (f : { x' // x' \u2260 x } \u2192 Y) (y : Y) (x' : X) (h : x' \u2260 x) :\n ((subtypeEquivCodomain f).symm y : X \u2192 Y) x' = f \u27e8x', h\u27e9 :=\ndif_pos h\n\nend subtypeEquivCodomain\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Logic.Equiv.Basic.uniqueCongr (L241-L247)\ndef uniqueCongr (e : \u03b1 \u2243 \u03b2) : Unique \u03b1 \u2243 Unique \u03b2 where\n toFun h := @Equiv.unique _ _ h e.symm\ninvFun h := @Equiv.unique _ _ h e\n left_inv _ := Subsingleton.elim _ _\n right_inv _ := Subsingleton.elim _ _\n\n/-- If `\u03b1` is equivalent to `\u03b2`, then `IsEmpty \u03b1` is equivalent to `IsEmpty \u03b2`. -/\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Logic.Equiv.Basic.swapCore (L619-L621)\ndef swapCore (a b r : \u03b1) : \u03b1 :=\nif r = a then b else if r = b then a else r\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Logic.Equiv.Basic.piComm_symm (L158-L164)\ntheorem piComm_symm {\u03c6 : \u03b1 \u2192 \u03b2 \u2192 Sort*} : (piComm \u03c6).symm = (piComm <| swap \u03c6) :=\nrfl\n\n/-- Dependent `curry` equivalence: the type of dependent functions on `\u03a3 i, \u03b2 i` is equivalent\nto the type of dependent functions of two arguments (i.e., functions to the space of functions).\n\nThis is `Sigma.curry` and `Sigma.uncurry` together as an equiv. -/\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeSubtypeEquivSubtypeInter (L332-L338)\ndef subtypeSubtypeEquivSubtypeInter {\u03b1 : Type u} (p q : \u03b1 \u2192 Prop) :\n { x : Subtype p // q x.1 } \u2243 Subtype fun x => p x \u2227 q x :=\n(subtypeSubtypeEquivSubtypeExists p _).trans <|\n subtypeEquivRight fun x => @exists_prop (q x) (p x)\n\n/-- If the outer subtype has more restrictive predicate than the inner one,\nthen we can drop the latter. -/\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Logic.Equiv.Basic.sigmaSubtypeFiberEquiv (L364-L371)\ndef sigmaSubtypeFiberEquiv {\u03b1 \u03b2 : Type*} (f : \u03b1 \u2192 \u03b2) (p : \u03b2 \u2192 Prop) (h : \u2200 x, p (f x)) :\n (\u03a3 y : Subtype p, { x : \u03b1 // f x = y }) \u2243 \u03b1 :=\ncalc\n _ \u2243 \u03a3 y : \u03b2, { x : \u03b1 // f x = y } := sigmaSubtypeEquivOfSubset _ p fun _ \u27e8x, h'\u27e9 => h' \u25b8 h x\n _ \u2243 \u03b1 := sigmaFiberEquiv f\n\n/-- If for each `x` we have `p x \u2194 q (f x)`, then `\u03a3 y : {y // q y}, f \u207b\u00b9' {y}` is equivalent\nto `{x // p x}`. -/\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquiv_refl (L274-L279)\ntheorem subtypeEquiv_refl {p : \u03b1 \u2192 Prop} (h : \u2200 a, p a \u2194 p (Equiv.refl _ a) := fun _ => Iff.rfl) :\n(Equiv.refl \u03b1).subtypeEquiv h = Equiv.refl { a : \u03b1 // p a } := by\n ext\n rfl\n\n-- We use `as_aux_lemma` here to avoid creating large proof terms when using `simp`\n```\n\n-- snippet 84\n```lean\n-- Mathlib.Logic.Equiv.Basic.sigmaSigmaSubtype_symm_apply (L459-L467)\nlemma sigmaSigmaSubtype_symm_apply {\u03b1 : Type*} {\u03b2 : \u03b1 \u2192 Type*} {\u03b3 : (a : \u03b1) \u2192 \u03b2 a \u2192 Type*}\n (p : (a : \u03b1) \u00d7 \u03b2 a \u2192 Prop) [uniq : Unique {ab // p ab}]\n {a : \u03b1} {b : \u03b2 a} (c : \u03b3 a b) (h : p \u27e8a, b\u27e9) :\n (sigmaSigmaSubtype p h).symm c = \u27e8\u27e8a, \u27e8b, c\u27e9\u27e9, h\u27e9 := by\nrw [Equiv.symm_apply_eq]; simp\n\n/-- A specialization of `sigmaSigmaSubtype` to the case where the second base\ndoes not depend on the first, and the property being checked for is simple\nequality. Useful e.g. when `\u03b3` is `Hom` inside a category. -/\n```\n\n-- snippet 85\n```lean\n-- Mathlib.Logic.Equiv.Basic.Perm (L63-L65)\ndef Perm.subtypeCongr : Equiv.Perm \u03b5 :=\npermCongr (sumCompl p) (sumCongr ep en)\n```\n\n-- snippet 86\n```lean\n-- Mathlib.Logic.Equiv.Basic.intEquivNatSumNat (L232-L237)\ndef intEquivNatSumNat : \u2124 \u2243 \u2115 \u2295 \u2115 where\n toFun z := Int.casesOn z inl inr\ninvFun := Sum.elim Int.ofNat Int.negSucc\n left_inv := by rintro (m | n) <;> rfl\n right_inv := by rintro (m | n) <;> rfl\n```\n\n-- snippet 87\n```lean\n-- Mathlib.Logic.Equiv.Basic.swap_swap (L665-L667)\ntheorem swap_swap (a b : \u03b1) : (swap a b).trans (swap a b) = Equiv.refl _ :=\next fun _ => swapCore_swapCore _ _ _\n```\n\n-- snippet 88\n```lean\n-- Mathlib.Logic.Equiv.Basic.swap_apply_of_ne_of_ne (L657-L659)\ntheorem swap_apply_of_ne_of_ne {a b x : \u03b1} : x \u2260 a \u2192 x \u2260 b \u2192 swap a b x = x := by\ngrind\n```\n\n-- snippet 89\n```lean\n-- Mathlib.Logic.Equiv.Basic.ofFiberEquiv (L191-L194)\ndef ofFiberEquiv {\u03b1 \u03b2 \u03b3} {f : \u03b1 \u2192 \u03b3} {g : \u03b2 \u2192 \u03b3}\n (e : \u2200 c, { a // f a = c } \u2243 { b // g b = c }) : \u03b1 \u2243 \u03b2 :=\n(sigmaFiberEquiv f).symm.trans <| (Equiv.sigmaCongrRight e).trans (sigmaFiberEquiv g)\n```\n\n-- snippet 90\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquivOfSubtype' (L311-L315)\ndef subtypeEquivOfSubtype' {p : \u03b1 \u2192 Prop} (e : \u03b1 \u2243 \u03b2) :\n { a : \u03b1 // p a } \u2243 { b : \u03b2 // p (e.symm b) } :=\ne.symm.subtypeEquivOfSubtype.symm\n\n/-- If two predicates are equal, then the corresponding subtypes are equivalent. -/\n```\n\n-- snippet 91\n```lean\n-- Mathlib.Logic.Equiv.Basic.swapCore_comm (L629-L633)\ntheorem swapCore_comm (r a b : \u03b1) : swapCore a b r = swapCore b a r := by\nunfold swapCore; split_ifs <;> grind\n\n/-- `swap a b` is the permutation that swaps `a` and `b` and\n leaves other values as is. -/\n```\n\n-- snippet 92\n```lean\n-- Mathlib.Logic.Equiv.Basic.isEmpty_congr (L248-L253)\ntheorem isEmpty_congr (e : \u03b1 \u2243 \u03b2) : IsEmpty \u03b1 \u2194 IsEmpty \u03b2 :=\n\u27e8fun h => @Function.isEmpty _ _ h e.symm, fun h => @Function.isEmpty _ _ h e\u27e9\n\nprotected theorem isEmpty (e : \u03b1 \u2243 \u03b2) [IsEmpty \u03b2] : IsEmpty \u03b1 :=\n e.isEmpty_congr.mpr \u2039_\u203a\n```\n\n-- snippet 93\n```lean\n-- Mathlib.Logic.Equiv.Basic.piOptionEquivProd (L44-L53)\ndef piOptionEquivProd {\u03b1} {\u03b2 : Option \u03b1 \u2192 Type*} :\n (\u2200 a : Option \u03b1, \u03b2 a) \u2243 \u03b2 none \u00d7 \u2200 a : \u03b1, \u03b2 (some a) where\n toFun f := (f none, fun a => f (some a))\ninvFun x a := Option.casesOn a x.fst x.snd\n left_inv f := funext fun a => by cases a <;> rfl\n\nsection subtypeCongr\n\n/-- Combines an `Equiv` between two subtypes with an `Equiv` between their complements to form a\n permutation. -/\n```\n\n-- snippet 94\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquivOfSubtype (L306-L310)\ndef subtypeEquivOfSubtype {p : \u03b2 \u2192 Prop} (e : \u03b1 \u2243 \u03b2) : { a : \u03b1 // p (e a) } \u2243 { b : \u03b2 // p b } :=\nsubtypeEquiv e <| by simp\n\n/-- If `\u03b1 \u2243 \u03b2`, then for any predicate `p : \u03b1 \u2192 Prop` the subtype `{a // p a}` is equivalent\nto the subtype `{b // p (e.symm b)}`. This version is used by `equiv_rw`. -/\n```\n\n-- snippet 95\n```lean\n-- Mathlib.Logic.Equiv.Basic.sigmaOptionEquivOfSome (L388-L401)\ndef sigmaOptionEquivOfSome {\u03b1} (p : Option \u03b1 \u2192 Type v) (h : p none \u2192 False) :\n (\u03a3 x : Option \u03b1, p x) \u2243 \u03a3 x : \u03b1, p (some x) :=\nhaveI h' : \u2200 x, p x \u2192 x.isSome := by\n intro x\n cases x\n \u00b7 intro n\n exfalso\n exact h n\n \u00b7 intro _\n exact rfl\n (sigmaSubtypeEquivOfSubset _ _ h').symm.trans (sigmaCongrLeft' (optionIsSomeEquiv \u03b1))\n\n/-- The `Pi`-type `\u2200 i, \u03c0 i` is equivalent to the type of sections `f : \u03b9 \u2192 \u03a3 i, \u03c0 i` of the\n`Sigma` type such that for all `i` we have `(f i).fst = i`. -/\n```\n\n-- snippet 96\n```lean\n-- Mathlib.Logic.Equiv.Basic.sigmaSigmaSubtypeEq (L468-L474)\ndef sigmaSigmaSubtypeEq {\u03b1 \u03b2 : Type*} {\u03b3 : \u03b1 \u2192 \u03b2 \u2192 Type*} (a : \u03b1) (b : \u03b2) :\n {s : (a : \u03b1) \u00d7 (b : \u03b2) \u00d7 \u03b3 a b // s.1 = a \u2227 s.2.1 = b} \u2243 \u03b3 a b :=\nhave : Unique (@Subtype ((_ : \u03b1) \u00d7 \u03b2) (fun \u27e8a', b'\u27e9 \u21a6 a' = a \u2227 b' = b)) := {\n default := \u27e8\u27e8a, b\u27e9, \u27e8rfl, rfl\u27e9\u27e9\n uniq := by rintro \u27e8\u27e8a', b'\u27e9, \u27e8rfl, rfl\u27e9\u27e9; rfl }\n sigmaSigmaSubtype (fun \u27e8a', b'\u27e9 \u21a6 a' = a \u2227 b' = b) \u27e8rfl, rfl\u27e9\n```\n\n-- snippet 97\n```lean\n-- Mathlib.Logic.Equiv.Basic.coe_subtypeEquivCodomain (L507-L511)\ntheorem coe_subtypeEquivCodomain (f : { x' // x' \u2260 x } \u2192 Y) :\n (subtypeEquivCodomain f : _ \u2192 Y) =\n fun g : { g : X \u2192 Y // g \u2218 (\u2191) = f } => (g : X \u2192 Y) x :=\nrfl\n```\n\n-- snippet 98\n```lean\n-- Mathlib.Logic.Equiv.Array.Array (L50-L53)\ninstance Array.encodable {\u03b1} [Encodable \u03b1] : Encodable (Array \u03b1) :=\nEncodable.ofEquiv _ (Equiv.arrayEquivList _)\n\n/-- If `\u03b1` is countable, then so is `Array \u03b1`. -/\n```\n\n-- snippet 99\n```lean\n-- Mathlib.Logic.Equiv.Basic.subtypeEquivCodomain_symm_apply_eq (L527-L530)\ntheorem subtypeEquivCodomain_symm_apply_eq (f : { x' // x' \u2260 x } \u2192 Y) (y : Y) :\n ((subtypeEquivCodomain f).symm y : X \u2192 Y) x = y :=\ndif_neg (not_not.mpr rfl)\n```\n\n-- snippet 100\n```lean\n-- Mathlib.Logic.Equiv.Array.arrayEquivList (L20-L30)\ndef arrayEquivList (\u03b1 : Type*) : Array \u03b1 \u2243 List \u03b1 where\n toFun := Array.toList\ninvFun := Array.mk\n\nend Equiv\n\n/- Porting note: removed instances for what would be ported as `Traversable (Array \u03b1)` and\n`LawfulTraversable (Array \u03b1)`. These would\n\n1. be implemented directly in terms of `Array` functionality for efficiency, rather than being the\ntraversal of some other type transported along an equivalence to `Array \u03b1` (as the traversable\n```\n\n-- snippet 101\n```lean\n-- Mathlib.Logic.Equiv.Basic.sigmaNatSucc (L206-L213)\ndef sigmaNatSucc (f : \u2115 \u2192 Type u) : (\u03a3 n, f n) \u2243 f 0 \u2295 \u03a3 n, f (n + 1) :=\n\u27e8fun x =>\n @Sigma.casesOn \u2115 f (fun _ => f 0 \u2295 \u03a3 n, f (n + 1)) x fun n =>\n @Nat.casesOn (fun i => f i \u2192 f 0 \u2295 \u03a3 n : \u2115, f (n + 1)) n (fun x : f 0 => Sum.inl x)\n fun (n : \u2115) (x : f n.succ) => Sum.inr \u27e8n, x\u27e9,\n Sum.elim (Sigma.mk 0) (Sigma.map Nat.succ fun _ => id), by rintro \u27e8n | n, x\u27e9 <;> rfl, by\n rintro (x | \u27e8n, x\u27e9) <;> rfl\u27e9\n```\n\n-- snippet 102\n```lean\n-- Mathlib.Logic.Equiv.Basic.symm_swap (L669-L671)\ntheorem symm_swap (a b : \u03b1) : (swap a b).symm = swap a b :=\nrfl\n```\n\n-- snippet 103\n```lean\n-- Mathlib.Logic.Equiv.Basic.sigmaAssocProd (L427-L432)\ndef sigmaAssocProd {\u03b1 \u03b2 : Type*} {\u03b3 : \u03b1 \u2192 \u03b2 \u2192 Type*} :\n (ab : \u03b1 \u00d7 \u03b2) \u00d7 \u03b3 ab.1 ab.2 \u2243 (a : \u03b1) \u00d7 (b : \u03b2) \u00d7 \u03b3 a b :=\nsigmaCongrLeft' (sigmaEquivProd _ _).symm |>.trans <| sigmaAssoc \u03b3\n\n/-- A subtype of a sigma which pins down the base of the sigma is equivalent to\nthe respective fiber. -/\n```\n\n-- snippet 104\n```lean\n-- Mathlib.Logic.Equiv.Basic.sigmaSigmaSubtypeEq_apply (L476-L480)\nlemma sigmaSigmaSubtypeEq_apply {\u03b1 \u03b2 : Type*} {\u03b3 : \u03b1 \u2192 \u03b2 \u2192 Type*} {a : \u03b1} {b : \u03b2}\n (s : {s : (a : \u03b1) \u00d7 (b : \u03b2) \u00d7 \u03b3 a b // s.1 = a \u2227 s.2.1 = b}) :\n sigmaSigmaSubtypeEq a b s = cast (congrArg\u2082 \u03b3 s.2.1 s.2.2) s.1.2.2 := by\nsimp [sigmaSigmaSubtypeEq]\n```\n\n-- snippet 105\n```lean\n-- Mathlib.Logic.Equiv.Basic.natEquivNatSumPUnit (L221-L227)\ndef natEquivNatSumPUnit : \u2115 \u2243 \u2115 \u2295 PUnit where\n toFun n := Nat.casesOn n (inr PUnit.unit) inl\ninvFun := Sum.elim Nat.succ fun _ => 0\n left_inv n := by cases n <;> rfl\n right_inv := by rintro (_ | _) <;> rfl\n\n/-- `\u2115 \u2295 PUnit` is equivalent to `\u2115`. -/\n```\n[/INST]", "sample_id": "C-Mathlib.Logic.Equiv.PartialEquiv.refl_coe", "source": {"declaration": "Mathlib.Logic.Equiv.PartialEquiv.refl_coe", "file": "Mathlib/Logic/Equiv/PartialEquiv.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Logic.Equiv.PartialEquiv", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Logic/Equiv/PartialEquiv.lean#L519", "span": "L519-L521"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "lemma isoLocallyConstantOfIsColimit_inv (X : LightProfinite.{u}\u1d52\u1d56 \u2964 Type u)\n [PreservesFiniteProducts X] (hX : \u2200 S : LightProfinite.{u}, (IsColimit <|\n X.mapCocone (coconeRightOpOfCone S.asLimitCone))) :\n (isoLocallyConstantOfIsColimit X hX).inv =\n (CompHausLike.LocallyConstant.counitApp.{u, u} X)\n:= by .someMissingNamespaceXYZ\ndsimp [isoLocallyConstantOfIsColimit]\n simp only [Category.assoc]\n rw [Iso.inv_comp_eq]\n ext S : 2\n apply colimit.hom_ext\n intro \u27e8Y, _, g\u27e9\n suffices _ \u226b (isoFinYonedaComponents _ _).inv \u226b X.map g =\n (locallyConstantPresheaf _).map g \u226b counitAppApp (Opposite.unop S) X by\n simpa [locallyConstantIsoFinYoneda, isoFinYoneda, counitApp]\n erw [(counitApp.{u, u} X).naturality]\n simp only [\u2190 Category.assoc, op_obj, functorToPresheaves_obj_obj]\n congr\n ext f\n simp only [types_comp_apply, counitApp_app]\n apply presheaf_ext.{u, u} (X := X) (Y := X) (f := f)\n intro x\n rw [incl_of_counitAppApp]\n simp only [counitAppAppImage]\n have : Finite (fiber.{u, u} f x) :=\n Finite.of_injective (sigmaIncl.{u, u} f x).1 Subtype.val_injective\n apply injective_of_mono (isoFinYonedaComponents X (fiber.{u, u} f x)).hom\n ext y\n simp only [isoFinYonedaComponents_hom_apply, \u2190 FunctorToTypes.map_comp_apply, \u2190 op_comp]\n rw [show (LightProfinite.of PUnit.{u + 1}).const y \u226b IsTerminal.from _ (fiber f x) = \ud835\udfd9 _ from rfl]\n simp only [op_comp, FunctorToTypes.map_comp_apply, op_id, FunctorToTypes.map_id_apply]\n rw [\u2190 isoFinYonedaComponents_inv_comp X _ (sigmaIncl.{u, u} f x)]\n simpa [\u2190 isoFinYonedaComponents_hom_apply] using x.map_eq_image f y\n\nend LightCondensed", "diagnostic": "[CompilationUnit(i_begin=0, i_end=70, messages=[Message(data='expected token', pos=Position(line=1, column=66), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=70, i_end=1652, messages=[Message(data='Invalid `end`: There is no current scope to end\\n\\nNote: Scopes are introduced using `namespace` and `section`', pos=Position(line=35, column=0), pos_end=Position(line=35, column=18), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]", "mutation_kind": "missing_import_open_namespace", "source_grounded_context_enriched": false, "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 2721, "declarations_count": 291, "diagnostics_count": 1, "duplicate_fingerprint": "ceaa0c0949f7ff3f", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 914, "lean_code_chars": 1620, "lean_code_ratio": 0.5954, "length_bucket": "short", "line_count": 46, "natural_language_chars": 1101, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Condensed.Discrete.Colimit).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma isoLocallyConstantOfIsColimit_inv (X : LightProfinite.{u}\u1d52\u1d56 \u2964 Type u)\n [PreservesFiniteProducts X] (hX : \u2200 S : LightProfinite.{u}, (IsColimit <|\n X.mapCocone (coconeRightOpOfCone S.asLimitCone))) :\n (isoLocallyConstantOfIsColimit X hX).inv =\n (CompHausLike.LocallyConstant.counitApp.{u, u} X)\n:= by .someMissingNamespaceXYZ\ndsimp [isoLocallyConstantOfIsColimit]\n simp only [Category.assoc]\n rw [Iso.inv_comp_eq]\n ext S : 2\n apply colimit.hom_ext\n intro \u27e8Y, _, g\u27e9\n suffices _ \u226b (isoFinYonedaComponents _ _).inv \u226b X.map g =\n (locallyConstantPresheaf _).map g \u226b counitAppApp (Opposite.unop S) X by\n simpa [locallyConstantIsoFinYoneda, isoFinYoneda, counitApp]\n erw [(counitApp.{u, u} X).naturality]\n simp only [\u2190 Category.assoc, op_obj, functorToPresheaves_obj_obj]\n congr\n ext f\n simp only [types_comp_apply, counitApp_app]\n apply presheaf_ext.{u, u} (X := X) (Y := X) (f := f)\n intro x\n rw [incl_of_counitAppApp]\n simp only [counitAppAppImage]\n have : Finite (fiber.{u, u} f x) :=\n Finite.of_injective (sigmaIncl.{u, u} f x).1 Subtype.val_injective\n apply injective_of_mono (isoFinYonedaComponents X (fiber.{u, u} f x)).hom\n ext y\n simp only [isoFinYonedaComponents_hom_apply, \u2190 FunctorToTypes.map_comp_apply, \u2190 op_comp]\n rw [show (LightProfinite.of PUnit.{u + 1}).const y \u226b IsTerminal.from _ (fiber f x) = \ud835\udfd9 _ from rfl]\n simp only [op_comp, FunctorToTypes.map_comp_apply, op_id, FunctorToTypes.map_id_apply]\n rw [\u2190 isoFinYonedaComponents_inv_comp X _ (sigmaIncl.{u, u} f x)]\n simpa [\u2190 isoFinYonedaComponents_hom_apply] using x.map_eq_image f y\n\nend LightCondensed\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=70, messages=[Message(data='expected token', pos=Position(line=1, column=66), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=70, i_end=1652, messages=[Message(data='Invalid `end`: There is no current scope to end\\n\\nNote: Scopes are introduced using `namespace` and `section`', pos=Position(line=35, column=0), pos_end=Position(line=35, 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.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Condensed.Discrete.Colimit).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma isoLocallyConstantOfIsColimit_inv (X : LightProfinite.{u}\u1d52\u1d56 \u2964 Type u)\n [PreservesFiniteProducts X] (hX : \u2200 S : LightProfinite.{u}, (IsColimit <|\n X.mapCocone (coconeRightOpOfCone S.asLimitCone))) :\n (isoLocallyConstantOfIsColimit X hX).inv =\n (CompHausLike.LocallyConstant.counitApp.{u, u} X)\n:= by .someMissingNamespaceXYZ\ndsimp [isoLocallyConstantOfIsColimit]\n simp only [Category.assoc]\n rw [Iso.inv_comp_eq]\n ext S : 2\n apply colimit.hom_ext\n intro \u27e8Y, _, g\u27e9\n suffices _ \u226b (isoFinYonedaComponents _ _).inv \u226b X.map g =\n (locallyConstantPresheaf _).map g \u226b counitAppApp (Opposite.unop S) X by\n simpa [locallyConstantIsoFinYoneda, isoFinYoneda, counitApp]\n erw [(counitApp.{u, u} X).naturality]\n simp only [\u2190 Category.assoc, op_obj, functorToPresheaves_obj_obj]\n congr\n ext f\n simp only [types_comp_apply, counitApp_app]\n apply presheaf_ext.{u, u} (X := X) (Y := X) (f := f)\n intro x\n rw [incl_of_counitAppApp]\n simp only [counitAppAppImage]\n have : Finite (fiber.{u, u} f x) :=\n Finite.of_injective (sigmaIncl.{u, u} f x).1 Subtype.val_injective\n apply injective_of_mono (isoFinYonedaComponents X (fiber.{u, u} f x)).hom\n ext y\n simp only [isoFinYonedaComponents_hom_apply, \u2190 FunctorToTypes.map_comp_apply, \u2190 op_comp]\n rw [show (LightProfinite.of PUnit.{u + 1}).const y \u226b IsTerminal.from _ (fiber f x) = \ud835\udfd9 _ from rfl]\n simp only [op_comp, FunctorToTypes.map_comp_apply, op_id, FunctorToTypes.map_id_apply]\n rw [\u2190 isoFinYonedaComponents_inv_comp X _ (sigmaIncl.{u, u} f x)]\n simpa [\u2190 isoFinYonedaComponents_hom_apply] using x.map_eq_image f y\n\nend LightCondensed\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=70, messages=[Message(data='expected token', pos=Position(line=1, column=66), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=70, i_end=1652, messages=[Message(data='Invalid `end`: There is no current scope to end\\n\\nNote: Scopes are introduced using `namespace` and `section`', pos=Position(line=35, column=0), pos_end=Position(line=35, 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]", "sample_id": "B-Mathlib.Condensed.Discrete.Colimit.isoLocallyConstantOfIsColimit_inv", "source": {"declaration": "Mathlib.Condensed.Discrete.Colimit.isoLocallyConstantOfIsColimit_inv", "file": "Mathlib/Condensed/Discrete/Colimit.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Condensed.Discrete.Colimit", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Condensed/Discrete/Colimit.lean#L535", "span": "L535-L568"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "F", "construction": {"context_enriched": true, "instruction": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.", "source_grounded_context_enriched": true, "statement": "lemma prod_le_prod_top {X Y : SSet.{u}} (A : X.Subcomplex) (B : Y.Subcomplex) :\n A.prod B \u2264 A.prod \u22a4", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 653, "declarations_count": 59, "diagnostics_count": 0, "duplicate_fingerprint": "01b60a471c879a4e", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 534, "lean_code_chars": 104, "lean_code_ratio": 0.1593, "length_bucket": "short", "line_count": 8, "natural_language_chars": 549, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplicialSet.Monoidal).", "role": "system"}, {"content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\nOpen namespaces: Simplicial, CategoryTheory, MonoidalCategory, CartesianMonoidalCategory\n\n## Surrounding context in Mathlib/AlgebraicTopology/SimplicialSet/Monoidal.lean\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.Monoidal.leftUnitor_hom_app_apply (L36-L38)\nlemma leftUnitor_hom_app_apply (K : SSet.{u}) {\u0394 : SimplexCategory\u1d52\u1d56} (x : (\ud835\udfd9_ _ \u2297 K).obj \u0394) :\n (\u03bb_ K).hom.app \u0394 x = x.2\n\n-- Mathlib.AlgebraicTopology.SimplicialSet.Monoidal.leftUnitor_inv_app_apply (L40-L42)\nlemma leftUnitor_inv_app_apply (K : SSet.{u}) {\u0394 : SimplexCategory\u1d52\u1d56} (x : K.obj \u0394) :\n (\u03bb_ K).inv.app \u0394 x = \u27e8PUnit.unit, x\u27e9\n\n-- Mathlib.AlgebraicTopology.SimplicialSet.Monoidal.rightUnitor_hom_app_apply (L44-L46)\nlemma rightUnitor_hom_app_apply (K : SSet.{u}) {\u0394 : SimplexCategory\u1d52\u1d56} (x : (K \u2297 \ud835\udfd9_ _).obj \u0394) :\n (\u03c1_ K).hom.app \u0394 x = x.1\n```\n\n```lean\nlemma prod_le_prod_top {X Y : SSet.{u}} (A : X.Subcomplex) (B : Y.Subcomplex) :\n A.prod B \u2264 A.prod \u22a4\n```\n\nDeclaration: `Mathlib.AlgebraicTopology.SimplicialSet.Monoidal.prod_le_prod_top` (module Mathlib.AlgebraicTopology.SimplicialSet.Monoidal).", "role": "user"}], "rendered_text": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplicialSet.Monoidal).\n\nExplain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\nOpen namespaces: Simplicial, CategoryTheory, MonoidalCategory, CartesianMonoidalCategory\n\n## Surrounding context in Mathlib/AlgebraicTopology/SimplicialSet/Monoidal.lean\n```lean\n-- Mathlib.AlgebraicTopology.SimplicialSet.Monoidal.leftUnitor_hom_app_apply (L36-L38)\nlemma leftUnitor_hom_app_apply (K : SSet.{u}) {\u0394 : SimplexCategory\u1d52\u1d56} (x : (\ud835\udfd9_ _ \u2297 K).obj \u0394) :\n (\u03bb_ K).hom.app \u0394 x = x.2\n\n-- Mathlib.AlgebraicTopology.SimplicialSet.Monoidal.leftUnitor_inv_app_apply (L40-L42)\nlemma leftUnitor_inv_app_apply (K : SSet.{u}) {\u0394 : SimplexCategory\u1d52\u1d56} (x : K.obj \u0394) :\n (\u03bb_ K).inv.app \u0394 x = \u27e8PUnit.unit, x\u27e9\n\n-- Mathlib.AlgebraicTopology.SimplicialSet.Monoidal.rightUnitor_hom_app_apply (L44-L46)\nlemma rightUnitor_hom_app_apply (K : SSet.{u}) {\u0394 : SimplexCategory\u1d52\u1d56} (x : (K \u2297 \ud835\udfd9_ _).obj \u0394) :\n (\u03c1_ K).hom.app \u0394 x = x.1\n```\n\n```lean\nlemma prod_le_prod_top {X Y : SSet.{u}} (A : X.Subcomplex) (B : Y.Subcomplex) :\n A.prod B \u2264 A.prod \u22a4\n```\n\nDeclaration: `Mathlib.AlgebraicTopology.SimplicialSet.Monoidal.prod_le_prod_top` (module Mathlib.AlgebraicTopology.SimplicialSet.Monoidal).", "sample_id": "F-Mathlib.AlgebraicTopology.SimplicialSet.Monoidal.prod_le_prod_top", "source": {"declaration": "Mathlib.AlgebraicTopology.SimplicialSet.Monoidal.prod_le_prod_top", "file": "Mathlib/AlgebraicTopology/SimplicialSet/Monoidal.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.SimplicialSet.Monoidal", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/SimplicialSet/Monoidal.lean#L134", "span": "L134-L138"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"source_grounded_context_enriched": false, "trace_states": [{"state": "lemma mem_skeleton {i : \u2115} (x : X _\u298bi\u298c) {n : \u2115} (hi : i < n", "tactic": "obtain \u27e8j, f, _, y, rfl\u27e9 := X.exists_nonDegenerate x suffices Subcomplex.ofSimplex y.1 \u2264 X.skeleton n from (X.skeleton n).map _ (this _ (Subcomplex.mem_ofSimplex_obj _))"}, {"state": "", "tactic": "exact le_trans (by exact le_trans (by rfl) (le_iSup _ y)) (le_iSup _ \u27e8j, lt_of_le_of_lt (SimplexCategory.len_le_of_epi f) hi\u27e9)"}], "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 1104, "declarations_count": 136, "diagnostics_count": 0, "duplicate_fingerprint": "383204b3587ae039", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 362, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "tiny", "line_count": 11, "natural_language_chars": 1104, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplicialSet.Skeleton).", "role": "system"}, {"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.AlgebraicTopology.SimplicialSet.Skeleton.mem_skeleton`:\nState 0: \u22a2 lemma mem_skeleton {i : \u2115} (x : X _\u298bi\u298c) {n : \u2115} (hi : i < n\nTactic: obtain \u27e8j, f, _, y, rfl\u27e9 := X.exists_nonDegenerate x suffices Subcomplex.ofSimplex y.1 \u2264 X.skeleton n from (X.skeleton n).map _ (this _ (Subcomplex.mem_ofSimplex_obj _))\nState 1: \u22a2 \nTactic: exact le_trans (by exact le_trans (by rfl) (le_iSup _ y)) (le_iSup _ \u27e8j, lt_of_le_of_lt (SimplexCategory.len_le_of_epi f) hi\u27e9)\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplicialSet.Skeleton).[/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.AlgebraicTopology.SimplicialSet.Skeleton.mem_skeleton`:\nState 0: \u22a2 lemma mem_skeleton {i : \u2115} (x : X _\u298bi\u298c) {n : \u2115} (hi : i < n\nTactic: obtain \u27e8j, f, _, y, rfl\u27e9 := X.exists_nonDegenerate x suffices Subcomplex.ofSimplex y.1 \u2264 X.skeleton n from (X.skeleton n).map _ (this _ (Subcomplex.mem_ofSimplex_obj _))\nState 1: \u22a2 \nTactic: exact le_trans (by exact le_trans (by rfl) (le_iSup _ y)) (le_iSup _ \u27e8j, lt_of_le_of_lt (SimplexCategory.len_le_of_epi f) hi\u27e9)\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.AlgebraicTopology.SimplicialSet.Skeleton.mem_skeleton", "source": {"declaration": "Mathlib.AlgebraicTopology.SimplicialSet.Skeleton.mem_skeleton", "file": "Mathlib/AlgebraicTopology/SimplicialSet/Skeleton.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.SimplicialSet.Skeleton", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/SimplicialSet/Skeleton.lean#L50", "span": "L50-L58"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"context_enriched": true, "excerpt": "```lean\ndef tr : \u039b' \u0393 \u039b \u2192 TM1.Stmt \u0393 (\u039b' \u0393 \u039b) Unit\n | \u039b'.normal q =>\n branch (fun a _ \u21a6 (M q a).isNone) halt <|\n goto fun a _ \u21a6 match M q a with\n | none => default -- unreachable\n | some (q', s) => \u039b'.act s q'\n | \u039b'.act (TM0.Stmt.move d) q => move d <| goto fun _ _ \u21a6 \u039b'.normal q\n | \u039b'.act (TM0.Stmt.write a) q => (write fun _ _ \u21a6 a) <| goto fun _ _ \u21a6 \u039b'.normal q\n\n/-- The configuration translation. -/\n```", "instruction": "Edit `tr` so it still compiles and the proof is simplified where possible. Return the full updated `tr` block.", "proof_is_oneliner": false, "source_grounded_context_enriched": true, "target_span": "L986-L995", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 1155, "declarations_count": 138, "diagnostics_count": 0, "duplicate_fingerprint": "4f22e14f35bb1480", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 552, "lean_code_chars": 416, "lean_code_ratio": 0.3602, "length_bucket": "short", "line_count": 19, "natural_language_chars": 739, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.TuringMachine.PostTuringMachine).", "role": "system"}, {"content": "You are editing a file in `Mathlib/Computability/TuringMachine/PostTuringMachine.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Computability.TuringMachine.PostTuringMachine.tr`, L986-L995)\nOpen namespaces: List, (Vector), Relation, Nat, (iterate), Function, (update, iterate_succ\n\n## Surrounding context in Mathlib/Computability/TuringMachine/PostTuringMachine.lean\n```lean\n-- Mathlib.Computability.TuringMachine.PostTuringMachine.Stmt (L122-L133)\ninstance Stmt.inhabited [Inhabited \u0393] : Inhabited (Stmt \u0393)\n\n-- Mathlib.Computability.TuringMachine.PostTuringMachine.Machine (L135-L152)\ndef Machine [Inhabited \u039b]\n\n-- Mathlib.Computability.TuringMachine.PostTuringMachine.Cfg (L156-L158)\ninstance Cfg.inhabited : Inhabited (Cfg \u0393 \u039b)\n```\n\n```lean\ndef tr : \u039b' \u0393 \u039b \u2192 TM1.Stmt \u0393 (\u039b' \u0393 \u039b) Unit\n | \u039b'.normal q =>\n branch (fun a _ \u21a6 (M q a).isNone) halt <|\n goto fun a _ \u21a6 match M q a with\n | none => default -- unreachable\n | some (q', s) => \u039b'.act s q'\n | \u039b'.act (TM0.Stmt.move d) q => move d <| goto fun _ _ \u21a6 \u039b'.normal q\n | \u039b'.act (TM0.Stmt.write a) q => (write fun _ _ \u21a6 a) <| goto fun _ _ \u21a6 \u039b'.normal q\n\n/-- The configuration translation. -/\n```\n\n## Edit instruction\nEdit `tr` so it still compiles and the proof is simplified where possible. Return the full updated `tr` block.\n", "role": "user"}], "rendered_text": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.TuringMachine.PostTuringMachine).\n\nYou are editing a file in `Mathlib/Computability/TuringMachine/PostTuringMachine.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Computability.TuringMachine.PostTuringMachine.tr`, L986-L995)\nOpen namespaces: List, (Vector), Relation, Nat, (iterate), Function, (update, iterate_succ\n\n## Surrounding context in Mathlib/Computability/TuringMachine/PostTuringMachine.lean\n```lean\n-- Mathlib.Computability.TuringMachine.PostTuringMachine.Stmt (L122-L133)\ninstance Stmt.inhabited [Inhabited \u0393] : Inhabited (Stmt \u0393)\n\n-- Mathlib.Computability.TuringMachine.PostTuringMachine.Machine (L135-L152)\ndef Machine [Inhabited \u039b]\n\n-- Mathlib.Computability.TuringMachine.PostTuringMachine.Cfg (L156-L158)\ninstance Cfg.inhabited : Inhabited (Cfg \u0393 \u039b)\n```\n\n```lean\ndef tr : \u039b' \u0393 \u039b \u2192 TM1.Stmt \u0393 (\u039b' \u0393 \u039b) Unit\n | \u039b'.normal q =>\n branch (fun a _ \u21a6 (M q a).isNone) halt <|\n goto fun a _ \u21a6 match M q a with\n | none => default -- unreachable\n | some (q', s) => \u039b'.act s q'\n | \u039b'.act (TM0.Stmt.move d) q => move d <| goto fun _ _ \u21a6 \u039b'.normal q\n | \u039b'.act (TM0.Stmt.write a) q => (write fun _ _ \u21a6 a) <| goto fun _ _ \u21a6 \u039b'.normal q\n\n/-- The configuration translation. -/\n```\n\n## Edit instruction\nEdit `tr` so it still compiles and the proof is simplified where possible. Return the full updated `tr` block.\n", "sample_id": "D-Mathlib.Computability.TuringMachine.PostTuringMachine.tr", "source": {"declaration": "Mathlib.Computability.TuringMachine.PostTuringMachine.tr", "file": "Mathlib/Computability/TuringMachine/PostTuringMachine.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Computability.TuringMachine.PostTuringMachine", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Computability/TuringMachine/PostTuringMachine.lean#L986", "span": "L986-L995"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"source_grounded_context_enriched": false, "trace_states": [{"state": "lemma face_eq_ofSimplex {n : \u2115} (S : Finset (Fin (n + 1))) (m : \u2115) (e : Fin (m + 1) \u2243o S) :\n face.{u} S =\n Subcomplex.ofSimplex (X", "tactic": "apply le_antisymm \u00b7 rintro \u27e8k\u27e9 x hx"}, {"state": "", "tactic": "induction k using SimplexCategory.rec with | _ k"}, {"state": "", "tactic": "rw [mem_face_iff] at hx let \u03c6 : Fin (k + 1) \u2192o S := { toFun i := \u27e8x i, hx i\u27e9 monotone' := (objEquiv x).toOrderHom.monotone }"}, {"state": "", "tactic": "refine \u27e8Quiver.Hom.op (SimplexCategory.Hom.mk ((e.symm.toOrderEmbedding.toOrderHom.comp \u03c6))), ?_\u27e9"}, {"state": "", "tactic": "ext j : 1"}, {"state": "", "tactic": "simpa only [Subtype.ext_iff] using e.apply_symm_apply \u27e8_, hx j\u27e9 \u00b7 simp set_option backward.isDefEq.respectTransparency false in /-- If `S : Finset (Fin (n + 1))` is order isomorphic to `Fin (m + 1)`, then the face `face S` of `\u0394[n]` is representable by `m`, i.e. `face S` is isomorphic to `\u0394[m]`, see `stdSimplex.isoOfRepresentableBy`. -/"}], "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 1756, "declarations_count": 212, "diagnostics_count": 0, "duplicate_fingerprint": "6464181588479a00", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 616, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "short", "line_count": 21, "natural_language_chars": 1756, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplicialSet.StdSimplex).", "role": "system"}, {"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.AlgebraicTopology.SimplicialSet.StdSimplex.face_eq_ofSimplex`:\nState 0: \u22a2 lemma face_eq_ofSimplex {n : \u2115} (S : Finset (Fin (n + 1))) (m : \u2115) (e : Fin (m + 1) \u2243o S) :\n face.{u} S =\n Subcomplex.ofSimplex (X\nTactic: apply le_antisymm \u00b7 rintro \u27e8k\u27e9 x hx\nState 1: \u22a2 \nTactic: induction k using SimplexCategory.rec with | _ k\nState 2: \u22a2 \nTactic: rw [mem_face_iff] at hx let \u03c6 : Fin (k + 1) \u2192o S := { toFun i := \u27e8x i, hx i\u27e9 monotone' := (objEquiv x).toOrderHom.monotone }\nState 3: \u22a2 \nTactic: refine \u27e8Quiver.Hom.op (SimplexCategory.Hom.mk ((e.symm.toOrderEmbedding.toOrderHom.comp \u03c6))), ?_\u27e9\nState 4: \u22a2 \nTactic: ext j : 1\nState 5: \u22a2 \nTactic: simpa only [Subtype.ext_iff] using e.apply_symm_apply \u27e8_, hx j\u27e9 \u00b7 simp set_option backward.isDefEq.respectTransparency false in /-- If `S : Finset (Fin (n + 1))` is order isomorphic to `Fin (m + 1)`, then the face `face S` of `\u0394[n]` is representable by `m`, i.e. `face S` is isomorphic to `\u0394[m]`, see `stdSimplex.isoOfRepresentableBy`. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicTopology.SimplicialSet.StdSimplex).[/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.AlgebraicTopology.SimplicialSet.StdSimplex.face_eq_ofSimplex`:\nState 0: \u22a2 lemma face_eq_ofSimplex {n : \u2115} (S : Finset (Fin (n + 1))) (m : \u2115) (e : Fin (m + 1) \u2243o S) :\n face.{u} S =\n Subcomplex.ofSimplex (X\nTactic: apply le_antisymm \u00b7 rintro \u27e8k\u27e9 x hx\nState 1: \u22a2 \nTactic: induction k using SimplexCategory.rec with | _ k\nState 2: \u22a2 \nTactic: rw [mem_face_iff] at hx let \u03c6 : Fin (k + 1) \u2192o S := { toFun i := \u27e8x i, hx i\u27e9 monotone' := (objEquiv x).toOrderHom.monotone }\nState 3: \u22a2 \nTactic: refine \u27e8Quiver.Hom.op (SimplexCategory.Hom.mk ((e.symm.toOrderEmbedding.toOrderHom.comp \u03c6))), ?_\u27e9\nState 4: \u22a2 \nTactic: ext j : 1\nState 5: \u22a2 \nTactic: simpa only [Subtype.ext_iff] using e.apply_symm_apply \u27e8_, hx j\u27e9 \u00b7 simp set_option backward.isDefEq.respectTransparency false in /-- If `S : Finset (Fin (n + 1))` is order isomorphic to `Fin (m + 1)`, then the face `face S` of `\u0394[n]` is representable by `m`, i.e. `face S` is isomorphic to `\u0394[m]`, see `stdSimplex.isoOfRepresentableBy`. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.AlgebraicTopology.SimplicialSet.StdSimplex.face_eq_ofSimplex", "source": {"declaration": "Mathlib.AlgebraicTopology.SimplicialSet.StdSimplex.face_eq_ofSimplex", "file": "Mathlib/AlgebraicTopology/SimplicialSet/StdSimplex.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.SimplicialSet.StdSimplex", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/SimplicialSet/StdSimplex.lean#L276", "span": "L276-L297"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "F", "construction": {"context_enriched": true, "instruction": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.", "source_grounded_context_enriched": true, "statement": "theorem vector_tail {n} : Primrec (@List.Vector.tail \u03b1 n)", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 560, "declarations_count": 52, "diagnostics_count": 0, "duplicate_fingerprint": "e3bc8f5e5e570b2c", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 381, "lean_code_chars": 58, "lean_code_ratio": 0.1036, "length_bucket": "tiny", "line_count": 7, "natural_language_chars": 502, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.Primrec.List).", "role": "system"}, {"content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\nOpen namespaces: List, (Vector), Denumerable, Encodable, Function, Primrec, PrimrecPred\n\n## Surrounding context in Mathlib/Computability/Primrec/List.lean\n```lean\n-- Mathlib.Computability.Primrec.List.list (L109-L141)\ninstance list : Primcodable (List \u03b1)\n\n-- Mathlib.Computability.Primrec.List.list_cons (L142-L144)\ntheorem list_cons : Primrec\u2082 (@List.cons \u03b1)\n\n-- Mathlib.Computability.Primrec.List.list_casesOn (L145-L150)\ntheorem list_casesOn {f : \u03b1 \u2192 List \u03b2} {g : \u03b1 \u2192 \u03c3} {h : \u03b1 \u2192 \u03b2 \u00d7 List \u03b2 \u2192 \u03c3} :\n Primrec f \u2192\n Primrec g \u2192\n Primrec\u2082 h \u2192 @Primrec _ \u03c3 _ _ fun a => List.casesOn (f a) (g a) fun b l => h a (b, l)\n```\n\n```lean\ntheorem vector_tail {n} : Primrec (@List.Vector.tail \u03b1 n)\n```\n\nDeclaration: `Mathlib.Computability.Primrec.List.vector_tail` (module Mathlib.Computability.Primrec.List).", "role": "user"}], "rendered_text": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.Primrec.List).\n\nExplain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\nOpen namespaces: List, (Vector), Denumerable, Encodable, Function, Primrec, PrimrecPred\n\n## Surrounding context in Mathlib/Computability/Primrec/List.lean\n```lean\n-- Mathlib.Computability.Primrec.List.list (L109-L141)\ninstance list : Primcodable (List \u03b1)\n\n-- Mathlib.Computability.Primrec.List.list_cons (L142-L144)\ntheorem list_cons : Primrec\u2082 (@List.cons \u03b1)\n\n-- Mathlib.Computability.Primrec.List.list_casesOn (L145-L150)\ntheorem list_casesOn {f : \u03b1 \u2192 List \u03b2} {g : \u03b1 \u2192 \u03c3} {h : \u03b1 \u2192 \u03b2 \u00d7 List \u03b2 \u2192 \u03c3} :\n Primrec f \u2192\n Primrec g \u2192\n Primrec\u2082 h \u2192 @Primrec _ \u03c3 _ _ fun a => List.casesOn (f a) (g a) fun b l => h a (b, l)\n```\n\n```lean\ntheorem vector_tail {n} : Primrec (@List.Vector.tail \u03b1 n)\n```\n\nDeclaration: `Mathlib.Computability.Primrec.List.vector_tail` (module Mathlib.Computability.Primrec.List).", "sample_id": "F-Mathlib.Computability.Primrec.List.vector_tail", "source": {"declaration": "Mathlib.Computability.Primrec.List.vector_tail", "file": "Mathlib/Computability/Primrec/List.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Computability.Primrec.List", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Computability/Primrec/List.lean#L547", "span": "L547-L549"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"context_enriched": true, "excerpt": "```lean\ntheorem fix_eq_of_\u03c9ScottContinuous (hc : \u03c9ScottContinuous g) :\n Part.fix g = g (Part.fix g) := by\nrw [fix_eq_\u03c9Sup_of_\u03c9ScottContinuous hc, hc.map_\u03c9Sup]\n apply le_antisymm\n \u00b7 apply \u03c9Sup_le_\u03c9Sup_of_le _\n intro i\n exists i\n apply le_f_of_mem_approx _ \u27e8i, rfl\u27e9\n \u00b7 apply \u03c9Sup_le_\u03c9Sup_of_le _\n intro i\n exists i.succ\n\nend Part\n\nnamespace Part\n\n/-- `toUnit` as a monotone function -/\n```", "instruction": "Edit `fix_eq_of_\u03c9ScottContinuous` so it still compiles and the proof is simplified where possible. Return the full updated `fix_eq_of_\u03c9ScottContinuous` block.", "proof_is_oneliner": false, "source_grounded_context_enriched": true, "target_span": "L156-L172", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 1124, "declarations_count": 128, "diagnostics_count": 0, "duplicate_fingerprint": "75e6f0f040e52e03", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 602, "lean_code_chars": 397, "lean_code_ratio": 0.3532, "length_bucket": "short", "line_count": 26, "natural_language_chars": 727, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Control.LawfulFix).", "role": "system"}, {"content": "You are editing a file in `Mathlib/Control/LawfulFix.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Control.LawfulFix.fix_eq_of_\u03c9ScottContinuous`, L156-L172)\nOpen namespaces: OmegaCompletePartialOrder, Nat, Nat.Upto, Fix\n\n## Surrounding context in Mathlib/Control/LawfulFix.lean\n```lean\n-- Mathlib.Control.LawfulFix.approx_mono' (L49-L53)\ntheorem approx_mono' {i : \u2115} : Fix.approx f i \u2264 Fix.approx f (succ i)\n\n-- Mathlib.Control.LawfulFix.approx_mono (L54-L60)\ntheorem approx_mono \u2983i j : \u2115\u2984 (hij : i \u2264 j) : approx f i \u2264 approx f j\n\n-- Mathlib.Control.LawfulFix.mem_iff (L61-L83)\ntheorem mem_iff (a : \u03b1) (b : \u03b2 a) : b \u2208 Part.fix f a \u2194 \u2203 i, b \u2208 approx f i a\n```\n\nRelevant lemmas available in scope: `le_antisymm`, `i`, `le_f_of_mem_approx`\n\n```lean\ntheorem fix_eq_of_\u03c9ScottContinuous (hc : \u03c9ScottContinuous g) :\n Part.fix g = g (Part.fix g) := by\nrw [fix_eq_\u03c9Sup_of_\u03c9ScottContinuous hc, hc.map_\u03c9Sup]\n apply le_antisymm\n \u00b7 apply \u03c9Sup_le_\u03c9Sup_of_le _\n intro i\n exists i\n apply le_f_of_mem_approx _ \u27e8i, rfl\u27e9\n \u00b7 apply \u03c9Sup_le_\u03c9Sup_of_le _\n intro i\n exists i.succ\n\nend Part\n\nnamespace Part\n\n/-- `toUnit` as a monotone function -/\n```\n\n## Edit instruction\nEdit `fix_eq_of_\u03c9ScottContinuous` so it still compiles and the proof is simplified where possible. Return the full updated `fix_eq_of_\u03c9ScottContinuous` block.\n", "role": "user"}], "rendered_text": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Control.LawfulFix).\n\nYou are editing a file in `Mathlib/Control/LawfulFix.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Control.LawfulFix.fix_eq_of_\u03c9ScottContinuous`, L156-L172)\nOpen namespaces: OmegaCompletePartialOrder, Nat, Nat.Upto, Fix\n\n## Surrounding context in Mathlib/Control/LawfulFix.lean\n```lean\n-- Mathlib.Control.LawfulFix.approx_mono' (L49-L53)\ntheorem approx_mono' {i : \u2115} : Fix.approx f i \u2264 Fix.approx f (succ i)\n\n-- Mathlib.Control.LawfulFix.approx_mono (L54-L60)\ntheorem approx_mono \u2983i j : \u2115\u2984 (hij : i \u2264 j) : approx f i \u2264 approx f j\n\n-- Mathlib.Control.LawfulFix.mem_iff (L61-L83)\ntheorem mem_iff (a : \u03b1) (b : \u03b2 a) : b \u2208 Part.fix f a \u2194 \u2203 i, b \u2208 approx f i a\n```\n\nRelevant lemmas available in scope: `le_antisymm`, `i`, `le_f_of_mem_approx`\n\n```lean\ntheorem fix_eq_of_\u03c9ScottContinuous (hc : \u03c9ScottContinuous g) :\n Part.fix g = g (Part.fix g) := by\nrw [fix_eq_\u03c9Sup_of_\u03c9ScottContinuous hc, hc.map_\u03c9Sup]\n apply le_antisymm\n \u00b7 apply \u03c9Sup_le_\u03c9Sup_of_le _\n intro i\n exists i\n apply le_f_of_mem_approx _ \u27e8i, rfl\u27e9\n \u00b7 apply \u03c9Sup_le_\u03c9Sup_of_le _\n intro i\n exists i.succ\n\nend Part\n\nnamespace Part\n\n/-- `toUnit` as a monotone function -/\n```\n\n## Edit instruction\nEdit `fix_eq_of_\u03c9ScottContinuous` so it still compiles and the proof is simplified where possible. Return the full updated `fix_eq_of_\u03c9ScottContinuous` block.\n", "sample_id": "D-Mathlib.Control.LawfulFix.fix_eq_of_\u03c9ScottContinuous", "source": {"declaration": "Mathlib.Control.LawfulFix.fix_eq_of_\u03c9ScottContinuous", "file": "Mathlib/Control/LawfulFix.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Control.LawfulFix", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Control/LawfulFix.lean#L156", "span": "L156-L172"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"context_enriched": true, "excerpt": "```lean\ntheorem ManyOneEquiv.symm {\u03b1 \u03b2} [Primcodable \u03b1] [Primcodable \u03b2] {p : \u03b1 \u2192 Prop} {q : \u03b2 \u2192 Prop} :\n ManyOneEquiv p q \u2192 ManyOneEquiv q p := And.symm\n```", "instruction": "Edit `ManyOneEquiv` so it still compiles and the proof is simplified where possible. Return the full updated `ManyOneEquiv` block.", "proof_is_oneliner": false, "source_grounded_context_enriched": true, "target_span": "L147-L150", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 842, "declarations_count": 89, "diagnostics_count": 0, "duplicate_fingerprint": "211202e7961f518e", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 509, "lean_code_chars": 148, "lean_code_ratio": 0.1758, "length_bucket": "tiny", "line_count": 11, "natural_language_chars": 694, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.Reduce).", "role": "system"}, {"content": "You are editing a file in `Mathlib/Computability/Reduce.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Computability.Reduce.ManyOneEquiv`, L147-L150)\nOpen namespaces: Function, Computable\n\n## Surrounding context in Mathlib/Computability/Reduce.lean\n```lean\n-- Mathlib.Computability.Reduce.ManyOneReducible (L41-L43)\ndef ManyOneReducible {\u03b1 \u03b2} [Primcodable \u03b1] [Primcodable \u03b2] (p : \u03b1 \u2192 Prop) (q : \u03b2 \u2192 Prop)\n\n-- Mathlib.Computability.Reduce.ManyOneReducible (L47-L50)\ntheorem ManyOneReducible.mk {\u03b1 \u03b2} [Primcodable \u03b1] [Primcodable \u03b2] {f : \u03b1 \u2192 \u03b2} (q : \u03b2 \u2192 Prop)\n (h : Computable f) : (fun a => q (f a)) \u2264\u2080 q\n\n-- Mathlib.Computability.Reduce.manyOneReducible_refl (L52-L54)\ntheorem manyOneReducible_refl {\u03b1} [Primcodable \u03b1] (p : \u03b1 \u2192 Prop) : p \u2264\u2080 p\n```\n\n```lean\ntheorem ManyOneEquiv.symm {\u03b1 \u03b2} [Primcodable \u03b1] [Primcodable \u03b2] {p : \u03b1 \u2192 Prop} {q : \u03b2 \u2192 Prop} :\n ManyOneEquiv p q \u2192 ManyOneEquiv q p := And.symm\n```\n\n## Edit instruction\nEdit `ManyOneEquiv` so it still compiles and the proof is simplified where possible. Return the full updated `ManyOneEquiv` block.\n", "role": "user"}], "rendered_text": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.Reduce).\n\nYou are editing a file in `Mathlib/Computability/Reduce.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Computability.Reduce.ManyOneEquiv`, L147-L150)\nOpen namespaces: Function, Computable\n\n## Surrounding context in Mathlib/Computability/Reduce.lean\n```lean\n-- Mathlib.Computability.Reduce.ManyOneReducible (L41-L43)\ndef ManyOneReducible {\u03b1 \u03b2} [Primcodable \u03b1] [Primcodable \u03b2] (p : \u03b1 \u2192 Prop) (q : \u03b2 \u2192 Prop)\n\n-- Mathlib.Computability.Reduce.ManyOneReducible (L47-L50)\ntheorem ManyOneReducible.mk {\u03b1 \u03b2} [Primcodable \u03b1] [Primcodable \u03b2] {f : \u03b1 \u2192 \u03b2} (q : \u03b2 \u2192 Prop)\n (h : Computable f) : (fun a => q (f a)) \u2264\u2080 q\n\n-- Mathlib.Computability.Reduce.manyOneReducible_refl (L52-L54)\ntheorem manyOneReducible_refl {\u03b1} [Primcodable \u03b1] (p : \u03b1 \u2192 Prop) : p \u2264\u2080 p\n```\n\n```lean\ntheorem ManyOneEquiv.symm {\u03b1 \u03b2} [Primcodable \u03b1] [Primcodable \u03b2] {p : \u03b1 \u2192 Prop} {q : \u03b2 \u2192 Prop} :\n ManyOneEquiv p q \u2192 ManyOneEquiv q p := And.symm\n```\n\n## Edit instruction\nEdit `ManyOneEquiv` so it still compiles and the proof is simplified where possible. Return the full updated `ManyOneEquiv` block.\n", "sample_id": "D-Mathlib.Computability.Reduce.ManyOneEquiv", "source": {"declaration": "Mathlib.Computability.Reduce.ManyOneEquiv", "file": "Mathlib/Computability/Reduce.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Computability.Reduce", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Computability/Reduce.lean#L147", "span": "L147-L150"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "theorem append_mem_mul : a \u2208 l \u2192 b \u2208 m \u2192 a ++ b \u2208 l * m\n frobnicateTacticThatDoesNotExist :=\nmem_image2_of_mem", "diagnostic": "[CompilationUnit(i_begin=0, i_end=121, messages=[Message(data=\"Function expected at\\n m\\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 `m` 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=54), pos_end=Position(line=2, column=34), severity=, kind=None), Message(data='Unknown identifier `mem_image2_of_mem`', pos=Position(line=3, column=0), pos_end=Position(line=3, column=17), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]", "mutation_kind": "plausible_wrong_tactic", "source_grounded_context_enriched": false, "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 1555, "declarations_count": 195, "diagnostics_count": 1, "duplicate_fingerprint": "c9942489027fedd5", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 419, "lean_code_chars": 112, "lean_code_ratio": 0.072, "length_bucket": "tiny", "line_count": 14, "natural_language_chars": 1443, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 0, "tokenizer": "mistralai/Leanstral-1.5-119B-A6B:tekken.json", "tool_transcript_turns": 0, "triviality_score": 0.0}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.Language).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem append_mem_mul : a \u2208 l \u2192 b \u2208 m \u2192 a ++ b \u2208 l * m\n frobnicateTacticThatDoesNotExist :=\nmem_image2_of_mem\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=121, messages=[Message(data=\"Function expected at\\n m\\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 `m` 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=54), pos_end=Position(line=2, column=34), severity=, kind=None), Message(data='Unknown identifier `mem_image2_of_mem`', pos=Position(line=3, column=0), pos_end=Position(line=3, column=17), 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.", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. Complete the task below using the provided Lean source context. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Computability.Language).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem append_mem_mul : a \u2208 l \u2192 b \u2208 m \u2192 a ++ b \u2208 l * m\n frobnicateTacticThatDoesNotExist :=\nmem_image2_of_mem\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=121, messages=[Message(data=\"Function expected at\\n m\\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 `m` 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=54), pos_end=Position(line=2, column=34), severity=, kind=None), Message(data='Unknown identifier `mem_image2_of_mem`', pos=Position(line=3, column=0), pos_end=Position(line=3, column=17), 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]", "sample_id": "B-Mathlib.Computability.Language.append_mem_mul", "source": {"declaration": "Mathlib.Computability.Language.append_mem_mul", "file": "Mathlib/Computability/Language.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Computability.Language", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Computability/Language.lean#L145", "span": "L145-L147"}}