{"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Data.WSeq.Relation.LiftRelO (L37-L41)\ndef LiftRelO (R : \u03b1 \u2192 \u03b2 \u2192 Prop) (C : WSeq \u03b1 \u2192 WSeq \u03b2 \u2192 Prop) :\n Option (\u03b1 \u00d7 WSeq \u03b1) \u2192 Option (\u03b2 \u00d7 WSeq \u03b2) \u2192 Prop\n | none, none => True\n | some (a, s), some (b, t) => R a b \u2227 C s t\n | _, _ => False", "-- Mathlib.Data.WSeq.Relation.LiftRelO (L44-L50)\ntheorem LiftRelO.imp {R S : \u03b1 \u2192 \u03b2 \u2192 Prop} {C D : WSeq \u03b1 \u2192 WSeq \u03b2 \u2192 Prop} (H1 : \u2200 a b, R a b \u2192 S a b)\n (H2 : \u2200 s t, C s t \u2192 D s t) : \u2200 {o p}, LiftRelO R C o p \u2192 LiftRelO S D o p\n | none, none, _ => trivial\n | some (_, _), some (_, _), h => And.imp (H1 _ _) (H2 _ _) h\n | none, some _, h => False.elim h\n | some (_, _), none, h => False.elim h", "-- Mathlib.Data.WSeq.Relation.LiftRelO (L51-L54)\ntheorem LiftRelO.imp_right (R : \u03b1 \u2192 \u03b2 \u2192 Prop) {C D : WSeq \u03b1 \u2192 WSeq \u03b2 \u2192 Prop}\n (H : \u2200 s t, C s t \u2192 D s t) {o p} : LiftRelO R C o p \u2192 LiftRelO R D o p :=\nLiftRelO.imp (fun _ _ => id) H", "-- Mathlib.Data.WSeq.Relation.LiftRelO (L55-L60)\ntheorem LiftRelO.swap (R : \u03b1 \u2192 \u03b2 \u2192 Prop) (C) :\n swap (LiftRelO R C) = LiftRelO (swap R) (swap C) := by\nfunext x y\n rcases x with \u27e8\u27e9 | \u27e8hx, jx\u27e9 <;> rcases y with \u27e8\u27e9 | \u27e8hy, jy\u27e9 <;> rfl\n\n/-- Definition of bisimilarity for weak sequences -/", "-- Mathlib.Data.WSeq.Relation.BisimO (L62-L64)\ndef BisimO (R : WSeq \u03b1 \u2192 WSeq \u03b1 \u2192 Prop) : Option (\u03b1 \u00d7 WSeq \u03b1) \u2192 Option (\u03b1 \u00d7 WSeq \u03b1) \u2192 Prop :=\nLiftRelO (\u00b7 = \u00b7) R", "-- Mathlib.Data.WSeq.Relation.BisimO (L65-L71)\ntheorem BisimO.imp {R S : WSeq \u03b1 \u2192 WSeq \u03b1 \u2192 Prop} (H : \u2200 s t, R s t \u2192 S s t) {o p} :\n BisimO R o p \u2192 BisimO S o p :=\nLiftRelO.imp_right _ H\n\n/-- Two weak sequences are `LiftRel R` related if they are either both empty,\n or they are both nonempty and the heads are `R` related and the tails are\n `LiftRel R` related. (This is a coinductive definition.) -/", "-- Mathlib.Data.WSeq.Relation.liftRel_destruct (L76-L82)\ntheorem liftRel_destruct {R : \u03b1 \u2192 \u03b2 \u2192 Prop} {s : WSeq \u03b1} {t : WSeq \u03b2} :\n LiftRel R s t \u2192 Computation.LiftRel (LiftRelO R (LiftRel R)) (destruct s) (destruct t)\n | \u27e8R, h1, h2\u27e9 => by\n refine Computation.LiftRel.imp ?_ _ _ (h2 h1)\n apply LiftRelO.imp_right\n exact fun s' t' h' => \u27e8R, h', @h2\u27e9", "-- Mathlib.Data.WSeq.Relation.liftRel_destruct_iff (L83-L97)\ntheorem liftRel_destruct_iff {R : \u03b1 \u2192 \u03b2 \u2192 Prop} {s : WSeq \u03b1} {t : WSeq \u03b2} :\n LiftRel R s t \u2194 Computation.LiftRel (LiftRelO R (LiftRel R)) (destruct s) (destruct t) :=\n\u27e8liftRel_destruct, fun h =>\n \u27e8fun s t =>\n LiftRel R s t \u2228 Computation.LiftRel (LiftRelO R (LiftRel R)) (destruct s) (destruct t),\n Or.inr h, fun {s t} h => by\n have h : Computation.LiftRel (LiftRelO R (LiftRel R)) (destruct s) (destruct t) := by\n obtain h | h := h\n \u00b7 exact liftRel_destruct h\n \u00b7 assumption\n apply Computation.LiftRel.imp _ _ _ h\n apply LiftRelO.imp_right\n intro s t\n apply Or.inl\u27e9\u27e9", "-- Mathlib.Data.WSeq.Relation.Equiv (L159-L161)\ndef Equiv : WSeq \u03b1 \u2192 WSeq \u03b1 \u2192 Prop :=\nLiftRel (\u00b7 = \u00b7)", "-- Mathlib.Data.WSeq.Relation.Equiv (L165-L167)\ntheorem Equiv.refl : \u2200 s : WSeq \u03b1, s ~\u02b7 s :=\nLiftRel.refl (\u00b7 = \u00b7) Eq.refl", "-- Mathlib.Data.WSeq.Relation.Equiv (L169-L171)\ntheorem Equiv.symm : \u2200 {s t : WSeq \u03b1}, s ~\u02b7 t \u2192 t ~\u02b7 s :=\n@(LiftRel.symm (\u00b7 = \u00b7) (@Eq.symm _))", "-- Mathlib.Data.WSeq.Relation.Equiv (L173-L175)\ntheorem Equiv.trans : \u2200 {s t u : WSeq \u03b1}, s ~\u02b7 t \u2192 t ~\u02b7 u \u2192 s ~\u02b7 u :=\nLiftRel.trans (\u00b7 = \u00b7) inferInstance |>.trans _ _ _", "-- Mathlib.Data.WSeq.Relation.Equiv (L176-L178)\ntheorem Equiv.equivalence : Equivalence (@Equiv \u03b1) :=\n\u27e8@Equiv.refl _, @Equiv.symm _, @Equiv.trans _\u27e9", "-- Mathlib.Data.WSeq.Relation.destruct_congr (L179-L182)\ntheorem destruct_congr {s t : WSeq \u03b1} :\n s ~\u02b7 t \u2192 Computation.LiftRel (BisimO (\u00b7 ~\u02b7 \u00b7)) (destruct s) (destruct t) :=\nliftRel_destruct", "-- Mathlib.Data.WSeq.Relation.destruct_congr_iff (L183-L188)\ntheorem destruct_congr_iff {s t : WSeq \u03b1} :\n s ~\u02b7 t \u2194 Computation.LiftRel (BisimO (\u00b7 ~\u02b7 \u00b7)) (destruct s) (destruct t) :=\nliftRel_destruct_iff\n\nopen Computation", "-- Mathlib.Data.WSeq.Relation.liftRel_dropn_destruct (L189-L200)\ntheorem liftRel_dropn_destruct {R : \u03b1 \u2192 \u03b2 \u2192 Prop} {s t} (H : LiftRel R s t) :\n \u2200 n, Computation.LiftRel (LiftRelO R (LiftRel R)) (destruct (drop s n)) (destruct (drop t n))\n | 0 => liftRel_destruct H\n | n + 1 => by\n simp only [drop, destruct_tail]\n apply liftRel_bind\n \u00b7 apply liftRel_dropn_destruct H n\n exact fun {a b} o =>\n match a, b, o with\n | none, none, _ => by simp\n | some (a, s), some (b, t), \u27e8_, h2\u27e9 => by simpa [tail.aux] using liftRel_destruct h2", "-- Mathlib.Data.WSeq.Relation.exists_of_liftRel_left (L201-L207)\ntheorem exists_of_liftRel_left {R : \u03b1 \u2192 \u03b2 \u2192 Prop} {s t} (H : LiftRel R s t) {a} (h : a \u2208 s) :\n \u2203 b, b \u2208 t \u2227 R a b := by\nlet \u27e8n, h\u27e9 := exists_get?_of_mem h\n let \u27e8some (_, s'), sd, rfl\u27e9 := Computation.exists_of_mem_map h\n let \u27e8some (b, t'), td, \u27e8ab, _\u27e9\u27e9 := (liftRel_dropn_destruct H n).left sd\n exact \u27e8b, get?_mem (Computation.mem_map (Prod.fst.{v, v} <$> \u00b7) td), ab\u27e9", "-- Mathlib.Data.WSeq.Relation.exists_of_liftRel_right (L208-L210)\ntheorem exists_of_liftRel_right {R : \u03b1 \u2192 \u03b2 \u2192 Prop} {s t} (H : LiftRel R s t) {b} (h : b \u2208 t) :\n \u2203 a, a \u2208 s \u2227 R a b := by rw [\u2190 LiftRel.swap] at H; exact exists_of_liftRel_left H h", "-- Mathlib.Data.WSeq.Relation.liftRel_nil (L212-L214)\ntheorem liftRel_nil (R : \u03b1 \u2192 \u03b2 \u2192 Prop) : LiftRel R nil nil := by\nsimp [liftRel_destruct_iff]", "-- Mathlib.Data.WSeq.Relation.liftRel_cons (L216-L219)\ntheorem liftRel_cons (R : \u03b1 \u2192 \u03b2 \u2192 Prop) (a b s t) :\n LiftRel R (cons a s) (cons b t) \u2194 R a b \u2227 LiftRel R s t := by\nsimp [liftRel_destruct_iff]", "-- Mathlib.Data.WSeq.Relation.liftRel_think_left (L221-L223)\ntheorem liftRel_think_left (R : \u03b1 \u2192 \u03b2 \u2192 Prop) (s t) : LiftRel R (think s) t \u2194 LiftRel R s t := by\nrw [liftRel_destruct_iff, liftRel_destruct_iff]; simp", "-- Mathlib.Data.WSeq.Relation.liftRel_think_right (L225-L227)\ntheorem liftRel_think_right (R : \u03b1 \u2192 \u03b2 \u2192 Prop) (s t) : LiftRel R s (think t) \u2194 LiftRel R s t := by\nrw [liftRel_destruct_iff, liftRel_destruct_iff]; simp", "-- Mathlib.Data.WSeq.Relation.cons_congr (L228-L230)\ntheorem cons_congr {s t : WSeq \u03b1} (a : \u03b1) (h : s ~\u02b7 t) : cons a s ~\u02b7 cons a t := by\nunfold Equiv; simpa using h", "-- Mathlib.Data.WSeq.Relation.think_equiv (L231-L232)\ntheorem think_equiv (s : WSeq \u03b1) : think s ~\u02b7 s := by unfold Equiv; simpa using Equiv.refl _", "-- Mathlib.Data.WSeq.Relation.think_congr (L233-L235)\ntheorem think_congr {s t : WSeq \u03b1} (h : s ~\u02b7 t) : think s ~\u02b7 think t := by\nunfold Equiv; simpa using h", "-- Mathlib.Data.WSeq.Basic.head_terminates_iff (L248-L250)\ntheorem head_terminates_iff (s : WSeq \u03b1) : Terminates (head s) \u2194 Terminates (destruct s) :=\nterminates_map_iff _ (destruct s)", "-- Mathlib.Data.WSeq.Basic.flatten_pure (L218-L228)\ntheorem flatten_pure (s : WSeq \u03b1) : flatten (Computation.pure s) = s := by\nrefine Seq.eq_of_bisim (fun s1 s2 => flatten (Computation.pure s2) = s1) ?_ rfl\n intro s' s h\n rw [\u2190 h]\n simp only [Seq.BisimO, flatten, Seq.omap, pure_def, Seq.corec_eq, destruct_pure]\n cases Seq.destruct s with\n | none => simp\n | some val =>\n obtain \u27e8o, s'\u27e9 := val\n simp", "-- Mathlib.Data.WSeq.Basic.tail (L124-L127)\ndef tail (s : WSeq \u03b1) : WSeq \u03b1 :=\nflatten <| (fun o => Option.recOn o nil Prod.snd) <$> destruct s\n\n/-- drop the first `n` elements from `s`. -/", "-- Mathlib.Data.WSeq.Basic.eq_or_mem_iff_mem (L425-L445)\ntheorem eq_or_mem_iff_mem {s : WSeq \u03b1} {a a' s'} :\n some (a', s') \u2208 destruct s \u2192 (a \u2208 s \u2194 a = a' \u2228 a \u2208 s') := by\ngeneralize e : destruct s = c; intro h\n revert s\n apply Computation.memRecOn h <;> [skip; intro c IH] <;> intro s <;>\n induction s using WSeq.recOn <;>\n intro m <;>\n have := congr_arg Computation.destruct m <;>\n simp at this\n \u00b7 obtain \u27e8i1, i2\u27e9 := this\n rw [i1, i2]\n dsimp only [cons, Membership.mem, WSeq.Mem, Seq.Mem, Seq.cons]\n have h_a_eq_a' : a = a' \u2194 some (some a) = some (some a') := by simp\n rw [h_a_eq_a']\n refine \u27e8Stream'.eq_or_mem_of_mem_cons, fun o => ?_\u27e9\n \u00b7 rcases o with e | m\n \u00b7 rw [e]\n apply Stream'.mem_cons\n \u00b7 exact Stream'.mem_cons_of_mem _ m\n \u00b7 simp [IH this]", "-- Mathlib.Data.WSeq.Basic.mem_think (L415-L424)\ntheorem mem_think (s : WSeq \u03b1) (a) : a \u2208 think s \u2194 a \u2208 s := by\nobtain \u27e8f, al\u27e9 := s\n change (some (some a) \u2208 some none::f) \u2194 some (some a) \u2208 f\n constructor <;> intro h\n \u00b7 apply (Stream'.eq_or_mem_of_mem_cons h).resolve_left\n intro\n injections\n \u00b7 apply Stream'.mem_cons_of_mem _ h\n\nset_option linter.flexible false in -- TODO: fix non-terminal simp", "-- Mathlib.Data.WSeq.Basic.cons_append (L310-L312)\ntheorem cons_append (a : \u03b1) (s t) : append (cons a s) t = cons a (append s t) :=\nSeq.cons_append _ _ _", "-- Mathlib.Data.WSeq.Basic.toList'_cons (L554-L566)\ntheorem toList'_cons (l : List \u03b1) (s : WSeq \u03b1) (a : \u03b1) :\n Computation.corec (fun \u27e8l, s\u27e9 =>\n match Seq.destruct s with\n | none => Sum.inl l.reverse\n | some (none, s') => Sum.inr (l, s')\n | some (some a, s') => Sum.inr (a::l, s')) (l, cons a s) =\n (Computation.corec (fun \u27e8l, s\u27e9 =>\n match Seq.destruct s with\n | none => Sum.inl l.reverse\n | some (none, s') => Sum.inr (l, s')\n | some (some a, s') => Sum.inr (a::l, s')) (a::l, s)).think :=\ndestruct_eq_think <| by simp [cons]", "-- Mathlib.Data.WSeq.Basic.WSeq (L37-L44)\ndef WSeq (\u03b1) :=\nSeq (Option \u03b1)\n\nnamespace WSeq\n\nvariable {\u03b1 : Type u} {\u03b2 : Type v} {\u03b3 : Type w}\n\n/-- Turn a sequence into a weak sequence -/", "-- Mathlib.Data.WSeq.Basic.ofList (L51-L54)\ndef ofList (l : List \u03b1) : WSeq \u03b1 :=\nofSeq l\n\n/-- Turn a stream into a weak sequence -/", "-- Mathlib.Data.WSeq.Basic.head (L110-L114)\ndef head (s : WSeq \u03b1) : Computation (Option \u03b1) :=\nComputation.map (Prod.fst <$> \u00b7) (destruct s)\n\n/-- Encode a computation yielding a weak sequence into additional\n `think` constructors in a weak sequence -/", "-- Mathlib.Data.WSeq.Basic.head_terminates_of_head_tail_terminates (L353-L360)\ntheorem head_terminates_of_head_tail_terminates (s : WSeq \u03b1) [T : Terminates (head (tail s))] :\n Terminates (head s) :=\n(head_terminates_iff _).2 <| by\n rcases (head_terminates_iff _).1 T with \u27e8\u27e8a, h\u27e9\u27e9\n simp? [tail] at h says simp only [tail, destruct_flatten, bind_map_left] at h\n rcases exists_of_mem_bind h with \u27e8s', h1, _\u27e9\n exact terminates_of_mem h1", "-- Mathlib.Data.WSeq.Basic.destruct_terminates_of_get (L397-L400)\ntheorem destruct_terminates_of_get?_terminates {s : WSeq \u03b1} {n} (T : Terminates (get? s n)) :\n Terminates (destruct s) :=\n(head_terminates_iff _).1 <| head_terminates_of_get?_terminates T", "-- Mathlib.Data.WSeq.Basic.monad (L177-L183)\ninstance monad : Monad WSeq where\n map := @map\npure := @ret\n bind := @bind\n\nopen Computation", "-- Mathlib.Data.WSeq.Basic.exists_get (L487-L503)\ntheorem exists_get?_of_mem {s : WSeq \u03b1} {a} (h : a \u2208 s) : \u2203 n, some a \u2208 get? s n := by\napply mem_rec_on h\n \u00b7 intro a' s' h\n rcases h with h | h\n \u00b7 exists 0\n simp only [get?, drop, head_cons]\n rw [h]\n apply ret_mem\n \u00b7 obtain \u27e8n, h\u27e9 := h\n exists n + 1\n simpa [get?]\n \u00b7 intro s' h\n obtain \u27e8n, h\u27e9 := h\n exists n\n simp only [get?, dropn_think, head_think]\n apply think_mem h", "-- Mathlib.Data.WSeq.Basic.join_cons (L300-L304)\ntheorem join_cons (s : WSeq \u03b1) (S) : join (cons s S) = think (append s (join S)) := by\nsimp only [join, think]\n dsimp only [(\u00b7 <$> \u00b7)]\n simp [cons, append]", "-- Mathlib.Data.WSeq.Basic.dropn_tail (L278-L282)\ntheorem dropn_tail (s : WSeq \u03b1) (n) : drop (tail s) n = drop s (n + 1) := by\nrw [Nat.add_comm]\n symm\n apply dropn_add", "-- Mathlib.Data.WSeq.Basic.toList'_think (L568-L580)\ntheorem toList'_think (l : List \u03b1) (s : WSeq \u03b1) :\n Computation.corec (fun \u27e8l, s\u27e9 =>\n match Seq.destruct s with\n | none => Sum.inl l.reverse\n | some (none, s') => Sum.inr (l, s')\n | some (some a, s') => Sum.inr (a::l, s')) (l, think s) =\n (Computation.corec (fun \u27e8l, s\u27e9 =>\n match Seq.destruct s with\n | none => Sum.inl l.reverse\n | some (none, s') => Sum.inr (l, s')\n | some (some a, s') => Sum.inr (a::l, s')) (l, s)).think :=\ndestruct_eq_think <| by simp [think]", "-- Mathlib.Data.WSeq.Basic.head_cons (L212-L213)\ntheorem head_cons (a : \u03b1) (s) : head (cons a s) = Computation.pure (some a) := by simp [head]", "-- Mathlib.Data.WSeq.Basic.append_nil (L318-L320)\ntheorem append_nil (s : WSeq \u03b1) : append s nil = s :=\nSeq.append_nil _", "-- Mathlib.Data.WSeq.Basic.mem_of_mem_tail (L457-L468)\ntheorem mem_of_mem_tail {s : WSeq \u03b1} {a} : a \u2208 tail s \u2192 a \u2208 s := by\nintro h; have := h; obtain \u27e8n, e\u27e9 := h; revert s; simp only [Stream'.get]\n induction n <;> intro s <;> induction s using WSeq.recOn <;>\n simp <;> intro m e <;> injections\n \u00b7 exact Or.inr m\n \u00b7 exact Or.inr m\n case succ.think n IH s =>\n apply IH m\n rw [e]\n cases tail s\n rfl", "-- Mathlib.Data.WSeq.Basic.head_some_of_get (L379-L386)\ntheorem head_some_of_get?_some {s : WSeq \u03b1} {a n} (h : some a \u2208 get? s n) :\n \u2203 a', some a' \u2208 head s := by\ninduction n generalizing a with\n | zero => exact \u27e8_, h\u27e9\n | succ n IH =>\n let \u27e8a', h'\u27e9 := head_some_of_head_tail_some h\n exact IH h'", "-- Mathlib.Data.WSeq.Basic.dropn_nil (L261-L262)\ntheorem dropn_nil (n) : drop (nil : WSeq \u03b1) n = nil := by induction n <;> simp [*, drop]", "-- Mathlib.Data.WSeq.Basic.mem_cons_of_mem (L450-L452)\ntheorem mem_cons_of_mem {s : WSeq \u03b1} (b) {a} (h : a \u2208 s) : a \u2208 cons b s :=\n(mem_cons_iff _ _).2 (Or.inr h)", "-- Mathlib.Data.WSeq.Basic.head_nil (L209-L210)\ntheorem head_nil : head (nil : WSeq \u03b1) = Computation.pure none := by simp [head]", "-- Mathlib.Data.WSeq.Basic.mem_cons_iff (L447-L449)\ntheorem mem_cons_iff (s : WSeq \u03b1) (b) {a} : a \u2208 cons b s \u2194 a = b \u2228 a \u2208 s :=\neq_or_mem_iff_mem <| by simp", "-- Mathlib.Data.WSeq.Basic.coeList (L62-L64)\ninstance coeList : Coe (List \u03b1) (WSeq \u03b1) :=\n\u27e8ofList\u27e9", "-- Mathlib.Data.WSeq.Basic.tail_nil (L252-L253)\ntheorem tail_nil : tail (nil : WSeq \u03b1) = nil := by simp [tail]", "-- Mathlib.Data.WSeq.Basic.join_think (L294-L298)\ntheorem join_think (S : WSeq (WSeq \u03b1)) : join (think S) = think (join S) := by\nsimp only [join, think]\n dsimp only [(\u00b7 <$> \u00b7)]\n simp [Seq1.ret]", "-- Mathlib.Data.WSeq.Basic.map (L162-L165)\ndef map (f : \u03b1 \u2192 \u03b2) : WSeq \u03b1 \u2192 WSeq \u03b2 :=\nSeq.map (Option.map f)\n\n/-- The monadic `return a` is a singleton list containing `a`. -/", "-- Mathlib.Data.WSeq.Basic.head_terminates_of_mem (L518-L521)\ntheorem head_terminates_of_mem {s : WSeq \u03b1} {a} (h : a \u2208 s) : Terminates (head s) :=\nlet \u27e8_, h\u27e9 := exists_get?_of_mem h\n head_terminates_of_get?_terminates \u27e8\u27e8_, h\u27e9\u27e9", "-- Mathlib.Data.WSeq.Basic.head_terminates_of_get (L393-L396)\ntheorem head_terminates_of_get?_terminates {s : WSeq \u03b1} {n} :\n Terminates (get? s n) \u2192 Terminates (head s) :=\nget?_terminates_le (Nat.zero_le n)", "-- Mathlib.Data.WSeq.Basic.append_assoc (L322-L325)\ntheorem append_assoc (s t u : WSeq \u03b1) : append (append s t) u = append s (append t u) :=\nSeq.append_assoc _ _ _\n\n/-- auxiliary definition of tail over weak sequences -/", "-- Mathlib.Data.WSeq.Basic.inhabited (L72-L75)\ninstance inhabited : Inhabited (WSeq \u03b1) :=\n\u27e8nil\u27e9\n\n/-- Prepend an element to a weak sequence -/", "-- Mathlib.Data.WSeq.Basic.join_nil (L290-L292)\ntheorem join_nil : join nil = (nil : WSeq \u03b1) :=\nSeq.join_nil", "-- Mathlib.Data.WSeq.Basic.bind (L170-L176)\ndef bind (s : WSeq \u03b1) (f : \u03b1 \u2192 WSeq \u03b2) : WSeq \u03b2 :=\njoin (map f s)\n\n/-- Unfortunately, `WSeq` is not a lawful monad, because it does not satisfy the monad laws exactly,\nonly up to sequence equivalence. Furthermore, even quotienting by the equivalence is not sufficient,\nbecause the join operation involves lists of quotient elements, with a lifted equivalence relation,\nand pure quotients cannot handle this type of construction. -/", "-- Mathlib.Data.WSeq.Basic.exists_of_mem_map (L528-L535)\ntheorem exists_of_mem_map {f} {b : \u03b2} : \u2200 {s : WSeq \u03b1}, b \u2208 map f s \u2192 \u2203 a, a \u2208 s \u2227 f a = b\n | \u27e8g, al\u27e9, h => by\n let \u27e8o, om, oe\u27e9 := Seq.exists_of_mem_map h\nrcases o with - | a\n \u00b7 injection oe\n injection oe with h'\n exact \u27e8a, om, h'\u27e9", "-- Mathlib.Data.WSeq.Basic.seq_destruct_think (L205-L207)\ntheorem seq_destruct_think (s : WSeq \u03b1) : Seq.destruct (think s) = some (none, s) :=\nSeq.destruct_cons _ _", "-- Mathlib.Data.WSeq.Basic.coeStream (L65-L68)\ninstance coeStream : Coe (Stream' \u03b1) (WSeq \u03b1) :=\n\u27e8ofStream\u27e9\n\n/-- The empty weak sequence -/", "-- Mathlib.Data.WSeq.Basic.nil (L69-L71)\ndef nil : WSeq \u03b1 :=\nSeq.nil", "-- Mathlib.Data.WSeq.Basic.head_some_of_head_tail_some (L371-L378)\ntheorem head_some_of_head_tail_some {s : WSeq \u03b1} {a} (h : some a \u2208 head (tail s)) :\n \u2203 a', some a' \u2208 head s := by\nunfold head at h\n rcases Computation.exists_of_mem_map h with \u27e8o, md, e\u27e9; clear h\n rcases o with - | o <;> [injection e; injection e with h']; clear h'\n obtain \u27e8a, am\u27e9 := destruct_some_of_destruct_tail_some md\n exact \u27e8_, Computation.mem_map (@Prod.fst \u03b1 (WSeq \u03b1) <$> \u00b7) am\u27e9", "-- Mathlib.Data.WSeq.Basic.cons (L76-L79)\ndef cons (a : \u03b1) : WSeq \u03b1 \u2192 WSeq \u03b1 :=\nSeq.cons (some a)\n\n/-- Compute for one tick, without producing any elements -/", "-- Mathlib.Data.WSeq.Basic.mem_cons (L453-L456)\ntheorem mem_cons (s : WSeq \u03b1) (a) : a \u2208 cons a s :=\n(mem_cons_iff _ _).2 (Or.inl rfl)\n\nset_option linter.flexible false in -- TODO: fix non-terminal simp", "-- Mathlib.Data.WSeq.Basic.destruct_cons (L189-L191)\ntheorem destruct_cons (a : \u03b1) (s) : destruct (cons a s) = Computation.pure (some (a, s)) :=\nComputation.destruct_eq_pure <| by simp [destruct, cons, Computation.rmap]", "-- Mathlib.Data.WSeq.Basic.get (L133-L136)\ndef get? (s : WSeq \u03b1) (n : \u2115) : Computation (Option \u03b1) :=\nhead (drop s n)\n\n/-- Convert `s` to a list (if it is finite and completes in finite time). -/", "-- Mathlib.Data.WSeq.Basic.notMem_nil (L105-L109)\ntheorem notMem_nil (a : \u03b1) : a \u2209 @nil \u03b1 :=\nSeq.notMem_nil (some a)\n\n/-- Get the head of a weak sequence. This involves a possibly\n infinite computation. -/", "-- Mathlib.Data.WSeq.Basic.ofList_nil (L537-L539)\ntheorem ofList_nil : ofList [] = (nil : WSeq \u03b1) :=\nrfl", "-- Mathlib.Data.WSeq.Basic.dropn_cons (L264-L269)\ntheorem dropn_cons (a : \u03b1) (s) (n) : drop (cons a s) (n + 1) = drop s n := by\ninduction n with\n | zero => simp [drop]\n | succ n n_ih =>\n simp [drop, \u2190 n_ih]", "-- Mathlib.Data.WSeq.Basic.mem_rec_on (L401-L413)\ntheorem mem_rec_on {C : WSeq \u03b1 \u2192 Prop} {a s} (M : a \u2208 s) (h1 : \u2200 b s', a = b \u2228 C s' \u2192 C (cons b s'))\n (h2 : \u2200 s, C s \u2192 C (think s)) : C s := by\napply Seq.mem_rec_on M\n intro o s' h; rcases o with - | b\n \u00b7 apply h2\n cases h\n \u00b7 contradiction\n \u00b7 assumption\n \u00b7 apply h1\n apply Or.imp_left _ h\n intro h\n injection h", "-- Mathlib.Data.WSeq.Basic.join (L153-L161)\ndef join (S : WSeq (WSeq \u03b1)) : WSeq \u03b1 :=\nSeq.join\n ((fun o : Option (WSeq \u03b1) =>\n match o with\n | none => Seq1.ret none\n | some s => (none, s)) <$>\n S)\n\n/-- Map a function over a weak sequence -/", "-- Mathlib.Data.WSeq.Basic.destruct_think (L193-L195)\ntheorem destruct_think (s : WSeq \u03b1) : destruct (think s) = (destruct s).think :=\nComputation.destruct_eq_think <| by simp [destruct, think, Computation.rmap]", "-- Mathlib.Data.WSeq.Basic.think (L80-L84)\ndef think : WSeq \u03b1 \u2192 WSeq \u03b1 :=\nSeq.cons none\n\n/-- Destruct a weak sequence, to (eventually possibly) produce either\n `none` for `nil` or `some (a, s)` if an element is produced. -/", "-- Mathlib.Data.WSeq.Basic.ofList_cons (L541-L543)\ntheorem ofList_cons (a : \u03b1) (l) : ofList (a::l) = cons a (ofList l) :=\nshow Seq.map some (Seq.ofList (a::l)) = Seq.cons (some a) (Seq.map some (Seq.ofList l)) by simp", "-- Mathlib.Data.WSeq.Basic.flatten (L115-L123)\ndef flatten : Computation (WSeq \u03b1) \u2192 WSeq \u03b1 :=\nSeq.corec fun c =>\n match Computation.destruct c with\n | Sum.inl s => Seq.omap (return \u00b7) (Seq.destruct s)\n | Sum.inr c' => some (none, c')\n\n/-- Get the tail of a weak sequence. This doesn't need a `Computation`\n wrapper, unlike `head`, because `flatten` allows us to hide this\n in the construction of the weak sequence itself. -/", "-- Mathlib.Data.WSeq.Basic.seq_destruct_nil (L197-L199)\ntheorem seq_destruct_nil : Seq.destruct (nil : WSeq \u03b1) = none :=\nrfl", "-- Mathlib.Data.WSeq.Basic.destruct_nil (L185-L187)\ntheorem destruct_nil : destruct (nil : WSeq \u03b1) = Computation.pure none :=\nComputation.destruct_eq_pure rfl", "-- Mathlib.Data.WSeq.Basic.recOn (L94-L101)\ndef recOn {motive : WSeq \u03b1 \u2192 Sort v} (s : WSeq \u03b1) (nil : motive nil)\n (cons : \u2200 x s, motive (cons x s)) (think : \u2200 s, motive (think s)) : motive s :=\nSeq.recOn s nil fun o => Option.recOn o think cons\n\n/-- membership for weak sequences -/\nprotected def Mem (s : WSeq \u03b1) (a : \u03b1) :=\n Seq.Mem s (some a)", "-- Mathlib.Data.WSeq.Basic.coeSeq (L59-L61)\ninstance coeSeq : Coe (Seq \u03b1) (WSeq \u03b1) :=\n\u27e8ofSeq\u27e9", "-- Mathlib.Data.WSeq.Basic.head_think (L215-L216)\ntheorem head_think (s : WSeq \u03b1) : head (think s) = (head s).think := by simp [head]", "-- Mathlib.Data.WSeq.Basic.ret (L166-L169)\ndef ret (a : \u03b1) : WSeq \u03b1 :=\nofList [a]\n\n/-- Monadic bind operator for weak sequences -/", "-- Mathlib.Data.WSeq.Basic.destruct_some_of_destruct_tail_some (L361-L370)\ntheorem destruct_some_of_destruct_tail_some {s : WSeq \u03b1} {a} (h : some a \u2208 destruct (tail s)) :\n \u2203 a', some a' \u2208 destruct s := by\nunfold tail Functor.map at h; simp only [destruct_flatten] at h\n rcases exists_of_mem_bind h with \u27e8t, tm, td\u27e9; clear h\n rcases Computation.exists_of_mem_map tm with \u27e8t', ht', ht2\u27e9; clear tm\n rcases t' with - | t' <;> rw [\u2190 ht2] at td <;> simp only [destruct_nil] at td\n \u00b7 have := mem_unique td (ret_mem _)\n contradiction\n \u00b7 exact \u27e8_, ht'\u27e9", "-- Mathlib.Data.WSeq.Basic.think_append (L314-L316)\ntheorem think_append (s t : WSeq \u03b1) : append (think s) t = think (append s t) :=\nSeq.cons_append _ _ _", "-- Mathlib.Data.WSeq.Basic.seq_destruct_cons (L201-L203)\ntheorem seq_destruct_cons (a : \u03b1) (s) : Seq.destruct (cons a s) = some (some a, s) :=\nSeq.destruct_cons _ _", "-- Mathlib.Data.WSeq.Basic.destruct (L85-L92)\ndef destruct : WSeq \u03b1 \u2192 Computation (Option (\u03b1 \u00d7 WSeq \u03b1)) :=\nComputation.corec fun s =>\n match Seq.destruct s with\n | none => Sum.inl none\n | some (none, s') => Sum.inr s'\n | some (some a, s') => Sum.inl (some (a, s'))\n\n/-- Recursion principle for weak sequences, compare with `List.recOn`. -/", "-- Mathlib.Data.WSeq.Basic.of_mem_append (L522-L524)\ntheorem of_mem_append {s\u2081 s\u2082 : WSeq \u03b1} {a : \u03b1} : a \u2208 append s\u2081 s\u2082 \u2192 a \u2208 s\u2081 \u2228 a \u2208 s\u2082 :=\nSeq.of_mem_append", "-- Mathlib.Data.WSeq.Basic.flatten_think (L230-L232)\ntheorem flatten_think (c : Computation (WSeq \u03b1)) : flatten c.think = think (flatten c) :=\nSeq.destruct_eq_cons <| by simp [flatten]", "-- Mathlib.Data.WSeq.Basic.toList'_map (L581-L607)\ntheorem toList'_map (l : List \u03b1) (s : WSeq \u03b1) :\n Computation.corec (fun \u27e8l, s\u27e9 =>\n match Seq.destruct s with\n | none => Sum.inl l.reverse\n | some (none, s') => Sum.inr (l, s')\n | some (some a, s') => Sum.inr (a :: l, s')) (l, s) = (l.reverse ++ \u00b7) <$> toList s := by\nrefine\n Computation.eq_of_bisim\n (fun c1 c2 =>\n \u2203 (l' : List \u03b1) (s : WSeq \u03b1),\n c1 = Computation.corec (fun \u27e8l, s\u27e9 =>\n match Seq.destruct s with\n | none => Sum.inl l.reverse\n | some (none, s') => Sum.inr (l, s')\n | some (some a, s') => Sum.inr (a::l, s')) (l' ++ l, s) \u2227\n c2 = Computation.map (l.reverse ++ \u00b7) (Computation.corec (fun \u27e8l, s\u27e9 =>\n match Seq.destruct s with\n | none => Sum.inl l.reverse\n | some (none, s') => Sum.inr (l, s')\n | some (some a, s') => Sum.inr (a::l, s')) (l', s)))\n ?_ \u27e8[], s, rfl, rfl\u27e9\n intro s1 s2 h; rcases h with \u27e8l', s, h\u27e9; rw [h.left, h.right]\n induction s using WSeq.recOn\n case nil => simp\n case cons a s => refine \u27e8a :: l', s, ?_, ?_\u27e9 <;> simp\n case think s => refine \u27e8l', s, ?_, ?_\u27e9 <;> simp", "-- Mathlib.Data.WSeq.Basic.destruct_flatten (L234-L247)\ntheorem destruct_flatten (c : Computation (WSeq \u03b1)) : destruct (flatten c) = c >>= destruct := by\nrefine\n Computation.eq_of_bisim\n (fun c1 c2 => c1 = c2 \u2228 \u2203 c, c1 = destruct (flatten c) \u2227 c2 = Computation.bind c destruct) ?_\n (Or.inr \u27e8c, rfl, rfl\u27e9)\n intro c1 c2 h\n exact\n match c1, c2, h with\n | c, _, Or.inl rfl => by cases c.destruct <;> simp\n | _, _, Or.inr \u27e8c, rfl, rfl\u27e9 => by\n induction c using Computation.recOn with\n | pure a => simp; cases (destruct a).destruct <;> simp\n | think c' => simpa using Or.inr \u27e8c', rfl, rfl\u27e9", "-- Mathlib.Data.WSeq.Basic.ofSeq (L46-L49)\ndef ofSeq : Seq \u03b1 \u2192 WSeq \u03b1 :=\n(\u00b7 <$> \u00b7) some\n\n/-- Turn a list into a weak sequence -/", "-- Mathlib.Data.WSeq.Basic.membership (L102-L104)\ninstance membership : Membership \u03b1 (WSeq \u03b1) :=\n\u27e8WSeq.Mem\u27e9", "-- Mathlib.Data.WSeq.Basic.dropn_think (L271-L273)\ntheorem dropn_think (s : WSeq \u03b1) (n) : drop (think s) n = (drop s n).think := by\ninduction n <;> simp [*, drop]", "-- Mathlib.Data.WSeq.Basic.toList (L137-L147)\ndef toList (s : WSeq \u03b1) : Computation (List \u03b1) :=\n@Computation.corec (List \u03b1) (List \u03b1 \u00d7 WSeq \u03b1)\n (fun \u27e8l, s\u27e9 =>\n match Seq.destruct s with\n | none => Sum.inl l.reverse\n | some (none, s') => Sum.inr (l, s')\n | some (some a, s') => Sum.inr (a::l, s'))\n ([], s)\n\n/-- Append two weak sequences. As with `Seq.append`, this may not use\n the second sequence if the first one takes forever to compute -/", "-- Mathlib.Data.WSeq.Basic.destruct_tail (L331-L335)\ntheorem destruct_tail (s : WSeq \u03b1) : destruct (tail s) = destruct s >>= tail.aux := by\nsimp only [tail, destruct_flatten]; rw [\u2190 bind_pure_comp, LawfulMonad.bind_assoc]\n apply congr_arg; ext1 (_ | \u27e8a, s\u27e9) <;> apply (@pure_bind Computation _ _ _ _ _ _).trans _ <;> simp\n\n/-- auxiliary definition of drop over weak sequences -/", "-- Mathlib.Data.WSeq.Basic.toList'_nil (L545-L552)\ntheorem toList'_nil (l : List \u03b1) :\n Computation.corec (fun \u27e8l, s\u27e9 =>\n match Seq.destruct s with\n | none => Sum.inl l.reverse\n | some (none, s') => Sum.inr (l, s')\n | some (some a, s') => Sum.inr (a::l, s')) (l, nil) = Computation.pure l.reverse :=\ndestruct_eq_pure rfl", "-- Mathlib.Data.WSeq.Basic.mem_append_left (L525-L527)\ntheorem mem_append_left {s\u2081 s\u2082 : WSeq \u03b1} {a : \u03b1} : a \u2208 s\u2081 \u2192 a \u2208 append s\u2081 s\u2082 :=\nSeq.mem_append_left", "-- Mathlib.Data.WSeq.Basic.nil_append (L306-L308)\ntheorem nil_append (s : WSeq \u03b1) : append nil s = s :=\nSeq.nil_append _", "-- Mathlib.Data.WSeq.Basic.tail_cons (L255-L256)\ntheorem tail_cons (a : \u03b1) (s) : tail (cons a s) = s := by simp [tail]", "-- Mathlib.Data.WSeq.Basic.exists_dropn_of_mem (L504-L517)\ntheorem exists_dropn_of_mem {s : WSeq \u03b1} {a} (h : a \u2208 s) :\n \u2203 n s', some (a, s') \u2208 destruct (drop s n) :=\nlet \u27e8n, h\u27e9 := exists_get?_of_mem h\n \u27e8n, by\n rcases (head_terminates_iff _).1 \u27e8\u27e8_, h\u27e9\u27e9 with \u27e8\u27e8o, om\u27e9\u27e9\n have := Computation.mem_unique (Computation.mem_map _ om) h\n rcases o with - | o\n \u00b7 injection this\n injection this with i\n obtain \u27e8a', s'\u27e9 := o\n dsimp at i\n rw [i] at om\n exact \u27e8_, om\u27e9\u27e9", "-- Mathlib.Data.WSeq.Basic.tail_think (L258-L259)\ntheorem tail_think (s : WSeq \u03b1) : tail (think s) = (tail s).think := by simp [tail]", "-- Mathlib.Data.WSeq.Basic.ofStream (L56-L58)\ndef ofStream (l : Stream' \u03b1) : WSeq \u03b1 :=\nofSeq l", "-- Mathlib.Data.WSeq.Basic.append (L148-L152)\ndef append : WSeq \u03b1 \u2192 WSeq \u03b1 \u2192 WSeq \u03b1 :=\nSeq.append\n\n/-- Flatten a sequence of weak sequences. (Note that this allows\n empty sequences, unlike `Seq.join`.) -/"], "statement": "theorem LiftRel.refl (R : \u03b1 \u2192 \u03b1 \u2192 Prop) (H : Reflexive R) : Reflexive (LiftRel R)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 30302, "declarations_count": 3587, "diagnostics_count": 0, "duplicate_fingerprint": "7a1eda0847d17ca0", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 11590, "lean_code_chars": 27046, "lean_code_ratio": 0.8925, "length_bucket": "long", "line_count": 1048, "natural_language_chars": 3256, "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.Data.WSeq.Relation).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem LiftRel.refl (R : \u03b1 \u2192 \u03b1 \u2192 Prop) (H : Reflexive R) : Reflexive (LiftRel R)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Data.WSeq.Relation.LiftRelO (L37-L41)\ndef LiftRelO (R : \u03b1 \u2192 \u03b2 \u2192 Prop) (C : WSeq \u03b1 \u2192 WSeq \u03b2 \u2192 Prop) :\n Option (\u03b1 \u00d7 WSeq \u03b1) \u2192 Option (\u03b2 \u00d7 WSeq \u03b2) \u2192 Prop\n | none, none => True\n | some (a, s), some (b, t) => R a b \u2227 C s t\n | _, _ => False\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Data.WSeq.Relation.LiftRelO (L44-L50)\ntheorem LiftRelO.imp {R S : \u03b1 \u2192 \u03b2 \u2192 Prop} {C D : WSeq \u03b1 \u2192 WSeq \u03b2 \u2192 Prop} (H1 : \u2200 a b, R a b \u2192 S a b)\n (H2 : \u2200 s t, C s t \u2192 D s t) : \u2200 {o p}, LiftRelO R C o p \u2192 LiftRelO S D o p\n | none, none, _ => trivial\n | some (_, _), some (_, _), h => And.imp (H1 _ _) (H2 _ _) h\n | none, some _, h => False.elim h\n | some (_, _), none, h => False.elim h\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Data.WSeq.Relation.LiftRelO (L51-L54)\ntheorem LiftRelO.imp_right (R : \u03b1 \u2192 \u03b2 \u2192 Prop) {C D : WSeq \u03b1 \u2192 WSeq \u03b2 \u2192 Prop}\n (H : \u2200 s t, C s t \u2192 D s t) {o p} : LiftRelO R C o p \u2192 LiftRelO R D o p :=\nLiftRelO.imp (fun _ _ => id) H\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Data.WSeq.Relation.LiftRelO (L55-L60)\ntheorem LiftRelO.swap (R : \u03b1 \u2192 \u03b2 \u2192 Prop) (C) :\n swap (LiftRelO R C) = LiftRelO (swap R) (swap C) := by\nfunext x y\n rcases x with \u27e8\u27e9 | \u27e8hx, jx\u27e9 <;> rcases y with \u27e8\u27e9 | \u27e8hy, jy\u27e9 <;> rfl\n\n/-- Definition of bisimilarity for weak sequences -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Data.WSeq.Relation.BisimO (L62-L64)\ndef BisimO (R : WSeq \u03b1 \u2192 WSeq \u03b1 \u2192 Prop) : Option (\u03b1 \u00d7 WSeq \u03b1) \u2192 Option (\u03b1 \u00d7 WSeq \u03b1) \u2192 Prop :=\nLiftRelO (\u00b7 = \u00b7) R\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Data.WSeq.Relation.BisimO (L65-L71)\ntheorem BisimO.imp {R S : WSeq \u03b1 \u2192 WSeq \u03b1 \u2192 Prop} (H : \u2200 s t, R s t \u2192 S s t) {o p} :\n BisimO R o p \u2192 BisimO S o p :=\nLiftRelO.imp_right _ H\n\n/-- Two weak sequences are `LiftRel R` related if they are either both empty,\n or they are both nonempty and the heads are `R` related and the tails are\n `LiftRel R` related. (This is a coinductive definition.) -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Data.WSeq.Relation.liftRel_destruct (L76-L82)\ntheorem liftRel_destruct {R : \u03b1 \u2192 \u03b2 \u2192 Prop} {s : WSeq \u03b1} {t : WSeq \u03b2} :\n LiftRel R s t \u2192 Computation.LiftRel (LiftRelO R (LiftRel R)) (destruct s) (destruct t)\n | \u27e8R, h1, h2\u27e9 => by\n refine Computation.LiftRel.imp ?_ _ _ (h2 h1)\n apply LiftRelO.imp_right\n exact fun s' t' h' => \u27e8R, h', @h2\u27e9\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Data.WSeq.Relation.liftRel_destruct_iff (L83-L97)\ntheorem liftRel_destruct_iff {R : \u03b1 \u2192 \u03b2 \u2192 Prop} {s : WSeq \u03b1} {t : WSeq \u03b2} :\n LiftRel R s t \u2194 Computation.LiftRel (LiftRelO R (LiftRel R)) (destruct s) (destruct t) :=\n\u27e8liftRel_destruct, fun h =>\n \u27e8fun s t =>\n LiftRel R s t \u2228 Computation.LiftRel (LiftRelO R (LiftRel R)) (destruct s) (destruct t),\n Or.inr h, fun {s t} h => by\n have h : Computation.LiftRel (LiftRelO R (LiftRel R)) (destruct s) (destruct t) := by\n obtain h | h := h\n \u00b7 exact liftRel_destruct h\n \u00b7 assumption\n apply Computation.LiftRel.imp _ _ _ h\n apply LiftRelO.imp_right\n intro s t\n apply Or.inl\u27e9\u27e9\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Data.WSeq.Relation.Equiv (L159-L161)\ndef Equiv : WSeq \u03b1 \u2192 WSeq \u03b1 \u2192 Prop :=\nLiftRel (\u00b7 = \u00b7)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Data.WSeq.Relation.Equiv (L165-L167)\ntheorem Equiv.refl : \u2200 s : WSeq \u03b1, s ~\u02b7 s :=\nLiftRel.refl (\u00b7 = \u00b7) Eq.refl\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Data.WSeq.Relation.Equiv (L169-L171)\ntheorem Equiv.symm : \u2200 {s t : WSeq \u03b1}, s ~\u02b7 t \u2192 t ~\u02b7 s :=\n@(LiftRel.symm (\u00b7 = \u00b7) (@Eq.symm _))\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Data.WSeq.Relation.Equiv (L173-L175)\ntheorem Equiv.trans : \u2200 {s t u : WSeq \u03b1}, s ~\u02b7 t \u2192 t ~\u02b7 u \u2192 s ~\u02b7 u :=\nLiftRel.trans (\u00b7 = \u00b7) inferInstance |>.trans _ _ _\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Data.WSeq.Relation.Equiv (L176-L178)\ntheorem Equiv.equivalence : Equivalence (@Equiv \u03b1) :=\n\u27e8@Equiv.refl _, @Equiv.symm _, @Equiv.trans _\u27e9\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Data.WSeq.Relation.destruct_congr (L179-L182)\ntheorem destruct_congr {s t : WSeq \u03b1} :\n s ~\u02b7 t \u2192 Computation.LiftRel (BisimO (\u00b7 ~\u02b7 \u00b7)) (destruct s) (destruct t) :=\nliftRel_destruct\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Data.WSeq.Relation.destruct_congr_iff (L183-L188)\ntheorem destruct_congr_iff {s t : WSeq \u03b1} :\n s ~\u02b7 t \u2194 Computation.LiftRel (BisimO (\u00b7 ~\u02b7 \u00b7)) (destruct s) (destruct t) :=\nliftRel_destruct_iff\n\nopen Computation\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Data.WSeq.Relation.liftRel_dropn_destruct (L189-L200)\ntheorem liftRel_dropn_destruct {R : \u03b1 \u2192 \u03b2 \u2192 Prop} {s t} (H : LiftRel R s t) :\n \u2200 n, Computation.LiftRel (LiftRelO R (LiftRel R)) (destruct (drop s n)) (destruct (drop t n))\n | 0 => liftRel_destruct H\n | n + 1 => by\n simp only [drop, destruct_tail]\n apply liftRel_bind\n \u00b7 apply liftRel_dropn_destruct H n\n exact fun {a b} o =>\n match a, b, o with\n | none, none, _ => by simp\n | some (a, s), some (b, t), \u27e8_, h2\u27e9 => by simpa [tail.aux] using liftRel_destruct h2\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Data.WSeq.Relation.exists_of_liftRel_left (L201-L207)\ntheorem exists_of_liftRel_left {R : \u03b1 \u2192 \u03b2 \u2192 Prop} {s t} (H : LiftRel R s t) {a} (h : a \u2208 s) :\n \u2203 b, b \u2208 t \u2227 R a b := by\nlet \u27e8n, h\u27e9 := exists_get?_of_mem h\n let \u27e8some (_, s'), sd, rfl\u27e9 := Computation.exists_of_mem_map h\n let \u27e8some (b, t'), td, \u27e8ab, _\u27e9\u27e9 := (liftRel_dropn_destruct H n).left sd\n exact \u27e8b, get?_mem (Computation.mem_map (Prod.fst.{v, v} <$> \u00b7) td), ab\u27e9\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Data.WSeq.Relation.exists_of_liftRel_right (L208-L210)\ntheorem exists_of_liftRel_right {R : \u03b1 \u2192 \u03b2 \u2192 Prop} {s t} (H : LiftRel R s t) {b} (h : b \u2208 t) :\n \u2203 a, a \u2208 s \u2227 R a b := by rw [\u2190 LiftRel.swap] at H; exact exists_of_liftRel_left H h\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Data.WSeq.Relation.liftRel_nil (L212-L214)\ntheorem liftRel_nil (R : \u03b1 \u2192 \u03b2 \u2192 Prop) : LiftRel R nil nil := by\nsimp [liftRel_destruct_iff]\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Data.WSeq.Relation.liftRel_cons (L216-L219)\ntheorem liftRel_cons (R : \u03b1 \u2192 \u03b2 \u2192 Prop) (a b s t) :\n LiftRel R (cons a s) (cons b t) \u2194 R a b \u2227 LiftRel R s t := by\nsimp [liftRel_destruct_iff]\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Data.WSeq.Relation.liftRel_think_left (L221-L223)\ntheorem liftRel_think_left (R : \u03b1 \u2192 \u03b2 \u2192 Prop) (s t) : LiftRel R (think s) t \u2194 LiftRel R s t := by\nrw [liftRel_destruct_iff, liftRel_destruct_iff]; simp\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Data.WSeq.Relation.liftRel_think_right (L225-L227)\ntheorem liftRel_think_right (R : \u03b1 \u2192 \u03b2 \u2192 Prop) (s t) : LiftRel R s (think t) \u2194 LiftRel R s t := by\nrw [liftRel_destruct_iff, liftRel_destruct_iff]; simp\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Data.WSeq.Relation.cons_congr (L228-L230)\ntheorem cons_congr {s t : WSeq \u03b1} (a : \u03b1) (h : s ~\u02b7 t) : cons a s ~\u02b7 cons a t := by\nunfold Equiv; simpa using h\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Data.WSeq.Relation.think_equiv (L231-L232)\ntheorem think_equiv (s : WSeq \u03b1) : think s ~\u02b7 s := by unfold Equiv; simpa using Equiv.refl _\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Data.WSeq.Relation.think_congr (L233-L235)\ntheorem think_congr {s t : WSeq \u03b1} (h : s ~\u02b7 t) : think s ~\u02b7 think t := by\nunfold Equiv; simpa using h\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Data.WSeq.Basic.head_terminates_iff (L248-L250)\ntheorem head_terminates_iff (s : WSeq \u03b1) : Terminates (head s) \u2194 Terminates (destruct s) :=\nterminates_map_iff _ (destruct s)\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Data.WSeq.Basic.flatten_pure (L218-L228)\ntheorem flatten_pure (s : WSeq \u03b1) : flatten (Computation.pure s) = s := by\nrefine Seq.eq_of_bisim (fun s1 s2 => flatten (Computation.pure s2) = s1) ?_ rfl\n intro s' s h\n rw [\u2190 h]\n simp only [Seq.BisimO, flatten, Seq.omap, pure_def, Seq.corec_eq, destruct_pure]\n cases Seq.destruct s with\n | none => simp\n | some val =>\n obtain \u27e8o, s'\u27e9 := val\n simp\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Data.WSeq.Basic.tail (L124-L127)\ndef tail (s : WSeq \u03b1) : WSeq \u03b1 :=\nflatten <| (fun o => Option.recOn o nil Prod.snd) <$> destruct s\n\n/-- drop the first `n` elements from `s`. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Data.WSeq.Basic.eq_or_mem_iff_mem (L425-L445)\ntheorem eq_or_mem_iff_mem {s : WSeq \u03b1} {a a' s'} :\n some (a', s') \u2208 destruct s \u2192 (a \u2208 s \u2194 a = a' \u2228 a \u2208 s') := by\ngeneralize e : destruct s = c; intro h\n revert s\n apply Computation.memRecOn h <;> [skip; intro c IH] <;> intro s <;>\n induction s using WSeq.recOn <;>\n intro m <;>\n have := congr_arg Computation.destruct m <;>\n simp at this\n \u00b7 obtain \u27e8i1, i2\u27e9 := this\n rw [i1, i2]\n dsimp only [cons, Membership.mem, WSeq.Mem, Seq.Mem, Seq.cons]\n have h_a_eq_a' : a = a' \u2194 some (some a) = some (some a') := by simp\n rw [h_a_eq_a']\n refine \u27e8Stream'.eq_or_mem_of_mem_cons, fun o => ?_\u27e9\n \u00b7 rcases o with e | m\n \u00b7 rw [e]\n apply Stream'.mem_cons\n \u00b7 exact Stream'.mem_cons_of_mem _ m\n \u00b7 simp [IH this]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Data.WSeq.Basic.mem_think (L415-L424)\ntheorem mem_think (s : WSeq \u03b1) (a) : a \u2208 think s \u2194 a \u2208 s := by\nobtain \u27e8f, al\u27e9 := s\n change (some (some a) \u2208 some none::f) \u2194 some (some a) \u2208 f\n constructor <;> intro h\n \u00b7 apply (Stream'.eq_or_mem_of_mem_cons h).resolve_left\n intro\n injections\n \u00b7 apply Stream'.mem_cons_of_mem _ h\n\nset_option linter.flexible false in -- TODO: fix non-terminal simp\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Data.WSeq.Basic.cons_append (L310-L312)\ntheorem cons_append (a : \u03b1) (s t) : append (cons a s) t = cons a (append s t) :=\nSeq.cons_append _ _ _\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Data.WSeq.Basic.toList'_cons (L554-L566)\ntheorem toList'_cons (l : List \u03b1) (s : WSeq \u03b1) (a : \u03b1) :\n Computation.corec (fun \u27e8l, s\u27e9 =>\n match Seq.destruct s with\n | none => Sum.inl l.reverse\n | some (none, s') => Sum.inr (l, s')\n | some (some a, s') => Sum.inr (a::l, s')) (l, cons a s) =\n (Computation.corec (fun \u27e8l, s\u27e9 =>\n match Seq.destruct s with\n | none => Sum.inl l.reverse\n | some (none, s') => Sum.inr (l, s')\n | some (some a, s') => Sum.inr (a::l, s')) (a::l, s)).think :=\ndestruct_eq_think <| by simp [cons]\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Data.WSeq.Basic.WSeq (L37-L44)\ndef WSeq (\u03b1) :=\nSeq (Option \u03b1)\n\nnamespace WSeq\n\nvariable {\u03b1 : Type u} {\u03b2 : Type v} {\u03b3 : Type w}\n\n/-- Turn a sequence into a weak sequence -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Data.WSeq.Basic.ofList (L51-L54)\ndef ofList (l : List \u03b1) : WSeq \u03b1 :=\nofSeq l\n\n/-- Turn a stream into a weak sequence -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Data.WSeq.Basic.head (L110-L114)\ndef head (s : WSeq \u03b1) : Computation (Option \u03b1) :=\nComputation.map (Prod.fst <$> \u00b7) (destruct s)\n\n/-- Encode a computation yielding a weak sequence into additional\n `think` constructors in a weak sequence -/\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Data.WSeq.Basic.head_terminates_of_head_tail_terminates (L353-L360)\ntheorem head_terminates_of_head_tail_terminates (s : WSeq \u03b1) [T : Terminates (head (tail s))] :\n Terminates (head s) :=\n(head_terminates_iff _).2 <| by\n rcases (head_terminates_iff _).1 T with \u27e8\u27e8a, h\u27e9\u27e9\n simp? [tail] at h says simp only [tail, destruct_flatten, bind_map_left] at h\n rcases exists_of_mem_bind h with \u27e8s', h1, _\u27e9\n exact terminates_of_mem h1\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Data.WSeq.Basic.destruct_terminates_of_get (L397-L400)\ntheorem destruct_terminates_of_get?_terminates {s : WSeq \u03b1} {n} (T : Terminates (get? s n)) :\n Terminates (destruct s) :=\n(head_terminates_iff _).1 <| head_terminates_of_get?_terminates T\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Data.WSeq.Basic.monad (L177-L183)\ninstance monad : Monad WSeq where\n map := @map\npure := @ret\n bind := @bind\n\nopen Computation\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Data.WSeq.Basic.exists_get (L487-L503)\ntheorem exists_get?_of_mem {s : WSeq \u03b1} {a} (h : a \u2208 s) : \u2203 n, some a \u2208 get? s n := by\napply mem_rec_on h\n \u00b7 intro a' s' h\n rcases h with h | h\n \u00b7 exists 0\n simp only [get?, drop, head_cons]\n rw [h]\n apply ret_mem\n \u00b7 obtain \u27e8n, h\u27e9 := h\n exists n + 1\n simpa [get?]\n \u00b7 intro s' h\n obtain \u27e8n, h\u27e9 := h\n exists n\n simp only [get?, dropn_think, head_think]\n apply think_mem h\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Data.WSeq.Basic.join_cons (L300-L304)\ntheorem join_cons (s : WSeq \u03b1) (S) : join (cons s S) = think (append s (join S)) := by\nsimp only [join, think]\n dsimp only [(\u00b7 <$> \u00b7)]\n simp [cons, append]\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Data.WSeq.Basic.dropn_tail (L278-L282)\ntheorem dropn_tail (s : WSeq \u03b1) (n) : drop (tail s) n = drop s (n + 1) := by\nrw [Nat.add_comm]\n symm\n apply dropn_add\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Data.WSeq.Basic.toList'_think (L568-L580)\ntheorem toList'_think (l : List \u03b1) (s : WSeq \u03b1) :\n Computation.corec (fun \u27e8l, s\u27e9 =>\n match Seq.destruct s with\n | none => Sum.inl l.reverse\n | some (none, s') => Sum.inr (l, s')\n | some (some a, s') => Sum.inr (a::l, s')) (l, think s) =\n (Computation.corec (fun \u27e8l, s\u27e9 =>\n match Seq.destruct s with\n | none => Sum.inl l.reverse\n | some (none, s') => Sum.inr (l, s')\n | some (some a, s') => Sum.inr (a::l, s')) (l, s)).think :=\ndestruct_eq_think <| by simp [think]\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Data.WSeq.Basic.head_cons (L212-L213)\ntheorem head_cons (a : \u03b1) (s) : head (cons a s) = Computation.pure (some a) := by simp [head]\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Data.WSeq.Basic.append_nil (L318-L320)\ntheorem append_nil (s : WSeq \u03b1) : append s nil = s :=\nSeq.append_nil _\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Data.WSeq.Basic.mem_of_mem_tail (L457-L468)\ntheorem mem_of_mem_tail {s : WSeq \u03b1} {a} : a \u2208 tail s \u2192 a \u2208 s := by\nintro h; have := h; obtain \u27e8n, e\u27e9 := h; revert s; simp only [Stream'.get]\n induction n <;> intro s <;> induction s using WSeq.recOn <;>\n simp <;> intro m e <;> injections\n \u00b7 exact Or.inr m\n \u00b7 exact Or.inr m\n case succ.think n IH s =>\n apply IH m\n rw [e]\n cases tail s\n rfl\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Data.WSeq.Basic.head_some_of_get (L379-L386)\ntheorem head_some_of_get?_some {s : WSeq \u03b1} {a n} (h : some a \u2208 get? s n) :\n \u2203 a', some a' \u2208 head s := by\ninduction n generalizing a with\n | zero => exact \u27e8_, h\u27e9\n | succ n IH =>\n let \u27e8a', h'\u27e9 := head_some_of_head_tail_some h\n exact IH h'\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Data.WSeq.Basic.dropn_nil (L261-L262)\ntheorem dropn_nil (n) : drop (nil : WSeq \u03b1) n = nil := by induction n <;> simp [*, drop]\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Data.WSeq.Basic.mem_cons_of_mem (L450-L452)\ntheorem mem_cons_of_mem {s : WSeq \u03b1} (b) {a} (h : a \u2208 s) : a \u2208 cons b s :=\n(mem_cons_iff _ _).2 (Or.inr h)\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Data.WSeq.Basic.head_nil (L209-L210)\ntheorem head_nil : head (nil : WSeq \u03b1) = Computation.pure none := by simp [head]\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Data.WSeq.Basic.mem_cons_iff (L447-L449)\ntheorem mem_cons_iff (s : WSeq \u03b1) (b) {a} : a \u2208 cons b s \u2194 a = b \u2228 a \u2208 s :=\neq_or_mem_iff_mem <| by simp\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Data.WSeq.Basic.coeList (L62-L64)\ninstance coeList : Coe (List \u03b1) (WSeq \u03b1) :=\n\u27e8ofList\u27e9\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Data.WSeq.Basic.tail_nil (L252-L253)\ntheorem tail_nil : tail (nil : WSeq \u03b1) = nil := by simp [tail]\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Data.WSeq.Basic.join_think (L294-L298)\ntheorem join_think (S : WSeq (WSeq \u03b1)) : join (think S) = think (join S) := by\nsimp only [join, think]\n dsimp only [(\u00b7 <$> \u00b7)]\n simp [Seq1.ret]\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Data.WSeq.Basic.map (L162-L165)\ndef map (f : \u03b1 \u2192 \u03b2) : WSeq \u03b1 \u2192 WSeq \u03b2 :=\nSeq.map (Option.map f)\n\n/-- The monadic `return a` is a singleton list containing `a`. -/\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Data.WSeq.Basic.head_terminates_of_mem (L518-L521)\ntheorem head_terminates_of_mem {s : WSeq \u03b1} {a} (h : a \u2208 s) : Terminates (head s) :=\nlet \u27e8_, h\u27e9 := exists_get?_of_mem h\n head_terminates_of_get?_terminates \u27e8\u27e8_, h\u27e9\u27e9\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Data.WSeq.Basic.head_terminates_of_get (L393-L396)\ntheorem head_terminates_of_get?_terminates {s : WSeq \u03b1} {n} :\n Terminates (get? s n) \u2192 Terminates (head s) :=\nget?_terminates_le (Nat.zero_le n)\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Data.WSeq.Basic.append_assoc (L322-L325)\ntheorem append_assoc (s t u : WSeq \u03b1) : append (append s t) u = append s (append t u) :=\nSeq.append_assoc _ _ _\n\n/-- auxiliary definition of tail over weak sequences -/\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Data.WSeq.Basic.inhabited (L72-L75)\ninstance inhabited : Inhabited (WSeq \u03b1) :=\n\u27e8nil\u27e9\n\n/-- Prepend an element to a weak sequence -/\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Data.WSeq.Basic.join_nil (L290-L292)\ntheorem join_nil : join nil = (nil : WSeq \u03b1) :=\nSeq.join_nil\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Data.WSeq.Basic.bind (L170-L176)\ndef bind (s : WSeq \u03b1) (f : \u03b1 \u2192 WSeq \u03b2) : WSeq \u03b2 :=\njoin (map f s)\n\n/-- Unfortunately, `WSeq` is not a lawful monad, because it does not satisfy the monad laws exactly,\nonly up to sequence equivalence. Furthermore, even quotienting by the equivalence is not sufficient,\nbecause the join operation involves lists of quotient elements, with a lifted equivalence relation,\nand pure quotients cannot handle this type of construction. -/\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Data.WSeq.Basic.exists_of_mem_map (L528-L535)\ntheorem exists_of_mem_map {f} {b : \u03b2} : \u2200 {s : WSeq \u03b1}, b \u2208 map f s \u2192 \u2203 a, a \u2208 s \u2227 f a = b\n | \u27e8g, al\u27e9, h => by\n let \u27e8o, om, oe\u27e9 := Seq.exists_of_mem_map h\nrcases o with - | a\n \u00b7 injection oe\n injection oe with h'\n exact \u27e8a, om, h'\u27e9\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Data.WSeq.Basic.seq_destruct_think (L205-L207)\ntheorem seq_destruct_think (s : WSeq \u03b1) : Seq.destruct (think s) = some (none, s) :=\nSeq.destruct_cons _ _\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Data.WSeq.Basic.coeStream (L65-L68)\ninstance coeStream : Coe (Stream' \u03b1) (WSeq \u03b1) :=\n\u27e8ofStream\u27e9\n\n/-- The empty weak sequence -/\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Data.WSeq.Basic.nil (L69-L71)\ndef nil : WSeq \u03b1 :=\nSeq.nil\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Data.WSeq.Basic.head_some_of_head_tail_some (L371-L378)\ntheorem head_some_of_head_tail_some {s : WSeq \u03b1} {a} (h : some a \u2208 head (tail s)) :\n \u2203 a', some a' \u2208 head s := by\nunfold head at h\n rcases Computation.exists_of_mem_map h with \u27e8o, md, e\u27e9; clear h\n rcases o with - | o <;> [injection e; injection e with h']; clear h'\n obtain \u27e8a, am\u27e9 := destruct_some_of_destruct_tail_some md\n exact \u27e8_, Computation.mem_map (@Prod.fst \u03b1 (WSeq \u03b1) <$> \u00b7) am\u27e9\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Data.WSeq.Basic.cons (L76-L79)\ndef cons (a : \u03b1) : WSeq \u03b1 \u2192 WSeq \u03b1 :=\nSeq.cons (some a)\n\n/-- Compute for one tick, without producing any elements -/\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Data.WSeq.Basic.mem_cons (L453-L456)\ntheorem mem_cons (s : WSeq \u03b1) (a) : a \u2208 cons a s :=\n(mem_cons_iff _ _).2 (Or.inl rfl)\n\nset_option linter.flexible false in -- TODO: fix non-terminal simp\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Data.WSeq.Basic.destruct_cons (L189-L191)\ntheorem destruct_cons (a : \u03b1) (s) : destruct (cons a s) = Computation.pure (some (a, s)) :=\nComputation.destruct_eq_pure <| by simp [destruct, cons, Computation.rmap]\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Data.WSeq.Basic.get (L133-L136)\ndef get? (s : WSeq \u03b1) (n : \u2115) : Computation (Option \u03b1) :=\nhead (drop s n)\n\n/-- Convert `s` to a list (if it is finite and completes in finite time). -/\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Data.WSeq.Basic.notMem_nil (L105-L109)\ntheorem notMem_nil (a : \u03b1) : a \u2209 @nil \u03b1 :=\nSeq.notMem_nil (some a)\n\n/-- Get the head of a weak sequence. This involves a possibly\n infinite computation. -/\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Data.WSeq.Basic.ofList_nil (L537-L539)\ntheorem ofList_nil : ofList [] = (nil : WSeq \u03b1) :=\nrfl\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Data.WSeq.Basic.dropn_cons (L264-L269)\ntheorem dropn_cons (a : \u03b1) (s) (n) : drop (cons a s) (n + 1) = drop s n := by\ninduction n with\n | zero => simp [drop]\n | succ n n_ih =>\n simp [drop, \u2190 n_ih]\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Data.WSeq.Basic.mem_rec_on (L401-L413)\ntheorem mem_rec_on {C : WSeq \u03b1 \u2192 Prop} {a s} (M : a \u2208 s) (h1 : \u2200 b s', a = b \u2228 C s' \u2192 C (cons b s'))\n (h2 : \u2200 s, C s \u2192 C (think s)) : C s := by\napply Seq.mem_rec_on M\n intro o s' h; rcases o with - | b\n \u00b7 apply h2\n cases h\n \u00b7 contradiction\n \u00b7 assumption\n \u00b7 apply h1\n apply Or.imp_left _ h\n intro h\n injection h\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Data.WSeq.Basic.join (L153-L161)\ndef join (S : WSeq (WSeq \u03b1)) : WSeq \u03b1 :=\nSeq.join\n ((fun o : Option (WSeq \u03b1) =>\n match o with\n | none => Seq1.ret none\n | some s => (none, s)) <$>\n S)\n\n/-- Map a function over a weak sequence -/\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Data.WSeq.Basic.destruct_think (L193-L195)\ntheorem destruct_think (s : WSeq \u03b1) : destruct (think s) = (destruct s).think :=\nComputation.destruct_eq_think <| by simp [destruct, think, Computation.rmap]\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Data.WSeq.Basic.think (L80-L84)\ndef think : WSeq \u03b1 \u2192 WSeq \u03b1 :=\nSeq.cons none\n\n/-- Destruct a weak sequence, to (eventually possibly) produce either\n `none` for `nil` or `some (a, s)` if an element is produced. -/\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Data.WSeq.Basic.ofList_cons (L541-L543)\ntheorem ofList_cons (a : \u03b1) (l) : ofList (a::l) = cons a (ofList l) :=\nshow Seq.map some (Seq.ofList (a::l)) = Seq.cons (some a) (Seq.map some (Seq.ofList l)) by simp\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Data.WSeq.Basic.flatten (L115-L123)\ndef flatten : Computation (WSeq \u03b1) \u2192 WSeq \u03b1 :=\nSeq.corec fun c =>\n match Computation.destruct c with\n | Sum.inl s => Seq.omap (return \u00b7) (Seq.destruct s)\n | Sum.inr c' => some (none, c')\n\n/-- Get the tail of a weak sequence. This doesn't need a `Computation`\n wrapper, unlike `head`, because `flatten` allows us to hide this\n in the construction of the weak sequence itself. -/\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Data.WSeq.Basic.seq_destruct_nil (L197-L199)\ntheorem seq_destruct_nil : Seq.destruct (nil : WSeq \u03b1) = none :=\nrfl\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Data.WSeq.Basic.destruct_nil (L185-L187)\ntheorem destruct_nil : destruct (nil : WSeq \u03b1) = Computation.pure none :=\nComputation.destruct_eq_pure rfl\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Data.WSeq.Basic.recOn (L94-L101)\ndef recOn {motive : WSeq \u03b1 \u2192 Sort v} (s : WSeq \u03b1) (nil : motive nil)\n (cons : \u2200 x s, motive (cons x s)) (think : \u2200 s, motive (think s)) : motive s :=\nSeq.recOn s nil fun o => Option.recOn o think cons\n\n/-- membership for weak sequences -/\nprotected def Mem (s : WSeq \u03b1) (a : \u03b1) :=\n Seq.Mem s (some a)\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Data.WSeq.Basic.coeSeq (L59-L61)\ninstance coeSeq : Coe (Seq \u03b1) (WSeq \u03b1) :=\n\u27e8ofSeq\u27e9\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Data.WSeq.Basic.head_think (L215-L216)\ntheorem head_think (s : WSeq \u03b1) : head (think s) = (head s).think := by simp [head]\n```\n\n-- snippet 84\n```lean\n-- Mathlib.Data.WSeq.Basic.ret (L166-L169)\ndef ret (a : \u03b1) : WSeq \u03b1 :=\nofList [a]\n\n/-- Monadic bind operator for weak sequences -/\n```\n\n-- snippet 85\n```lean\n-- Mathlib.Data.WSeq.Basic.destruct_some_of_destruct_tail_some (L361-L370)\ntheorem destruct_some_of_destruct_tail_some {s : WSeq \u03b1} {a} (h : some a \u2208 destruct (tail s)) :\n \u2203 a', some a' \u2208 destruct s := by\nunfold tail Functor.map at h; simp only [destruct_flatten] at h\n rcases exists_of_mem_bind h with \u27e8t, tm, td\u27e9; clear h\n rcases Computation.exists_of_mem_map tm with \u27e8t', ht', ht2\u27e9; clear tm\n rcases t' with - | t' <;> rw [\u2190 ht2] at td <;> simp only [destruct_nil] at td\n \u00b7 have := mem_unique td (ret_mem _)\n contradiction\n \u00b7 exact \u27e8_, ht'\u27e9\n```\n\n-- snippet 86\n```lean\n-- Mathlib.Data.WSeq.Basic.think_append (L314-L316)\ntheorem think_append (s t : WSeq \u03b1) : append (think s) t = think (append s t) :=\nSeq.cons_append _ _ _\n```\n\n-- snippet 87\n```lean\n-- Mathlib.Data.WSeq.Basic.seq_destruct_cons (L201-L203)\ntheorem seq_destruct_cons (a : \u03b1) (s) : Seq.destruct (cons a s) = some (some a, s) :=\nSeq.destruct_cons _ _\n```\n\n-- snippet 88\n```lean\n-- Mathlib.Data.WSeq.Basic.destruct (L85-L92)\ndef destruct : WSeq \u03b1 \u2192 Computation (Option (\u03b1 \u00d7 WSeq \u03b1)) :=\nComputation.corec fun s =>\n match Seq.destruct s with\n | none => Sum.inl none\n | some (none, s') => Sum.inr s'\n | some (some a, s') => Sum.inl (some (a, s'))\n\n/-- Recursion principle for weak sequences, compare with `List.recOn`. -/\n```\n\n-- snippet 89\n```lean\n-- Mathlib.Data.WSeq.Basic.of_mem_append (L522-L524)\ntheorem of_mem_append {s\u2081 s\u2082 : WSeq \u03b1} {a : \u03b1} : a \u2208 append s\u2081 s\u2082 \u2192 a \u2208 s\u2081 \u2228 a \u2208 s\u2082 :=\nSeq.of_mem_append\n```\n\n-- snippet 90\n```lean\n-- Mathlib.Data.WSeq.Basic.flatten_think (L230-L232)\ntheorem flatten_think (c : Computation (WSeq \u03b1)) : flatten c.think = think (flatten c) :=\nSeq.destruct_eq_cons <| by simp [flatten]\n```\n\n-- snippet 91\n```lean\n-- Mathlib.Data.WSeq.Basic.toList'_map (L581-L607)\ntheorem toList'_map (l : List \u03b1) (s : WSeq \u03b1) :\n Computation.corec (fun \u27e8l, s\u27e9 =>\n match Seq.destruct s with\n | none => Sum.inl l.reverse\n | some (none, s') => Sum.inr (l, s')\n | some (some a, s') => Sum.inr (a :: l, s')) (l, s) = (l.reverse ++ \u00b7) <$> toList s := by\nrefine\n Computation.eq_of_bisim\n (fun c1 c2 =>\n \u2203 (l' : List \u03b1) (s : WSeq \u03b1),\n c1 = Computation.corec (fun \u27e8l, s\u27e9 =>\n match Seq.destruct s with\n | none => Sum.inl l.reverse\n | some (none, s') => Sum.inr (l, s')\n | some (some a, s') => Sum.inr (a::l, s')) (l' ++ l, s) \u2227\n c2 = Computation.map (l.reverse ++ \u00b7) (Computation.corec (fun \u27e8l, s\u27e9 =>\n match Seq.destruct s with\n | none => Sum.inl l.reverse\n | some (none, s') => Sum.inr (l, s')\n | some (some a, s') => Sum.inr (a::l, s')) (l', s)))\n ?_ \u27e8[], s, rfl, rfl\u27e9\n intro s1 s2 h; rcases h with \u27e8l', s, h\u27e9; rw [h.left, h.right]\n induction s using WSeq.recOn\n case nil => simp\n case cons a s => refine \u27e8a :: l', s, ?_, ?_\u27e9 <;> simp\n case think s => refine \u27e8l', s, ?_, ?_\u27e9 <;> simp\n```\n\n-- snippet 92\n```lean\n-- Mathlib.Data.WSeq.Basic.destruct_flatten (L234-L247)\ntheorem destruct_flatten (c : Computation (WSeq \u03b1)) : destruct (flatten c) = c >>= destruct := by\nrefine\n Computation.eq_of_bisim\n (fun c1 c2 => c1 = c2 \u2228 \u2203 c, c1 = destruct (flatten c) \u2227 c2 = Computation.bind c destruct) ?_\n (Or.inr \u27e8c, rfl, rfl\u27e9)\n intro c1 c2 h\n exact\n match c1, c2, h with\n | c, _, Or.inl rfl => by cases c.destruct <;> simp\n | _, _, Or.inr \u27e8c, rfl, rfl\u27e9 => by\n induction c using Computation.recOn with\n | pure a => simp; cases (destruct a).destruct <;> simp\n | think c' => simpa using Or.inr \u27e8c', rfl, rfl\u27e9\n```\n\n-- snippet 93\n```lean\n-- Mathlib.Data.WSeq.Basic.ofSeq (L46-L49)\ndef ofSeq : Seq \u03b1 \u2192 WSeq \u03b1 :=\n(\u00b7 <$> \u00b7) some\n\n/-- Turn a list into a weak sequence -/\n```\n\n-- snippet 94\n```lean\n-- Mathlib.Data.WSeq.Basic.membership (L102-L104)\ninstance membership : Membership \u03b1 (WSeq \u03b1) :=\n\u27e8WSeq.Mem\u27e9\n```\n\n-- snippet 95\n```lean\n-- Mathlib.Data.WSeq.Basic.dropn_think (L271-L273)\ntheorem dropn_think (s : WSeq \u03b1) (n) : drop (think s) n = (drop s n).think := by\ninduction n <;> simp [*, drop]\n```\n\n-- snippet 96\n```lean\n-- Mathlib.Data.WSeq.Basic.toList (L137-L147)\ndef toList (s : WSeq \u03b1) : Computation (List \u03b1) :=\n@Computation.corec (List \u03b1) (List \u03b1 \u00d7 WSeq \u03b1)\n (fun \u27e8l, s\u27e9 =>\n match Seq.destruct s with\n | none => Sum.inl l.reverse\n | some (none, s') => Sum.inr (l, s')\n | some (some a, s') => Sum.inr (a::l, s'))\n ([], s)\n\n/-- Append two weak sequences. As with `Seq.append`, this may not use\n the second sequence if the first one takes forever to compute -/\n```\n\n-- snippet 97\n```lean\n-- Mathlib.Data.WSeq.Basic.destruct_tail (L331-L335)\ntheorem destruct_tail (s : WSeq \u03b1) : destruct (tail s) = destruct s >>= tail.aux := by\nsimp only [tail, destruct_flatten]; rw [\u2190 bind_pure_comp, LawfulMonad.bind_assoc]\n apply congr_arg; ext1 (_ | \u27e8a, s\u27e9) <;> apply (@pure_bind Computation _ _ _ _ _ _).trans _ <;> simp\n\n/-- auxiliary definition of drop over weak sequences -/\n```\n\n-- snippet 98\n```lean\n-- Mathlib.Data.WSeq.Basic.toList'_nil (L545-L552)\ntheorem toList'_nil (l : List \u03b1) :\n Computation.corec (fun \u27e8l, s\u27e9 =>\n match Seq.destruct s with\n | none => Sum.inl l.reverse\n | some (none, s') => Sum.inr (l, s')\n | some (some a, s') => Sum.inr (a::l, s')) (l, nil) = Computation.pure l.reverse :=\ndestruct_eq_pure rfl\n```\n\n-- snippet 99\n```lean\n-- Mathlib.Data.WSeq.Basic.mem_append_left (L525-L527)\ntheorem mem_append_left {s\u2081 s\u2082 : WSeq \u03b1} {a : \u03b1} : a \u2208 s\u2081 \u2192 a \u2208 append s\u2081 s\u2082 :=\nSeq.mem_append_left\n```\n\n-- snippet 100\n```lean\n-- Mathlib.Data.WSeq.Basic.nil_append (L306-L308)\ntheorem nil_append (s : WSeq \u03b1) : append nil s = s :=\nSeq.nil_append _\n```\n\n-- snippet 101\n```lean\n-- Mathlib.Data.WSeq.Basic.tail_cons (L255-L256)\ntheorem tail_cons (a : \u03b1) (s) : tail (cons a s) = s := by simp [tail]\n```\n\n-- snippet 102\n```lean\n-- Mathlib.Data.WSeq.Basic.exists_dropn_of_mem (L504-L517)\ntheorem exists_dropn_of_mem {s : WSeq \u03b1} {a} (h : a \u2208 s) :\n \u2203 n s', some (a, s') \u2208 destruct (drop s n) :=\nlet \u27e8n, h\u27e9 := exists_get?_of_mem h\n \u27e8n, by\n rcases (head_terminates_iff _).1 \u27e8\u27e8_, h\u27e9\u27e9 with \u27e8\u27e8o, om\u27e9\u27e9\n have := Computation.mem_unique (Computation.mem_map _ om) h\n rcases o with - | o\n \u00b7 injection this\n injection this with i\n obtain \u27e8a', s'\u27e9 := o\n dsimp at i\n rw [i] at om\n exact \u27e8_, om\u27e9\u27e9\n```\n\n-- snippet 103\n```lean\n-- Mathlib.Data.WSeq.Basic.tail_think (L258-L259)\ntheorem tail_think (s : WSeq \u03b1) : tail (think s) = (tail s).think := by simp [tail]\n```\n\n-- snippet 104\n```lean\n-- Mathlib.Data.WSeq.Basic.ofStream (L56-L58)\ndef ofStream (l : Stream' \u03b1) : WSeq \u03b1 :=\nofSeq l\n```\n\n-- snippet 105\n```lean\n-- Mathlib.Data.WSeq.Basic.append (L148-L152)\ndef append : WSeq \u03b1 \u2192 WSeq \u03b1 \u2192 WSeq \u03b1 :=\nSeq.append\n\n/-- Flatten a sequence of weak sequences. (Note that this allows\n empty sequences, unlike `Seq.join`.) -/\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.Data.WSeq.Relation).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem LiftRel.refl (R : \u03b1 \u2192 \u03b1 \u2192 Prop) (H : Reflexive R) : Reflexive (LiftRel R)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Data.WSeq.Relation.LiftRelO (L37-L41)\ndef LiftRelO (R : \u03b1 \u2192 \u03b2 \u2192 Prop) (C : WSeq \u03b1 \u2192 WSeq \u03b2 \u2192 Prop) :\n Option (\u03b1 \u00d7 WSeq \u03b1) \u2192 Option (\u03b2 \u00d7 WSeq \u03b2) \u2192 Prop\n | none, none => True\n | some (a, s), some (b, t) => R a b \u2227 C s t\n | _, _ => False\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Data.WSeq.Relation.LiftRelO (L44-L50)\ntheorem LiftRelO.imp {R S : \u03b1 \u2192 \u03b2 \u2192 Prop} {C D : WSeq \u03b1 \u2192 WSeq \u03b2 \u2192 Prop} (H1 : \u2200 a b, R a b \u2192 S a b)\n (H2 : \u2200 s t, C s t \u2192 D s t) : \u2200 {o p}, LiftRelO R C o p \u2192 LiftRelO S D o p\n | none, none, _ => trivial\n | some (_, _), some (_, _), h => And.imp (H1 _ _) (H2 _ _) h\n | none, some _, h => False.elim h\n | some (_, _), none, h => False.elim h\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Data.WSeq.Relation.LiftRelO (L51-L54)\ntheorem LiftRelO.imp_right (R : \u03b1 \u2192 \u03b2 \u2192 Prop) {C D : WSeq \u03b1 \u2192 WSeq \u03b2 \u2192 Prop}\n (H : \u2200 s t, C s t \u2192 D s t) {o p} : LiftRelO R C o p \u2192 LiftRelO R D o p :=\nLiftRelO.imp (fun _ _ => id) H\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Data.WSeq.Relation.LiftRelO (L55-L60)\ntheorem LiftRelO.swap (R : \u03b1 \u2192 \u03b2 \u2192 Prop) (C) :\n swap (LiftRelO R C) = LiftRelO (swap R) (swap C) := by\nfunext x y\n rcases x with \u27e8\u27e9 | \u27e8hx, jx\u27e9 <;> rcases y with \u27e8\u27e9 | \u27e8hy, jy\u27e9 <;> rfl\n\n/-- Definition of bisimilarity for weak sequences -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Data.WSeq.Relation.BisimO (L62-L64)\ndef BisimO (R : WSeq \u03b1 \u2192 WSeq \u03b1 \u2192 Prop) : Option (\u03b1 \u00d7 WSeq \u03b1) \u2192 Option (\u03b1 \u00d7 WSeq \u03b1) \u2192 Prop :=\nLiftRelO (\u00b7 = \u00b7) R\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Data.WSeq.Relation.BisimO (L65-L71)\ntheorem BisimO.imp {R S : WSeq \u03b1 \u2192 WSeq \u03b1 \u2192 Prop} (H : \u2200 s t, R s t \u2192 S s t) {o p} :\n BisimO R o p \u2192 BisimO S o p :=\nLiftRelO.imp_right _ H\n\n/-- Two weak sequences are `LiftRel R` related if they are either both empty,\n or they are both nonempty and the heads are `R` related and the tails are\n `LiftRel R` related. (This is a coinductive definition.) -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Data.WSeq.Relation.liftRel_destruct (L76-L82)\ntheorem liftRel_destruct {R : \u03b1 \u2192 \u03b2 \u2192 Prop} {s : WSeq \u03b1} {t : WSeq \u03b2} :\n LiftRel R s t \u2192 Computation.LiftRel (LiftRelO R (LiftRel R)) (destruct s) (destruct t)\n | \u27e8R, h1, h2\u27e9 => by\n refine Computation.LiftRel.imp ?_ _ _ (h2 h1)\n apply LiftRelO.imp_right\n exact fun s' t' h' => \u27e8R, h', @h2\u27e9\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Data.WSeq.Relation.liftRel_destruct_iff (L83-L97)\ntheorem liftRel_destruct_iff {R : \u03b1 \u2192 \u03b2 \u2192 Prop} {s : WSeq \u03b1} {t : WSeq \u03b2} :\n LiftRel R s t \u2194 Computation.LiftRel (LiftRelO R (LiftRel R)) (destruct s) (destruct t) :=\n\u27e8liftRel_destruct, fun h =>\n \u27e8fun s t =>\n LiftRel R s t \u2228 Computation.LiftRel (LiftRelO R (LiftRel R)) (destruct s) (destruct t),\n Or.inr h, fun {s t} h => by\n have h : Computation.LiftRel (LiftRelO R (LiftRel R)) (destruct s) (destruct t) := by\n obtain h | h := h\n \u00b7 exact liftRel_destruct h\n \u00b7 assumption\n apply Computation.LiftRel.imp _ _ _ h\n apply LiftRelO.imp_right\n intro s t\n apply Or.inl\u27e9\u27e9\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Data.WSeq.Relation.Equiv (L159-L161)\ndef Equiv : WSeq \u03b1 \u2192 WSeq \u03b1 \u2192 Prop :=\nLiftRel (\u00b7 = \u00b7)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Data.WSeq.Relation.Equiv (L165-L167)\ntheorem Equiv.refl : \u2200 s : WSeq \u03b1, s ~\u02b7 s :=\nLiftRel.refl (\u00b7 = \u00b7) Eq.refl\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Data.WSeq.Relation.Equiv (L169-L171)\ntheorem Equiv.symm : \u2200 {s t : WSeq \u03b1}, s ~\u02b7 t \u2192 t ~\u02b7 s :=\n@(LiftRel.symm (\u00b7 = \u00b7) (@Eq.symm _))\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Data.WSeq.Relation.Equiv (L173-L175)\ntheorem Equiv.trans : \u2200 {s t u : WSeq \u03b1}, s ~\u02b7 t \u2192 t ~\u02b7 u \u2192 s ~\u02b7 u :=\nLiftRel.trans (\u00b7 = \u00b7) inferInstance |>.trans _ _ _\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Data.WSeq.Relation.Equiv (L176-L178)\ntheorem Equiv.equivalence : Equivalence (@Equiv \u03b1) :=\n\u27e8@Equiv.refl _, @Equiv.symm _, @Equiv.trans _\u27e9\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Data.WSeq.Relation.destruct_congr (L179-L182)\ntheorem destruct_congr {s t : WSeq \u03b1} :\n s ~\u02b7 t \u2192 Computation.LiftRel (BisimO (\u00b7 ~\u02b7 \u00b7)) (destruct s) (destruct t) :=\nliftRel_destruct\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Data.WSeq.Relation.destruct_congr_iff (L183-L188)\ntheorem destruct_congr_iff {s t : WSeq \u03b1} :\n s ~\u02b7 t \u2194 Computation.LiftRel (BisimO (\u00b7 ~\u02b7 \u00b7)) (destruct s) (destruct t) :=\nliftRel_destruct_iff\n\nopen Computation\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Data.WSeq.Relation.liftRel_dropn_destruct (L189-L200)\ntheorem liftRel_dropn_destruct {R : \u03b1 \u2192 \u03b2 \u2192 Prop} {s t} (H : LiftRel R s t) :\n \u2200 n, Computation.LiftRel (LiftRelO R (LiftRel R)) (destruct (drop s n)) (destruct (drop t n))\n | 0 => liftRel_destruct H\n | n + 1 => by\n simp only [drop, destruct_tail]\n apply liftRel_bind\n \u00b7 apply liftRel_dropn_destruct H n\n exact fun {a b} o =>\n match a, b, o with\n | none, none, _ => by simp\n | some (a, s), some (b, t), \u27e8_, h2\u27e9 => by simpa [tail.aux] using liftRel_destruct h2\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Data.WSeq.Relation.exists_of_liftRel_left (L201-L207)\ntheorem exists_of_liftRel_left {R : \u03b1 \u2192 \u03b2 \u2192 Prop} {s t} (H : LiftRel R s t) {a} (h : a \u2208 s) :\n \u2203 b, b \u2208 t \u2227 R a b := by\nlet \u27e8n, h\u27e9 := exists_get?_of_mem h\n let \u27e8some (_, s'), sd, rfl\u27e9 := Computation.exists_of_mem_map h\n let \u27e8some (b, t'), td, \u27e8ab, _\u27e9\u27e9 := (liftRel_dropn_destruct H n).left sd\n exact \u27e8b, get?_mem (Computation.mem_map (Prod.fst.{v, v} <$> \u00b7) td), ab\u27e9\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Data.WSeq.Relation.exists_of_liftRel_right (L208-L210)\ntheorem exists_of_liftRel_right {R : \u03b1 \u2192 \u03b2 \u2192 Prop} {s t} (H : LiftRel R s t) {b} (h : b \u2208 t) :\n \u2203 a, a \u2208 s \u2227 R a b := by rw [\u2190 LiftRel.swap] at H; exact exists_of_liftRel_left H h\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Data.WSeq.Relation.liftRel_nil (L212-L214)\ntheorem liftRel_nil (R : \u03b1 \u2192 \u03b2 \u2192 Prop) : LiftRel R nil nil := by\nsimp [liftRel_destruct_iff]\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Data.WSeq.Relation.liftRel_cons (L216-L219)\ntheorem liftRel_cons (R : \u03b1 \u2192 \u03b2 \u2192 Prop) (a b s t) :\n LiftRel R (cons a s) (cons b t) \u2194 R a b \u2227 LiftRel R s t := by\nsimp [liftRel_destruct_iff]\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Data.WSeq.Relation.liftRel_think_left (L221-L223)\ntheorem liftRel_think_left (R : \u03b1 \u2192 \u03b2 \u2192 Prop) (s t) : LiftRel R (think s) t \u2194 LiftRel R s t := by\nrw [liftRel_destruct_iff, liftRel_destruct_iff]; simp\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Data.WSeq.Relation.liftRel_think_right (L225-L227)\ntheorem liftRel_think_right (R : \u03b1 \u2192 \u03b2 \u2192 Prop) (s t) : LiftRel R s (think t) \u2194 LiftRel R s t := by\nrw [liftRel_destruct_iff, liftRel_destruct_iff]; simp\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Data.WSeq.Relation.cons_congr (L228-L230)\ntheorem cons_congr {s t : WSeq \u03b1} (a : \u03b1) (h : s ~\u02b7 t) : cons a s ~\u02b7 cons a t := by\nunfold Equiv; simpa using h\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Data.WSeq.Relation.think_equiv (L231-L232)\ntheorem think_equiv (s : WSeq \u03b1) : think s ~\u02b7 s := by unfold Equiv; simpa using Equiv.refl _\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Data.WSeq.Relation.think_congr (L233-L235)\ntheorem think_congr {s t : WSeq \u03b1} (h : s ~\u02b7 t) : think s ~\u02b7 think t := by\nunfold Equiv; simpa using h\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Data.WSeq.Basic.head_terminates_iff (L248-L250)\ntheorem head_terminates_iff (s : WSeq \u03b1) : Terminates (head s) \u2194 Terminates (destruct s) :=\nterminates_map_iff _ (destruct s)\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Data.WSeq.Basic.flatten_pure (L218-L228)\ntheorem flatten_pure (s : WSeq \u03b1) : flatten (Computation.pure s) = s := by\nrefine Seq.eq_of_bisim (fun s1 s2 => flatten (Computation.pure s2) = s1) ?_ rfl\n intro s' s h\n rw [\u2190 h]\n simp only [Seq.BisimO, flatten, Seq.omap, pure_def, Seq.corec_eq, destruct_pure]\n cases Seq.destruct s with\n | none => simp\n | some val =>\n obtain \u27e8o, s'\u27e9 := val\n simp\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Data.WSeq.Basic.tail (L124-L127)\ndef tail (s : WSeq \u03b1) : WSeq \u03b1 :=\nflatten <| (fun o => Option.recOn o nil Prod.snd) <$> destruct s\n\n/-- drop the first `n` elements from `s`. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Data.WSeq.Basic.eq_or_mem_iff_mem (L425-L445)\ntheorem eq_or_mem_iff_mem {s : WSeq \u03b1} {a a' s'} :\n some (a', s') \u2208 destruct s \u2192 (a \u2208 s \u2194 a = a' \u2228 a \u2208 s') := by\ngeneralize e : destruct s = c; intro h\n revert s\n apply Computation.memRecOn h <;> [skip; intro c IH] <;> intro s <;>\n induction s using WSeq.recOn <;>\n intro m <;>\n have := congr_arg Computation.destruct m <;>\n simp at this\n \u00b7 obtain \u27e8i1, i2\u27e9 := this\n rw [i1, i2]\n dsimp only [cons, Membership.mem, WSeq.Mem, Seq.Mem, Seq.cons]\n have h_a_eq_a' : a = a' \u2194 some (some a) = some (some a') := by simp\n rw [h_a_eq_a']\n refine \u27e8Stream'.eq_or_mem_of_mem_cons, fun o => ?_\u27e9\n \u00b7 rcases o with e | m\n \u00b7 rw [e]\n apply Stream'.mem_cons\n \u00b7 exact Stream'.mem_cons_of_mem _ m\n \u00b7 simp [IH this]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Data.WSeq.Basic.mem_think (L415-L424)\ntheorem mem_think (s : WSeq \u03b1) (a) : a \u2208 think s \u2194 a \u2208 s := by\nobtain \u27e8f, al\u27e9 := s\n change (some (some a) \u2208 some none::f) \u2194 some (some a) \u2208 f\n constructor <;> intro h\n \u00b7 apply (Stream'.eq_or_mem_of_mem_cons h).resolve_left\n intro\n injections\n \u00b7 apply Stream'.mem_cons_of_mem _ h\n\nset_option linter.flexible false in -- TODO: fix non-terminal simp\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Data.WSeq.Basic.cons_append (L310-L312)\ntheorem cons_append (a : \u03b1) (s t) : append (cons a s) t = cons a (append s t) :=\nSeq.cons_append _ _ _\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Data.WSeq.Basic.toList'_cons (L554-L566)\ntheorem toList'_cons (l : List \u03b1) (s : WSeq \u03b1) (a : \u03b1) :\n Computation.corec (fun \u27e8l, s\u27e9 =>\n match Seq.destruct s with\n | none => Sum.inl l.reverse\n | some (none, s') => Sum.inr (l, s')\n | some (some a, s') => Sum.inr (a::l, s')) (l, cons a s) =\n (Computation.corec (fun \u27e8l, s\u27e9 =>\n match Seq.destruct s with\n | none => Sum.inl l.reverse\n | some (none, s') => Sum.inr (l, s')\n | some (some a, s') => Sum.inr (a::l, s')) (a::l, s)).think :=\ndestruct_eq_think <| by simp [cons]\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Data.WSeq.Basic.WSeq (L37-L44)\ndef WSeq (\u03b1) :=\nSeq (Option \u03b1)\n\nnamespace WSeq\n\nvariable {\u03b1 : Type u} {\u03b2 : Type v} {\u03b3 : Type w}\n\n/-- Turn a sequence into a weak sequence -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Data.WSeq.Basic.ofList (L51-L54)\ndef ofList (l : List \u03b1) : WSeq \u03b1 :=\nofSeq l\n\n/-- Turn a stream into a weak sequence -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Data.WSeq.Basic.head (L110-L114)\ndef head (s : WSeq \u03b1) : Computation (Option \u03b1) :=\nComputation.map (Prod.fst <$> \u00b7) (destruct s)\n\n/-- Encode a computation yielding a weak sequence into additional\n `think` constructors in a weak sequence -/\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Data.WSeq.Basic.head_terminates_of_head_tail_terminates (L353-L360)\ntheorem head_terminates_of_head_tail_terminates (s : WSeq \u03b1) [T : Terminates (head (tail s))] :\n Terminates (head s) :=\n(head_terminates_iff _).2 <| by\n rcases (head_terminates_iff _).1 T with \u27e8\u27e8a, h\u27e9\u27e9\n simp? [tail] at h says simp only [tail, destruct_flatten, bind_map_left] at h\n rcases exists_of_mem_bind h with \u27e8s', h1, _\u27e9\n exact terminates_of_mem h1\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Data.WSeq.Basic.destruct_terminates_of_get (L397-L400)\ntheorem destruct_terminates_of_get?_terminates {s : WSeq \u03b1} {n} (T : Terminates (get? s n)) :\n Terminates (destruct s) :=\n(head_terminates_iff _).1 <| head_terminates_of_get?_terminates T\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Data.WSeq.Basic.monad (L177-L183)\ninstance monad : Monad WSeq where\n map := @map\npure := @ret\n bind := @bind\n\nopen Computation\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Data.WSeq.Basic.exists_get (L487-L503)\ntheorem exists_get?_of_mem {s : WSeq \u03b1} {a} (h : a \u2208 s) : \u2203 n, some a \u2208 get? s n := by\napply mem_rec_on h\n \u00b7 intro a' s' h\n rcases h with h | h\n \u00b7 exists 0\n simp only [get?, drop, head_cons]\n rw [h]\n apply ret_mem\n \u00b7 obtain \u27e8n, h\u27e9 := h\n exists n + 1\n simpa [get?]\n \u00b7 intro s' h\n obtain \u27e8n, h\u27e9 := h\n exists n\n simp only [get?, dropn_think, head_think]\n apply think_mem h\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Data.WSeq.Basic.join_cons (L300-L304)\ntheorem join_cons (s : WSeq \u03b1) (S) : join (cons s S) = think (append s (join S)) := by\nsimp only [join, think]\n dsimp only [(\u00b7 <$> \u00b7)]\n simp [cons, append]\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Data.WSeq.Basic.dropn_tail (L278-L282)\ntheorem dropn_tail (s : WSeq \u03b1) (n) : drop (tail s) n = drop s (n + 1) := by\nrw [Nat.add_comm]\n symm\n apply dropn_add\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Data.WSeq.Basic.toList'_think (L568-L580)\ntheorem toList'_think (l : List \u03b1) (s : WSeq \u03b1) :\n Computation.corec (fun \u27e8l, s\u27e9 =>\n match Seq.destruct s with\n | none => Sum.inl l.reverse\n | some (none, s') => Sum.inr (l, s')\n | some (some a, s') => Sum.inr (a::l, s')) (l, think s) =\n (Computation.corec (fun \u27e8l, s\u27e9 =>\n match Seq.destruct s with\n | none => Sum.inl l.reverse\n | some (none, s') => Sum.inr (l, s')\n | some (some a, s') => Sum.inr (a::l, s')) (l, s)).think :=\ndestruct_eq_think <| by simp [think]\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Data.WSeq.Basic.head_cons (L212-L213)\ntheorem head_cons (a : \u03b1) (s) : head (cons a s) = Computation.pure (some a) := by simp [head]\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Data.WSeq.Basic.append_nil (L318-L320)\ntheorem append_nil (s : WSeq \u03b1) : append s nil = s :=\nSeq.append_nil _\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Data.WSeq.Basic.mem_of_mem_tail (L457-L468)\ntheorem mem_of_mem_tail {s : WSeq \u03b1} {a} : a \u2208 tail s \u2192 a \u2208 s := by\nintro h; have := h; obtain \u27e8n, e\u27e9 := h; revert s; simp only [Stream'.get]\n induction n <;> intro s <;> induction s using WSeq.recOn <;>\n simp <;> intro m e <;> injections\n \u00b7 exact Or.inr m\n \u00b7 exact Or.inr m\n case succ.think n IH s =>\n apply IH m\n rw [e]\n cases tail s\n rfl\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Data.WSeq.Basic.head_some_of_get (L379-L386)\ntheorem head_some_of_get?_some {s : WSeq \u03b1} {a n} (h : some a \u2208 get? s n) :\n \u2203 a', some a' \u2208 head s := by\ninduction n generalizing a with\n | zero => exact \u27e8_, h\u27e9\n | succ n IH =>\n let \u27e8a', h'\u27e9 := head_some_of_head_tail_some h\n exact IH h'\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Data.WSeq.Basic.dropn_nil (L261-L262)\ntheorem dropn_nil (n) : drop (nil : WSeq \u03b1) n = nil := by induction n <;> simp [*, drop]\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Data.WSeq.Basic.mem_cons_of_mem (L450-L452)\ntheorem mem_cons_of_mem {s : WSeq \u03b1} (b) {a} (h : a \u2208 s) : a \u2208 cons b s :=\n(mem_cons_iff _ _).2 (Or.inr h)\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Data.WSeq.Basic.head_nil (L209-L210)\ntheorem head_nil : head (nil : WSeq \u03b1) = Computation.pure none := by simp [head]\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Data.WSeq.Basic.mem_cons_iff (L447-L449)\ntheorem mem_cons_iff (s : WSeq \u03b1) (b) {a} : a \u2208 cons b s \u2194 a = b \u2228 a \u2208 s :=\neq_or_mem_iff_mem <| by simp\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Data.WSeq.Basic.coeList (L62-L64)\ninstance coeList : Coe (List \u03b1) (WSeq \u03b1) :=\n\u27e8ofList\u27e9\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Data.WSeq.Basic.tail_nil (L252-L253)\ntheorem tail_nil : tail (nil : WSeq \u03b1) = nil := by simp [tail]\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Data.WSeq.Basic.join_think (L294-L298)\ntheorem join_think (S : WSeq (WSeq \u03b1)) : join (think S) = think (join S) := by\nsimp only [join, think]\n dsimp only [(\u00b7 <$> \u00b7)]\n simp [Seq1.ret]\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Data.WSeq.Basic.map (L162-L165)\ndef map (f : \u03b1 \u2192 \u03b2) : WSeq \u03b1 \u2192 WSeq \u03b2 :=\nSeq.map (Option.map f)\n\n/-- The monadic `return a` is a singleton list containing `a`. -/\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Data.WSeq.Basic.head_terminates_of_mem (L518-L521)\ntheorem head_terminates_of_mem {s : WSeq \u03b1} {a} (h : a \u2208 s) : Terminates (head s) :=\nlet \u27e8_, h\u27e9 := exists_get?_of_mem h\n head_terminates_of_get?_terminates \u27e8\u27e8_, h\u27e9\u27e9\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Data.WSeq.Basic.head_terminates_of_get (L393-L396)\ntheorem head_terminates_of_get?_terminates {s : WSeq \u03b1} {n} :\n Terminates (get? s n) \u2192 Terminates (head s) :=\nget?_terminates_le (Nat.zero_le n)\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Data.WSeq.Basic.append_assoc (L322-L325)\ntheorem append_assoc (s t u : WSeq \u03b1) : append (append s t) u = append s (append t u) :=\nSeq.append_assoc _ _ _\n\n/-- auxiliary definition of tail over weak sequences -/\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Data.WSeq.Basic.inhabited (L72-L75)\ninstance inhabited : Inhabited (WSeq \u03b1) :=\n\u27e8nil\u27e9\n\n/-- Prepend an element to a weak sequence -/\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Data.WSeq.Basic.join_nil (L290-L292)\ntheorem join_nil : join nil = (nil : WSeq \u03b1) :=\nSeq.join_nil\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Data.WSeq.Basic.bind (L170-L176)\ndef bind (s : WSeq \u03b1) (f : \u03b1 \u2192 WSeq \u03b2) : WSeq \u03b2 :=\njoin (map f s)\n\n/-- Unfortunately, `WSeq` is not a lawful monad, because it does not satisfy the monad laws exactly,\nonly up to sequence equivalence. Furthermore, even quotienting by the equivalence is not sufficient,\nbecause the join operation involves lists of quotient elements, with a lifted equivalence relation,\nand pure quotients cannot handle this type of construction. -/\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Data.WSeq.Basic.exists_of_mem_map (L528-L535)\ntheorem exists_of_mem_map {f} {b : \u03b2} : \u2200 {s : WSeq \u03b1}, b \u2208 map f s \u2192 \u2203 a, a \u2208 s \u2227 f a = b\n | \u27e8g, al\u27e9, h => by\n let \u27e8o, om, oe\u27e9 := Seq.exists_of_mem_map h\nrcases o with - | a\n \u00b7 injection oe\n injection oe with h'\n exact \u27e8a, om, h'\u27e9\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Data.WSeq.Basic.seq_destruct_think (L205-L207)\ntheorem seq_destruct_think (s : WSeq \u03b1) : Seq.destruct (think s) = some (none, s) :=\nSeq.destruct_cons _ _\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Data.WSeq.Basic.coeStream (L65-L68)\ninstance coeStream : Coe (Stream' \u03b1) (WSeq \u03b1) :=\n\u27e8ofStream\u27e9\n\n/-- The empty weak sequence -/\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Data.WSeq.Basic.nil (L69-L71)\ndef nil : WSeq \u03b1 :=\nSeq.nil\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Data.WSeq.Basic.head_some_of_head_tail_some (L371-L378)\ntheorem head_some_of_head_tail_some {s : WSeq \u03b1} {a} (h : some a \u2208 head (tail s)) :\n \u2203 a', some a' \u2208 head s := by\nunfold head at h\n rcases Computation.exists_of_mem_map h with \u27e8o, md, e\u27e9; clear h\n rcases o with - | o <;> [injection e; injection e with h']; clear h'\n obtain \u27e8a, am\u27e9 := destruct_some_of_destruct_tail_some md\n exact \u27e8_, Computation.mem_map (@Prod.fst \u03b1 (WSeq \u03b1) <$> \u00b7) am\u27e9\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Data.WSeq.Basic.cons (L76-L79)\ndef cons (a : \u03b1) : WSeq \u03b1 \u2192 WSeq \u03b1 :=\nSeq.cons (some a)\n\n/-- Compute for one tick, without producing any elements -/\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Data.WSeq.Basic.mem_cons (L453-L456)\ntheorem mem_cons (s : WSeq \u03b1) (a) : a \u2208 cons a s :=\n(mem_cons_iff _ _).2 (Or.inl rfl)\n\nset_option linter.flexible false in -- TODO: fix non-terminal simp\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Data.WSeq.Basic.destruct_cons (L189-L191)\ntheorem destruct_cons (a : \u03b1) (s) : destruct (cons a s) = Computation.pure (some (a, s)) :=\nComputation.destruct_eq_pure <| by simp [destruct, cons, Computation.rmap]\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Data.WSeq.Basic.get (L133-L136)\ndef get? (s : WSeq \u03b1) (n : \u2115) : Computation (Option \u03b1) :=\nhead (drop s n)\n\n/-- Convert `s` to a list (if it is finite and completes in finite time). -/\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Data.WSeq.Basic.notMem_nil (L105-L109)\ntheorem notMem_nil (a : \u03b1) : a \u2209 @nil \u03b1 :=\nSeq.notMem_nil (some a)\n\n/-- Get the head of a weak sequence. This involves a possibly\n infinite computation. -/\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Data.WSeq.Basic.ofList_nil (L537-L539)\ntheorem ofList_nil : ofList [] = (nil : WSeq \u03b1) :=\nrfl\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Data.WSeq.Basic.dropn_cons (L264-L269)\ntheorem dropn_cons (a : \u03b1) (s) (n) : drop (cons a s) (n + 1) = drop s n := by\ninduction n with\n | zero => simp [drop]\n | succ n n_ih =>\n simp [drop, \u2190 n_ih]\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Data.WSeq.Basic.mem_rec_on (L401-L413)\ntheorem mem_rec_on {C : WSeq \u03b1 \u2192 Prop} {a s} (M : a \u2208 s) (h1 : \u2200 b s', a = b \u2228 C s' \u2192 C (cons b s'))\n (h2 : \u2200 s, C s \u2192 C (think s)) : C s := by\napply Seq.mem_rec_on M\n intro o s' h; rcases o with - | b\n \u00b7 apply h2\n cases h\n \u00b7 contradiction\n \u00b7 assumption\n \u00b7 apply h1\n apply Or.imp_left _ h\n intro h\n injection h\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Data.WSeq.Basic.join (L153-L161)\ndef join (S : WSeq (WSeq \u03b1)) : WSeq \u03b1 :=\nSeq.join\n ((fun o : Option (WSeq \u03b1) =>\n match o with\n | none => Seq1.ret none\n | some s => (none, s)) <$>\n S)\n\n/-- Map a function over a weak sequence -/\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Data.WSeq.Basic.destruct_think (L193-L195)\ntheorem destruct_think (s : WSeq \u03b1) : destruct (think s) = (destruct s).think :=\nComputation.destruct_eq_think <| by simp [destruct, think, Computation.rmap]\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Data.WSeq.Basic.think (L80-L84)\ndef think : WSeq \u03b1 \u2192 WSeq \u03b1 :=\nSeq.cons none\n\n/-- Destruct a weak sequence, to (eventually possibly) produce either\n `none` for `nil` or `some (a, s)` if an element is produced. -/\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Data.WSeq.Basic.ofList_cons (L541-L543)\ntheorem ofList_cons (a : \u03b1) (l) : ofList (a::l) = cons a (ofList l) :=\nshow Seq.map some (Seq.ofList (a::l)) = Seq.cons (some a) (Seq.map some (Seq.ofList l)) by simp\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Data.WSeq.Basic.flatten (L115-L123)\ndef flatten : Computation (WSeq \u03b1) \u2192 WSeq \u03b1 :=\nSeq.corec fun c =>\n match Computation.destruct c with\n | Sum.inl s => Seq.omap (return \u00b7) (Seq.destruct s)\n | Sum.inr c' => some (none, c')\n\n/-- Get the tail of a weak sequence. This doesn't need a `Computation`\n wrapper, unlike `head`, because `flatten` allows us to hide this\n in the construction of the weak sequence itself. -/\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Data.WSeq.Basic.seq_destruct_nil (L197-L199)\ntheorem seq_destruct_nil : Seq.destruct (nil : WSeq \u03b1) = none :=\nrfl\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Data.WSeq.Basic.destruct_nil (L185-L187)\ntheorem destruct_nil : destruct (nil : WSeq \u03b1) = Computation.pure none :=\nComputation.destruct_eq_pure rfl\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Data.WSeq.Basic.recOn (L94-L101)\ndef recOn {motive : WSeq \u03b1 \u2192 Sort v} (s : WSeq \u03b1) (nil : motive nil)\n (cons : \u2200 x s, motive (cons x s)) (think : \u2200 s, motive (think s)) : motive s :=\nSeq.recOn s nil fun o => Option.recOn o think cons\n\n/-- membership for weak sequences -/\nprotected def Mem (s : WSeq \u03b1) (a : \u03b1) :=\n Seq.Mem s (some a)\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Data.WSeq.Basic.coeSeq (L59-L61)\ninstance coeSeq : Coe (Seq \u03b1) (WSeq \u03b1) :=\n\u27e8ofSeq\u27e9\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Data.WSeq.Basic.head_think (L215-L216)\ntheorem head_think (s : WSeq \u03b1) : head (think s) = (head s).think := by simp [head]\n```\n\n-- snippet 84\n```lean\n-- Mathlib.Data.WSeq.Basic.ret (L166-L169)\ndef ret (a : \u03b1) : WSeq \u03b1 :=\nofList [a]\n\n/-- Monadic bind operator for weak sequences -/\n```\n\n-- snippet 85\n```lean\n-- Mathlib.Data.WSeq.Basic.destruct_some_of_destruct_tail_some (L361-L370)\ntheorem destruct_some_of_destruct_tail_some {s : WSeq \u03b1} {a} (h : some a \u2208 destruct (tail s)) :\n \u2203 a', some a' \u2208 destruct s := by\nunfold tail Functor.map at h; simp only [destruct_flatten] at h\n rcases exists_of_mem_bind h with \u27e8t, tm, td\u27e9; clear h\n rcases Computation.exists_of_mem_map tm with \u27e8t', ht', ht2\u27e9; clear tm\n rcases t' with - | t' <;> rw [\u2190 ht2] at td <;> simp only [destruct_nil] at td\n \u00b7 have := mem_unique td (ret_mem _)\n contradiction\n \u00b7 exact \u27e8_, ht'\u27e9\n```\n\n-- snippet 86\n```lean\n-- Mathlib.Data.WSeq.Basic.think_append (L314-L316)\ntheorem think_append (s t : WSeq \u03b1) : append (think s) t = think (append s t) :=\nSeq.cons_append _ _ _\n```\n\n-- snippet 87\n```lean\n-- Mathlib.Data.WSeq.Basic.seq_destruct_cons (L201-L203)\ntheorem seq_destruct_cons (a : \u03b1) (s) : Seq.destruct (cons a s) = some (some a, s) :=\nSeq.destruct_cons _ _\n```\n\n-- snippet 88\n```lean\n-- Mathlib.Data.WSeq.Basic.destruct (L85-L92)\ndef destruct : WSeq \u03b1 \u2192 Computation (Option (\u03b1 \u00d7 WSeq \u03b1)) :=\nComputation.corec fun s =>\n match Seq.destruct s with\n | none => Sum.inl none\n | some (none, s') => Sum.inr s'\n | some (some a, s') => Sum.inl (some (a, s'))\n\n/-- Recursion principle for weak sequences, compare with `List.recOn`. -/\n```\n\n-- snippet 89\n```lean\n-- Mathlib.Data.WSeq.Basic.of_mem_append (L522-L524)\ntheorem of_mem_append {s\u2081 s\u2082 : WSeq \u03b1} {a : \u03b1} : a \u2208 append s\u2081 s\u2082 \u2192 a \u2208 s\u2081 \u2228 a \u2208 s\u2082 :=\nSeq.of_mem_append\n```\n\n-- snippet 90\n```lean\n-- Mathlib.Data.WSeq.Basic.flatten_think (L230-L232)\ntheorem flatten_think (c : Computation (WSeq \u03b1)) : flatten c.think = think (flatten c) :=\nSeq.destruct_eq_cons <| by simp [flatten]\n```\n\n-- snippet 91\n```lean\n-- Mathlib.Data.WSeq.Basic.toList'_map (L581-L607)\ntheorem toList'_map (l : List \u03b1) (s : WSeq \u03b1) :\n Computation.corec (fun \u27e8l, s\u27e9 =>\n match Seq.destruct s with\n | none => Sum.inl l.reverse\n | some (none, s') => Sum.inr (l, s')\n | some (some a, s') => Sum.inr (a :: l, s')) (l, s) = (l.reverse ++ \u00b7) <$> toList s := by\nrefine\n Computation.eq_of_bisim\n (fun c1 c2 =>\n \u2203 (l' : List \u03b1) (s : WSeq \u03b1),\n c1 = Computation.corec (fun \u27e8l, s\u27e9 =>\n match Seq.destruct s with\n | none => Sum.inl l.reverse\n | some (none, s') => Sum.inr (l, s')\n | some (some a, s') => Sum.inr (a::l, s')) (l' ++ l, s) \u2227\n c2 = Computation.map (l.reverse ++ \u00b7) (Computation.corec (fun \u27e8l, s\u27e9 =>\n match Seq.destruct s with\n | none => Sum.inl l.reverse\n | some (none, s') => Sum.inr (l, s')\n | some (some a, s') => Sum.inr (a::l, s')) (l', s)))\n ?_ \u27e8[], s, rfl, rfl\u27e9\n intro s1 s2 h; rcases h with \u27e8l', s, h\u27e9; rw [h.left, h.right]\n induction s using WSeq.recOn\n case nil => simp\n case cons a s => refine \u27e8a :: l', s, ?_, ?_\u27e9 <;> simp\n case think s => refine \u27e8l', s, ?_, ?_\u27e9 <;> simp\n```\n\n-- snippet 92\n```lean\n-- Mathlib.Data.WSeq.Basic.destruct_flatten (L234-L247)\ntheorem destruct_flatten (c : Computation (WSeq \u03b1)) : destruct (flatten c) = c >>= destruct := by\nrefine\n Computation.eq_of_bisim\n (fun c1 c2 => c1 = c2 \u2228 \u2203 c, c1 = destruct (flatten c) \u2227 c2 = Computation.bind c destruct) ?_\n (Or.inr \u27e8c, rfl, rfl\u27e9)\n intro c1 c2 h\n exact\n match c1, c2, h with\n | c, _, Or.inl rfl => by cases c.destruct <;> simp\n | _, _, Or.inr \u27e8c, rfl, rfl\u27e9 => by\n induction c using Computation.recOn with\n | pure a => simp; cases (destruct a).destruct <;> simp\n | think c' => simpa using Or.inr \u27e8c', rfl, rfl\u27e9\n```\n\n-- snippet 93\n```lean\n-- Mathlib.Data.WSeq.Basic.ofSeq (L46-L49)\ndef ofSeq : Seq \u03b1 \u2192 WSeq \u03b1 :=\n(\u00b7 <$> \u00b7) some\n\n/-- Turn a list into a weak sequence -/\n```\n\n-- snippet 94\n```lean\n-- Mathlib.Data.WSeq.Basic.membership (L102-L104)\ninstance membership : Membership \u03b1 (WSeq \u03b1) :=\n\u27e8WSeq.Mem\u27e9\n```\n\n-- snippet 95\n```lean\n-- Mathlib.Data.WSeq.Basic.dropn_think (L271-L273)\ntheorem dropn_think (s : WSeq \u03b1) (n) : drop (think s) n = (drop s n).think := by\ninduction n <;> simp [*, drop]\n```\n\n-- snippet 96\n```lean\n-- Mathlib.Data.WSeq.Basic.toList (L137-L147)\ndef toList (s : WSeq \u03b1) : Computation (List \u03b1) :=\n@Computation.corec (List \u03b1) (List \u03b1 \u00d7 WSeq \u03b1)\n (fun \u27e8l, s\u27e9 =>\n match Seq.destruct s with\n | none => Sum.inl l.reverse\n | some (none, s') => Sum.inr (l, s')\n | some (some a, s') => Sum.inr (a::l, s'))\n ([], s)\n\n/-- Append two weak sequences. As with `Seq.append`, this may not use\n the second sequence if the first one takes forever to compute -/\n```\n\n-- snippet 97\n```lean\n-- Mathlib.Data.WSeq.Basic.destruct_tail (L331-L335)\ntheorem destruct_tail (s : WSeq \u03b1) : destruct (tail s) = destruct s >>= tail.aux := by\nsimp only [tail, destruct_flatten]; rw [\u2190 bind_pure_comp, LawfulMonad.bind_assoc]\n apply congr_arg; ext1 (_ | \u27e8a, s\u27e9) <;> apply (@pure_bind Computation _ _ _ _ _ _).trans _ <;> simp\n\n/-- auxiliary definition of drop over weak sequences -/\n```\n\n-- snippet 98\n```lean\n-- Mathlib.Data.WSeq.Basic.toList'_nil (L545-L552)\ntheorem toList'_nil (l : List \u03b1) :\n Computation.corec (fun \u27e8l, s\u27e9 =>\n match Seq.destruct s with\n | none => Sum.inl l.reverse\n | some (none, s') => Sum.inr (l, s')\n | some (some a, s') => Sum.inr (a::l, s')) (l, nil) = Computation.pure l.reverse :=\ndestruct_eq_pure rfl\n```\n\n-- snippet 99\n```lean\n-- Mathlib.Data.WSeq.Basic.mem_append_left (L525-L527)\ntheorem mem_append_left {s\u2081 s\u2082 : WSeq \u03b1} {a : \u03b1} : a \u2208 s\u2081 \u2192 a \u2208 append s\u2081 s\u2082 :=\nSeq.mem_append_left\n```\n\n-- snippet 100\n```lean\n-- Mathlib.Data.WSeq.Basic.nil_append (L306-L308)\ntheorem nil_append (s : WSeq \u03b1) : append nil s = s :=\nSeq.nil_append _\n```\n\n-- snippet 101\n```lean\n-- Mathlib.Data.WSeq.Basic.tail_cons (L255-L256)\ntheorem tail_cons (a : \u03b1) (s) : tail (cons a s) = s := by simp [tail]\n```\n\n-- snippet 102\n```lean\n-- Mathlib.Data.WSeq.Basic.exists_dropn_of_mem (L504-L517)\ntheorem exists_dropn_of_mem {s : WSeq \u03b1} {a} (h : a \u2208 s) :\n \u2203 n s', some (a, s') \u2208 destruct (drop s n) :=\nlet \u27e8n, h\u27e9 := exists_get?_of_mem h\n \u27e8n, by\n rcases (head_terminates_iff _).1 \u27e8\u27e8_, h\u27e9\u27e9 with \u27e8\u27e8o, om\u27e9\u27e9\n have := Computation.mem_unique (Computation.mem_map _ om) h\n rcases o with - | o\n \u00b7 injection this\n injection this with i\n obtain \u27e8a', s'\u27e9 := o\n dsimp at i\n rw [i] at om\n exact \u27e8_, om\u27e9\u27e9\n```\n\n-- snippet 103\n```lean\n-- Mathlib.Data.WSeq.Basic.tail_think (L258-L259)\ntheorem tail_think (s : WSeq \u03b1) : tail (think s) = (tail s).think := by simp [tail]\n```\n\n-- snippet 104\n```lean\n-- Mathlib.Data.WSeq.Basic.ofStream (L56-L58)\ndef ofStream (l : Stream' \u03b1) : WSeq \u03b1 :=\nofSeq l\n```\n\n-- snippet 105\n```lean\n-- Mathlib.Data.WSeq.Basic.append (L148-L152)\ndef append : WSeq \u03b1 \u2192 WSeq \u03b1 \u2192 WSeq \u03b1 :=\nSeq.append\n\n/-- Flatten a sequence of weak sequences. (Note that this allows\n empty sequences, unlike `Seq.join`.) -/\n```\n[/INST]", "sample_id": "C-Mathlib.Data.WSeq.Relation.LiftRel", "source": {"declaration": "Mathlib.Data.WSeq.Relation.LiftRel", "file": "Mathlib/Data/WSeq/Relation.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Data.WSeq.Relation", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/WSeq/Relation.lean#L107", "span": "L107-L117"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Topology.Algebra.Support.mulTSupport (L49-L50)\ndef mulTSupport (f : X \u2192 \u03b1) : Set X := closure (mulSupport f)", "-- Mathlib.Topology.Algebra.Support.subset_mulTSupport (L52-L54)\ntheorem subset_mulTSupport (f : X \u2192 \u03b1) : mulSupport f \u2286 mulTSupport f :=\nsubset_closure", "-- Mathlib.Topology.Algebra.Support.mulTSupport_eq_empty_iff (L60-L62)\ntheorem mulTSupport_eq_empty_iff {f : X \u2192 \u03b1} : mulTSupport f = \u2205 \u2194 f = 1 := by\nrw [mulTSupport, closure_empty_iff, mulSupport_eq_empty_iff]", "-- Mathlib.Topology.Algebra.Support.mulTSupport_fun_one (L64-L66)\ntheorem mulTSupport_fun_one : mulTSupport (fun _ \u21a6 1 : X \u2192 \u03b1) = \u2205 := by\nrw [mulTSupport, mulSupport_fun_one, closure_empty]", "-- Mathlib.Topology.Algebra.Support.mulTSupport_one (L68-L70)\ntheorem mulTSupport_one : mulTSupport (1 : X \u2192 \u03b1) = \u2205 := by\nrw [mulTSupport, mulSupport_one, closure_empty]", "-- Mathlib.Topology.Algebra.Support.mulTSupport_binop_subset (L72-L76)\ntheorem mulTSupport_binop_subset [One \u03b2] [One \u03b3] (op : \u03b1 \u2192 \u03b2 \u2192 \u03b3)\n (op1 : op 1 1 = 1) (f : X \u2192 \u03b1) (g : X \u2192 \u03b2) :\n mulTSupport (fun x \u21a6 op (f x) (g x)) \u2286 mulTSupport f \u222a mulTSupport g :=\nclosure_mono (mulSupport_binop_subset op op1 f g) |>.trans closure_union.subset", "-- Mathlib.Topology.Algebra.Support.mulTSupport_comp_subset (L78-L81)\nlemma mulTSupport_comp_subset [One \u03b2] {g : \u03b1 \u2192 \u03b2} (hg : g 1 = 1) (f : X \u2192 \u03b1) :\n mulTSupport (g \u2218 f) \u2286 mulTSupport f :=\nclosure_mono (mulSupport_comp_subset hg f)", "-- Mathlib.Topology.Algebra.Support.mulTSupport_subset_comp (L83-L86)\nlemma mulTSupport_subset_comp [One \u03b2] {g : \u03b1 \u2192 \u03b2} (hg : \u2200 {x}, g x = 1 \u2192 x = 1) (f : X \u2192 \u03b1) :\n mulTSupport f \u2286 mulTSupport (g \u2218 f) :=\nclosure_mono (mulSupport_subset_comp hg f)", "-- Mathlib.Topology.Algebra.Support.mulTSupport_comp_eq (L88-L91)\nlemma mulTSupport_comp_eq [One \u03b2] {g : \u03b1 \u2192 \u03b2} (hg : \u2200 {x}, g x = 1 \u2194 x = 1) (f : X \u2192 \u03b1) :\n mulTSupport (g \u2218 f) = mulTSupport f := by\nrw [mulTSupport, mulTSupport, mulSupport_comp_eq g hg]", "-- Mathlib.Topology.Algebra.Support.mulTSupport_comp_eq_of_range_subset (L93-L97)\nlemma mulTSupport_comp_eq_of_range_subset [One \u03b2] {g : \u03b1 \u2192 \u03b2} {f : X \u2192 \u03b1}\n (hg : \u2200 {x}, x \u2208 range f \u2192 (g x = 1 \u2194 x = 1)) :\n mulTSupport (g \u2218 f) = mulTSupport f := by\nrw [mulTSupport, mulTSupport, mulSupport_comp_eq_of_range_subset hg]", "-- Mathlib.Topology.Algebra.Support.mulTSupport_comp_subset_preimage (L99-L104)\nlemma mulTSupport_comp_subset_preimage {Y : Type*} [TopologicalSpace Y] (g : Y \u2192 \u03b1) {f : X \u2192 Y}\n (hf : Continuous f) :\n mulTSupport (g \u2218 f) \u2286 f \u207b\u00b9' mulTSupport g := by\nrw [mulTSupport, mulTSupport, mulSupport_comp_eq_preimage]\n exact hf.closure_preimage_subset _", "-- Mathlib.Topology.Algebra.Support.mulTSupport_comp_eq_preimage (L106-L109)\nlemma mulTSupport_comp_eq_preimage {Y : Type*} [TopologicalSpace Y] (g : Y \u2192 \u03b1) (f : X \u2243\u209c Y) :\n mulTSupport (g \u2218 f) = f \u207b\u00b9' mulTSupport g := by\nrw [mulTSupport, mulTSupport, mulSupport_comp_eq_preimage, Homeomorph.preimage_closure]", "-- Mathlib.Topology.Algebra.Support.image_eq_one_of_notMem_mulTSupport (L111-L113)\ntheorem image_eq_one_of_notMem_mulTSupport {f : X \u2192 \u03b1} {x : X} (hx : x \u2209 mulTSupport f) : f x = 1 :=\nmulSupport_subset_iff'.mp (subset_mulTSupport f) x hx", "-- Mathlib.Topology.Algebra.Support.range_subset_insert_image_mulTSupport (L115-L118)\ntheorem range_subset_insert_image_mulTSupport (f : X \u2192 \u03b1) :\n range f \u2286 insert 1 (f '' mulTSupport f) := by\ngrw [\u2190 subset_mulTSupport f]; exact range_subset_insert_image_mulSupport f", "-- Mathlib.Topology.Algebra.Support.range_eq_image_mulTSupport_or (L120-L123)\ntheorem range_eq_image_mulTSupport_or (f : X \u2192 \u03b1) :\n range f = f '' mulTSupport f \u2228 range f = insert 1 (f '' mulTSupport f) :=\n(wcovBy_insert _ _).eq_or_eq (image_subset_range _ _) (range_subset_insert_image_mulTSupport f)", "-- Mathlib.Topology.Algebra.Algebra.Equiv.toAlgEquiv_injective (L106-L109)\ntheorem toAlgEquiv_injective : Function.Injective (toAlgEquiv : (A \u2243A[R] B) \u2192 A \u2243\u2090[R] B) := by\nrintro \u27e8e, _, _\u27e9 \u27e8e', _, _\u27e9 rfl\n rfl", "-- Mathlib.Topology.Algebra.Algebra.Equiv.coe (L78-L79)\ninstance coe : Coe (A \u2243A[R] B) (A \u2192A[R] B) := \u27e8toContinuousAlgHom\u27e9", "-- Mathlib.Topology.Algebra.Affine.lineMap_continuous (L66-L75)\ntheorem lineMap_continuous {p q : P} :\n Continuous (lineMap p q : R \u2192\u1d43[R] P) := by\nfun_prop\n\nopen Topology Filter\n\nsection Tendsto\n\nvariable {\u03b1 : Type*} {l : Filter \u03b1}", "-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_inj (L118-L120)\ntheorem coe_inj {f g : A \u2243A[R] B} : (f : A \u2192A[R] B) = g \u2194 f = g :=\ncoe_injective.eq_iff", "-- Mathlib.Topology.Algebra.Algebra.Equiv.equivLike (L80-L91)\ninstance equivLike : EquivLike (A \u2243A[R] B) A B where\n coe f := f.toFun\ninv f := f.invFun\n coe_injective' f g h\u2081 h\u2082 := by\n obtain \u27e8f', _\u27e9 := f\n obtain \u27e8g', _\u27e9 := g\n rcases f' with \u27e8\u27e8_, _\u27e9, _\u27e9\n rcases g' with \u27e8\u27e8_, _\u27e9, _\u27e9\n congr\n left_inv f := f.left_inv\n right_inv f := f.right_inv", "-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_injective (L114-L116)\ntheorem coe_injective : Function.Injective ((\u2191) : (A \u2243A[R] B) \u2192 A \u2192A[R] B) :=\nfun _ _ h => ext <| funext <| ContinuousAlgHom.ext_iff.1 h", "-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearEquiv_apply (L137-L139)\ntheorem toContinuousLinearEquiv_apply (e : A \u2243A[R] B) (a : A) :\n e.toContinuousLinearEquiv a = e a := rfl", "-- Mathlib.Topology.Algebra.Algebra.Equiv.isOpenMap (L148-L150)\ntheorem isOpenMap (e : A \u2243A[R] B) : IsOpenMap e :=\ne.toHomeomorph.isOpenMap", "-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousAlgHom (L74-L77)\ndef toContinuousAlgHom (e : A \u2243A[R] B) : A \u2192A[R] B where\n __ := e.toAlgHom\ncont := e.continuous_toFun", "-- Mathlib.Topology.Algebra.Algebra.Equiv.image_closure (L151-L153)\ntheorem image_closure (e : A \u2243A[R] B) (S : Set A) : e '' closure S = closure (e '' S) :=\ne.toHomeomorph.image_closure S", "-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_coe (L104-L105)\ntheorem coe_coe (e : A \u2243A[R] B) : \u21d1(e : A \u2192A[R] B) = e := rfl", "-- Mathlib.Topology.Algebra.AffineSubspace.isClosed_direction_iff (L54-L61)\ntheorem isClosed_direction_iff [T1Space V] (s : AffineSubspace R P) :\n IsClosed (s.direction : Set V) \u2194 IsClosed (s : Set P) := by\nrcases s.eq_bot_or_nonempty with (rfl | \u27e8x, hx\u27e9); \u00b7 simp\n rw [\u2190 (Homeomorph.vaddConst x).symm.isClosed_image,\n AffineSubspace.coe_direction_eq_vsub_set_right hx]\n simp only [Homeomorph.vaddConst_symm_apply]\n\nend AffineSubspace", "-- Mathlib.Topology.Algebra.Affine.continuous_linear_iff (L35-L45)\ntheorem continuous_linear_iff {f : P \u2192\u1d43[R] Q} : Continuous f.linear \u2194 Continuous f := by\ninhabit P\n have :\n (f.linear : V \u2192 W) =\n (Homeomorph.vaddConst <| f default).symm \u2218 f \u2218 (Homeomorph.vaddConst default) := by\n ext v\n simp\n rw [this]\n simp only [Homeomorph.comp_continuous_iff, Homeomorph.comp_continuous_iff']\n\n/-- If `f` is an affine map, then its linear part is an open map iff `f` is an open map. -/", "-- Mathlib.Topology.Algebra.AffineSubspace.subtypeA (L33-L36)\ndef subtypeA (s : AffineSubspace R P) [Nonempty s] : s \u2192\u1d2c[R] P where\n toAffineMap := s.subtype\ncont := continuous_subtype_val", "-- Mathlib.Topology.Algebra.Algebra.Equiv.continuousAlgEquivClass (L92-L98)\ninstance continuousAlgEquivClass : ContinuousAlgEquivClass (A \u2243A[R] B) R A B where\n map_add f := f.map_add'\nmap_mul f := f.map_mul'\n commutes f := f.commutes'\n map_continuous := continuous_toFun\n inv_continuous := continuous_invFun", "-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_apply (L99-L100)\ntheorem coe_apply (e : A \u2243A[R] B) (a : A) : (e : A \u2192A[R] B) a = e a := rfl", "-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearEquiv_toLinearEquiv_eq (L144-L147)\ntheorem toContinuousLinearEquiv_toLinearEquiv_eq (e : A \u2243A[R] B) :\n e.toContinuousLinearEquiv.toLinearEquiv\n = e.toAlgEquiv.toLinearEquiv := rfl", "-- Mathlib.Topology.Algebra.Affine.homothety_isOpenMap (L146-L152)\ntheorem homothety_isOpenMap (x : P) (t : R) (ht : t \u2260 0) : IsOpenMap <| homothety x t := by\napply IsOpenMap.of_inverse (homothety_continuous x t\u207b\u00b9) <;> intro e <;>\n simp [\u2190 AffineMap.comp_apply, \u2190 homothety_mul, ht]\n\nend Field\n\nend AffineMap", "-- Mathlib.Topology.Algebra.Affine.homothety_continuous (L118-L125)\ntheorem homothety_continuous (x : P) (t : R) : Continuous <| homothety x t := by\nrw [coe_homothety]\n fun_prop\n\nvariable (R) [TopologicalSpace R] [Module R W] [ContinuousSMul R W] (x : Q) {s : Set Q}\n\nopen Topology", "-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_toAlgEquiv (L122-L125)\ntheorem coe_toAlgEquiv (e : A \u2243A[R] B) : \u21d1e.toAlgEquiv = e := rfl\n/-- The natural coercion from a continuous algebra isomorphism\nto a continuous linear isomorphism. -/", "-- Mathlib.Topology.Algebra.Affine.lineMap_continuous_uncurry (L60-L65)\ntheorem lineMap_continuous_uncurry :\n Continuous (fun pqt : P \u00d7 P \u00d7 R \u21a6 lineMap pqt.1 pqt.2.1 pqt.2.2) := by\nsimp only [coe_lineMap]\n fun_prop\n\n/-- The line map is continuous. -/", "-- Mathlib.Topology.Algebra.Algebra.Equiv.ext (L111-L113)\ntheorem ext {f g : A \u2243A[R] B} (h : \u21d1f = \u21d1g) : f = g :=\ntoAlgEquiv_injective <| AlgEquiv.ext <| congr_fun h", "-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearMap_toContinuousLinearEquiv_eq (L140-L143)\ntheorem toContinuousLinearMap_toContinuousLinearEquiv_eq (e : A \u2243A[R] B) :\n e.toContinuousLinearEquiv.toContinuousLinearMap\n = e.toContinuousAlgHom.toContinuousLinearMap := rfl", "-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearEquiv (L127-L129)\ndef toContinuousLinearEquiv (e : A \u2243A[R] B) : A \u2243L[R] B :=\n{ e with __ := e.toLinearEquiv }", "-- Mathlib.Topology.Algebra.Affine.isOpenMap_linear_iff (L46-L58)\ntheorem isOpenMap_linear_iff {f : P \u2192\u1d43[R] Q} : IsOpenMap f.linear \u2194 IsOpenMap f := by\ninhabit P\n have :\n (f.linear : V \u2192 W) =\n (Homeomorph.vaddConst <| f default).symm \u2218 f \u2218 (Homeomorph.vaddConst default) := by\n ext v\n simp\n rw [this]\n simp only [Homeomorph.comp_isOpenMap_iff, Homeomorph.comp_isOpenMap_iff']\n\nvariable [TopologicalSpace R] [ContinuousSMul R V]\n\n/-- The line map is continuous in all arguments. -/"], "statement": "theorem isClosed_mulTSupport (f : X \u2192 \u03b1) : IsClosed (mulTSupport f)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 11421, "declarations_count": 1093, "diagnostics_count": 0, "duplicate_fingerprint": "95fdbe095fb65fff", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 4235, "lean_code_chars": 9920, "lean_code_ratio": 0.8686, "length_bucket": "medium", "line_count": 362, "natural_language_chars": 1501, "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.Topology.Algebra.Support).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem isClosed_mulTSupport (f : X \u2192 \u03b1) : IsClosed (mulTSupport f)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.Algebra.Support.mulTSupport (L49-L50)\ndef mulTSupport (f : X \u2192 \u03b1) : Set X := closure (mulSupport f)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.Algebra.Support.subset_mulTSupport (L52-L54)\ntheorem subset_mulTSupport (f : X \u2192 \u03b1) : mulSupport f \u2286 mulTSupport f :=\nsubset_closure\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.Algebra.Support.mulTSupport_eq_empty_iff (L60-L62)\ntheorem mulTSupport_eq_empty_iff {f : X \u2192 \u03b1} : mulTSupport f = \u2205 \u2194 f = 1 := by\nrw [mulTSupport, closure_empty_iff, mulSupport_eq_empty_iff]\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.Algebra.Support.mulTSupport_fun_one (L64-L66)\ntheorem mulTSupport_fun_one : mulTSupport (fun _ \u21a6 1 : X \u2192 \u03b1) = \u2205 := by\nrw [mulTSupport, mulSupport_fun_one, closure_empty]\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Topology.Algebra.Support.mulTSupport_one (L68-L70)\ntheorem mulTSupport_one : mulTSupport (1 : X \u2192 \u03b1) = \u2205 := by\nrw [mulTSupport, mulSupport_one, closure_empty]\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Topology.Algebra.Support.mulTSupport_binop_subset (L72-L76)\ntheorem mulTSupport_binop_subset [One \u03b2] [One \u03b3] (op : \u03b1 \u2192 \u03b2 \u2192 \u03b3)\n (op1 : op 1 1 = 1) (f : X \u2192 \u03b1) (g : X \u2192 \u03b2) :\n mulTSupport (fun x \u21a6 op (f x) (g x)) \u2286 mulTSupport f \u222a mulTSupport g :=\nclosure_mono (mulSupport_binop_subset op op1 f g) |>.trans closure_union.subset\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Topology.Algebra.Support.mulTSupport_comp_subset (L78-L81)\nlemma mulTSupport_comp_subset [One \u03b2] {g : \u03b1 \u2192 \u03b2} (hg : g 1 = 1) (f : X \u2192 \u03b1) :\n mulTSupport (g \u2218 f) \u2286 mulTSupport f :=\nclosure_mono (mulSupport_comp_subset hg f)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Topology.Algebra.Support.mulTSupport_subset_comp (L83-L86)\nlemma mulTSupport_subset_comp [One \u03b2] {g : \u03b1 \u2192 \u03b2} (hg : \u2200 {x}, g x = 1 \u2192 x = 1) (f : X \u2192 \u03b1) :\n mulTSupport f \u2286 mulTSupport (g \u2218 f) :=\nclosure_mono (mulSupport_subset_comp hg f)\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Topology.Algebra.Support.mulTSupport_comp_eq (L88-L91)\nlemma mulTSupport_comp_eq [One \u03b2] {g : \u03b1 \u2192 \u03b2} (hg : \u2200 {x}, g x = 1 \u2194 x = 1) (f : X \u2192 \u03b1) :\n mulTSupport (g \u2218 f) = mulTSupport f := by\nrw [mulTSupport, mulTSupport, mulSupport_comp_eq g hg]\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Topology.Algebra.Support.mulTSupport_comp_eq_of_range_subset (L93-L97)\nlemma mulTSupport_comp_eq_of_range_subset [One \u03b2] {g : \u03b1 \u2192 \u03b2} {f : X \u2192 \u03b1}\n (hg : \u2200 {x}, x \u2208 range f \u2192 (g x = 1 \u2194 x = 1)) :\n mulTSupport (g \u2218 f) = mulTSupport f := by\nrw [mulTSupport, mulTSupport, mulSupport_comp_eq_of_range_subset hg]\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Topology.Algebra.Support.mulTSupport_comp_subset_preimage (L99-L104)\nlemma mulTSupport_comp_subset_preimage {Y : Type*} [TopologicalSpace Y] (g : Y \u2192 \u03b1) {f : X \u2192 Y}\n (hf : Continuous f) :\n mulTSupport (g \u2218 f) \u2286 f \u207b\u00b9' mulTSupport g := by\nrw [mulTSupport, mulTSupport, mulSupport_comp_eq_preimage]\n exact hf.closure_preimage_subset _\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Topology.Algebra.Support.mulTSupport_comp_eq_preimage (L106-L109)\nlemma mulTSupport_comp_eq_preimage {Y : Type*} [TopologicalSpace Y] (g : Y \u2192 \u03b1) (f : X \u2243\u209c Y) :\n mulTSupport (g \u2218 f) = f \u207b\u00b9' mulTSupport g := by\nrw [mulTSupport, mulTSupport, mulSupport_comp_eq_preimage, Homeomorph.preimage_closure]\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Topology.Algebra.Support.image_eq_one_of_notMem_mulTSupport (L111-L113)\ntheorem image_eq_one_of_notMem_mulTSupport {f : X \u2192 \u03b1} {x : X} (hx : x \u2209 mulTSupport f) : f x = 1 :=\nmulSupport_subset_iff'.mp (subset_mulTSupport f) x hx\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Topology.Algebra.Support.range_subset_insert_image_mulTSupport (L115-L118)\ntheorem range_subset_insert_image_mulTSupport (f : X \u2192 \u03b1) :\n range f \u2286 insert 1 (f '' mulTSupport f) := by\ngrw [\u2190 subset_mulTSupport f]; exact range_subset_insert_image_mulSupport f\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Topology.Algebra.Support.range_eq_image_mulTSupport_or (L120-L123)\ntheorem range_eq_image_mulTSupport_or (f : X \u2192 \u03b1) :\n range f = f '' mulTSupport f \u2228 range f = insert 1 (f '' mulTSupport f) :=\n(wcovBy_insert _ _).eq_or_eq (image_subset_range _ _) (range_subset_insert_image_mulTSupport f)\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toAlgEquiv_injective (L106-L109)\ntheorem toAlgEquiv_injective : Function.Injective (toAlgEquiv : (A \u2243A[R] B) \u2192 A \u2243\u2090[R] B) := by\nrintro \u27e8e, _, _\u27e9 \u27e8e', _, _\u27e9 rfl\n rfl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe (L78-L79)\ninstance coe : Coe (A \u2243A[R] B) (A \u2192A[R] B) := \u27e8toContinuousAlgHom\u27e9\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Topology.Algebra.Affine.lineMap_continuous (L66-L75)\ntheorem lineMap_continuous {p q : P} :\n Continuous (lineMap p q : R \u2192\u1d43[R] P) := by\nfun_prop\n\nopen Topology Filter\n\nsection Tendsto\n\nvariable {\u03b1 : Type*} {l : Filter \u03b1}\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_inj (L118-L120)\ntheorem coe_inj {f g : A \u2243A[R] B} : (f : A \u2192A[R] B) = g \u2194 f = g :=\ncoe_injective.eq_iff\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.equivLike (L80-L91)\ninstance equivLike : EquivLike (A \u2243A[R] B) A B where\n coe f := f.toFun\ninv f := f.invFun\n coe_injective' f g h\u2081 h\u2082 := by\n obtain \u27e8f', _\u27e9 := f\n obtain \u27e8g', _\u27e9 := g\n rcases f' with \u27e8\u27e8_, _\u27e9, _\u27e9\n rcases g' with \u27e8\u27e8_, _\u27e9, _\u27e9\n congr\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_injective (L114-L116)\ntheorem coe_injective : Function.Injective ((\u2191) : (A \u2243A[R] B) \u2192 A \u2192A[R] B) :=\nfun _ _ h => ext <| funext <| ContinuousAlgHom.ext_iff.1 h\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearEquiv_apply (L137-L139)\ntheorem toContinuousLinearEquiv_apply (e : A \u2243A[R] B) (a : A) :\n e.toContinuousLinearEquiv a = e a := rfl\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.isOpenMap (L148-L150)\ntheorem isOpenMap (e : A \u2243A[R] B) : IsOpenMap e :=\ne.toHomeomorph.isOpenMap\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousAlgHom (L74-L77)\ndef toContinuousAlgHom (e : A \u2243A[R] B) : A \u2192A[R] B where\n __ := e.toAlgHom\ncont := e.continuous_toFun\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.image_closure (L151-L153)\ntheorem image_closure (e : A \u2243A[R] B) (S : Set A) : e '' closure S = closure (e '' S) :=\ne.toHomeomorph.image_closure S\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_coe (L104-L105)\ntheorem coe_coe (e : A \u2243A[R] B) : \u21d1(e : A \u2192A[R] B) = e := rfl\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Topology.Algebra.AffineSubspace.isClosed_direction_iff (L54-L61)\ntheorem isClosed_direction_iff [T1Space V] (s : AffineSubspace R P) :\n IsClosed (s.direction : Set V) \u2194 IsClosed (s : Set P) := by\nrcases s.eq_bot_or_nonempty with (rfl | \u27e8x, hx\u27e9); \u00b7 simp\n rw [\u2190 (Homeomorph.vaddConst x).symm.isClosed_image,\n AffineSubspace.coe_direction_eq_vsub_set_right hx]\n simp only [Homeomorph.vaddConst_symm_apply]\n\nend AffineSubspace\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Topology.Algebra.Affine.continuous_linear_iff (L35-L45)\ntheorem continuous_linear_iff {f : P \u2192\u1d43[R] Q} : Continuous f.linear \u2194 Continuous f := by\ninhabit P\n have :\n (f.linear : V \u2192 W) =\n (Homeomorph.vaddConst <| f default).symm \u2218 f \u2218 (Homeomorph.vaddConst default) := by\n ext v\n simp\n rw [this]\n simp only [Homeomorph.comp_continuous_iff, Homeomorph.comp_continuous_iff']\n\n/-- If `f` is an affine map, then its linear part is an open map iff `f` is an open map. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Topology.Algebra.AffineSubspace.subtypeA (L33-L36)\ndef subtypeA (s : AffineSubspace R P) [Nonempty s] : s \u2192\u1d2c[R] P where\n toAffineMap := s.subtype\ncont := continuous_subtype_val\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.continuousAlgEquivClass (L92-L98)\ninstance continuousAlgEquivClass : ContinuousAlgEquivClass (A \u2243A[R] B) R A B where\n map_add f := f.map_add'\nmap_mul f := f.map_mul'\n commutes f := f.commutes'\n map_continuous := continuous_toFun\n inv_continuous := continuous_invFun\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_apply (L99-L100)\ntheorem coe_apply (e : A \u2243A[R] B) (a : A) : (e : A \u2192A[R] B) a = e a := rfl\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearEquiv_toLinearEquiv_eq (L144-L147)\ntheorem toContinuousLinearEquiv_toLinearEquiv_eq (e : A \u2243A[R] B) :\n e.toContinuousLinearEquiv.toLinearEquiv\n = e.toAlgEquiv.toLinearEquiv := rfl\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Topology.Algebra.Affine.homothety_isOpenMap (L146-L152)\ntheorem homothety_isOpenMap (x : P) (t : R) (ht : t \u2260 0) : IsOpenMap <| homothety x t := by\napply IsOpenMap.of_inverse (homothety_continuous x t\u207b\u00b9) <;> intro e <;>\n simp [\u2190 AffineMap.comp_apply, \u2190 homothety_mul, ht]\n\nend Field\n\nend AffineMap\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Topology.Algebra.Affine.homothety_continuous (L118-L125)\ntheorem homothety_continuous (x : P) (t : R) : Continuous <| homothety x t := by\nrw [coe_homothety]\n fun_prop\n\nvariable (R) [TopologicalSpace R] [Module R W] [ContinuousSMul R W] (x : Q) {s : Set Q}\n\nopen Topology\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_toAlgEquiv (L122-L125)\ntheorem coe_toAlgEquiv (e : A \u2243A[R] B) : \u21d1e.toAlgEquiv = e := rfl\n/-- The natural coercion from a continuous algebra isomorphism\nto a continuous linear isomorphism. -/\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Topology.Algebra.Affine.lineMap_continuous_uncurry (L60-L65)\ntheorem lineMap_continuous_uncurry :\n Continuous (fun pqt : P \u00d7 P \u00d7 R \u21a6 lineMap pqt.1 pqt.2.1 pqt.2.2) := by\nsimp only [coe_lineMap]\n fun_prop\n\n/-- The line map is continuous. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.ext (L111-L113)\ntheorem ext {f g : A \u2243A[R] B} (h : \u21d1f = \u21d1g) : f = g :=\ntoAlgEquiv_injective <| AlgEquiv.ext <| congr_fun h\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearMap_toContinuousLinearEquiv_eq (L140-L143)\ntheorem toContinuousLinearMap_toContinuousLinearEquiv_eq (e : A \u2243A[R] B) :\n e.toContinuousLinearEquiv.toContinuousLinearMap\n = e.toContinuousAlgHom.toContinuousLinearMap := rfl\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearEquiv (L127-L129)\ndef toContinuousLinearEquiv (e : A \u2243A[R] B) : A \u2243L[R] B :=\n{ e with __ := e.toLinearEquiv }\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Topology.Algebra.Affine.isOpenMap_linear_iff (L46-L58)\ntheorem isOpenMap_linear_iff {f : P \u2192\u1d43[R] Q} : IsOpenMap f.linear \u2194 IsOpenMap f := by\ninhabit P\n have :\n (f.linear : V \u2192 W) =\n (Homeomorph.vaddConst <| f default).symm \u2218 f \u2218 (Homeomorph.vaddConst default) := by\n ext v\n simp\n rw [this]\n simp only [Homeomorph.comp_isOpenMap_iff, Homeomorph.comp_isOpenMap_iff']\n\nvariable [TopologicalSpace R] [ContinuousSMul R V]\n\n/-- The line map is continuous in all arguments. -/\n```\n", "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.Topology.Algebra.Support).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem isClosed_mulTSupport (f : X \u2192 \u03b1) : IsClosed (mulTSupport f)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Topology.Algebra.Support.mulTSupport (L49-L50)\ndef mulTSupport (f : X \u2192 \u03b1) : Set X := closure (mulSupport f)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Topology.Algebra.Support.subset_mulTSupport (L52-L54)\ntheorem subset_mulTSupport (f : X \u2192 \u03b1) : mulSupport f \u2286 mulTSupport f :=\nsubset_closure\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Topology.Algebra.Support.mulTSupport_eq_empty_iff (L60-L62)\ntheorem mulTSupport_eq_empty_iff {f : X \u2192 \u03b1} : mulTSupport f = \u2205 \u2194 f = 1 := by\nrw [mulTSupport, closure_empty_iff, mulSupport_eq_empty_iff]\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Topology.Algebra.Support.mulTSupport_fun_one (L64-L66)\ntheorem mulTSupport_fun_one : mulTSupport (fun _ \u21a6 1 : X \u2192 \u03b1) = \u2205 := by\nrw [mulTSupport, mulSupport_fun_one, closure_empty]\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Topology.Algebra.Support.mulTSupport_one (L68-L70)\ntheorem mulTSupport_one : mulTSupport (1 : X \u2192 \u03b1) = \u2205 := by\nrw [mulTSupport, mulSupport_one, closure_empty]\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Topology.Algebra.Support.mulTSupport_binop_subset (L72-L76)\ntheorem mulTSupport_binop_subset [One \u03b2] [One \u03b3] (op : \u03b1 \u2192 \u03b2 \u2192 \u03b3)\n (op1 : op 1 1 = 1) (f : X \u2192 \u03b1) (g : X \u2192 \u03b2) :\n mulTSupport (fun x \u21a6 op (f x) (g x)) \u2286 mulTSupport f \u222a mulTSupport g :=\nclosure_mono (mulSupport_binop_subset op op1 f g) |>.trans closure_union.subset\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Topology.Algebra.Support.mulTSupport_comp_subset (L78-L81)\nlemma mulTSupport_comp_subset [One \u03b2] {g : \u03b1 \u2192 \u03b2} (hg : g 1 = 1) (f : X \u2192 \u03b1) :\n mulTSupport (g \u2218 f) \u2286 mulTSupport f :=\nclosure_mono (mulSupport_comp_subset hg f)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Topology.Algebra.Support.mulTSupport_subset_comp (L83-L86)\nlemma mulTSupport_subset_comp [One \u03b2] {g : \u03b1 \u2192 \u03b2} (hg : \u2200 {x}, g x = 1 \u2192 x = 1) (f : X \u2192 \u03b1) :\n mulTSupport f \u2286 mulTSupport (g \u2218 f) :=\nclosure_mono (mulSupport_subset_comp hg f)\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Topology.Algebra.Support.mulTSupport_comp_eq (L88-L91)\nlemma mulTSupport_comp_eq [One \u03b2] {g : \u03b1 \u2192 \u03b2} (hg : \u2200 {x}, g x = 1 \u2194 x = 1) (f : X \u2192 \u03b1) :\n mulTSupport (g \u2218 f) = mulTSupport f := by\nrw [mulTSupport, mulTSupport, mulSupport_comp_eq g hg]\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Topology.Algebra.Support.mulTSupport_comp_eq_of_range_subset (L93-L97)\nlemma mulTSupport_comp_eq_of_range_subset [One \u03b2] {g : \u03b1 \u2192 \u03b2} {f : X \u2192 \u03b1}\n (hg : \u2200 {x}, x \u2208 range f \u2192 (g x = 1 \u2194 x = 1)) :\n mulTSupport (g \u2218 f) = mulTSupport f := by\nrw [mulTSupport, mulTSupport, mulSupport_comp_eq_of_range_subset hg]\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Topology.Algebra.Support.mulTSupport_comp_subset_preimage (L99-L104)\nlemma mulTSupport_comp_subset_preimage {Y : Type*} [TopologicalSpace Y] (g : Y \u2192 \u03b1) {f : X \u2192 Y}\n (hf : Continuous f) :\n mulTSupport (g \u2218 f) \u2286 f \u207b\u00b9' mulTSupport g := by\nrw [mulTSupport, mulTSupport, mulSupport_comp_eq_preimage]\n exact hf.closure_preimage_subset _\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Topology.Algebra.Support.mulTSupport_comp_eq_preimage (L106-L109)\nlemma mulTSupport_comp_eq_preimage {Y : Type*} [TopologicalSpace Y] (g : Y \u2192 \u03b1) (f : X \u2243\u209c Y) :\n mulTSupport (g \u2218 f) = f \u207b\u00b9' mulTSupport g := by\nrw [mulTSupport, mulTSupport, mulSupport_comp_eq_preimage, Homeomorph.preimage_closure]\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Topology.Algebra.Support.image_eq_one_of_notMem_mulTSupport (L111-L113)\ntheorem image_eq_one_of_notMem_mulTSupport {f : X \u2192 \u03b1} {x : X} (hx : x \u2209 mulTSupport f) : f x = 1 :=\nmulSupport_subset_iff'.mp (subset_mulTSupport f) x hx\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Topology.Algebra.Support.range_subset_insert_image_mulTSupport (L115-L118)\ntheorem range_subset_insert_image_mulTSupport (f : X \u2192 \u03b1) :\n range f \u2286 insert 1 (f '' mulTSupport f) := by\ngrw [\u2190 subset_mulTSupport f]; exact range_subset_insert_image_mulSupport f\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Topology.Algebra.Support.range_eq_image_mulTSupport_or (L120-L123)\ntheorem range_eq_image_mulTSupport_or (f : X \u2192 \u03b1) :\n range f = f '' mulTSupport f \u2228 range f = insert 1 (f '' mulTSupport f) :=\n(wcovBy_insert _ _).eq_or_eq (image_subset_range _ _) (range_subset_insert_image_mulTSupport f)\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toAlgEquiv_injective (L106-L109)\ntheorem toAlgEquiv_injective : Function.Injective (toAlgEquiv : (A \u2243A[R] B) \u2192 A \u2243\u2090[R] B) := by\nrintro \u27e8e, _, _\u27e9 \u27e8e', _, _\u27e9 rfl\n rfl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe (L78-L79)\ninstance coe : Coe (A \u2243A[R] B) (A \u2192A[R] B) := \u27e8toContinuousAlgHom\u27e9\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Topology.Algebra.Affine.lineMap_continuous (L66-L75)\ntheorem lineMap_continuous {p q : P} :\n Continuous (lineMap p q : R \u2192\u1d43[R] P) := by\nfun_prop\n\nopen Topology Filter\n\nsection Tendsto\n\nvariable {\u03b1 : Type*} {l : Filter \u03b1}\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_inj (L118-L120)\ntheorem coe_inj {f g : A \u2243A[R] B} : (f : A \u2192A[R] B) = g \u2194 f = g :=\ncoe_injective.eq_iff\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.equivLike (L80-L91)\ninstance equivLike : EquivLike (A \u2243A[R] B) A B where\n coe f := f.toFun\ninv f := f.invFun\n coe_injective' f g h\u2081 h\u2082 := by\n obtain \u27e8f', _\u27e9 := f\n obtain \u27e8g', _\u27e9 := g\n rcases f' with \u27e8\u27e8_, _\u27e9, _\u27e9\n rcases g' with \u27e8\u27e8_, _\u27e9, _\u27e9\n congr\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_injective (L114-L116)\ntheorem coe_injective : Function.Injective ((\u2191) : (A \u2243A[R] B) \u2192 A \u2192A[R] B) :=\nfun _ _ h => ext <| funext <| ContinuousAlgHom.ext_iff.1 h\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearEquiv_apply (L137-L139)\ntheorem toContinuousLinearEquiv_apply (e : A \u2243A[R] B) (a : A) :\n e.toContinuousLinearEquiv a = e a := rfl\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.isOpenMap (L148-L150)\ntheorem isOpenMap (e : A \u2243A[R] B) : IsOpenMap e :=\ne.toHomeomorph.isOpenMap\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousAlgHom (L74-L77)\ndef toContinuousAlgHom (e : A \u2243A[R] B) : A \u2192A[R] B where\n __ := e.toAlgHom\ncont := e.continuous_toFun\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.image_closure (L151-L153)\ntheorem image_closure (e : A \u2243A[R] B) (S : Set A) : e '' closure S = closure (e '' S) :=\ne.toHomeomorph.image_closure S\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_coe (L104-L105)\ntheorem coe_coe (e : A \u2243A[R] B) : \u21d1(e : A \u2192A[R] B) = e := rfl\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Topology.Algebra.AffineSubspace.isClosed_direction_iff (L54-L61)\ntheorem isClosed_direction_iff [T1Space V] (s : AffineSubspace R P) :\n IsClosed (s.direction : Set V) \u2194 IsClosed (s : Set P) := by\nrcases s.eq_bot_or_nonempty with (rfl | \u27e8x, hx\u27e9); \u00b7 simp\n rw [\u2190 (Homeomorph.vaddConst x).symm.isClosed_image,\n AffineSubspace.coe_direction_eq_vsub_set_right hx]\n simp only [Homeomorph.vaddConst_symm_apply]\n\nend AffineSubspace\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Topology.Algebra.Affine.continuous_linear_iff (L35-L45)\ntheorem continuous_linear_iff {f : P \u2192\u1d43[R] Q} : Continuous f.linear \u2194 Continuous f := by\ninhabit P\n have :\n (f.linear : V \u2192 W) =\n (Homeomorph.vaddConst <| f default).symm \u2218 f \u2218 (Homeomorph.vaddConst default) := by\n ext v\n simp\n rw [this]\n simp only [Homeomorph.comp_continuous_iff, Homeomorph.comp_continuous_iff']\n\n/-- If `f` is an affine map, then its linear part is an open map iff `f` is an open map. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Topology.Algebra.AffineSubspace.subtypeA (L33-L36)\ndef subtypeA (s : AffineSubspace R P) [Nonempty s] : s \u2192\u1d2c[R] P where\n toAffineMap := s.subtype\ncont := continuous_subtype_val\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.continuousAlgEquivClass (L92-L98)\ninstance continuousAlgEquivClass : ContinuousAlgEquivClass (A \u2243A[R] B) R A B where\n map_add f := f.map_add'\nmap_mul f := f.map_mul'\n commutes f := f.commutes'\n map_continuous := continuous_toFun\n inv_continuous := continuous_invFun\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_apply (L99-L100)\ntheorem coe_apply (e : A \u2243A[R] B) (a : A) : (e : A \u2192A[R] B) a = e a := rfl\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearEquiv_toLinearEquiv_eq (L144-L147)\ntheorem toContinuousLinearEquiv_toLinearEquiv_eq (e : A \u2243A[R] B) :\n e.toContinuousLinearEquiv.toLinearEquiv\n = e.toAlgEquiv.toLinearEquiv := rfl\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Topology.Algebra.Affine.homothety_isOpenMap (L146-L152)\ntheorem homothety_isOpenMap (x : P) (t : R) (ht : t \u2260 0) : IsOpenMap <| homothety x t := by\napply IsOpenMap.of_inverse (homothety_continuous x t\u207b\u00b9) <;> intro e <;>\n simp [\u2190 AffineMap.comp_apply, \u2190 homothety_mul, ht]\n\nend Field\n\nend AffineMap\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Topology.Algebra.Affine.homothety_continuous (L118-L125)\ntheorem homothety_continuous (x : P) (t : R) : Continuous <| homothety x t := by\nrw [coe_homothety]\n fun_prop\n\nvariable (R) [TopologicalSpace R] [Module R W] [ContinuousSMul R W] (x : Q) {s : Set Q}\n\nopen Topology\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.coe_toAlgEquiv (L122-L125)\ntheorem coe_toAlgEquiv (e : A \u2243A[R] B) : \u21d1e.toAlgEquiv = e := rfl\n/-- The natural coercion from a continuous algebra isomorphism\nto a continuous linear isomorphism. -/\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Topology.Algebra.Affine.lineMap_continuous_uncurry (L60-L65)\ntheorem lineMap_continuous_uncurry :\n Continuous (fun pqt : P \u00d7 P \u00d7 R \u21a6 lineMap pqt.1 pqt.2.1 pqt.2.2) := by\nsimp only [coe_lineMap]\n fun_prop\n\n/-- The line map is continuous. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.ext (L111-L113)\ntheorem ext {f g : A \u2243A[R] B} (h : \u21d1f = \u21d1g) : f = g :=\ntoAlgEquiv_injective <| AlgEquiv.ext <| congr_fun h\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearMap_toContinuousLinearEquiv_eq (L140-L143)\ntheorem toContinuousLinearMap_toContinuousLinearEquiv_eq (e : A \u2243A[R] B) :\n e.toContinuousLinearEquiv.toContinuousLinearMap\n = e.toContinuousAlgHom.toContinuousLinearMap := rfl\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Topology.Algebra.Algebra.Equiv.toContinuousLinearEquiv (L127-L129)\ndef toContinuousLinearEquiv (e : A \u2243A[R] B) : A \u2243L[R] B :=\n{ e with __ := e.toLinearEquiv }\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Topology.Algebra.Affine.isOpenMap_linear_iff (L46-L58)\ntheorem isOpenMap_linear_iff {f : P \u2192\u1d43[R] Q} : IsOpenMap f.linear \u2194 IsOpenMap f := by\ninhabit P\n have :\n (f.linear : V \u2192 W) =\n (Homeomorph.vaddConst <| f default).symm \u2218 f \u2218 (Homeomorph.vaddConst default) := by\n ext v\n simp\n rw [this]\n simp only [Homeomorph.comp_isOpenMap_iff, Homeomorph.comp_isOpenMap_iff']\n\nvariable [TopologicalSpace R] [ContinuousSMul R V]\n\n/-- The line map is continuous in all arguments. -/\n```\n[/INST]", "sample_id": "C-Mathlib.Topology.Algebra.Support.isClosed_mulTSupport", "source": {"declaration": "Mathlib.Topology.Algebra.Support.isClosed_mulTSupport", "file": "Mathlib/Topology/Algebra/Support.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Topology.Algebra.Support", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Algebra/Support.lean#L56", "span": "L56-L58"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\nlemma ofLp_bijective : Function.Bijective (@ofLp p V) := \u27e8ofLp_injective p, ofLp_surjective p\u27e9\n```", "instruction": "Edit `ofLp_bijective` so it still compiles and the proof is simplified where possible. Return the full updated `ofLp_bijective` block.", "proof_is_oneliner": false, "target_span": "L116-L118", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 810, "declarations_count": 86, "diagnostics_count": 0, "duplicate_fingerprint": "01b9817d11dd36a4", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 277, "lean_code_chars": 95, "lean_code_ratio": 0.1173, "length_bucket": "tiny", "line_count": 10, "natural_language_chars": 715, "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.Analysis.Normed.Lp.WithLp).", "role": "system"}, {"content": "You are editing a file in `Mathlib/Analysis/Normed/Lp/WithLp.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Analysis.Normed.Lp.WithLp.ofLp_bijective`, L116-L118)\n```lean\nlemma ofLp_bijective : Function.Bijective (@ofLp p V) := \u27e8ofLp_injective p, ofLp_surjective p\u27e9\n```\n\n## Edit instruction\nEdit `ofLp_bijective` so it still compiles and the proof is simplified where possible. Return the full updated `ofLp_bijective` 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.Analysis.Normed.Lp.WithLp).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Analysis/Normed/Lp/WithLp.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Analysis.Normed.Lp.WithLp.ofLp_bijective`, L116-L118)\n```lean\nlemma ofLp_bijective : Function.Bijective (@ofLp p V) := \u27e8ofLp_injective p, ofLp_surjective p\u27e9\n```\n\n## Edit instruction\nEdit `ofLp_bijective` so it still compiles and the proof is simplified where possible. Return the full updated `ofLp_bijective` block.\n[/INST]", "sample_id": "D-Mathlib.Analysis.Normed.Lp.WithLp.ofLp_bijective", "source": {"declaration": "Mathlib.Analysis.Normed.Lp.WithLp.ofLp_bijective", "file": "Mathlib/Analysis/Normed/Lp/WithLp.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Analysis.Normed.Lp.WithLp", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Normed/Lp/WithLp.lean#L116", "span": "L116-L118"}} {"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 adjoin (s : Set A) : NonUnitalSubalgebra R A", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 573, "declarations_count": 54, "diagnostics_count": 0, "duplicate_fingerprint": "b8630195b394eedd", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 164, "lean_code_chars": 49, "lean_code_ratio": 0.0855, "length_bucket": "tiny", "line_count": 7, "natural_language_chars": 524, "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.Algebra.Algebra.NonUnitalSubalgebra).", "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 adjoin (s : Set A) : NonUnitalSubalgebra R A\n```\n\nDeclaration: `Mathlib.Algebra.Algebra.NonUnitalSubalgebra.adjoin` (module Mathlib.Algebra.Algebra.NonUnitalSubalgebra).", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Algebra.NonUnitalSubalgebra).[/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 adjoin (s : Set A) : NonUnitalSubalgebra R A\n```\n\nDeclaration: `Mathlib.Algebra.Algebra.NonUnitalSubalgebra.adjoin` (module Mathlib.Algebra.Algebra.NonUnitalSubalgebra).[/INST]", "sample_id": "F-Mathlib.Algebra.Algebra.NonUnitalSubalgebra.adjoin", "source": {"declaration": "Mathlib.Algebra.Algebra.NonUnitalSubalgebra.adjoin", "file": "Mathlib/Algebra/Algebra/NonUnitalSubalgebra.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Algebra.Algebra.NonUnitalSubalgebra", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Algebra/NonUnitalSubalgebra.lean#L548", "span": "L548-L565"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\nlemma innerRegularWRT_isCompact_isClosed_measure_ne_top_of_group [h : InnerRegularCompactLTTop \u03bc] :\n InnerRegularWRT \u03bc (fun s \u21a6 IsCompact s \u2227 IsClosed s) (fun s \u21a6 MeasurableSet s \u2227 \u03bc s \u2260 \u221e) := by\nintro s \u27e8s_meas, \u03bcs\u27e9 r hr\n rcases h.innerRegular \u27e8s_meas, \u03bcs\u27e9 r hr with \u27e8K, Ks, K_comp, hK\u27e9\n refine \u27e8closure K, ?_, \u27e8K_comp.closure, isClosed_closure\u27e9, ?_\u27e9\n \u00b7 exact IsCompact.closure_subset_measurableSet K_comp s_meas Ks\n \u00b7 rwa [K_comp.measure_closure]\n\nend IsTopologicalGroup\n\nsection CommSemigroup\n\nvariable [CommSemigroup G]\n\n/-- In an abelian group every left invariant measure is also right-invariant.\n We don't declare the converse as an instance, since that would loop type-class inference, and\n we use `IsMulLeftInvariant` as the default hypothesis in abelian groups. -/\n```", "instruction": "Edit `innerRegularWRT_isCompact_isClosed_measure_ne_top_of_group` so it still compiles and the proof is simplified where possible. Return the full updated `innerRegularWRT_isCompact_isClosed_measure_ne_top_of_group` block.", "proof_is_oneliner": false, "target_span": "L718-L734", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1637, "declarations_count": 168, "diagnostics_count": 0, "duplicate_fingerprint": "db9b017d693a6f54", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 515, "lean_code_chars": 784, "lean_code_ratio": 0.4789, "length_bucket": "short", "line_count": 26, "natural_language_chars": 853, "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.MeasureTheory.Group.Measure).", "role": "system"}, {"content": "You are editing a file in `Mathlib/MeasureTheory/Group/Measure.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.MeasureTheory.Group.Measure.innerRegularWRT_isCompact_isClosed_measure_ne_top_of_group`, L718-L734)\n```lean\nlemma innerRegularWRT_isCompact_isClosed_measure_ne_top_of_group [h : InnerRegularCompactLTTop \u03bc] :\n InnerRegularWRT \u03bc (fun s \u21a6 IsCompact s \u2227 IsClosed s) (fun s \u21a6 MeasurableSet s \u2227 \u03bc s \u2260 \u221e) := by\nintro s \u27e8s_meas, \u03bcs\u27e9 r hr\n rcases h.innerRegular \u27e8s_meas, \u03bcs\u27e9 r hr with \u27e8K, Ks, K_comp, hK\u27e9\n refine \u27e8closure K, ?_, \u27e8K_comp.closure, isClosed_closure\u27e9, ?_\u27e9\n \u00b7 exact IsCompact.closure_subset_measurableSet K_comp s_meas Ks\n \u00b7 rwa [K_comp.measure_closure]\n\nend IsTopologicalGroup\n\nsection CommSemigroup\n\nvariable [CommSemigroup G]\n\n/-- In an abelian group every left invariant measure is also right-invariant.\n We don't declare the converse as an instance, since that would loop type-class inference, and\n we use `IsMulLeftInvariant` as the default hypothesis in abelian groups. -/\n```\n\n## Edit instruction\nEdit `innerRegularWRT_isCompact_isClosed_measure_ne_top_of_group` so it still compiles and the proof is simplified where possible. Return the full updated `innerRegularWRT_isCompact_isClosed_measure_ne_top_of_group` 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.MeasureTheory.Group.Measure).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/MeasureTheory/Group/Measure.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.MeasureTheory.Group.Measure.innerRegularWRT_isCompact_isClosed_measure_ne_top_of_group`, L718-L734)\n```lean\nlemma innerRegularWRT_isCompact_isClosed_measure_ne_top_of_group [h : InnerRegularCompactLTTop \u03bc] :\n InnerRegularWRT \u03bc (fun s \u21a6 IsCompact s \u2227 IsClosed s) (fun s \u21a6 MeasurableSet s \u2227 \u03bc s \u2260 \u221e) := by\nintro s \u27e8s_meas, \u03bcs\u27e9 r hr\n rcases h.innerRegular \u27e8s_meas, \u03bcs\u27e9 r hr with \u27e8K, Ks, K_comp, hK\u27e9\n refine \u27e8closure K, ?_, \u27e8K_comp.closure, isClosed_closure\u27e9, ?_\u27e9\n \u00b7 exact IsCompact.closure_subset_measurableSet K_comp s_meas Ks\n \u00b7 rwa [K_comp.measure_closure]\n\nend IsTopologicalGroup\n\nsection CommSemigroup\n\nvariable [CommSemigroup G]\n\n/-- In an abelian group every left invariant measure is also right-invariant.\n We don't declare the converse as an instance, since that would loop type-class inference, and\n we use `IsMulLeftInvariant` as the default hypothesis in abelian groups. -/\n```\n\n## Edit instruction\nEdit `innerRegularWRT_isCompact_isClosed_measure_ne_top_of_group` so it still compiles and the proof is simplified where possible. Return the full updated `innerRegularWRT_isCompact_isClosed_measure_ne_top_of_group` block.\n[/INST]", "sample_id": "D-Mathlib.MeasureTheory.Group.Measure.innerRegularWRT_isCompact_isClosed_measure_ne_top_of_group", "source": {"declaration": "Mathlib.MeasureTheory.Group.Measure.innerRegularWRT_isCompact_isClosed_measure_ne_top_of_group", "file": "Mathlib/MeasureTheory/Group/Measure.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.MeasureTheory.Group.Measure", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Group/Measure.lean#L718", "span": "L718-L734"}} {"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 Coloring.completeEquipartiteGraph :\n (completeEquipartiteGraph r t).Coloring (Fin r)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 640, "declarations_count": 54, "diagnostics_count": 0, "duplicate_fingerprint": "66617e49127c1376", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 171, "lean_code_chars": 90, "lean_code_ratio": 0.1406, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 550, "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.Combinatorics.SimpleGraph.ConcreteColorings).", "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 Coloring.completeEquipartiteGraph :\n (completeEquipartiteGraph r t).Coloring (Fin r)\n```\n\nDeclaration: `Mathlib.Combinatorics.SimpleGraph.ConcreteColorings.Coloring` (module Mathlib.Combinatorics.SimpleGraph.ConcreteColorings).", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Combinatorics.SimpleGraph.ConcreteColorings).[/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 Coloring.completeEquipartiteGraph :\n (completeEquipartiteGraph r t).Coloring (Fin r)\n```\n\nDeclaration: `Mathlib.Combinatorics.SimpleGraph.ConcreteColorings.Coloring` (module Mathlib.Combinatorics.SimpleGraph.ConcreteColorings).[/INST]", "sample_id": "F-Mathlib.Combinatorics.SimpleGraph.ConcreteColorings.Coloring", "source": {"declaration": "Mathlib.Combinatorics.SimpleGraph.ConcreteColorings.Coloring", "file": "Mathlib/Combinatorics/SimpleGraph/ConcreteColorings.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Combinatorics.SimpleGraph.ConcreteColorings", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Combinatorics/SimpleGraph/ConcreteColorings.lean#L172", "span": "L172-L175"}} {"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 supported_comap_lmapDomain (f : \u03b1 \u2192 \u03b1') (s : Set \u03b1') :\n supported M R (f \u207b\u00b9' s) \u2264 (supported M R s).comap (lmapDomain M R f)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 668, "declarations_count": 65, "diagnostics_count": 0, "duplicate_fingerprint": "905b2d426797b4c6", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 195, "lean_code_chars": 136, "lean_code_ratio": 0.2036, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 532, "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.LinearAlgebra.Finsupp.Supported).", "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 supported_comap_lmapDomain (f : \u03b1 \u2192 \u03b1') (s : Set \u03b1') :\n supported M R (f \u207b\u00b9' s) \u2264 (supported M R s).comap (lmapDomain M R f)\n```\n\nDeclaration: `Mathlib.LinearAlgebra.Finsupp.Supported.supported_comap_lmapDomain` (module Mathlib.LinearAlgebra.Finsupp.Supported).", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.LinearAlgebra.Finsupp.Supported).[/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 supported_comap_lmapDomain (f : \u03b1 \u2192 \u03b1') (s : Set \u03b1') :\n supported M R (f \u207b\u00b9' s) \u2264 (supported M R s).comap (lmapDomain M R f)\n```\n\nDeclaration: `Mathlib.LinearAlgebra.Finsupp.Supported.supported_comap_lmapDomain` (module Mathlib.LinearAlgebra.Finsupp.Supported).[/INST]", "sample_id": "F-Mathlib.LinearAlgebra.Finsupp.Supported.supported_comap_lmapDomain", "source": {"declaration": "Mathlib.LinearAlgebra.Finsupp.Supported.supported_comap_lmapDomain", "file": "Mathlib/LinearAlgebra/Finsupp/Supported.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.LinearAlgebra.Finsupp.Supported", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/Finsupp/Supported.lean#L217", "span": "L217-L224"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"trace_states": [{"state": "theorem isPurelyInseparable_of_finSepDegree_eq_one\n (hdeg : finSepDegree F E = 1) : IsPurelyInseparable F E", "tactic": "refine fun x \u21a6 \u27e8Algebra.IsIntegral.isIntegral x, fun hsep \u21a6 ?_\u27e9"}, {"state": "", "tactic": "have := finSepDegree_mul_finSepDegree_of_isAlgebraic F F\u27eex\u27ef E"}, {"state": "", "tactic": "rw [hdeg, mul_eq_one, (finSepDegree_adjoin_simple_eq_finrank_iff F E x (Algebra.IsAlgebraic.isAlgebraic x)).2 hsep, IntermediateField.finrank_eq_one_iff] at this"}, {"state": "", "tactic": "simpa only [this.1] using mem_adjoin_simple_self F x \u00b7 rw [\u2190 Algebra.transcendental_iff_not_isAlgebraic] at H"}, {"state": "", "tactic": "simp [finSepDegree_eq_zero_of_transcendental F E] at hdeg namespace IsPurelyInseparable variable [IsPurelyInseparable F E] (R L : Type*) [CommSemiring R] [Algebra R F] [Algebra R E] /-- If `E / F` is purely inseparable, then for any reduced ring `L`, the map `(E \u2192+* L) \u2192 (F \u2192+* L)` induced by `algebraMap F E` is injective. In particular, a purely inseparable field extension is an epimorphism in the category of fields. -/"}], "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1998, "declarations_count": 228, "diagnostics_count": 0, "duplicate_fingerprint": "0a765efdd39c5875", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 660, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "short", "line_count": 18, "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.FieldTheory.PurelyInseparable.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.FieldTheory.PurelyInseparable.Basic.isPurelyInseparable_of_finSepDegree_eq_one`:\nState 0: \u22a2 theorem isPurelyInseparable_of_finSepDegree_eq_one\n (hdeg : finSepDegree F E = 1) : IsPurelyInseparable F E\nTactic: refine fun x \u21a6 \u27e8Algebra.IsIntegral.isIntegral x, fun hsep \u21a6 ?_\u27e9\nState 1: \u22a2 \nTactic: have := finSepDegree_mul_finSepDegree_of_isAlgebraic F F\u27eex\u27ef E\nState 2: \u22a2 \nTactic: rw [hdeg, mul_eq_one, (finSepDegree_adjoin_simple_eq_finrank_iff F E x (Algebra.IsAlgebraic.isAlgebraic x)).2 hsep, IntermediateField.finrank_eq_one_iff] at this\nState 3: \u22a2 \nTactic: simpa only [this.1] using mem_adjoin_simple_self F x \u00b7 rw [\u2190 Algebra.transcendental_iff_not_isAlgebraic] at H\nState 4: \u22a2 \nTactic: simp [finSepDegree_eq_zero_of_transcendental F E] at hdeg namespace IsPurelyInseparable variable [IsPurelyInseparable F E] (R L : Type*) [CommSemiring R] [Algebra R F] [Algebra R E] /-- If `E / F` is purely inseparable, then for any reduced ring `L`, the map `(E \u2192+* L) \u2192 (F \u2192+* L)` induced by `algebraMap F E` is injective. In particular, a purely inseparable field extension is an epimorphism in the category of fields. -/\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.FieldTheory.PurelyInseparable.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.FieldTheory.PurelyInseparable.Basic.isPurelyInseparable_of_finSepDegree_eq_one`:\nState 0: \u22a2 theorem isPurelyInseparable_of_finSepDegree_eq_one\n (hdeg : finSepDegree F E = 1) : IsPurelyInseparable F E\nTactic: refine fun x \u21a6 \u27e8Algebra.IsIntegral.isIntegral x, fun hsep \u21a6 ?_\u27e9\nState 1: \u22a2 \nTactic: have := finSepDegree_mul_finSepDegree_of_isAlgebraic F F\u27eex\u27ef E\nState 2: \u22a2 \nTactic: rw [hdeg, mul_eq_one, (finSepDegree_adjoin_simple_eq_finrank_iff F E x (Algebra.IsAlgebraic.isAlgebraic x)).2 hsep, IntermediateField.finrank_eq_one_iff] at this\nState 3: \u22a2 \nTactic: simpa only [this.1] using mem_adjoin_simple_self F x \u00b7 rw [\u2190 Algebra.transcendental_iff_not_isAlgebraic] at H\nState 4: \u22a2 \nTactic: simp [finSepDegree_eq_zero_of_transcendental F E] at hdeg namespace IsPurelyInseparable variable [IsPurelyInseparable F E] (R L : Type*) [CommSemiring R] [Algebra R F] [Algebra R E] /-- If `E / F` is purely inseparable, then for any reduced ring `L`, the map `(E \u2192+* L) \u2192 (F \u2192+* L)` induced by `algebraMap F E` is injective. In particular, a purely inseparable field extension is an epimorphism in the category of fields. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.FieldTheory.PurelyInseparable.Basic.isPurelyInseparable_of_finSepDegree_eq_one", "source": {"declaration": "Mathlib.FieldTheory.PurelyInseparable.Basic.isPurelyInseparable_of_finSepDegree_eq_one", "file": "Mathlib/FieldTheory/PurelyInseparable/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.FieldTheory.PurelyInseparable.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/FieldTheory/PurelyInseparable/Basic.lean#L350", "span": "L350-L369"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "theorem IsIdempotentElem.spectrum_subset (\ud835\udd5c : Type*) {A : Type*} [Field \ud835\udd5c] [Ring A] [Algebra \ud835\udd5c A]\n {p : A} (hp : IsIdempotentElem p) : spectrum \ud835\udd5c p \u2286 {0, 1}\n:= by thisIsWrongLemmaNameXYZ\nnontriviality A\n apply Set.image_subset_iff.mp (spectrum.subset_polynomial_aeval p (X ^ 2 - X)) |>.trans\n refine fun a ha => eq_zero_or_one_of_sq_eq_self ?_\n simpa [pow_two p, hp.eq, sub_eq_zero] using ha", "diagnostic": "[CompilationUnit(i_begin=0, i_end=181, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=181, i_end=411, 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": 1267, "declarations_count": 133, "diagnostics_count": 1, "duplicate_fingerprint": "e577c005a58c820d", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 394, "lean_code_chars": 398, "lean_code_ratio": 0.3141, "length_bucket": "tiny", "line_count": 18, "natural_language_chars": 869, "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.FieldTheory.IsAlgClosed.Spectrum).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem IsIdempotentElem.spectrum_subset (\ud835\udd5c : Type*) {A : Type*} [Field \ud835\udd5c] [Ring A] [Algebra \ud835\udd5c A]\n {p : A} (hp : IsIdempotentElem p) : spectrum \ud835\udd5c p \u2286 {0, 1}\n:= by thisIsWrongLemmaNameXYZ\nnontriviality A\n apply Set.image_subset_iff.mp (spectrum.subset_polynomial_aeval p (X ^ 2 - X)) |>.trans\n refine fun a ha => eq_zero_or_one_of_sq_eq_self ?_\n simpa [pow_two p, hp.eq, sub_eq_zero] using ha\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=181, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=181, i_end=411, 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.FieldTheory.IsAlgClosed.Spectrum).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem IsIdempotentElem.spectrum_subset (\ud835\udd5c : Type*) {A : Type*} [Field \ud835\udd5c] [Ring A] [Algebra \ud835\udd5c A]\n {p : A} (hp : IsIdempotentElem p) : spectrum \ud835\udd5c p \u2286 {0, 1}\n:= by thisIsWrongLemmaNameXYZ\nnontriviality A\n apply Set.image_subset_iff.mp (spectrum.subset_polynomial_aeval p (X ^ 2 - X)) |>.trans\n refine fun a ha => eq_zero_or_one_of_sq_eq_self ?_\n simpa [pow_two p, hp.eq, sub_eq_zero] using ha\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=181, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=181, i_end=411, 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.FieldTheory.IsAlgClosed.Spectrum.IsIdempotentElem", "source": {"declaration": "Mathlib.FieldTheory.IsAlgClosed.Spectrum.IsIdempotentElem", "file": "Mathlib/FieldTheory/IsAlgClosed/Spectrum.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.FieldTheory.IsAlgClosed.Spectrum", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/FieldTheory/IsAlgClosed/Spectrum.lean#L163", "span": "L163-L169"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem domain_nontrivial [Nontrivial \u03b2] : Nontrivial \u03b1", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 461, "declarations_count": 50, "diagnostics_count": 0, "duplicate_fingerprint": "a88c7371b86daaa6", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 131, "lean_code_chars": 56, "lean_code_ratio": 0.1215, "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.Algebra.Ring.Hom.Defs).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem domain_nontrivial [Nontrivial \u03b2] : Nontrivial \u03b1\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.Algebra.Ring.Hom.Defs).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem domain_nontrivial [Nontrivial \u03b2] : Nontrivial \u03b1\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Algebra.Ring.Hom.Defs.domain_nontrivial", "source": {"declaration": "Mathlib.Algebra.Ring.Hom.Defs.domain_nontrivial", "file": "Mathlib/Algebra/Ring/Hom/Defs.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Algebra.Ring.Hom.Defs", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Ring/Hom/Defs.lean#L483", "span": "L483-L485"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"trace_states": [{"state": "lemma compClosure_iff_self {X Y : C} (f g : X \u27f6 Y) :\n CompClosure r f g \u2194 r f g", "tactic": "refine \u27e8?_, CompClosure.of\u27e9 rintro \u27e8_, _, _, _, _, _, h\u27e9"}, {"state": "", "tactic": "exact HomRel.comp_left _ (HomRel.comp_right _ h)"}], "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 882, "declarations_count": 114, "diagnostics_count": 0, "duplicate_fingerprint": "cd4e850ef1a94ba0", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 268, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "tiny", "line_count": 12, "natural_language_chars": 882, "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.CategoryTheory.Quotient).", "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.CategoryTheory.Quotient.compClosure_iff_self`:\nState 0: \u22a2 lemma compClosure_iff_self {X Y : C} (f g : X \u27f6 Y) :\n CompClosure r f g \u2194 r f g\nTactic: refine \u27e8?_, CompClosure.of\u27e9 rintro \u27e8_, _, _, _, _, _, h\u27e9\nState 1: \u22a2 \nTactic: exact HomRel.comp_left _ (HomRel.comp_right _ 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.CategoryTheory.Quotient).[/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.CategoryTheory.Quotient.compClosure_iff_self`:\nState 0: \u22a2 lemma compClosure_iff_self {X Y : C} (f g : X \u27f6 Y) :\n CompClosure r f g \u2194 r f g\nTactic: refine \u27e8?_, CompClosure.of\u27e9 rintro \u27e8_, _, _, _, _, _, h\u27e9\nState 1: \u22a2 \nTactic: exact HomRel.comp_left _ (HomRel.comp_right _ h)\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.CategoryTheory.Quotient.compClosure_iff_self", "source": {"declaration": "Mathlib.CategoryTheory.Quotient.compClosure_iff_self", "file": "Mathlib/CategoryTheory/Quotient.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.CategoryTheory.Quotient", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Quotient.lean#L87", "span": "L87-L92"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\ntheorem map_hom_inv (F : C \u2964 D) {X Y : C} (f : X \u27f6 Y) [IsIso f] :\n F.map f \u226b F.map (inv f) = \ud835\udfd9 (F.obj X) := by simp\nend Functor\n\nend CategoryTheory\n```", "instruction": "Edit `map_hom_inv` so it still compiles and the proof is simplified where possible. Return the full updated `map_hom_inv` block.", "proof_is_oneliner": false, "target_span": "L507-L512", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 836, "declarations_count": 100, "diagnostics_count": 0, "duplicate_fingerprint": "eef424ad86f0e56a", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 288, "lean_code_chars": 151, "lean_code_ratio": 0.1806, "length_bucket": "tiny", "line_count": 14, "natural_language_chars": 685, "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.CategoryTheory.Iso).", "role": "system"}, {"content": "You are editing a file in `Mathlib/CategoryTheory/Iso.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.CategoryTheory.Iso.map_hom_inv`, L507-L512)\n```lean\ntheorem map_hom_inv (F : C \u2964 D) {X Y : C} (f : X \u27f6 Y) [IsIso f] :\n F.map f \u226b F.map (inv f) = \ud835\udfd9 (F.obj X) := by simp\nend Functor\n\nend CategoryTheory\n```\n\n## Edit instruction\nEdit `map_hom_inv` so it still compiles and the proof is simplified where possible. Return the full updated `map_hom_inv` 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.CategoryTheory.Iso).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/CategoryTheory/Iso.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.CategoryTheory.Iso.map_hom_inv`, L507-L512)\n```lean\ntheorem map_hom_inv (F : C \u2964 D) {X Y : C} (f : X \u27f6 Y) [IsIso f] :\n F.map f \u226b F.map (inv f) = \ud835\udfd9 (F.obj X) := by simp\nend Functor\n\nend CategoryTheory\n```\n\n## Edit instruction\nEdit `map_hom_inv` so it still compiles and the proof is simplified where possible. Return the full updated `map_hom_inv` block.\n[/INST]", "sample_id": "D-Mathlib.CategoryTheory.Iso.map_hom_inv", "source": {"declaration": "Mathlib.CategoryTheory.Iso.map_hom_inv", "file": "Mathlib/CategoryTheory/Iso.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.CategoryTheory.Iso", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Iso.lean#L507", "span": "L507-L512"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Order.Bounded.Bounded (L29-L31)\ntheorem Bounded.mono (hst : s \u2286 t) (hs : Bounded r t) : Bounded r s", "-- Mathlib.Order.Bounded.Unbounded (L32-L38)\ntheorem Unbounded.mono (hst : s \u2286 t) (hs : Unbounded r s) : Unbounded r t", "-- Mathlib.Order.Bounded.unbounded_le_of_forall_exists_lt (L39-L43)\ntheorem unbounded_le_of_forall_exists_lt [Preorder \u03b1] (h : \u2200 a, \u2203 b \u2208 s, a < b) :\n Unbounded (\u00b7 \u2264 \u00b7) s", "-- Mathlib.Order.Bounded.unbounded_le_iff (L44-L46)\ntheorem unbounded_le_iff [LinearOrder \u03b1] : Unbounded (\u00b7 \u2264 \u00b7) s \u2194 \u2200 a, \u2203 b \u2208 s, a < b", "-- Mathlib.Order.Bounded.unbounded_lt_of_forall_exists_le (L47-L51)\ntheorem unbounded_lt_of_forall_exists_le [Preorder \u03b1] (h : \u2200 a, \u2203 b \u2208 s, a \u2264 b) :\n Unbounded (\u00b7 < \u00b7) s", "-- Mathlib.Order.Bounded.unbounded_lt_iff (L52-L54)\ntheorem unbounded_lt_iff [LinearOrder \u03b1] : Unbounded (\u00b7 < \u00b7) s \u2194 \u2200 a, \u2203 b \u2208 s, a \u2264 b", "-- Mathlib.Order.Bounded.unbounded_ge_of_forall_exists_gt (L55-L58)\ntheorem unbounded_ge_of_forall_exists_gt [Preorder \u03b1] (h : \u2200 a, \u2203 b \u2208 s, b < a) :\n Unbounded (\u00b7 \u2265 \u00b7) s", "-- Mathlib.Order.Bounded.unbounded_ge_iff (L59-L64)\ntheorem unbounded_ge_iff [LinearOrder \u03b1] : Unbounded (\u00b7 \u2265 \u00b7) s \u2194 \u2200 a, \u2203 b \u2208 s, b < a"], "statement": "theorem bounded_le_Iic [Preorder \u03b1] (a : \u03b1) : Bounded (\u00b7 \u2264 \u00b7) (Iic a)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1860, "declarations_count": 181, "diagnostics_count": 0, "duplicate_fingerprint": "fa1aab477e24c278", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 691, "lean_code_chars": 1233, "lean_code_ratio": 0.6629, "length_bucket": "short", "line_count": 58, "natural_language_chars": 627, "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.Order.Bounded).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem bounded_le_Iic [Preorder \u03b1] (a : \u03b1) : Bounded (\u00b7 \u2264 \u00b7) (Iic a)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Order.Bounded.Bounded (L29-L31)\ntheorem Bounded.mono (hst : s \u2286 t) (hs : Bounded r t) : Bounded r s\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Order.Bounded.Unbounded (L32-L38)\ntheorem Unbounded.mono (hst : s \u2286 t) (hs : Unbounded r s) : Unbounded r t\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Order.Bounded.unbounded_le_of_forall_exists_lt (L39-L43)\ntheorem unbounded_le_of_forall_exists_lt [Preorder \u03b1] (h : \u2200 a, \u2203 b \u2208 s, a < b) :\n Unbounded (\u00b7 \u2264 \u00b7) s\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Order.Bounded.unbounded_le_iff (L44-L46)\ntheorem unbounded_le_iff [LinearOrder \u03b1] : Unbounded (\u00b7 \u2264 \u00b7) s \u2194 \u2200 a, \u2203 b \u2208 s, a < b\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Order.Bounded.unbounded_lt_of_forall_exists_le (L47-L51)\ntheorem unbounded_lt_of_forall_exists_le [Preorder \u03b1] (h : \u2200 a, \u2203 b \u2208 s, a \u2264 b) :\n Unbounded (\u00b7 < \u00b7) s\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Order.Bounded.unbounded_lt_iff (L52-L54)\ntheorem unbounded_lt_iff [LinearOrder \u03b1] : Unbounded (\u00b7 < \u00b7) s \u2194 \u2200 a, \u2203 b \u2208 s, a \u2264 b\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Order.Bounded.unbounded_ge_of_forall_exists_gt (L55-L58)\ntheorem unbounded_ge_of_forall_exists_gt [Preorder \u03b1] (h : \u2200 a, \u2203 b \u2208 s, b < a) :\n Unbounded (\u00b7 \u2265 \u00b7) s\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Order.Bounded.unbounded_ge_iff (L59-L64)\ntheorem unbounded_ge_iff [LinearOrder \u03b1] : Unbounded (\u00b7 \u2265 \u00b7) s \u2194 \u2200 a, \u2203 b \u2208 s, b < a\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.Order.Bounded).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem bounded_le_Iic [Preorder \u03b1] (a : \u03b1) : Bounded (\u00b7 \u2264 \u00b7) (Iic a)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Order.Bounded.Bounded (L29-L31)\ntheorem Bounded.mono (hst : s \u2286 t) (hs : Bounded r t) : Bounded r s\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Order.Bounded.Unbounded (L32-L38)\ntheorem Unbounded.mono (hst : s \u2286 t) (hs : Unbounded r s) : Unbounded r t\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Order.Bounded.unbounded_le_of_forall_exists_lt (L39-L43)\ntheorem unbounded_le_of_forall_exists_lt [Preorder \u03b1] (h : \u2200 a, \u2203 b \u2208 s, a < b) :\n Unbounded (\u00b7 \u2264 \u00b7) s\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Order.Bounded.unbounded_le_iff (L44-L46)\ntheorem unbounded_le_iff [LinearOrder \u03b1] : Unbounded (\u00b7 \u2264 \u00b7) s \u2194 \u2200 a, \u2203 b \u2208 s, a < b\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Order.Bounded.unbounded_lt_of_forall_exists_le (L47-L51)\ntheorem unbounded_lt_of_forall_exists_le [Preorder \u03b1] (h : \u2200 a, \u2203 b \u2208 s, a \u2264 b) :\n Unbounded (\u00b7 < \u00b7) s\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Order.Bounded.unbounded_lt_iff (L52-L54)\ntheorem unbounded_lt_iff [LinearOrder \u03b1] : Unbounded (\u00b7 < \u00b7) s \u2194 \u2200 a, \u2203 b \u2208 s, a \u2264 b\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Order.Bounded.unbounded_ge_of_forall_exists_gt (L55-L58)\ntheorem unbounded_ge_of_forall_exists_gt [Preorder \u03b1] (h : \u2200 a, \u2203 b \u2208 s, b < a) :\n Unbounded (\u00b7 \u2265 \u00b7) s\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Order.Bounded.unbounded_ge_iff (L59-L64)\ntheorem unbounded_ge_iff [LinearOrder \u03b1] : Unbounded (\u00b7 \u2265 \u00b7) s \u2194 \u2200 a, \u2203 b \u2208 s, b < a\n```\n[/INST]", "sample_id": "C-Mathlib.Order.Bounded.bounded_le_Iic", "source": {"declaration": "Mathlib.Order.Bounded.bounded_le_Iic", "file": "Mathlib/Order/Bounded.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Order.Bounded", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Bounded.lean#L160", "span": "L160-L162"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"trace_states": [{"state": "theorem IsInertiaField.rank_left (hp : p \u2260 \u22a5) :\n Module.finrank E L = p.ramificationIdxIn B", "tactic": "have : p.IsMaximal := over_def P p \u25b8 Ideal.IsMaximal.under A P"}, {"state": "", "tactic": "have : Finite (A \u29f8 p) := Ring.HasFiniteQuotients.finiteQuotient hp"}, {"state": "", "tactic": "rw [\u2190 IsGaloisGroup.card_eq_finrank (inertia Gal(L/K) P) E L, card_inertia_eq_ramificationIdxIn p hp] /-- The degree `[E : K]` of the inertia field `E` over `K` equals the product of the number of prime ideals of `B` lying over `p` and the inertia degree of `p` in `B`. -/"}], "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1369, "declarations_count": 164, "diagnostics_count": 0, "duplicate_fingerprint": "4def96c3398d7d3c", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 435, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "tiny", "line_count": 14, "natural_language_chars": 1369, "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.NumberTheory.RamificationInertia.HilbertTheory).", "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.NumberTheory.RamificationInertia.HilbertTheory.IsInertiaField`:\nState 0: \u22a2 theorem IsInertiaField.rank_left (hp : p \u2260 \u22a5) :\n Module.finrank E L = p.ramificationIdxIn B\nTactic: have : p.IsMaximal := over_def P p \u25b8 Ideal.IsMaximal.under A P\nState 1: \u22a2 \nTactic: have : Finite (A \u29f8 p) := Ring.HasFiniteQuotients.finiteQuotient hp\nState 2: \u22a2 \nTactic: rw [\u2190 IsGaloisGroup.card_eq_finrank (inertia Gal(L/K) P) E L, card_inertia_eq_ramificationIdxIn p hp] /-- The degree `[E : K]` of the inertia field `E` over `K` equals the product of the number of prime ideals of `B` lying over `p` and the inertia degree of `p` in `B`. -/\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.NumberTheory.RamificationInertia.HilbertTheory).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.NumberTheory.RamificationInertia.HilbertTheory.IsInertiaField`:\nState 0: \u22a2 theorem IsInertiaField.rank_left (hp : p \u2260 \u22a5) :\n Module.finrank E L = p.ramificationIdxIn B\nTactic: have : p.IsMaximal := over_def P p \u25b8 Ideal.IsMaximal.under A P\nState 1: \u22a2 \nTactic: have : Finite (A \u29f8 p) := Ring.HasFiniteQuotients.finiteQuotient hp\nState 2: \u22a2 \nTactic: rw [\u2190 IsGaloisGroup.card_eq_finrank (inertia Gal(L/K) P) E L, card_inertia_eq_ramificationIdxIn p hp] /-- The degree `[E : K]` of the inertia field `E` over `K` equals the product of the number of prime ideals of `B` lying over `p` and the inertia degree of `p` in `B`. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.NumberTheory.RamificationInertia.HilbertTheory.IsInertiaField", "source": {"declaration": "Mathlib.NumberTheory.RamificationInertia.HilbertTheory.IsInertiaField", "file": "Mathlib/NumberTheory/RamificationInertia/HilbertTheory.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.NumberTheory.RamificationInertia.HilbertTheory", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/RamificationInertia/HilbertTheory.lean#L191", "span": "L191-L201"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "def fintypeArrow (\u03b1 : Type*) (\u03b2 : Type*) [DecidableEq \u03b1] [Fintype \u03b1] [Encodable \u03b2] :\n Trunc (Encodable (\u03b1 \u2192 \u03b2))\n:= .someMissingNamespaceXYZ\n(Fintype.truncEquivFin \u03b1).map fun f =>\n Encodable.ofEquiv (Fin (Fintype.card \u03b1) \u2192 \u03b2) <| Equiv.arrowCongr f (Equiv.refl _)\n\n/-- When `\u03b1` is finite and all `\u03c0 a` are encodable, `\u03a0 a, \u03c0 a` is encodable too. Because the\nencoding is not unique, we wrap it in `Trunc` to preserve computability. -/", "diagnostic": "[CompilationUnit(i_begin=0, i_end=283, messages=[Message(data='Unknown constant `Trunc.someMissingNamespaceXYZ`\\n\\nNote: Inferred this name from the expected resulting type of `.someMissingNamespaceXYZ`:\\n Trunc (Encodable (\u03b1 \u2192 \u03b2))', pos=Position(line=3, column=3), pos_end=Position(line=3, column=27), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown constant `Quotient.someMissingNamespaceXYZ`\\n\\nNote: Inferred this name from the expected resulting type of `.someMissingNamespaceXYZ`:\\n Trunc (Encodable (\u03b1 \u2192 \u03b2))', pos=Position(line=3, column=3), pos_end=Position(line=3, column=27), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown constant `Quot.someMissingNamespaceXYZ`\\n\\nNote: Inferred this name from the expected resulting type of `.someMissingNamespaceXYZ`:\\n Trunc (Encodable (\u03b1 \u2192 \u03b2))', pos=Position(line=3, column=3), pos_end=Position(line=3, column=27), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=283, i_end=455, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=8, column=75), 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": 2308, "declarations_count": 240, "diagnostics_count": 1, "duplicate_fingerprint": "e15ca67dc04b3a6f", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 676, "lean_code_chars": 438, "lean_code_ratio": 0.1898, "length_bucket": "short", "line_count": 19, "natural_language_chars": 1870, "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.Encodable.Pi).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef fintypeArrow (\u03b1 : Type*) (\u03b2 : Type*) [DecidableEq \u03b1] [Fintype \u03b1] [Encodable \u03b2] :\n Trunc (Encodable (\u03b1 \u2192 \u03b2))\n:= .someMissingNamespaceXYZ\n(Fintype.truncEquivFin \u03b1).map fun f =>\n Encodable.ofEquiv (Fin (Fintype.card \u03b1) \u2192 \u03b2) <| Equiv.arrowCongr f (Equiv.refl _)\n\n/-- When `\u03b1` is finite and all `\u03c0 a` are encodable, `\u03a0 a, \u03c0 a` is encodable too. Because the\nencoding is not unique, we wrap it in `Trunc` to preserve computability. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=283, messages=[Message(data='Unknown constant `Trunc.someMissingNamespaceXYZ`\\n\\nNote: Inferred this name from the expected resulting type of `.someMissingNamespaceXYZ`:\\n Trunc (Encodable (\u03b1 \u2192 \u03b2))', pos=Position(line=3, column=3), pos_end=Position(line=3, column=27), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown constant `Quotient.someMissingNamespaceXYZ`\\n\\nNote: Inferred this name from the expected resulting type of `.someMissingNamespaceXYZ`:\\n Trunc (Encodable (\u03b1 \u2192 \u03b2))', pos=Position(line=3, column=3), pos_end=Position(line=3, column=27), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown constant `Quot.someMissingNamespaceXYZ`\\n\\nNote: Inferred this name from the expected resulting type of `.someMissingNamespaceXYZ`:\\n Trunc (Encodable (\u03b1 \u2192 \u03b2))', pos=Position(line=3, column=3), pos_end=Position(line=3, column=27), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=283, i_end=455, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=8, column=75), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.", "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.Encodable.Pi).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef fintypeArrow (\u03b1 : Type*) (\u03b2 : Type*) [DecidableEq \u03b1] [Fintype \u03b1] [Encodable \u03b2] :\n Trunc (Encodable (\u03b1 \u2192 \u03b2))\n:= .someMissingNamespaceXYZ\n(Fintype.truncEquivFin \u03b1).map fun f =>\n Encodable.ofEquiv (Fin (Fintype.card \u03b1) \u2192 \u03b2) <| Equiv.arrowCongr f (Equiv.refl _)\n\n/-- When `\u03b1` is finite and all `\u03c0 a` are encodable, `\u03a0 a, \u03c0 a` is encodable too. Because the\nencoding is not unique, we wrap it in `Trunc` to preserve computability. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=283, messages=[Message(data='Unknown constant `Trunc.someMissingNamespaceXYZ`\\n\\nNote: Inferred this name from the expected resulting type of `.someMissingNamespaceXYZ`:\\n Trunc (Encodable (\u03b1 \u2192 \u03b2))', pos=Position(line=3, column=3), pos_end=Position(line=3, column=27), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown constant `Quotient.someMissingNamespaceXYZ`\\n\\nNote: Inferred this name from the expected resulting type of `.someMissingNamespaceXYZ`:\\n Trunc (Encodable (\u03b1 \u2192 \u03b2))', pos=Position(line=3, column=3), pos_end=Position(line=3, column=27), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown constant `Quot.someMissingNamespaceXYZ`\\n\\nNote: Inferred this name from the expected resulting type of `.someMissingNamespaceXYZ`:\\n Trunc (Encodable (\u03b1 \u2192 \u03b2))', pos=Position(line=3, column=3), pos_end=Position(line=3, column=27), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=283, i_end=455, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=8, column=75), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "sample_id": "B-Mathlib.Logic.Encodable.Pi.fintypeArrow", "source": {"declaration": "Mathlib.Logic.Encodable.Pi.fintypeArrow", "file": "Mathlib/Logic/Encodable/Pi.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Logic.Encodable.Pi", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Logic/Encodable/Pi.lean#L49", "span": "L49-L55"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"trace_states": [{"state": "lemma excenterWeightsUnnorm_ne_zero (signs : Finset (Fin (n + 1))) (i : Fin (n + 1)) :\n s.excenterWeightsUnnorm signs i \u2260 0", "tactic": "rw [excenterWeightsUnnorm]"}, {"state": "", "tactic": "refine mul_ne_zero ?_ ?_ \u00b7 grind \u00b7 simp [(s.height_pos i).ne'] /-- Whether an excenter exists with a given choice of signs. -/"}], "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 992, "declarations_count": 113, "diagnostics_count": 0, "duplicate_fingerprint": "29dc69e69a47c373", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 295, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "tiny", "line_count": 12, "natural_language_chars": 992, "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.Geometry.Euclidean.Incenter).", "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.Geometry.Euclidean.Incenter.excenterWeightsUnnorm_ne_zero`:\nState 0: \u22a2 lemma excenterWeightsUnnorm_ne_zero (signs : Finset (Fin (n + 1))) (i : Fin (n + 1)) :\n s.excenterWeightsUnnorm signs i \u2260 0\nTactic: rw [excenterWeightsUnnorm]\nState 1: \u22a2 \nTactic: refine mul_ne_zero ?_ ?_ \u00b7 grind \u00b7 simp [(s.height_pos i).ne'] /-- Whether an excenter exists with a given choice of signs. -/\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.Geometry.Euclidean.Incenter).[/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.Geometry.Euclidean.Incenter.excenterWeightsUnnorm_ne_zero`:\nState 0: \u22a2 lemma excenterWeightsUnnorm_ne_zero (signs : Finset (Fin (n + 1))) (i : Fin (n + 1)) :\n s.excenterWeightsUnnorm signs i \u2260 0\nTactic: rw [excenterWeightsUnnorm]\nState 1: \u22a2 \nTactic: refine mul_ne_zero ?_ ?_ \u00b7 grind \u00b7 simp [(s.height_pos i).ne'] /-- Whether an excenter exists with a given choice of signs. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.Geometry.Euclidean.Incenter.excenterWeightsUnnorm_ne_zero", "source": {"declaration": "Mathlib.Geometry.Euclidean.Incenter.excenterWeightsUnnorm_ne_zero", "file": "Mathlib/Geometry/Euclidean/Incenter.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Geometry.Euclidean.Incenter", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Geometry/Euclidean/Incenter.lean#L107", "span": "L107-L114"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.RingTheory.HahnSeries.Summable.coe_mk (L85-L88)\ntheorem coe_mk (toFun : \u03b1 \u2192 R\u27e6\u0393\u27e7) (h1 h2) :\n (\u27e8toFun, h1, h2\u27e9 : SummableFamily \u0393 R \u03b1) = toFun :=\nrfl", "-- Mathlib.RingTheory.HahnSeries.Summable.isPWO_iUnion_support (L89-L91)\ntheorem isPWO_iUnion_support (s : SummableFamily \u0393 R \u03b1) : Set.IsPWO (\u22c3 a : \u03b1, (s a).support) :=\ns.isPWO_iUnion_support'", "-- Mathlib.RingTheory.HahnSeries.Summable.finite_co_support (L92-L95)\ntheorem finite_co_support (s : SummableFamily \u0393 R \u03b1) (g : \u0393) :\n (fun a => (s a).coeff g).HasFiniteSupport :=\ns.finite_co_support' g", "-- Mathlib.RingTheory.HahnSeries.Summable.coe_injective (L96-L98)\ntheorem coe_injective : @Function.Injective (SummableFamily \u0393 R \u03b1) (\u03b1 \u2192 R\u27e6\u0393\u27e7) (\u21d1) :=\nDFunLike.coe_injective", "-- Mathlib.RingTheory.HahnSeries.Summable.ext (L100-L102)\ntheorem ext {s t : SummableFamily \u0393 R \u03b1} (h : \u2200 a : \u03b1, s a = t a) : s = t :=\nDFunLike.ext s t h", "-- Mathlib.RingTheory.HahnSeries.Summable.coe_add (L127-L129)\ntheorem coe_add (s t : SummableFamily \u0393 R \u03b1) : \u21d1(s + t) = s + t :=\nrfl", "-- Mathlib.RingTheory.HahnSeries.Summable.add_apply (L130-L132)\ntheorem add_apply {s t : SummableFamily \u0393 R \u03b1} {a : \u03b1} : (s + t) a = s a + t a :=\nrfl", "-- Mathlib.RingTheory.HahnSeries.Summable.coe_zero (L134-L136)\ntheorem coe_zero : ((0 : SummableFamily \u0393 R \u03b1) : \u03b1 \u2192 R\u27e6\u0393\u27e7) = 0 :=\nrfl", "-- Mathlib.RingTheory.HahnSeries.Summable.zero_apply (L137-L144)\ntheorem zero_apply {a : \u03b1} : (0 : SummableFamily \u0393 R \u03b1) a = 0 :=\nrfl\n\n\nsection SMul\n\nvariable {M} [SMulZeroClass M R]", "-- Mathlib.RingTheory.HahnSeries.Summable.coe_smul' (L159-L161)\ntheorem coe_smul' (m : M) (s : SummableFamily \u0393 R \u03b1) : \u21d1(m \u2022 s) = m \u2022 s :=\nrfl", "-- Mathlib.RingTheory.HahnSeries.Summable.smul_apply' (L162-L166)\ntheorem smul_apply' (m : M) (s : SummableFamily \u0393 R \u03b1) (a : \u03b1) : (m \u2022 s) a = m \u2022 s a :=\nrfl\n\nend SMul", "-- Mathlib.RingTheory.HahnSeries.Summable.coeff (L172-L176)\ndef coeff (s : SummableFamily \u0393 R \u03b1) (g : \u0393) : \u03b1 \u2192\u2080 R where\n support := (s.finite_co_support g).toFinset\ntoFun a := (s a).coeff g\n mem_support_toFun a := by simp", "-- Mathlib.RingTheory.HahnSeries.Summable.coeff_def (L178-L181)\ntheorem coeff_def (s : SummableFamily \u0393 R \u03b1) (a : \u03b1) (g : \u0393) : s.coeff g a = (s a).coeff g :=\nrfl\n\n/-- The infinite sum of a `SummableFamily` of Hahn series. -/", "-- Mathlib.RingTheory.HahnSeries.Summable.hsum (L182-L191)\ndef hsum (s : SummableFamily \u0393 R \u03b1) : R\u27e6\u0393\u27e7 where\n coeff g := \u2211\u1da0 i, (s i).coeff g\nisPWO_support' :=\n s.isPWO_iUnion_support.mono fun g => by\n contrapose\n rw [Set.mem_iUnion, not_exists, Function.mem_support, Classical.not_not]\n simp_rw [mem_support, Classical.not_not]\n intro h\n rw [finsum_congr h, finsum_zero]", "-- Mathlib.RingTheory.HahnSeries.Summable.coeff_hsum (L193-L195)\ntheorem coeff_hsum {s : SummableFamily \u0393 R \u03b1} {g : \u0393} : s.hsum.coeff g = \u2211\u1da0 i, (s i).coeff g :=\nrfl", "-- Mathlib.RingTheory.HahnSeries.Addition.coeff_add (L114-L116)\ntheorem coeff_add {x y : R\u27e6\u0393\u27e7} {a : \u0393} : (x + y).coeff a = x.coeff a + y.coeff a :=\nrfl", "-- Mathlib.RingTheory.HahnSeries.Addition.addOppositeEquiv (L137-L148)\ndef addOppositeEquiv : R\u1d43\u1d52\u1d56\u27e6\u0393\u27e7 \u2243+ R\u27e6\u0393\u27e7\u1d43\u1d52\u1d56 where\n toFun x := .op \u27e8fun a \u21a6 (x.coeff a).unop, by convert x.isPWO_support; ext; simp\u27e9\ninvFun x := \u27e8fun a \u21a6 .op (x.unop.coeff a), by convert x.unop.isPWO_support; ext; simp\u27e9\n left_inv x := by simp\n right_inv x := by\n apply AddOpposite.unop_injective\n simp\n map_add' x y := by\n apply AddOpposite.unop_injective\n ext\n simp", "-- Mathlib.RingTheory.HahnSeries.Addition.support_add_subset (L107-L109)\ntheorem support_add_subset (x y : R\u27e6\u0393\u27e7) : (x + y).support \u2286 x.support \u222a y.support :=\nFunction.support_add ..", "-- Mathlib.RingTheory.HahnSeries.Addition.orderTop_add_eq_right (L228-L233)\ntheorem orderTop_add_eq_right {\u0393} [LinearOrder \u0393] {x y : R\u27e6\u0393\u27e7}\n (hxy : y.orderTop < x.orderTop) : (x + y).orderTop = y.orderTop := by\nsimpa [\u2190 map_add, \u2190 AddOpposite.op_add, hxy] using orderTop_add_eq_left\n (x := addOppositeEquiv.symm (.op y))\n (y := addOppositeEquiv.symm (.op x))", "-- Mathlib.RingTheory.HahnSeries.Addition.coeff_add' (L111-L113)\ntheorem coeff_add' (x y : R\u27e6\u0393\u27e7) : (x + y).coeff = x.coeff + y.coeff :=\nrfl", "-- Mathlib.RingTheory.HahnSeries.Addition.leadingCoeff_add_eq_left (L234-L243)\ntheorem leadingCoeff_add_eq_left {\u0393} [LinearOrder \u0393] {x y : R\u27e6\u0393\u27e7}\n (hxy : x.orderTop < y.orderTop) : (x + y).leadingCoeff = x.leadingCoeff := by\nhave hx : x \u2260 0 := orderTop_ne_top.1 hxy.ne_top\n have ho : (x + y).orderTop = x.orderTop := orderTop_add_eq_left hxy\n by_cases h : x + y = 0\n \u00b7 rw [h, orderTop_zero] at ho\n rw [h, orderTop_eq_top.mp ho.symm]\n \u00b7 simp_rw [leadingCoeff_of_ne_zero h, leadingCoeff_of_ne_zero hx, ho, coeff_add]\n rw [coeff_eq_zero_of_lt_orderTop (x := y) (by simpa using hxy), add_zero]", "-- Mathlib.RingTheory.HahnSeries.Addition.addOppositeEquiv_leadingCoeff (L176-L184)\nlemma addOppositeEquiv_leadingCoeff (x : R\u1d43\u1d52\u1d56\u27e6\u0393\u27e7) :\n (addOppositeEquiv x).unop.leadingCoeff = x.leadingCoeff.unop := by\nclassical\n obtain rfl | hx := eq_or_ne x 0\n \u00b7 simp\n simp only [ne_eq, AddOpposite.unop_eq_zero_iff, EmbeddingLike.map_eq_zero_iff, hx,\n not_false_eq_true, leadingCoeff_of_ne_zero, addOppositeEquiv_orderTop]\n simp [addOppositeEquiv]", "-- Mathlib.RingTheory.HahnSeries.Addition.support_smul_subset (L51-L53)\ntheorem support_smul_subset (r : R) (x : HahnSeries \u0393 V) : (r \u2022 x).support \u2286 x.support :=\nFunction.support_const_smul_subset ..", "-- Mathlib.RingTheory.HahnSeries.Addition.le_order_smul (L85-L88)\ntheorem le_order_smul {\u0393} [Zero \u0393] [LinearOrder \u0393] (r : R) (x : V\u27e6\u0393\u27e7) (h : r \u2022 x \u2260 0) :\n x.order \u2264 (r \u2022 x).order :=\nle_of_not_gt (order_smul_not_lt r x h)", "-- Mathlib.RingTheory.HahnSeries.Addition.coeff_smul (L59-L61)\ntheorem coeff_smul {r : R} {x : V\u27e6\u0393\u27e7} {a : \u0393} : (r \u2022 x).coeff a = r \u2022 x.coeff a :=\nrfl", "-- Mathlib.RingTheory.HahnSeries.Addition.min_order_le_order_add (L208-L214)\ntheorem min_order_le_order_add {\u0393} [Zero \u0393] [LinearOrder \u0393] {x y : R\u27e6\u0393\u27e7}\n (hxy : x + y \u2260 0) : min x.order y.order \u2264 (x + y).order := by\nby_cases hx : x = 0; \u00b7 simp [hx]\n by_cases hy : y = 0; \u00b7 simp [hy]\n rw [order_of_ne hx, order_of_ne hy, order_of_ne hxy]\n exact HahnSeries.min_le_min_add hx hy hxy", "-- Mathlib.RingTheory.HahnSeries.Addition.orderTop_smul_not_lt (L67-L74)\ntheorem orderTop_smul_not_lt (r : R) (x : V\u27e6\u0393\u27e7) : \u00ac (r \u2022 x).orderTop < x.orderTop := by\nby_cases hrx : r \u2022 x = 0\n \u00b7 rw [hrx, orderTop_zero]\n exact not_top_lt\n \u00b7 simp only [orderTop_of_ne_zero hrx, orderTop_of_ne_zero <| right_ne_zero_of_smul hrx,\n WithTop.coe_lt_coe]\n exact Set.IsWF.min_of_subset_not_lt_min (Function.support_smul_subset_right ..)", "-- Mathlib.RingTheory.HahnSeries.Addition.orderTop_add_eq_left (L215-L227)\ntheorem orderTop_add_eq_left {\u0393} [LinearOrder \u0393] {x y : R\u27e6\u0393\u27e7}\n (hxy : x.orderTop < y.orderTop) : (x + y).orderTop = x.orderTop := by\nhave hx : x \u2260 0 := orderTop_ne_top.1 hxy.ne_top\n let g : \u0393 := Set.IsWF.min x.isWF_support (support_nonempty_iff.2 hx)\n have hcxyne : (x + y).coeff g \u2260 0 := by\n rw [coeff_add, coeff_eq_zero_of_lt_orderTop (lt_of_eq_of_lt (orderTop_of_ne_zero hx).symm hxy),\n add_zero]\n exact coeff_orderTop_ne (orderTop_of_ne_zero hx)\n have hxyx : (x + y).orderTop \u2264 x.orderTop := by\n rw [orderTop_of_ne_zero hx]\n exact orderTop_le_of_coeff_ne_zero hcxyne\n exact le_antisymm hxyx (le_of_eq_of_le (min_eq_left_of_lt hxy).symm min_orderTop_le_orderTop_add)", "-- Mathlib.RingTheory.HahnSeries.Addition.orderTop_le_orderTop_smul (L75-L78)\ntheorem orderTop_le_orderTop_smul {\u0393} [LinearOrder \u0393] (r : R) (x : V\u27e6\u0393\u27e7) :\n x.orderTop \u2264 (r \u2022 x).orderTop :=\nle_of_not_gt <| orderTop_smul_not_lt r x", "-- Mathlib.RingTheory.HahnSeries.Addition.addOppositeEquiv_orderTop (L161-L169)\nlemma addOppositeEquiv_orderTop (x : R\u1d43\u1d52\u1d56\u27e6\u0393\u27e7) :\n (addOppositeEquiv x).unop.orderTop = x.orderTop := by\nclassical\n simp only [orderTop,\n addOppositeEquiv_support]\n simp only [addOppositeEquiv_apply, AddOpposite.unop_op, mk_eq_zero]\n simp_rw [HahnSeries.ext_iff, funext_iff]\n simp only [Pi.zero_apply, AddOpposite.unop_eq_zero_iff, coeff_zero]", "-- Mathlib.RingTheory.HahnSeries.Addition.leadingCoeff_add_eq_right (L244-L249)\ntheorem leadingCoeff_add_eq_right {\u0393} [LinearOrder \u0393] {x y : R\u27e6\u0393\u27e7}\n (hxy : y.orderTop < x.orderTop) : (x + y).leadingCoeff = y.leadingCoeff := by\nsimpa [\u2190 map_add, \u2190 AddOpposite.op_add, hxy] using leadingCoeff_add_eq_left\n (x := addOppositeEquiv.symm (.op y))\n (y := addOppositeEquiv.symm (.op x))", "-- Mathlib.RingTheory.HahnSeries.Addition.addOppositeEquiv_symm_leadingCoeff (L186-L198)\nlemma addOppositeEquiv_symm_leadingCoeff (x : R\u27e6\u0393\u27e7\u1d43\u1d52\u1d56) :\n (addOppositeEquiv.symm x).leadingCoeff = .op x.unop.leadingCoeff := by\napply AddOpposite.unop_injective\n rw [\u2190 addOppositeEquiv_leadingCoeff, AddEquiv.apply_symm_apply, AddOpposite.unop_op]\n\nprotected theorem min_le_min_add {\u0393} [LinearOrder \u0393] {x y : R\u27e6\u0393\u27e7} (hx : x \u2260 0)\n (hy : y \u2260 0) (hxy : x + y \u2260 0) :\n min (Set.IsWF.min x.isWF_support (support_nonempty_iff.2 hx))\n (Set.IsWF.min y.isWF_support (support_nonempty_iff.2 hy)) \u2264\n Set.IsWF.min (x + y).isWF_support (support_nonempty_iff.2 hxy) := by\n rw [\u2190 Set.IsWF.min_union]\n exact Set.IsWF.min_le_min_of_subset (support_add_subset (x := x) (y := y))", "-- Mathlib.RingTheory.HahnSeries.Addition.coeff_nsmul (L125-L126)\ntheorem coeff_nsmul {x : R\u27e6\u0393\u27e7} {n : \u2115} : (n \u2022 x).coeff = n \u2022 x.coeff := coeff_smul' _ _", "-- Mathlib.RingTheory.HahnSeries.Addition.min_orderTop_le_orderTop_add (L199-L207)\ntheorem min_orderTop_le_orderTop_add {\u0393} [LinearOrder \u0393] {x y : R\u27e6\u0393\u27e7} :\n min x.orderTop y.orderTop \u2264 (x + y).orderTop := by\nby_cases hx : x = 0; \u00b7 simp [hx]\n by_cases hy : y = 0; \u00b7 simp [hy]\n by_cases hxy : x + y = 0; \u00b7 simp [hxy]\n rw [orderTop_of_ne_zero hx, orderTop_of_ne_zero hy, orderTop_of_ne_zero hxy, \u2190 WithTop.coe_min,\n WithTop.coe_le_coe]\n exact HahnSeries.min_le_min_add hx hy hxy", "-- Mathlib.RingTheory.HahnSeries.Addition.coeff_smul' (L55-L57)\ntheorem coeff_smul' (r : R) (x : V\u27e6\u0393\u27e7) : (r \u2022 x).coeff = r \u2022 x.coeff :=\nrfl", "-- Mathlib.RingTheory.HahnSeries.Addition.truncLT_smul (L89-L101)\ntheorem truncLT_smul [DecidableLT \u0393] (c : \u0393) (r : R) (x : V\u27e6\u0393\u27e7) :\n truncLT c (r \u2022 x) = r \u2022 truncLT c x := by ext; simp\nend SMulZeroClass\n\nsection Addition\n\nvariable [PartialOrder \u0393]\n\nsection AddMonoid\n\nvariable [AddMonoid R]", "-- Mathlib.RingTheory.HahnSeries.Addition.addOppositeEquiv_symm_orderTop (L171-L174)\nlemma addOppositeEquiv_symm_orderTop (x : R\u27e6\u0393\u27e7\u1d43\u1d52\u1d56) :\n (addOppositeEquiv.symm x).orderTop = x.unop.orderTop := by\nrw [\u2190 addOppositeEquiv_orderTop, AddEquiv.apply_symm_apply]", "-- Mathlib.RingTheory.HahnSeries.Addition.addOppositeEquiv_symm_support (L156-L159)\nlemma addOppositeEquiv_symm_support (x : R\u27e6\u0393\u27e7\u1d43\u1d52\u1d56) :\n (addOppositeEquiv.symm x).support = x.unop.support := by\nrw [\u2190 addOppositeEquiv_support, AddEquiv.apply_symm_apply]", "-- Mathlib.RingTheory.HahnSeries.Addition.order_smul_not_lt (L79-L84)\ntheorem order_smul_not_lt [Zero \u0393] (r : R) (x : V\u27e6\u0393\u27e7) (h : r \u2022 x \u2260 0) :\n \u00ac (r \u2022 x).order < x.order := by\nhave hx : x \u2260 0 := right_ne_zero_of_smul h\n simp_all only [order, dite_false]\n exact Set.IsWF.min_of_subset_not_lt_min (Function.support_smul_subset_right ..)", "-- Mathlib.RingTheory.HahnSeries.Addition.addOppositeEquiv_support (L150-L154)\nlemma addOppositeEquiv_support (x : R\u1d43\u1d52\u1d56\u27e6\u0393\u27e7) :\n (addOppositeEquiv x).unop.support = x.support := by\next\n simp [addOppositeEquiv_apply]"], "statement": "def toOrderTopSubOnePos {x : R\u27e6\u0393\u27e7} (h : 0 < (x - 1).orderTop) :\n orderTopSubOnePos \u0393 R where\n val", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 12892, "declarations_count": 1156, "diagnostics_count": 0, "duplicate_fingerprint": "b23f41a523484579", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 5218, "lean_code_chars": 11385, "lean_code_ratio": 0.8831, "length_bucket": "medium", "line_count": 395, "natural_language_chars": 1507, "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.RingTheory.HahnSeries.Summable).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef toOrderTopSubOnePos {x : R\u27e6\u0393\u27e7} (h : 0 < (x - 1).orderTop) :\n orderTopSubOnePos \u0393 R where\n val\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.coe_mk (L85-L88)\ntheorem coe_mk (toFun : \u03b1 \u2192 R\u27e6\u0393\u27e7) (h1 h2) :\n (\u27e8toFun, h1, h2\u27e9 : SummableFamily \u0393 R \u03b1) = toFun :=\nrfl\n```\n\n-- snippet 2\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.isPWO_iUnion_support (L89-L91)\ntheorem isPWO_iUnion_support (s : SummableFamily \u0393 R \u03b1) : Set.IsPWO (\u22c3 a : \u03b1, (s a).support) :=\ns.isPWO_iUnion_support'\n```\n\n-- snippet 3\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.finite_co_support (L92-L95)\ntheorem finite_co_support (s : SummableFamily \u0393 R \u03b1) (g : \u0393) :\n (fun a => (s a).coeff g).HasFiniteSupport :=\ns.finite_co_support' g\n```\n\n-- snippet 4\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.coe_injective (L96-L98)\ntheorem coe_injective : @Function.Injective (SummableFamily \u0393 R \u03b1) (\u03b1 \u2192 R\u27e6\u0393\u27e7) (\u21d1) :=\nDFunLike.coe_injective\n```\n\n-- snippet 5\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.ext (L100-L102)\ntheorem ext {s t : SummableFamily \u0393 R \u03b1} (h : \u2200 a : \u03b1, s a = t a) : s = t :=\nDFunLike.ext s t h\n```\n\n-- snippet 6\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.coe_add (L127-L129)\ntheorem coe_add (s t : SummableFamily \u0393 R \u03b1) : \u21d1(s + t) = s + t :=\nrfl\n```\n\n-- snippet 7\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.add_apply (L130-L132)\ntheorem add_apply {s t : SummableFamily \u0393 R \u03b1} {a : \u03b1} : (s + t) a = s a + t a :=\nrfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.coe_zero (L134-L136)\ntheorem coe_zero : ((0 : SummableFamily \u0393 R \u03b1) : \u03b1 \u2192 R\u27e6\u0393\u27e7) = 0 :=\nrfl\n```\n\n-- snippet 9\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.zero_apply (L137-L144)\ntheorem zero_apply {a : \u03b1} : (0 : SummableFamily \u0393 R \u03b1) a = 0 :=\nrfl\n\n\nsection SMul\n\nvariable {M} [SMulZeroClass M R]\n```\n\n-- snippet 10\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.coe_smul' (L159-L161)\ntheorem coe_smul' (m : M) (s : SummableFamily \u0393 R \u03b1) : \u21d1(m \u2022 s) = m \u2022 s :=\nrfl\n```\n\n-- snippet 11\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.smul_apply' (L162-L166)\ntheorem smul_apply' (m : M) (s : SummableFamily \u0393 R \u03b1) (a : \u03b1) : (m \u2022 s) a = m \u2022 s a :=\nrfl\n\nend SMul\n```\n\n-- snippet 12\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.coeff (L172-L176)\ndef coeff (s : SummableFamily \u0393 R \u03b1) (g : \u0393) : \u03b1 \u2192\u2080 R where\n support := (s.finite_co_support g).toFinset\ntoFun a := (s a).coeff g\n mem_support_toFun a := by simp\n```\n\n-- snippet 13\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.coeff_def (L178-L181)\ntheorem coeff_def (s : SummableFamily \u0393 R \u03b1) (a : \u03b1) (g : \u0393) : s.coeff g a = (s a).coeff g :=\nrfl\n\n/-- The infinite sum of a `SummableFamily` of Hahn series. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.hsum (L182-L191)\ndef hsum (s : SummableFamily \u0393 R \u03b1) : R\u27e6\u0393\u27e7 where\n coeff g := \u2211\u1da0 i, (s i).coeff g\nisPWO_support' :=\n s.isPWO_iUnion_support.mono fun g => by\n contrapose\n rw [Set.mem_iUnion, not_exists, Function.mem_support, Classical.not_not]\n simp_rw [mem_support, Classical.not_not]\n intro h\n rw [finsum_congr h, finsum_zero]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.coeff_hsum (L193-L195)\ntheorem coeff_hsum {s : SummableFamily \u0393 R \u03b1} {g : \u0393} : s.hsum.coeff g = \u2211\u1da0 i, (s i).coeff g :=\nrfl\n```\n\n-- snippet 16\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.coeff_add (L114-L116)\ntheorem coeff_add {x y : R\u27e6\u0393\u27e7} {a : \u0393} : (x + y).coeff a = x.coeff a + y.coeff a :=\nrfl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.addOppositeEquiv (L137-L148)\ndef addOppositeEquiv : R\u1d43\u1d52\u1d56\u27e6\u0393\u27e7 \u2243+ R\u27e6\u0393\u27e7\u1d43\u1d52\u1d56 where\n toFun x := .op \u27e8fun a \u21a6 (x.coeff a).unop, by convert x.isPWO_support; ext; simp\u27e9\ninvFun x := \u27e8fun a \u21a6 .op (x.unop.coeff a), by convert x.unop.isPWO_support; ext; simp\u27e9\n left_inv x := by simp\n right_inv x := by\n apply AddOpposite.unop_injective\n simp\n map_add' x y := by\n apply AddOpposite.unop_injective\n ext\n simp\n```\n\n-- snippet 18\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.support_add_subset (L107-L109)\ntheorem support_add_subset (x y : R\u27e6\u0393\u27e7) : (x + y).support \u2286 x.support \u222a y.support :=\nFunction.support_add ..\n```\n\n-- snippet 19\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.orderTop_add_eq_right (L228-L233)\ntheorem orderTop_add_eq_right {\u0393} [LinearOrder \u0393] {x y : R\u27e6\u0393\u27e7}\n (hxy : y.orderTop < x.orderTop) : (x + y).orderTop = y.orderTop := by\nsimpa [\u2190 map_add, \u2190 AddOpposite.op_add, hxy] using orderTop_add_eq_left\n (x := addOppositeEquiv.symm (.op y))\n (y := addOppositeEquiv.symm (.op x))\n```\n\n-- snippet 20\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.coeff_add' (L111-L113)\ntheorem coeff_add' (x y : R\u27e6\u0393\u27e7) : (x + y).coeff = x.coeff + y.coeff :=\nrfl\n```\n\n-- snippet 21\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.leadingCoeff_add_eq_left (L234-L243)\ntheorem leadingCoeff_add_eq_left {\u0393} [LinearOrder \u0393] {x y : R\u27e6\u0393\u27e7}\n (hxy : x.orderTop < y.orderTop) : (x + y).leadingCoeff = x.leadingCoeff := by\nhave hx : x \u2260 0 := orderTop_ne_top.1 hxy.ne_top\n have ho : (x + y).orderTop = x.orderTop := orderTop_add_eq_left hxy\n by_cases h : x + y = 0\n \u00b7 rw [h, orderTop_zero] at ho\n rw [h, orderTop_eq_top.mp ho.symm]\n \u00b7 simp_rw [leadingCoeff_of_ne_zero h, leadingCoeff_of_ne_zero hx, ho, coeff_add]\n rw [coeff_eq_zero_of_lt_orderTop (x := y) (by simpa using hxy), add_zero]\n```\n\n-- snippet 22\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.addOppositeEquiv_leadingCoeff (L176-L184)\nlemma addOppositeEquiv_leadingCoeff (x : R\u1d43\u1d52\u1d56\u27e6\u0393\u27e7) :\n (addOppositeEquiv x).unop.leadingCoeff = x.leadingCoeff.unop := by\nclassical\n obtain rfl | hx := eq_or_ne x 0\n \u00b7 simp\n simp only [ne_eq, AddOpposite.unop_eq_zero_iff, EmbeddingLike.map_eq_zero_iff, hx,\n not_false_eq_true, leadingCoeff_of_ne_zero, addOppositeEquiv_orderTop]\n simp [addOppositeEquiv]\n```\n\n-- snippet 23\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.support_smul_subset (L51-L53)\ntheorem support_smul_subset (r : R) (x : HahnSeries \u0393 V) : (r \u2022 x).support \u2286 x.support :=\nFunction.support_const_smul_subset ..\n```\n\n-- snippet 24\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.le_order_smul (L85-L88)\ntheorem le_order_smul {\u0393} [Zero \u0393] [LinearOrder \u0393] (r : R) (x : V\u27e6\u0393\u27e7) (h : r \u2022 x \u2260 0) :\n x.order \u2264 (r \u2022 x).order :=\nle_of_not_gt (order_smul_not_lt r x h)\n```\n\n-- snippet 25\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.coeff_smul (L59-L61)\ntheorem coeff_smul {r : R} {x : V\u27e6\u0393\u27e7} {a : \u0393} : (r \u2022 x).coeff a = r \u2022 x.coeff a :=\nrfl\n```\n\n-- snippet 26\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.min_order_le_order_add (L208-L214)\ntheorem min_order_le_order_add {\u0393} [Zero \u0393] [LinearOrder \u0393] {x y : R\u27e6\u0393\u27e7}\n (hxy : x + y \u2260 0) : min x.order y.order \u2264 (x + y).order := by\nby_cases hx : x = 0; \u00b7 simp [hx]\n by_cases hy : y = 0; \u00b7 simp [hy]\n rw [order_of_ne hx, order_of_ne hy, order_of_ne hxy]\n exact HahnSeries.min_le_min_add hx hy hxy\n```\n\n-- snippet 27\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.orderTop_smul_not_lt (L67-L74)\ntheorem orderTop_smul_not_lt (r : R) (x : V\u27e6\u0393\u27e7) : \u00ac (r \u2022 x).orderTop < x.orderTop := by\nby_cases hrx : r \u2022 x = 0\n \u00b7 rw [hrx, orderTop_zero]\n exact not_top_lt\n \u00b7 simp only [orderTop_of_ne_zero hrx, orderTop_of_ne_zero <| right_ne_zero_of_smul hrx,\n WithTop.coe_lt_coe]\n exact Set.IsWF.min_of_subset_not_lt_min (Function.support_smul_subset_right ..)\n```\n\n-- snippet 28\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.orderTop_add_eq_left (L215-L227)\ntheorem orderTop_add_eq_left {\u0393} [LinearOrder \u0393] {x y : R\u27e6\u0393\u27e7}\n (hxy : x.orderTop < y.orderTop) : (x + y).orderTop = x.orderTop := by\nhave hx : x \u2260 0 := orderTop_ne_top.1 hxy.ne_top\n let g : \u0393 := Set.IsWF.min x.isWF_support (support_nonempty_iff.2 hx)\n have hcxyne : (x + y).coeff g \u2260 0 := by\n rw [coeff_add, coeff_eq_zero_of_lt_orderTop (lt_of_eq_of_lt (orderTop_of_ne_zero hx).symm hxy),\n add_zero]\n exact coeff_orderTop_ne (orderTop_of_ne_zero hx)\n have hxyx : (x + y).orderTop \u2264 x.orderTop := by\n rw [orderTop_of_ne_zero hx]\n exact orderTop_le_of_coeff_ne_zero hcxyne\n exact le_antisymm hxyx (le_of_eq_of_le (min_eq_left_of_lt hxy).symm min_orderTop_le_orderTop_add)\n```\n\n-- snippet 29\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.orderTop_le_orderTop_smul (L75-L78)\ntheorem orderTop_le_orderTop_smul {\u0393} [LinearOrder \u0393] (r : R) (x : V\u27e6\u0393\u27e7) :\n x.orderTop \u2264 (r \u2022 x).orderTop :=\nle_of_not_gt <| orderTop_smul_not_lt r x\n```\n\n-- snippet 30\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.addOppositeEquiv_orderTop (L161-L169)\nlemma addOppositeEquiv_orderTop (x : R\u1d43\u1d52\u1d56\u27e6\u0393\u27e7) :\n (addOppositeEquiv x).unop.orderTop = x.orderTop := by\nclassical\n simp only [orderTop,\n addOppositeEquiv_support]\n simp only [addOppositeEquiv_apply, AddOpposite.unop_op, mk_eq_zero]\n simp_rw [HahnSeries.ext_iff, funext_iff]\n simp only [Pi.zero_apply, AddOpposite.unop_eq_zero_iff, coeff_zero]\n```\n\n-- snippet 31\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.leadingCoeff_add_eq_right (L244-L249)\ntheorem leadingCoeff_add_eq_right {\u0393} [LinearOrder \u0393] {x y : R\u27e6\u0393\u27e7}\n (hxy : y.orderTop < x.orderTop) : (x + y).leadingCoeff = y.leadingCoeff := by\nsimpa [\u2190 map_add, \u2190 AddOpposite.op_add, hxy] using leadingCoeff_add_eq_left\n (x := addOppositeEquiv.symm (.op y))\n (y := addOppositeEquiv.symm (.op x))\n```\n\n-- snippet 32\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.addOppositeEquiv_symm_leadingCoeff (L186-L198)\nlemma addOppositeEquiv_symm_leadingCoeff (x : R\u27e6\u0393\u27e7\u1d43\u1d52\u1d56) :\n (addOppositeEquiv.symm x).leadingCoeff = .op x.unop.leadingCoeff := by\napply AddOpposite.unop_injective\n rw [\u2190 addOppositeEquiv_leadingCoeff, AddEquiv.apply_symm_apply, AddOpposite.unop_op]\n\nprotected theorem min_le_min_add {\u0393} [LinearOrder \u0393] {x y : R\u27e6\u0393\u27e7} (hx : x \u2260 0)\n (hy : y \u2260 0) (hxy : x + y \u2260 0) :\n min (Set.IsWF.min x.isWF_support (support_nonempty_iff.2 hx))\n (Set.IsWF.min y.isWF_support (support_nonempty_iff.2 hy)) \u2264\n Set.IsWF.min (x + y).isWF_support (support_nonempty_iff.2 hxy) := by\n rw [\u2190 Set.IsWF.min_union]\n exact Set.IsWF.min_le_min_of_subset (support_add_subset (x := x) (y := y))\n```\n\n-- snippet 33\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.coeff_nsmul (L125-L126)\ntheorem coeff_nsmul {x : R\u27e6\u0393\u27e7} {n : \u2115} : (n \u2022 x).coeff = n \u2022 x.coeff := coeff_smul' _ _\n```\n\n-- snippet 34\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.min_orderTop_le_orderTop_add (L199-L207)\ntheorem min_orderTop_le_orderTop_add {\u0393} [LinearOrder \u0393] {x y : R\u27e6\u0393\u27e7} :\n min x.orderTop y.orderTop \u2264 (x + y).orderTop := by\nby_cases hx : x = 0; \u00b7 simp [hx]\n by_cases hy : y = 0; \u00b7 simp [hy]\n by_cases hxy : x + y = 0; \u00b7 simp [hxy]\n rw [orderTop_of_ne_zero hx, orderTop_of_ne_zero hy, orderTop_of_ne_zero hxy, \u2190 WithTop.coe_min,\n WithTop.coe_le_coe]\n exact HahnSeries.min_le_min_add hx hy hxy\n```\n\n-- snippet 35\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.coeff_smul' (L55-L57)\ntheorem coeff_smul' (r : R) (x : V\u27e6\u0393\u27e7) : (r \u2022 x).coeff = r \u2022 x.coeff :=\nrfl\n```\n\n-- snippet 36\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.truncLT_smul (L89-L101)\ntheorem truncLT_smul [DecidableLT \u0393] (c : \u0393) (r : R) (x : V\u27e6\u0393\u27e7) :\n truncLT c (r \u2022 x) = r \u2022 truncLT c x := by ext; simp\nend SMulZeroClass\n\nsection Addition\n\nvariable [PartialOrder \u0393]\n\nsection AddMonoid\n\nvariable [AddMonoid R]\n```\n\n-- snippet 37\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.addOppositeEquiv_symm_orderTop (L171-L174)\nlemma addOppositeEquiv_symm_orderTop (x : R\u27e6\u0393\u27e7\u1d43\u1d52\u1d56) :\n (addOppositeEquiv.symm x).orderTop = x.unop.orderTop := by\nrw [\u2190 addOppositeEquiv_orderTop, AddEquiv.apply_symm_apply]\n```\n\n-- snippet 38\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.addOppositeEquiv_symm_support (L156-L159)\nlemma addOppositeEquiv_symm_support (x : R\u27e6\u0393\u27e7\u1d43\u1d52\u1d56) :\n (addOppositeEquiv.symm x).support = x.unop.support := by\nrw [\u2190 addOppositeEquiv_support, AddEquiv.apply_symm_apply]\n```\n\n-- snippet 39\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.order_smul_not_lt (L79-L84)\ntheorem order_smul_not_lt [Zero \u0393] (r : R) (x : V\u27e6\u0393\u27e7) (h : r \u2022 x \u2260 0) :\n \u00ac (r \u2022 x).order < x.order := by\nhave hx : x \u2260 0 := right_ne_zero_of_smul h\n simp_all only [order, dite_false]\n exact Set.IsWF.min_of_subset_not_lt_min (Function.support_smul_subset_right ..)\n```\n\n-- snippet 40\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.addOppositeEquiv_support (L150-L154)\nlemma addOppositeEquiv_support (x : R\u1d43\u1d52\u1d56\u27e6\u0393\u27e7) :\n (addOppositeEquiv x).unop.support = x.support := by\next\n simp [addOppositeEquiv_apply]\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.RingTheory.HahnSeries.Summable).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef toOrderTopSubOnePos {x : R\u27e6\u0393\u27e7} (h : 0 < (x - 1).orderTop) :\n orderTopSubOnePos \u0393 R where\n val\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.coe_mk (L85-L88)\ntheorem coe_mk (toFun : \u03b1 \u2192 R\u27e6\u0393\u27e7) (h1 h2) :\n (\u27e8toFun, h1, h2\u27e9 : SummableFamily \u0393 R \u03b1) = toFun :=\nrfl\n```\n\n-- snippet 2\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.isPWO_iUnion_support (L89-L91)\ntheorem isPWO_iUnion_support (s : SummableFamily \u0393 R \u03b1) : Set.IsPWO (\u22c3 a : \u03b1, (s a).support) :=\ns.isPWO_iUnion_support'\n```\n\n-- snippet 3\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.finite_co_support (L92-L95)\ntheorem finite_co_support (s : SummableFamily \u0393 R \u03b1) (g : \u0393) :\n (fun a => (s a).coeff g).HasFiniteSupport :=\ns.finite_co_support' g\n```\n\n-- snippet 4\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.coe_injective (L96-L98)\ntheorem coe_injective : @Function.Injective (SummableFamily \u0393 R \u03b1) (\u03b1 \u2192 R\u27e6\u0393\u27e7) (\u21d1) :=\nDFunLike.coe_injective\n```\n\n-- snippet 5\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.ext (L100-L102)\ntheorem ext {s t : SummableFamily \u0393 R \u03b1} (h : \u2200 a : \u03b1, s a = t a) : s = t :=\nDFunLike.ext s t h\n```\n\n-- snippet 6\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.coe_add (L127-L129)\ntheorem coe_add (s t : SummableFamily \u0393 R \u03b1) : \u21d1(s + t) = s + t :=\nrfl\n```\n\n-- snippet 7\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.add_apply (L130-L132)\ntheorem add_apply {s t : SummableFamily \u0393 R \u03b1} {a : \u03b1} : (s + t) a = s a + t a :=\nrfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.coe_zero (L134-L136)\ntheorem coe_zero : ((0 : SummableFamily \u0393 R \u03b1) : \u03b1 \u2192 R\u27e6\u0393\u27e7) = 0 :=\nrfl\n```\n\n-- snippet 9\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.zero_apply (L137-L144)\ntheorem zero_apply {a : \u03b1} : (0 : SummableFamily \u0393 R \u03b1) a = 0 :=\nrfl\n\n\nsection SMul\n\nvariable {M} [SMulZeroClass M R]\n```\n\n-- snippet 10\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.coe_smul' (L159-L161)\ntheorem coe_smul' (m : M) (s : SummableFamily \u0393 R \u03b1) : \u21d1(m \u2022 s) = m \u2022 s :=\nrfl\n```\n\n-- snippet 11\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.smul_apply' (L162-L166)\ntheorem smul_apply' (m : M) (s : SummableFamily \u0393 R \u03b1) (a : \u03b1) : (m \u2022 s) a = m \u2022 s a :=\nrfl\n\nend SMul\n```\n\n-- snippet 12\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.coeff (L172-L176)\ndef coeff (s : SummableFamily \u0393 R \u03b1) (g : \u0393) : \u03b1 \u2192\u2080 R where\n support := (s.finite_co_support g).toFinset\ntoFun a := (s a).coeff g\n mem_support_toFun a := by simp\n```\n\n-- snippet 13\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.coeff_def (L178-L181)\ntheorem coeff_def (s : SummableFamily \u0393 R \u03b1) (a : \u03b1) (g : \u0393) : s.coeff g a = (s a).coeff g :=\nrfl\n\n/-- The infinite sum of a `SummableFamily` of Hahn series. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.hsum (L182-L191)\ndef hsum (s : SummableFamily \u0393 R \u03b1) : R\u27e6\u0393\u27e7 where\n coeff g := \u2211\u1da0 i, (s i).coeff g\nisPWO_support' :=\n s.isPWO_iUnion_support.mono fun g => by\n contrapose\n rw [Set.mem_iUnion, not_exists, Function.mem_support, Classical.not_not]\n simp_rw [mem_support, Classical.not_not]\n intro h\n rw [finsum_congr h, finsum_zero]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.RingTheory.HahnSeries.Summable.coeff_hsum (L193-L195)\ntheorem coeff_hsum {s : SummableFamily \u0393 R \u03b1} {g : \u0393} : s.hsum.coeff g = \u2211\u1da0 i, (s i).coeff g :=\nrfl\n```\n\n-- snippet 16\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.coeff_add (L114-L116)\ntheorem coeff_add {x y : R\u27e6\u0393\u27e7} {a : \u0393} : (x + y).coeff a = x.coeff a + y.coeff a :=\nrfl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.addOppositeEquiv (L137-L148)\ndef addOppositeEquiv : R\u1d43\u1d52\u1d56\u27e6\u0393\u27e7 \u2243+ R\u27e6\u0393\u27e7\u1d43\u1d52\u1d56 where\n toFun x := .op \u27e8fun a \u21a6 (x.coeff a).unop, by convert x.isPWO_support; ext; simp\u27e9\ninvFun x := \u27e8fun a \u21a6 .op (x.unop.coeff a), by convert x.unop.isPWO_support; ext; simp\u27e9\n left_inv x := by simp\n right_inv x := by\n apply AddOpposite.unop_injective\n simp\n map_add' x y := by\n apply AddOpposite.unop_injective\n ext\n simp\n```\n\n-- snippet 18\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.support_add_subset (L107-L109)\ntheorem support_add_subset (x y : R\u27e6\u0393\u27e7) : (x + y).support \u2286 x.support \u222a y.support :=\nFunction.support_add ..\n```\n\n-- snippet 19\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.orderTop_add_eq_right (L228-L233)\ntheorem orderTop_add_eq_right {\u0393} [LinearOrder \u0393] {x y : R\u27e6\u0393\u27e7}\n (hxy : y.orderTop < x.orderTop) : (x + y).orderTop = y.orderTop := by\nsimpa [\u2190 map_add, \u2190 AddOpposite.op_add, hxy] using orderTop_add_eq_left\n (x := addOppositeEquiv.symm (.op y))\n (y := addOppositeEquiv.symm (.op x))\n```\n\n-- snippet 20\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.coeff_add' (L111-L113)\ntheorem coeff_add' (x y : R\u27e6\u0393\u27e7) : (x + y).coeff = x.coeff + y.coeff :=\nrfl\n```\n\n-- snippet 21\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.leadingCoeff_add_eq_left (L234-L243)\ntheorem leadingCoeff_add_eq_left {\u0393} [LinearOrder \u0393] {x y : R\u27e6\u0393\u27e7}\n (hxy : x.orderTop < y.orderTop) : (x + y).leadingCoeff = x.leadingCoeff := by\nhave hx : x \u2260 0 := orderTop_ne_top.1 hxy.ne_top\n have ho : (x + y).orderTop = x.orderTop := orderTop_add_eq_left hxy\n by_cases h : x + y = 0\n \u00b7 rw [h, orderTop_zero] at ho\n rw [h, orderTop_eq_top.mp ho.symm]\n \u00b7 simp_rw [leadingCoeff_of_ne_zero h, leadingCoeff_of_ne_zero hx, ho, coeff_add]\n rw [coeff_eq_zero_of_lt_orderTop (x := y) (by simpa using hxy), add_zero]\n```\n\n-- snippet 22\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.addOppositeEquiv_leadingCoeff (L176-L184)\nlemma addOppositeEquiv_leadingCoeff (x : R\u1d43\u1d52\u1d56\u27e6\u0393\u27e7) :\n (addOppositeEquiv x).unop.leadingCoeff = x.leadingCoeff.unop := by\nclassical\n obtain rfl | hx := eq_or_ne x 0\n \u00b7 simp\n simp only [ne_eq, AddOpposite.unop_eq_zero_iff, EmbeddingLike.map_eq_zero_iff, hx,\n not_false_eq_true, leadingCoeff_of_ne_zero, addOppositeEquiv_orderTop]\n simp [addOppositeEquiv]\n```\n\n-- snippet 23\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.support_smul_subset (L51-L53)\ntheorem support_smul_subset (r : R) (x : HahnSeries \u0393 V) : (r \u2022 x).support \u2286 x.support :=\nFunction.support_const_smul_subset ..\n```\n\n-- snippet 24\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.le_order_smul (L85-L88)\ntheorem le_order_smul {\u0393} [Zero \u0393] [LinearOrder \u0393] (r : R) (x : V\u27e6\u0393\u27e7) (h : r \u2022 x \u2260 0) :\n x.order \u2264 (r \u2022 x).order :=\nle_of_not_gt (order_smul_not_lt r x h)\n```\n\n-- snippet 25\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.coeff_smul (L59-L61)\ntheorem coeff_smul {r : R} {x : V\u27e6\u0393\u27e7} {a : \u0393} : (r \u2022 x).coeff a = r \u2022 x.coeff a :=\nrfl\n```\n\n-- snippet 26\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.min_order_le_order_add (L208-L214)\ntheorem min_order_le_order_add {\u0393} [Zero \u0393] [LinearOrder \u0393] {x y : R\u27e6\u0393\u27e7}\n (hxy : x + y \u2260 0) : min x.order y.order \u2264 (x + y).order := by\nby_cases hx : x = 0; \u00b7 simp [hx]\n by_cases hy : y = 0; \u00b7 simp [hy]\n rw [order_of_ne hx, order_of_ne hy, order_of_ne hxy]\n exact HahnSeries.min_le_min_add hx hy hxy\n```\n\n-- snippet 27\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.orderTop_smul_not_lt (L67-L74)\ntheorem orderTop_smul_not_lt (r : R) (x : V\u27e6\u0393\u27e7) : \u00ac (r \u2022 x).orderTop < x.orderTop := by\nby_cases hrx : r \u2022 x = 0\n \u00b7 rw [hrx, orderTop_zero]\n exact not_top_lt\n \u00b7 simp only [orderTop_of_ne_zero hrx, orderTop_of_ne_zero <| right_ne_zero_of_smul hrx,\n WithTop.coe_lt_coe]\n exact Set.IsWF.min_of_subset_not_lt_min (Function.support_smul_subset_right ..)\n```\n\n-- snippet 28\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.orderTop_add_eq_left (L215-L227)\ntheorem orderTop_add_eq_left {\u0393} [LinearOrder \u0393] {x y : R\u27e6\u0393\u27e7}\n (hxy : x.orderTop < y.orderTop) : (x + y).orderTop = x.orderTop := by\nhave hx : x \u2260 0 := orderTop_ne_top.1 hxy.ne_top\n let g : \u0393 := Set.IsWF.min x.isWF_support (support_nonempty_iff.2 hx)\n have hcxyne : (x + y).coeff g \u2260 0 := by\n rw [coeff_add, coeff_eq_zero_of_lt_orderTop (lt_of_eq_of_lt (orderTop_of_ne_zero hx).symm hxy),\n add_zero]\n exact coeff_orderTop_ne (orderTop_of_ne_zero hx)\n have hxyx : (x + y).orderTop \u2264 x.orderTop := by\n rw [orderTop_of_ne_zero hx]\n exact orderTop_le_of_coeff_ne_zero hcxyne\n exact le_antisymm hxyx (le_of_eq_of_le (min_eq_left_of_lt hxy).symm min_orderTop_le_orderTop_add)\n```\n\n-- snippet 29\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.orderTop_le_orderTop_smul (L75-L78)\ntheorem orderTop_le_orderTop_smul {\u0393} [LinearOrder \u0393] (r : R) (x : V\u27e6\u0393\u27e7) :\n x.orderTop \u2264 (r \u2022 x).orderTop :=\nle_of_not_gt <| orderTop_smul_not_lt r x\n```\n\n-- snippet 30\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.addOppositeEquiv_orderTop (L161-L169)\nlemma addOppositeEquiv_orderTop (x : R\u1d43\u1d52\u1d56\u27e6\u0393\u27e7) :\n (addOppositeEquiv x).unop.orderTop = x.orderTop := by\nclassical\n simp only [orderTop,\n addOppositeEquiv_support]\n simp only [addOppositeEquiv_apply, AddOpposite.unop_op, mk_eq_zero]\n simp_rw [HahnSeries.ext_iff, funext_iff]\n simp only [Pi.zero_apply, AddOpposite.unop_eq_zero_iff, coeff_zero]\n```\n\n-- snippet 31\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.leadingCoeff_add_eq_right (L244-L249)\ntheorem leadingCoeff_add_eq_right {\u0393} [LinearOrder \u0393] {x y : R\u27e6\u0393\u27e7}\n (hxy : y.orderTop < x.orderTop) : (x + y).leadingCoeff = y.leadingCoeff := by\nsimpa [\u2190 map_add, \u2190 AddOpposite.op_add, hxy] using leadingCoeff_add_eq_left\n (x := addOppositeEquiv.symm (.op y))\n (y := addOppositeEquiv.symm (.op x))\n```\n\n-- snippet 32\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.addOppositeEquiv_symm_leadingCoeff (L186-L198)\nlemma addOppositeEquiv_symm_leadingCoeff (x : R\u27e6\u0393\u27e7\u1d43\u1d52\u1d56) :\n (addOppositeEquiv.symm x).leadingCoeff = .op x.unop.leadingCoeff := by\napply AddOpposite.unop_injective\n rw [\u2190 addOppositeEquiv_leadingCoeff, AddEquiv.apply_symm_apply, AddOpposite.unop_op]\n\nprotected theorem min_le_min_add {\u0393} [LinearOrder \u0393] {x y : R\u27e6\u0393\u27e7} (hx : x \u2260 0)\n (hy : y \u2260 0) (hxy : x + y \u2260 0) :\n min (Set.IsWF.min x.isWF_support (support_nonempty_iff.2 hx))\n (Set.IsWF.min y.isWF_support (support_nonempty_iff.2 hy)) \u2264\n Set.IsWF.min (x + y).isWF_support (support_nonempty_iff.2 hxy) := by\n rw [\u2190 Set.IsWF.min_union]\n exact Set.IsWF.min_le_min_of_subset (support_add_subset (x := x) (y := y))\n```\n\n-- snippet 33\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.coeff_nsmul (L125-L126)\ntheorem coeff_nsmul {x : R\u27e6\u0393\u27e7} {n : \u2115} : (n \u2022 x).coeff = n \u2022 x.coeff := coeff_smul' _ _\n```\n\n-- snippet 34\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.min_orderTop_le_orderTop_add (L199-L207)\ntheorem min_orderTop_le_orderTop_add {\u0393} [LinearOrder \u0393] {x y : R\u27e6\u0393\u27e7} :\n min x.orderTop y.orderTop \u2264 (x + y).orderTop := by\nby_cases hx : x = 0; \u00b7 simp [hx]\n by_cases hy : y = 0; \u00b7 simp [hy]\n by_cases hxy : x + y = 0; \u00b7 simp [hxy]\n rw [orderTop_of_ne_zero hx, orderTop_of_ne_zero hy, orderTop_of_ne_zero hxy, \u2190 WithTop.coe_min,\n WithTop.coe_le_coe]\n exact HahnSeries.min_le_min_add hx hy hxy\n```\n\n-- snippet 35\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.coeff_smul' (L55-L57)\ntheorem coeff_smul' (r : R) (x : V\u27e6\u0393\u27e7) : (r \u2022 x).coeff = r \u2022 x.coeff :=\nrfl\n```\n\n-- snippet 36\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.truncLT_smul (L89-L101)\ntheorem truncLT_smul [DecidableLT \u0393] (c : \u0393) (r : R) (x : V\u27e6\u0393\u27e7) :\n truncLT c (r \u2022 x) = r \u2022 truncLT c x := by ext; simp\nend SMulZeroClass\n\nsection Addition\n\nvariable [PartialOrder \u0393]\n\nsection AddMonoid\n\nvariable [AddMonoid R]\n```\n\n-- snippet 37\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.addOppositeEquiv_symm_orderTop (L171-L174)\nlemma addOppositeEquiv_symm_orderTop (x : R\u27e6\u0393\u27e7\u1d43\u1d52\u1d56) :\n (addOppositeEquiv.symm x).orderTop = x.unop.orderTop := by\nrw [\u2190 addOppositeEquiv_orderTop, AddEquiv.apply_symm_apply]\n```\n\n-- snippet 38\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.addOppositeEquiv_symm_support (L156-L159)\nlemma addOppositeEquiv_symm_support (x : R\u27e6\u0393\u27e7\u1d43\u1d52\u1d56) :\n (addOppositeEquiv.symm x).support = x.unop.support := by\nrw [\u2190 addOppositeEquiv_support, AddEquiv.apply_symm_apply]\n```\n\n-- snippet 39\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.order_smul_not_lt (L79-L84)\ntheorem order_smul_not_lt [Zero \u0393] (r : R) (x : V\u27e6\u0393\u27e7) (h : r \u2022 x \u2260 0) :\n \u00ac (r \u2022 x).order < x.order := by\nhave hx : x \u2260 0 := right_ne_zero_of_smul h\n simp_all only [order, dite_false]\n exact Set.IsWF.min_of_subset_not_lt_min (Function.support_smul_subset_right ..)\n```\n\n-- snippet 40\n```lean\n-- Mathlib.RingTheory.HahnSeries.Addition.addOppositeEquiv_support (L150-L154)\nlemma addOppositeEquiv_support (x : R\u1d43\u1d52\u1d56\u27e6\u0393\u27e7) :\n (addOppositeEquiv x).unop.support = x.support := by\next\n simp [addOppositeEquiv_apply]\n```\n[/INST]", "sample_id": "C-Mathlib.RingTheory.HahnSeries.Summable.toOrderTopSubOnePos", "source": {"declaration": "Mathlib.RingTheory.HahnSeries.Summable.toOrderTopSubOnePos", "file": "Mathlib/RingTheory/HahnSeries/Summable.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.RingTheory.HahnSeries.Summable", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/HahnSeries/Summable.lean#L824", "span": "L824-L835"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Analysis.Convex.StdSimplex.stdSimplex (L35-L37)\ndef stdSimplex : Set (\u03b9 \u2192 \ud835\udd5c)", "-- Mathlib.Analysis.Convex.StdSimplex.stdSimplex_eq_inter (L38-L41)\ntheorem stdSimplex_eq_inter : stdSimplex \ud835\udd5c \u03b9 = (\u22c2 x, { f | 0 \u2264 f x }) \u2229 { f | \u2211 x, f x = 1 }", "-- Mathlib.Analysis.Convex.StdSimplex.convex_stdSimplex (L42-L48)\ntheorem convex_stdSimplex [IsOrderedRing \ud835\udd5c] : Convex \ud835\udd5c (stdSimplex \ud835\udd5c \u03b9)", "-- Mathlib.Analysis.Convex.StdSimplex.stdSimplex_of_isEmpty_index (L53-L55)\nlemma stdSimplex_of_isEmpty_index [IsEmpty \u03b9] [Nontrivial \ud835\udd5c] : stdSimplex \ud835\udd5c \u03b9 = \u2205", "-- Mathlib.Analysis.Convex.StdSimplex.stdSimplex_unique (L56-L67)\nlemma stdSimplex_unique [ZeroLEOneClass \ud835\udd5c] [Nonempty \u03b9] [Subsingleton \u03b9] :\n stdSimplex \ud835\udd5c \u03b9 = {fun _ \u21a6 1}", "-- Mathlib.Analysis.Convex.StdSimplex.mem_Icc_of_mem_stdSimplex (L68-L73)\ntheorem mem_Icc_of_mem_stdSimplex [IsOrderedAddMonoid \ud835\udd5c]\n {f : \u03b9 \u2192 \ud835\udd5c} (hf : f \u2208 stdSimplex \ud835\udd5c \u03b9) (x) :\n f x \u2208 Icc (0 : \ud835\udd5c) 1", "-- Mathlib.Analysis.Convex.StdSimplex.stdSimplex_subset_Icc (L74-L80)\ntheorem stdSimplex_subset_Icc [IsOrderedAddMonoid \ud835\udd5c] : stdSimplex \ud835\udd5c \u03b9 \u2286 Icc 0 1", "-- Mathlib.Analysis.Convex.StdSimplex.single_mem_stdSimplex (L81-L83)\ntheorem single_mem_stdSimplex (i : \u03b9) : Pi.single i 1 \u2208 stdSimplex \ud835\udd5c \u03b9", "-- Mathlib.Analysis.Convex.AmpleSet.ampleSet_univ (L58-L63)\ntheorem ampleSet_univ {F : Type*} [NormedAddCommGroup F] [NormedSpace \u211d F] :\n AmpleSet (univ : Set F)", "-- Mathlib.Analysis.Convex.AmpleSet.AmpleSet (L53-L56)\ndef AmpleSet (s : Set F) : Prop", "-- Mathlib.Analysis.Convex.AmpleSet.ampleSet_empty (L65-L69)\ntheorem ampleSet_empty : AmpleSet (\u2205 : Set F)", "-- Mathlib.Analysis.Convex.AmpleSet.union (L70-L83)\ntheorem union {s t : Set F} (hs : AmpleSet s) (ht : AmpleSet t) : AmpleSet (s \u222a t)", "-- Mathlib.Analysis.Convex.AmpleSet.image (L84-L93)\ntheorem image {s : Set E} (h : AmpleSet s) (L : E \u2243\u1d2c[\u211d] F) :\n AmpleSet (L '' s)", "-- Mathlib.Analysis.Convex.AmpleSet.image_iff (L94-L98)\ntheorem image_iff {s : Set E} (L : E \u2243\u1d2c[\u211d] F) :\n AmpleSet (L '' s) \u2194 AmpleSet s"], "statement": "lemma le_one (s : stdSimplex S X) (x : X) : s x \u2264 1", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 2834, "declarations_count": 246, "diagnostics_count": 0, "duplicate_fingerprint": "d0e9f5be9c1486bb", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1113, "lean_code_chars": 2033, "lean_code_ratio": 0.7174, "length_bucket": "short", "line_count": 97, "natural_language_chars": 801, "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.Analysis.Convex.StdSimplex).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma le_one (s : stdSimplex S X) (x : X) : s x \u2264 1\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.Convex.StdSimplex.stdSimplex (L35-L37)\ndef stdSimplex : Set (\u03b9 \u2192 \ud835\udd5c)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.Convex.StdSimplex.stdSimplex_eq_inter (L38-L41)\ntheorem stdSimplex_eq_inter : stdSimplex \ud835\udd5c \u03b9 = (\u22c2 x, { f | 0 \u2264 f x }) \u2229 { f | \u2211 x, f x = 1 }\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.Convex.StdSimplex.convex_stdSimplex (L42-L48)\ntheorem convex_stdSimplex [IsOrderedRing \ud835\udd5c] : Convex \ud835\udd5c (stdSimplex \ud835\udd5c \u03b9)\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.Convex.StdSimplex.stdSimplex_of_isEmpty_index (L53-L55)\nlemma stdSimplex_of_isEmpty_index [IsEmpty \u03b9] [Nontrivial \ud835\udd5c] : stdSimplex \ud835\udd5c \u03b9 = \u2205\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.Convex.StdSimplex.stdSimplex_unique (L56-L67)\nlemma stdSimplex_unique [ZeroLEOneClass \ud835\udd5c] [Nonempty \u03b9] [Subsingleton \u03b9] :\n stdSimplex \ud835\udd5c \u03b9 = {fun _ \u21a6 1}\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.Convex.StdSimplex.mem_Icc_of_mem_stdSimplex (L68-L73)\ntheorem mem_Icc_of_mem_stdSimplex [IsOrderedAddMonoid \ud835\udd5c]\n {f : \u03b9 \u2192 \ud835\udd5c} (hf : f \u2208 stdSimplex \ud835\udd5c \u03b9) (x) :\n f x \u2208 Icc (0 : \ud835\udd5c) 1\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.Convex.StdSimplex.stdSimplex_subset_Icc (L74-L80)\ntheorem stdSimplex_subset_Icc [IsOrderedAddMonoid \ud835\udd5c] : stdSimplex \ud835\udd5c \u03b9 \u2286 Icc 0 1\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.Convex.StdSimplex.single_mem_stdSimplex (L81-L83)\ntheorem single_mem_stdSimplex (i : \u03b9) : Pi.single i 1 \u2208 stdSimplex \ud835\udd5c \u03b9\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.Convex.AmpleSet.ampleSet_univ (L58-L63)\ntheorem ampleSet_univ {F : Type*} [NormedAddCommGroup F] [NormedSpace \u211d F] :\n AmpleSet (univ : Set F)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.Convex.AmpleSet.AmpleSet (L53-L56)\ndef AmpleSet (s : Set F) : Prop\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.Convex.AmpleSet.ampleSet_empty (L65-L69)\ntheorem ampleSet_empty : AmpleSet (\u2205 : Set F)\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.Convex.AmpleSet.union (L70-L83)\ntheorem union {s t : Set F} (hs : AmpleSet s) (ht : AmpleSet t) : AmpleSet (s \u222a t)\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.Convex.AmpleSet.image (L84-L93)\ntheorem image {s : Set E} (h : AmpleSet s) (L : E \u2243\u1d2c[\u211d] F) :\n AmpleSet (L '' s)\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.Convex.AmpleSet.image_iff (L94-L98)\ntheorem image_iff {s : Set E} (L : E \u2243\u1d2c[\u211d] F) :\n AmpleSet (L '' s) \u2194 AmpleSet s\n```\n", "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.Analysis.Convex.StdSimplex).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma le_one (s : stdSimplex S X) (x : X) : s x \u2264 1\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.Convex.StdSimplex.stdSimplex (L35-L37)\ndef stdSimplex : Set (\u03b9 \u2192 \ud835\udd5c)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.Convex.StdSimplex.stdSimplex_eq_inter (L38-L41)\ntheorem stdSimplex_eq_inter : stdSimplex \ud835\udd5c \u03b9 = (\u22c2 x, { f | 0 \u2264 f x }) \u2229 { f | \u2211 x, f x = 1 }\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.Convex.StdSimplex.convex_stdSimplex (L42-L48)\ntheorem convex_stdSimplex [IsOrderedRing \ud835\udd5c] : Convex \ud835\udd5c (stdSimplex \ud835\udd5c \u03b9)\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.Convex.StdSimplex.stdSimplex_of_isEmpty_index (L53-L55)\nlemma stdSimplex_of_isEmpty_index [IsEmpty \u03b9] [Nontrivial \ud835\udd5c] : stdSimplex \ud835\udd5c \u03b9 = \u2205\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.Convex.StdSimplex.stdSimplex_unique (L56-L67)\nlemma stdSimplex_unique [ZeroLEOneClass \ud835\udd5c] [Nonempty \u03b9] [Subsingleton \u03b9] :\n stdSimplex \ud835\udd5c \u03b9 = {fun _ \u21a6 1}\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.Convex.StdSimplex.mem_Icc_of_mem_stdSimplex (L68-L73)\ntheorem mem_Icc_of_mem_stdSimplex [IsOrderedAddMonoid \ud835\udd5c]\n {f : \u03b9 \u2192 \ud835\udd5c} (hf : f \u2208 stdSimplex \ud835\udd5c \u03b9) (x) :\n f x \u2208 Icc (0 : \ud835\udd5c) 1\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.Convex.StdSimplex.stdSimplex_subset_Icc (L74-L80)\ntheorem stdSimplex_subset_Icc [IsOrderedAddMonoid \ud835\udd5c] : stdSimplex \ud835\udd5c \u03b9 \u2286 Icc 0 1\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.Convex.StdSimplex.single_mem_stdSimplex (L81-L83)\ntheorem single_mem_stdSimplex (i : \u03b9) : Pi.single i 1 \u2208 stdSimplex \ud835\udd5c \u03b9\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.Convex.AmpleSet.ampleSet_univ (L58-L63)\ntheorem ampleSet_univ {F : Type*} [NormedAddCommGroup F] [NormedSpace \u211d F] :\n AmpleSet (univ : Set F)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.Convex.AmpleSet.AmpleSet (L53-L56)\ndef AmpleSet (s : Set F) : Prop\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.Convex.AmpleSet.ampleSet_empty (L65-L69)\ntheorem ampleSet_empty : AmpleSet (\u2205 : Set F)\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.Convex.AmpleSet.union (L70-L83)\ntheorem union {s t : Set F} (hs : AmpleSet s) (ht : AmpleSet t) : AmpleSet (s \u222a t)\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.Convex.AmpleSet.image (L84-L93)\ntheorem image {s : Set E} (h : AmpleSet s) (L : E \u2243\u1d2c[\u211d] F) :\n AmpleSet (L '' s)\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.Convex.AmpleSet.image_iff (L94-L98)\ntheorem image_iff {s : Set E} (L : E \u2243\u1d2c[\u211d] F) :\n AmpleSet (L '' s) \u2194 AmpleSet s\n```\n[/INST]", "sample_id": "C-Mathlib.Analysis.Convex.StdSimplex.le_one", "source": {"declaration": "Mathlib.Analysis.Convex.StdSimplex.le_one", "file": "Mathlib/Analysis/Convex/StdSimplex.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Analysis.Convex.StdSimplex", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Convex/StdSimplex.lean#L304", "span": "L304-L307"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integrableOn_exp_Iic (L37-L44)\ntheorem integrableOn_exp_Iic (c : \u211d) : IntegrableOn exp (Iic c) := by\nrefine\n integrableOn_Iic_of_intervalIntegral_norm_bounded (exp c) c\n (fun y => intervalIntegrable_exp.1) tendsto_id\n (eventually_of_mem (Iic_mem_atBot 0) fun y _ => ?_)\n simp_rw [norm_of_nonneg (exp_pos _).le, integral_exp, sub_le_self_iff]\n exact (exp_pos _).le", "-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integrableOn_exp_neg_Ioi (L45-L47)\ntheorem integrableOn_exp_neg_Ioi (c : \u211d) : IntegrableOn (fun (x : \u211d) => exp (-x)) (Ioi c) :=\nIff.mp integrableOn_Ici_iff_integrableOn_Ioi (integrableOn_exp_Iic (-c)).comp_neg_Ici", "-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integral_exp_Iic (L48-L54)\ntheorem integral_exp_Iic (c : \u211d) : \u222b x : \u211d in Iic c, exp x = exp c := by\nrefine\n tendsto_nhds_unique\n (intervalIntegral_tendsto_integral_Iic _ (integrableOn_exp_Iic _) tendsto_id) ?_\n simp_rw [integral_exp, show \ud835\udcdd (exp c) = \ud835\udcdd (exp c - 0) by rw [sub_zero]]\n exact tendsto_exp_atBot.const_sub _", "-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integral_exp_Iic_zero (L55-L57)\ntheorem integral_exp_Iic_zero : \u222b x : \u211d in Iic 0, exp x = 1 :=\nexp_zero \u25b8 integral_exp_Iic 0", "-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integral_exp_neg_Ioi (L58-L60)\ntheorem integral_exp_neg_Ioi (c : \u211d) : (\u222b x : \u211d in Ioi c, exp (-x)) = exp (-c) := by\nsimpa only [integral_comp_neg_Ioi] using integral_exp_Iic (-c)", "-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integral_exp_neg_Ioi_zero (L61-L63)\ntheorem integral_exp_neg_Ioi_zero : (\u222b x : \u211d in Ioi 0, exp (-x)) = 1 := by\nsimpa only [neg_zero, exp_zero] using integral_exp_neg_Ioi 0", "-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integrableOn_exp_mul_complex_Ioi (L64-L72)\ntheorem integrableOn_exp_mul_complex_Ioi {a : \u2102} (ha : a.re < 0) (c : \u211d) :\n IntegrableOn (fun x : \u211d => Complex.exp (a * x)) (Ioi c) := by\nrefine (integrable_norm_iff ?_).mp ?_\n \u00b7 apply Continuous.aestronglyMeasurable\n fun_prop\n \u00b7 simpa [Complex.norm_exp] using\n (integrableOn_Ioi_comp_mul_left_iff (fun x => exp (-x)) c (a := -a.re) (by simpa)).mpr <|\n integrableOn_exp_neg_Ioi _", "-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integrableOn_exp_mul_Ioi (L78-L82)\ntheorem integrableOn_exp_mul_Ioi {a : \u211d} (ha : a < 0) (c : \u211d) :\n IntegrableOn (fun x : \u211d => Real.exp (a * x)) (Ioi c) := by\nhave := Integrable.norm <| integrableOn_exp_mul_complex_Ioi (a := a) (by simpa using ha) c\n simpa [Complex.norm_exp] using this", "-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integrableOn_exp_mul_Iic (L83-L87)\ntheorem integrableOn_exp_mul_Iic {a : \u211d} (ha : 0 < a) (c : \u211d) :\n IntegrableOn (fun x : \u211d => Real.exp (a * x)) (Iic c) := by\nhave := Integrable.norm <| integrableOn_exp_mul_complex_Iic (a := a) (by simpa using ha) c\n simpa [Complex.norm_exp] using this", "-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integral_exp_mul_complex_Ioi (L88-L96)\ntheorem integral_exp_mul_complex_Ioi {a : \u2102} (ha : a.re < 0) (c : \u211d) :\n \u222b x : \u211d in Set.Ioi c, Complex.exp (a * x) = - Complex.exp (a * c) / a := by\nrefine tendsto_nhds_unique (intervalIntegral_tendsto_integral_Ioi c\n (integrableOn_exp_mul_complex_Ioi ha c) tendsto_id) ?_\n simp_rw [integral_exp_mul_complex (c := a) (by aesop), id_eq]\n suffices Tendsto (fun x : \u211d \u21a6 Complex.exp (a * x)) atTop (\ud835\udcdd 0) by\n simpa using this.sub_const _ |>.div_const _\n simpa [Complex.tendsto_exp_nhds_zero_iff] using tendsto_const_nhds.neg_mul_atTop ha tendsto_id", "-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integral_exp_mul_complex_Iic (L97-L103)\ntheorem integral_exp_mul_complex_Iic {a : \u2102} (ha : 0 < a.re) (c : \u211d) :\n \u222b x : \u211d in Set.Iic c, Complex.exp (a * x) = Complex.exp (a * c) / a := by\nsimpa [neg_mul, \u2190 mul_neg, \u2190 Complex.ofReal_neg,\n integral_comp_neg_Ioi (f := fun x : \u211d \u21a6 Complex.exp (a * x))]\n using integral_exp_mul_complex_Ioi (a := -a) (by simpa) (-c)\n\nset_option backward.isDefEq.respectTransparency false in", "-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integral_exp_mul_Ioi (L104-L110)\ntheorem integral_exp_mul_Ioi {a : \u211d} (ha : a < 0) (c : \u211d) :\n \u222b x : \u211d in Set.Ioi c, Real.exp (a * x) = - Real.exp (a * c) / a := by\nsimp_rw [Real.exp, \u2190 RCLike.re_to_complex, Complex.ofReal_mul]\n rw [integral_re, integral_exp_mul_complex_Ioi (by simpa using ha), RCLike.re_to_complex,\n RCLike.re_to_complex, Complex.div_ofReal_re, Complex.neg_re]\n exact integrableOn_exp_mul_complex_Ioi (by simpa using ha) _", "-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integral_exp_mul_Iic (L111-L116)\ntheorem integral_exp_mul_Iic {a : \u211d} (ha : 0 < a) (c : \u211d) :\n \u222b x : \u211d in Set.Iic c, Real.exp (a * x) = Real.exp (a * c) / a := by\nsimpa [neg_mul, \u2190 mul_neg, integral_comp_neg_Ioi (f := fun x : \u211d \u21a6 Real.exp (a * x))]\n using integral_exp_mul_Ioi (a := -a) (by simpa) (-c)\n\n/-- If `-m < c`, then `(fun t : \u211d \u21a6 (t + m) ^ a)` is integrable on `(c, \u221e)` for all `a < -1`. -/", "-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integrableOn_add_rpow_Ioi_of_lt (L117-L131)\ntheorem integrableOn_add_rpow_Ioi_of_lt {a c m : \u211d} (ha : a < -1) (hc : -m < c) :\n IntegrableOn (fun (x : \u211d) \u21a6 (x + m) ^ a) (Ioi c) := by\nhave hd : \u2200 x \u2208 Ici c, HasDerivAt (fun t \u21a6 (t + m) ^ (a + 1) / (a + 1)) ((x + m) ^ a) x := by\n intro x hx\n convert (((hasDerivAt_id _).add_const _).rpow_const _).div_const _ using 1\n \u00b7 simp [show a + 1 \u2260 0 by linarith]\n left; linarith [mem_Ici.mp hx, id_eq x]\n have ht : Tendsto (fun t \u21a6 ((t + m) ^ (a + 1)) / (a + 1)) atTop (nhds (0 / (a + 1))) := by\n rw [\u2190 neg_neg (a + 1)]\n exact (tendsto_rpow_neg_atTop (by linarith)).comp\n (tendsto_atTop_add_const_right _ m tendsto_id) |>.div_const _\n exact integrableOn_Ioi_deriv_of_nonneg' hd\n (fun t ht \u21a6 rpow_nonneg (by linarith [mem_Ioi.mp ht]) a) ht\n\n/-- If `0 < c`, then `(fun t : \u211d \u21a6 t ^ a)` is integrable on `(c, \u221e)` for all `a < -1`. -/", "-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integrableOn_Ioi_rpow_of_lt (L132-L135)\ntheorem integrableOn_Ioi_rpow_of_lt {a c : \u211d} (ha : a < -1) (hc : 0 < c) :\n IntegrableOn (fun t : \u211d \u21a6 t ^ a) (Ioi c) := by\nsimpa using integrableOn_add_rpow_Ioi_of_lt ha (by simpa : -0 < c)", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh (L61-L63)\ndef arcosh (x : \u211d) :=\nlog (x + \u221a(x ^ 2 - 1))", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_zero (L69-L70)\ntheorem arcosh_zero : arcosh 1 = 0 := by simp [arcosh]", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.coshOpenPartialHomeomorph (L139-L152)\ndef coshOpenPartialHomeomorph : OpenPartialHomeomorph \u211d \u211d where\n toFun := cosh\ninvFun := arcosh\n source := Ioi 0\n target := Ioi 1\n map_source' _ hr := one_lt_cosh.mpr (ne_of_lt hr).symm\n map_target' _ hr := arcosh_pos hr\n left_inv' _ hr := arcosh_cosh (le_of_lt hr)\n right_inv' _ hr := cosh_arcosh (le_of_lt hr)\n open_source := isOpen_Ioi\n open_target := isOpen_Ioi\n continuousOn_toFun := by fun_prop\n continuousOn_invFun := continuousOn_arcosh.mono Ioi_subset_Ici_self", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.analyticAt_arcosh (L180-L183)\nlemma analyticAt_arcosh {x : \u211d} (hx : x \u2208 Ioi 1) : AnalyticAt \u211d arcosh x :=\n(contDiffAt_arcosh hx).analyticAt\n\n/-- The function `Real.arcosh` is real analytic. -/", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.continuousOn_arcosh (L133-L138)\ntheorem continuousOn_arcosh : ContinuousOn arcosh (Ici 1) :=\nhave {x : \u211d} (hx : x \u2208 Ici 1) : 0 < x + \u221a(x ^ 2 - 1) :=\n add_pos_of_pos_of_nonneg (show 0 < x by grind) (sqrt_nonneg _)\n continuousOn_log.comp (by fun_prop) (by grind [MapsTo])\n\n/-- `Real.cosh` as an `OpenPartialHomeomorph` from $(0, \u221e)$ to $(1, \u221e)$. -/", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.exp_arcosh (L64-L67)\ntheorem exp_arcosh {x : \u211d} (hx : 1 \u2264 x) : exp (arcosh x) = x + \u221a(x ^ 2 - 1) := by\napply exp_log\n positivity", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.coshPartialEquiv (L123-L132)\ndef coshPartialEquiv : PartialEquiv \u211d \u211d where\n toFun := cosh\ninvFun := arcosh\n source := Ici 0\n target := Ici 1\n map_source' r _ := one_le_cosh r\n map_target' _ hr := arcosh_nonneg hr\n left_inv' _ hr := arcosh_cosh hr\n right_inv' _ hr := cosh_arcosh hr", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.contDiffAt_arcosh (L169-L174)\ntheorem contDiffAt_arcosh {n : WithTop \u2115\u221e} {x : \u211d} (hx : x \u2208 Ioi 1) : ContDiffAt \u211d n arcosh x := by\nrefine coshOpenPartialHomeomorph.contDiffAt_symm_deriv ?_ hx (hasDerivAt_cosh _)\n contDiff_cosh.contDiffAt\n rw [ne_eq, sinh_eq_zero]\n exact (arcosh_pos hx).ne'", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.differentiableOn_arcosh (L166-L168)\ntheorem differentiableOn_arcosh : DifferentiableOn \u211d arcosh (Ioi 1) := fun _ hx =>\n(differentiableAt_arcosh hx).differentiableWithinAt", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.analyticWithinAt_arcosh (L184-L188)\nlemma analyticWithinAt_arcosh {s : Set \u211d} {x : \u211d} (hx : x \u2208 Ioi 1) :\n AnalyticWithinAt \u211d arcosh s x :=\n(contDiffAt_arcosh hx).contDiffWithinAt.analyticWithinAt\n\n/-- The function `Real.arcosh` is real analytic. -/", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_pos (L103-L109)\ntheorem arcosh_pos {x : \u211d} (hx : 1 < x) : 0 < arcosh x := by\napply log_pos\n calc\n 1 < x + 0 := by simpa\n _ \u2264 x + \u221a(x ^ 2 - 1) := by gcongr; positivity\n\n/-- This holds for `Ioi 0` instead of only `Ici 1` due to junk values. -/", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.hasDerivAt_arcosh (L160-L162)\ntheorem hasDerivAt_arcosh {x : \u211d} (hx : x \u2208 Ioi 1) : HasDerivAt arcosh (\u221a(x ^ 2 - 1))\u207b\u00b9 x :=\n(hasStrictDerivAt_arcosh hx).hasDerivAt", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_lt_arcosh (L119-L122)\ntheorem arcosh_lt_arcosh {x y : \u211d} (hx : 0 < x) (hy : 0 < y) : arcosh x < arcosh y \u2194 x < y :=\nstrictMonoOn_arcosh.lt_iff_lt hx hy\n\n/-- `Real.cosh` as a `PartialEquiv` from $[0, \u221e)$ to $[1, \u221e)$. -/", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_cosh (L93-L96)\ntheorem arcosh_cosh {x : \u211d} (hx : 0 \u2264 x) : arcosh (cosh x) = x := by\nrw [arcosh, \u2190 exp_eq_exp, exp_log (by positivity), \u2190 eq_sub_iff_add_eq', exp_sub_cosh,\n \u2190 sq_eq_sq\u2080 (sqrt_nonneg _) (sinh_nonneg_iff.mpr hx), \u2190 sinh_sq, sq_sqrt (pow_two_nonneg _)]", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_eq_zero_iff (L81-L84)\ntheorem arcosh_eq_zero_iff {x : \u211d} (hx : 1 \u2264 x) : arcosh x = 0 \u2194 x = 1 := by\nrw [\u2190 exp_injective.eq_iff, exp_arcosh hx, exp_zero]\n grind", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_nonneg (L97-L102)\ntheorem arcosh_nonneg {x : \u211d} (hx : 1 \u2264 x) : 0 \u2264 arcosh x := by\napply log_nonneg\n calc\n 1 \u2264 x + 0 := by simpa\n _ \u2264 x + \u221a(x ^ 2 - 1) := by gcongr; positivity", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.tanh_arcosh (L89-L92)\ntheorem tanh_arcosh {x : \u211d} (hx : 1 \u2264 x) : tanh (arcosh x) = \u221a(x ^ 2 - 1) / x := by\nrw [tanh_eq_sinh_div_cosh, sinh_arcosh hx, cosh_arcosh hx]\n\n/-- `arcosh` is the left inverse of `cosh` over $[0, \u221e)$. -/", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_le_arcosh (L115-L118)\ntheorem arcosh_le_arcosh {x y : \u211d} (hx : 0 < x) (hy : 0 < y) : arcosh x \u2264 arcosh y \u2194 x \u2264 y :=\nstrictMonoOn_arcosh.le_iff_le hx hy\n\n/-- This holds for `0 < x, y \u2264 1` due to junk values. -/", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.hasStrictDerivAt_arcosh (L153-L159)\ntheorem hasStrictDerivAt_arcosh {x : \u211d} (hx : x \u2208 Ioi 1) :\n HasStrictDerivAt arcosh (\u221a(x ^ 2 - 1))\u207b\u00b9 x := by\nrw [\u2190 sinh_arcosh (le_of_lt hx)]\n refine coshOpenPartialHomeomorph.hasStrictDerivAt_symm hx ?_ (hasStrictDerivAt_cosh _)\n rw [ne_eq, sinh_eq_zero]\n exact ne_of_gt (arcosh_pos hx)", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.sinh_arcosh (L85-L88)\ntheorem sinh_arcosh {x : \u211d} (hx : 1 \u2264 x) : sinh (arcosh x) = \u221a(x ^ 2 - 1) := by\nrw [arcosh, sinh_eq, exp_neg, exp_log (by positivity), add_sqrt_self_sq_sub_one_inv hx]\n ring", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.cosh_arcosh (L77-L80)\ntheorem cosh_arcosh {x : \u211d} (hx : 1 \u2264 x) : cosh (arcosh x) = x := by\nrw [arcosh, cosh_eq, exp_neg, exp_log (by positivity), add_sqrt_self_sq_sub_one_inv hx]\n ring", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.contDiffOn_arcosh (L175-L178)\ntheorem contDiffOn_arcosh {n : WithTop \u2115\u221e} : ContDiffOn \u211d n arcosh (Ioi 1) := fun _ hx =>\n(contDiffAt_arcosh hx).contDiffWithinAt\n\n/-- The function `Real.arcosh` is real analytic. -/", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.add_sqrt_self_sq_sub_one_inv (L71-L76)\nlemma add_sqrt_self_sq_sub_one_inv {x : \u211d} (hx : 1 \u2264 x) :\n (x + \u221a(x ^ 2 - 1))\u207b\u00b9 = x - \u221a(x ^ 2 - 1) := by\napply inv_eq_of_mul_eq_one_right\n rw [\u2190 pow_two_sub_pow_two, sq_sqrt (sub_nonneg_of_le (one_le_pow\u2080 hx)), sub_sub_cancel]\n\n/-- `arcosh` is the right inverse of `cosh` over $[1, \u221e)$. -/", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.differentiableAt_arcosh (L163-L165)\ntheorem differentiableAt_arcosh {x : \u211d} (hx : x \u2208 Ioi 1) : DifferentiableAt \u211d arcosh x :=\n(hasDerivAt_arcosh hx).differentiableAt", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.strictMonoOn_arcosh (L110-L114)\ntheorem strictMonoOn_arcosh : StrictMonoOn arcosh (Ioi 0) := by\nrefine strictMonoOn_log.comp ?_ fun x (hx : 0 < x) \u21a6 show 0 < x + \u221a(x ^ 2 - 1) by positivity\n exact strictMonoOn_id.add_monotone fun x (hx : 0 < x) y (hy : 0 < y) hxy \u21a6 by gcongr\n\n/-- This holds for `0 < x, y \u2264 1` due to junk values. -/"], "statement": "theorem integrableOn_exp_mul_complex_Iic {a : \u2102} (ha : 0 < a.re) (c : \u211d) :\n IntegrableOn (fun x : \u211d => Complex.exp (a * x)) (Iic c)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 14830, "declarations_count": 1363, "diagnostics_count": 0, "duplicate_fingerprint": "87fc0143f6b3619c", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 5904, "lean_code_chars": 13310, "lean_code_ratio": 0.8975, "length_bucket": "medium", "line_count": 401, "natural_language_chars": 1520, "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.Analysis.SpecialFunctions.ImproperIntegrals).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem integrableOn_exp_mul_complex_Iic {a : \u2102} (ha : 0 < a.re) (c : \u211d) :\n IntegrableOn (fun x : \u211d => Complex.exp (a * x)) (Iic c)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integrableOn_exp_Iic (L37-L44)\ntheorem integrableOn_exp_Iic (c : \u211d) : IntegrableOn exp (Iic c) := by\nrefine\n integrableOn_Iic_of_intervalIntegral_norm_bounded (exp c) c\n (fun y => intervalIntegrable_exp.1) tendsto_id\n (eventually_of_mem (Iic_mem_atBot 0) fun y _ => ?_)\n simp_rw [norm_of_nonneg (exp_pos _).le, integral_exp, sub_le_self_iff]\n exact (exp_pos _).le\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integrableOn_exp_neg_Ioi (L45-L47)\ntheorem integrableOn_exp_neg_Ioi (c : \u211d) : IntegrableOn (fun (x : \u211d) => exp (-x)) (Ioi c) :=\nIff.mp integrableOn_Ici_iff_integrableOn_Ioi (integrableOn_exp_Iic (-c)).comp_neg_Ici\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integral_exp_Iic (L48-L54)\ntheorem integral_exp_Iic (c : \u211d) : \u222b x : \u211d in Iic c, exp x = exp c := by\nrefine\n tendsto_nhds_unique\n (intervalIntegral_tendsto_integral_Iic _ (integrableOn_exp_Iic _) tendsto_id) ?_\n simp_rw [integral_exp, show \ud835\udcdd (exp c) = \ud835\udcdd (exp c - 0) by rw [sub_zero]]\n exact tendsto_exp_atBot.const_sub _\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integral_exp_Iic_zero (L55-L57)\ntheorem integral_exp_Iic_zero : \u222b x : \u211d in Iic 0, exp x = 1 :=\nexp_zero \u25b8 integral_exp_Iic 0\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integral_exp_neg_Ioi (L58-L60)\ntheorem integral_exp_neg_Ioi (c : \u211d) : (\u222b x : \u211d in Ioi c, exp (-x)) = exp (-c) := by\nsimpa only [integral_comp_neg_Ioi] using integral_exp_Iic (-c)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integral_exp_neg_Ioi_zero (L61-L63)\ntheorem integral_exp_neg_Ioi_zero : (\u222b x : \u211d in Ioi 0, exp (-x)) = 1 := by\nsimpa only [neg_zero, exp_zero] using integral_exp_neg_Ioi 0\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integrableOn_exp_mul_complex_Ioi (L64-L72)\ntheorem integrableOn_exp_mul_complex_Ioi {a : \u2102} (ha : a.re < 0) (c : \u211d) :\n IntegrableOn (fun x : \u211d => Complex.exp (a * x)) (Ioi c) := by\nrefine (integrable_norm_iff ?_).mp ?_\n \u00b7 apply Continuous.aestronglyMeasurable\n fun_prop\n \u00b7 simpa [Complex.norm_exp] using\n (integrableOn_Ioi_comp_mul_left_iff (fun x => exp (-x)) c (a := -a.re) (by simpa)).mpr <|\n integrableOn_exp_neg_Ioi _\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integrableOn_exp_mul_Ioi (L78-L82)\ntheorem integrableOn_exp_mul_Ioi {a : \u211d} (ha : a < 0) (c : \u211d) :\n IntegrableOn (fun x : \u211d => Real.exp (a * x)) (Ioi c) := by\nhave := Integrable.norm <| integrableOn_exp_mul_complex_Ioi (a := a) (by simpa using ha) c\n simpa [Complex.norm_exp] using this\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integrableOn_exp_mul_Iic (L83-L87)\ntheorem integrableOn_exp_mul_Iic {a : \u211d} (ha : 0 < a) (c : \u211d) :\n IntegrableOn (fun x : \u211d => Real.exp (a * x)) (Iic c) := by\nhave := Integrable.norm <| integrableOn_exp_mul_complex_Iic (a := a) (by simpa using ha) c\n simpa [Complex.norm_exp] using this\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integral_exp_mul_complex_Ioi (L88-L96)\ntheorem integral_exp_mul_complex_Ioi {a : \u2102} (ha : a.re < 0) (c : \u211d) :\n \u222b x : \u211d in Set.Ioi c, Complex.exp (a * x) = - Complex.exp (a * c) / a := by\nrefine tendsto_nhds_unique (intervalIntegral_tendsto_integral_Ioi c\n (integrableOn_exp_mul_complex_Ioi ha c) tendsto_id) ?_\n simp_rw [integral_exp_mul_complex (c := a) (by aesop), id_eq]\n suffices Tendsto (fun x : \u211d \u21a6 Complex.exp (a * x)) atTop (\ud835\udcdd 0) by\n simpa using this.sub_const _ |>.div_const _\n simpa [Complex.tendsto_exp_nhds_zero_iff] using tendsto_const_nhds.neg_mul_atTop ha tendsto_id\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integral_exp_mul_complex_Iic (L97-L103)\ntheorem integral_exp_mul_complex_Iic {a : \u2102} (ha : 0 < a.re) (c : \u211d) :\n \u222b x : \u211d in Set.Iic c, Complex.exp (a * x) = Complex.exp (a * c) / a := by\nsimpa [neg_mul, \u2190 mul_neg, \u2190 Complex.ofReal_neg,\n integral_comp_neg_Ioi (f := fun x : \u211d \u21a6 Complex.exp (a * x))]\n using integral_exp_mul_complex_Ioi (a := -a) (by simpa) (-c)\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integral_exp_mul_Ioi (L104-L110)\ntheorem integral_exp_mul_Ioi {a : \u211d} (ha : a < 0) (c : \u211d) :\n \u222b x : \u211d in Set.Ioi c, Real.exp (a * x) = - Real.exp (a * c) / a := by\nsimp_rw [Real.exp, \u2190 RCLike.re_to_complex, Complex.ofReal_mul]\n rw [integral_re, integral_exp_mul_complex_Ioi (by simpa using ha), RCLike.re_to_complex,\n RCLike.re_to_complex, Complex.div_ofReal_re, Complex.neg_re]\n exact integrableOn_exp_mul_complex_Ioi (by simpa using ha) _\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integral_exp_mul_Iic (L111-L116)\ntheorem integral_exp_mul_Iic {a : \u211d} (ha : 0 < a) (c : \u211d) :\n \u222b x : \u211d in Set.Iic c, Real.exp (a * x) = Real.exp (a * c) / a := by\nsimpa [neg_mul, \u2190 mul_neg, integral_comp_neg_Ioi (f := fun x : \u211d \u21a6 Real.exp (a * x))]\n using integral_exp_mul_Ioi (a := -a) (by simpa) (-c)\n\n/-- If `-m < c`, then `(fun t : \u211d \u21a6 (t + m) ^ a)` is integrable on `(c, \u221e)` for all `a < -1`. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integrableOn_add_rpow_Ioi_of_lt (L117-L131)\ntheorem integrableOn_add_rpow_Ioi_of_lt {a c m : \u211d} (ha : a < -1) (hc : -m < c) :\n IntegrableOn (fun (x : \u211d) \u21a6 (x + m) ^ a) (Ioi c) := by\nhave hd : \u2200 x \u2208 Ici c, HasDerivAt (fun t \u21a6 (t + m) ^ (a + 1) / (a + 1)) ((x + m) ^ a) x := by\n intro x hx\n convert (((hasDerivAt_id _).add_const _).rpow_const _).div_const _ using 1\n \u00b7 simp [show a + 1 \u2260 0 by linarith]\n left; linarith [mem_Ici.mp hx, id_eq x]\n have ht : Tendsto (fun t \u21a6 ((t + m) ^ (a + 1)) / (a + 1)) atTop (nhds (0 / (a + 1))) := by\n rw [\u2190 neg_neg (a + 1)]\n exact (tendsto_rpow_neg_atTop (by linarith)).comp\n (tendsto_atTop_add_const_right _ m tendsto_id) |>.div_const _\n exact integrableOn_Ioi_deriv_of_nonneg' hd\n (fun t ht \u21a6 rpow_nonneg (by linarith [mem_Ioi.mp ht]) a) ht\n\n/-- If `0 < c`, then `(fun t : \u211d \u21a6 t ^ a)` is integrable on `(c, \u221e)` for all `a < -1`. -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integrableOn_Ioi_rpow_of_lt (L132-L135)\ntheorem integrableOn_Ioi_rpow_of_lt {a c : \u211d} (ha : a < -1) (hc : 0 < c) :\n IntegrableOn (fun t : \u211d \u21a6 t ^ a) (Ioi c) := by\nsimpa using integrableOn_add_rpow_Ioi_of_lt ha (by simpa : -0 < c)\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh (L61-L63)\ndef arcosh (x : \u211d) :=\nlog (x + \u221a(x ^ 2 - 1))\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_zero (L69-L70)\ntheorem arcosh_zero : arcosh 1 = 0 := by simp [arcosh]\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.coshOpenPartialHomeomorph (L139-L152)\ndef coshOpenPartialHomeomorph : OpenPartialHomeomorph \u211d \u211d where\n toFun := cosh\ninvFun := arcosh\n source := Ioi 0\n target := Ioi 1\n map_source' _ hr := one_lt_cosh.mpr (ne_of_lt hr).symm\n map_target' _ hr := arcosh_pos hr\n left_inv' _ hr := arcosh_cosh (le_of_lt hr)\n right_inv' _ hr := cosh_arcosh (le_of_lt hr)\n open_source := isOpen_Ioi\n open_target := isOpen_Ioi\n continuousOn_toFun := by fun_prop\n continuousOn_invFun := continuousOn_arcosh.mono Ioi_subset_Ici_self\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.analyticAt_arcosh (L180-L183)\nlemma analyticAt_arcosh {x : \u211d} (hx : x \u2208 Ioi 1) : AnalyticAt \u211d arcosh x :=\n(contDiffAt_arcosh hx).analyticAt\n\n/-- The function `Real.arcosh` is real analytic. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.continuousOn_arcosh (L133-L138)\ntheorem continuousOn_arcosh : ContinuousOn arcosh (Ici 1) :=\nhave {x : \u211d} (hx : x \u2208 Ici 1) : 0 < x + \u221a(x ^ 2 - 1) :=\n add_pos_of_pos_of_nonneg (show 0 < x by grind) (sqrt_nonneg _)\n continuousOn_log.comp (by fun_prop) (by grind [MapsTo])\n\n/-- `Real.cosh` as an `OpenPartialHomeomorph` from $(0, \u221e)$ to $(1, \u221e)$. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.exp_arcosh (L64-L67)\ntheorem exp_arcosh {x : \u211d} (hx : 1 \u2264 x) : exp (arcosh x) = x + \u221a(x ^ 2 - 1) := by\napply exp_log\n positivity\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.coshPartialEquiv (L123-L132)\ndef coshPartialEquiv : PartialEquiv \u211d \u211d where\n toFun := cosh\ninvFun := arcosh\n source := Ici 0\n target := Ici 1\n map_source' r _ := one_le_cosh r\n map_target' _ hr := arcosh_nonneg hr\n left_inv' _ hr := arcosh_cosh hr\n right_inv' _ hr := cosh_arcosh hr\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.contDiffAt_arcosh (L169-L174)\ntheorem contDiffAt_arcosh {n : WithTop \u2115\u221e} {x : \u211d} (hx : x \u2208 Ioi 1) : ContDiffAt \u211d n arcosh x := by\nrefine coshOpenPartialHomeomorph.contDiffAt_symm_deriv ?_ hx (hasDerivAt_cosh _)\n contDiff_cosh.contDiffAt\n rw [ne_eq, sinh_eq_zero]\n exact (arcosh_pos hx).ne'\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.differentiableOn_arcosh (L166-L168)\ntheorem differentiableOn_arcosh : DifferentiableOn \u211d arcosh (Ioi 1) := fun _ hx =>\n(differentiableAt_arcosh hx).differentiableWithinAt\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.analyticWithinAt_arcosh (L184-L188)\nlemma analyticWithinAt_arcosh {s : Set \u211d} {x : \u211d} (hx : x \u2208 Ioi 1) :\n AnalyticWithinAt \u211d arcosh s x :=\n(contDiffAt_arcosh hx).contDiffWithinAt.analyticWithinAt\n\n/-- The function `Real.arcosh` is real analytic. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_pos (L103-L109)\ntheorem arcosh_pos {x : \u211d} (hx : 1 < x) : 0 < arcosh x := by\napply log_pos\n calc\n 1 < x + 0 := by simpa\n _ \u2264 x + \u221a(x ^ 2 - 1) := by gcongr; positivity\n\n/-- This holds for `Ioi 0` instead of only `Ici 1` due to junk values. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.hasDerivAt_arcosh (L160-L162)\ntheorem hasDerivAt_arcosh {x : \u211d} (hx : x \u2208 Ioi 1) : HasDerivAt arcosh (\u221a(x ^ 2 - 1))\u207b\u00b9 x :=\n(hasStrictDerivAt_arcosh hx).hasDerivAt\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_lt_arcosh (L119-L122)\ntheorem arcosh_lt_arcosh {x y : \u211d} (hx : 0 < x) (hy : 0 < y) : arcosh x < arcosh y \u2194 x < y :=\nstrictMonoOn_arcosh.lt_iff_lt hx hy\n\n/-- `Real.cosh` as a `PartialEquiv` from $[0, \u221e)$ to $[1, \u221e)$. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_cosh (L93-L96)\ntheorem arcosh_cosh {x : \u211d} (hx : 0 \u2264 x) : arcosh (cosh x) = x := by\nrw [arcosh, \u2190 exp_eq_exp, exp_log (by positivity), \u2190 eq_sub_iff_add_eq', exp_sub_cosh,\n \u2190 sq_eq_sq\u2080 (sqrt_nonneg _) (sinh_nonneg_iff.mpr hx), \u2190 sinh_sq, sq_sqrt (pow_two_nonneg _)]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_eq_zero_iff (L81-L84)\ntheorem arcosh_eq_zero_iff {x : \u211d} (hx : 1 \u2264 x) : arcosh x = 0 \u2194 x = 1 := by\nrw [\u2190 exp_injective.eq_iff, exp_arcosh hx, exp_zero]\n grind\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_nonneg (L97-L102)\ntheorem arcosh_nonneg {x : \u211d} (hx : 1 \u2264 x) : 0 \u2264 arcosh x := by\napply log_nonneg\n calc\n 1 \u2264 x + 0 := by simpa\n _ \u2264 x + \u221a(x ^ 2 - 1) := by gcongr; positivity\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.tanh_arcosh (L89-L92)\ntheorem tanh_arcosh {x : \u211d} (hx : 1 \u2264 x) : tanh (arcosh x) = \u221a(x ^ 2 - 1) / x := by\nrw [tanh_eq_sinh_div_cosh, sinh_arcosh hx, cosh_arcosh hx]\n\n/-- `arcosh` is the left inverse of `cosh` over $[0, \u221e)$. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_le_arcosh (L115-L118)\ntheorem arcosh_le_arcosh {x y : \u211d} (hx : 0 < x) (hy : 0 < y) : arcosh x \u2264 arcosh y \u2194 x \u2264 y :=\nstrictMonoOn_arcosh.le_iff_le hx hy\n\n/-- This holds for `0 < x, y \u2264 1` due to junk values. -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.hasStrictDerivAt_arcosh (L153-L159)\ntheorem hasStrictDerivAt_arcosh {x : \u211d} (hx : x \u2208 Ioi 1) :\n HasStrictDerivAt arcosh (\u221a(x ^ 2 - 1))\u207b\u00b9 x := by\nrw [\u2190 sinh_arcosh (le_of_lt hx)]\n refine coshOpenPartialHomeomorph.hasStrictDerivAt_symm hx ?_ (hasStrictDerivAt_cosh _)\n rw [ne_eq, sinh_eq_zero]\n exact ne_of_gt (arcosh_pos hx)\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.sinh_arcosh (L85-L88)\ntheorem sinh_arcosh {x : \u211d} (hx : 1 \u2264 x) : sinh (arcosh x) = \u221a(x ^ 2 - 1) := by\nrw [arcosh, sinh_eq, exp_neg, exp_log (by positivity), add_sqrt_self_sq_sub_one_inv hx]\n ring\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.cosh_arcosh (L77-L80)\ntheorem cosh_arcosh {x : \u211d} (hx : 1 \u2264 x) : cosh (arcosh x) = x := by\nrw [arcosh, cosh_eq, exp_neg, exp_log (by positivity), add_sqrt_self_sq_sub_one_inv hx]\n ring\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.contDiffOn_arcosh (L175-L178)\ntheorem contDiffOn_arcosh {n : WithTop \u2115\u221e} : ContDiffOn \u211d n arcosh (Ioi 1) := fun _ hx =>\n(contDiffAt_arcosh hx).contDiffWithinAt\n\n/-- The function `Real.arcosh` is real analytic. -/\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.add_sqrt_self_sq_sub_one_inv (L71-L76)\nlemma add_sqrt_self_sq_sub_one_inv {x : \u211d} (hx : 1 \u2264 x) :\n (x + \u221a(x ^ 2 - 1))\u207b\u00b9 = x - \u221a(x ^ 2 - 1) := by\napply inv_eq_of_mul_eq_one_right\n rw [\u2190 pow_two_sub_pow_two, sq_sqrt (sub_nonneg_of_le (one_le_pow\u2080 hx)), sub_sub_cancel]\n\n/-- `arcosh` is the right inverse of `cosh` over $[1, \u221e)$. -/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.differentiableAt_arcosh (L163-L165)\ntheorem differentiableAt_arcosh {x : \u211d} (hx : x \u2208 Ioi 1) : DifferentiableAt \u211d arcosh x :=\n(hasDerivAt_arcosh hx).differentiableAt\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.strictMonoOn_arcosh (L110-L114)\ntheorem strictMonoOn_arcosh : StrictMonoOn arcosh (Ioi 0) := by\nrefine strictMonoOn_log.comp ?_ fun x (hx : 0 < x) \u21a6 show 0 < x + \u221a(x ^ 2 - 1) by positivity\n exact strictMonoOn_id.add_monotone fun x (hx : 0 < x) y (hy : 0 < y) hxy \u21a6 by gcongr\n\n/-- This holds for `0 < x, y \u2264 1` due to junk values. -/\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.Analysis.SpecialFunctions.ImproperIntegrals).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem integrableOn_exp_mul_complex_Iic {a : \u2102} (ha : 0 < a.re) (c : \u211d) :\n IntegrableOn (fun x : \u211d => Complex.exp (a * x)) (Iic c)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integrableOn_exp_Iic (L37-L44)\ntheorem integrableOn_exp_Iic (c : \u211d) : IntegrableOn exp (Iic c) := by\nrefine\n integrableOn_Iic_of_intervalIntegral_norm_bounded (exp c) c\n (fun y => intervalIntegrable_exp.1) tendsto_id\n (eventually_of_mem (Iic_mem_atBot 0) fun y _ => ?_)\n simp_rw [norm_of_nonneg (exp_pos _).le, integral_exp, sub_le_self_iff]\n exact (exp_pos _).le\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integrableOn_exp_neg_Ioi (L45-L47)\ntheorem integrableOn_exp_neg_Ioi (c : \u211d) : IntegrableOn (fun (x : \u211d) => exp (-x)) (Ioi c) :=\nIff.mp integrableOn_Ici_iff_integrableOn_Ioi (integrableOn_exp_Iic (-c)).comp_neg_Ici\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integral_exp_Iic (L48-L54)\ntheorem integral_exp_Iic (c : \u211d) : \u222b x : \u211d in Iic c, exp x = exp c := by\nrefine\n tendsto_nhds_unique\n (intervalIntegral_tendsto_integral_Iic _ (integrableOn_exp_Iic _) tendsto_id) ?_\n simp_rw [integral_exp, show \ud835\udcdd (exp c) = \ud835\udcdd (exp c - 0) by rw [sub_zero]]\n exact tendsto_exp_atBot.const_sub _\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integral_exp_Iic_zero (L55-L57)\ntheorem integral_exp_Iic_zero : \u222b x : \u211d in Iic 0, exp x = 1 :=\nexp_zero \u25b8 integral_exp_Iic 0\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integral_exp_neg_Ioi (L58-L60)\ntheorem integral_exp_neg_Ioi (c : \u211d) : (\u222b x : \u211d in Ioi c, exp (-x)) = exp (-c) := by\nsimpa only [integral_comp_neg_Ioi] using integral_exp_Iic (-c)\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integral_exp_neg_Ioi_zero (L61-L63)\ntheorem integral_exp_neg_Ioi_zero : (\u222b x : \u211d in Ioi 0, exp (-x)) = 1 := by\nsimpa only [neg_zero, exp_zero] using integral_exp_neg_Ioi 0\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integrableOn_exp_mul_complex_Ioi (L64-L72)\ntheorem integrableOn_exp_mul_complex_Ioi {a : \u2102} (ha : a.re < 0) (c : \u211d) :\n IntegrableOn (fun x : \u211d => Complex.exp (a * x)) (Ioi c) := by\nrefine (integrable_norm_iff ?_).mp ?_\n \u00b7 apply Continuous.aestronglyMeasurable\n fun_prop\n \u00b7 simpa [Complex.norm_exp] using\n (integrableOn_Ioi_comp_mul_left_iff (fun x => exp (-x)) c (a := -a.re) (by simpa)).mpr <|\n integrableOn_exp_neg_Ioi _\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integrableOn_exp_mul_Ioi (L78-L82)\ntheorem integrableOn_exp_mul_Ioi {a : \u211d} (ha : a < 0) (c : \u211d) :\n IntegrableOn (fun x : \u211d => Real.exp (a * x)) (Ioi c) := by\nhave := Integrable.norm <| integrableOn_exp_mul_complex_Ioi (a := a) (by simpa using ha) c\n simpa [Complex.norm_exp] using this\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integrableOn_exp_mul_Iic (L83-L87)\ntheorem integrableOn_exp_mul_Iic {a : \u211d} (ha : 0 < a) (c : \u211d) :\n IntegrableOn (fun x : \u211d => Real.exp (a * x)) (Iic c) := by\nhave := Integrable.norm <| integrableOn_exp_mul_complex_Iic (a := a) (by simpa using ha) c\n simpa [Complex.norm_exp] using this\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integral_exp_mul_complex_Ioi (L88-L96)\ntheorem integral_exp_mul_complex_Ioi {a : \u2102} (ha : a.re < 0) (c : \u211d) :\n \u222b x : \u211d in Set.Ioi c, Complex.exp (a * x) = - Complex.exp (a * c) / a := by\nrefine tendsto_nhds_unique (intervalIntegral_tendsto_integral_Ioi c\n (integrableOn_exp_mul_complex_Ioi ha c) tendsto_id) ?_\n simp_rw [integral_exp_mul_complex (c := a) (by aesop), id_eq]\n suffices Tendsto (fun x : \u211d \u21a6 Complex.exp (a * x)) atTop (\ud835\udcdd 0) by\n simpa using this.sub_const _ |>.div_const _\n simpa [Complex.tendsto_exp_nhds_zero_iff] using tendsto_const_nhds.neg_mul_atTop ha tendsto_id\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integral_exp_mul_complex_Iic (L97-L103)\ntheorem integral_exp_mul_complex_Iic {a : \u2102} (ha : 0 < a.re) (c : \u211d) :\n \u222b x : \u211d in Set.Iic c, Complex.exp (a * x) = Complex.exp (a * c) / a := by\nsimpa [neg_mul, \u2190 mul_neg, \u2190 Complex.ofReal_neg,\n integral_comp_neg_Ioi (f := fun x : \u211d \u21a6 Complex.exp (a * x))]\n using integral_exp_mul_complex_Ioi (a := -a) (by simpa) (-c)\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integral_exp_mul_Ioi (L104-L110)\ntheorem integral_exp_mul_Ioi {a : \u211d} (ha : a < 0) (c : \u211d) :\n \u222b x : \u211d in Set.Ioi c, Real.exp (a * x) = - Real.exp (a * c) / a := by\nsimp_rw [Real.exp, \u2190 RCLike.re_to_complex, Complex.ofReal_mul]\n rw [integral_re, integral_exp_mul_complex_Ioi (by simpa using ha), RCLike.re_to_complex,\n RCLike.re_to_complex, Complex.div_ofReal_re, Complex.neg_re]\n exact integrableOn_exp_mul_complex_Ioi (by simpa using ha) _\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integral_exp_mul_Iic (L111-L116)\ntheorem integral_exp_mul_Iic {a : \u211d} (ha : 0 < a) (c : \u211d) :\n \u222b x : \u211d in Set.Iic c, Real.exp (a * x) = Real.exp (a * c) / a := by\nsimpa [neg_mul, \u2190 mul_neg, integral_comp_neg_Ioi (f := fun x : \u211d \u21a6 Real.exp (a * x))]\n using integral_exp_mul_Ioi (a := -a) (by simpa) (-c)\n\n/-- If `-m < c`, then `(fun t : \u211d \u21a6 (t + m) ^ a)` is integrable on `(c, \u221e)` for all `a < -1`. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integrableOn_add_rpow_Ioi_of_lt (L117-L131)\ntheorem integrableOn_add_rpow_Ioi_of_lt {a c m : \u211d} (ha : a < -1) (hc : -m < c) :\n IntegrableOn (fun (x : \u211d) \u21a6 (x + m) ^ a) (Ioi c) := by\nhave hd : \u2200 x \u2208 Ici c, HasDerivAt (fun t \u21a6 (t + m) ^ (a + 1) / (a + 1)) ((x + m) ^ a) x := by\n intro x hx\n convert (((hasDerivAt_id _).add_const _).rpow_const _).div_const _ using 1\n \u00b7 simp [show a + 1 \u2260 0 by linarith]\n left; linarith [mem_Ici.mp hx, id_eq x]\n have ht : Tendsto (fun t \u21a6 ((t + m) ^ (a + 1)) / (a + 1)) atTop (nhds (0 / (a + 1))) := by\n rw [\u2190 neg_neg (a + 1)]\n exact (tendsto_rpow_neg_atTop (by linarith)).comp\n (tendsto_atTop_add_const_right _ m tendsto_id) |>.div_const _\n exact integrableOn_Ioi_deriv_of_nonneg' hd\n (fun t ht \u21a6 rpow_nonneg (by linarith [mem_Ioi.mp ht]) a) ht\n\n/-- If `0 < c`, then `(fun t : \u211d \u21a6 t ^ a)` is integrable on `(c, \u221e)` for all `a < -1`. -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integrableOn_Ioi_rpow_of_lt (L132-L135)\ntheorem integrableOn_Ioi_rpow_of_lt {a c : \u211d} (ha : a < -1) (hc : 0 < c) :\n IntegrableOn (fun t : \u211d \u21a6 t ^ a) (Ioi c) := by\nsimpa using integrableOn_add_rpow_Ioi_of_lt ha (by simpa : -0 < c)\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh (L61-L63)\ndef arcosh (x : \u211d) :=\nlog (x + \u221a(x ^ 2 - 1))\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_zero (L69-L70)\ntheorem arcosh_zero : arcosh 1 = 0 := by simp [arcosh]\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.coshOpenPartialHomeomorph (L139-L152)\ndef coshOpenPartialHomeomorph : OpenPartialHomeomorph \u211d \u211d where\n toFun := cosh\ninvFun := arcosh\n source := Ioi 0\n target := Ioi 1\n map_source' _ hr := one_lt_cosh.mpr (ne_of_lt hr).symm\n map_target' _ hr := arcosh_pos hr\n left_inv' _ hr := arcosh_cosh (le_of_lt hr)\n right_inv' _ hr := cosh_arcosh (le_of_lt hr)\n open_source := isOpen_Ioi\n open_target := isOpen_Ioi\n continuousOn_toFun := by fun_prop\n continuousOn_invFun := continuousOn_arcosh.mono Ioi_subset_Ici_self\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.analyticAt_arcosh (L180-L183)\nlemma analyticAt_arcosh {x : \u211d} (hx : x \u2208 Ioi 1) : AnalyticAt \u211d arcosh x :=\n(contDiffAt_arcosh hx).analyticAt\n\n/-- The function `Real.arcosh` is real analytic. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.continuousOn_arcosh (L133-L138)\ntheorem continuousOn_arcosh : ContinuousOn arcosh (Ici 1) :=\nhave {x : \u211d} (hx : x \u2208 Ici 1) : 0 < x + \u221a(x ^ 2 - 1) :=\n add_pos_of_pos_of_nonneg (show 0 < x by grind) (sqrt_nonneg _)\n continuousOn_log.comp (by fun_prop) (by grind [MapsTo])\n\n/-- `Real.cosh` as an `OpenPartialHomeomorph` from $(0, \u221e)$ to $(1, \u221e)$. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.exp_arcosh (L64-L67)\ntheorem exp_arcosh {x : \u211d} (hx : 1 \u2264 x) : exp (arcosh x) = x + \u221a(x ^ 2 - 1) := by\napply exp_log\n positivity\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.coshPartialEquiv (L123-L132)\ndef coshPartialEquiv : PartialEquiv \u211d \u211d where\n toFun := cosh\ninvFun := arcosh\n source := Ici 0\n target := Ici 1\n map_source' r _ := one_le_cosh r\n map_target' _ hr := arcosh_nonneg hr\n left_inv' _ hr := arcosh_cosh hr\n right_inv' _ hr := cosh_arcosh hr\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.contDiffAt_arcosh (L169-L174)\ntheorem contDiffAt_arcosh {n : WithTop \u2115\u221e} {x : \u211d} (hx : x \u2208 Ioi 1) : ContDiffAt \u211d n arcosh x := by\nrefine coshOpenPartialHomeomorph.contDiffAt_symm_deriv ?_ hx (hasDerivAt_cosh _)\n contDiff_cosh.contDiffAt\n rw [ne_eq, sinh_eq_zero]\n exact (arcosh_pos hx).ne'\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.differentiableOn_arcosh (L166-L168)\ntheorem differentiableOn_arcosh : DifferentiableOn \u211d arcosh (Ioi 1) := fun _ hx =>\n(differentiableAt_arcosh hx).differentiableWithinAt\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.analyticWithinAt_arcosh (L184-L188)\nlemma analyticWithinAt_arcosh {s : Set \u211d} {x : \u211d} (hx : x \u2208 Ioi 1) :\n AnalyticWithinAt \u211d arcosh s x :=\n(contDiffAt_arcosh hx).contDiffWithinAt.analyticWithinAt\n\n/-- The function `Real.arcosh` is real analytic. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_pos (L103-L109)\ntheorem arcosh_pos {x : \u211d} (hx : 1 < x) : 0 < arcosh x := by\napply log_pos\n calc\n 1 < x + 0 := by simpa\n _ \u2264 x + \u221a(x ^ 2 - 1) := by gcongr; positivity\n\n/-- This holds for `Ioi 0` instead of only `Ici 1` due to junk values. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.hasDerivAt_arcosh (L160-L162)\ntheorem hasDerivAt_arcosh {x : \u211d} (hx : x \u2208 Ioi 1) : HasDerivAt arcosh (\u221a(x ^ 2 - 1))\u207b\u00b9 x :=\n(hasStrictDerivAt_arcosh hx).hasDerivAt\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_lt_arcosh (L119-L122)\ntheorem arcosh_lt_arcosh {x y : \u211d} (hx : 0 < x) (hy : 0 < y) : arcosh x < arcosh y \u2194 x < y :=\nstrictMonoOn_arcosh.lt_iff_lt hx hy\n\n/-- `Real.cosh` as a `PartialEquiv` from $[0, \u221e)$ to $[1, \u221e)$. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_cosh (L93-L96)\ntheorem arcosh_cosh {x : \u211d} (hx : 0 \u2264 x) : arcosh (cosh x) = x := by\nrw [arcosh, \u2190 exp_eq_exp, exp_log (by positivity), \u2190 eq_sub_iff_add_eq', exp_sub_cosh,\n \u2190 sq_eq_sq\u2080 (sqrt_nonneg _) (sinh_nonneg_iff.mpr hx), \u2190 sinh_sq, sq_sqrt (pow_two_nonneg _)]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_eq_zero_iff (L81-L84)\ntheorem arcosh_eq_zero_iff {x : \u211d} (hx : 1 \u2264 x) : arcosh x = 0 \u2194 x = 1 := by\nrw [\u2190 exp_injective.eq_iff, exp_arcosh hx, exp_zero]\n grind\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_nonneg (L97-L102)\ntheorem arcosh_nonneg {x : \u211d} (hx : 1 \u2264 x) : 0 \u2264 arcosh x := by\napply log_nonneg\n calc\n 1 \u2264 x + 0 := by simpa\n _ \u2264 x + \u221a(x ^ 2 - 1) := by gcongr; positivity\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.tanh_arcosh (L89-L92)\ntheorem tanh_arcosh {x : \u211d} (hx : 1 \u2264 x) : tanh (arcosh x) = \u221a(x ^ 2 - 1) / x := by\nrw [tanh_eq_sinh_div_cosh, sinh_arcosh hx, cosh_arcosh hx]\n\n/-- `arcosh` is the left inverse of `cosh` over $[0, \u221e)$. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_le_arcosh (L115-L118)\ntheorem arcosh_le_arcosh {x y : \u211d} (hx : 0 < x) (hy : 0 < y) : arcosh x \u2264 arcosh y \u2194 x \u2264 y :=\nstrictMonoOn_arcosh.le_iff_le hx hy\n\n/-- This holds for `0 < x, y \u2264 1` due to junk values. -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.hasStrictDerivAt_arcosh (L153-L159)\ntheorem hasStrictDerivAt_arcosh {x : \u211d} (hx : x \u2208 Ioi 1) :\n HasStrictDerivAt arcosh (\u221a(x ^ 2 - 1))\u207b\u00b9 x := by\nrw [\u2190 sinh_arcosh (le_of_lt hx)]\n refine coshOpenPartialHomeomorph.hasStrictDerivAt_symm hx ?_ (hasStrictDerivAt_cosh _)\n rw [ne_eq, sinh_eq_zero]\n exact ne_of_gt (arcosh_pos hx)\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.sinh_arcosh (L85-L88)\ntheorem sinh_arcosh {x : \u211d} (hx : 1 \u2264 x) : sinh (arcosh x) = \u221a(x ^ 2 - 1) := by\nrw [arcosh, sinh_eq, exp_neg, exp_log (by positivity), add_sqrt_self_sq_sub_one_inv hx]\n ring\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.cosh_arcosh (L77-L80)\ntheorem cosh_arcosh {x : \u211d} (hx : 1 \u2264 x) : cosh (arcosh x) = x := by\nrw [arcosh, cosh_eq, exp_neg, exp_log (by positivity), add_sqrt_self_sq_sub_one_inv hx]\n ring\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.contDiffOn_arcosh (L175-L178)\ntheorem contDiffOn_arcosh {n : WithTop \u2115\u221e} : ContDiffOn \u211d n arcosh (Ioi 1) := fun _ hx =>\n(contDiffAt_arcosh hx).contDiffWithinAt\n\n/-- The function `Real.arcosh` is real analytic. -/\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.add_sqrt_self_sq_sub_one_inv (L71-L76)\nlemma add_sqrt_self_sq_sub_one_inv {x : \u211d} (hx : 1 \u2264 x) :\n (x + \u221a(x ^ 2 - 1))\u207b\u00b9 = x - \u221a(x ^ 2 - 1) := by\napply inv_eq_of_mul_eq_one_right\n rw [\u2190 pow_two_sub_pow_two, sq_sqrt (sub_nonneg_of_le (one_le_pow\u2080 hx)), sub_sub_cancel]\n\n/-- `arcosh` is the right inverse of `cosh` over $[1, \u221e)$. -/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.differentiableAt_arcosh (L163-L165)\ntheorem differentiableAt_arcosh {x : \u211d} (hx : x \u2208 Ioi 1) : DifferentiableAt \u211d arcosh x :=\n(hasDerivAt_arcosh hx).differentiableAt\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.strictMonoOn_arcosh (L110-L114)\ntheorem strictMonoOn_arcosh : StrictMonoOn arcosh (Ioi 0) := by\nrefine strictMonoOn_log.comp ?_ fun x (hx : 0 < x) \u21a6 show 0 < x + \u221a(x ^ 2 - 1) by positivity\n exact strictMonoOn_id.add_monotone fun x (hx : 0 < x) y (hy : 0 < y) hxy \u21a6 by gcongr\n\n/-- This holds for `0 < x, y \u2264 1` due to junk values. -/\n```\n[/INST]", "sample_id": "C-Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integrableOn_exp_mul_complex_Iic", "source": {"declaration": "Mathlib.Analysis.SpecialFunctions.ImproperIntegrals.integrableOn_exp_mul_complex_Iic", "file": "Mathlib/Analysis/SpecialFunctions/ImproperIntegrals.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Analysis.SpecialFunctions.ImproperIntegrals", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/SpecialFunctions/ImproperIntegrals.lean#L73", "span": "L73-L77"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"trace_states": [{"state": "theorem TermDefinable\u2081.definable\u2082_graph {f : M \u2192 M} (h : A.TermDefinable\u2081 L f) :\n A.Definable\u2082 L f.graph", "tactic": "obtain \u27e8t, h\u27e9 := h.termDefinable.definable_tupleGraph A L"}, {"state": "", "tactic": "use t.relabel (Option.elim \u00b7 1 (fun _ \u21a6 0))"}, {"state": "", "tactic": "ext v"}, {"state": "", "tactic": "convert Set.ext_iff.1 h (v \u2218 (Option.elim \u00b7 1 (fun _ \u21a6 0)))"}, {"state": "", "tactic": "simp /-- The identity function is `TermDefinable\u2081` -/"}], "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1255, "declarations_count": 150, "diagnostics_count": 0, "duplicate_fingerprint": "dcd269bb4bd12529", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 432, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "tiny", "line_count": 18, "natural_language_chars": 1255, "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.ModelTheory.Definability).", "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.ModelTheory.Definability.TermDefinable\u2081`:\nState 0: \u22a2 theorem TermDefinable\u2081.definable\u2082_graph {f : M \u2192 M} (h : A.TermDefinable\u2081 L f) :\n A.Definable\u2082 L f.graph\nTactic: obtain \u27e8t, h\u27e9 := h.termDefinable.definable_tupleGraph A L\nState 1: \u22a2 \nTactic: use t.relabel (Option.elim \u00b7 1 (fun _ \u21a6 0))\nState 2: \u22a2 \nTactic: ext v\nState 3: \u22a2 \nTactic: convert Set.ext_iff.1 h (v \u2218 (Option.elim \u00b7 1 (fun _ \u21a6 0)))\nState 4: \u22a2 \nTactic: simp /-- The identity function is `TermDefinable\u2081` -/\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.ModelTheory.Definability).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.ModelTheory.Definability.TermDefinable\u2081`:\nState 0: \u22a2 theorem TermDefinable\u2081.definable\u2082_graph {f : M \u2192 M} (h : A.TermDefinable\u2081 L f) :\n A.Definable\u2082 L f.graph\nTactic: obtain \u27e8t, h\u27e9 := h.termDefinable.definable_tupleGraph A L\nState 1: \u22a2 \nTactic: use t.relabel (Option.elim \u00b7 1 (fun _ \u21a6 0))\nState 2: \u22a2 \nTactic: ext v\nState 3: \u22a2 \nTactic: convert Set.ext_iff.1 h (v \u2218 (Option.elim \u00b7 1 (fun _ \u21a6 0)))\nState 4: \u22a2 \nTactic: simp /-- The identity function is `TermDefinable\u2081` -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.ModelTheory.Definability.TermDefinable\u2081", "source": {"declaration": "Mathlib.ModelTheory.Definability.TermDefinable\u2081", "file": "Mathlib/ModelTheory/Definability.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.ModelTheory.Definability", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/ModelTheory/Definability.lean#L481", "span": "L481-L489"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "theorem mem_carrier {s : NonUnitalSubring R} {x : R} : x \u2208 s.toNonUnitalSubsemiring \u2194 x \u2208 s\n:= .someMissingNamespaceXYZ\nIff.rfl", "diagnostic": "[CompilationUnit(i_begin=0, i_end=133, messages=[Message(data='failed to synthesize instance of type class\\n NonUnitalNonAssocRing R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=25), pos_end=Position(line=1, column=43), 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": 1103, "declarations_count": 119, "diagnostics_count": 1, "duplicate_fingerprint": "fa25d2b7432283e2", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 306, "lean_code_chars": 128, "lean_code_ratio": 0.116, "length_bucket": "tiny", "line_count": 14, "natural_language_chars": 975, "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.RingTheory.NonUnitalSubring.Defs).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem mem_carrier {s : NonUnitalSubring R} {x : R} : x \u2208 s.toNonUnitalSubsemiring \u2194 x \u2208 s\n:= .someMissingNamespaceXYZ\nIff.rfl\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=133, messages=[Message(data='failed to synthesize instance of type class\\n NonUnitalNonAssocRing R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=25), pos_end=Position(line=1, column=43), 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.RingTheory.NonUnitalSubring.Defs).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem mem_carrier {s : NonUnitalSubring R} {x : R} : x \u2208 s.toNonUnitalSubsemiring \u2194 x \u2208 s\n:= .someMissingNamespaceXYZ\nIff.rfl\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=133, messages=[Message(data='failed to synthesize instance of type class\\n NonUnitalNonAssocRing R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=25), pos_end=Position(line=1, column=43), 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.RingTheory.NonUnitalSubring.Defs.mem_carrier", "source": {"declaration": "Mathlib.RingTheory.NonUnitalSubring.Defs.mem_carrier", "file": "Mathlib/RingTheory/NonUnitalSubring/Defs.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.RingTheory.NonUnitalSubring.Defs", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/NonUnitalSubring/Defs.lean#L169", "span": "L169-L171"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem monic_charpoly (b : B) : (charpoly G b).Monic", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 464, "declarations_count": 54, "diagnostics_count": 0, "duplicate_fingerprint": "0df4f93601c8de92", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 134, "lean_code_chars": 54, "lean_code_ratio": 0.1164, "length_bucket": "tiny", "line_count": 7, "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.RingTheory.Invariant.Basic).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem monic_charpoly (b : B) : (charpoly G b).Monic\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.RingTheory.Invariant.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem monic_charpoly (b : B) : (charpoly G b).Monic\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.RingTheory.Invariant.Basic.monic_charpoly", "source": {"declaration": "Mathlib.RingTheory.Invariant.Basic.monic_charpoly", "file": "Mathlib/RingTheory/Invariant/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.RingTheory.Invariant.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Invariant/Basic.lean#L146", "span": "L146-L148"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "def getPCompSet : LinarithM PCompSet\n:= \u27e8\u27e9\u27e8\u27e9\nLinarithData.comps <$> get\n\n/-- Throws an exception if a contradictory `PComp` is contained in the current state. -/", "diagnostic": "[CompilationUnit(i_begin=0, i_end=46, messages=[Message(data=\"Function expected at\\n LinarithM\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n PCompSet\\n\\nHint: The identifier `LinarithM` 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=36), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=46, i_end=169, messages=[Message(data=\"unexpected token '\u27e8'; expected command\", pos=Position(line=2, column=5), pos_end=Position(line=2, column=6), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=5, column=88), 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": 1857, "declarations_count": 233, "diagnostics_count": 1, "duplicate_fingerprint": "f280cfee73250443", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 514, "lean_code_chars": 162, "lean_code_ratio": 0.0872, "length_bucket": "short", "line_count": 16, "natural_language_chars": 1695, "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.Linarith.Oracle.FourierMotzkin).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef getPCompSet : LinarithM PCompSet\n:= \u27e8\u27e9\u27e8\u27e9\nLinarithData.comps <$> get\n\n/-- Throws an exception if a contradictory `PComp` is contained in the current state. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=46, messages=[Message(data=\"Function expected at\\n LinarithM\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n PCompSet\\n\\nHint: The identifier `LinarithM` 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=36), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=46, i_end=169, messages=[Message(data=\"unexpected token '\u27e8'; expected command\", pos=Position(line=2, column=5), pos_end=Position(line=2, column=6), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=5, column=88), 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.Linarith.Oracle.FourierMotzkin).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef getPCompSet : LinarithM PCompSet\n:= \u27e8\u27e9\u27e8\u27e9\nLinarithData.comps <$> get\n\n/-- Throws an exception if a contradictory `PComp` is contained in the current state. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=46, messages=[Message(data=\"Function expected at\\n LinarithM\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n PCompSet\\n\\nHint: The identifier `LinarithM` 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=36), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=46, i_end=169, messages=[Message(data=\"unexpected token '\u27e8'; expected command\", pos=Position(line=2, column=5), pos_end=Position(line=2, column=6), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=5, column=88), 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.Linarith.Oracle.FourierMotzkin.getPCompSet", "source": {"declaration": "Mathlib.Tactic.Linarith.Oracle.FourierMotzkin.getPCompSet", "file": "Mathlib/Tactic/Linarith/Oracle/FourierMotzkin.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.Linarith.Oracle.FourierMotzkin", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/Linarith/Oracle/FourierMotzkin.lean#L274", "span": "L274-L277"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\nlemma isoCycles\u2081_hom_comp_i :\n (isoCycles\u2081 A).hom \u226b (shortComplexH1 A).moduleCatLeftHomologyData.i =\n iCycles A 1 \u226b (chainsIso\u2081 A).hom := by\nsimp [isoCycles\u2081, iCycles, HomologicalComplex.iCycles, ShortComplex.iCycles]\n```", "instruction": "Edit `isoCycles\u2081_hom_comp_i` so it still compiles and the proof is simplified where possible. Return the full updated `isoCycles\u2081_hom_comp_i` block.", "proof_is_oneliner": false, "target_span": "L755-L759", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1055, "declarations_count": 99, "diagnostics_count": 0, "duplicate_fingerprint": "b792860ce504998e", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 342, "lean_code_chars": 226, "lean_code_ratio": 0.2142, "length_bucket": "tiny", "line_count": 13, "natural_language_chars": 829, "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.RepresentationTheory.Homological.GroupHomology.LowDegree).", "role": "system"}, {"content": "You are editing a file in `Mathlib/RepresentationTheory/Homological/GroupHomology/LowDegree.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.RepresentationTheory.Homological.GroupHomology.LowDegree.isoCycles\u2081_hom_comp_i`, L755-L759)\n```lean\nlemma isoCycles\u2081_hom_comp_i :\n (isoCycles\u2081 A).hom \u226b (shortComplexH1 A).moduleCatLeftHomologyData.i =\n iCycles A 1 \u226b (chainsIso\u2081 A).hom := by\nsimp [isoCycles\u2081, iCycles, HomologicalComplex.iCycles, ShortComplex.iCycles]\n```\n\n## Edit instruction\nEdit `isoCycles\u2081_hom_comp_i` so it still compiles and the proof is simplified where possible. Return the full updated `isoCycles\u2081_hom_comp_i` 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.RepresentationTheory.Homological.GroupHomology.LowDegree).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/RepresentationTheory/Homological/GroupHomology/LowDegree.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.RepresentationTheory.Homological.GroupHomology.LowDegree.isoCycles\u2081_hom_comp_i`, L755-L759)\n```lean\nlemma isoCycles\u2081_hom_comp_i :\n (isoCycles\u2081 A).hom \u226b (shortComplexH1 A).moduleCatLeftHomologyData.i =\n iCycles A 1 \u226b (chainsIso\u2081 A).hom := by\nsimp [isoCycles\u2081, iCycles, HomologicalComplex.iCycles, ShortComplex.iCycles]\n```\n\n## Edit instruction\nEdit `isoCycles\u2081_hom_comp_i` so it still compiles and the proof is simplified where possible. Return the full updated `isoCycles\u2081_hom_comp_i` block.\n[/INST]", "sample_id": "D-Mathlib.RepresentationTheory.Homological.GroupHomology.LowDegree.isoCycles\u2081_hom_comp_i", "source": {"declaration": "Mathlib.RepresentationTheory.Homological.GroupHomology.LowDegree.isoCycles\u2081_hom_comp_i", "file": "Mathlib/RepresentationTheory/Homological/GroupHomology/LowDegree.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.RepresentationTheory.Homological.GroupHomology.LowDegree", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RepresentationTheory/Homological/GroupHomology/LowDegree.lean#L755", "span": "L755-L759"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Algebra.Module.Submodule.Lattice.inhabited' (L57-L59)\ninstance inhabited' : Inhabited (Submodule R M) :=\n\u27e8\u22a5\u27e9", "-- Mathlib.Algebra.Module.Submodule.Lattice.bot_coe (L61-L63)\ntheorem bot_coe : ((\u22a5 : Submodule R M) : Set M) = {0} :=\nrfl", "-- Mathlib.Algebra.Module.Submodule.Lattice.bot_toAddSubmonoid (L65-L67)\ntheorem bot_toAddSubmonoid : (\u22a5 : Submodule R M).toAddSubmonoid = \u22a5 :=\nrfl", "-- Mathlib.Algebra.Module.Submodule.Lattice.bot_toAddSubgroup (L69-L72)\nlemma bot_toAddSubgroup {R M} [Ring R] [AddCommGroup M] [Module R M] :\n (\u22a5 : Submodule R M).toAddSubgroup = \u22a5 := rfl\nvariable (R) in", "-- Mathlib.Algebra.Module.Submodule.Lattice.mem_bot (L74-L76)\ntheorem mem_bot {x : M} : x \u2208 (\u22a5 : Submodule R M) \u2194 x = 0 :=\nSet.mem_singleton_iff", "-- Mathlib.Algebra.Module.Submodule.Lattice.uniqueBot (L80-L82)\ninstance uniqueBot : Unique (\u22a5 : Submodule R M) :=\n\u27e8inferInstance, fun x \u21a6 Subtype.ext <| (mem_bot R).1 x.mem\u27e9", "-- Mathlib.Algebra.Module.Submodule.Lattice.nonzero_mem_of_bot_lt (L97-L100)\ntheorem nonzero_mem_of_bot_lt {p : Submodule R M} (bot_lt : \u22a5 < p) : \u2203 a : p, a \u2260 0 :=\nlet \u27e8b, hb\u2081, hb\u2082\u27e9 := p.ne_bot_iff.mp bot_lt.ne'\n \u27e8\u27e8b, hb\u2081\u27e9, hb\u2082 \u2218 congr_arg Subtype.val\u27e9", "-- Mathlib.Algebra.Module.Submodule.Lattice.exists_mem_ne_zero_of_ne_bot (L101-L106)\ntheorem exists_mem_ne_zero_of_ne_bot {p : Submodule R M} (h : p \u2260 \u22a5) : \u2203 b : M, b \u2208 p \u2227 b \u2260 0 :=\nlet \u27e8b, hb\u2081, hb\u2082\u27e9 := p.ne_bot_iff.mp h\n \u27e8b, hb\u2081, hb\u2082\u27e9\n\n-- FIXME: we default PUnit to PUnit.{1} here without the explicit universe annotation\n/-- The bottom submodule is linearly equivalent to punit as an `R`-module. -/", "-- Mathlib.Algebra.Module.Submodule.Lattice.botEquivPUnit (L108-L113)\ndef botEquivPUnit : (\u22a5 : Submodule R M) \u2243\u2097[R] PUnit.{v + 1} where\n toFun _ := PUnit.unit\ninvFun _ := 0\n map_add' _ _ := rfl\n map_smul' _ _ := rfl", "-- Mathlib.Algebra.Module.Submodule.Lattice.subsingleton_iff_eq_bot (L114-L118)\ntheorem subsingleton_iff_eq_bot : Subsingleton p \u2194 p = \u22a5 := by\nrw [subsingleton_iff, Submodule.eq_bot_iff]\n refine \u27e8fun h x hx \u21a6 by simpa using h \u27e8x, hx\u27e9 \u27e80, p.zero_mem\u27e9,\n fun h \u27e8x, hx\u27e9 \u27e8y, hy\u27e9 \u21a6 by simp [h x hx, h y hy]\u27e9", "-- Mathlib.Algebra.Module.Submodule.Lattice.eq_bot_of_subsingleton (L119-L121)\ntheorem eq_bot_of_subsingleton [Subsingleton p] : p = \u22a5 :=\nsubsingleton_iff_eq_bot.mp inferInstance", "-- Mathlib.Algebra.Module.Submodule.Lattice.nontrivial_iff_ne_bot (L122-L129)\ntheorem nontrivial_iff_ne_bot : Nontrivial p \u2194 p \u2260 \u22a5 := by\nrw [iff_not_comm, not_nontrivial_iff_subsingleton, subsingleton_iff_eq_bot]\n\n/-!\n## Top element of a submodule\n-/\n\n/-- The universal set is the top element of the lattice of submodules. -/", "-- Mathlib.Algebra.Module.Submodule.Lattice.top_coe (L136-L138)\ntheorem top_coe : ((\u22a4 : Submodule R M) : Set M) = Set.univ :=\nrfl", "-- Mathlib.Algebra.Module.Submodule.Lattice.coe_eq_univ (L140-L142)\ntheorem coe_eq_univ : (p : Set M) = Set.univ \u2194 p = \u22a4 := by\nrw [iff_comm, \u2190 SetLike.coe_set_eq, top_coe]", "-- Mathlib.Algebra.Module.Submodule.Lattice.top_toAddSubmonoid (L146-L148)\ntheorem top_toAddSubmonoid : (\u22a4 : Submodule R M).toAddSubmonoid = \u22a4 :=\nrfl", "-- Mathlib.Algebra.Module.Submodule.Lattice.top_toAddSubgroup (L150-L152)\nlemma top_toAddSubgroup {R M : Type*} [Ring R] [AddCommGroup M] [Module R M] :\n (\u22a4 : Submodule R M).toAddSubgroup = \u22a4 := rfl", "-- Mathlib.Algebra.Module.Submodule.Lattice.toAddSubgroup_eq_top (L154-L156)\nlemma toAddSubgroup_eq_top {R M : Type*} [Ring R] [AddCommGroup M] [Module R M]\n {p : Submodule R M} : p.toAddSubgroup = \u22a4 \u2194 p = \u22a4 := by simp [\u2190 toAddSubgroup_inj]", "-- Mathlib.Algebra.Module.Submodule.Lattice.eq_top_iff' (L163-L168)\ntheorem eq_top_iff' {p : Submodule R M} : p = \u22a4 \u2194 \u2200 x, x \u2208 p :=\neq_top_iff.trans \u27e8fun h _ \u21a6 h trivial, fun h x _ \u21a6 h x\u27e9\n\n/-- The top submodule is linearly equivalent to the module.\n\nThis is the module version of `AddSubmonoid.topEquiv`. -/", "-- Mathlib.Algebra.Module.Submodule.Lattice.topEquiv (L170-L179)\ndef topEquiv : (\u22a4 : Submodule R M) \u2243\u2097[R] M where\n toFun x := x\ninvFun x := \u27e8x, mem_top\u27e9\n map_add' _ _ := rfl\n map_smul' _ _ := rfl\n\n/-!\n## Infima & suprema in a submodule\n-/", "-- Mathlib.Algebra.Module.Submodule.Lattice.completeLattice (L207-L221)\ninstance completeLattice : CompleteLattice (Submodule R M) :=\n{ (inferInstance : OrderTop (Submodule R M)),\n (inferInstance : OrderBot (Submodule R M)) with\n sup := fun a b \u21a6 sInf { x | a \u2264 x \u2227 b \u2264 x }\n le_sup_left := fun _ _ \u21a6 le_sInf' fun _ \u27e8h, _\u27e9 \u21a6 h\n le_sup_right := fun _ _ \u21a6 le_sInf' fun _ \u27e8_, h\u27e9 \u21a6 h\n sup_le := fun _ _ _ h\u2081 h\u2082 \u21a6 sInf_le' \u27e8h\u2081, h\u2082\u27e9\n inf := (\u00b7 \u2293 \u00b7)\n le_inf := fun _ _ _ \u21a6 Set.subset_inter\n inf_le_left := fun _ _ \u21a6 Set.inter_subset_left\n inf_le_right := fun _ _ \u21a6 Set.inter_subset_right\n sSup S := sInf {sm | \u2200 s \u2208 S, s \u2264 sm}\n isLUB_sSup _ := isGLB_upperBounds.mp Submodule.isGLB_sInf\n isGLB_sInf _ := Submodule.isGLB_sInf }", "-- Mathlib.Algebra.Module.Submodule.Lattice.coe_inf (L223-L225)\ntheorem coe_inf : \u2191(p \u2293 q) = (p \u2229 q : Set M) :=\nrfl", "-- Mathlib.Algebra.Module.Submodule.Lattice.mem_inf (L227-L229)\ntheorem mem_inf {p q : Submodule R M} {x : M} : x \u2208 p \u2293 q \u2194 x \u2208 p \u2227 x \u2208 q :=\nIff.rfl", "-- Mathlib.Algebra.Module.Submodule.Lattice.coe_sInf (L231-L233)\ntheorem coe_sInf (P : Set (Submodule R M)) : (\u2191(sInf P) : Set M) = \u22c2 p \u2208 P, \u2191p :=\nrfl", "-- Mathlib.Algebra.Module.Submodule.Lattice.coe_finsetInf (L235-L242)\ntheorem coe_finsetInf {\u03b9} (s : Finset \u03b9) (p : \u03b9 \u2192 Submodule R M) :\n (\u2191(s.inf p) : Set M) = \u22c2 i \u2208 s, \u2191(p i) := by\nletI := Classical.decEq \u03b9\n refine s.induction_on ?_ fun i s _ ih \u21a6 ?_\n \u00b7 simp\n \u00b7 rw [Finset.inf_insert, coe_inf, ih]\n simp", "-- Mathlib.Algebra.Module.Submodule.Lattice.coe_iInf (L244-L246)\ntheorem coe_iInf {\u03b9} (p : \u03b9 \u2192 Submodule R M) : (\u2191(\u2a05 i, p i) : Set M) = \u22c2 i, \u2191(p i) := by\nrw [iInf, coe_sInf]; simp only [Set.mem_range, Set.iInter_exists, Set.iInter_iInter_eq']", "-- Mathlib.Algebra.Module.Equiv.Basic.restrictScalars_injective (L55-L58)\ntheorem restrictScalars_injective :\n Function.Injective (restrictScalars R : (M \u2243\u2097[S] M\u2082) \u2192 M \u2243\u2097[R] M\u2082) := fun _ _ h \u21a6\next (LinearEquiv.congr_fun h :)", "-- Mathlib.Algebra.Module.End.AddMonoid (L32-L41)\ntheorem AddMonoid.End.natCast_def (n : \u2115) :\n (\u2191n : AddMonoid.End M) = DistribMulAction.toAddMonoidEnd \u2115 M n :=\nrfl\n\nvariable (R M)\n\nset_option backward.isDefEq.respectTransparency false in\n/-- `(\u2022)` as an `AddMonoidHom`.\n\nThis is a stronger version of `DistribMulAction.toAddMonoidEnd` -/", "-- Mathlib.Algebra.Module.DedekindDomain.isInternal_prime_power_torsion (L64-L75)\ntheorem isInternal_prime_power_torsion [Module.Finite R M]\n (hM : Module.IsTorsion R M) :\n DirectSum.IsInternal fun p : (factors (\u22a4 : Submodule R M).annihilator).toFinset =>\n torsionBySet R M (p ^ (factors (\u22a4 : Submodule R M).annihilator).count \u2191p : Ideal R) := by\nhave hM' := Module.isTorsionBySet_annihilator_top R M\n have hI := Submodule.annihilator_top_inter_nonZeroDivisors hM\n refine isInternal_prime_power_torsion_of_is_torsion_by_ideal ?_ hM'\n rw [Submodule.ne_bot_iff]\n obtain \u27e8x, H, hx\u27e9 := hI; exact \u27e8x, H, nonZeroDivisors.ne_zero hx\u27e9\n\n/-- A finitely generated torsion module over a Dedekind domain is an internal direct sum of its\n`p i ^ e i`-torsion submodules for some prime ideals `p i` and numbers `e i`. -/", "-- Mathlib.Algebra.Module.CharacterModule.dual_comp (L90-L94)\nlemma dual_comp {C : Type*} [AddCommGroup C] [Module R C] (f : A \u2192\u2097[R] B) (g : B \u2192\u2097[R] C) :\n dual (g.comp f) = (dual f).comp (dual g) := by\next\n rfl", "-- Mathlib.Algebra.Module.Basic.indicator_const_smul_apply (L132-L135)\nlemma indicator_const_smul_apply (s : Set \u03b1) (r : R) (f : \u03b1 \u2192 M) (a : \u03b1) :\n indicator s (r \u2022 f \u00b7) a = r \u2022 indicator s f a :=\nindicator_smul_apply s (fun _ \u21a6 r) f a", "-- Mathlib.Algebra.Module.Defs.smul_add_one_sub_smul (L109-L117)\ntheorem smul_add_one_sub_smul {R : Type*} [Ring R] [Module R M] {r : R} {m : M} :\n r \u2022 m + (1 - r) \u2022 m = m := by rw [\u2190 add_smul, add_sub_cancel, one_smul]\nend AddCommMonoid\n\nsection AddCommGroup\n\nvariable [Semiring R] [AddCommGroup M]", "-- Mathlib.Algebra.Module.Basic.inv_natCast_smul_comm (L81-L87)\ntheorem inv_natCast_smul_comm {\u03b1 E : Type*} (R : Type*) [AddCommMonoid E] [DivisionSemiring R]\n [Module R E] [DistribSMul \u03b1 E] (n : \u2115) (s : \u03b1) (x : E) :\n (n\u207b\u00b9 : R) \u2022 s \u2022 x = s \u2022 (n\u207b\u00b9 : R) \u2022 x :=\n(map_inv_natCast_smul (DistribSMul.toAddMonoidHom E s) R R n x).symm\n\n/-- If `E` is a vector space over a division ring `R` and has a monoid action by `\u03b1`, then that\naction commutes by scalar multiplication of inverses of integers in `R` -/", "-- Mathlib.Algebra.Module.Basic.indicator_const_smul (L136-L144)\nlemma indicator_const_smul (s : Set \u03b1) (r : R) (f : \u03b1 \u2192 M) :\n indicator s (r \u2022 f \u00b7) = (r \u2022 indicator s f \u00b7) :=\nfunext <| indicator_const_smul_apply s r f\n\nend SMulZeroClass\n\nsection SMulWithZero\nvariable [Zero R] [Zero M] [SMulWithZero R M]", "-- Mathlib.Algebra.Module.Basic.support_const_smul_of_ne_zero (L105-L108)\nlemma support_const_smul_of_ne_zero [Semiring R] [IsDomain R] [AddCommMonoid M] [Module R M]\n [Module.IsTorsionFree R M] (c : R) (g : \u03b1 \u2192 M) (hc : c \u2260 0) : support (c \u2022 g) = support g :=\next fun _ \u21a6 smul_ne_zero_iff_right hc", "-- Mathlib.Algebra.Module.Defs.sub_smul (L150-L166)\ntheorem sub_smul (r s : R) (y : M) : (r - s) \u2022 y = r \u2022 y - s \u2022 y := by\nsimp [add_smul, sub_eq_add_neg]\n\nend Module\n\n/-- A module over a `Subsingleton` semiring is a `Subsingleton`. We cannot register this\nas an instance because Lean has no way to guess `R`. -/\nprotected theorem Module.subsingleton (R M : Type*) [MonoidWithZero R] [Subsingleton R] [Zero M]\n [MulActionWithZero R M] : Subsingleton M :=\n MulActionWithZero.subsingleton R M\n\n/-- A semiring is `Nontrivial` provided that there exists a nontrivial module over this semiring. -/\nprotected theorem Module.nontrivial (R M : Type*) [MonoidWithZero R] [Nontrivial M] [Zero M]\n [MulActionWithZero R M] : Nontrivial R :=\n MulActionWithZero.nontrivial R M\n\n-- see Note [lower instance priority]", "-- Mathlib.Algebra.Module.Basic.support_smul (L109-L112)\nlemma support_smul [Semiring R] [IsDomain R] [AddCommMonoid M] [Module R M]\n [Module.IsTorsionFree R M] (f : \u03b1 \u2192 R) (g : \u03b1 \u2192 M) : support (f \u2022 g) = support f \u2229 support g :=\next fun _ => smul_ne_zero_iff", "-- Mathlib.Algebra.Module.Bimodule.baseChange (L102-L107)\ndef baseChange (S : Type*) [CommSemiring S] [Module S M] [Algebra S A] [Algebra S B]\n [IsScalarTower S A M] [IsScalarTower S B M] (p : Submodule (A \u2297[R] B) M) :\n Submodule (A \u2297[S] B) M :=\nmk p.toAddSubmonoid (smul_mem p) (smul_mem' p)\n\n/-- Forgetting the `B` action, a `Submodule` over `A \u2297[R] B` is just a `Submodule` over `A`. -/", "-- Mathlib.Algebra.Module.Basic.indicator_smul_const (L158-L167)\nlemma indicator_smul_const (s : Set \u03b1) (r : \u03b1 \u2192 R) (m : M) :\n indicator s (r \u00b7 \u2022 m) = (indicator s r \u00b7 \u2022 m) :=\nfunext <| indicator_smul_const_apply _ _ _\n\nend SMulWithZero\n\nsection MulZeroOneClass\n\nvariable [MulZeroOneClass R]", "-- Mathlib.Algebra.Module.Basic.inv_intCast_smul_eq (L75-L80)\ntheorem inv_intCast_smul_eq {E : Type*} (R S : Type*) [AddCommGroup E] [DivisionRing R]\n [DivisionRing S] [Module R E] [Module S E] (n : \u2124) (x : E) : (n\u207b\u00b9 : R) \u2022 x = (n\u207b\u00b9 : S) \u2022 x :=\nmap_inv_intCast_smul (AddMonoidHom.id E) R S n x\n\n/-- If `E` is a vector space over a division semiring `R` and has a monoid action by `\u03b1`, then that\naction commutes by scalar multiplication of inverses of natural numbers in `R`. -/", "-- Mathlib.Algebra.Module.Defs.two_smul (L81-L104)\ntheorem two_smul : (2 : R) \u2022 x = x + x := by rw [\u2190 one_add_one_eq_two, add_smul, one_smul]\n/-- Pullback a `Module` structure along an injective additive monoid homomorphism.\nSee note [reducible non-instances]. -/\nprotected abbrev Function.Injective.module [AddCommMonoid M\u2082] [SMul R M\u2082] (f : M\u2082 \u2192+ M)\n (hf : Injective f) (smul : \u2200 (c : R) (x), f (c \u2022 x) = c \u2022 f x) : Module R M\u2082 :=\n { hf.distribMulAction f smul with\n add_smul := fun c\u2081 c\u2082 x => hf <| by simp only [smul, f.map_add, add_smul]\n zero_smul := fun x => hf <| by simp only [smul, zero_smul, f.map_zero] }\n\n/-- Pushforward a `Module` structure along a surjective additive monoid homomorphism.\nSee note [reducible non-instances]. -/\nprotected abbrev Function.Surjective.module [AddCommMonoid M\u2082] [SMul R M\u2082] (f : M \u2192+ M\u2082)\n (hf : Surjective f) (smul : \u2200 (c : R) (x), f (c \u2022 x) = c \u2022 f x) : Module R M\u2082 :=\n { toDistribMulAction := hf.distribMulAction f smul\n add_smul := fun c\u2081 c\u2082 x => by\n rcases hf x with \u27e8x, rfl\u27e9\n simp only [add_smul, \u2190 smul, \u2190 f.map_add]\n zero_smul := fun x => by\n rcases hf x with \u27e8x, rfl\u27e9\n rw [\u2190 f.map_zero, \u2190 smul, zero_smul] }\n\nvariable {R}", "-- Mathlib.Algebra.Module.BigOperators.List (L26-L28)\ntheorem List.sum_smul {l : List R} {x : M} : l.sum \u2022 x = (l.map fun r \u21a6 r \u2022 x).sum :=\nmap_list_sum ((smulAddHom R M).flip x) l", "-- Mathlib.Algebra.Module.Defs.neg_smul (L139-L141)\ntheorem neg_smul : -r \u2022 x = -(r \u2022 x) :=\neq_neg_of_add_eq_zero_left <| by rw [\u2190 add_smul, neg_add_cancel, zero_smul]", "-- Mathlib.Algebra.Module.BigOperators.Fintype (L45-L51)\nlemma Fintype.sum_smul_sum [Fintype \u03b1] [Fintype \u03b2] (f : \u03b1 \u2192 R) (g : \u03b2 \u2192 M) :\n (\u2211 i, f i) \u2022 \u2211 j, g j = \u2211 i, \u2211 j, f i \u2022 g j := Finset.sum_smul_sum _ _\nend AddCommMonoid\n\nopen Finset", "-- Mathlib.Algebra.Module.CharacterModule.congr (L110-L119)\ndef congr (e : A \u2243\u2097[R] B) : CharacterModule A \u2243\u2097[R] CharacterModule B :=\n.ofLinear (dual e.symm) (dual e)\n (by ext c _; exact congr(c $(e.right_inv _)))\n (by ext c _; exact congr(c $(e.left_inv _)))\n\nopen TensorProduct\n\n/--\nAny linear map `L : A \u2192 B\u22c6` induces a character in `(A \u2297 B)\u22c6` by `a \u2297 b \u21a6 L a b`.\n-/", "-- Mathlib.Algebra.Module.Basic.Units (L31-L34)\ntheorem Units.neg_smul [Ring R] [AddCommGroup M] [Module R M] (u : R\u02e3) (x : M) :\n -u \u2022 x = -(u \u2022 x) := by\nrw [Units.smul_def, Units.val_neg, _root_.neg_smul, Units.smul_def]", "-- Mathlib.Algebra.Module.CharacterModule.intSpanEquivQuotAddOrderOf_apply_self (L181-L200)\nlemma intSpanEquivQuotAddOrderOf_apply_self (a : A) :\n intSpanEquivQuotAddOrderOf a \u27e8a, Submodule.mem_span_singleton_self a\u27e9 =\n Submodule.Quotient.mk 1 :=\n(LinearEquiv.eq_symm_apply _).mp <| Subtype.ext (one_zsmul _).symm\n\n/--\nFor an abelian group `A` and an element `a \u2208 A`, there is a character `c : \u2124 \u2219 a \u2192 \u211a \u29f8 \u2124` given by\n`m \u2022 a \u21a6 m / n` where `n` is the smallest positive integer such that `n \u2022 a = 0` and when such `n`\ndoes not exist, `c` is defined by `m \u2022 a \u21a6 m / 2`.\n-/\nnoncomputable def ofSpanSingleton (a : A) : CharacterModule (\u2124 \u2219 a) :=\n let l : \u2124 \u29f8 Ideal.span {(addOrderOf a : \u2124)} \u2192\u2097[\u2124] AddCircle (1 : \u211a) :=\n Submodule.liftQSpanSingleton _\n (CharacterModule.int.divByNat <|\n if addOrderOf a = 0 then 2 else addOrderOf a).toIntLinearMap <| by\n split_ifs with h\n \u00b7 rw [h, Nat.cast_zero, map_zero]\n \u00b7 apply CharacterModule.int.divByNat_self\n l \u2218\u2097 intSpanEquivQuotAddOrderOf a |>.toAddMonoidHom", "-- Mathlib.Algebra.Module.Equiv.Basic.restrictScalars (L48-L54)\ndef restrictScalars (f : M \u2243\u2097[S] M\u2082) : M \u2243\u2097[R] M\u2082 :=\n{ f.toLinearMap.restrictScalars R with\n toFun := f\n invFun := f.symm\n left_inv := f.left_inv\n right_inv := f.right_inv }", "-- Mathlib.Algebra.Module.CharacterModule.dual_surjective_iff_injective (L225-L230)\nlemma dual_surjective_iff_injective {f : A \u2192\u2097[R] A'} :\n Function.Surjective (dual f) \u2194 Function.Injective f :=\n\u27e8fun h \u21a6 (injective_iff_map_eq_zero _).2 fun a h0 \u21a6 eq_zero_of_character_apply fun c \u21a6 by\n obtain \u27e8c, rfl\u27e9 := h c; exact congr(c $h0).trans c.map_zero,\n dual_surjective_of_injective f\u27e9", "-- Mathlib.Algebra.Module.Basic.map_inv_intCast_smul (L58-L67)\ntheorem map_inv_intCast_smul [AddCommGroup M] [AddCommGroup M\u2082] {F : Type*} [FunLike F M M\u2082]\n [AddMonoidHomClass F M M\u2082] (f : F) (R S : Type*) [DivisionRing R] [DivisionRing S] [Module R M]\n [Module S M\u2082] (z : \u2124) (x : M) : f ((z\u207b\u00b9 : R) \u2022 x) = (z\u207b\u00b9 : S) \u2022 f x := by\nobtain \u27e8n, rfl | rfl\u27e9 := z.eq_nat_or_neg\n \u00b7 rw [Int.cast_natCast, Int.cast_natCast, map_inv_natCast_smul _ R S]\n \u00b7 simp_rw [Int.cast_neg, Int.cast_natCast, inv_neg, neg_smul, map_neg,\n map_inv_natCast_smul _ R S]\n\n/-- If `E` is a vector space over two division semirings `R` and `S`, then scalar multiplications\nagree on inverses of natural numbers in `R` and `S`. -/", "-- Mathlib.Algebra.Module.Basic.indicator_smul (L128-L131)\nlemma indicator_smul (s : Set \u03b1) (r : \u03b1 \u2192 R) (f : \u03b1 \u2192 M) :\n indicator s (fun a \u21a6 r a \u2022 f a) = fun a \u21a6 r a \u2022 indicator s f a :=\nfunext <| indicator_smul_apply s r f", "-- Mathlib.Algebra.Module.Basic.support_smul_subset_left (L95-L100)\nlemma support_smul_subset_left [Zero R] [Zero M] [SMulWithZero R M] (f : \u03b1 \u2192 R) (g : \u03b1 \u2192 M) :\n support (f \u2022 g) \u2286 support f := fun x hfg hf \u21a6\nhfg <| by rw [Pi.smul_apply', hf, zero_smul]\n\n-- Changed (2024-01-21): this lemma was generalised;\n-- the old version is now called `support_const_smul_subset`.", "-- Mathlib.Algebra.Module.CharacterModule.CharacterModule (L46-L49)\ndef CharacterModule : Type uA := A \u2192+ AddCircle (1 : \u211a)\nnamespace CharacterModule", "-- Mathlib.Algebra.Module.Defs.add_smul (L73-L75)\ntheorem add_smul : (r + s) \u2022 x = r \u2022 x + s \u2022 x :=\nModule.add_smul r s x", "-- Mathlib.Algebra.Module.CharacterModule.dual_zero (L86-L89)\nlemma dual_zero : dual (0 : A \u2192\u2097[R] B) = 0 := by\next f\n exact map_zero f", "-- Mathlib.Algebra.Module.CharacterModule.dual_rTensor_conj_homEquiv (L147-L171)\ntheorem dual_rTensor_conj_homEquiv (f : A \u2192\u2097[R] A') :\n homEquiv.symm.toLinearMap \u2218\u2097 dual (f.rTensor B) \u2218\u2097 homEquiv.toLinearMap = f.lcomp R _ := rfl\nend module\n\n/--\n`\u2124\u22c6`, the character module of `\u2124` in the unit rational circle.\n-/\nprotected abbrev int : Type := CharacterModule \u2124\n\n/-- Given `n : \u2115`, the map `m \u21a6 m / n`. -/\nprotected abbrev int.divByNat (n : \u2115) : CharacterModule.int :=\n LinearMap.toSpanSingleton \u2124 _ (QuotientAddGroup.mk (n : \u211a)\u207b\u00b9) |>.toAddMonoidHom\n\nprotected lemma int.divByNat_self (n : \u2115) :\n int.divByNat n n = 0 := by\n obtain rfl | h0 := eq_or_ne n 0\n \u00b7 apply map_zero\n exact (AddCircle.coe_eq_zero_iff _).mpr\n \u27e81, by simp [mul_inv_cancel\u2080 (Nat.cast_ne_zero (R := \u211a).mpr h0)]\u27e9\n\nvariable {A}\n\n/-- The `\u2124`-submodule spanned by a single element `a` is isomorphic to the quotient of `\u2124`\nby the ideal generated by the order of `a`. -/", "-- Mathlib.Algebra.Module.DedekindDomain.isInternal_prime_power_torsion_of_is_torsion_by_ideal (L37-L63)\ntheorem isInternal_prime_power_torsion_of_is_torsion_by_ideal\n {I : Ideal R} (hI : I \u2260 \u22a5) (hM : Module.IsTorsionBySet R M I) :\n DirectSum.IsInternal fun p : (factors I).toFinset =>\n torsionBySet R M (p ^ (factors I).count \u2191p : Ideal R) := by\nlet P := factors I\n have prime_of_mem := fun p (hp : p \u2208 P.toFinset) =>\n prime_of_factor p (Multiset.mem_toFinset.mp hp)\n apply torsionBySet_isInternal (p := fun p => p ^ P.count p) _\n \u00b7 convert hM\n rw [\u2190 Finset.inf_eq_iInf, IsDedekindDomain.inf_pow_eq_prod_of_prime,\n \u2190 Finset.prod_multiset_count, \u2190 associated_iff_eq]\n \u00b7 exact factors_prod hI\n \u00b7 exact prime_of_mem\n \u00b7 exact fun _ _ _ _ ij => ij\n \u00b7 intro p hp q hq pq; dsimp\n rw [irreducible_pow_sup]\n \u00b7 suffices (normalizedFactors _).count p = 0 by rw [this, zero_min, pow_zero, Ideal.one_eq_top]\n rw [Multiset.count_eq_zero,\n normalizedFactors_of_irreducible_pow (prime_of_mem q hq).irreducible,\n Multiset.mem_replicate]\n exact fun H => pq <| H.2.trans <| normalize_eq q\n \u00b7 rw [\u2190 Ideal.zero_eq_bot]; apply pow_ne_zero; exact (prime_of_mem q hq).ne_zero\n \u00b7 exact (prime_of_mem p hp).irreducible\n\n/-- A finitely generated torsion module over a Dedekind domain is an internal direct sum of its\n`p i ^ e i`-torsion submodules where `p i` are factors of `(\u22a4 : Submodule R M).annihilator` and\n`e i` are their multiplicities. -/", "-- Mathlib.Algebra.Module.BigOperators.sum_single_smul (L66-L71)\nlemma sum_single_smul\n {R : Type*} [Semiring R] [Module R \u03b1] (f : \u03b9 \u2192 \u03b1) (r : R) (i\u2080 : \u03b9) :\n \u2211 i, (Pi.single (M := fun _ \u21a6 R) i\u2080 r i) \u2022 f i = r \u2022 f i\u2080 := by\nrw [Finset.sum_eq_single i\u2080, Pi.single_eq_same] <;> aesop\n\nend Fintype", "-- Mathlib.Algebra.Module.CharacterModule.dual_surjective_of_injective (L103-L109)\nlemma dual_surjective_of_injective (f : A \u2192\u2097[R] B) (hf : Function.Injective f) :\n Function.Surjective (dual f) :=\n(Module.Baer.of_divisible _).extension_property_addMonoidHom _ hf\n\n/--\nTwo isomorphic modules have isomorphic character modules.\n-/", "-- Mathlib.Algebra.Module.Bimodule.toSubmodule (L109-L114)\ndef toSubmodule (p : Submodule (A \u2297[R] B) M) : Submodule A M :=\n{ p with\n carrier := p\n smul_mem' := smul_mem p }\n\n/-- Forgetting the `A` action, a `Submodule` over `A \u2297[R] B` is just a `Submodule` over `B`. -/", "-- Mathlib.Algebra.Module.End.Module (L43-L50)\ndef Module.toAddMonoidEnd : R \u2192+* AddMonoid.End M :=\n{ DistribMulAction.toAddMonoidEnd R M with\n map_zero' := AddMonoidHom.ext fun r => by simp\n map_add' x y :=\n AddMonoidHom.ext fun r => by simp [(AddMonoidHom.add_apply), add_smul] }\n\n/-- A convenience alias for `Module.toAddMonoidEnd` as an `AddMonoidHom`, usually to allow the\nuse of `AddMonoidHom.flip`. -/", "-- Mathlib.Algebra.Module.Basic.inv_natCast_smul_eq (L68-L74)\ntheorem inv_natCast_smul_eq {E : Type*} (R S : Type*) [AddCommMonoid E] [DivisionSemiring R]\n [DivisionSemiring S] [Module R E] [Module S E] (n : \u2115) (x : E) :\n (n\u207b\u00b9 : R) \u2022 x = (n\u207b\u00b9 : S) \u2022 x :=\nmap_inv_natCast_smul (AddMonoidHom.id E) R S n x\n\n/-- If `E` is a vector space over two division rings `R` and `S`, then scalar multiplications\nagree on inverses of integer numbers in `R` and `S`. -/", "-- Mathlib.Algebra.Module.Equiv.Basic.coe_one (L94-L95)\nlemma coe_one : \u2191(1 : M \u2243\u2097[R] M) = id := rfl", "-- Mathlib.Algebra.Module.CharacterModule.dual_bijective_iff_bijective (L250-L255)\nlemma dual_bijective_iff_bijective {f : A \u2192\u2097[R] A'} :\n Function.Bijective (dual f) \u2194 Function.Bijective f :=\n\u27e8fun h \u21a6 \u27e8dual_surjective_iff_injective.mp h.2, dual_injective_iff_surjective.mp h.1\u27e9,\n fun h \u21a6 \u27e8dual_injective_iff_surjective.mpr h.2, dual_surjective_iff_injective.mpr h.1\u27e9\u27e9\n\nend CharacterModule", "-- Mathlib.Algebra.Module.End.IsAddUnit (L62-L67)\nlemma IsAddUnit.smul_left [DistribSMul S M] (hx : IsAddUnit x) (s : S) :\n IsAddUnit (s \u2022 x) :=\nhx.map (DistribSMul.toAddMonoidHom M s)\n\nvariable {r} (x)", "-- Mathlib.Algebra.Module.Equiv.Basic.mul_eq_trans (L91-L92)\nlemma mul_eq_trans (f g : M \u2243\u2097[R] M) : f * g = g.trans f := rfl", "-- Mathlib.Algebra.Module.CharacterModule.dual_injective_iff_surjective (L246-L249)\nlemma dual_injective_iff_surjective {f : A \u2192\u2097[R] A'} :\n Function.Injective (dual f) \u2194 Function.Surjective f :=\n\u27e8fun h \u21a6 surjective_of_dual_injective f h, fun h \u21a6 dual_injective_of_surjective f h\u27e9", "-- Mathlib.Algebra.Module.Bimodule.smul_mem (L91-L94)\ntheorem smul_mem (p : Submodule (A \u2297[R] B) M) (a : A) {m : M} (hm : m \u2208 p) : a \u2022 m \u2208 p := by\nsuffices a \u2022 m = a \u2297\u209c[R] (1 : B) \u2022 m by exact this.symm \u25b8 p.smul_mem _ hm\n simp [TensorProduct.Algebra.smul_def]", "-- Mathlib.Algebra.Module.Bimodule.smul_mem' (L95-L100)\ntheorem smul_mem' (p : Submodule (A \u2297[R] B) M) (b : B) {m : M} (hm : m \u2208 p) : b \u2022 m \u2208 p := by\nsuffices b \u2022 m = (1 : A) \u2297\u209c[R] b \u2022 m by exact this.symm \u25b8 p.smul_mem _ hm\n simp [TensorProduct.Algebra.smul_def]\n\n/-- If `A` and `B` are also `Algebra`s over yet another set of scalars `S` then we may \"base change\"\nfrom `R` to `S`. -/", "-- Mathlib.Algebra.Module.Congruence.Defs.ModuleCon (L148-L160)\ndef ModuleCon.ker [Monoid R] [Monoid S] [AddMonoid M] [AddMonoid N] [DistribMulAction R M]\n [DistribMulAction S N] {\u03c6 : R \u2192* S} (f : M \u2192\u2091+[\u03c6] N) : ModuleCon R M where\n __ := SMulCon.ker f.toMulActionHom\n__ := AddCon.ker f\n\n/-- The first isomorphism theorem for semimodules in the case of a surjective homomorphism. -/\nnoncomputable def ModuleCon.quotientKerEquivOfSurjective [Semiring S] [AddCommMonoid M]\n [AddCommMonoid N] [Module S M] [Module S N] (f : M \u2192\u2097[S] N) (hf : Function.Surjective f) :\n (ker f.toDistribMulActionHom).Quotient \u2243\u2097[S] N where\n __ := AddCon.quotientKerEquivOfSurjective f.toAddMonoidHom hf\n map_smul' s := by rintro \u27e8\u27e9; apply map_smul f\n\nend ker", "-- Mathlib.Algebra.Module.Basic.map_inv_natCast_smul (L41-L57)\ntheorem map_inv_natCast_smul [AddCommMonoid M] [AddCommMonoid M\u2082] {F : Type*} [FunLike F M M\u2082]\n [AddMonoidHomClass F M M\u2082] (f : F) (R S : Type*)\n [DivisionSemiring R] [DivisionSemiring S] [Module R M]\n [Module S M\u2082] (n : \u2115) (x : M) : f ((n\u207b\u00b9 : R) \u2022 x) = (n\u207b\u00b9 : S) \u2022 f x := by\nby_cases hR : (n : R) = 0 <;> by_cases hS : (n : S) = 0\n \u00b7 simp [hR, hS, map_zero f]\n \u00b7 suffices \u2200 y, f y = 0 by rw [this, this, smul_zero]\n clear x\n intro x\n rw [\u2190 inv_smul_smul\u2080 hS (f x), \u2190 map_natCast_smul f R S]\n simp [hR, map_zero f]\n \u00b7 suffices \u2200 y, f y = 0 by simp [this]\n clear x\n intro x\n rw [\u2190 smul_inv_smul\u2080 hR x, map_natCast_smul f R S, hS, zero_smul]\n \u00b7 rw [\u2190 inv_smul_smul\u2080 hS (f _), \u2190 map_natCast_smul f R S, smul_inv_smul\u2080 hR]", "-- Mathlib.Algebra.Module.Bimodule.mk (L82-L90)\ndef mk (p : AddSubmonoid M) (hA : \u2200 (a : A) {m : M}, m \u2208 p \u2192 a \u2022 m \u2208 p)\n (hB : \u2200 (b : B) {m : M}, m \u2208 p \u2192 b \u2022 m \u2208 p) : Submodule (A \u2297[R] B) M :=\n{ p with\n carrier := p\n smul_mem' := fun ab m =>\n TensorProduct.induction_on ab (fun _ => by simp only [zero_smul, SetLike.mem_coe, zero_mem])\n (fun a b hm => by simpa only [TensorProduct.Algebra.smul_def] using hA a (hB b hm))\n fun z w hz hw hm => by simpa only [add_smul] using p.add_mem (hz hm) (hw hm) }", "-- Mathlib.Algebra.Module.Equiv.Basic.coe_toLinearMap_one (L99-L100)\nlemma coe_toLinearMap_one : (\u2191(1 : M \u2243\u2097[R] M) : M \u2192\u2097[R] M) = LinearMap.id := rfl", "-- Mathlib.Algebra.Module.BigOperators.Multiset (L29-L31)\ntheorem Multiset.sum_smul {l : Multiset R} {x : M} : l.sum \u2022 x = (l.map fun r \u21a6 r \u2022 x).sum :=\n((smulAddHom R M).flip x).map_multiset_sum l", "-- Mathlib.Algebra.Module.DedekindDomain.exists_isInternal_prime_power_torsion (L76-L83)\ntheorem exists_isInternal_prime_power_torsion [Module.Finite R M] (hM : Module.IsTorsion R M) :\n \u2203 (P : Finset <| Ideal R) (_ : DecidableEq P) (_ : \u2200 p \u2208 P, Prime p) (e : P \u2192 \u2115),\n DirectSum.IsInternal fun p : P => torsionBySet R M (p ^ e p : Ideal R) := by\nclassical\n exact \u27e8_, _, fun p hp => prime_of_factor p (Multiset.mem_toFinset.mp hp), _,\n isInternal_prime_power_torsion hM\u27e9\n\nend Submodule", "-- Mathlib.Algebra.Module.Card.mk_le_of_module (L28-L35)\ntheorem mk_le_of_module (R : Type u) (E : Type v)\n [AddCommGroup E] [Ring R] [IsDomain R] [Module R E] [Nontrivial E] [Module.IsTorsionFree R E] :\n Cardinal.lift.{v} (#R) \u2264 Cardinal.lift.{u} (#E) := by\nobtain \u27e8x, hx\u27e9 : \u2203 (x : E), x \u2260 0 := exists_ne 0\n have : Injective (fun k \u21a6 k \u2022 x) := smul_left_injective R hx\n exact lift_mk_le_lift_mk_of_injective this\n\nend Cardinal", "-- Mathlib.Algebra.Module.End.smulAddHom (L51-L55)\ndef smulAddHom : R \u2192+ M \u2192+ M :=\n(Module.toAddMonoidEnd R M).toAddMonoidHom\n\nvariable {R M}", "-- Mathlib.Algebra.Module.Basic.smul_indicator_one_apply (L168-L173)\nlemma smul_indicator_one_apply (s : Set \u03b1) (r : R) (a : \u03b1) :\n r \u2022 s.indicator (1 : \u03b1 \u2192 R) a = s.indicator (fun _ \u21a6 r) a := by\nsimp_rw [\u2190 indicator_const_smul_apply, Pi.one_apply, smul_eq_mul, mul_one]\n\nend MulZeroOneClass\nend Set", "-- Mathlib.Algebra.Module.CharacterModule.eq_zero_of_ofSpanSingleton_apply_self (L201-L214)\nlemma eq_zero_of_ofSpanSingleton_apply_self (a : A)\n (h : ofSpanSingleton a \u27e8a, Submodule.mem_span_singleton_self a\u27e9 = 0) : a = 0 := by\nerw [ofSpanSingleton, LinearMap.toAddMonoidHom_coe, LinearMap.comp_apply,\n intSpanEquivQuotAddOrderOf_apply_self, Submodule.liftQSpanSingleton_apply,\n AddMonoidHom.coe_toIntLinearMap, int.divByNat, LinearMap.toSpanSingleton_apply_one,\n AddCircle.coe_eq_zero_iff] at h\n rcases h with \u27e8n, hn\u27e9\n apply_fun Rat.den at hn\n rw [zsmul_one, Rat.den_intCast, Rat.inv_natCast_den_of_pos] at hn\n \u00b7 split_ifs at hn\n \u00b7 cases hn\n \u00b7 rwa [eq_comm, AddMonoid.addOrderOf_eq_one_iff] at hn\n \u00b7 grind", "-- Mathlib.Algebra.Module.BigOperators.Finset (L38-L40)\ntheorem Finset.sum_smul {f : \u03b9 \u2192 R} {s : Finset \u03b9} {x : M} :\n (\u2211 i \u2208 s, f i) \u2022 x = \u2211 i \u2208 s, f i \u2022 x := map_sum ((smulAddHom R M).flip x) f s", "-- Mathlib.Algebra.Module.CharacterModule.eq_zero_of_character_apply (L220-L224)\nlemma eq_zero_of_character_apply {a : A} (h : \u2200 c : CharacterModule A, c a = 0) : a = 0 := by\ncontrapose! h; exact exists_character_apply_ne_zero_of_ne_zero h\n\nvariable [Module R A] [Module R A'] [Module R B] {R A' B}", "-- Mathlib.Algebra.Module.Basic.invOf_two_smul_add_invOf_two_smul (L36-L40)\ntheorem invOf_two_smul_add_invOf_two_smul (R) [Semiring R] [AddCommMonoid M] [Module R M]\n [Invertible (2 : R)] (x : M) :\n (\u215f2 : R) \u2022 x + (\u215f2 : R) \u2022 x = x :=\nConvex.combo_self invOf_two_add_invOf_two _", "-- Mathlib.Algebra.Module.CharacterModule.surjective_of_dual_injective (L236-L245)\nlemma surjective_of_dual_injective (f : A \u2192\u2097[R] A') (hf : Function.Injective (dual f)) :\n Function.Surjective f := by\nrw [\u2190 LinearMap.range_eq_top, \u2190 Submodule.unique_quotient_iff_eq_top]\n refine \u27e8Unique.mk inferInstance fun a \u21a6 eq_zero_of_character_apply fun c \u21a6 ?_\u27e9\n obtain \u27e8b, rfl\u27e9 := QuotientAddGroup.mk'_surjective _ a\n suffices eq : dual (Submodule.mkQ _) c = 0 from congr($eq b)\n refine hf ?_\n rw [\u2190 LinearMap.comp_apply, \u2190 dual_comp, LinearMap.range_mkQ_comp, dual_zero,\n LinearMap.zero_apply, dual_apply, AddMonoidHom.zero_comp]", "-- Mathlib.Algebra.Module.Equiv.Basic.one_eq_refl (L90-L90)\nlemma one_eq_refl : (1 : M \u2243\u2097[R] M) = refl R M := rfl", "-- Mathlib.Algebra.Module.Basic.indicator_smul_const_apply (L155-L157)\nlemma indicator_smul_const_apply (s : Set \u03b1) (r : \u03b1 \u2192 R) (m : M) (a : \u03b1) :\n indicator s (r \u00b7 \u2022 m) a = indicator s r a \u2022 m := indicator_smul_apply_left _ _ _ _", "-- Mathlib.Algebra.Module.Defs.Convex (L76-L80)\ntheorem Convex.combo_self {a b : R} (h : a + b = 1) (x : M) : a \u2022 x + b \u2022 x = x := by\nrw [\u2190 add_smul, h, one_smul]\n\nvariable (R)", "-- Mathlib.Algebra.Module.Congruence.Defs.SMulCon (L143-L147)\ndef SMulCon.ker [SMul R M] [SMul S N] {\u03c6 : R \u2192 S} (f : M \u2192\u2091[\u03c6] N) : SMulCon R M where\n __ := Setoid.ker f\nsmul r _ _ h := by rw [Setoid.ker_def] at h \u22a2; simp_rw [map_smul\u209b\u2097, h]\n\n/-- The kernel of a `DistribMulActionHom` as a congruence relation. -/", "-- Mathlib.Algebra.Module.CharacterModule.dual_injective_of_surjective (L95-L102)\nlemma dual_injective_of_surjective (f : A \u2192\u2097[R] B) (hf : Function.Surjective f) :\n Function.Injective (dual f) := by\nintro \u03c6 \u03c8 eq\n ext x\n obtain \u27e8y, rfl\u27e9 := hf x\n change (dual f) \u03c6 _ = (dual f) \u03c8 _\n rw [eq]", "-- Mathlib.Algebra.Module.Basic.inv_intCast_smul_comm (L88-L94)\ntheorem inv_intCast_smul_comm {\u03b1 E : Type*} (R : Type*) [AddCommGroup E] [DivisionRing R]\n [Module R E] [DistribSMul \u03b1 E] (n : \u2124) (s : \u03b1) (x : E) :\n (n\u207b\u00b9 : R) \u2022 s \u2022 x = s \u2022 (n\u207b\u00b9 : R) \u2022 x :=\n(map_inv_intCast_smul (DistribSMul.toAddMonoidHom E s) R R n x).symm\n\nnamespace Function", "-- Mathlib.Algebra.Module.Defs.neg_smul_neg (L142-L145)\ntheorem neg_smul_neg : -r \u2022 -x = r \u2022 x := by rw [neg_smul, smul_neg, neg_neg]\nvariable (R)", "-- Mathlib.Algebra.Module.BigOperators.sum_piFinset_apply (L58-L64)\nlemma sum_piFinset_apply (f : \u03ba \u2192 \u03b1) (s : Finset \u03ba) (i : \u03b9) :\n \u2211 g \u2208 piFinset fun _ : \u03b9 \u21a6 s, f (g i) = #s ^ (card \u03b9 - 1) \u2022 \u2211 b \u2208 s, f b := by\nclassical\n rw [Finset.sum_comp]\n simp only [eval_image_piFinset_const, card_filter_piFinset_const s, ite_smul, zero_smul, smul_sum,\n Finset.sum_ite_mem, inter_self]", "-- Mathlib.Algebra.Module.Basic.support_smul_subset_right (L101-L104)\nlemma support_smul_subset_right [Zero M] [SMulZeroClass R M] (f : \u03b1 \u2192 R) (g : \u03b1 \u2192 M) :\n support (f \u2022 g) \u2286 support g :=\nfun x hbf hf \u21a6 hbf <| by rw [Pi.smul_apply', hf, smul_zero]", "-- Mathlib.Algebra.Module.Bimodule.toSubmodule' (L116-L129)\ndef toSubmodule' (p : Submodule (A \u2297[R] B) M) : Submodule B M :=\n{ p with\n carrier := p\n smul_mem' := smul_mem' p }\n\nend Algebra\n\nsection Ring\n\nvariable (R S M : Type*) [Ring R] [Ring S]\nvariable [AddCommGroup M] [Module R M] [Module S M] [SMulCommClass R S M]\n\n/-- A `Submodule` over `R \u2297[\u2115] S` is naturally also a `Submodule` over the canonically-isomorphic\nring `R \u2297[\u2124] S`. -/", "-- Mathlib.Algebra.Module.Equiv.Basic.restrictScalars_inj (L60-L65)\ntheorem restrictScalars_inj (f g : M \u2243\u2097[S] M\u2082) :\n f.restrictScalars R = g.restrictScalars R \u2194 f = g :=\n(restrictScalars_injective R).eq_iff\n\nend RestrictScalars", "-- Mathlib.Algebra.Module.Basic.indicator_smul_left (L151-L154)\nlemma indicator_smul_left (s : Set \u03b1) (r : \u03b1 \u2192 R) (f : \u03b1 \u2192 M) :\n indicator s (fun a \u21a6 r a \u2022 f a) = fun a \u21a6 indicator s r a \u2022 f a :=\nfunext <| indicator_smul_apply_left _ _ _", "-- Mathlib.Algebra.Module.Equiv.Basic.automorphismGroup (L81-L89)\ninstance automorphismGroup : Group (M \u2243\u2097[R] M) where\n mul f g := g.trans f\none := LinearEquiv.refl R M\n inv f := f.symm\n mul_assoc _ _ _ := rfl\n mul_one _ := ext fun _ \u21a6 rfl\n one_mul _ := ext fun _ \u21a6 rfl\n inv_mul_cancel f := ext <| f.left_inv", "-- Mathlib.Algebra.Module.End.smulAddHom_apply (L57-L61)\ntheorem smulAddHom_apply : smulAddHom R M r x = r \u2022 x :=\nrfl\n\nvariable {x}", "-- Mathlib.Algebra.Module.Bimodule.toSubbimoduleNat (L137-L142)\ndef toSubbimoduleNat (p : Submodule (R \u2297[\u2124] S) M) : Submodule (R \u2297[\u2115] S) M :=\nbaseChange \u2115 p\n\nend Ring\n\nend Subbimodule", "-- Mathlib.Algebra.Module.Basic.support_const_smul_subset (L113-L121)\nlemma support_const_smul_subset [Zero M] [SMulZeroClass R M] (a : R) (f : \u03b1 \u2192 M) :\n support (a \u2022 f) \u2286 support f := support_smul_subset_right (fun _ \u21a6 a) f\nend Function\n\nnamespace Set\nsection SMulZeroClass\nvariable [Zero M] [SMulZeroClass R M]", "-- Mathlib.Algebra.Module.Basic.indicator_smul_apply_left (L145-L150)\nlemma indicator_smul_apply_left (s : Set \u03b1) (r : \u03b1 \u2192 R) (f : \u03b1 \u2192 M) (a : \u03b1) :\n indicator s (fun a \u21a6 r a \u2022 f a) a = indicator s r a \u2022 f a := by\ndsimp only [indicator]\n split_ifs\n exacts [rfl, (zero_smul _ (f a)).symm]", "-- Mathlib.Algebra.Module.Bimodule.toSubbimoduleInt (L131-L135)\ndef toSubbimoduleInt (p : Submodule (R \u2297[\u2115] S) M) : Submodule (R \u2297[\u2124] S) M :=\nbaseChange \u2124 p\n\n/-- A `Submodule` over `R \u2297[\u2124] S` is naturally also a `Submodule` over the canonically-isomorphic\nring `R \u2297[\u2115] S`. -/", "-- Mathlib.Algebra.Module.Defs.neg_one_smul (L146-L149)\ntheorem neg_one_smul (x : M) : (-1 : R) \u2022 x = -x := by simp\nvariable {R}", "-- Mathlib.Algebra.Module.Basic.indicator_smul_apply (L122-L127)\nlemma indicator_smul_apply (s : Set \u03b1) (r : \u03b1 \u2192 R) (f : \u03b1 \u2192 M) (a : \u03b1) :\n indicator s (fun a \u21a6 r a \u2022 f a) a = r a \u2022 indicator s f a := by\ndsimp only [indicator]\n split_ifs\n exacts [rfl, (smul_zero (r a)).symm]", "-- Mathlib.Algebra.Module.Congruence.Defs.addConGen' (L64-L81)\ndef addConGen' (r : M \u2192 M \u2192 Prop) (hr : \u2200 (s : S) {m m'}, r m m' \u2192 r (s \u2022 m) (s \u2022 m')) :\n ModuleCon S M where\n toAddCon := addConGen r\nsmul s _ _ h := ((addConGen r).comap (DistribSMul.toAddMonoidHom M s) <| by simp).addConGen_le\n (fun _ _ h \u21a6 .of _ _ (hr s h)) h\n\n/-- The `AddCon` generated by a `SMulCon` is a `ModuleCon`. -/\nprotected abbrev addConGen (c : SMulCon S M) : ModuleCon S M := addConGen' c.r c.smul\n\nend addConGen\n\nend SMulCon\n\nnamespace ModuleCon\n\n/-- The quotient by a congruence relation preserving addition and scalar multiplication. -/\nprotected def Quotient [Add M] [SMul S M] (c : ModuleCon S M) : Type _ := Quotient c.toSetoid", "-- Mathlib.Algebra.Module.Defs.Module (L105-L107)\ntheorem Module.eq_zero_of_zero_eq_one (zero_eq_one : (0 : R) = 1) : x = 0 := by\nrw [\u2190 one_smul R x, \u2190 zero_eq_one, zero_smul]", "-- Mathlib.Algebra.Module.CharacterModule.exists_character_apply_ne_zero_of_ne_zero (L215-L219)\nlemma exists_character_apply_ne_zero_of_ne_zero {a : A} (ne_zero : a \u2260 0) :\n \u2203 (c : CharacterModule A), c a \u2260 0 :=\nhave \u27e8c, hc\u27e9 := dual_surjective_of_injective _ (Submodule.injective_subtype _) (ofSpanSingleton a)\n \u27e8c, fun h \u21a6 ne_zero <| eq_zero_of_ofSpanSingleton_apply_self a <| by rwa [\u2190 hc]\u27e9"], "statement": "theorem sum_mem_iSup {\u03b9 : Type*} [Fintype \u03b9] {f : \u03b9 \u2192 M} {p : \u03b9 \u2192 Submodule R M}\n (h : \u2200 i, f i \u2208 p i) : (\u2211 i, f i) \u2208 \u2a06 i, p i", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 38828, "declarations_count": 4378, "diagnostics_count": 0, "duplicate_fingerprint": "53d5370695b330fb", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 14953, "lean_code_chars": 35558, "lean_code_ratio": 0.9158, "length_bucket": "long", "line_count": 1157, "natural_language_chars": 3270, "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.Algebra.Module.Submodule.Lattice).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem sum_mem_iSup {\u03b9 : Type*} [Fintype \u03b9] {f : \u03b9 \u2192 M} {p : \u03b9 \u2192 Submodule R M}\n (h : \u2200 i, f i \u2208 p i) : (\u2211 i, f i) \u2208 \u2a06 i, p i\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.inhabited' (L57-L59)\ninstance inhabited' : Inhabited (Submodule R M) :=\n\u27e8\u22a5\u27e9\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.bot_coe (L61-L63)\ntheorem bot_coe : ((\u22a5 : Submodule R M) : Set M) = {0} :=\nrfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.bot_toAddSubmonoid (L65-L67)\ntheorem bot_toAddSubmonoid : (\u22a5 : Submodule R M).toAddSubmonoid = \u22a5 :=\nrfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.bot_toAddSubgroup (L69-L72)\nlemma bot_toAddSubgroup {R M} [Ring R] [AddCommGroup M] [Module R M] :\n (\u22a5 : Submodule R M).toAddSubgroup = \u22a5 := rfl\nvariable (R) in\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.mem_bot (L74-L76)\ntheorem mem_bot {x : M} : x \u2208 (\u22a5 : Submodule R M) \u2194 x = 0 :=\nSet.mem_singleton_iff\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.uniqueBot (L80-L82)\ninstance uniqueBot : Unique (\u22a5 : Submodule R M) :=\n\u27e8inferInstance, fun x \u21a6 Subtype.ext <| (mem_bot R).1 x.mem\u27e9\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.nonzero_mem_of_bot_lt (L97-L100)\ntheorem nonzero_mem_of_bot_lt {p : Submodule R M} (bot_lt : \u22a5 < p) : \u2203 a : p, a \u2260 0 :=\nlet \u27e8b, hb\u2081, hb\u2082\u27e9 := p.ne_bot_iff.mp bot_lt.ne'\n \u27e8\u27e8b, hb\u2081\u27e9, hb\u2082 \u2218 congr_arg Subtype.val\u27e9\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.exists_mem_ne_zero_of_ne_bot (L101-L106)\ntheorem exists_mem_ne_zero_of_ne_bot {p : Submodule R M} (h : p \u2260 \u22a5) : \u2203 b : M, b \u2208 p \u2227 b \u2260 0 :=\nlet \u27e8b, hb\u2081, hb\u2082\u27e9 := p.ne_bot_iff.mp h\n \u27e8b, hb\u2081, hb\u2082\u27e9\n\n-- FIXME: we default PUnit to PUnit.{1} here without the explicit universe annotation\n/-- The bottom submodule is linearly equivalent to punit as an `R`-module. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.botEquivPUnit (L108-L113)\ndef botEquivPUnit : (\u22a5 : Submodule R M) \u2243\u2097[R] PUnit.{v + 1} where\n toFun _ := PUnit.unit\ninvFun _ := 0\n map_add' _ _ := rfl\n map_smul' _ _ := rfl\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.subsingleton_iff_eq_bot (L114-L118)\ntheorem subsingleton_iff_eq_bot : Subsingleton p \u2194 p = \u22a5 := by\nrw [subsingleton_iff, Submodule.eq_bot_iff]\n refine \u27e8fun h x hx \u21a6 by simpa using h \u27e8x, hx\u27e9 \u27e80, p.zero_mem\u27e9,\n fun h \u27e8x, hx\u27e9 \u27e8y, hy\u27e9 \u21a6 by simp [h x hx, h y hy]\u27e9\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.eq_bot_of_subsingleton (L119-L121)\ntheorem eq_bot_of_subsingleton [Subsingleton p] : p = \u22a5 :=\nsubsingleton_iff_eq_bot.mp inferInstance\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.nontrivial_iff_ne_bot (L122-L129)\ntheorem nontrivial_iff_ne_bot : Nontrivial p \u2194 p \u2260 \u22a5 := by\nrw [iff_not_comm, not_nontrivial_iff_subsingleton, subsingleton_iff_eq_bot]\n\n/-!\n## Top element of a submodule\n-/\n\n/-- The universal set is the top element of the lattice of submodules. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.top_coe (L136-L138)\ntheorem top_coe : ((\u22a4 : Submodule R M) : Set M) = Set.univ :=\nrfl\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.coe_eq_univ (L140-L142)\ntheorem coe_eq_univ : (p : Set M) = Set.univ \u2194 p = \u22a4 := by\nrw [iff_comm, \u2190 SetLike.coe_set_eq, top_coe]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.top_toAddSubmonoid (L146-L148)\ntheorem top_toAddSubmonoid : (\u22a4 : Submodule R M).toAddSubmonoid = \u22a4 :=\nrfl\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.top_toAddSubgroup (L150-L152)\nlemma top_toAddSubgroup {R M : Type*} [Ring R] [AddCommGroup M] [Module R M] :\n (\u22a4 : Submodule R M).toAddSubgroup = \u22a4 := rfl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.toAddSubgroup_eq_top (L154-L156)\nlemma toAddSubgroup_eq_top {R M : Type*} [Ring R] [AddCommGroup M] [Module R M]\n {p : Submodule R M} : p.toAddSubgroup = \u22a4 \u2194 p = \u22a4 := by simp [\u2190 toAddSubgroup_inj]\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.eq_top_iff' (L163-L168)\ntheorem eq_top_iff' {p : Submodule R M} : p = \u22a4 \u2194 \u2200 x, x \u2208 p :=\neq_top_iff.trans \u27e8fun h _ \u21a6 h trivial, fun h x _ \u21a6 h x\u27e9\n\n/-- The top submodule is linearly equivalent to the module.\n\nThis is the module version of `AddSubmonoid.topEquiv`. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.topEquiv (L170-L179)\ndef topEquiv : (\u22a4 : Submodule R M) \u2243\u2097[R] M where\n toFun x := x\ninvFun x := \u27e8x, mem_top\u27e9\n map_add' _ _ := rfl\n map_smul' _ _ := rfl\n\n/-!\n## Infima & suprema in a submodule\n-/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.completeLattice (L207-L221)\ninstance completeLattice : CompleteLattice (Submodule R M) :=\n{ (inferInstance : OrderTop (Submodule R M)),\n (inferInstance : OrderBot (Submodule R M)) with\n sup := fun a b \u21a6 sInf { x | a \u2264 x \u2227 b \u2264 x }\n le_sup_left := fun _ _ \u21a6 le_sInf' fun _ \u27e8h, _\u27e9 \u21a6 h\n le_sup_right := fun _ _ \u21a6 le_sInf' fun _ \u27e8_, h\u27e9 \u21a6 h\n sup_le := fun _ _ _ h\u2081 h\u2082 \u21a6 sInf_le' \u27e8h\u2081, h\u2082\u27e9\n inf := (\u00b7 \u2293 \u00b7)\n le_inf := fun _ _ _ \u21a6 Set.subset_inter\n inf_le_left := fun _ _ \u21a6 Set.inter_subset_left\n inf_le_right := fun _ _ \u21a6 Set.inter_subset_right\n sSup S := sInf {sm | \u2200 s \u2208 S, s \u2264 sm}\n isLUB_sSup _ := isGLB_upperBounds.mp Submodule.isGLB_sInf\n isGLB_sInf _ := Submodule.isGLB_sInf }\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.coe_inf (L223-L225)\ntheorem coe_inf : \u2191(p \u2293 q) = (p \u2229 q : Set M) :=\nrfl\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.mem_inf (L227-L229)\ntheorem mem_inf {p q : Submodule R M} {x : M} : x \u2208 p \u2293 q \u2194 x \u2208 p \u2227 x \u2208 q :=\nIff.rfl\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.coe_sInf (L231-L233)\ntheorem coe_sInf (P : Set (Submodule R M)) : (\u2191(sInf P) : Set M) = \u22c2 p \u2208 P, \u2191p :=\nrfl\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.coe_finsetInf (L235-L242)\ntheorem coe_finsetInf {\u03b9} (s : Finset \u03b9) (p : \u03b9 \u2192 Submodule R M) :\n (\u2191(s.inf p) : Set M) = \u22c2 i \u2208 s, \u2191(p i) := by\nletI := Classical.decEq \u03b9\n refine s.induction_on ?_ fun i s _ ih \u21a6 ?_\n \u00b7 simp\n \u00b7 rw [Finset.inf_insert, coe_inf, ih]\n simp\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.coe_iInf (L244-L246)\ntheorem coe_iInf {\u03b9} (p : \u03b9 \u2192 Submodule R M) : (\u2191(\u2a05 i, p i) : Set M) = \u22c2 i, \u2191(p i) := by\nrw [iInf, coe_sInf]; simp only [Set.mem_range, Set.iInter_exists, Set.iInter_iInter_eq']\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.restrictScalars_injective (L55-L58)\ntheorem restrictScalars_injective :\n Function.Injective (restrictScalars R : (M \u2243\u2097[S] M\u2082) \u2192 M \u2243\u2097[R] M\u2082) := fun _ _ h \u21a6\next (LinearEquiv.congr_fun h :)\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Algebra.Module.End.AddMonoid (L32-L41)\ntheorem AddMonoid.End.natCast_def (n : \u2115) :\n (\u2191n : AddMonoid.End M) = DistribMulAction.toAddMonoidEnd \u2115 M n :=\nrfl\n\nvariable (R M)\n\nset_option backward.isDefEq.respectTransparency false in\n/-- `(\u2022)` as an `AddMonoidHom`.\n\nThis is a stronger version of `DistribMulAction.toAddMonoidEnd` -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Algebra.Module.DedekindDomain.isInternal_prime_power_torsion (L64-L75)\ntheorem isInternal_prime_power_torsion [Module.Finite R M]\n (hM : Module.IsTorsion R M) :\n DirectSum.IsInternal fun p : (factors (\u22a4 : Submodule R M).annihilator).toFinset =>\n torsionBySet R M (p ^ (factors (\u22a4 : Submodule R M).annihilator).count \u2191p : Ideal R) := by\nhave hM' := Module.isTorsionBySet_annihilator_top R M\n have hI := Submodule.annihilator_top_inter_nonZeroDivisors hM\n refine isInternal_prime_power_torsion_of_is_torsion_by_ideal ?_ hM'\n rw [Submodule.ne_bot_iff]\n obtain \u27e8x, H, hx\u27e9 := hI; exact \u27e8x, H, nonZeroDivisors.ne_zero hx\u27e9\n\n/-- A finitely generated torsion module over a Dedekind domain is an internal direct sum of its\n`p i ^ e i`-torsion submodules for some prime ideals `p i` and numbers `e i`. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_comp (L90-L94)\nlemma dual_comp {C : Type*} [AddCommGroup C] [Module R C] (f : A \u2192\u2097[R] B) (g : B \u2192\u2097[R] C) :\n dual (g.comp f) = (dual f).comp (dual g) := by\next\n rfl\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_const_smul_apply (L132-L135)\nlemma indicator_const_smul_apply (s : Set \u03b1) (r : R) (f : \u03b1 \u2192 M) (a : \u03b1) :\n indicator s (r \u2022 f \u00b7) a = r \u2022 indicator s f a :=\nindicator_smul_apply s (fun _ \u21a6 r) f a\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Algebra.Module.Defs.smul_add_one_sub_smul (L109-L117)\ntheorem smul_add_one_sub_smul {R : Type*} [Ring R] [Module R M] {r : R} {m : M} :\n r \u2022 m + (1 - r) \u2022 m = m := by rw [\u2190 add_smul, add_sub_cancel, one_smul]\nend AddCommMonoid\n\nsection AddCommGroup\n\nvariable [Semiring R] [AddCommGroup M]\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Algebra.Module.Basic.inv_natCast_smul_comm (L81-L87)\ntheorem inv_natCast_smul_comm {\u03b1 E : Type*} (R : Type*) [AddCommMonoid E] [DivisionSemiring R]\n [Module R E] [DistribSMul \u03b1 E] (n : \u2115) (s : \u03b1) (x : E) :\n (n\u207b\u00b9 : R) \u2022 s \u2022 x = s \u2022 (n\u207b\u00b9 : R) \u2022 x :=\n(map_inv_natCast_smul (DistribSMul.toAddMonoidHom E s) R R n x).symm\n\n/-- If `E` is a vector space over a division ring `R` and has a monoid action by `\u03b1`, then that\naction commutes by scalar multiplication of inverses of integers in `R` -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_const_smul (L136-L144)\nlemma indicator_const_smul (s : Set \u03b1) (r : R) (f : \u03b1 \u2192 M) :\n indicator s (r \u2022 f \u00b7) = (r \u2022 indicator s f \u00b7) :=\nfunext <| indicator_const_smul_apply s r f\n\nend SMulZeroClass\n\nsection SMulWithZero\nvariable [Zero R] [Zero M] [SMulWithZero R M]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Algebra.Module.Basic.support_const_smul_of_ne_zero (L105-L108)\nlemma support_const_smul_of_ne_zero [Semiring R] [IsDomain R] [AddCommMonoid M] [Module R M]\n [Module.IsTorsionFree R M] (c : R) (g : \u03b1 \u2192 M) (hc : c \u2260 0) : support (c \u2022 g) = support g :=\next fun _ \u21a6 smul_ne_zero_iff_right hc\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Algebra.Module.Defs.sub_smul (L150-L166)\ntheorem sub_smul (r s : R) (y : M) : (r - s) \u2022 y = r \u2022 y - s \u2022 y := by\nsimp [add_smul, sub_eq_add_neg]\n\nend Module\n\n/-- A module over a `Subsingleton` semiring is a `Subsingleton`. We cannot register this\nas an instance because Lean has no way to guess `R`. -/\nprotected theorem Module.subsingleton (R M : Type*) [MonoidWithZero R] [Subsingleton R] [Zero M]\n [MulActionWithZero R M] : Subsingleton M :=\n MulActionWithZero.subsingleton R M\n\n/-- A semiring is `Nontrivial` provided that there exists a nontrivial module over this semiring. -/\nprotected theorem Module.nontrivial (R M : Type*) [MonoidWithZero R] [Nontrivial M] [Zero M]\n [MulActionWithZero R M] : Nontrivial R :=\n MulActionWithZero.nontrivial R M\n\n-- see Note [lower instance priority]\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Algebra.Module.Basic.support_smul (L109-L112)\nlemma support_smul [Semiring R] [IsDomain R] [AddCommMonoid M] [Module R M]\n [Module.IsTorsionFree R M] (f : \u03b1 \u2192 R) (g : \u03b1 \u2192 M) : support (f \u2022 g) = support f \u2229 support g :=\next fun _ => smul_ne_zero_iff\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Algebra.Module.Bimodule.baseChange (L102-L107)\ndef baseChange (S : Type*) [CommSemiring S] [Module S M] [Algebra S A] [Algebra S B]\n [IsScalarTower S A M] [IsScalarTower S B M] (p : Submodule (A \u2297[R] B) M) :\n Submodule (A \u2297[S] B) M :=\nmk p.toAddSubmonoid (smul_mem p) (smul_mem' p)\n\n/-- Forgetting the `B` action, a `Submodule` over `A \u2297[R] B` is just a `Submodule` over `A`. -/\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_smul_const (L158-L167)\nlemma indicator_smul_const (s : Set \u03b1) (r : \u03b1 \u2192 R) (m : M) :\n indicator s (r \u00b7 \u2022 m) = (indicator s r \u00b7 \u2022 m) :=\nfunext <| indicator_smul_const_apply _ _ _\n\nend SMulWithZero\n\nsection MulZeroOneClass\n\nvariable [MulZeroOneClass R]\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Algebra.Module.Basic.inv_intCast_smul_eq (L75-L80)\ntheorem inv_intCast_smul_eq {E : Type*} (R S : Type*) [AddCommGroup E] [DivisionRing R]\n [DivisionRing S] [Module R E] [Module S E] (n : \u2124) (x : E) : (n\u207b\u00b9 : R) \u2022 x = (n\u207b\u00b9 : S) \u2022 x :=\nmap_inv_intCast_smul (AddMonoidHom.id E) R S n x\n\n/-- If `E` is a vector space over a division semiring `R` and has a monoid action by `\u03b1`, then that\naction commutes by scalar multiplication of inverses of natural numbers in `R`. -/\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Algebra.Module.Defs.two_smul (L81-L104)\ntheorem two_smul : (2 : R) \u2022 x = x + x := by rw [\u2190 one_add_one_eq_two, add_smul, one_smul]\n/-- Pullback a `Module` structure along an injective additive monoid homomorphism.\nSee note [reducible non-instances]. -/\nprotected abbrev Function.Injective.module [AddCommMonoid M\u2082] [SMul R M\u2082] (f : M\u2082 \u2192+ M)\n (hf : Injective f) (smul : \u2200 (c : R) (x), f (c \u2022 x) = c \u2022 f x) : Module R M\u2082 :=\n { hf.distribMulAction f smul with\n add_smul := fun c\u2081 c\u2082 x => hf <| by simp only [smul, f.map_add, add_smul]\n zero_smul := fun x => hf <| by simp only [smul, zero_smul, f.map_zero] }\n\n/-- Pushforward a `Module` structure along a surjective additive monoid homomorphism.\nSee note [reducible non-instances]. -/\nprotected abbrev Function.Surjective.module [AddCommMonoid M\u2082] [SMul R M\u2082] (f : M \u2192+ M\u2082)\n (hf : Surjective f) (smul : \u2200 (c : R) (x), f (c \u2022 x) = c \u2022 f x) : Module R M\u2082 :=\n { toDistribMulAction := hf.distribMulAction f smul\n add_smul := fun c\u2081 c\u2082 x => by\n rcases hf x with \u27e8x, rfl\u27e9\n simp only [add_smul, \u2190 smul, \u2190 f.map_add]\n zero_smul := fun x => by\n rcases hf x with \u27e8x, rfl\u27e9\n rw [\u2190 f.map_zero, \u2190 smul, zero_smul] }\n\nvariable {R}\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Algebra.Module.BigOperators.List (L26-L28)\ntheorem List.sum_smul {l : List R} {x : M} : l.sum \u2022 x = (l.map fun r \u21a6 r \u2022 x).sum :=\nmap_list_sum ((smulAddHom R M).flip x) l\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Algebra.Module.Defs.neg_smul (L139-L141)\ntheorem neg_smul : -r \u2022 x = -(r \u2022 x) :=\neq_neg_of_add_eq_zero_left <| by rw [\u2190 add_smul, neg_add_cancel, zero_smul]\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Algebra.Module.BigOperators.Fintype (L45-L51)\nlemma Fintype.sum_smul_sum [Fintype \u03b1] [Fintype \u03b2] (f : \u03b1 \u2192 R) (g : \u03b2 \u2192 M) :\n (\u2211 i, f i) \u2022 \u2211 j, g j = \u2211 i, \u2211 j, f i \u2022 g j := Finset.sum_smul_sum _ _\nend AddCommMonoid\n\nopen Finset\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.congr (L110-L119)\ndef congr (e : A \u2243\u2097[R] B) : CharacterModule A \u2243\u2097[R] CharacterModule B :=\n.ofLinear (dual e.symm) (dual e)\n (by ext c _; exact congr(c $(e.right_inv _)))\n (by ext c _; exact congr(c $(e.left_inv _)))\n\nopen TensorProduct\n\n/--\nAny linear map `L : A \u2192 B\u22c6` induces a character in `(A \u2297 B)\u22c6` by `a \u2297 b \u21a6 L a b`.\n-/\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Algebra.Module.Basic.Units (L31-L34)\ntheorem Units.neg_smul [Ring R] [AddCommGroup M] [Module R M] (u : R\u02e3) (x : M) :\n -u \u2022 x = -(u \u2022 x) := by\nrw [Units.smul_def, Units.val_neg, _root_.neg_smul, Units.smul_def]\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.intSpanEquivQuotAddOrderOf_apply_self (L181-L200)\nlemma intSpanEquivQuotAddOrderOf_apply_self (a : A) :\n intSpanEquivQuotAddOrderOf a \u27e8a, Submodule.mem_span_singleton_self a\u27e9 =\n Submodule.Quotient.mk 1 :=\n(LinearEquiv.eq_symm_apply _).mp <| Subtype.ext (one_zsmul _).symm\n\n/--\nFor an abelian group `A` and an element `a \u2208 A`, there is a character `c : \u2124 \u2219 a \u2192 \u211a \u29f8 \u2124` given by\n`m \u2022 a \u21a6 m / n` where `n` is the smallest positive integer such that `n \u2022 a = 0` and when such `n`\ndoes not exist, `c` is defined by `m \u2022 a \u21a6 m / 2`.\n-/\nnoncomputable def ofSpanSingleton (a : A) : CharacterModule (\u2124 \u2219 a) :=\n let l : \u2124 \u29f8 Ideal.span {(addOrderOf a : \u2124)} \u2192\u2097[\u2124] AddCircle (1 : \u211a) :=\n Submodule.liftQSpanSingleton _\n (CharacterModule.int.divByNat <|\n if addOrderOf a = 0 then 2 else addOrderOf a).toIntLinearMap <| by\n split_ifs with h\n \u00b7 rw [h, Nat.cast_zero, map_zero]\n \u00b7 apply CharacterModule.int.divByNat_self\n l \u2218\u2097 intSpanEquivQuotAddOrderOf a |>.toAddMonoidHom\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.restrictScalars (L48-L54)\ndef restrictScalars (f : M \u2243\u2097[S] M\u2082) : M \u2243\u2097[R] M\u2082 :=\n{ f.toLinearMap.restrictScalars R with\n toFun := f\n invFun := f.symm\n left_inv := f.left_inv\n right_inv := f.right_inv }\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_surjective_iff_injective (L225-L230)\nlemma dual_surjective_iff_injective {f : A \u2192\u2097[R] A'} :\n Function.Surjective (dual f) \u2194 Function.Injective f :=\n\u27e8fun h \u21a6 (injective_iff_map_eq_zero _).2 fun a h0 \u21a6 eq_zero_of_character_apply fun c \u21a6 by\n obtain \u27e8c, rfl\u27e9 := h c; exact congr(c $h0).trans c.map_zero,\n dual_surjective_of_injective f\u27e9\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Algebra.Module.Basic.map_inv_intCast_smul (L58-L67)\ntheorem map_inv_intCast_smul [AddCommGroup M] [AddCommGroup M\u2082] {F : Type*} [FunLike F M M\u2082]\n [AddMonoidHomClass F M M\u2082] (f : F) (R S : Type*) [DivisionRing R] [DivisionRing S] [Module R M]\n [Module S M\u2082] (z : \u2124) (x : M) : f ((z\u207b\u00b9 : R) \u2022 x) = (z\u207b\u00b9 : S) \u2022 f x := by\nobtain \u27e8n, rfl | rfl\u27e9 := z.eq_nat_or_neg\n \u00b7 rw [Int.cast_natCast, Int.cast_natCast, map_inv_natCast_smul _ R S]\n \u00b7 simp_rw [Int.cast_neg, Int.cast_natCast, inv_neg, neg_smul, map_neg,\n map_inv_natCast_smul _ R S]\n\n/-- If `E` is a vector space over two division semirings `R` and `S`, then scalar multiplications\nagree on inverses of natural numbers in `R` and `S`. -/\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_smul (L128-L131)\nlemma indicator_smul (s : Set \u03b1) (r : \u03b1 \u2192 R) (f : \u03b1 \u2192 M) :\n indicator s (fun a \u21a6 r a \u2022 f a) = fun a \u21a6 r a \u2022 indicator s f a :=\nfunext <| indicator_smul_apply s r f\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Algebra.Module.Basic.support_smul_subset_left (L95-L100)\nlemma support_smul_subset_left [Zero R] [Zero M] [SMulWithZero R M] (f : \u03b1 \u2192 R) (g : \u03b1 \u2192 M) :\n support (f \u2022 g) \u2286 support f := fun x hfg hf \u21a6\nhfg <| by rw [Pi.smul_apply', hf, zero_smul]\n\n-- Changed (2024-01-21): this lemma was generalised;\n-- the old version is now called `support_const_smul_subset`.\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.CharacterModule (L46-L49)\ndef CharacterModule : Type uA := A \u2192+ AddCircle (1 : \u211a)\nnamespace CharacterModule\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Algebra.Module.Defs.add_smul (L73-L75)\ntheorem add_smul : (r + s) \u2022 x = r \u2022 x + s \u2022 x :=\nModule.add_smul r s x\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_zero (L86-L89)\nlemma dual_zero : dual (0 : A \u2192\u2097[R] B) = 0 := by\next f\n exact map_zero f\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_rTensor_conj_homEquiv (L147-L171)\ntheorem dual_rTensor_conj_homEquiv (f : A \u2192\u2097[R] A') :\n homEquiv.symm.toLinearMap \u2218\u2097 dual (f.rTensor B) \u2218\u2097 homEquiv.toLinearMap = f.lcomp R _ := rfl\nend module\n\n/--\n`\u2124\u22c6`, the character module of `\u2124` in the unit rational circle.\n-/\nprotected abbrev int : Type := CharacterModule \u2124\n\n/-- Given `n : \u2115`, the map `m \u21a6 m / n`. -/\nprotected abbrev int.divByNat (n : \u2115) : CharacterModule.int :=\n LinearMap.toSpanSingleton \u2124 _ (QuotientAddGroup.mk (n : \u211a)\u207b\u00b9) |>.toAddMonoidHom\n\nprotected lemma int.divByNat_self (n : \u2115) :\n int.divByNat n n = 0 := by\n obtain rfl | h0 := eq_or_ne n 0\n \u00b7 apply map_zero\n exact (AddCircle.coe_eq_zero_iff _).mpr\n \u27e81, by simp [mul_inv_cancel\u2080 (Nat.cast_ne_zero (R := \u211a).mpr h0)]\u27e9\n\nvariable {A}\n\n/-- The `\u2124`-submodule spanned by a single element `a` is isomorphic to the quotient of `\u2124`\nby the ideal generated by the order of `a`. -/\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Algebra.Module.DedekindDomain.isInternal_prime_power_torsion_of_is_torsion_by_ideal (L37-L63)\ntheorem isInternal_prime_power_torsion_of_is_torsion_by_ideal\n {I : Ideal R} (hI : I \u2260 \u22a5) (hM : Module.IsTorsionBySet R M I) :\n DirectSum.IsInternal fun p : (factors I).toFinset =>\n torsionBySet R M (p ^ (factors I).count \u2191p : Ideal R) := by\nlet P := factors I\n have prime_of_mem := fun p (hp : p \u2208 P.toFinset) =>\n prime_of_factor p (Multiset.mem_toFinset.mp hp)\n apply torsionBySet_isInternal (p := fun p => p ^ P.count p) _\n \u00b7 convert hM\n rw [\u2190 Finset.inf_eq_iInf, IsDedekindDomain.inf_pow_eq_prod_of_prime,\n \u2190 Finset.prod_multiset_count, \u2190 associated_iff_eq]\n \u00b7 exact factors_prod hI\n \u00b7 exact prime_of_mem\n \u00b7 exact fun _ _ _ _ ij => ij\n \u00b7 intro p hp q hq pq; dsimp\n rw [irreducible_pow_sup]\n \u00b7 suffices (normalizedFactors _).count p = 0 by rw [this, zero_min, pow_zero, Ideal.one_eq_top]\n rw [Multiset.count_eq_zero,\n normalizedFactors_of_irreducible_pow (prime_of_mem q hq).irreducible,\n Multiset.mem_replicate]\n exact fun H => pq <| H.2.trans <| normalize_eq q\n \u00b7 rw [\u2190 Ideal.zero_eq_bot]; apply pow_ne_zero; exact (prime_of_mem q hq).ne_zero\n \u00b7 exact (prime_of_mem p hp).irreducible\n\n/-- A finitely generated torsion module over a Dedekind domain is an internal direct sum of its\n`p i ^ e i`-torsion submodules where `p i` are factors of `(\u22a4 : Submodule R M).annihilator` and\n`e i` are their multiplicities. -/\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Algebra.Module.BigOperators.sum_single_smul (L66-L71)\nlemma sum_single_smul\n {R : Type*} [Semiring R] [Module R \u03b1] (f : \u03b9 \u2192 \u03b1) (r : R) (i\u2080 : \u03b9) :\n \u2211 i, (Pi.single (M := fun _ \u21a6 R) i\u2080 r i) \u2022 f i = r \u2022 f i\u2080 := by\nrw [Finset.sum_eq_single i\u2080, Pi.single_eq_same] <;> aesop\n\nend Fintype\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_surjective_of_injective (L103-L109)\nlemma dual_surjective_of_injective (f : A \u2192\u2097[R] B) (hf : Function.Injective f) :\n Function.Surjective (dual f) :=\n(Module.Baer.of_divisible _).extension_property_addMonoidHom _ hf\n\n/--\nTwo isomorphic modules have isomorphic character modules.\n-/\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Algebra.Module.Bimodule.toSubmodule (L109-L114)\ndef toSubmodule (p : Submodule (A \u2297[R] B) M) : Submodule A M :=\n{ p with\n carrier := p\n smul_mem' := smul_mem p }\n\n/-- Forgetting the `A` action, a `Submodule` over `A \u2297[R] B` is just a `Submodule` over `B`. -/\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Algebra.Module.End.Module (L43-L50)\ndef Module.toAddMonoidEnd : R \u2192+* AddMonoid.End M :=\n{ DistribMulAction.toAddMonoidEnd R M with\n map_zero' := AddMonoidHom.ext fun r => by simp\n map_add' x y :=\n AddMonoidHom.ext fun r => by simp [(AddMonoidHom.add_apply), add_smul] }\n\n/-- A convenience alias for `Module.toAddMonoidEnd` as an `AddMonoidHom`, usually to allow the\nuse of `AddMonoidHom.flip`. -/\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Algebra.Module.Basic.inv_natCast_smul_eq (L68-L74)\ntheorem inv_natCast_smul_eq {E : Type*} (R S : Type*) [AddCommMonoid E] [DivisionSemiring R]\n [DivisionSemiring S] [Module R E] [Module S E] (n : \u2115) (x : E) :\n (n\u207b\u00b9 : R) \u2022 x = (n\u207b\u00b9 : S) \u2022 x :=\nmap_inv_natCast_smul (AddMonoidHom.id E) R S n x\n\n/-- If `E` is a vector space over two division rings `R` and `S`, then scalar multiplications\nagree on inverses of integer numbers in `R` and `S`. -/\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.coe_one (L94-L95)\nlemma coe_one : \u2191(1 : M \u2243\u2097[R] M) = id := rfl\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_bijective_iff_bijective (L250-L255)\nlemma dual_bijective_iff_bijective {f : A \u2192\u2097[R] A'} :\n Function.Bijective (dual f) \u2194 Function.Bijective f :=\n\u27e8fun h \u21a6 \u27e8dual_surjective_iff_injective.mp h.2, dual_injective_iff_surjective.mp h.1\u27e9,\n fun h \u21a6 \u27e8dual_injective_iff_surjective.mpr h.2, dual_surjective_iff_injective.mpr h.1\u27e9\u27e9\n\nend CharacterModule\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Algebra.Module.End.IsAddUnit (L62-L67)\nlemma IsAddUnit.smul_left [DistribSMul S M] (hx : IsAddUnit x) (s : S) :\n IsAddUnit (s \u2022 x) :=\nhx.map (DistribSMul.toAddMonoidHom M s)\n\nvariable {r} (x)\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.mul_eq_trans (L91-L92)\nlemma mul_eq_trans (f g : M \u2243\u2097[R] M) : f * g = g.trans f := rfl\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_injective_iff_surjective (L246-L249)\nlemma dual_injective_iff_surjective {f : A \u2192\u2097[R] A'} :\n Function.Injective (dual f) \u2194 Function.Surjective f :=\n\u27e8fun h \u21a6 surjective_of_dual_injective f h, fun h \u21a6 dual_injective_of_surjective f h\u27e9\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Algebra.Module.Bimodule.smul_mem (L91-L94)\ntheorem smul_mem (p : Submodule (A \u2297[R] B) M) (a : A) {m : M} (hm : m \u2208 p) : a \u2022 m \u2208 p := by\nsuffices a \u2022 m = a \u2297\u209c[R] (1 : B) \u2022 m by exact this.symm \u25b8 p.smul_mem _ hm\n simp [TensorProduct.Algebra.smul_def]\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Algebra.Module.Bimodule.smul_mem' (L95-L100)\ntheorem smul_mem' (p : Submodule (A \u2297[R] B) M) (b : B) {m : M} (hm : m \u2208 p) : b \u2022 m \u2208 p := by\nsuffices b \u2022 m = (1 : A) \u2297\u209c[R] b \u2022 m by exact this.symm \u25b8 p.smul_mem _ hm\n simp [TensorProduct.Algebra.smul_def]\n\n/-- If `A` and `B` are also `Algebra`s over yet another set of scalars `S` then we may \"base change\"\nfrom `R` to `S`. -/\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Algebra.Module.Congruence.Defs.ModuleCon (L148-L160)\ndef ModuleCon.ker [Monoid R] [Monoid S] [AddMonoid M] [AddMonoid N] [DistribMulAction R M]\n [DistribMulAction S N] {\u03c6 : R \u2192* S} (f : M \u2192\u2091+[\u03c6] N) : ModuleCon R M where\n __ := SMulCon.ker f.toMulActionHom\n__ := AddCon.ker f\n\n/-- The first isomorphism theorem for semimodules in the case of a surjective homomorphism. -/\nnoncomputable def ModuleCon.quotientKerEquivOfSurjective [Semiring S] [AddCommMonoid M]\n [AddCommMonoid N] [Module S M] [Module S N] (f : M \u2192\u2097[S] N) (hf : Function.Surjective f) :\n (ker f.toDistribMulActionHom).Quotient \u2243\u2097[S] N where\n __ := AddCon.quotientKerEquivOfSurjective f.toAddMonoidHom hf\n map_smul' s := by rintro \u27e8\u27e9; apply map_smul f\n\nend ker\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Algebra.Module.Basic.map_inv_natCast_smul (L41-L57)\ntheorem map_inv_natCast_smul [AddCommMonoid M] [AddCommMonoid M\u2082] {F : Type*} [FunLike F M M\u2082]\n [AddMonoidHomClass F M M\u2082] (f : F) (R S : Type*)\n [DivisionSemiring R] [DivisionSemiring S] [Module R M]\n [Module S M\u2082] (n : \u2115) (x : M) : f ((n\u207b\u00b9 : R) \u2022 x) = (n\u207b\u00b9 : S) \u2022 f x := by\nby_cases hR : (n : R) = 0 <;> by_cases hS : (n : S) = 0\n \u00b7 simp [hR, hS, map_zero f]\n \u00b7 suffices \u2200 y, f y = 0 by rw [this, this, smul_zero]\n clear x\n intro x\n rw [\u2190 inv_smul_smul\u2080 hS (f x), \u2190 map_natCast_smul f R S]\n simp [hR, map_zero f]\n \u00b7 suffices \u2200 y, f y = 0 by simp [this]\n clear x\n intro x\n rw [\u2190 smul_inv_smul\u2080 hR x, map_natCast_smul f R S, hS, zero_smul]\n \u00b7 rw [\u2190 inv_smul_smul\u2080 hS (f _), \u2190 map_natCast_smul f R S, smul_inv_smul\u2080 hR]\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Algebra.Module.Bimodule.mk (L82-L90)\ndef mk (p : AddSubmonoid M) (hA : \u2200 (a : A) {m : M}, m \u2208 p \u2192 a \u2022 m \u2208 p)\n (hB : \u2200 (b : B) {m : M}, m \u2208 p \u2192 b \u2022 m \u2208 p) : Submodule (A \u2297[R] B) M :=\n{ p with\n carrier := p\n smul_mem' := fun ab m =>\n TensorProduct.induction_on ab (fun _ => by simp only [zero_smul, SetLike.mem_coe, zero_mem])\n (fun a b hm => by simpa only [TensorProduct.Algebra.smul_def] using hA a (hB b hm))\n fun z w hz hw hm => by simpa only [add_smul] using p.add_mem (hz hm) (hw hm) }\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.coe_toLinearMap_one (L99-L100)\nlemma coe_toLinearMap_one : (\u2191(1 : M \u2243\u2097[R] M) : M \u2192\u2097[R] M) = LinearMap.id := rfl\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Algebra.Module.BigOperators.Multiset (L29-L31)\ntheorem Multiset.sum_smul {l : Multiset R} {x : M} : l.sum \u2022 x = (l.map fun r \u21a6 r \u2022 x).sum :=\n((smulAddHom R M).flip x).map_multiset_sum l\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Algebra.Module.DedekindDomain.exists_isInternal_prime_power_torsion (L76-L83)\ntheorem exists_isInternal_prime_power_torsion [Module.Finite R M] (hM : Module.IsTorsion R M) :\n \u2203 (P : Finset <| Ideal R) (_ : DecidableEq P) (_ : \u2200 p \u2208 P, Prime p) (e : P \u2192 \u2115),\n DirectSum.IsInternal fun p : P => torsionBySet R M (p ^ e p : Ideal R) := by\nclassical\n exact \u27e8_, _, fun p hp => prime_of_factor p (Multiset.mem_toFinset.mp hp), _,\n isInternal_prime_power_torsion hM\u27e9\n\nend Submodule\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Algebra.Module.Card.mk_le_of_module (L28-L35)\ntheorem mk_le_of_module (R : Type u) (E : Type v)\n [AddCommGroup E] [Ring R] [IsDomain R] [Module R E] [Nontrivial E] [Module.IsTorsionFree R E] :\n Cardinal.lift.{v} (#R) \u2264 Cardinal.lift.{u} (#E) := by\nobtain \u27e8x, hx\u27e9 : \u2203 (x : E), x \u2260 0 := exists_ne 0\n have : Injective (fun k \u21a6 k \u2022 x) := smul_left_injective R hx\n exact lift_mk_le_lift_mk_of_injective this\n\nend Cardinal\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Algebra.Module.End.smulAddHom (L51-L55)\ndef smulAddHom : R \u2192+ M \u2192+ M :=\n(Module.toAddMonoidEnd R M).toAddMonoidHom\n\nvariable {R M}\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Algebra.Module.Basic.smul_indicator_one_apply (L168-L173)\nlemma smul_indicator_one_apply (s : Set \u03b1) (r : R) (a : \u03b1) :\n r \u2022 s.indicator (1 : \u03b1 \u2192 R) a = s.indicator (fun _ \u21a6 r) a := by\nsimp_rw [\u2190 indicator_const_smul_apply, Pi.one_apply, smul_eq_mul, mul_one]\n\nend MulZeroOneClass\nend Set\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.eq_zero_of_ofSpanSingleton_apply_self (L201-L214)\nlemma eq_zero_of_ofSpanSingleton_apply_self (a : A)\n (h : ofSpanSingleton a \u27e8a, Submodule.mem_span_singleton_self a\u27e9 = 0) : a = 0 := by\nerw [ofSpanSingleton, LinearMap.toAddMonoidHom_coe, LinearMap.comp_apply,\n intSpanEquivQuotAddOrderOf_apply_self, Submodule.liftQSpanSingleton_apply,\n AddMonoidHom.coe_toIntLinearMap, int.divByNat, LinearMap.toSpanSingleton_apply_one,\n AddCircle.coe_eq_zero_iff] at h\n rcases h with \u27e8n, hn\u27e9\n apply_fun Rat.den at hn\n rw [zsmul_one, Rat.den_intCast, Rat.inv_natCast_den_of_pos] at hn\n \u00b7 split_ifs at hn\n \u00b7 cases hn\n \u00b7 rwa [eq_comm, AddMonoid.addOrderOf_eq_one_iff] at hn\n \u00b7 grind\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Algebra.Module.BigOperators.Finset (L38-L40)\ntheorem Finset.sum_smul {f : \u03b9 \u2192 R} {s : Finset \u03b9} {x : M} :\n (\u2211 i \u2208 s, f i) \u2022 x = \u2211 i \u2208 s, f i \u2022 x := map_sum ((smulAddHom R M).flip x) f s\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.eq_zero_of_character_apply (L220-L224)\nlemma eq_zero_of_character_apply {a : A} (h : \u2200 c : CharacterModule A, c a = 0) : a = 0 := by\ncontrapose! h; exact exists_character_apply_ne_zero_of_ne_zero h\n\nvariable [Module R A] [Module R A'] [Module R B] {R A' B}\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Algebra.Module.Basic.invOf_two_smul_add_invOf_two_smul (L36-L40)\ntheorem invOf_two_smul_add_invOf_two_smul (R) [Semiring R] [AddCommMonoid M] [Module R M]\n [Invertible (2 : R)] (x : M) :\n (\u215f2 : R) \u2022 x + (\u215f2 : R) \u2022 x = x :=\nConvex.combo_self invOf_two_add_invOf_two _\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.surjective_of_dual_injective (L236-L245)\nlemma surjective_of_dual_injective (f : A \u2192\u2097[R] A') (hf : Function.Injective (dual f)) :\n Function.Surjective f := by\nrw [\u2190 LinearMap.range_eq_top, \u2190 Submodule.unique_quotient_iff_eq_top]\n refine \u27e8Unique.mk inferInstance fun a \u21a6 eq_zero_of_character_apply fun c \u21a6 ?_\u27e9\n obtain \u27e8b, rfl\u27e9 := QuotientAddGroup.mk'_surjective _ a\n suffices eq : dual (Submodule.mkQ _) c = 0 from congr($eq b)\n refine hf ?_\n rw [\u2190 LinearMap.comp_apply, \u2190 dual_comp, LinearMap.range_mkQ_comp, dual_zero,\n LinearMap.zero_apply, dual_apply, AddMonoidHom.zero_comp]\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.one_eq_refl (L90-L90)\nlemma one_eq_refl : (1 : M \u2243\u2097[R] M) = refl R M := rfl\n```\n\n-- snippet 84\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_smul_const_apply (L155-L157)\nlemma indicator_smul_const_apply (s : Set \u03b1) (r : \u03b1 \u2192 R) (m : M) (a : \u03b1) :\n indicator s (r \u00b7 \u2022 m) a = indicator s r a \u2022 m := indicator_smul_apply_left _ _ _ _\n```\n\n-- snippet 85\n```lean\n-- Mathlib.Algebra.Module.Defs.Convex (L76-L80)\ntheorem Convex.combo_self {a b : R} (h : a + b = 1) (x : M) : a \u2022 x + b \u2022 x = x := by\nrw [\u2190 add_smul, h, one_smul]\n\nvariable (R)\n```\n\n-- snippet 86\n```lean\n-- Mathlib.Algebra.Module.Congruence.Defs.SMulCon (L143-L147)\ndef SMulCon.ker [SMul R M] [SMul S N] {\u03c6 : R \u2192 S} (f : M \u2192\u2091[\u03c6] N) : SMulCon R M where\n __ := Setoid.ker f\nsmul r _ _ h := by rw [Setoid.ker_def] at h \u22a2; simp_rw [map_smul\u209b\u2097, h]\n\n/-- The kernel of a `DistribMulActionHom` as a congruence relation. -/\n```\n\n-- snippet 87\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_injective_of_surjective (L95-L102)\nlemma dual_injective_of_surjective (f : A \u2192\u2097[R] B) (hf : Function.Surjective f) :\n Function.Injective (dual f) := by\nintro \u03c6 \u03c8 eq\n ext x\n obtain \u27e8y, rfl\u27e9 := hf x\n change (dual f) \u03c6 _ = (dual f) \u03c8 _\n rw [eq]\n```\n\n-- snippet 88\n```lean\n-- Mathlib.Algebra.Module.Basic.inv_intCast_smul_comm (L88-L94)\ntheorem inv_intCast_smul_comm {\u03b1 E : Type*} (R : Type*) [AddCommGroup E] [DivisionRing R]\n [Module R E] [DistribSMul \u03b1 E] (n : \u2124) (s : \u03b1) (x : E) :\n (n\u207b\u00b9 : R) \u2022 s \u2022 x = s \u2022 (n\u207b\u00b9 : R) \u2022 x :=\n(map_inv_intCast_smul (DistribSMul.toAddMonoidHom E s) R R n x).symm\n\nnamespace Function\n```\n\n-- snippet 89\n```lean\n-- Mathlib.Algebra.Module.Defs.neg_smul_neg (L142-L145)\ntheorem neg_smul_neg : -r \u2022 -x = r \u2022 x := by rw [neg_smul, smul_neg, neg_neg]\nvariable (R)\n```\n\n-- snippet 90\n```lean\n-- Mathlib.Algebra.Module.BigOperators.sum_piFinset_apply (L58-L64)\nlemma sum_piFinset_apply (f : \u03ba \u2192 \u03b1) (s : Finset \u03ba) (i : \u03b9) :\n \u2211 g \u2208 piFinset fun _ : \u03b9 \u21a6 s, f (g i) = #s ^ (card \u03b9 - 1) \u2022 \u2211 b \u2208 s, f b := by\nclassical\n rw [Finset.sum_comp]\n simp only [eval_image_piFinset_const, card_filter_piFinset_const s, ite_smul, zero_smul, smul_sum,\n Finset.sum_ite_mem, inter_self]\n```\n\n-- snippet 91\n```lean\n-- Mathlib.Algebra.Module.Basic.support_smul_subset_right (L101-L104)\nlemma support_smul_subset_right [Zero M] [SMulZeroClass R M] (f : \u03b1 \u2192 R) (g : \u03b1 \u2192 M) :\n support (f \u2022 g) \u2286 support g :=\nfun x hbf hf \u21a6 hbf <| by rw [Pi.smul_apply', hf, smul_zero]\n```\n\n-- snippet 92\n```lean\n-- Mathlib.Algebra.Module.Bimodule.toSubmodule' (L116-L129)\ndef toSubmodule' (p : Submodule (A \u2297[R] B) M) : Submodule B M :=\n{ p with\n carrier := p\n smul_mem' := smul_mem' p }\n\nend Algebra\n\nsection Ring\n\nvariable (R S M : Type*) [Ring R] [Ring S]\nvariable [AddCommGroup M] [Module R M] [Module S M] [SMulCommClass R S M]\n\n/-- A `Submodule` over `R \u2297[\u2115] S` is naturally also a `Submodule` over the canonically-isomorphic\nring `R \u2297[\u2124] S`. -/\n```\n\n-- snippet 93\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.restrictScalars_inj (L60-L65)\ntheorem restrictScalars_inj (f g : M \u2243\u2097[S] M\u2082) :\n f.restrictScalars R = g.restrictScalars R \u2194 f = g :=\n(restrictScalars_injective R).eq_iff\n\nend RestrictScalars\n```\n\n-- snippet 94\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_smul_left (L151-L154)\nlemma indicator_smul_left (s : Set \u03b1) (r : \u03b1 \u2192 R) (f : \u03b1 \u2192 M) :\n indicator s (fun a \u21a6 r a \u2022 f a) = fun a \u21a6 indicator s r a \u2022 f a :=\nfunext <| indicator_smul_apply_left _ _ _\n```\n\n-- snippet 95\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.automorphismGroup (L81-L89)\ninstance automorphismGroup : Group (M \u2243\u2097[R] M) where\n mul f g := g.trans f\none := LinearEquiv.refl R M\n inv f := f.symm\n mul_assoc _ _ _ := rfl\n mul_one _ := ext fun _ \u21a6 rfl\n one_mul _ := ext fun _ \u21a6 rfl\n inv_mul_cancel f := ext <| f.left_inv\n```\n\n-- snippet 96\n```lean\n-- Mathlib.Algebra.Module.End.smulAddHom_apply (L57-L61)\ntheorem smulAddHom_apply : smulAddHom R M r x = r \u2022 x :=\nrfl\n\nvariable {x}\n```\n\n-- snippet 97\n```lean\n-- Mathlib.Algebra.Module.Bimodule.toSubbimoduleNat (L137-L142)\ndef toSubbimoduleNat (p : Submodule (R \u2297[\u2124] S) M) : Submodule (R \u2297[\u2115] S) M :=\nbaseChange \u2115 p\n\nend Ring\n\nend Subbimodule\n```\n\n-- snippet 98\n```lean\n-- Mathlib.Algebra.Module.Basic.support_const_smul_subset (L113-L121)\nlemma support_const_smul_subset [Zero M] [SMulZeroClass R M] (a : R) (f : \u03b1 \u2192 M) :\n support (a \u2022 f) \u2286 support f := support_smul_subset_right (fun _ \u21a6 a) f\nend Function\n\nnamespace Set\nsection SMulZeroClass\nvariable [Zero M] [SMulZeroClass R M]\n```\n\n-- snippet 99\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_smul_apply_left (L145-L150)\nlemma indicator_smul_apply_left (s : Set \u03b1) (r : \u03b1 \u2192 R) (f : \u03b1 \u2192 M) (a : \u03b1) :\n indicator s (fun a \u21a6 r a \u2022 f a) a = indicator s r a \u2022 f a := by\ndsimp only [indicator]\n split_ifs\n exacts [rfl, (zero_smul _ (f a)).symm]\n```\n\n-- snippet 100\n```lean\n-- Mathlib.Algebra.Module.Bimodule.toSubbimoduleInt (L131-L135)\ndef toSubbimoduleInt (p : Submodule (R \u2297[\u2115] S) M) : Submodule (R \u2297[\u2124] S) M :=\nbaseChange \u2124 p\n\n/-- A `Submodule` over `R \u2297[\u2124] S` is naturally also a `Submodule` over the canonically-isomorphic\nring `R \u2297[\u2115] S`. -/\n```\n\n-- snippet 101\n```lean\n-- Mathlib.Algebra.Module.Defs.neg_one_smul (L146-L149)\ntheorem neg_one_smul (x : M) : (-1 : R) \u2022 x = -x := by simp\nvariable {R}\n```\n\n-- snippet 102\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_smul_apply (L122-L127)\nlemma indicator_smul_apply (s : Set \u03b1) (r : \u03b1 \u2192 R) (f : \u03b1 \u2192 M) (a : \u03b1) :\n indicator s (fun a \u21a6 r a \u2022 f a) a = r a \u2022 indicator s f a := by\ndsimp only [indicator]\n split_ifs\n exacts [rfl, (smul_zero (r a)).symm]\n```\n\n-- snippet 103\n```lean\n-- Mathlib.Algebra.Module.Congruence.Defs.addConGen' (L64-L81)\ndef addConGen' (r : M \u2192 M \u2192 Prop) (hr : \u2200 (s : S) {m m'}, r m m' \u2192 r (s \u2022 m) (s \u2022 m')) :\n ModuleCon S M where\n toAddCon := addConGen r\nsmul s _ _ h := ((addConGen r).comap (DistribSMul.toAddMonoidHom M s) <| by simp).addConGen_le\n (fun _ _ h \u21a6 .of _ _ (hr s h)) h\n\n/-- The `AddCon` generated by a `SMulCon` is a `ModuleCon`. -/\nprotected abbrev addConGen (c : SMulCon S M) : ModuleCon S M := addConGen' c.r c.smul\n\nend addConGen\n\nend SMulCon\n\nnamespace ModuleCon\n\n/-- The quotient by a congruence relation preserving addition and scalar multiplication. -/\nprotected def Quotient [Add M] [SMul S M] (c : ModuleCon S M) : Type _ := Quotient c.toSetoid\n```\n\n-- snippet 104\n```lean\n-- Mathlib.Algebra.Module.Defs.Module (L105-L107)\ntheorem Module.eq_zero_of_zero_eq_one (zero_eq_one : (0 : R) = 1) : x = 0 := by\nrw [\u2190 one_smul R x, \u2190 zero_eq_one, zero_smul]\n```\n\n-- snippet 105\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.exists_character_apply_ne_zero_of_ne_zero (L215-L219)\nlemma exists_character_apply_ne_zero_of_ne_zero {a : A} (ne_zero : a \u2260 0) :\n \u2203 (c : CharacterModule A), c a \u2260 0 :=\nhave \u27e8c, hc\u27e9 := dual_surjective_of_injective _ (Submodule.injective_subtype _) (ofSpanSingleton a)\n \u27e8c, fun h \u21a6 ne_zero <| eq_zero_of_ofSpanSingleton_apply_self a <| by rwa [\u2190 hc]\u27e9\n```\n", "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.Algebra.Module.Submodule.Lattice).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem sum_mem_iSup {\u03b9 : Type*} [Fintype \u03b9] {f : \u03b9 \u2192 M} {p : \u03b9 \u2192 Submodule R M}\n (h : \u2200 i, f i \u2208 p i) : (\u2211 i, f i) \u2208 \u2a06 i, p i\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.inhabited' (L57-L59)\ninstance inhabited' : Inhabited (Submodule R M) :=\n\u27e8\u22a5\u27e9\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.bot_coe (L61-L63)\ntheorem bot_coe : ((\u22a5 : Submodule R M) : Set M) = {0} :=\nrfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.bot_toAddSubmonoid (L65-L67)\ntheorem bot_toAddSubmonoid : (\u22a5 : Submodule R M).toAddSubmonoid = \u22a5 :=\nrfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.bot_toAddSubgroup (L69-L72)\nlemma bot_toAddSubgroup {R M} [Ring R] [AddCommGroup M] [Module R M] :\n (\u22a5 : Submodule R M).toAddSubgroup = \u22a5 := rfl\nvariable (R) in\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.mem_bot (L74-L76)\ntheorem mem_bot {x : M} : x \u2208 (\u22a5 : Submodule R M) \u2194 x = 0 :=\nSet.mem_singleton_iff\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.uniqueBot (L80-L82)\ninstance uniqueBot : Unique (\u22a5 : Submodule R M) :=\n\u27e8inferInstance, fun x \u21a6 Subtype.ext <| (mem_bot R).1 x.mem\u27e9\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.nonzero_mem_of_bot_lt (L97-L100)\ntheorem nonzero_mem_of_bot_lt {p : Submodule R M} (bot_lt : \u22a5 < p) : \u2203 a : p, a \u2260 0 :=\nlet \u27e8b, hb\u2081, hb\u2082\u27e9 := p.ne_bot_iff.mp bot_lt.ne'\n \u27e8\u27e8b, hb\u2081\u27e9, hb\u2082 \u2218 congr_arg Subtype.val\u27e9\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.exists_mem_ne_zero_of_ne_bot (L101-L106)\ntheorem exists_mem_ne_zero_of_ne_bot {p : Submodule R M} (h : p \u2260 \u22a5) : \u2203 b : M, b \u2208 p \u2227 b \u2260 0 :=\nlet \u27e8b, hb\u2081, hb\u2082\u27e9 := p.ne_bot_iff.mp h\n \u27e8b, hb\u2081, hb\u2082\u27e9\n\n-- FIXME: we default PUnit to PUnit.{1} here without the explicit universe annotation\n/-- The bottom submodule is linearly equivalent to punit as an `R`-module. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.botEquivPUnit (L108-L113)\ndef botEquivPUnit : (\u22a5 : Submodule R M) \u2243\u2097[R] PUnit.{v + 1} where\n toFun _ := PUnit.unit\ninvFun _ := 0\n map_add' _ _ := rfl\n map_smul' _ _ := rfl\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.subsingleton_iff_eq_bot (L114-L118)\ntheorem subsingleton_iff_eq_bot : Subsingleton p \u2194 p = \u22a5 := by\nrw [subsingleton_iff, Submodule.eq_bot_iff]\n refine \u27e8fun h x hx \u21a6 by simpa using h \u27e8x, hx\u27e9 \u27e80, p.zero_mem\u27e9,\n fun h \u27e8x, hx\u27e9 \u27e8y, hy\u27e9 \u21a6 by simp [h x hx, h y hy]\u27e9\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.eq_bot_of_subsingleton (L119-L121)\ntheorem eq_bot_of_subsingleton [Subsingleton p] : p = \u22a5 :=\nsubsingleton_iff_eq_bot.mp inferInstance\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.nontrivial_iff_ne_bot (L122-L129)\ntheorem nontrivial_iff_ne_bot : Nontrivial p \u2194 p \u2260 \u22a5 := by\nrw [iff_not_comm, not_nontrivial_iff_subsingleton, subsingleton_iff_eq_bot]\n\n/-!\n## Top element of a submodule\n-/\n\n/-- The universal set is the top element of the lattice of submodules. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.top_coe (L136-L138)\ntheorem top_coe : ((\u22a4 : Submodule R M) : Set M) = Set.univ :=\nrfl\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.coe_eq_univ (L140-L142)\ntheorem coe_eq_univ : (p : Set M) = Set.univ \u2194 p = \u22a4 := by\nrw [iff_comm, \u2190 SetLike.coe_set_eq, top_coe]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.top_toAddSubmonoid (L146-L148)\ntheorem top_toAddSubmonoid : (\u22a4 : Submodule R M).toAddSubmonoid = \u22a4 :=\nrfl\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.top_toAddSubgroup (L150-L152)\nlemma top_toAddSubgroup {R M : Type*} [Ring R] [AddCommGroup M] [Module R M] :\n (\u22a4 : Submodule R M).toAddSubgroup = \u22a4 := rfl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.toAddSubgroup_eq_top (L154-L156)\nlemma toAddSubgroup_eq_top {R M : Type*} [Ring R] [AddCommGroup M] [Module R M]\n {p : Submodule R M} : p.toAddSubgroup = \u22a4 \u2194 p = \u22a4 := by simp [\u2190 toAddSubgroup_inj]\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.eq_top_iff' (L163-L168)\ntheorem eq_top_iff' {p : Submodule R M} : p = \u22a4 \u2194 \u2200 x, x \u2208 p :=\neq_top_iff.trans \u27e8fun h _ \u21a6 h trivial, fun h x _ \u21a6 h x\u27e9\n\n/-- The top submodule is linearly equivalent to the module.\n\nThis is the module version of `AddSubmonoid.topEquiv`. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.topEquiv (L170-L179)\ndef topEquiv : (\u22a4 : Submodule R M) \u2243\u2097[R] M where\n toFun x := x\ninvFun x := \u27e8x, mem_top\u27e9\n map_add' _ _ := rfl\n map_smul' _ _ := rfl\n\n/-!\n## Infima & suprema in a submodule\n-/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.completeLattice (L207-L221)\ninstance completeLattice : CompleteLattice (Submodule R M) :=\n{ (inferInstance : OrderTop (Submodule R M)),\n (inferInstance : OrderBot (Submodule R M)) with\n sup := fun a b \u21a6 sInf { x | a \u2264 x \u2227 b \u2264 x }\n le_sup_left := fun _ _ \u21a6 le_sInf' fun _ \u27e8h, _\u27e9 \u21a6 h\n le_sup_right := fun _ _ \u21a6 le_sInf' fun _ \u27e8_, h\u27e9 \u21a6 h\n sup_le := fun _ _ _ h\u2081 h\u2082 \u21a6 sInf_le' \u27e8h\u2081, h\u2082\u27e9\n inf := (\u00b7 \u2293 \u00b7)\n le_inf := fun _ _ _ \u21a6 Set.subset_inter\n inf_le_left := fun _ _ \u21a6 Set.inter_subset_left\n inf_le_right := fun _ _ \u21a6 Set.inter_subset_right\n sSup S := sInf {sm | \u2200 s \u2208 S, s \u2264 sm}\n isLUB_sSup _ := isGLB_upperBounds.mp Submodule.isGLB_sInf\n isGLB_sInf _ := Submodule.isGLB_sInf }\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.coe_inf (L223-L225)\ntheorem coe_inf : \u2191(p \u2293 q) = (p \u2229 q : Set M) :=\nrfl\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.mem_inf (L227-L229)\ntheorem mem_inf {p q : Submodule R M} {x : M} : x \u2208 p \u2293 q \u2194 x \u2208 p \u2227 x \u2208 q :=\nIff.rfl\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.coe_sInf (L231-L233)\ntheorem coe_sInf (P : Set (Submodule R M)) : (\u2191(sInf P) : Set M) = \u22c2 p \u2208 P, \u2191p :=\nrfl\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.coe_finsetInf (L235-L242)\ntheorem coe_finsetInf {\u03b9} (s : Finset \u03b9) (p : \u03b9 \u2192 Submodule R M) :\n (\u2191(s.inf p) : Set M) = \u22c2 i \u2208 s, \u2191(p i) := by\nletI := Classical.decEq \u03b9\n refine s.induction_on ?_ fun i s _ ih \u21a6 ?_\n \u00b7 simp\n \u00b7 rw [Finset.inf_insert, coe_inf, ih]\n simp\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Algebra.Module.Submodule.Lattice.coe_iInf (L244-L246)\ntheorem coe_iInf {\u03b9} (p : \u03b9 \u2192 Submodule R M) : (\u2191(\u2a05 i, p i) : Set M) = \u22c2 i, \u2191(p i) := by\nrw [iInf, coe_sInf]; simp only [Set.mem_range, Set.iInter_exists, Set.iInter_iInter_eq']\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.restrictScalars_injective (L55-L58)\ntheorem restrictScalars_injective :\n Function.Injective (restrictScalars R : (M \u2243\u2097[S] M\u2082) \u2192 M \u2243\u2097[R] M\u2082) := fun _ _ h \u21a6\next (LinearEquiv.congr_fun h :)\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Algebra.Module.End.AddMonoid (L32-L41)\ntheorem AddMonoid.End.natCast_def (n : \u2115) :\n (\u2191n : AddMonoid.End M) = DistribMulAction.toAddMonoidEnd \u2115 M n :=\nrfl\n\nvariable (R M)\n\nset_option backward.isDefEq.respectTransparency false in\n/-- `(\u2022)` as an `AddMonoidHom`.\n\nThis is a stronger version of `DistribMulAction.toAddMonoidEnd` -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Algebra.Module.DedekindDomain.isInternal_prime_power_torsion (L64-L75)\ntheorem isInternal_prime_power_torsion [Module.Finite R M]\n (hM : Module.IsTorsion R M) :\n DirectSum.IsInternal fun p : (factors (\u22a4 : Submodule R M).annihilator).toFinset =>\n torsionBySet R M (p ^ (factors (\u22a4 : Submodule R M).annihilator).count \u2191p : Ideal R) := by\nhave hM' := Module.isTorsionBySet_annihilator_top R M\n have hI := Submodule.annihilator_top_inter_nonZeroDivisors hM\n refine isInternal_prime_power_torsion_of_is_torsion_by_ideal ?_ hM'\n rw [Submodule.ne_bot_iff]\n obtain \u27e8x, H, hx\u27e9 := hI; exact \u27e8x, H, nonZeroDivisors.ne_zero hx\u27e9\n\n/-- A finitely generated torsion module over a Dedekind domain is an internal direct sum of its\n`p i ^ e i`-torsion submodules for some prime ideals `p i` and numbers `e i`. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_comp (L90-L94)\nlemma dual_comp {C : Type*} [AddCommGroup C] [Module R C] (f : A \u2192\u2097[R] B) (g : B \u2192\u2097[R] C) :\n dual (g.comp f) = (dual f).comp (dual g) := by\next\n rfl\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_const_smul_apply (L132-L135)\nlemma indicator_const_smul_apply (s : Set \u03b1) (r : R) (f : \u03b1 \u2192 M) (a : \u03b1) :\n indicator s (r \u2022 f \u00b7) a = r \u2022 indicator s f a :=\nindicator_smul_apply s (fun _ \u21a6 r) f a\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Algebra.Module.Defs.smul_add_one_sub_smul (L109-L117)\ntheorem smul_add_one_sub_smul {R : Type*} [Ring R] [Module R M] {r : R} {m : M} :\n r \u2022 m + (1 - r) \u2022 m = m := by rw [\u2190 add_smul, add_sub_cancel, one_smul]\nend AddCommMonoid\n\nsection AddCommGroup\n\nvariable [Semiring R] [AddCommGroup M]\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Algebra.Module.Basic.inv_natCast_smul_comm (L81-L87)\ntheorem inv_natCast_smul_comm {\u03b1 E : Type*} (R : Type*) [AddCommMonoid E] [DivisionSemiring R]\n [Module R E] [DistribSMul \u03b1 E] (n : \u2115) (s : \u03b1) (x : E) :\n (n\u207b\u00b9 : R) \u2022 s \u2022 x = s \u2022 (n\u207b\u00b9 : R) \u2022 x :=\n(map_inv_natCast_smul (DistribSMul.toAddMonoidHom E s) R R n x).symm\n\n/-- If `E` is a vector space over a division ring `R` and has a monoid action by `\u03b1`, then that\naction commutes by scalar multiplication of inverses of integers in `R` -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_const_smul (L136-L144)\nlemma indicator_const_smul (s : Set \u03b1) (r : R) (f : \u03b1 \u2192 M) :\n indicator s (r \u2022 f \u00b7) = (r \u2022 indicator s f \u00b7) :=\nfunext <| indicator_const_smul_apply s r f\n\nend SMulZeroClass\n\nsection SMulWithZero\nvariable [Zero R] [Zero M] [SMulWithZero R M]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Algebra.Module.Basic.support_const_smul_of_ne_zero (L105-L108)\nlemma support_const_smul_of_ne_zero [Semiring R] [IsDomain R] [AddCommMonoid M] [Module R M]\n [Module.IsTorsionFree R M] (c : R) (g : \u03b1 \u2192 M) (hc : c \u2260 0) : support (c \u2022 g) = support g :=\next fun _ \u21a6 smul_ne_zero_iff_right hc\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Algebra.Module.Defs.sub_smul (L150-L166)\ntheorem sub_smul (r s : R) (y : M) : (r - s) \u2022 y = r \u2022 y - s \u2022 y := by\nsimp [add_smul, sub_eq_add_neg]\n\nend Module\n\n/-- A module over a `Subsingleton` semiring is a `Subsingleton`. We cannot register this\nas an instance because Lean has no way to guess `R`. -/\nprotected theorem Module.subsingleton (R M : Type*) [MonoidWithZero R] [Subsingleton R] [Zero M]\n [MulActionWithZero R M] : Subsingleton M :=\n MulActionWithZero.subsingleton R M\n\n/-- A semiring is `Nontrivial` provided that there exists a nontrivial module over this semiring. -/\nprotected theorem Module.nontrivial (R M : Type*) [MonoidWithZero R] [Nontrivial M] [Zero M]\n [MulActionWithZero R M] : Nontrivial R :=\n MulActionWithZero.nontrivial R M\n\n-- see Note [lower instance priority]\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Algebra.Module.Basic.support_smul (L109-L112)\nlemma support_smul [Semiring R] [IsDomain R] [AddCommMonoid M] [Module R M]\n [Module.IsTorsionFree R M] (f : \u03b1 \u2192 R) (g : \u03b1 \u2192 M) : support (f \u2022 g) = support f \u2229 support g :=\next fun _ => smul_ne_zero_iff\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Algebra.Module.Bimodule.baseChange (L102-L107)\ndef baseChange (S : Type*) [CommSemiring S] [Module S M] [Algebra S A] [Algebra S B]\n [IsScalarTower S A M] [IsScalarTower S B M] (p : Submodule (A \u2297[R] B) M) :\n Submodule (A \u2297[S] B) M :=\nmk p.toAddSubmonoid (smul_mem p) (smul_mem' p)\n\n/-- Forgetting the `B` action, a `Submodule` over `A \u2297[R] B` is just a `Submodule` over `A`. -/\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_smul_const (L158-L167)\nlemma indicator_smul_const (s : Set \u03b1) (r : \u03b1 \u2192 R) (m : M) :\n indicator s (r \u00b7 \u2022 m) = (indicator s r \u00b7 \u2022 m) :=\nfunext <| indicator_smul_const_apply _ _ _\n\nend SMulWithZero\n\nsection MulZeroOneClass\n\nvariable [MulZeroOneClass R]\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Algebra.Module.Basic.inv_intCast_smul_eq (L75-L80)\ntheorem inv_intCast_smul_eq {E : Type*} (R S : Type*) [AddCommGroup E] [DivisionRing R]\n [DivisionRing S] [Module R E] [Module S E] (n : \u2124) (x : E) : (n\u207b\u00b9 : R) \u2022 x = (n\u207b\u00b9 : S) \u2022 x :=\nmap_inv_intCast_smul (AddMonoidHom.id E) R S n x\n\n/-- If `E` is a vector space over a division semiring `R` and has a monoid action by `\u03b1`, then that\naction commutes by scalar multiplication of inverses of natural numbers in `R`. -/\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Algebra.Module.Defs.two_smul (L81-L104)\ntheorem two_smul : (2 : R) \u2022 x = x + x := by rw [\u2190 one_add_one_eq_two, add_smul, one_smul]\n/-- Pullback a `Module` structure along an injective additive monoid homomorphism.\nSee note [reducible non-instances]. -/\nprotected abbrev Function.Injective.module [AddCommMonoid M\u2082] [SMul R M\u2082] (f : M\u2082 \u2192+ M)\n (hf : Injective f) (smul : \u2200 (c : R) (x), f (c \u2022 x) = c \u2022 f x) : Module R M\u2082 :=\n { hf.distribMulAction f smul with\n add_smul := fun c\u2081 c\u2082 x => hf <| by simp only [smul, f.map_add, add_smul]\n zero_smul := fun x => hf <| by simp only [smul, zero_smul, f.map_zero] }\n\n/-- Pushforward a `Module` structure along a surjective additive monoid homomorphism.\nSee note [reducible non-instances]. -/\nprotected abbrev Function.Surjective.module [AddCommMonoid M\u2082] [SMul R M\u2082] (f : M \u2192+ M\u2082)\n (hf : Surjective f) (smul : \u2200 (c : R) (x), f (c \u2022 x) = c \u2022 f x) : Module R M\u2082 :=\n { toDistribMulAction := hf.distribMulAction f smul\n add_smul := fun c\u2081 c\u2082 x => by\n rcases hf x with \u27e8x, rfl\u27e9\n simp only [add_smul, \u2190 smul, \u2190 f.map_add]\n zero_smul := fun x => by\n rcases hf x with \u27e8x, rfl\u27e9\n rw [\u2190 f.map_zero, \u2190 smul, zero_smul] }\n\nvariable {R}\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Algebra.Module.BigOperators.List (L26-L28)\ntheorem List.sum_smul {l : List R} {x : M} : l.sum \u2022 x = (l.map fun r \u21a6 r \u2022 x).sum :=\nmap_list_sum ((smulAddHom R M).flip x) l\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Algebra.Module.Defs.neg_smul (L139-L141)\ntheorem neg_smul : -r \u2022 x = -(r \u2022 x) :=\neq_neg_of_add_eq_zero_left <| by rw [\u2190 add_smul, neg_add_cancel, zero_smul]\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Algebra.Module.BigOperators.Fintype (L45-L51)\nlemma Fintype.sum_smul_sum [Fintype \u03b1] [Fintype \u03b2] (f : \u03b1 \u2192 R) (g : \u03b2 \u2192 M) :\n (\u2211 i, f i) \u2022 \u2211 j, g j = \u2211 i, \u2211 j, f i \u2022 g j := Finset.sum_smul_sum _ _\nend AddCommMonoid\n\nopen Finset\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.congr (L110-L119)\ndef congr (e : A \u2243\u2097[R] B) : CharacterModule A \u2243\u2097[R] CharacterModule B :=\n.ofLinear (dual e.symm) (dual e)\n (by ext c _; exact congr(c $(e.right_inv _)))\n (by ext c _; exact congr(c $(e.left_inv _)))\n\nopen TensorProduct\n\n/--\nAny linear map `L : A \u2192 B\u22c6` induces a character in `(A \u2297 B)\u22c6` by `a \u2297 b \u21a6 L a b`.\n-/\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Algebra.Module.Basic.Units (L31-L34)\ntheorem Units.neg_smul [Ring R] [AddCommGroup M] [Module R M] (u : R\u02e3) (x : M) :\n -u \u2022 x = -(u \u2022 x) := by\nrw [Units.smul_def, Units.val_neg, _root_.neg_smul, Units.smul_def]\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.intSpanEquivQuotAddOrderOf_apply_self (L181-L200)\nlemma intSpanEquivQuotAddOrderOf_apply_self (a : A) :\n intSpanEquivQuotAddOrderOf a \u27e8a, Submodule.mem_span_singleton_self a\u27e9 =\n Submodule.Quotient.mk 1 :=\n(LinearEquiv.eq_symm_apply _).mp <| Subtype.ext (one_zsmul _).symm\n\n/--\nFor an abelian group `A` and an element `a \u2208 A`, there is a character `c : \u2124 \u2219 a \u2192 \u211a \u29f8 \u2124` given by\n`m \u2022 a \u21a6 m / n` where `n` is the smallest positive integer such that `n \u2022 a = 0` and when such `n`\ndoes not exist, `c` is defined by `m \u2022 a \u21a6 m / 2`.\n-/\nnoncomputable def ofSpanSingleton (a : A) : CharacterModule (\u2124 \u2219 a) :=\n let l : \u2124 \u29f8 Ideal.span {(addOrderOf a : \u2124)} \u2192\u2097[\u2124] AddCircle (1 : \u211a) :=\n Submodule.liftQSpanSingleton _\n (CharacterModule.int.divByNat <|\n if addOrderOf a = 0 then 2 else addOrderOf a).toIntLinearMap <| by\n split_ifs with h\n \u00b7 rw [h, Nat.cast_zero, map_zero]\n \u00b7 apply CharacterModule.int.divByNat_self\n l \u2218\u2097 intSpanEquivQuotAddOrderOf a |>.toAddMonoidHom\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.restrictScalars (L48-L54)\ndef restrictScalars (f : M \u2243\u2097[S] M\u2082) : M \u2243\u2097[R] M\u2082 :=\n{ f.toLinearMap.restrictScalars R with\n toFun := f\n invFun := f.symm\n left_inv := f.left_inv\n right_inv := f.right_inv }\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_surjective_iff_injective (L225-L230)\nlemma dual_surjective_iff_injective {f : A \u2192\u2097[R] A'} :\n Function.Surjective (dual f) \u2194 Function.Injective f :=\n\u27e8fun h \u21a6 (injective_iff_map_eq_zero _).2 fun a h0 \u21a6 eq_zero_of_character_apply fun c \u21a6 by\n obtain \u27e8c, rfl\u27e9 := h c; exact congr(c $h0).trans c.map_zero,\n dual_surjective_of_injective f\u27e9\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Algebra.Module.Basic.map_inv_intCast_smul (L58-L67)\ntheorem map_inv_intCast_smul [AddCommGroup M] [AddCommGroup M\u2082] {F : Type*} [FunLike F M M\u2082]\n [AddMonoidHomClass F M M\u2082] (f : F) (R S : Type*) [DivisionRing R] [DivisionRing S] [Module R M]\n [Module S M\u2082] (z : \u2124) (x : M) : f ((z\u207b\u00b9 : R) \u2022 x) = (z\u207b\u00b9 : S) \u2022 f x := by\nobtain \u27e8n, rfl | rfl\u27e9 := z.eq_nat_or_neg\n \u00b7 rw [Int.cast_natCast, Int.cast_natCast, map_inv_natCast_smul _ R S]\n \u00b7 simp_rw [Int.cast_neg, Int.cast_natCast, inv_neg, neg_smul, map_neg,\n map_inv_natCast_smul _ R S]\n\n/-- If `E` is a vector space over two division semirings `R` and `S`, then scalar multiplications\nagree on inverses of natural numbers in `R` and `S`. -/\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_smul (L128-L131)\nlemma indicator_smul (s : Set \u03b1) (r : \u03b1 \u2192 R) (f : \u03b1 \u2192 M) :\n indicator s (fun a \u21a6 r a \u2022 f a) = fun a \u21a6 r a \u2022 indicator s f a :=\nfunext <| indicator_smul_apply s r f\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Algebra.Module.Basic.support_smul_subset_left (L95-L100)\nlemma support_smul_subset_left [Zero R] [Zero M] [SMulWithZero R M] (f : \u03b1 \u2192 R) (g : \u03b1 \u2192 M) :\n support (f \u2022 g) \u2286 support f := fun x hfg hf \u21a6\nhfg <| by rw [Pi.smul_apply', hf, zero_smul]\n\n-- Changed (2024-01-21): this lemma was generalised;\n-- the old version is now called `support_const_smul_subset`.\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.CharacterModule (L46-L49)\ndef CharacterModule : Type uA := A \u2192+ AddCircle (1 : \u211a)\nnamespace CharacterModule\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Algebra.Module.Defs.add_smul (L73-L75)\ntheorem add_smul : (r + s) \u2022 x = r \u2022 x + s \u2022 x :=\nModule.add_smul r s x\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_zero (L86-L89)\nlemma dual_zero : dual (0 : A \u2192\u2097[R] B) = 0 := by\next f\n exact map_zero f\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_rTensor_conj_homEquiv (L147-L171)\ntheorem dual_rTensor_conj_homEquiv (f : A \u2192\u2097[R] A') :\n homEquiv.symm.toLinearMap \u2218\u2097 dual (f.rTensor B) \u2218\u2097 homEquiv.toLinearMap = f.lcomp R _ := rfl\nend module\n\n/--\n`\u2124\u22c6`, the character module of `\u2124` in the unit rational circle.\n-/\nprotected abbrev int : Type := CharacterModule \u2124\n\n/-- Given `n : \u2115`, the map `m \u21a6 m / n`. -/\nprotected abbrev int.divByNat (n : \u2115) : CharacterModule.int :=\n LinearMap.toSpanSingleton \u2124 _ (QuotientAddGroup.mk (n : \u211a)\u207b\u00b9) |>.toAddMonoidHom\n\nprotected lemma int.divByNat_self (n : \u2115) :\n int.divByNat n n = 0 := by\n obtain rfl | h0 := eq_or_ne n 0\n \u00b7 apply map_zero\n exact (AddCircle.coe_eq_zero_iff _).mpr\n \u27e81, by simp [mul_inv_cancel\u2080 (Nat.cast_ne_zero (R := \u211a).mpr h0)]\u27e9\n\nvariable {A}\n\n/-- The `\u2124`-submodule spanned by a single element `a` is isomorphic to the quotient of `\u2124`\nby the ideal generated by the order of `a`. -/\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Algebra.Module.DedekindDomain.isInternal_prime_power_torsion_of_is_torsion_by_ideal (L37-L63)\ntheorem isInternal_prime_power_torsion_of_is_torsion_by_ideal\n {I : Ideal R} (hI : I \u2260 \u22a5) (hM : Module.IsTorsionBySet R M I) :\n DirectSum.IsInternal fun p : (factors I).toFinset =>\n torsionBySet R M (p ^ (factors I).count \u2191p : Ideal R) := by\nlet P := factors I\n have prime_of_mem := fun p (hp : p \u2208 P.toFinset) =>\n prime_of_factor p (Multiset.mem_toFinset.mp hp)\n apply torsionBySet_isInternal (p := fun p => p ^ P.count p) _\n \u00b7 convert hM\n rw [\u2190 Finset.inf_eq_iInf, IsDedekindDomain.inf_pow_eq_prod_of_prime,\n \u2190 Finset.prod_multiset_count, \u2190 associated_iff_eq]\n \u00b7 exact factors_prod hI\n \u00b7 exact prime_of_mem\n \u00b7 exact fun _ _ _ _ ij => ij\n \u00b7 intro p hp q hq pq; dsimp\n rw [irreducible_pow_sup]\n \u00b7 suffices (normalizedFactors _).count p = 0 by rw [this, zero_min, pow_zero, Ideal.one_eq_top]\n rw [Multiset.count_eq_zero,\n normalizedFactors_of_irreducible_pow (prime_of_mem q hq).irreducible,\n Multiset.mem_replicate]\n exact fun H => pq <| H.2.trans <| normalize_eq q\n \u00b7 rw [\u2190 Ideal.zero_eq_bot]; apply pow_ne_zero; exact (prime_of_mem q hq).ne_zero\n \u00b7 exact (prime_of_mem p hp).irreducible\n\n/-- A finitely generated torsion module over a Dedekind domain is an internal direct sum of its\n`p i ^ e i`-torsion submodules where `p i` are factors of `(\u22a4 : Submodule R M).annihilator` and\n`e i` are their multiplicities. -/\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Algebra.Module.BigOperators.sum_single_smul (L66-L71)\nlemma sum_single_smul\n {R : Type*} [Semiring R] [Module R \u03b1] (f : \u03b9 \u2192 \u03b1) (r : R) (i\u2080 : \u03b9) :\n \u2211 i, (Pi.single (M := fun _ \u21a6 R) i\u2080 r i) \u2022 f i = r \u2022 f i\u2080 := by\nrw [Finset.sum_eq_single i\u2080, Pi.single_eq_same] <;> aesop\n\nend Fintype\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_surjective_of_injective (L103-L109)\nlemma dual_surjective_of_injective (f : A \u2192\u2097[R] B) (hf : Function.Injective f) :\n Function.Surjective (dual f) :=\n(Module.Baer.of_divisible _).extension_property_addMonoidHom _ hf\n\n/--\nTwo isomorphic modules have isomorphic character modules.\n-/\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Algebra.Module.Bimodule.toSubmodule (L109-L114)\ndef toSubmodule (p : Submodule (A \u2297[R] B) M) : Submodule A M :=\n{ p with\n carrier := p\n smul_mem' := smul_mem p }\n\n/-- Forgetting the `A` action, a `Submodule` over `A \u2297[R] B` is just a `Submodule` over `B`. -/\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Algebra.Module.End.Module (L43-L50)\ndef Module.toAddMonoidEnd : R \u2192+* AddMonoid.End M :=\n{ DistribMulAction.toAddMonoidEnd R M with\n map_zero' := AddMonoidHom.ext fun r => by simp\n map_add' x y :=\n AddMonoidHom.ext fun r => by simp [(AddMonoidHom.add_apply), add_smul] }\n\n/-- A convenience alias for `Module.toAddMonoidEnd` as an `AddMonoidHom`, usually to allow the\nuse of `AddMonoidHom.flip`. -/\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Algebra.Module.Basic.inv_natCast_smul_eq (L68-L74)\ntheorem inv_natCast_smul_eq {E : Type*} (R S : Type*) [AddCommMonoid E] [DivisionSemiring R]\n [DivisionSemiring S] [Module R E] [Module S E] (n : \u2115) (x : E) :\n (n\u207b\u00b9 : R) \u2022 x = (n\u207b\u00b9 : S) \u2022 x :=\nmap_inv_natCast_smul (AddMonoidHom.id E) R S n x\n\n/-- If `E` is a vector space over two division rings `R` and `S`, then scalar multiplications\nagree on inverses of integer numbers in `R` and `S`. -/\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.coe_one (L94-L95)\nlemma coe_one : \u2191(1 : M \u2243\u2097[R] M) = id := rfl\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_bijective_iff_bijective (L250-L255)\nlemma dual_bijective_iff_bijective {f : A \u2192\u2097[R] A'} :\n Function.Bijective (dual f) \u2194 Function.Bijective f :=\n\u27e8fun h \u21a6 \u27e8dual_surjective_iff_injective.mp h.2, dual_injective_iff_surjective.mp h.1\u27e9,\n fun h \u21a6 \u27e8dual_injective_iff_surjective.mpr h.2, dual_surjective_iff_injective.mpr h.1\u27e9\u27e9\n\nend CharacterModule\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Algebra.Module.End.IsAddUnit (L62-L67)\nlemma IsAddUnit.smul_left [DistribSMul S M] (hx : IsAddUnit x) (s : S) :\n IsAddUnit (s \u2022 x) :=\nhx.map (DistribSMul.toAddMonoidHom M s)\n\nvariable {r} (x)\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.mul_eq_trans (L91-L92)\nlemma mul_eq_trans (f g : M \u2243\u2097[R] M) : f * g = g.trans f := rfl\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_injective_iff_surjective (L246-L249)\nlemma dual_injective_iff_surjective {f : A \u2192\u2097[R] A'} :\n Function.Injective (dual f) \u2194 Function.Surjective f :=\n\u27e8fun h \u21a6 surjective_of_dual_injective f h, fun h \u21a6 dual_injective_of_surjective f h\u27e9\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Algebra.Module.Bimodule.smul_mem (L91-L94)\ntheorem smul_mem (p : Submodule (A \u2297[R] B) M) (a : A) {m : M} (hm : m \u2208 p) : a \u2022 m \u2208 p := by\nsuffices a \u2022 m = a \u2297\u209c[R] (1 : B) \u2022 m by exact this.symm \u25b8 p.smul_mem _ hm\n simp [TensorProduct.Algebra.smul_def]\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Algebra.Module.Bimodule.smul_mem' (L95-L100)\ntheorem smul_mem' (p : Submodule (A \u2297[R] B) M) (b : B) {m : M} (hm : m \u2208 p) : b \u2022 m \u2208 p := by\nsuffices b \u2022 m = (1 : A) \u2297\u209c[R] b \u2022 m by exact this.symm \u25b8 p.smul_mem _ hm\n simp [TensorProduct.Algebra.smul_def]\n\n/-- If `A` and `B` are also `Algebra`s over yet another set of scalars `S` then we may \"base change\"\nfrom `R` to `S`. -/\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Algebra.Module.Congruence.Defs.ModuleCon (L148-L160)\ndef ModuleCon.ker [Monoid R] [Monoid S] [AddMonoid M] [AddMonoid N] [DistribMulAction R M]\n [DistribMulAction S N] {\u03c6 : R \u2192* S} (f : M \u2192\u2091+[\u03c6] N) : ModuleCon R M where\n __ := SMulCon.ker f.toMulActionHom\n__ := AddCon.ker f\n\n/-- The first isomorphism theorem for semimodules in the case of a surjective homomorphism. -/\nnoncomputable def ModuleCon.quotientKerEquivOfSurjective [Semiring S] [AddCommMonoid M]\n [AddCommMonoid N] [Module S M] [Module S N] (f : M \u2192\u2097[S] N) (hf : Function.Surjective f) :\n (ker f.toDistribMulActionHom).Quotient \u2243\u2097[S] N where\n __ := AddCon.quotientKerEquivOfSurjective f.toAddMonoidHom hf\n map_smul' s := by rintro \u27e8\u27e9; apply map_smul f\n\nend ker\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Algebra.Module.Basic.map_inv_natCast_smul (L41-L57)\ntheorem map_inv_natCast_smul [AddCommMonoid M] [AddCommMonoid M\u2082] {F : Type*} [FunLike F M M\u2082]\n [AddMonoidHomClass F M M\u2082] (f : F) (R S : Type*)\n [DivisionSemiring R] [DivisionSemiring S] [Module R M]\n [Module S M\u2082] (n : \u2115) (x : M) : f ((n\u207b\u00b9 : R) \u2022 x) = (n\u207b\u00b9 : S) \u2022 f x := by\nby_cases hR : (n : R) = 0 <;> by_cases hS : (n : S) = 0\n \u00b7 simp [hR, hS, map_zero f]\n \u00b7 suffices \u2200 y, f y = 0 by rw [this, this, smul_zero]\n clear x\n intro x\n rw [\u2190 inv_smul_smul\u2080 hS (f x), \u2190 map_natCast_smul f R S]\n simp [hR, map_zero f]\n \u00b7 suffices \u2200 y, f y = 0 by simp [this]\n clear x\n intro x\n rw [\u2190 smul_inv_smul\u2080 hR x, map_natCast_smul f R S, hS, zero_smul]\n \u00b7 rw [\u2190 inv_smul_smul\u2080 hS (f _), \u2190 map_natCast_smul f R S, smul_inv_smul\u2080 hR]\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Algebra.Module.Bimodule.mk (L82-L90)\ndef mk (p : AddSubmonoid M) (hA : \u2200 (a : A) {m : M}, m \u2208 p \u2192 a \u2022 m \u2208 p)\n (hB : \u2200 (b : B) {m : M}, m \u2208 p \u2192 b \u2022 m \u2208 p) : Submodule (A \u2297[R] B) M :=\n{ p with\n carrier := p\n smul_mem' := fun ab m =>\n TensorProduct.induction_on ab (fun _ => by simp only [zero_smul, SetLike.mem_coe, zero_mem])\n (fun a b hm => by simpa only [TensorProduct.Algebra.smul_def] using hA a (hB b hm))\n fun z w hz hw hm => by simpa only [add_smul] using p.add_mem (hz hm) (hw hm) }\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.coe_toLinearMap_one (L99-L100)\nlemma coe_toLinearMap_one : (\u2191(1 : M \u2243\u2097[R] M) : M \u2192\u2097[R] M) = LinearMap.id := rfl\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Algebra.Module.BigOperators.Multiset (L29-L31)\ntheorem Multiset.sum_smul {l : Multiset R} {x : M} : l.sum \u2022 x = (l.map fun r \u21a6 r \u2022 x).sum :=\n((smulAddHom R M).flip x).map_multiset_sum l\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Algebra.Module.DedekindDomain.exists_isInternal_prime_power_torsion (L76-L83)\ntheorem exists_isInternal_prime_power_torsion [Module.Finite R M] (hM : Module.IsTorsion R M) :\n \u2203 (P : Finset <| Ideal R) (_ : DecidableEq P) (_ : \u2200 p \u2208 P, Prime p) (e : P \u2192 \u2115),\n DirectSum.IsInternal fun p : P => torsionBySet R M (p ^ e p : Ideal R) := by\nclassical\n exact \u27e8_, _, fun p hp => prime_of_factor p (Multiset.mem_toFinset.mp hp), _,\n isInternal_prime_power_torsion hM\u27e9\n\nend Submodule\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Algebra.Module.Card.mk_le_of_module (L28-L35)\ntheorem mk_le_of_module (R : Type u) (E : Type v)\n [AddCommGroup E] [Ring R] [IsDomain R] [Module R E] [Nontrivial E] [Module.IsTorsionFree R E] :\n Cardinal.lift.{v} (#R) \u2264 Cardinal.lift.{u} (#E) := by\nobtain \u27e8x, hx\u27e9 : \u2203 (x : E), x \u2260 0 := exists_ne 0\n have : Injective (fun k \u21a6 k \u2022 x) := smul_left_injective R hx\n exact lift_mk_le_lift_mk_of_injective this\n\nend Cardinal\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Algebra.Module.End.smulAddHom (L51-L55)\ndef smulAddHom : R \u2192+ M \u2192+ M :=\n(Module.toAddMonoidEnd R M).toAddMonoidHom\n\nvariable {R M}\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Algebra.Module.Basic.smul_indicator_one_apply (L168-L173)\nlemma smul_indicator_one_apply (s : Set \u03b1) (r : R) (a : \u03b1) :\n r \u2022 s.indicator (1 : \u03b1 \u2192 R) a = s.indicator (fun _ \u21a6 r) a := by\nsimp_rw [\u2190 indicator_const_smul_apply, Pi.one_apply, smul_eq_mul, mul_one]\n\nend MulZeroOneClass\nend Set\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.eq_zero_of_ofSpanSingleton_apply_self (L201-L214)\nlemma eq_zero_of_ofSpanSingleton_apply_self (a : A)\n (h : ofSpanSingleton a \u27e8a, Submodule.mem_span_singleton_self a\u27e9 = 0) : a = 0 := by\nerw [ofSpanSingleton, LinearMap.toAddMonoidHom_coe, LinearMap.comp_apply,\n intSpanEquivQuotAddOrderOf_apply_self, Submodule.liftQSpanSingleton_apply,\n AddMonoidHom.coe_toIntLinearMap, int.divByNat, LinearMap.toSpanSingleton_apply_one,\n AddCircle.coe_eq_zero_iff] at h\n rcases h with \u27e8n, hn\u27e9\n apply_fun Rat.den at hn\n rw [zsmul_one, Rat.den_intCast, Rat.inv_natCast_den_of_pos] at hn\n \u00b7 split_ifs at hn\n \u00b7 cases hn\n \u00b7 rwa [eq_comm, AddMonoid.addOrderOf_eq_one_iff] at hn\n \u00b7 grind\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Algebra.Module.BigOperators.Finset (L38-L40)\ntheorem Finset.sum_smul {f : \u03b9 \u2192 R} {s : Finset \u03b9} {x : M} :\n (\u2211 i \u2208 s, f i) \u2022 x = \u2211 i \u2208 s, f i \u2022 x := map_sum ((smulAddHom R M).flip x) f s\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.eq_zero_of_character_apply (L220-L224)\nlemma eq_zero_of_character_apply {a : A} (h : \u2200 c : CharacterModule A, c a = 0) : a = 0 := by\ncontrapose! h; exact exists_character_apply_ne_zero_of_ne_zero h\n\nvariable [Module R A] [Module R A'] [Module R B] {R A' B}\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Algebra.Module.Basic.invOf_two_smul_add_invOf_two_smul (L36-L40)\ntheorem invOf_two_smul_add_invOf_two_smul (R) [Semiring R] [AddCommMonoid M] [Module R M]\n [Invertible (2 : R)] (x : M) :\n (\u215f2 : R) \u2022 x + (\u215f2 : R) \u2022 x = x :=\nConvex.combo_self invOf_two_add_invOf_two _\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.surjective_of_dual_injective (L236-L245)\nlemma surjective_of_dual_injective (f : A \u2192\u2097[R] A') (hf : Function.Injective (dual f)) :\n Function.Surjective f := by\nrw [\u2190 LinearMap.range_eq_top, \u2190 Submodule.unique_quotient_iff_eq_top]\n refine \u27e8Unique.mk inferInstance fun a \u21a6 eq_zero_of_character_apply fun c \u21a6 ?_\u27e9\n obtain \u27e8b, rfl\u27e9 := QuotientAddGroup.mk'_surjective _ a\n suffices eq : dual (Submodule.mkQ _) c = 0 from congr($eq b)\n refine hf ?_\n rw [\u2190 LinearMap.comp_apply, \u2190 dual_comp, LinearMap.range_mkQ_comp, dual_zero,\n LinearMap.zero_apply, dual_apply, AddMonoidHom.zero_comp]\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.one_eq_refl (L90-L90)\nlemma one_eq_refl : (1 : M \u2243\u2097[R] M) = refl R M := rfl\n```\n\n-- snippet 84\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_smul_const_apply (L155-L157)\nlemma indicator_smul_const_apply (s : Set \u03b1) (r : \u03b1 \u2192 R) (m : M) (a : \u03b1) :\n indicator s (r \u00b7 \u2022 m) a = indicator s r a \u2022 m := indicator_smul_apply_left _ _ _ _\n```\n\n-- snippet 85\n```lean\n-- Mathlib.Algebra.Module.Defs.Convex (L76-L80)\ntheorem Convex.combo_self {a b : R} (h : a + b = 1) (x : M) : a \u2022 x + b \u2022 x = x := by\nrw [\u2190 add_smul, h, one_smul]\n\nvariable (R)\n```\n\n-- snippet 86\n```lean\n-- Mathlib.Algebra.Module.Congruence.Defs.SMulCon (L143-L147)\ndef SMulCon.ker [SMul R M] [SMul S N] {\u03c6 : R \u2192 S} (f : M \u2192\u2091[\u03c6] N) : SMulCon R M where\n __ := Setoid.ker f\nsmul r _ _ h := by rw [Setoid.ker_def] at h \u22a2; simp_rw [map_smul\u209b\u2097, h]\n\n/-- The kernel of a `DistribMulActionHom` as a congruence relation. -/\n```\n\n-- snippet 87\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.dual_injective_of_surjective (L95-L102)\nlemma dual_injective_of_surjective (f : A \u2192\u2097[R] B) (hf : Function.Surjective f) :\n Function.Injective (dual f) := by\nintro \u03c6 \u03c8 eq\n ext x\n obtain \u27e8y, rfl\u27e9 := hf x\n change (dual f) \u03c6 _ = (dual f) \u03c8 _\n rw [eq]\n```\n\n-- snippet 88\n```lean\n-- Mathlib.Algebra.Module.Basic.inv_intCast_smul_comm (L88-L94)\ntheorem inv_intCast_smul_comm {\u03b1 E : Type*} (R : Type*) [AddCommGroup E] [DivisionRing R]\n [Module R E] [DistribSMul \u03b1 E] (n : \u2124) (s : \u03b1) (x : E) :\n (n\u207b\u00b9 : R) \u2022 s \u2022 x = s \u2022 (n\u207b\u00b9 : R) \u2022 x :=\n(map_inv_intCast_smul (DistribSMul.toAddMonoidHom E s) R R n x).symm\n\nnamespace Function\n```\n\n-- snippet 89\n```lean\n-- Mathlib.Algebra.Module.Defs.neg_smul_neg (L142-L145)\ntheorem neg_smul_neg : -r \u2022 -x = r \u2022 x := by rw [neg_smul, smul_neg, neg_neg]\nvariable (R)\n```\n\n-- snippet 90\n```lean\n-- Mathlib.Algebra.Module.BigOperators.sum_piFinset_apply (L58-L64)\nlemma sum_piFinset_apply (f : \u03ba \u2192 \u03b1) (s : Finset \u03ba) (i : \u03b9) :\n \u2211 g \u2208 piFinset fun _ : \u03b9 \u21a6 s, f (g i) = #s ^ (card \u03b9 - 1) \u2022 \u2211 b \u2208 s, f b := by\nclassical\n rw [Finset.sum_comp]\n simp only [eval_image_piFinset_const, card_filter_piFinset_const s, ite_smul, zero_smul, smul_sum,\n Finset.sum_ite_mem, inter_self]\n```\n\n-- snippet 91\n```lean\n-- Mathlib.Algebra.Module.Basic.support_smul_subset_right (L101-L104)\nlemma support_smul_subset_right [Zero M] [SMulZeroClass R M] (f : \u03b1 \u2192 R) (g : \u03b1 \u2192 M) :\n support (f \u2022 g) \u2286 support g :=\nfun x hbf hf \u21a6 hbf <| by rw [Pi.smul_apply', hf, smul_zero]\n```\n\n-- snippet 92\n```lean\n-- Mathlib.Algebra.Module.Bimodule.toSubmodule' (L116-L129)\ndef toSubmodule' (p : Submodule (A \u2297[R] B) M) : Submodule B M :=\n{ p with\n carrier := p\n smul_mem' := smul_mem' p }\n\nend Algebra\n\nsection Ring\n\nvariable (R S M : Type*) [Ring R] [Ring S]\nvariable [AddCommGroup M] [Module R M] [Module S M] [SMulCommClass R S M]\n\n/-- A `Submodule` over `R \u2297[\u2115] S` is naturally also a `Submodule` over the canonically-isomorphic\nring `R \u2297[\u2124] S`. -/\n```\n\n-- snippet 93\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.restrictScalars_inj (L60-L65)\ntheorem restrictScalars_inj (f g : M \u2243\u2097[S] M\u2082) :\n f.restrictScalars R = g.restrictScalars R \u2194 f = g :=\n(restrictScalars_injective R).eq_iff\n\nend RestrictScalars\n```\n\n-- snippet 94\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_smul_left (L151-L154)\nlemma indicator_smul_left (s : Set \u03b1) (r : \u03b1 \u2192 R) (f : \u03b1 \u2192 M) :\n indicator s (fun a \u21a6 r a \u2022 f a) = fun a \u21a6 indicator s r a \u2022 f a :=\nfunext <| indicator_smul_apply_left _ _ _\n```\n\n-- snippet 95\n```lean\n-- Mathlib.Algebra.Module.Equiv.Basic.automorphismGroup (L81-L89)\ninstance automorphismGroup : Group (M \u2243\u2097[R] M) where\n mul f g := g.trans f\none := LinearEquiv.refl R M\n inv f := f.symm\n mul_assoc _ _ _ := rfl\n mul_one _ := ext fun _ \u21a6 rfl\n one_mul _ := ext fun _ \u21a6 rfl\n inv_mul_cancel f := ext <| f.left_inv\n```\n\n-- snippet 96\n```lean\n-- Mathlib.Algebra.Module.End.smulAddHom_apply (L57-L61)\ntheorem smulAddHom_apply : smulAddHom R M r x = r \u2022 x :=\nrfl\n\nvariable {x}\n```\n\n-- snippet 97\n```lean\n-- Mathlib.Algebra.Module.Bimodule.toSubbimoduleNat (L137-L142)\ndef toSubbimoduleNat (p : Submodule (R \u2297[\u2124] S) M) : Submodule (R \u2297[\u2115] S) M :=\nbaseChange \u2115 p\n\nend Ring\n\nend Subbimodule\n```\n\n-- snippet 98\n```lean\n-- Mathlib.Algebra.Module.Basic.support_const_smul_subset (L113-L121)\nlemma support_const_smul_subset [Zero M] [SMulZeroClass R M] (a : R) (f : \u03b1 \u2192 M) :\n support (a \u2022 f) \u2286 support f := support_smul_subset_right (fun _ \u21a6 a) f\nend Function\n\nnamespace Set\nsection SMulZeroClass\nvariable [Zero M] [SMulZeroClass R M]\n```\n\n-- snippet 99\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_smul_apply_left (L145-L150)\nlemma indicator_smul_apply_left (s : Set \u03b1) (r : \u03b1 \u2192 R) (f : \u03b1 \u2192 M) (a : \u03b1) :\n indicator s (fun a \u21a6 r a \u2022 f a) a = indicator s r a \u2022 f a := by\ndsimp only [indicator]\n split_ifs\n exacts [rfl, (zero_smul _ (f a)).symm]\n```\n\n-- snippet 100\n```lean\n-- Mathlib.Algebra.Module.Bimodule.toSubbimoduleInt (L131-L135)\ndef toSubbimoduleInt (p : Submodule (R \u2297[\u2115] S) M) : Submodule (R \u2297[\u2124] S) M :=\nbaseChange \u2124 p\n\n/-- A `Submodule` over `R \u2297[\u2124] S` is naturally also a `Submodule` over the canonically-isomorphic\nring `R \u2297[\u2115] S`. -/\n```\n\n-- snippet 101\n```lean\n-- Mathlib.Algebra.Module.Defs.neg_one_smul (L146-L149)\ntheorem neg_one_smul (x : M) : (-1 : R) \u2022 x = -x := by simp\nvariable {R}\n```\n\n-- snippet 102\n```lean\n-- Mathlib.Algebra.Module.Basic.indicator_smul_apply (L122-L127)\nlemma indicator_smul_apply (s : Set \u03b1) (r : \u03b1 \u2192 R) (f : \u03b1 \u2192 M) (a : \u03b1) :\n indicator s (fun a \u21a6 r a \u2022 f a) a = r a \u2022 indicator s f a := by\ndsimp only [indicator]\n split_ifs\n exacts [rfl, (smul_zero (r a)).symm]\n```\n\n-- snippet 103\n```lean\n-- Mathlib.Algebra.Module.Congruence.Defs.addConGen' (L64-L81)\ndef addConGen' (r : M \u2192 M \u2192 Prop) (hr : \u2200 (s : S) {m m'}, r m m' \u2192 r (s \u2022 m) (s \u2022 m')) :\n ModuleCon S M where\n toAddCon := addConGen r\nsmul s _ _ h := ((addConGen r).comap (DistribSMul.toAddMonoidHom M s) <| by simp).addConGen_le\n (fun _ _ h \u21a6 .of _ _ (hr s h)) h\n\n/-- The `AddCon` generated by a `SMulCon` is a `ModuleCon`. -/\nprotected abbrev addConGen (c : SMulCon S M) : ModuleCon S M := addConGen' c.r c.smul\n\nend addConGen\n\nend SMulCon\n\nnamespace ModuleCon\n\n/-- The quotient by a congruence relation preserving addition and scalar multiplication. -/\nprotected def Quotient [Add M] [SMul S M] (c : ModuleCon S M) : Type _ := Quotient c.toSetoid\n```\n\n-- snippet 104\n```lean\n-- Mathlib.Algebra.Module.Defs.Module (L105-L107)\ntheorem Module.eq_zero_of_zero_eq_one (zero_eq_one : (0 : R) = 1) : x = 0 := by\nrw [\u2190 one_smul R x, \u2190 zero_eq_one, zero_smul]\n```\n\n-- snippet 105\n```lean\n-- Mathlib.Algebra.Module.CharacterModule.exists_character_apply_ne_zero_of_ne_zero (L215-L219)\nlemma exists_character_apply_ne_zero_of_ne_zero {a : A} (ne_zero : a \u2260 0) :\n \u2203 (c : CharacterModule A), c a \u2260 0 :=\nhave \u27e8c, hc\u27e9 := dual_surjective_of_injective _ (Submodule.injective_subtype _) (ofSpanSingleton a)\n \u27e8c, fun h \u21a6 ne_zero <| eq_zero_of_ofSpanSingleton_apply_self a <| by rwa [\u2190 hc]\u27e9\n```\n[/INST]", "sample_id": "C-Mathlib.Algebra.Module.Submodule.Lattice.sum_mem_iSup", "source": {"declaration": "Mathlib.Algebra.Module.Submodule.Lattice.sum_mem_iSup", "file": "Mathlib/Algebra/Module/Submodule/Lattice.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Algebra.Module.Submodule.Lattice", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Module/Submodule/Lattice.lean#L286", "span": "L286-L289"}} {"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 equivPUnit [HasZeroObject C] : C \u224c Discrete PUnit.{w + 1} where\n functor", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 606, "declarations_count": 56, "diagnostics_count": 0, "duplicate_fingerprint": "c606f7a67831f3cc", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 177, "lean_code_chars": 78, "lean_code_ratio": 0.1287, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 528, "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.CategoryTheory.Monoidal.Closed.Zero).", "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 equivPUnit [HasZeroObject C] : C \u224c Discrete PUnit.{w + 1} where\n functor\n```\n\nDeclaration: `Mathlib.CategoryTheory.Monoidal.Closed.Zero.equivPUnit` (module Mathlib.CategoryTheory.Monoidal.Closed.Zero).", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Monoidal.Closed.Zero).[/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 equivPUnit [HasZeroObject C] : C \u224c Discrete PUnit.{w + 1} where\n functor\n```\n\nDeclaration: `Mathlib.CategoryTheory.Monoidal.Closed.Zero.equivPUnit` (module Mathlib.CategoryTheory.Monoidal.Closed.Zero).[/INST]", "sample_id": "F-Mathlib.CategoryTheory.Monoidal.Closed.Zero.equivPUnit", "source": {"declaration": "Mathlib.CategoryTheory.Monoidal.Closed.Zero.equivPUnit", "file": "Mathlib/CategoryTheory/Monoidal/Closed/Zero.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.CategoryTheory.Monoidal.Closed.Zero", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Monoidal/Closed/Zero.lean#L65", "span": "L65-L75"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"trace_states": [{"state": "theorem uniformEquicontinuous_birkhoffAverage (hf : LipschitzWith 1 f) (hg : UniformContinuous g) :\n UniformEquicontinuous (birkhoffAverage \ud835\udd5c f g)", "tactic": "refine Metric.uniformity_basis_dist_le.uniformEquicontinuous_iff_right.2 fun \u03b5 h\u03b5 \u21a6 ?_ rcases (uniformity_basis_edist_le.uniformContinuous_iff Metric.uniformity_basis_dist_le).1 hg \u03b5 h\u03b5 with \u27e8\u03b4, h\u03b4\u2080, h\u03b4\u03b5\u27e9"}, {"state": "", "tactic": "refine mem_uniformity_edist.2 \u27e8\u03b4, h\u03b4\u2080, fun {x y} h n \u21a6 ?_\u27e9"}, {"state": "", "tactic": "calc dist (birkhoffAverage \ud835\udd5c f g n x) (birkhoffAverage \ud835\udd5c f g n y) \u2264 (\u2211 k \u2208 Finset.range n, dist (g (f^[k] x)) (g (f^[k] y))) / n := dist_birkhoffAverage_birkhoffAverage_le .. _ \u2264 (\u2211 _k \u2208 Finset.range n, \u03b5) / n := by"}, {"state": "", "tactic": "gcongr"}, {"state": "", "tactic": "refine h\u03b4\u03b5 _ _ ?_"}, {"state": "", "tactic": "simpa using (hf.iterate _).edist_le_mul_of_le h.le _ = n * \u03b5 / n := by simp _ \u2264 \u03b5 := by rcases eq_or_ne n 0 with hn | hn <;> simp [hn, h\u03b5.le, mul_div_cancel_left\u2080] /-- If `f : X \u2192 X` is a non-strictly contracting map (i.e., it is Lipschitz with constant `1`), `g : X \u2192 E` is a uniformly continuous, and `l : X \u2192 E` is a continuous function, then the set of points `x` such that the Birkhoff average of `g` along the orbit of `x` tends to `l x` is a closed set. -/"}], "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 2136, "declarations_count": 268, "diagnostics_count": 0, "duplicate_fingerprint": "7be5d8e6f8cdd65f", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 772, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "short", "line_count": 20, "natural_language_chars": 2136, "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.NormedSpace).", "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.BirkhoffSum.NormedSpace.uniformEquicontinuous_birkhoffAverage`:\nState 0: \u22a2 theorem uniformEquicontinuous_birkhoffAverage (hf : LipschitzWith 1 f) (hg : UniformContinuous g) :\n UniformEquicontinuous (birkhoffAverage \ud835\udd5c f g)\nTactic: refine Metric.uniformity_basis_dist_le.uniformEquicontinuous_iff_right.2 fun \u03b5 h\u03b5 \u21a6 ?_ rcases (uniformity_basis_edist_le.uniformContinuous_iff Metric.uniformity_basis_dist_le).1 hg \u03b5 h\u03b5 with \u27e8\u03b4, h\u03b4\u2080, h\u03b4\u03b5\u27e9\nState 1: \u22a2 \nTactic: refine mem_uniformity_edist.2 \u27e8\u03b4, h\u03b4\u2080, fun {x y} h n \u21a6 ?_\u27e9\nState 2: \u22a2 \nTactic: calc dist (birkhoffAverage \ud835\udd5c f g n x) (birkhoffAverage \ud835\udd5c f g n y) \u2264 (\u2211 k \u2208 Finset.range n, dist (g (f^[k] x)) (g (f^[k] y))) / n := dist_birkhoffAverage_birkhoffAverage_le .. _ \u2264 (\u2211 _k \u2208 Finset.range n, \u03b5) / n := by\nState 3: \u22a2 \nTactic: gcongr\nState 4: \u22a2 \nTactic: refine h\u03b4\u03b5 _ _ ?_\nState 5: \u22a2 \nTactic: simpa using (hf.iterate _).edist_le_mul_of_le h.le _ = n * \u03b5 / n := by simp _ \u2264 \u03b5 := by rcases eq_or_ne n 0 with hn | hn <;> simp [hn, h\u03b5.le, mul_div_cancel_left\u2080] /-- If `f : X \u2192 X` is a non-strictly contracting map (i.e., it is Lipschitz with constant `1`), `g : X \u2192 E` is a uniformly continuous, and `l : X \u2192 E` is a continuous function, then the set of points `x` such that the Birkhoff average of `g` along the orbit of `x` tends to `l x` is a closed set. -/\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.BirkhoffSum.NormedSpace).[/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.BirkhoffSum.NormedSpace.uniformEquicontinuous_birkhoffAverage`:\nState 0: \u22a2 theorem uniformEquicontinuous_birkhoffAverage (hf : LipschitzWith 1 f) (hg : UniformContinuous g) :\n UniformEquicontinuous (birkhoffAverage \ud835\udd5c f g)\nTactic: refine Metric.uniformity_basis_dist_le.uniformEquicontinuous_iff_right.2 fun \u03b5 h\u03b5 \u21a6 ?_ rcases (uniformity_basis_edist_le.uniformContinuous_iff Metric.uniformity_basis_dist_le).1 hg \u03b5 h\u03b5 with \u27e8\u03b4, h\u03b4\u2080, h\u03b4\u03b5\u27e9\nState 1: \u22a2 \nTactic: refine mem_uniformity_edist.2 \u27e8\u03b4, h\u03b4\u2080, fun {x y} h n \u21a6 ?_\u27e9\nState 2: \u22a2 \nTactic: calc dist (birkhoffAverage \ud835\udd5c f g n x) (birkhoffAverage \ud835\udd5c f g n y) \u2264 (\u2211 k \u2208 Finset.range n, dist (g (f^[k] x)) (g (f^[k] y))) / n := dist_birkhoffAverage_birkhoffAverage_le .. _ \u2264 (\u2211 _k \u2208 Finset.range n, \u03b5) / n := by\nState 3: \u22a2 \nTactic: gcongr\nState 4: \u22a2 \nTactic: refine h\u03b4\u03b5 _ _ ?_\nState 5: \u22a2 \nTactic: simpa using (hf.iterate _).edist_le_mul_of_le h.le _ = n * \u03b5 / n := by simp _ \u2264 \u03b5 := by rcases eq_or_ne n 0 with hn | hn <;> simp [hn, h\u03b5.le, mul_div_cancel_left\u2080] /-- If `f : X \u2192 X` is a non-strictly contracting map (i.e., it is Lipschitz with constant `1`), `g : X \u2192 E` is a uniformly continuous, and `l : X \u2192 E` is a continuous function, then the set of points `x` such that the Birkhoff average of `g` along the orbit of `x` tends to `l x` is a closed set. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.Dynamics.BirkhoffSum.NormedSpace.uniformEquicontinuous_birkhoffAverage", "source": {"declaration": "Mathlib.Dynamics.BirkhoffSum.NormedSpace.uniformEquicontinuous_birkhoffAverage", "file": "Mathlib/Dynamics/BirkhoffSum/NormedSpace.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Dynamics.BirkhoffSum.NormedSpace", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Dynamics/BirkhoffSum/NormedSpace.lean#L110", "span": "L110-L132"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "def structurePresheafInCommRingCat : Presheaf CommRingCat (PrimeSpectrum.Top R) where\n obj U", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 510, "declarations_count": 55, "diagnostics_count": 0, "duplicate_fingerprint": "8d6bebb20b72d007", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 141, "lean_code_chars": 94, "lean_code_ratio": 0.1843, "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": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicGeometry.StructureSheaf).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ndef structurePresheafInCommRingCat : Presheaf CommRingCat (PrimeSpectrum.Top R) where\n obj U\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.AlgebraicGeometry.StructureSheaf).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ndef structurePresheafInCommRingCat : Presheaf CommRingCat (PrimeSpectrum.Top R) where\n obj U\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.AlgebraicGeometry.StructureSheaf.structurePresheafInCommRingCat", "source": {"declaration": "Mathlib.AlgebraicGeometry.StructureSheaf.structurePresheafInCommRingCat", "file": "Mathlib/AlgebraicGeometry/StructureSheaf.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicGeometry.StructureSheaf", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicGeometry/StructureSheaf.lean#L221", "span": "L221-L230"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\nabbrev lift (W : C) (k : \u2200 a, W \u27f6 I.left a)\n (h : \u2200 b, k (J.fst b) \u226b I.fst b = k (J.snd b) \u226b I.snd b) : W \u27f6 multiequalizer I := limit.lift _ (Multifork.of\u03b9 I _ k h)\n```", "instruction": "Edit `lift` so it still compiles and the proof is simplified where possible. Return the full updated `lift` block.", "proof_is_oneliner": false, "target_span": "L1050-L1053", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 909, "declarations_count": 107, "diagnostics_count": 0, "duplicate_fingerprint": "9c7fe5c39fb830e1", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 317, "lean_code_chars": 168, "lean_code_ratio": 0.1848, "length_bucket": "tiny", "line_count": 11, "natural_language_chars": 741, "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.CategoryTheory.Limits.Shapes.Multiequalizer).", "role": "system"}, {"content": "You are editing a file in `Mathlib/CategoryTheory/Limits/Shapes/Multiequalizer.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.CategoryTheory.Limits.Shapes.Multiequalizer.lift`, L1050-L1053)\n```lean\nabbrev lift (W : C) (k : \u2200 a, W \u27f6 I.left a)\n (h : \u2200 b, k (J.fst b) \u226b I.fst b = k (J.snd b) \u226b I.snd b) : W \u27f6 multiequalizer I := limit.lift _ (Multifork.of\u03b9 I _ k h)\n```\n\n## Edit instruction\nEdit `lift` so it still compiles and the proof is simplified where possible. Return the full updated `lift` 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.CategoryTheory.Limits.Shapes.Multiequalizer).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/CategoryTheory/Limits/Shapes/Multiequalizer.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.CategoryTheory.Limits.Shapes.Multiequalizer.lift`, L1050-L1053)\n```lean\nabbrev lift (W : C) (k : \u2200 a, W \u27f6 I.left a)\n (h : \u2200 b, k (J.fst b) \u226b I.fst b = k (J.snd b) \u226b I.snd b) : W \u27f6 multiequalizer I := limit.lift _ (Multifork.of\u03b9 I _ k h)\n```\n\n## Edit instruction\nEdit `lift` so it still compiles and the proof is simplified where possible. Return the full updated `lift` block.\n[/INST]", "sample_id": "D-Mathlib.CategoryTheory.Limits.Shapes.Multiequalizer.lift", "source": {"declaration": "Mathlib.CategoryTheory.Limits.Shapes.Multiequalizer.lift", "file": "Mathlib/CategoryTheory/Limits/Shapes/Multiequalizer.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.CategoryTheory.Limits.Shapes.Multiequalizer", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Limits/Shapes/Multiequalizer.lean#L1050", "span": "L1050-L1053"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Data.Finset.Insert.singleton_val (L70-L72)\ntheorem singleton_val (a : \u03b1) : ({a} : Finset \u03b1).1 = {a} :=\nrfl", "-- Mathlib.Data.Finset.Insert.mem_singleton (L74-L76)\ntheorem mem_singleton {a b : \u03b1} : b \u2208 ({a} : Finset \u03b1) \u2194 b = a :=\nMultiset.mem_singleton", "-- Mathlib.Data.Finset.Insert.eq_of_mem_singleton (L77-L79)\ntheorem eq_of_mem_singleton {x y : \u03b1} (h : x \u2208 ({y} : Finset \u03b1)) : x = y :=\nmem_singleton.1 h", "-- Mathlib.Data.Finset.Insert.notMem_singleton (L80-L82)\ntheorem notMem_singleton {a b : \u03b1} : a \u2209 ({b} : Finset \u03b1) \u2194 a \u2260 b :=\nnot_congr mem_singleton", "-- Mathlib.Data.Finset.Insert.mem_singleton_self (L83-L85)\ntheorem mem_singleton_self (a : \u03b1) : a \u2208 ({a} : Finset \u03b1) :=\nmem_singleton.mpr rfl", "-- Mathlib.Data.Finset.Insert.val_eq_singleton_iff (L87-L90)\ntheorem val_eq_singleton_iff {a : \u03b1} {s : Finset \u03b1} : s.val = {a} \u2194 s = {a} := by\nrw [\u2190 val_inj]\n rfl", "-- Mathlib.Data.Finset.Insert.singleton_injective (L91-L93)\ntheorem singleton_injective : Injective (singleton : \u03b1 \u2192 Finset \u03b1) := fun _a _b h =>\nmem_singleton.1 (h \u25b8 mem_singleton_self _)", "-- Mathlib.Data.Finset.Insert.singleton_inj (L95-L97)\ntheorem singleton_inj : ({a} : Finset \u03b1) = {b} \u2194 a = b :=\nsingleton_injective.eq_iff", "-- Mathlib.Data.Finset.Insert.singleton_nonempty (L99-L101)\ntheorem singleton_nonempty (a : \u03b1) : ({a} : Finset \u03b1).Nonempty :=\n\u27e8a, mem_singleton_self a\u27e9", "-- Mathlib.Data.Finset.Insert.singleton_ne_empty (L103-L105)\ntheorem singleton_ne_empty (a : \u03b1) : ({a} : Finset \u03b1) \u2260 \u2205 :=\n(singleton_nonempty a).ne_empty", "-- Mathlib.Data.Finset.Insert.empty_ne_singleton (L107-L109)\ntheorem empty_ne_singleton (a : \u03b1) : \u2205 \u2260 ({a} : Finset \u03b1) :=\n(singleton_ne_empty a).symm", "-- Mathlib.Data.Finset.Insert.empty_ssubset_singleton (L110-L112)\ntheorem empty_ssubset_singleton : (\u2205 : Finset \u03b1) \u2282 {a} :=\n(singleton_nonempty _).empty_ssubset", "-- Mathlib.Data.Finset.Insert.coe_singleton (L114-L115)\ntheorem coe_singleton (a : \u03b1) : (({a} : Finset \u03b1) : Set \u03b1) = {a} := by grind", "-- Mathlib.Data.Finset.Insert.coe_eq_singleton (L117-L118)\ntheorem coe_eq_singleton {s : Finset \u03b1} {a : \u03b1} : (s : Set \u03b1) = {a} \u2194 s = {a} := by grind", "-- Mathlib.Data.Finset.Insert.coe_subset_singleton (L120-L121)\nlemma coe_subset_singleton : (s : Set \u03b1) \u2286 {a} \u2194 s \u2286 {a} := by grind", "-- Mathlib.Data.Finset.Basic.disjUnion_eq_union (L73-L74)\ntheorem disjUnion_eq_union (s t h) : @disjUnion \u03b1 s t h = s \u222a t := by grind", "-- Mathlib.Data.Finset.Basic.erase_cons_of_ne (L139-L141)\ntheorem erase_cons_of_ne {a b : \u03b1} {s : Finset \u03b1} (ha : a \u2209 s) (hb : a \u2260 b) :\n (s.cons a ha).erase b = (s.erase b).cons a fun h => ha <| erase_subset _ _ h := by grind", "-- Mathlib.Data.Finset.Basic.erase_singleton (L129-L130)\ntheorem erase_singleton (a : \u03b1) : ({a} : Finset \u03b1).erase a = \u2205 := by grind", "-- Mathlib.Data.Finset.Basic.ssubset_iff_exists_subset_erase (L153-L155)\ntheorem ssubset_iff_exists_subset_erase {s t : Finset \u03b1} : s \u2282 t \u2194 \u2203 a \u2208 t, s \u2286 t.erase a := by\ngrind", "-- Mathlib.Data.Finset.Basic.disjoint_union_right (L80-L84)\ntheorem disjoint_union_right : Disjoint s (t \u222a u) \u2194 Disjoint s t \u2227 Disjoint s u := by\nsimp only [disjoint_right, mem_union, or_imp, forall_and]\n\n/-! #### inter -/", "-- Mathlib.Data.Finset.Basic.disjoint_or_nonempty_inter (L90-L94)\ntheorem disjoint_or_nonempty_inter (s t : Finset \u03b1) : Disjoint s t \u2228 (s \u2229 t).Nonempty := by\nrw [\u2190 not_disjoint_iff_nonempty_inter]\n exact em _\n\nomit [DecidableEq \u03b1] in", "-- Mathlib.Data.Finset.Attach.coe_attach (L58-L60)\ntheorem coe_attach (s : Finset \u03b1) : (s.attach : Set s) = Set.univ := by ext; simp\nend Finset", "-- Mathlib.Data.Finset.Basic.isDirected_subset (L107-L114)\ninstance isDirected_subset : IsDirected (Finset \u03b1) (\u00b7 \u2286 \u00b7) := isDirected_le\n/-! ### erase -/\n\nsection Erase\n\nvariable [DecidableEq \u03b1] {s t u v : Finset \u03b1} {a b : \u03b1}", "-- Mathlib.Data.Finset.Basic.disjoint_union_left (L76-L78)\ntheorem disjoint_union_left : Disjoint (s \u222a t) u \u2194 Disjoint s u \u2227 Disjoint t u := by\nsimp only [disjoint_left, mem_union, or_imp, forall_and]", "-- Mathlib.Data.Finset.Attach.attach_val (L50-L52)\ntheorem attach_val (s : Finset \u03b1) : s.attach.1 = s.1.attach :=\nrfl", "-- Mathlib.Data.Finset.Basic.erase_insert_eq_erase (L132-L133)\ntheorem erase_insert_eq_erase (s : Finset \u03b1) (a : \u03b1) : (insert a s).erase a = s.erase a := by grind", "-- Mathlib.Data.Finset.Basic.erase_eq_iff_eq_insert (L144-L146)\nlemma erase_eq_iff_eq_insert (hs : a \u2208 s) (ht : a \u2209 t) : s.erase a = t \u2194 s = insert a t := by\naesop", "-- Mathlib.Data.Finset.Basic.not_disjoint_iff_nonempty_inter (L85-L89)\ntheorem not_disjoint_iff_nonempty_inter : \u00acDisjoint s t \u2194 (s \u2229 t).Nonempty :=\nnot_disjoint_iff.trans <| by simp [Finset.Nonempty]\n\nalias \u27e8_, Nonempty.not_disjoint\u27e9 := not_disjoint_iff_nonempty_inter", "-- Mathlib.Data.Finset.Basic.erase_cons (L159-L160)\ntheorem erase_cons {s : Finset \u03b1} {a : \u03b1} (h : a \u2209 s) : (s.cons a h).erase a = s := by grind", "-- Mathlib.Data.Finset.Basic.erase_ssubset_insert (L156-L158)\ntheorem erase_ssubset_insert (s : Finset \u03b1) (a : \u03b1) : s.erase a \u2282 insert a s :=\nssubset_iff_exists_subset_erase.2 \u27e8a, mem_insert_self _ _, by grw [\u2190 subset_insert]\u27e9", "-- Mathlib.Data.Finset.Basic.insert_erase_invOn (L147-L150)\nlemma insert_erase_invOn :\n Set.InvOn (insert a) (fun s \u21a6 s.erase a) {s : Finset \u03b1 | a \u2208 s} {s : Finset \u03b1 | a \u2209 s} :=\n\u27e8fun _s \u21a6 insert_erase, fun _s \u21a6 erase_insert\u27e9", "-- Mathlib.Data.Finset.Attach.attach (L46-L48)\ndef attach (s : Finset \u03b1) : Finset { x // x \u2208 s } :=\n\u27e8Multiset.attach s.1, nodup_attach.2 s.2\u27e9", "-- Mathlib.Data.Finset.Basic.disjoint_of_subset_iff_left_eq_empty (L95-L98)\ntheorem disjoint_of_subset_iff_left_eq_empty (h : s \u2286 t) :\n Disjoint s t \u2194 s = \u2205 :=\ndisjoint_of_le_iff_left_eq_bot h", "-- Mathlib.Data.Finset.Basic.erase_empty (L116-L121)\ntheorem erase_empty (a : \u03b1) : erase \u2205 a = \u2205 :=\nrfl\n\nprotected lemma Nontrivial.erase_nonempty (hs : s.Nontrivial) : (s.erase a).Nonempty :=\n (hs.exists_ne a).imp <| by simp_all", "-- Mathlib.Data.Finset.Basic.erase_insert (L134-L135)\ntheorem erase_insert {a : \u03b1} {s : Finset \u03b1} (h : a \u2209 s) : (insert a s).erase a = s := by grind", "-- Mathlib.Data.Finset.Basic.pairwiseDisjoint_iff (L99-L105)\nlemma pairwiseDisjoint_iff {\u03b9 : Type*} {s : Set \u03b9} {f : \u03b9 \u2192 Finset \u03b1} :\n s.PairwiseDisjoint f \u2194 \u2200 \u2983i\u2984, i \u2208 s \u2192 \u2200 \u2983j\u2984, j \u2208 s \u2192 (f i \u2229 f j).Nonempty \u2192 i = j := by\nsimp [Set.PairwiseDisjoint, Set.Pairwise, not_imp_comm (a := _ = _),\n not_disjoint_iff_nonempty_inter]\n\nend Lattice", "-- Mathlib.Data.Finset.Attach.mem_attach (L54-L56)\ntheorem mem_attach (s : Finset \u03b1) : \u2200 x, x \u2208 s.attach :=\nMultiset.mem_attach _", "-- Mathlib.Data.Finset.Basic.erase_insert_of_ne (L136-L138)\ntheorem erase_insert_of_ne {a b : \u03b1} {s : Finset \u03b1} (h : a \u2260 b) :\n (insert a s).erase b = insert a (s.erase b) := by grind", "-- Mathlib.Data.Finset.Basic.erase_ssubset (L151-L152)\ntheorem erase_ssubset {a : \u03b1} {s : Finset \u03b1} (h : a \u2208 s) : s.erase a \u2282 s := by grind", "-- Mathlib.Data.Finset.Basic.isDirected_le (L106-L106)\ninstance isDirected_le : IsDirectedOrder (Finset \u03b1) := by classical infer_instance"], "statement": "theorem exists_mem_insert (a : \u03b1) (s : Finset \u03b1) (p : \u03b1 \u2192 Prop) :\n (\u2203 x, x \u2208 insert a s \u2227 p x) \u2194 p a \u2228 \u2203 x, x \u2208 s \u2227 p x", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 8515, "declarations_count": 818, "diagnostics_count": 0, "duplicate_fingerprint": "3da7a6507b963c7f", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 3280, "lean_code_chars": 7020, "lean_code_ratio": 0.8244, "length_bucket": "medium", "line_count": 299, "natural_language_chars": 1495, "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.Data.Finset.Insert).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem exists_mem_insert (a : \u03b1) (s : Finset \u03b1) (p : \u03b1 \u2192 Prop) :\n (\u2203 x, x \u2208 insert a s \u2227 p x) \u2194 p a \u2228 \u2203 x, x \u2208 s \u2227 p x\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Data.Finset.Insert.singleton_val (L70-L72)\ntheorem singleton_val (a : \u03b1) : ({a} : Finset \u03b1).1 = {a} :=\nrfl\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Data.Finset.Insert.mem_singleton (L74-L76)\ntheorem mem_singleton {a b : \u03b1} : b \u2208 ({a} : Finset \u03b1) \u2194 b = a :=\nMultiset.mem_singleton\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Data.Finset.Insert.eq_of_mem_singleton (L77-L79)\ntheorem eq_of_mem_singleton {x y : \u03b1} (h : x \u2208 ({y} : Finset \u03b1)) : x = y :=\nmem_singleton.1 h\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Data.Finset.Insert.notMem_singleton (L80-L82)\ntheorem notMem_singleton {a b : \u03b1} : a \u2209 ({b} : Finset \u03b1) \u2194 a \u2260 b :=\nnot_congr mem_singleton\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Data.Finset.Insert.mem_singleton_self (L83-L85)\ntheorem mem_singleton_self (a : \u03b1) : a \u2208 ({a} : Finset \u03b1) :=\nmem_singleton.mpr rfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Data.Finset.Insert.val_eq_singleton_iff (L87-L90)\ntheorem val_eq_singleton_iff {a : \u03b1} {s : Finset \u03b1} : s.val = {a} \u2194 s = {a} := by\nrw [\u2190 val_inj]\n rfl\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Data.Finset.Insert.singleton_injective (L91-L93)\ntheorem singleton_injective : Injective (singleton : \u03b1 \u2192 Finset \u03b1) := fun _a _b h =>\nmem_singleton.1 (h \u25b8 mem_singleton_self _)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Data.Finset.Insert.singleton_inj (L95-L97)\ntheorem singleton_inj : ({a} : Finset \u03b1) = {b} \u2194 a = b :=\nsingleton_injective.eq_iff\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Data.Finset.Insert.singleton_nonempty (L99-L101)\ntheorem singleton_nonempty (a : \u03b1) : ({a} : Finset \u03b1).Nonempty :=\n\u27e8a, mem_singleton_self a\u27e9\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Data.Finset.Insert.singleton_ne_empty (L103-L105)\ntheorem singleton_ne_empty (a : \u03b1) : ({a} : Finset \u03b1) \u2260 \u2205 :=\n(singleton_nonempty a).ne_empty\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Data.Finset.Insert.empty_ne_singleton (L107-L109)\ntheorem empty_ne_singleton (a : \u03b1) : \u2205 \u2260 ({a} : Finset \u03b1) :=\n(singleton_ne_empty a).symm\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Data.Finset.Insert.empty_ssubset_singleton (L110-L112)\ntheorem empty_ssubset_singleton : (\u2205 : Finset \u03b1) \u2282 {a} :=\n(singleton_nonempty _).empty_ssubset\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Data.Finset.Insert.coe_singleton (L114-L115)\ntheorem coe_singleton (a : \u03b1) : (({a} : Finset \u03b1) : Set \u03b1) = {a} := by grind\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Data.Finset.Insert.coe_eq_singleton (L117-L118)\ntheorem coe_eq_singleton {s : Finset \u03b1} {a : \u03b1} : (s : Set \u03b1) = {a} \u2194 s = {a} := by grind\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Data.Finset.Insert.coe_subset_singleton (L120-L121)\nlemma coe_subset_singleton : (s : Set \u03b1) \u2286 {a} \u2194 s \u2286 {a} := by grind\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Data.Finset.Basic.disjUnion_eq_union (L73-L74)\ntheorem disjUnion_eq_union (s t h) : @disjUnion \u03b1 s t h = s \u222a t := by grind\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Data.Finset.Basic.erase_cons_of_ne (L139-L141)\ntheorem erase_cons_of_ne {a b : \u03b1} {s : Finset \u03b1} (ha : a \u2209 s) (hb : a \u2260 b) :\n (s.cons a ha).erase b = (s.erase b).cons a fun h => ha <| erase_subset _ _ h := by grind\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Data.Finset.Basic.erase_singleton (L129-L130)\ntheorem erase_singleton (a : \u03b1) : ({a} : Finset \u03b1).erase a = \u2205 := by grind\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Data.Finset.Basic.ssubset_iff_exists_subset_erase (L153-L155)\ntheorem ssubset_iff_exists_subset_erase {s t : Finset \u03b1} : s \u2282 t \u2194 \u2203 a \u2208 t, s \u2286 t.erase a := by\ngrind\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Data.Finset.Basic.disjoint_union_right (L80-L84)\ntheorem disjoint_union_right : Disjoint s (t \u222a u) \u2194 Disjoint s t \u2227 Disjoint s u := by\nsimp only [disjoint_right, mem_union, or_imp, forall_and]\n\n/-! #### inter -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Data.Finset.Basic.disjoint_or_nonempty_inter (L90-L94)\ntheorem disjoint_or_nonempty_inter (s t : Finset \u03b1) : Disjoint s t \u2228 (s \u2229 t).Nonempty := by\nrw [\u2190 not_disjoint_iff_nonempty_inter]\n exact em _\n\nomit [DecidableEq \u03b1] in\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Data.Finset.Attach.coe_attach (L58-L60)\ntheorem coe_attach (s : Finset \u03b1) : (s.attach : Set s) = Set.univ := by ext; simp\nend Finset\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Data.Finset.Basic.isDirected_subset (L107-L114)\ninstance isDirected_subset : IsDirected (Finset \u03b1) (\u00b7 \u2286 \u00b7) := isDirected_le\n/-! ### erase -/\n\nsection Erase\n\nvariable [DecidableEq \u03b1] {s t u v : Finset \u03b1} {a b : \u03b1}\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Data.Finset.Basic.disjoint_union_left (L76-L78)\ntheorem disjoint_union_left : Disjoint (s \u222a t) u \u2194 Disjoint s u \u2227 Disjoint t u := by\nsimp only [disjoint_left, mem_union, or_imp, forall_and]\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Data.Finset.Attach.attach_val (L50-L52)\ntheorem attach_val (s : Finset \u03b1) : s.attach.1 = s.1.attach :=\nrfl\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Data.Finset.Basic.erase_insert_eq_erase (L132-L133)\ntheorem erase_insert_eq_erase (s : Finset \u03b1) (a : \u03b1) : (insert a s).erase a = s.erase a := by grind\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Data.Finset.Basic.erase_eq_iff_eq_insert (L144-L146)\nlemma erase_eq_iff_eq_insert (hs : a \u2208 s) (ht : a \u2209 t) : s.erase a = t \u2194 s = insert a t := by\naesop\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Data.Finset.Basic.not_disjoint_iff_nonempty_inter (L85-L89)\ntheorem not_disjoint_iff_nonempty_inter : \u00acDisjoint s t \u2194 (s \u2229 t).Nonempty :=\nnot_disjoint_iff.trans <| by simp [Finset.Nonempty]\n\nalias \u27e8_, Nonempty.not_disjoint\u27e9 := not_disjoint_iff_nonempty_inter\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Data.Finset.Basic.erase_cons (L159-L160)\ntheorem erase_cons {s : Finset \u03b1} {a : \u03b1} (h : a \u2209 s) : (s.cons a h).erase a = s := by grind\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Data.Finset.Basic.erase_ssubset_insert (L156-L158)\ntheorem erase_ssubset_insert (s : Finset \u03b1) (a : \u03b1) : s.erase a \u2282 insert a s :=\nssubset_iff_exists_subset_erase.2 \u27e8a, mem_insert_self _ _, by grw [\u2190 subset_insert]\u27e9\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Data.Finset.Basic.insert_erase_invOn (L147-L150)\nlemma insert_erase_invOn :\n Set.InvOn (insert a) (fun s \u21a6 s.erase a) {s : Finset \u03b1 | a \u2208 s} {s : Finset \u03b1 | a \u2209 s} :=\n\u27e8fun _s \u21a6 insert_erase, fun _s \u21a6 erase_insert\u27e9\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Data.Finset.Attach.attach (L46-L48)\ndef attach (s : Finset \u03b1) : Finset { x // x \u2208 s } :=\n\u27e8Multiset.attach s.1, nodup_attach.2 s.2\u27e9\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Data.Finset.Basic.disjoint_of_subset_iff_left_eq_empty (L95-L98)\ntheorem disjoint_of_subset_iff_left_eq_empty (h : s \u2286 t) :\n Disjoint s t \u2194 s = \u2205 :=\ndisjoint_of_le_iff_left_eq_bot h\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Data.Finset.Basic.erase_empty (L116-L121)\ntheorem erase_empty (a : \u03b1) : erase \u2205 a = \u2205 :=\nrfl\n\nprotected lemma Nontrivial.erase_nonempty (hs : s.Nontrivial) : (s.erase a).Nonempty :=\n (hs.exists_ne a).imp <| by simp_all\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Data.Finset.Basic.erase_insert (L134-L135)\ntheorem erase_insert {a : \u03b1} {s : Finset \u03b1} (h : a \u2209 s) : (insert a s).erase a = s := by grind\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Data.Finset.Basic.pairwiseDisjoint_iff (L99-L105)\nlemma pairwiseDisjoint_iff {\u03b9 : Type*} {s : Set \u03b9} {f : \u03b9 \u2192 Finset \u03b1} :\n s.PairwiseDisjoint f \u2194 \u2200 \u2983i\u2984, i \u2208 s \u2192 \u2200 \u2983j\u2984, j \u2208 s \u2192 (f i \u2229 f j).Nonempty \u2192 i = j := by\nsimp [Set.PairwiseDisjoint, Set.Pairwise, not_imp_comm (a := _ = _),\n not_disjoint_iff_nonempty_inter]\n\nend Lattice\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Data.Finset.Attach.mem_attach (L54-L56)\ntheorem mem_attach (s : Finset \u03b1) : \u2200 x, x \u2208 s.attach :=\nMultiset.mem_attach _\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Data.Finset.Basic.erase_insert_of_ne (L136-L138)\ntheorem erase_insert_of_ne {a b : \u03b1} {s : Finset \u03b1} (h : a \u2260 b) :\n (insert a s).erase b = insert a (s.erase b) := by grind\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Data.Finset.Basic.erase_ssubset (L151-L152)\ntheorem erase_ssubset {a : \u03b1} {s : Finset \u03b1} (h : a \u2208 s) : s.erase a \u2282 s := by grind\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Data.Finset.Basic.isDirected_le (L106-L106)\ninstance isDirected_le : IsDirectedOrder (Finset \u03b1) := by classical infer_instance\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.Data.Finset.Insert).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem exists_mem_insert (a : \u03b1) (s : Finset \u03b1) (p : \u03b1 \u2192 Prop) :\n (\u2203 x, x \u2208 insert a s \u2227 p x) \u2194 p a \u2228 \u2203 x, x \u2208 s \u2227 p x\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Data.Finset.Insert.singleton_val (L70-L72)\ntheorem singleton_val (a : \u03b1) : ({a} : Finset \u03b1).1 = {a} :=\nrfl\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Data.Finset.Insert.mem_singleton (L74-L76)\ntheorem mem_singleton {a b : \u03b1} : b \u2208 ({a} : Finset \u03b1) \u2194 b = a :=\nMultiset.mem_singleton\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Data.Finset.Insert.eq_of_mem_singleton (L77-L79)\ntheorem eq_of_mem_singleton {x y : \u03b1} (h : x \u2208 ({y} : Finset \u03b1)) : x = y :=\nmem_singleton.1 h\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Data.Finset.Insert.notMem_singleton (L80-L82)\ntheorem notMem_singleton {a b : \u03b1} : a \u2209 ({b} : Finset \u03b1) \u2194 a \u2260 b :=\nnot_congr mem_singleton\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Data.Finset.Insert.mem_singleton_self (L83-L85)\ntheorem mem_singleton_self (a : \u03b1) : a \u2208 ({a} : Finset \u03b1) :=\nmem_singleton.mpr rfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Data.Finset.Insert.val_eq_singleton_iff (L87-L90)\ntheorem val_eq_singleton_iff {a : \u03b1} {s : Finset \u03b1} : s.val = {a} \u2194 s = {a} := by\nrw [\u2190 val_inj]\n rfl\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Data.Finset.Insert.singleton_injective (L91-L93)\ntheorem singleton_injective : Injective (singleton : \u03b1 \u2192 Finset \u03b1) := fun _a _b h =>\nmem_singleton.1 (h \u25b8 mem_singleton_self _)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Data.Finset.Insert.singleton_inj (L95-L97)\ntheorem singleton_inj : ({a} : Finset \u03b1) = {b} \u2194 a = b :=\nsingleton_injective.eq_iff\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Data.Finset.Insert.singleton_nonempty (L99-L101)\ntheorem singleton_nonempty (a : \u03b1) : ({a} : Finset \u03b1).Nonempty :=\n\u27e8a, mem_singleton_self a\u27e9\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Data.Finset.Insert.singleton_ne_empty (L103-L105)\ntheorem singleton_ne_empty (a : \u03b1) : ({a} : Finset \u03b1) \u2260 \u2205 :=\n(singleton_nonempty a).ne_empty\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Data.Finset.Insert.empty_ne_singleton (L107-L109)\ntheorem empty_ne_singleton (a : \u03b1) : \u2205 \u2260 ({a} : Finset \u03b1) :=\n(singleton_ne_empty a).symm\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Data.Finset.Insert.empty_ssubset_singleton (L110-L112)\ntheorem empty_ssubset_singleton : (\u2205 : Finset \u03b1) \u2282 {a} :=\n(singleton_nonempty _).empty_ssubset\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Data.Finset.Insert.coe_singleton (L114-L115)\ntheorem coe_singleton (a : \u03b1) : (({a} : Finset \u03b1) : Set \u03b1) = {a} := by grind\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Data.Finset.Insert.coe_eq_singleton (L117-L118)\ntheorem coe_eq_singleton {s : Finset \u03b1} {a : \u03b1} : (s : Set \u03b1) = {a} \u2194 s = {a} := by grind\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Data.Finset.Insert.coe_subset_singleton (L120-L121)\nlemma coe_subset_singleton : (s : Set \u03b1) \u2286 {a} \u2194 s \u2286 {a} := by grind\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Data.Finset.Basic.disjUnion_eq_union (L73-L74)\ntheorem disjUnion_eq_union (s t h) : @disjUnion \u03b1 s t h = s \u222a t := by grind\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Data.Finset.Basic.erase_cons_of_ne (L139-L141)\ntheorem erase_cons_of_ne {a b : \u03b1} {s : Finset \u03b1} (ha : a \u2209 s) (hb : a \u2260 b) :\n (s.cons a ha).erase b = (s.erase b).cons a fun h => ha <| erase_subset _ _ h := by grind\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Data.Finset.Basic.erase_singleton (L129-L130)\ntheorem erase_singleton (a : \u03b1) : ({a} : Finset \u03b1).erase a = \u2205 := by grind\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Data.Finset.Basic.ssubset_iff_exists_subset_erase (L153-L155)\ntheorem ssubset_iff_exists_subset_erase {s t : Finset \u03b1} : s \u2282 t \u2194 \u2203 a \u2208 t, s \u2286 t.erase a := by\ngrind\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Data.Finset.Basic.disjoint_union_right (L80-L84)\ntheorem disjoint_union_right : Disjoint s (t \u222a u) \u2194 Disjoint s t \u2227 Disjoint s u := by\nsimp only [disjoint_right, mem_union, or_imp, forall_and]\n\n/-! #### inter -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Data.Finset.Basic.disjoint_or_nonempty_inter (L90-L94)\ntheorem disjoint_or_nonempty_inter (s t : Finset \u03b1) : Disjoint s t \u2228 (s \u2229 t).Nonempty := by\nrw [\u2190 not_disjoint_iff_nonempty_inter]\n exact em _\n\nomit [DecidableEq \u03b1] in\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Data.Finset.Attach.coe_attach (L58-L60)\ntheorem coe_attach (s : Finset \u03b1) : (s.attach : Set s) = Set.univ := by ext; simp\nend Finset\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Data.Finset.Basic.isDirected_subset (L107-L114)\ninstance isDirected_subset : IsDirected (Finset \u03b1) (\u00b7 \u2286 \u00b7) := isDirected_le\n/-! ### erase -/\n\nsection Erase\n\nvariable [DecidableEq \u03b1] {s t u v : Finset \u03b1} {a b : \u03b1}\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Data.Finset.Basic.disjoint_union_left (L76-L78)\ntheorem disjoint_union_left : Disjoint (s \u222a t) u \u2194 Disjoint s u \u2227 Disjoint t u := by\nsimp only [disjoint_left, mem_union, or_imp, forall_and]\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Data.Finset.Attach.attach_val (L50-L52)\ntheorem attach_val (s : Finset \u03b1) : s.attach.1 = s.1.attach :=\nrfl\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Data.Finset.Basic.erase_insert_eq_erase (L132-L133)\ntheorem erase_insert_eq_erase (s : Finset \u03b1) (a : \u03b1) : (insert a s).erase a = s.erase a := by grind\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Data.Finset.Basic.erase_eq_iff_eq_insert (L144-L146)\nlemma erase_eq_iff_eq_insert (hs : a \u2208 s) (ht : a \u2209 t) : s.erase a = t \u2194 s = insert a t := by\naesop\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Data.Finset.Basic.not_disjoint_iff_nonempty_inter (L85-L89)\ntheorem not_disjoint_iff_nonempty_inter : \u00acDisjoint s t \u2194 (s \u2229 t).Nonempty :=\nnot_disjoint_iff.trans <| by simp [Finset.Nonempty]\n\nalias \u27e8_, Nonempty.not_disjoint\u27e9 := not_disjoint_iff_nonempty_inter\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Data.Finset.Basic.erase_cons (L159-L160)\ntheorem erase_cons {s : Finset \u03b1} {a : \u03b1} (h : a \u2209 s) : (s.cons a h).erase a = s := by grind\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Data.Finset.Basic.erase_ssubset_insert (L156-L158)\ntheorem erase_ssubset_insert (s : Finset \u03b1) (a : \u03b1) : s.erase a \u2282 insert a s :=\nssubset_iff_exists_subset_erase.2 \u27e8a, mem_insert_self _ _, by grw [\u2190 subset_insert]\u27e9\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Data.Finset.Basic.insert_erase_invOn (L147-L150)\nlemma insert_erase_invOn :\n Set.InvOn (insert a) (fun s \u21a6 s.erase a) {s : Finset \u03b1 | a \u2208 s} {s : Finset \u03b1 | a \u2209 s} :=\n\u27e8fun _s \u21a6 insert_erase, fun _s \u21a6 erase_insert\u27e9\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Data.Finset.Attach.attach (L46-L48)\ndef attach (s : Finset \u03b1) : Finset { x // x \u2208 s } :=\n\u27e8Multiset.attach s.1, nodup_attach.2 s.2\u27e9\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Data.Finset.Basic.disjoint_of_subset_iff_left_eq_empty (L95-L98)\ntheorem disjoint_of_subset_iff_left_eq_empty (h : s \u2286 t) :\n Disjoint s t \u2194 s = \u2205 :=\ndisjoint_of_le_iff_left_eq_bot h\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Data.Finset.Basic.erase_empty (L116-L121)\ntheorem erase_empty (a : \u03b1) : erase \u2205 a = \u2205 :=\nrfl\n\nprotected lemma Nontrivial.erase_nonempty (hs : s.Nontrivial) : (s.erase a).Nonempty :=\n (hs.exists_ne a).imp <| by simp_all\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Data.Finset.Basic.erase_insert (L134-L135)\ntheorem erase_insert {a : \u03b1} {s : Finset \u03b1} (h : a \u2209 s) : (insert a s).erase a = s := by grind\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Data.Finset.Basic.pairwiseDisjoint_iff (L99-L105)\nlemma pairwiseDisjoint_iff {\u03b9 : Type*} {s : Set \u03b9} {f : \u03b9 \u2192 Finset \u03b1} :\n s.PairwiseDisjoint f \u2194 \u2200 \u2983i\u2984, i \u2208 s \u2192 \u2200 \u2983j\u2984, j \u2208 s \u2192 (f i \u2229 f j).Nonempty \u2192 i = j := by\nsimp [Set.PairwiseDisjoint, Set.Pairwise, not_imp_comm (a := _ = _),\n not_disjoint_iff_nonempty_inter]\n\nend Lattice\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Data.Finset.Attach.mem_attach (L54-L56)\ntheorem mem_attach (s : Finset \u03b1) : \u2200 x, x \u2208 s.attach :=\nMultiset.mem_attach _\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Data.Finset.Basic.erase_insert_of_ne (L136-L138)\ntheorem erase_insert_of_ne {a b : \u03b1} {s : Finset \u03b1} (h : a \u2260 b) :\n (insert a s).erase b = insert a (s.erase b) := by grind\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Data.Finset.Basic.erase_ssubset (L151-L152)\ntheorem erase_ssubset {a : \u03b1} {s : Finset \u03b1} (h : a \u2208 s) : s.erase a \u2282 s := by grind\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Data.Finset.Basic.isDirected_le (L106-L106)\ninstance isDirected_le : IsDirectedOrder (Finset \u03b1) := by classical infer_instance\n```\n[/INST]", "sample_id": "C-Mathlib.Data.Finset.Insert.exists_mem_insert", "source": {"declaration": "Mathlib.Data.Finset.Insert.exists_mem_insert", "file": "Mathlib/Data/Finset/Insert.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Data.Finset.Insert", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Finset/Insert.lean#L557", "span": "L557-L559"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.RingTheory.Congruence.Hom.ker (L62-L63)\ndef ker (f : M \u2192+* N) : RingCon M := comap \u22a5 f", "-- Mathlib.RingTheory.Congruence.Hom.comap_bot (L64-L66)\ntheorem comap_bot (f : M \u2192+* N) : comap \u22a5 f = ker f := rfl\n/-- The definition of the ring congruence relation defined by a ring homomorphism's kernel. -/", "-- Mathlib.RingTheory.Congruence.Hom.ker_apply (L68-L71)\ntheorem ker_apply (f : M \u2192+* N) {x y} : ker f x y \u2194 f x = f y :=\nIff.rfl\n\n/-- The kernel of the quotient map induced by a ring congruence relation `c` equals `c`. -/", "-- Mathlib.RingTheory.Congruence.Hom.ker_mk'_eq (L72-L74)\ntheorem ker_mk'_eq (c : RingCon M) : ker c.mk' = c :=\next fun _ _ => Quotient.eq''", "-- Mathlib.RingTheory.Congruence.Hom.ker_comp (L75-L78)\ntheorem ker_comp {f : M \u2192+* N} {g : N \u2192+* P} :\n ker (g.comp f) = (ker g).comap f :=\next fun x y \u21a6 by simp [ker_apply, comap_rel]", "-- Mathlib.RingTheory.Congruence.Hom.comap_eq (L79-L90)\ntheorem comap_eq {g : N \u2192+* M} :\n c.comap g = ker (c.mk'.comp g) := by\nrw [ker_comp, ker_mk'_eq]\n\n/-- Makes an isomorphism of quotients by two ring congruence\nrelations, given that the relations are equal. -/\nprotected def congr (h : c = d) :\n c.Quotient \u2243+* d.Quotient :=\n { Quotient.congr (Equiv.refl M) <| by apply RingCon.ext_iff.mp h with\n map_add' x y := by rcases x with \u27e8\u27e9; rcases y with \u27e8\u27e9; rfl\n map_mul' x y := by rcases x with \u27e8\u27e9; rcases y with \u27e8\u27e9; rfl }", "-- Mathlib.RingTheory.Congruence.Hom.mapGen (L97-L102)\ndef mapGen {c : RingCon M} (f : M \u2192 N) : RingCon N :=\nringConGen <| Relation.Map c f f\n\n/-- If `c` is a ring congruence on `M`, then the smallest ring\ncongruence relation on `N` deduced from `c` by a ring homomorphism\nfrom `M` to `N` is the relation deduced from `c`. -/", "-- Mathlib.RingTheory.Congruence.Hom.mapGen_eq_map_of_surjective (L103-L122)\ntheorem mapGen_eq_map_of_surjective\n {c : RingCon M} (f : M \u2192+* N) (h : ker f \u2264 c) (hf : Surjective f) :\n c.mapGen f = Relation.Map c f f := by\nrefine le_antisymm ?_ <| (RingCon.gi N).gc.le_u_l _\n have := Relation.map_equivalence c.toSetoid.2 _ hf h\n intro _ _ hg\n induction hg with\n | of _ _ a => exact a\n | refl x => exact this.refl x\n | symm _ h => exact this.symm h\n | trans _ _ h\u2081 h\u2082 => exact this.trans h\u2081 h\u2082\n | add _ _ h\u2081 h\u2082 =>\n rcases h\u2081 with \u27e8a, b, h1, rfl, rfl\u27e9\n rcases h\u2082 with \u27e8p, q, h2, rfl, rfl\u27e9\n exact \u27e8a + p, b + q, c.add h1 h2, map_add f _ _, map_add f _ _\u27e9\n | mul _ _ h\u2081 h\u2082 =>\n rcases h\u2081 with \u27e8a, b, h1, rfl, rfl\u27e9\n rcases h\u2082 with \u27e8p, q, h2, rfl, rfl\u27e9\n exact \u27e8a * p, b * q, c.mul h1 h2, map_mul f _ _, map_mul f _ _\u27e9", "-- Mathlib.RingTheory.Congruence.Hom.mapGen_apply_apply_of_surjective (L123-L132)\ntheorem mapGen_apply_apply_of_surjective\n {c : RingCon M} (f : M \u2192+* N) (h : ker f \u2264 c) (hf : Surjective f) {x y : M} :\n c.mapGen f (f x) (f y) \u2194 c x y := by\nrw [mapGen_eq_map_of_surjective f h hf, Relation.map_apply]\n refine \u27e8fun \u27e8a, b, h\u2081, h\u2082, h\u2083\u27e9 \u21a6 ?_, by grind\u27e9\n exact c.trans (h h\u2082.symm) <| c.trans h\u2081 <| h h\u2083\n\n/-- Given a ring congruence relation `c` on a semiring `M`, the order-preserving\nbijection between the set of ring congruence relations containing `c` and the\nring congruence relations on the quotient of `M` by `c`. -/", "-- Mathlib.RingTheory.Congruence.Hom.correspondence (L133-L159)\ndef correspondence {c : RingCon M} : Set.Ici c \u2243o RingCon c.Quotient where\n toFun d := d.1.mapGen c.mk'\ninvFun d := \u27e8d.comap (mk' c), c.ker_mk'_eq.symm.trans_le <| comap_bot c.mk' \u25b8 comap_mono bot_le\u27e9\n left_inv d := by\n ext\n simp only [comap_rel]\n rw [mapGen_apply_apply_of_surjective c.mk' (c.ker_mk'_eq.trans_le d.2) c.mk'_surjective]\n right_inv d := by\n ext x y\n simp only\n obtain \u27e8x, rfl\u27e9 := c.mk'_surjective x\n obtain \u27e8y, rfl\u27e9 := c.mk'_surjective y\n rw [mapGen_apply_apply_of_surjective _ (comap_bot c.mk' \u25b8 comap_mono bot_le) c.mk'_surjective,\n comap_rel]\n map_rel_iff' {s t} := by\n simp only [Equiv.coe_fn_mk, le_def, c.mk'_surjective.forall, \u2190 Subtype.coe_le_coe]\n simp_rw [mapGen_apply_apply_of_surjective c.mk' (c.ker_mk'_eq.trans_le s.2) c.mk'_surjective,\n mapGen_apply_apply_of_surjective c.mk' (c.ker_mk'_eq.trans_le t.2) c.mk'_surjective]\n\nvariable (c : RingCon M)\n\nvariable (x y : M)\n\nvariable (f : M \u2192+* P)\n\n/-- The homomorphism on the quotient of a ring by a congruence relation `c`\ninduced by a homomorphism constant on the equivalence classes of `c`. -/", "-- Mathlib.RingTheory.Congruence.Hom.lift (L160-L167)\ndef lift (H : c \u2264 ker f) : c.Quotient \u2192+* P where\n __ := c.toAddCon.lift f.toAddMonoidHom H\nmap_one' := f.map_one\n map_mul' x y := Con.induction_on\u2082 x y fun m n => f.map_mul m n\n\nvariable {c f}\n\n/-- The diagram describing the universal property for quotients of ring commutes. -/", "-- Mathlib.RingTheory.Congruence.Hom.lift_mk' (L168-L171)\ntheorem lift_mk' (H : c \u2264 ker f) (x) : c.lift f H (c.mk' x) = f x :=\nrfl\n\n/-- The diagram describing the universal property for quotients of rings commutes. -/", "-- Mathlib.RingTheory.Congruence.Hom.lift_apply_mk' (L181-L186)\ntheorem lift_apply_mk' (f : c.Quotient \u2192+* P) :\n (c.lift (f.comp c.mk') fun x y h => show f \u2191x = f \u2191y by rw [c.eq.2 h]) = f := by\next x; rcases x with \u27e8\u27e9; rfl\n\n/-- Homomorphisms on the quotient of a ring by a ring congruence relation are\nequal if they are equal on elements that are coercions from the ring. -/", "-- Mathlib.RingTheory.Congruence.Hom.Quotient (L188-L191)\ntheorem Quotient.hom_ext {f g : c.Quotient \u2192+* P} (h : f.comp c.mk' = g.comp c.mk') : f = g :=\nDFunLike.ext _ _ <| c.mk'_surjective.forall.mpr fun x \u21a6 by exact congr($h x)\n\n/-- The uniqueness part of the universal property for quotients of rings. -/", "-- Mathlib.RingTheory.Congruence.Hom.lift_unique (L192-L197)\ntheorem lift_unique (H : c \u2264 ker f) (g : c.Quotient \u2192+* P) (Hg : g.comp c.mk' = f) :\n g = c.lift f H :=\nQuotient.hom_ext (by aesop)\n\n/-- Surjective ring homomorphisms constant on the equivalence classes\nof a ring congruence relation induce a surjective homomorphism on the quotient. -/", "-- Mathlib.RingTheory.Congruence.Basic.coe_inf (L196-L198)\ntheorem coe_inf {c d : RingCon R} : \u21d1(c \u2293 d) = \u21d1c \u2293 \u21d1d := rfl\n/-- Definition of the infimum of two congruence relations. -/", "-- Mathlib.RingTheory.Congruence.Defs.toCon_injective (L75-L76)\nlemma toCon_injective : Injective fun c : RingCon R \u21a6 c.toCon := fun c d \u21a6 by cases c; congr!", "-- Mathlib.RingTheory.Congruence.Basic.nontrivial_iff (L210-L214)\ntheorem nontrivial_iff : Nontrivial (RingCon R) \u2194 Nontrivial R := by\ncases subsingleton_or_nontrivial R\n on_goal 1 => simp_rw [\u2190 not_subsingleton_iff_nontrivial, not_iff_not]\n all_goals exact iff_of_true inferInstance \u2039_\u203a", "-- Mathlib.RingTheory.Congruence.Basic.sup_eq_ringConGen (L253-L259)\ntheorem sup_eq_ringConGen (c d : RingCon R) : c \u2294 d = ringConGen fun x y => c x y \u2228 d x y := by\nrw [ringConGen_eq]\n apply congr_arg sInf\n simp only [le_def, or_imp, \u2190 forall_and]\n\n/-- The supremum of two congruence relations equals the smallest congruence relation containing\nthe supremum of the underlying binary operations. -/", "-- Mathlib.RingTheory.Congruence.Defs.coe_mk (L87-L88)\ntheorem coe_mk (s : Con R) (h) : \u21d1(mk s h) = s := rfl", "-- Mathlib.RingTheory.Congruence.Basic.ringConGen_eq (L220-L231)\ntheorem ringConGen_eq (r : R \u2192 R \u2192 Prop) :\n ringConGen r = sInf {s : RingCon R | \u2200 x y, r x y \u2192 s x y} :=\nle_antisymm\n (fun _x _y H =>\n RingConGen.Rel.recOn H (fun _ _ h _ hs => hs _ _ h) (RingCon.refl _)\n (fun _ => RingCon.symm _) (fun _ _ => RingCon.trans _)\n (fun _ _ h1 h2 c hc => c.add (h1 c hc) <| h2 c hc)\n (fun _ _ h1 h2 c hc => c.mul (h1 c hc) <| h2 c hc))\n (sInf_le fun _ _ => RingConGen.Rel.of _ _)\n\n/-- The smallest congruence relation containing a binary relation `r` is contained in any\ncongruence relation containing `r`. -/", "-- Mathlib.RingTheory.Congruence.Basic.sup_def (L260-L264)\ntheorem sup_def {c d : RingCon R} : c \u2294 d = ringConGen (\u21d1c \u2294 \u21d1d) := by\nrw [sup_eq_ringConGen]; rfl\n\n/-- The supremum of a set of congruence relations `S` equals the smallest congruence relation\ncontaining the binary relation 'there exists `c \u2208 S` such that `x` is related to `y` by `c`'. -/", "-- Mathlib.RingTheory.Congruence.Basic.coe_iInf (L147-L149)\ntheorem coe_iInf {\u03b9 : Sort*} (f : \u03b9 \u2192 RingCon R) : \u21d1(iInf f) = \u2a05 i, \u21d1(f i) := by\nrw [iInf, coe_sInf, \u2190 Set.range_comp, sInf_range, Function.comp_def]", "-- Mathlib.RingTheory.Congruence.Basic.ringConGen_of_ringCon (L243-L247)\ntheorem ringConGen_of_ringCon (c : RingCon R) : ringConGen c = c :=\nle_antisymm (by rw [ringConGen_eq]; exact sInf_le fun _ _ => id) RingConGen.Rel.of\n\n/-- The map sending a binary relation to the smallest congruence relation in which it is\ncontained is idempotent. -/", "-- Mathlib.RingTheory.Congruence.Basic.sInf_toSetoid (L136-L141)\ntheorem sInf_toSetoid (S : Set (RingCon R)) : (sInf S).toSetoid = sInf ((\u00b7.toSetoid) '' S) :=\nSetoid.ext fun x y =>\n \u27e8fun h r \u27e8c, hS, hr\u27e9 => by rw [\u2190 hr]; exact h c hS, fun h c hS => h c.toSetoid \u27e8c, hS, rfl\u27e9\u27e9\n\n/-- The infimum of a set of congruence relations is the same as the infimum of the set's image\nunder the map to the underlying binary relation. -/", "-- Mathlib.RingTheory.Congruence.Basic.ringConGen_mono (L238-L242)\ntheorem ringConGen_mono {r s : R \u2192 R \u2192 Prop} (h : \u2200 x y, r x y \u2192 s x y) :\n ringConGen r \u2264 ringConGen s :=\nringConGen_le fun x y hr => RingConGen.Rel.of _ _ <| h x y hr\n\n/-- Congruence relations equal the smallest congruence relation in which they are contained. -/", "-- Mathlib.RingTheory.Congruence.Basic.isScalarTower_right (L71-L74)\ninstance isScalarTower_right [Add R] [MulOneClass R] [SMul \u03b1 R] [IsScalarTower \u03b1 R R]\n (c : RingCon R) : IsScalarTower \u03b1 c.Quotient c.Quotient where\n smul_assoc _ := Quotient.ind\u2082' fun _ _ => congr_arg Quotient.mk'' <| smul_mul_assoc _ _ _", "-- Mathlib.RingTheory.Congruence.Basic.sSup_eq_ringConGen (L265-L273)\ntheorem sSup_eq_ringConGen (S : Set (RingCon R)) :\n sSup S = ringConGen fun x y => \u2203 c : RingCon R, c \u2208 S \u2227 c x y := by\nrw [ringConGen_eq]\n apply congr_arg sInf\n ext\n exact \u27e8fun h _ _ \u27e8r, hr\u27e9 => h hr.1 hr.2, fun h r hS _ _ hr => h _ _ \u27e8r, hS, hr\u27e9\u27e9\n\n/-- The supremum of a set of congruence relations is the same as the smallest congruence relation\ncontaining the supremum of the set's image under the map to the underlying binary relation. -/", "-- Mathlib.RingTheory.Congruence.Basic.ringConGen_idem (L248-L252)\ntheorem ringConGen_idem (r : R \u2192 R \u2192 Prop) : ringConGen (ringConGen r) = ringConGen r :=\nringConGen_of_ringCon _\n\n/-- The supremum of congruence relations `c, d` equals the smallest congruence relation containing\nthe binary relation '`x` is related to `y` by `c` or `d`'. -/", "-- Mathlib.RingTheory.Congruence.Basic.le_def (L115-L116)\ntheorem le_def : c \u2264 d \u2194 \u2200 {x y}, c x y \u2192 d x y := .rfl", "-- Mathlib.RingTheory.Congruence.Basic.ringConGen_le (L232-L237)\ntheorem ringConGen_le {r : R \u2192 R \u2192 Prop} {c : RingCon R}\n (h : \u2200 x y, r x y \u2192 c x y) : ringConGen r \u2264 c := by\nrw [ringConGen_eq]; exact sInf_le h\n\n/-- Given binary relations `r, s` with `r` contained in `s`, the smallest congruence relation\ncontaining `s` contains the smallest congruence relation containing `r`. -/", "-- Mathlib.RingTheory.Congruence.Basic.comap_mono (L117-L124)\ntheorem comap_mono {R' : Type*} [Add R'] [Mul R']\n {F : Type*} [FunLike F R R'] [AddHomClass F R R'] [MulHomClass F R R']\n {J J' : RingCon R'} {f : F} (h : J \u2264 J') :\n J.comap f \u2264 J'.comap f :=\nfun _ _ h\u2081 \u21a6 h h\u2081\n\n/-- The infimum of a set of congruence relations on a given type with multiplication and\naddition. -/", "-- Mathlib.RingTheory.Congruence.Basic.coe_sInf (L143-L145)\ntheorem coe_sInf (S : Set (RingCon R)) : \u21d1(sInf S) = sInf ((\u21d1) '' S) := by\next; simp only [sInf_image, iInf_apply, iInf_Prop_eq]; rfl", "-- Mathlib.RingTheory.Congruence.Basic.smulCommClass (L75-L78)\ninstance smulCommClass [Add R] [MulOneClass R] [SMul \u03b1 R] [IsScalarTower \u03b1 R R]\n [SMulCommClass \u03b1 R R] (c : RingCon R) : SMulCommClass \u03b1 c.Quotient c.Quotient where\n smul_comm _ := Quotient.ind\u2082' fun _ _ => congr_arg Quotient.mk'' <| (mul_smul_comm _ _ _).symm", "-- Mathlib.RingTheory.Congruence.Defs.ringConGen (L63-L74)\ndef ringConGen [Add R] [Mul R] (r : R \u2192 R \u2192 Prop) : RingCon R where\n r := RingConGen.Rel r\niseqv := \u27e8RingConGen.Rel.refl, @RingConGen.Rel.symm _ _ _ _, @RingConGen.Rel.trans _ _ _ _\u27e9\n add' := RingConGen.Rel.add\n mul' := RingConGen.Rel.mul\n\nnamespace RingCon\n\nsection Basic\n\nvariable [Add R] [Mul R] {c d : RingCon R}", "-- Mathlib.RingTheory.Congruence.Basic.subsingleton_iff (L215-L219)\ntheorem subsingleton_iff : Subsingleton (RingCon R) \u2194 Subsingleton R := by\nsimp_rw [\u2190 not_nontrivial_iff_subsingleton, nontrivial_iff]\n\n/-- The inductively defined smallest congruence relation containing a binary relation `r` equals\nthe infimum of the set of congruence relations containing `r`. -/", "-- Mathlib.RingTheory.Congruence.Basic.sSup_def (L274-L294)\ntheorem sSup_def {S : Set (RingCon R)} :\n sSup S = ringConGen (sSup (@Set.image (RingCon R) (R \u2192 R \u2192 Prop) (\u21d1) S)) := by\nrw [sSup_eq_ringConGen, sSup_image]\n congr with (x y)\n simp only [iSup_apply, iSup_Prop_eq, exists_prop]\n\nvariable (R)\n\n/-- There is a Galois insertion of congruence relations on a type with multiplication and addition\n`R` into binary relations on `R`. -/\nprotected def gi : @GaloisInsertion (R \u2192 R \u2192 Prop) (RingCon R) _ _ ringConGen (\u21d1) where\n choice r _h := ringConGen r\n gc _r c :=\n \u27e8fun H _ _ h => H <| RingConGen.Rel.of _ _ h, fun H =>\n ringConGen_of_ringCon c \u25b8 ringConGen_mono H\u27e9\n le_l_u x := (ringConGen_of_ringCon x).symm \u25b8 le_refl x\n choice_eq _ _ := rfl\n\nend Lattice\n\nend RingCon", "-- Mathlib.RingTheory.Congruence.Basic.inf_iff_and (L199-L201)\ntheorem inf_iff_and {c d : RingCon R} {x y} : (c \u2293 d) x y \u2194 c x y \u2227 d x y :=\nIff.rfl", "-- Mathlib.RingTheory.Congruence.Basic.smulCommClass' (L79-L83)\ninstance smulCommClass' [Add R] [MulOneClass R] [SMul \u03b1 R] [IsScalarTower \u03b1 R R]\n [SMulCommClass R \u03b1 R] (c : RingCon R) : SMulCommClass c.Quotient \u03b1 c.Quotient :=\nhaveI := SMulCommClass.symm R \u03b1 R\n SMulCommClass.symm _ _ _", "-- Mathlib.RingTheory.Congruence.Basic.coe_smul (L57-L59)\ntheorem coe_smul (a : \u03b1) (x : R) : (\u2191(a \u2022 x) : c.Quotient) = a \u2022 (x : c.Quotient) :=\nrfl"], "statement": "theorem map_apply {c d : RingCon M} (h : c \u2264 d) (x) :\n c.map d h x = c.lift d.mk' (fun _ _ hc => d.eq.2 <| h hc) x", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 15724, "declarations_count": 2020, "diagnostics_count": 0, "duplicate_fingerprint": "1fad41eb5f2da42a", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 5999, "lean_code_chars": 14222, "lean_code_ratio": 0.9045, "length_bucket": "medium", "line_count": 453, "natural_language_chars": 1502, "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.RingTheory.Congruence.Hom).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem map_apply {c d : RingCon M} (h : c \u2264 d) (x) :\n c.map d h x = c.lift d.mk' (fun _ _ hc => d.eq.2 <| h hc) x\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.ker (L62-L63)\ndef ker (f : M \u2192+* N) : RingCon M := comap \u22a5 f\n```\n\n-- snippet 2\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.comap_bot (L64-L66)\ntheorem comap_bot (f : M \u2192+* N) : comap \u22a5 f = ker f := rfl\n/-- The definition of the ring congruence relation defined by a ring homomorphism's kernel. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.ker_apply (L68-L71)\ntheorem ker_apply (f : M \u2192+* N) {x y} : ker f x y \u2194 f x = f y :=\nIff.rfl\n\n/-- The kernel of the quotient map induced by a ring congruence relation `c` equals `c`. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.ker_mk'_eq (L72-L74)\ntheorem ker_mk'_eq (c : RingCon M) : ker c.mk' = c :=\next fun _ _ => Quotient.eq''\n```\n\n-- snippet 5\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.ker_comp (L75-L78)\ntheorem ker_comp {f : M \u2192+* N} {g : N \u2192+* P} :\n ker (g.comp f) = (ker g).comap f :=\next fun x y \u21a6 by simp [ker_apply, comap_rel]\n```\n\n-- snippet 6\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.comap_eq (L79-L90)\ntheorem comap_eq {g : N \u2192+* M} :\n c.comap g = ker (c.mk'.comp g) := by\nrw [ker_comp, ker_mk'_eq]\n\n/-- Makes an isomorphism of quotients by two ring congruence\nrelations, given that the relations are equal. -/\nprotected def congr (h : c = d) :\n c.Quotient \u2243+* d.Quotient :=\n { Quotient.congr (Equiv.refl M) <| by apply RingCon.ext_iff.mp h with\n map_add' x y := by rcases x with \u27e8\u27e9; rcases y with \u27e8\u27e9; rfl\n map_mul' x y := by rcases x with \u27e8\u27e9; rcases y with \u27e8\u27e9; rfl }\n```\n\n-- snippet 7\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.mapGen (L97-L102)\ndef mapGen {c : RingCon M} (f : M \u2192 N) : RingCon N :=\nringConGen <| Relation.Map c f f\n\n/-- If `c` is a ring congruence on `M`, then the smallest ring\ncongruence relation on `N` deduced from `c` by a ring homomorphism\nfrom `M` to `N` is the relation deduced from `c`. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.mapGen_eq_map_of_surjective (L103-L122)\ntheorem mapGen_eq_map_of_surjective\n {c : RingCon M} (f : M \u2192+* N) (h : ker f \u2264 c) (hf : Surjective f) :\n c.mapGen f = Relation.Map c f f := by\nrefine le_antisymm ?_ <| (RingCon.gi N).gc.le_u_l _\n have := Relation.map_equivalence c.toSetoid.2 _ hf h\n intro _ _ hg\n induction hg with\n | of _ _ a => exact a\n | refl x => exact this.refl x\n | symm _ h => exact this.symm h\n | trans _ _ h\u2081 h\u2082 => exact this.trans h\u2081 h\u2082\n | add _ _ h\u2081 h\u2082 =>\n rcases h\u2081 with \u27e8a, b, h1, rfl, rfl\u27e9\n rcases h\u2082 with \u27e8p, q, h2, rfl, rfl\u27e9\n exact \u27e8a + p, b + q, c.add h1 h2, map_add f _ _, map_add f _ _\u27e9\n | mul _ _ h\u2081 h\u2082 =>\n rcases h\u2081 with \u27e8a, b, h1, rfl, rfl\u27e9\n rcases h\u2082 with \u27e8p, q, h2, rfl, rfl\u27e9\n exact \u27e8a * p, b * q, c.mul h1 h2, map_mul f _ _, map_mul f _ _\u27e9\n```\n\n-- snippet 9\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.mapGen_apply_apply_of_surjective (L123-L132)\ntheorem mapGen_apply_apply_of_surjective\n {c : RingCon M} (f : M \u2192+* N) (h : ker f \u2264 c) (hf : Surjective f) {x y : M} :\n c.mapGen f (f x) (f y) \u2194 c x y := by\nrw [mapGen_eq_map_of_surjective f h hf, Relation.map_apply]\n refine \u27e8fun \u27e8a, b, h\u2081, h\u2082, h\u2083\u27e9 \u21a6 ?_, by grind\u27e9\n exact c.trans (h h\u2082.symm) <| c.trans h\u2081 <| h h\u2083\n\n/-- Given a ring congruence relation `c` on a semiring `M`, the order-preserving\nbijection between the set of ring congruence relations containing `c` and the\nring congruence relations on the quotient of `M` by `c`. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.correspondence (L133-L159)\ndef correspondence {c : RingCon M} : Set.Ici c \u2243o RingCon c.Quotient where\n toFun d := d.1.mapGen c.mk'\ninvFun d := \u27e8d.comap (mk' c), c.ker_mk'_eq.symm.trans_le <| comap_bot c.mk' \u25b8 comap_mono bot_le\u27e9\n left_inv d := by\n ext\n simp only [comap_rel]\n rw [mapGen_apply_apply_of_surjective c.mk' (c.ker_mk'_eq.trans_le d.2) c.mk'_surjective]\n right_inv d := by\n ext x y\n simp only\n obtain \u27e8x, rfl\u27e9 := c.mk'_surjective x\n obtain \u27e8y, rfl\u27e9 := c.mk'_surjective y\n rw [mapGen_apply_apply_of_surjective _ (comap_bot c.mk' \u25b8 comap_mono bot_le) c.mk'_surjective,\n comap_rel]\n map_rel_iff' {s t} := by\n simp only [Equiv.coe_fn_mk, le_def, c.mk'_surjective.forall, \u2190 Subtype.coe_le_coe]\n simp_rw [mapGen_apply_apply_of_surjective c.mk' (c.ker_mk'_eq.trans_le s.2) c.mk'_surjective,\n mapGen_apply_apply_of_surjective c.mk' (c.ker_mk'_eq.trans_le t.2) c.mk'_surjective]\n\nvariable (c : RingCon M)\n\nvariable (x y : M)\n\nvariable (f : M \u2192+* P)\n\n/-- The homomorphism on the quotient of a ring by a congruence relation `c`\ninduced by a homomorphism constant on the equivalence classes of `c`. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.lift (L160-L167)\ndef lift (H : c \u2264 ker f) : c.Quotient \u2192+* P where\n __ := c.toAddCon.lift f.toAddMonoidHom H\nmap_one' := f.map_one\n map_mul' x y := Con.induction_on\u2082 x y fun m n => f.map_mul m n\n\nvariable {c f}\n\n/-- The diagram describing the universal property for quotients of ring commutes. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.lift_mk' (L168-L171)\ntheorem lift_mk' (H : c \u2264 ker f) (x) : c.lift f H (c.mk' x) = f x :=\nrfl\n\n/-- The diagram describing the universal property for quotients of rings commutes. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.lift_apply_mk' (L181-L186)\ntheorem lift_apply_mk' (f : c.Quotient \u2192+* P) :\n (c.lift (f.comp c.mk') fun x y h => show f \u2191x = f \u2191y by rw [c.eq.2 h]) = f := by\next x; rcases x with \u27e8\u27e9; rfl\n\n/-- Homomorphisms on the quotient of a ring by a ring congruence relation are\nequal if they are equal on elements that are coercions from the ring. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.Quotient (L188-L191)\ntheorem Quotient.hom_ext {f g : c.Quotient \u2192+* P} (h : f.comp c.mk' = g.comp c.mk') : f = g :=\nDFunLike.ext _ _ <| c.mk'_surjective.forall.mpr fun x \u21a6 by exact congr($h x)\n\n/-- The uniqueness part of the universal property for quotients of rings. -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.lift_unique (L192-L197)\ntheorem lift_unique (H : c \u2264 ker f) (g : c.Quotient \u2192+* P) (Hg : g.comp c.mk' = f) :\n g = c.lift f H :=\nQuotient.hom_ext (by aesop)\n\n/-- Surjective ring homomorphisms constant on the equivalence classes\nof a ring congruence relation induce a surjective homomorphism on the quotient. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.coe_inf (L196-L198)\ntheorem coe_inf {c d : RingCon R} : \u21d1(c \u2293 d) = \u21d1c \u2293 \u21d1d := rfl\n/-- Definition of the infimum of two congruence relations. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.RingTheory.Congruence.Defs.toCon_injective (L75-L76)\nlemma toCon_injective : Injective fun c : RingCon R \u21a6 c.toCon := fun c d \u21a6 by cases c; congr!\n```\n\n-- snippet 18\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.nontrivial_iff (L210-L214)\ntheorem nontrivial_iff : Nontrivial (RingCon R) \u2194 Nontrivial R := by\ncases subsingleton_or_nontrivial R\n on_goal 1 => simp_rw [\u2190 not_subsingleton_iff_nontrivial, not_iff_not]\n all_goals exact iff_of_true inferInstance \u2039_\u203a\n```\n\n-- snippet 19\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.sup_eq_ringConGen (L253-L259)\ntheorem sup_eq_ringConGen (c d : RingCon R) : c \u2294 d = ringConGen fun x y => c x y \u2228 d x y := by\nrw [ringConGen_eq]\n apply congr_arg sInf\n simp only [le_def, or_imp, \u2190 forall_and]\n\n/-- The supremum of two congruence relations equals the smallest congruence relation containing\nthe supremum of the underlying binary operations. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.RingTheory.Congruence.Defs.coe_mk (L87-L88)\ntheorem coe_mk (s : Con R) (h) : \u21d1(mk s h) = s := rfl\n```\n\n-- snippet 21\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.ringConGen_eq (L220-L231)\ntheorem ringConGen_eq (r : R \u2192 R \u2192 Prop) :\n ringConGen r = sInf {s : RingCon R | \u2200 x y, r x y \u2192 s x y} :=\nle_antisymm\n (fun _x _y H =>\n RingConGen.Rel.recOn H (fun _ _ h _ hs => hs _ _ h) (RingCon.refl _)\n (fun _ => RingCon.symm _) (fun _ _ => RingCon.trans _)\n (fun _ _ h1 h2 c hc => c.add (h1 c hc) <| h2 c hc)\n (fun _ _ h1 h2 c hc => c.mul (h1 c hc) <| h2 c hc))\n (sInf_le fun _ _ => RingConGen.Rel.of _ _)\n\n/-- The smallest congruence relation containing a binary relation `r` is contained in any\ncongruence relation containing `r`. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.sup_def (L260-L264)\ntheorem sup_def {c d : RingCon R} : c \u2294 d = ringConGen (\u21d1c \u2294 \u21d1d) := by\nrw [sup_eq_ringConGen]; rfl\n\n/-- The supremum of a set of congruence relations `S` equals the smallest congruence relation\ncontaining the binary relation 'there exists `c \u2208 S` such that `x` is related to `y` by `c`'. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.coe_iInf (L147-L149)\ntheorem coe_iInf {\u03b9 : Sort*} (f : \u03b9 \u2192 RingCon R) : \u21d1(iInf f) = \u2a05 i, \u21d1(f i) := by\nrw [iInf, coe_sInf, \u2190 Set.range_comp, sInf_range, Function.comp_def]\n```\n\n-- snippet 24\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.ringConGen_of_ringCon (L243-L247)\ntheorem ringConGen_of_ringCon (c : RingCon R) : ringConGen c = c :=\nle_antisymm (by rw [ringConGen_eq]; exact sInf_le fun _ _ => id) RingConGen.Rel.of\n\n/-- The map sending a binary relation to the smallest congruence relation in which it is\ncontained is idempotent. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.sInf_toSetoid (L136-L141)\ntheorem sInf_toSetoid (S : Set (RingCon R)) : (sInf S).toSetoid = sInf ((\u00b7.toSetoid) '' S) :=\nSetoid.ext fun x y =>\n \u27e8fun h r \u27e8c, hS, hr\u27e9 => by rw [\u2190 hr]; exact h c hS, fun h c hS => h c.toSetoid \u27e8c, hS, rfl\u27e9\u27e9\n\n/-- The infimum of a set of congruence relations is the same as the infimum of the set's image\nunder the map to the underlying binary relation. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.ringConGen_mono (L238-L242)\ntheorem ringConGen_mono {r s : R \u2192 R \u2192 Prop} (h : \u2200 x y, r x y \u2192 s x y) :\n ringConGen r \u2264 ringConGen s :=\nringConGen_le fun x y hr => RingConGen.Rel.of _ _ <| h x y hr\n\n/-- Congruence relations equal the smallest congruence relation in which they are contained. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.isScalarTower_right (L71-L74)\ninstance isScalarTower_right [Add R] [MulOneClass R] [SMul \u03b1 R] [IsScalarTower \u03b1 R R]\n (c : RingCon R) : IsScalarTower \u03b1 c.Quotient c.Quotient where\n smul_assoc _ := Quotient.ind\u2082' fun _ _ => congr_arg Quotient.mk'' <| smul_mul_assoc _ _ _\n```\n\n-- snippet 28\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.sSup_eq_ringConGen (L265-L273)\ntheorem sSup_eq_ringConGen (S : Set (RingCon R)) :\n sSup S = ringConGen fun x y => \u2203 c : RingCon R, c \u2208 S \u2227 c x y := by\nrw [ringConGen_eq]\n apply congr_arg sInf\n ext\n exact \u27e8fun h _ _ \u27e8r, hr\u27e9 => h hr.1 hr.2, fun h r hS _ _ hr => h _ _ \u27e8r, hS, hr\u27e9\u27e9\n\n/-- The supremum of a set of congruence relations is the same as the smallest congruence relation\ncontaining the supremum of the set's image under the map to the underlying binary relation. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.ringConGen_idem (L248-L252)\ntheorem ringConGen_idem (r : R \u2192 R \u2192 Prop) : ringConGen (ringConGen r) = ringConGen r :=\nringConGen_of_ringCon _\n\n/-- The supremum of congruence relations `c, d` equals the smallest congruence relation containing\nthe binary relation '`x` is related to `y` by `c` or `d`'. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.le_def (L115-L116)\ntheorem le_def : c \u2264 d \u2194 \u2200 {x y}, c x y \u2192 d x y := .rfl\n```\n\n-- snippet 31\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.ringConGen_le (L232-L237)\ntheorem ringConGen_le {r : R \u2192 R \u2192 Prop} {c : RingCon R}\n (h : \u2200 x y, r x y \u2192 c x y) : ringConGen r \u2264 c := by\nrw [ringConGen_eq]; exact sInf_le h\n\n/-- Given binary relations `r, s` with `r` contained in `s`, the smallest congruence relation\ncontaining `s` contains the smallest congruence relation containing `r`. -/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.comap_mono (L117-L124)\ntheorem comap_mono {R' : Type*} [Add R'] [Mul R']\n {F : Type*} [FunLike F R R'] [AddHomClass F R R'] [MulHomClass F R R']\n {J J' : RingCon R'} {f : F} (h : J \u2264 J') :\n J.comap f \u2264 J'.comap f :=\nfun _ _ h\u2081 \u21a6 h h\u2081\n\n/-- The infimum of a set of congruence relations on a given type with multiplication and\naddition. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.coe_sInf (L143-L145)\ntheorem coe_sInf (S : Set (RingCon R)) : \u21d1(sInf S) = sInf ((\u21d1) '' S) := by\next; simp only [sInf_image, iInf_apply, iInf_Prop_eq]; rfl\n```\n\n-- snippet 34\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.smulCommClass (L75-L78)\ninstance smulCommClass [Add R] [MulOneClass R] [SMul \u03b1 R] [IsScalarTower \u03b1 R R]\n [SMulCommClass \u03b1 R R] (c : RingCon R) : SMulCommClass \u03b1 c.Quotient c.Quotient where\n smul_comm _ := Quotient.ind\u2082' fun _ _ => congr_arg Quotient.mk'' <| (mul_smul_comm _ _ _).symm\n```\n\n-- snippet 35\n```lean\n-- Mathlib.RingTheory.Congruence.Defs.ringConGen (L63-L74)\ndef ringConGen [Add R] [Mul R] (r : R \u2192 R \u2192 Prop) : RingCon R where\n r := RingConGen.Rel r\niseqv := \u27e8RingConGen.Rel.refl, @RingConGen.Rel.symm _ _ _ _, @RingConGen.Rel.trans _ _ _ _\u27e9\n add' := RingConGen.Rel.add\n mul' := RingConGen.Rel.mul\n\nnamespace RingCon\n\nsection Basic\n\nvariable [Add R] [Mul R] {c d : RingCon R}\n```\n\n-- snippet 36\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.subsingleton_iff (L215-L219)\ntheorem subsingleton_iff : Subsingleton (RingCon R) \u2194 Subsingleton R := by\nsimp_rw [\u2190 not_nontrivial_iff_subsingleton, nontrivial_iff]\n\n/-- The inductively defined smallest congruence relation containing a binary relation `r` equals\nthe infimum of the set of congruence relations containing `r`. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.sSup_def (L274-L294)\ntheorem sSup_def {S : Set (RingCon R)} :\n sSup S = ringConGen (sSup (@Set.image (RingCon R) (R \u2192 R \u2192 Prop) (\u21d1) S)) := by\nrw [sSup_eq_ringConGen, sSup_image]\n congr with (x y)\n simp only [iSup_apply, iSup_Prop_eq, exists_prop]\n\nvariable (R)\n\n/-- There is a Galois insertion of congruence relations on a type with multiplication and addition\n`R` into binary relations on `R`. -/\nprotected def gi : @GaloisInsertion (R \u2192 R \u2192 Prop) (RingCon R) _ _ ringConGen (\u21d1) where\n choice r _h := ringConGen r\n gc _r c :=\n \u27e8fun H _ _ h => H <| RingConGen.Rel.of _ _ h, fun H =>\n ringConGen_of_ringCon c \u25b8 ringConGen_mono H\u27e9\n le_l_u x := (ringConGen_of_ringCon x).symm \u25b8 le_refl x\n choice_eq _ _ := rfl\n\nend Lattice\n\nend RingCon\n```\n\n-- snippet 38\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.inf_iff_and (L199-L201)\ntheorem inf_iff_and {c d : RingCon R} {x y} : (c \u2293 d) x y \u2194 c x y \u2227 d x y :=\nIff.rfl\n```\n\n-- snippet 39\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.smulCommClass' (L79-L83)\ninstance smulCommClass' [Add R] [MulOneClass R] [SMul \u03b1 R] [IsScalarTower \u03b1 R R]\n [SMulCommClass R \u03b1 R] (c : RingCon R) : SMulCommClass c.Quotient \u03b1 c.Quotient :=\nhaveI := SMulCommClass.symm R \u03b1 R\n SMulCommClass.symm _ _ _\n```\n\n-- snippet 40\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.coe_smul (L57-L59)\ntheorem coe_smul (a : \u03b1) (x : R) : (\u2191(a \u2022 x) : c.Quotient) = a \u2022 (x : c.Quotient) :=\nrfl\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.RingTheory.Congruence.Hom).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem map_apply {c d : RingCon M} (h : c \u2264 d) (x) :\n c.map d h x = c.lift d.mk' (fun _ _ hc => d.eq.2 <| h hc) x\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.ker (L62-L63)\ndef ker (f : M \u2192+* N) : RingCon M := comap \u22a5 f\n```\n\n-- snippet 2\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.comap_bot (L64-L66)\ntheorem comap_bot (f : M \u2192+* N) : comap \u22a5 f = ker f := rfl\n/-- The definition of the ring congruence relation defined by a ring homomorphism's kernel. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.ker_apply (L68-L71)\ntheorem ker_apply (f : M \u2192+* N) {x y} : ker f x y \u2194 f x = f y :=\nIff.rfl\n\n/-- The kernel of the quotient map induced by a ring congruence relation `c` equals `c`. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.ker_mk'_eq (L72-L74)\ntheorem ker_mk'_eq (c : RingCon M) : ker c.mk' = c :=\next fun _ _ => Quotient.eq''\n```\n\n-- snippet 5\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.ker_comp (L75-L78)\ntheorem ker_comp {f : M \u2192+* N} {g : N \u2192+* P} :\n ker (g.comp f) = (ker g).comap f :=\next fun x y \u21a6 by simp [ker_apply, comap_rel]\n```\n\n-- snippet 6\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.comap_eq (L79-L90)\ntheorem comap_eq {g : N \u2192+* M} :\n c.comap g = ker (c.mk'.comp g) := by\nrw [ker_comp, ker_mk'_eq]\n\n/-- Makes an isomorphism of quotients by two ring congruence\nrelations, given that the relations are equal. -/\nprotected def congr (h : c = d) :\n c.Quotient \u2243+* d.Quotient :=\n { Quotient.congr (Equiv.refl M) <| by apply RingCon.ext_iff.mp h with\n map_add' x y := by rcases x with \u27e8\u27e9; rcases y with \u27e8\u27e9; rfl\n map_mul' x y := by rcases x with \u27e8\u27e9; rcases y with \u27e8\u27e9; rfl }\n```\n\n-- snippet 7\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.mapGen (L97-L102)\ndef mapGen {c : RingCon M} (f : M \u2192 N) : RingCon N :=\nringConGen <| Relation.Map c f f\n\n/-- If `c` is a ring congruence on `M`, then the smallest ring\ncongruence relation on `N` deduced from `c` by a ring homomorphism\nfrom `M` to `N` is the relation deduced from `c`. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.mapGen_eq_map_of_surjective (L103-L122)\ntheorem mapGen_eq_map_of_surjective\n {c : RingCon M} (f : M \u2192+* N) (h : ker f \u2264 c) (hf : Surjective f) :\n c.mapGen f = Relation.Map c f f := by\nrefine le_antisymm ?_ <| (RingCon.gi N).gc.le_u_l _\n have := Relation.map_equivalence c.toSetoid.2 _ hf h\n intro _ _ hg\n induction hg with\n | of _ _ a => exact a\n | refl x => exact this.refl x\n | symm _ h => exact this.symm h\n | trans _ _ h\u2081 h\u2082 => exact this.trans h\u2081 h\u2082\n | add _ _ h\u2081 h\u2082 =>\n rcases h\u2081 with \u27e8a, b, h1, rfl, rfl\u27e9\n rcases h\u2082 with \u27e8p, q, h2, rfl, rfl\u27e9\n exact \u27e8a + p, b + q, c.add h1 h2, map_add f _ _, map_add f _ _\u27e9\n | mul _ _ h\u2081 h\u2082 =>\n rcases h\u2081 with \u27e8a, b, h1, rfl, rfl\u27e9\n rcases h\u2082 with \u27e8p, q, h2, rfl, rfl\u27e9\n exact \u27e8a * p, b * q, c.mul h1 h2, map_mul f _ _, map_mul f _ _\u27e9\n```\n\n-- snippet 9\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.mapGen_apply_apply_of_surjective (L123-L132)\ntheorem mapGen_apply_apply_of_surjective\n {c : RingCon M} (f : M \u2192+* N) (h : ker f \u2264 c) (hf : Surjective f) {x y : M} :\n c.mapGen f (f x) (f y) \u2194 c x y := by\nrw [mapGen_eq_map_of_surjective f h hf, Relation.map_apply]\n refine \u27e8fun \u27e8a, b, h\u2081, h\u2082, h\u2083\u27e9 \u21a6 ?_, by grind\u27e9\n exact c.trans (h h\u2082.symm) <| c.trans h\u2081 <| h h\u2083\n\n/-- Given a ring congruence relation `c` on a semiring `M`, the order-preserving\nbijection between the set of ring congruence relations containing `c` and the\nring congruence relations on the quotient of `M` by `c`. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.correspondence (L133-L159)\ndef correspondence {c : RingCon M} : Set.Ici c \u2243o RingCon c.Quotient where\n toFun d := d.1.mapGen c.mk'\ninvFun d := \u27e8d.comap (mk' c), c.ker_mk'_eq.symm.trans_le <| comap_bot c.mk' \u25b8 comap_mono bot_le\u27e9\n left_inv d := by\n ext\n simp only [comap_rel]\n rw [mapGen_apply_apply_of_surjective c.mk' (c.ker_mk'_eq.trans_le d.2) c.mk'_surjective]\n right_inv d := by\n ext x y\n simp only\n obtain \u27e8x, rfl\u27e9 := c.mk'_surjective x\n obtain \u27e8y, rfl\u27e9 := c.mk'_surjective y\n rw [mapGen_apply_apply_of_surjective _ (comap_bot c.mk' \u25b8 comap_mono bot_le) c.mk'_surjective,\n comap_rel]\n map_rel_iff' {s t} := by\n simp only [Equiv.coe_fn_mk, le_def, c.mk'_surjective.forall, \u2190 Subtype.coe_le_coe]\n simp_rw [mapGen_apply_apply_of_surjective c.mk' (c.ker_mk'_eq.trans_le s.2) c.mk'_surjective,\n mapGen_apply_apply_of_surjective c.mk' (c.ker_mk'_eq.trans_le t.2) c.mk'_surjective]\n\nvariable (c : RingCon M)\n\nvariable (x y : M)\n\nvariable (f : M \u2192+* P)\n\n/-- The homomorphism on the quotient of a ring by a congruence relation `c`\ninduced by a homomorphism constant on the equivalence classes of `c`. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.lift (L160-L167)\ndef lift (H : c \u2264 ker f) : c.Quotient \u2192+* P where\n __ := c.toAddCon.lift f.toAddMonoidHom H\nmap_one' := f.map_one\n map_mul' x y := Con.induction_on\u2082 x y fun m n => f.map_mul m n\n\nvariable {c f}\n\n/-- The diagram describing the universal property for quotients of ring commutes. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.lift_mk' (L168-L171)\ntheorem lift_mk' (H : c \u2264 ker f) (x) : c.lift f H (c.mk' x) = f x :=\nrfl\n\n/-- The diagram describing the universal property for quotients of rings commutes. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.lift_apply_mk' (L181-L186)\ntheorem lift_apply_mk' (f : c.Quotient \u2192+* P) :\n (c.lift (f.comp c.mk') fun x y h => show f \u2191x = f \u2191y by rw [c.eq.2 h]) = f := by\next x; rcases x with \u27e8\u27e9; rfl\n\n/-- Homomorphisms on the quotient of a ring by a ring congruence relation are\nequal if they are equal on elements that are coercions from the ring. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.Quotient (L188-L191)\ntheorem Quotient.hom_ext {f g : c.Quotient \u2192+* P} (h : f.comp c.mk' = g.comp c.mk') : f = g :=\nDFunLike.ext _ _ <| c.mk'_surjective.forall.mpr fun x \u21a6 by exact congr($h x)\n\n/-- The uniqueness part of the universal property for quotients of rings. -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.RingTheory.Congruence.Hom.lift_unique (L192-L197)\ntheorem lift_unique (H : c \u2264 ker f) (g : c.Quotient \u2192+* P) (Hg : g.comp c.mk' = f) :\n g = c.lift f H :=\nQuotient.hom_ext (by aesop)\n\n/-- Surjective ring homomorphisms constant on the equivalence classes\nof a ring congruence relation induce a surjective homomorphism on the quotient. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.coe_inf (L196-L198)\ntheorem coe_inf {c d : RingCon R} : \u21d1(c \u2293 d) = \u21d1c \u2293 \u21d1d := rfl\n/-- Definition of the infimum of two congruence relations. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.RingTheory.Congruence.Defs.toCon_injective (L75-L76)\nlemma toCon_injective : Injective fun c : RingCon R \u21a6 c.toCon := fun c d \u21a6 by cases c; congr!\n```\n\n-- snippet 18\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.nontrivial_iff (L210-L214)\ntheorem nontrivial_iff : Nontrivial (RingCon R) \u2194 Nontrivial R := by\ncases subsingleton_or_nontrivial R\n on_goal 1 => simp_rw [\u2190 not_subsingleton_iff_nontrivial, not_iff_not]\n all_goals exact iff_of_true inferInstance \u2039_\u203a\n```\n\n-- snippet 19\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.sup_eq_ringConGen (L253-L259)\ntheorem sup_eq_ringConGen (c d : RingCon R) : c \u2294 d = ringConGen fun x y => c x y \u2228 d x y := by\nrw [ringConGen_eq]\n apply congr_arg sInf\n simp only [le_def, or_imp, \u2190 forall_and]\n\n/-- The supremum of two congruence relations equals the smallest congruence relation containing\nthe supremum of the underlying binary operations. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.RingTheory.Congruence.Defs.coe_mk (L87-L88)\ntheorem coe_mk (s : Con R) (h) : \u21d1(mk s h) = s := rfl\n```\n\n-- snippet 21\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.ringConGen_eq (L220-L231)\ntheorem ringConGen_eq (r : R \u2192 R \u2192 Prop) :\n ringConGen r = sInf {s : RingCon R | \u2200 x y, r x y \u2192 s x y} :=\nle_antisymm\n (fun _x _y H =>\n RingConGen.Rel.recOn H (fun _ _ h _ hs => hs _ _ h) (RingCon.refl _)\n (fun _ => RingCon.symm _) (fun _ _ => RingCon.trans _)\n (fun _ _ h1 h2 c hc => c.add (h1 c hc) <| h2 c hc)\n (fun _ _ h1 h2 c hc => c.mul (h1 c hc) <| h2 c hc))\n (sInf_le fun _ _ => RingConGen.Rel.of _ _)\n\n/-- The smallest congruence relation containing a binary relation `r` is contained in any\ncongruence relation containing `r`. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.sup_def (L260-L264)\ntheorem sup_def {c d : RingCon R} : c \u2294 d = ringConGen (\u21d1c \u2294 \u21d1d) := by\nrw [sup_eq_ringConGen]; rfl\n\n/-- The supremum of a set of congruence relations `S` equals the smallest congruence relation\ncontaining the binary relation 'there exists `c \u2208 S` such that `x` is related to `y` by `c`'. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.coe_iInf (L147-L149)\ntheorem coe_iInf {\u03b9 : Sort*} (f : \u03b9 \u2192 RingCon R) : \u21d1(iInf f) = \u2a05 i, \u21d1(f i) := by\nrw [iInf, coe_sInf, \u2190 Set.range_comp, sInf_range, Function.comp_def]\n```\n\n-- snippet 24\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.ringConGen_of_ringCon (L243-L247)\ntheorem ringConGen_of_ringCon (c : RingCon R) : ringConGen c = c :=\nle_antisymm (by rw [ringConGen_eq]; exact sInf_le fun _ _ => id) RingConGen.Rel.of\n\n/-- The map sending a binary relation to the smallest congruence relation in which it is\ncontained is idempotent. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.sInf_toSetoid (L136-L141)\ntheorem sInf_toSetoid (S : Set (RingCon R)) : (sInf S).toSetoid = sInf ((\u00b7.toSetoid) '' S) :=\nSetoid.ext fun x y =>\n \u27e8fun h r \u27e8c, hS, hr\u27e9 => by rw [\u2190 hr]; exact h c hS, fun h c hS => h c.toSetoid \u27e8c, hS, rfl\u27e9\u27e9\n\n/-- The infimum of a set of congruence relations is the same as the infimum of the set's image\nunder the map to the underlying binary relation. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.ringConGen_mono (L238-L242)\ntheorem ringConGen_mono {r s : R \u2192 R \u2192 Prop} (h : \u2200 x y, r x y \u2192 s x y) :\n ringConGen r \u2264 ringConGen s :=\nringConGen_le fun x y hr => RingConGen.Rel.of _ _ <| h x y hr\n\n/-- Congruence relations equal the smallest congruence relation in which they are contained. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.isScalarTower_right (L71-L74)\ninstance isScalarTower_right [Add R] [MulOneClass R] [SMul \u03b1 R] [IsScalarTower \u03b1 R R]\n (c : RingCon R) : IsScalarTower \u03b1 c.Quotient c.Quotient where\n smul_assoc _ := Quotient.ind\u2082' fun _ _ => congr_arg Quotient.mk'' <| smul_mul_assoc _ _ _\n```\n\n-- snippet 28\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.sSup_eq_ringConGen (L265-L273)\ntheorem sSup_eq_ringConGen (S : Set (RingCon R)) :\n sSup S = ringConGen fun x y => \u2203 c : RingCon R, c \u2208 S \u2227 c x y := by\nrw [ringConGen_eq]\n apply congr_arg sInf\n ext\n exact \u27e8fun h _ _ \u27e8r, hr\u27e9 => h hr.1 hr.2, fun h r hS _ _ hr => h _ _ \u27e8r, hS, hr\u27e9\u27e9\n\n/-- The supremum of a set of congruence relations is the same as the smallest congruence relation\ncontaining the supremum of the set's image under the map to the underlying binary relation. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.ringConGen_idem (L248-L252)\ntheorem ringConGen_idem (r : R \u2192 R \u2192 Prop) : ringConGen (ringConGen r) = ringConGen r :=\nringConGen_of_ringCon _\n\n/-- The supremum of congruence relations `c, d` equals the smallest congruence relation containing\nthe binary relation '`x` is related to `y` by `c` or `d`'. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.le_def (L115-L116)\ntheorem le_def : c \u2264 d \u2194 \u2200 {x y}, c x y \u2192 d x y := .rfl\n```\n\n-- snippet 31\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.ringConGen_le (L232-L237)\ntheorem ringConGen_le {r : R \u2192 R \u2192 Prop} {c : RingCon R}\n (h : \u2200 x y, r x y \u2192 c x y) : ringConGen r \u2264 c := by\nrw [ringConGen_eq]; exact sInf_le h\n\n/-- Given binary relations `r, s` with `r` contained in `s`, the smallest congruence relation\ncontaining `s` contains the smallest congruence relation containing `r`. -/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.comap_mono (L117-L124)\ntheorem comap_mono {R' : Type*} [Add R'] [Mul R']\n {F : Type*} [FunLike F R R'] [AddHomClass F R R'] [MulHomClass F R R']\n {J J' : RingCon R'} {f : F} (h : J \u2264 J') :\n J.comap f \u2264 J'.comap f :=\nfun _ _ h\u2081 \u21a6 h h\u2081\n\n/-- The infimum of a set of congruence relations on a given type with multiplication and\naddition. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.coe_sInf (L143-L145)\ntheorem coe_sInf (S : Set (RingCon R)) : \u21d1(sInf S) = sInf ((\u21d1) '' S) := by\next; simp only [sInf_image, iInf_apply, iInf_Prop_eq]; rfl\n```\n\n-- snippet 34\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.smulCommClass (L75-L78)\ninstance smulCommClass [Add R] [MulOneClass R] [SMul \u03b1 R] [IsScalarTower \u03b1 R R]\n [SMulCommClass \u03b1 R R] (c : RingCon R) : SMulCommClass \u03b1 c.Quotient c.Quotient where\n smul_comm _ := Quotient.ind\u2082' fun _ _ => congr_arg Quotient.mk'' <| (mul_smul_comm _ _ _).symm\n```\n\n-- snippet 35\n```lean\n-- Mathlib.RingTheory.Congruence.Defs.ringConGen (L63-L74)\ndef ringConGen [Add R] [Mul R] (r : R \u2192 R \u2192 Prop) : RingCon R where\n r := RingConGen.Rel r\niseqv := \u27e8RingConGen.Rel.refl, @RingConGen.Rel.symm _ _ _ _, @RingConGen.Rel.trans _ _ _ _\u27e9\n add' := RingConGen.Rel.add\n mul' := RingConGen.Rel.mul\n\nnamespace RingCon\n\nsection Basic\n\nvariable [Add R] [Mul R] {c d : RingCon R}\n```\n\n-- snippet 36\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.subsingleton_iff (L215-L219)\ntheorem subsingleton_iff : Subsingleton (RingCon R) \u2194 Subsingleton R := by\nsimp_rw [\u2190 not_nontrivial_iff_subsingleton, nontrivial_iff]\n\n/-- The inductively defined smallest congruence relation containing a binary relation `r` equals\nthe infimum of the set of congruence relations containing `r`. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.sSup_def (L274-L294)\ntheorem sSup_def {S : Set (RingCon R)} :\n sSup S = ringConGen (sSup (@Set.image (RingCon R) (R \u2192 R \u2192 Prop) (\u21d1) S)) := by\nrw [sSup_eq_ringConGen, sSup_image]\n congr with (x y)\n simp only [iSup_apply, iSup_Prop_eq, exists_prop]\n\nvariable (R)\n\n/-- There is a Galois insertion of congruence relations on a type with multiplication and addition\n`R` into binary relations on `R`. -/\nprotected def gi : @GaloisInsertion (R \u2192 R \u2192 Prop) (RingCon R) _ _ ringConGen (\u21d1) where\n choice r _h := ringConGen r\n gc _r c :=\n \u27e8fun H _ _ h => H <| RingConGen.Rel.of _ _ h, fun H =>\n ringConGen_of_ringCon c \u25b8 ringConGen_mono H\u27e9\n le_l_u x := (ringConGen_of_ringCon x).symm \u25b8 le_refl x\n choice_eq _ _ := rfl\n\nend Lattice\n\nend RingCon\n```\n\n-- snippet 38\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.inf_iff_and (L199-L201)\ntheorem inf_iff_and {c d : RingCon R} {x y} : (c \u2293 d) x y \u2194 c x y \u2227 d x y :=\nIff.rfl\n```\n\n-- snippet 39\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.smulCommClass' (L79-L83)\ninstance smulCommClass' [Add R] [MulOneClass R] [SMul \u03b1 R] [IsScalarTower \u03b1 R R]\n [SMulCommClass R \u03b1 R] (c : RingCon R) : SMulCommClass c.Quotient \u03b1 c.Quotient :=\nhaveI := SMulCommClass.symm R \u03b1 R\n SMulCommClass.symm _ _ _\n```\n\n-- snippet 40\n```lean\n-- Mathlib.RingTheory.Congruence.Basic.coe_smul (L57-L59)\ntheorem coe_smul (a : \u03b1) (x : R) : (\u2191(a \u2022 x) : c.Quotient) = a \u2022 (x : c.Quotient) :=\nrfl\n```\n[/INST]", "sample_id": "C-Mathlib.RingTheory.Congruence.Hom.map_apply", "source": {"declaration": "Mathlib.RingTheory.Congruence.Hom.map_apply", "file": "Mathlib/RingTheory/Congruence/Hom.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.RingTheory.Congruence.Hom", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Congruence/Hom.lean#L254", "span": "L254-L257"}} {"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 max'_eq_sorted_last {s : Finset \u03b1} {h : s.Nonempty} :\n s.max' h =\n s.sort[s.sort.length - 1]'\n (by simpa using Nat.sub_lt (card_pos.mpr h) Nat.zero_lt_one)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 659, "declarations_count": 63, "diagnostics_count": 0, "duplicate_fingerprint": "67cee02b35a71a04", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 201, "lean_code_chars": 179, "lean_code_ratio": 0.2716, "length_bucket": "tiny", "line_count": 10, "natural_language_chars": 480, "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.Data.Finset.Sort).", "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 max'_eq_sorted_last {s : Finset \u03b1} {h : s.Nonempty} :\n s.max' h =\n s.sort[s.sort.length - 1]'\n (by simpa using Nat.sub_lt (card_pos.mpr h) Nat.zero_lt_one)\n```\n\nDeclaration: `Mathlib.Data.Finset.Sort.max'_eq_sorted_last` (module Mathlib.Data.Finset.Sort).", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Data.Finset.Sort).[/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 max'_eq_sorted_last {s : Finset \u03b1} {h : s.Nonempty} :\n s.max' h =\n s.sort[s.sort.length - 1]'\n (by simpa using Nat.sub_lt (card_pos.mpr h) Nat.zero_lt_one)\n```\n\nDeclaration: `Mathlib.Data.Finset.Sort.max'_eq_sorted_last` (module Mathlib.Data.Finset.Sort).[/INST]", "sample_id": "F-Mathlib.Data.Finset.Sort.max'_eq_sorted_last", "source": {"declaration": "Mathlib.Data.Finset.Sort.max'_eq_sorted_last", "file": "Mathlib/Data/Finset/Sort.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Data.Finset.Sort", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Finset/Sort.lean#L183", "span": "L183-L192"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"trace_states": [{"state": "lemma UpperHemicontinuousAt.of_sequences {\u03b1 \u03b2 : Type*} [TopologicalSpace \u03b1]\n [TopologicalSpace \u03b2] {f : \u03b1 \u2192 Set \u03b2} {x\u2080 : \u03b1} [(\ud835\udcdd x\u2080).IsCountablyGenerated]\n {K : Set \u03b2} (hK : IsSeqCompact K) (hf : \u2200\u1da0 x in \ud835\udcdd x\u2080, f x \u2286 K)\n (h : \u2200 x : \u2115 \u2192 \u03b1, Tendsto x atTop (\ud835\udcdd x\u2080) \u2192\n \u2200 y : \u2115 \u2192 \u03b2, (\u2200 n, y n \u2208 f (x n)) \u2192 \u2200 y\u2080, Tendsto y atTop (\ud835\udcdd y\u2080) \u2192 y\u2080 \u2208 f x\u2080) :\n UpperHemicontinuousAt f x\u2080", "tactic": "refine .of_frequently fun t ht hft \u21a6 ?_"}, {"state": "", "tactic": "obtain \u27e8x, hx, hfx\u27e9 := exists_seq_forall_of_frequently hft"}, {"state": "", "tactic": "choose y hy using hfx"}, {"state": "", "tactic": "obtain \u27e8y\u2080, hy\u2080, \u03c6, h\u03c6, hy\u03c6\u27e9 := hK.subseq_of_frequently_in (x := y) <| by"}, {"state": "", "tactic": "refine Eventually.frequently ?_ filter_upwards [hx hf] with n hn"}, {"state": "", "tactic": "exact hn (hy n).1 specialize h (x \u2218 \u03c6) (hx.comp h\u03c6.tendsto_atTop) (y \u2218 \u03c6) (fun n \u21a6 (hy _).1) _ hy\u03c6"}, {"state": "", "tactic": "exact \u27e8y\u2080, h, ht.closure_eq \u25b8 mem_closure_of_tendsto hy\u03c6 <| .of_forall fun n \u21a6 (hy _).2\u27e9 /-- **Sequential characterization of upper hemicontinuity**: If `\u03b2` is a regular space and `f : \u03b1 \u2192 Set \u03b2` is upper hemicontinuous at `x\u2080` and `f x\u2080` is closed, then for any sequences `x` and `y` (in `\u03b1` and `\u03b2`, respectively) tending to `x\u2080` and `y\u2080`, respectively, if `y n \u2208 f (x n)` frequently, then `y\u2080 \u2208 f x\u2080`. This is a partial converse of `UpperHemicontinuousAt.of_sequences`. -/"}], "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 2329, "declarations_count": 299, "diagnostics_count": 0, "duplicate_fingerprint": "b8ab92e74cec70ed", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 899, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "short", "line_count": 26, "natural_language_chars": 2329, "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.Topology.Semicontinuity.Hemicontinuity).", "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.Topology.Semicontinuity.Hemicontinuity.UpperHemicontinuousAt`:\nState 0: \u22a2 lemma UpperHemicontinuousAt.of_sequences {\u03b1 \u03b2 : Type*} [TopologicalSpace \u03b1]\n [TopologicalSpace \u03b2] {f : \u03b1 \u2192 Set \u03b2} {x\u2080 : \u03b1} [(\ud835\udcdd x\u2080).IsCountablyGenerated]\n {K : Set \u03b2} (hK : IsSeqCompact K) (hf : \u2200\u1da0 x in \ud835\udcdd x\u2080, f x \u2286 K)\n (h : \u2200 x : \u2115 \u2192 \u03b1, Tendsto x atTop (\ud835\udcdd x\u2080) \u2192\n \u2200 y : \u2115 \u2192 \u03b2, (\u2200 n, y n \u2208 f (x n)) \u2192 \u2200 y\u2080, Tendsto y atTop (\ud835\udcdd y\u2080) \u2192 y\u2080 \u2208 f x\u2080) :\n UpperHemicontinuousAt f x\u2080\nTactic: refine .of_frequently fun t ht hft \u21a6 ?_\nState 1: \u22a2 \nTactic: obtain \u27e8x, hx, hfx\u27e9 := exists_seq_forall_of_frequently hft\nState 2: \u22a2 \nTactic: choose y hy using hfx\nState 3: \u22a2 \nTactic: obtain \u27e8y\u2080, hy\u2080, \u03c6, h\u03c6, hy\u03c6\u27e9 := hK.subseq_of_frequently_in (x := y) <| by\nState 4: \u22a2 \nTactic: refine Eventually.frequently ?_ filter_upwards [hx hf] with n hn\nState 5: \u22a2 \nTactic: exact hn (hy n).1 specialize h (x \u2218 \u03c6) (hx.comp h\u03c6.tendsto_atTop) (y \u2218 \u03c6) (fun n \u21a6 (hy _).1) _ hy\u03c6\nState 6: \u22a2 \nTactic: exact \u27e8y\u2080, h, ht.closure_eq \u25b8 mem_closure_of_tendsto hy\u03c6 <| .of_forall fun n \u21a6 (hy _).2\u27e9 /-- **Sequential characterization of upper hemicontinuity**: If `\u03b2` is a regular space and `f : \u03b1 \u2192 Set \u03b2` is upper hemicontinuous at `x\u2080` and `f x\u2080` is closed, then for any sequences `x` and `y` (in `\u03b1` and `\u03b2`, respectively) tending to `x\u2080` and `y\u2080`, respectively, if `y n \u2208 f (x n)` frequently, then `y\u2080 \u2208 f x\u2080`. This is a partial converse of `UpperHemicontinuousAt.of_sequences`. -/\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.Topology.Semicontinuity.Hemicontinuity).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.Topology.Semicontinuity.Hemicontinuity.UpperHemicontinuousAt`:\nState 0: \u22a2 lemma UpperHemicontinuousAt.of_sequences {\u03b1 \u03b2 : Type*} [TopologicalSpace \u03b1]\n [TopologicalSpace \u03b2] {f : \u03b1 \u2192 Set \u03b2} {x\u2080 : \u03b1} [(\ud835\udcdd x\u2080).IsCountablyGenerated]\n {K : Set \u03b2} (hK : IsSeqCompact K) (hf : \u2200\u1da0 x in \ud835\udcdd x\u2080, f x \u2286 K)\n (h : \u2200 x : \u2115 \u2192 \u03b1, Tendsto x atTop (\ud835\udcdd x\u2080) \u2192\n \u2200 y : \u2115 \u2192 \u03b2, (\u2200 n, y n \u2208 f (x n)) \u2192 \u2200 y\u2080, Tendsto y atTop (\ud835\udcdd y\u2080) \u2192 y\u2080 \u2208 f x\u2080) :\n UpperHemicontinuousAt f x\u2080\nTactic: refine .of_frequently fun t ht hft \u21a6 ?_\nState 1: \u22a2 \nTactic: obtain \u27e8x, hx, hfx\u27e9 := exists_seq_forall_of_frequently hft\nState 2: \u22a2 \nTactic: choose y hy using hfx\nState 3: \u22a2 \nTactic: obtain \u27e8y\u2080, hy\u2080, \u03c6, h\u03c6, hy\u03c6\u27e9 := hK.subseq_of_frequently_in (x := y) <| by\nState 4: \u22a2 \nTactic: refine Eventually.frequently ?_ filter_upwards [hx hf] with n hn\nState 5: \u22a2 \nTactic: exact hn (hy n).1 specialize h (x \u2218 \u03c6) (hx.comp h\u03c6.tendsto_atTop) (y \u2218 \u03c6) (fun n \u21a6 (hy _).1) _ hy\u03c6\nState 6: \u22a2 \nTactic: exact \u27e8y\u2080, h, ht.closure_eq \u25b8 mem_closure_of_tendsto hy\u03c6 <| .of_forall fun n \u21a6 (hy _).2\u27e9 /-- **Sequential characterization of upper hemicontinuity**: If `\u03b2` is a regular space and `f : \u03b1 \u2192 Set \u03b2` is upper hemicontinuous at `x\u2080` and `f x\u2080` is closed, then for any sequences `x` and `y` (in `\u03b1` and `\u03b2`, respectively) tending to `x\u2080` and `y\u2080`, respectively, if `y n \u2208 f (x n)` frequently, then `y\u2080 \u2208 f x\u2080`. This is a partial converse of `UpperHemicontinuousAt.of_sequences`. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.Topology.Semicontinuity.Hemicontinuity.UpperHemicontinuousAt", "source": {"declaration": "Mathlib.Topology.Semicontinuity.Hemicontinuity.UpperHemicontinuousAt", "file": "Mathlib/Topology/Semicontinuity/Hemicontinuity.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Topology.Semicontinuity.Hemicontinuity", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Semicontinuity/Hemicontinuity.lean#L300", "span": "L300-L321"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Analysis.Normed.Ring.Lemmas.Filter (L32-L36)\ntheorem Filter.Tendsto.zero_mul_isBoundedUnder_le {f g : \u03b9 \u2192 \u03b1} {l : Filter \u03b9}\n (hf : Tendsto f l (\ud835\udcdd 0)) (hg : IsBoundedUnder (\u00b7 \u2264 \u00b7) l ((\u2016\u00b7\u2016) \u2218 g)) :\n Tendsto (fun x => f x * g x) l (\ud835\udcdd 0) :=\nhf.op_zero_isBoundedUnder_le hg (\u00b7 * \u00b7) norm_mul_le", "-- Mathlib.Analysis.Normed.Ring.Lemmas.Filter (L37-L45)\ntheorem Filter.isBoundedUnder_le_mul_tendsto_zero {f g : \u03b9 \u2192 \u03b1} {l : Filter \u03b9}\n (hf : IsBoundedUnder (\u00b7 \u2264 \u00b7) l (norm \u2218 f)) (hg : Tendsto g l (\ud835\udcdd 0)) :\n Tendsto (fun x => f x * g x) l (\ud835\udcdd 0) :=\nhg.op_zero_isBoundedUnder_le hf (flip (\u00b7 * \u00b7)) fun x y =>\n (norm_mul_le y x).trans_eq (mul_comm _ _)\n\nopen Finset in\n/-- Non-unital seminormed ring structure on the product of finitely many non-unital seminormed\nrings, using the sup norm. -/", "-- Mathlib.Analysis.Normed.Ring.Lemmas.Pi (L46-L62)\ninstance Pi.nonUnitalSeminormedRing {R : \u03b9 \u2192 Type*} [Fintype \u03b9]\n [\u2200 i, NonUnitalSeminormedRing (R i)] : NonUnitalSeminormedRing (\u2200 i, R i) :=\n{ seminormedAddCommGroup, nonUnitalRing with\n norm_mul_le x y := NNReal.coe_mono <| calc\n (univ.sup fun i \u21a6 \u2016x i * y i\u2016\u208a) \u2264 univ.sup ((\u2016x \u00b7\u2016\u208a) * (\u2016y \u00b7\u2016\u208a)) :=\n sup_mono_fun fun _ _ \u21a6 nnnorm_mul_le _ _\n _ \u2264 (univ.sup (\u2016x \u00b7\u2016\u208a)) * univ.sup (\u2016y \u00b7\u2016\u208a) :=\n sup_mul_le_mul_sup_of_nonneg (fun _ _ \u21a6 zero_le _) fun _ _ \u21a6 zero_le _ }\n\nend NonUnitalSeminormedRing\n\nsection SeminormedRing\n\nvariable [SeminormedRing \u03b1]\n\n/-- Seminormed ring structure on the product of finitely many seminormed rings,\n using the sup norm. -/", "-- Mathlib.Analysis.Normed.Ring.Lemmas.Pi (L63-L66)\ninstance Pi.seminormedRing {R : \u03b9 \u2192 Type*} [Fintype \u03b9] [\u2200 i, SeminormedRing (R i)] :\n SeminormedRing (\u2200 i, R i) :=\n{ Pi.nonUnitalSeminormedRing, Pi.ring with }", "-- Mathlib.Analysis.Normed.Ring.Lemmas.RingHom (L67-L71)\nlemma RingHom.isometry {\ud835\udd5c\u2081 \ud835\udd5c\u2082 : Type*} [SeminormedRing \ud835\udd5c\u2081] [SeminormedRing \ud835\udd5c\u2082]\n (\u03c3 : \ud835\udd5c\u2081 \u2192+* \ud835\udd5c\u2082) [RingHomIsometric \u03c3] :\n Isometry \u03c3 := AddMonoidHomClass.isometry_of_norm _ fun _ => RingHomIsometric.norm_map\n/-- If `\u03c3` and `\u03c3'` are mutually inverse, then one is `RingHomIsometric` if the other is. Not an", "-- Mathlib.Analysis.Normed.Ring.Lemmas.RingHomIsometric (L73-L77)\nlemma RingHomIsometric.inv {\ud835\udd5c\u2081 \ud835\udd5c\u2082 : Type*} [SeminormedRing \ud835\udd5c\u2081] [SeminormedRing \ud835\udd5c\u2082]\n (\u03c3 : \ud835\udd5c\u2081 \u2192+* \ud835\udd5c\u2082) {\u03c3' : \ud835\udd5c\u2082 \u2192+* \ud835\udd5c\u2081} [RingHomInvPair \u03c3 \u03c3'] [RingHomIsometric \u03c3] :\n RingHomIsometric \u03c3' :=\n\u27e8fun {x} \u21a6 by rw [\u2190 RingHomIsometric.norm_map (\u03c3 := \u03c3), RingHomInvPair.comp_apply_eq\u2082]\u27e9", "-- Mathlib.Analysis.Normed.Ring.Lemmas.tendsto_pow_cobounded_cobounded (L78-L91)\nlemma tendsto_pow_cobounded_cobounded\n [NormOneClass \u03b1] [NormMulClass \u03b1] {m : \u2115} (hm : m \u2260 0) :\n Tendsto (\u00b7 ^ m) (cobounded \u03b1) (cobounded \u03b1) := by\nsimpa [\u2190 tendsto_norm_atTop_iff_cobounded] using\n (tendsto_pow_atTop hm).comp (tendsto_norm_cobounded_atTop (E := \u03b1))\n\nend SeminormedRing\n\nsection NonUnitalNormedRing\n\nvariable [NonUnitalNormedRing \u03b1]\n\n/-- Normed ring structure on the product of finitely many non-unital normed rings, using the sup\nnorm. -/", "-- Mathlib.Analysis.Normed.Ring.Lemmas.Pi (L92-L102)\ninstance Pi.nonUnitalNormedRing {R : \u03b9 \u2192 Type*} [Fintype \u03b9] [\u2200 i, NonUnitalNormedRing (R i)] :\n NonUnitalNormedRing (\u2200 i, R i) :=\n{ Pi.nonUnitalSeminormedRing, Pi.normedAddCommGroup with }\n\nend NonUnitalNormedRing\n\nsection NormedRing\n\nvariable [NormedRing \u03b1]\n\n/-- Normed ring structure on the product of finitely many normed rings, using the sup norm. -/", "-- Mathlib.Analysis.Normed.Ring.Lemmas.Pi (L103-L114)\ninstance Pi.normedRing {R : \u03b9 \u2192 Type*} [Fintype \u03b9] [\u2200 i, NormedRing (R i)] :\n NormedRing (\u2200 i, R i) :=\n{ Pi.seminormedRing, Pi.normedAddCommGroup with }\n\nend NormedRing\n\nsection NonUnitalSeminormedCommRing\n\nvariable [NonUnitalSeminormedCommRing \u03b1]\n\n/-- Non-unital seminormed commutative ring structure on the product of finitely many non-unital\nseminormed commutative rings, using the sup norm. -/", "-- Mathlib.Analysis.Normed.Ring.Lemmas.Pi (L115-L126)\ninstance Pi.nonUnitalSeminormedCommRing {R : \u03b9 \u2192 Type*} [Fintype \u03b9]\n [\u2200 i, NonUnitalSeminormedCommRing (R i)] : NonUnitalSeminormedCommRing (\u2200 i, R i) :=\n{ Pi.nonUnitalSeminormedRing, Pi.nonUnitalCommRing with }\n\nend NonUnitalSeminormedCommRing\n\nsection NonUnitalNormedCommRing\n\nvariable [NonUnitalNormedCommRing \u03b1]\n\n/-- Normed commutative ring structure on the product of finitely many non-unital normed\ncommutative rings, using the sup norm. -/", "-- Mathlib.Analysis.Normed.Ring.Lemmas.Pi (L127-L138)\ninstance Pi.nonUnitalNormedCommRing {R : \u03b9 \u2192 Type*} [Fintype \u03b9]\n [\u2200 i, NonUnitalNormedCommRing (R i)] : NonUnitalNormedCommRing (\u2200 i, R i) :=\n{ Pi.nonUnitalSeminormedCommRing, Pi.normedAddCommGroup with }\n\nend NonUnitalNormedCommRing\n\nsection SeminormedCommRing\n\nvariable [SeminormedCommRing \u03b1]\n\n/-- Seminormed commutative ring structure on the product of finitely many seminormed commutative\nrings, using the sup norm. -/", "-- Mathlib.Analysis.Normed.Ring.Lemmas.Pi (L139-L150)\ninstance Pi.seminormedCommRing {R : \u03b9 \u2192 Type*} [Fintype \u03b9] [\u2200 i, SeminormedCommRing (R i)] :\n SeminormedCommRing (\u2200 i, R i) :=\n{ Pi.nonUnitalSeminormedCommRing, Pi.ring with }\n\nend SeminormedCommRing\n\nsection NormedCommRing\n\nvariable [NormedCommRing \u03b1]\n\n/-- Normed commutative ring structure on the product of finitely many normed commutative rings,\nusing the sup norm. -/", "-- Mathlib.Analysis.Normed.Ring.Lemmas.Pi (L151-L157)\ninstance Pi.normedCommutativeRing {R : \u03b9 \u2192 Type*} [Fintype \u03b9] [\u2200 i, NormedCommRing (R i)] :\n NormedCommRing (\u2200 i, R i) :=\n{ Pi.seminormedCommRing, Pi.normedAddCommGroup with }\n\nend NormedCommRing\n\n-- see Note [lower instance priority]", "-- Mathlib.Analysis.Normed.Ring.Lemmas.lipschitzWith_sub (L212-L221)\nlemma lipschitzWith_sub : LipschitzWith 2 (fun (p : \u211d\u22650 \u00d7 \u211d\u22650) \u21a6 p.1 - p.2) := by\nrw [\u2190 NNReal.isometry_coe.lipschitzWith_iff]\n have : Isometry (Prod.map ((\u2191) : \u211d\u22650 \u2192 \u211d) ((\u2191) : \u211d\u22650 \u2192 \u211d)) :=\n NNReal.isometry_coe.prodMap NNReal.isometry_coe\n convert (((LipschitzWith.prod_fst.comp this.lipschitz).sub\n (LipschitzWith.prod_snd.comp this.lipschitz)).max_const 0)\n norm_num\n\nend NNReal", "-- Mathlib.Analysis.Normed.Ring.Lemmas.antilipschitzWith_mul_left (L236-L238)\nlemma antilipschitzWith_mul_left {a : \u03b1} (ha : a \u2260 0) : AntilipschitzWith (\u2016a\u2016\u208a\u207b\u00b9) (a * \u00b7) :=\nAntilipschitzWith.of_le_mul_dist fun _ _ \u21a6 by simp [dist_eq_norm, \u2190 mul_sub, ha]", "-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_self_homothety (L123-L125)\ntheorem dist_self_homothety (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n dist p\u2082 (homothety p\u2081 c p\u2082) = \u20161 - c\u2016 * dist p\u2081 p\u2082 := by rw [dist_comm, dist_homothety_self]", "-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_lineMap_lineMap (L60-L65)\ntheorem dist_lineMap_lineMap (p\u2081 p\u2082 : P) (c\u2081 c\u2082 : \ud835\udd5c) :\n dist (lineMap p\u2081 p\u2082 c\u2081) (lineMap p\u2081 p\u2082 c\u2082) = dist c\u2081 c\u2082 * dist p\u2081 p\u2082 := by\nrw [dist_comm p\u2081 p\u2082]\n simp only [lineMap_apply, dist_eq_norm_vsub, vadd_vsub_vadd_cancel_right,\n \u2190 sub_smul, norm_smul, vsub_eq_sub]", "-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_left_midpoint (L140-L143)\ntheorem nndist_left_midpoint (p\u2081 p\u2082 : P) :\n nndist p\u2081 (midpoint \ud835\udd5c p\u2081 p\u2082) = \u2016(2 : \ud835\udd5c)\u2016\u208a\u207b\u00b9 * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_left_midpoint _ _", "-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_lineMap_left (L76-L78)\ntheorem dist_lineMap_left (p\u2081 p\u2082 : P) (c : \ud835\udd5c) : dist (lineMap p\u2081 p\u2082 c) p\u2081 = \u2016c\u2016 * dist p\u2081 p\u2082 := by\nsimpa only [lineMap_apply_zero, dist_zero_right] using dist_lineMap_lineMap p\u2081 p\u2082 c 0", "-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_homothety_self (L118-L121)\ntheorem nndist_homothety_self (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist (homothety p\u2081 c p\u2082) p\u2082 = \u20161 - c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_homothety_self _ _ _", "-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_homothety_center (L51-L53)\ntheorem dist_homothety_center (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n dist (homothety p\u2081 c p\u2082) p\u2081 = \u2016c\u2016 * dist p\u2081 p\u2082 := by rw [dist_comm, dist_center_homothety]", "-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_homothety_self (L113-L116)\ntheorem dist_homothety_self (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n dist (homothety p\u2081 c p\u2082) p\u2082 = \u20161 - c\u2016 * dist p\u2081 p\u2082 := by\nrw [homothety_eq_lineMap, dist_lineMap_right]", "-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_left_midpoint (L136-L138)\ntheorem dist_left_midpoint (p\u2081 p\u2082 : P) : dist p\u2081 (midpoint \ud835\udd5c p\u2081 p\u2082) = \u2016(2 : \ud835\udd5c)\u2016\u207b\u00b9 * dist p\u2081 p\u2082 := by\nrw [midpoint, dist_comm, dist_lineMap_left, invOf_eq_inv, \u2190 norm_inv]", "-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_left_lineMap (L85-L87)\ntheorem dist_left_lineMap (p\u2081 p\u2082 : P) (c : \ud835\udd5c) : dist p\u2081 (lineMap p\u2081 p\u2082 c) = \u2016c\u2016 * dist p\u2081 p\u2082 :=\n(dist_comm _ _).trans (dist_lineMap_left _ _ _)", "-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_midpoint_left (L145-L147)\ntheorem dist_midpoint_left (p\u2081 p\u2082 : P) : dist (midpoint \ud835\udd5c p\u2081 p\u2082) p\u2081 = \u2016(2 : \ud835\udd5c)\u2016\u207b\u00b9 * dist p\u2081 p\u2082 := by\nrw [dist_comm, dist_left_midpoint]", "-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_right_lineMap (L108-L111)\ntheorem nndist_right_lineMap (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist p\u2082 (lineMap p\u2081 p\u2082 c) = \u20161 - c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_right_lineMap _ _ _", "-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_center_homothety (L41-L44)\ntheorem dist_center_homothety (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n dist p\u2081 (homothety p\u2081 c p\u2082) = \u2016c\u2016 * dist p\u2081 p\u2082 := by\nsimp [homothety_def, norm_smul, \u2190 dist_eq_norm_vsub, dist_comm]", "-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_midpoint_right (L154-L157)\ntheorem dist_midpoint_right (p\u2081 p\u2082 : P) :\n dist (midpoint \ud835\udd5c p\u2081 p\u2082) p\u2082 = \u2016(2 : \ud835\udd5c)\u2016\u207b\u00b9 * dist p\u2081 p\u2082 := by\nrw [midpoint_comm, dist_midpoint_left, dist_comm]", "-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_midpoint_right (L159-L162)\ntheorem nndist_midpoint_right (p\u2081 p\u2082 : P) :\n nndist (midpoint \ud835\udd5c p\u2081 p\u2082) p\u2082 = \u2016(2 : \ud835\udd5c)\u2016\u208a\u207b\u00b9 * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_midpoint_right _ _", "-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_right_lineMap (L104-L106)\ntheorem dist_right_lineMap (p\u2081 p\u2082 : P) (c : \ud835\udd5c) : dist p\u2082 (lineMap p\u2081 p\u2082 c) = \u20161 - c\u2016 * dist p\u2081 p\u2082 :=\n(dist_comm _ _).trans (dist_lineMap_right _ _ _)", "-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_self_homothety (L127-L134)\ntheorem nndist_self_homothety (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist p\u2082 (homothety p\u2081 c p\u2082) = \u20161 - c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_self_homothety _ _ _\n\nsection invertibleTwo\n\nvariable [Invertible (2 : \ud835\udd5c)]", "-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_homothety_center (L55-L58)\ntheorem nndist_homothety_center (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist (homothety p\u2081 c p\u2082) p\u2081 = \u2016c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_homothety_center _ _ _", "-- Mathlib.Analysis.Normed.Affine.AddTorsor.lipschitzWith_lineMap (L71-L74)\ntheorem lipschitzWith_lineMap (p\u2081 p\u2082 : P) : LipschitzWith (nndist p\u2081 p\u2082) (lineMap p\u2081 p\u2082 : \ud835\udd5c \u2192 P) :=\nLipschitzWith.of_dist_le_mul fun c\u2081 c\u2082 =>\n ((dist_lineMap_lineMap p\u2081 p\u2082 c\u2081 c\u2082).trans (mul_comm _ _)).le", "-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_left_lineMap (L89-L92)\ntheorem nndist_left_lineMap (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist p\u2081 (lineMap p\u2081 p\u2082 c) = \u2016c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_left_lineMap _ _ _", "-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_lineMap_right (L99-L102)\ntheorem nndist_lineMap_right (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist (lineMap p\u2081 p\u2082 c) p\u2082 = \u20161 - c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_lineMap_right _ _ _", "-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_midpoint_left (L149-L152)\ntheorem nndist_midpoint_left (p\u2081 p\u2082 : P) :\n nndist (midpoint \ud835\udd5c p\u2081 p\u2082) p\u2081 = \u2016(2 : \ud835\udd5c)\u2016\u208a\u207b\u00b9 * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_midpoint_left _ _", "-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_center_homothety (L46-L49)\ntheorem nndist_center_homothety (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist p\u2081 (homothety p\u2081 c p\u2082) = \u2016c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_center_homothety _ _ _", "-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_lineMap_left (L80-L83)\ntheorem nndist_lineMap_left (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist (lineMap p\u2081 p\u2082 c) p\u2081 = \u2016c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_lineMap_left _ _ _", "-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_lineMap_lineMap (L67-L70)\ntheorem nndist_lineMap_lineMap (p\u2081 p\u2082 : P) (c\u2081 c\u2082 : \ud835\udd5c) :\n nndist (lineMap p\u2081 p\u2082 c\u2081) (lineMap p\u2081 p\u2082 c\u2082) = nndist c\u2081 c\u2082 * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_lineMap_lineMap _ _ _ _", "-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_lineMap_right (L94-L97)\ntheorem dist_lineMap_right (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n dist (lineMap p\u2081 p\u2082 c) p\u2082 = \u20161 - c\u2016 * dist p\u2081 p\u2082 := by\nsimpa only [lineMap_apply_one, dist_eq_norm'] using dist_lineMap_lineMap p\u2081 p\u2082 c 1"], "statement": "instance Int.instNormedCommRing : NormedCommRing \u2124 where\n __", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 13866, "declarations_count": 1324, "diagnostics_count": 0, "duplicate_fingerprint": "3dad6ba8d3c7b560", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 5772, "lean_code_chars": 12362, "lean_code_ratio": 0.8915, "length_bucket": "medium", "line_count": 414, "natural_language_chars": 1504, "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.Analysis.Normed.Ring.Lemmas).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ninstance Int.instNormedCommRing : NormedCommRing \u2124 where\n __\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.Filter (L32-L36)\ntheorem Filter.Tendsto.zero_mul_isBoundedUnder_le {f g : \u03b9 \u2192 \u03b1} {l : Filter \u03b9}\n (hf : Tendsto f l (\ud835\udcdd 0)) (hg : IsBoundedUnder (\u00b7 \u2264 \u00b7) l ((\u2016\u00b7\u2016) \u2218 g)) :\n Tendsto (fun x => f x * g x) l (\ud835\udcdd 0) :=\nhf.op_zero_isBoundedUnder_le hg (\u00b7 * \u00b7) norm_mul_le\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.Filter (L37-L45)\ntheorem Filter.isBoundedUnder_le_mul_tendsto_zero {f g : \u03b9 \u2192 \u03b1} {l : Filter \u03b9}\n (hf : IsBoundedUnder (\u00b7 \u2264 \u00b7) l (norm \u2218 f)) (hg : Tendsto g l (\ud835\udcdd 0)) :\n Tendsto (fun x => f x * g x) l (\ud835\udcdd 0) :=\nhg.op_zero_isBoundedUnder_le hf (flip (\u00b7 * \u00b7)) fun x y =>\n (norm_mul_le y x).trans_eq (mul_comm _ _)\n\nopen Finset in\n/-- Non-unital seminormed ring structure on the product of finitely many non-unital seminormed\nrings, using the sup norm. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.Pi (L46-L62)\ninstance Pi.nonUnitalSeminormedRing {R : \u03b9 \u2192 Type*} [Fintype \u03b9]\n [\u2200 i, NonUnitalSeminormedRing (R i)] : NonUnitalSeminormedRing (\u2200 i, R i) :=\n{ seminormedAddCommGroup, nonUnitalRing with\n norm_mul_le x y := NNReal.coe_mono <| calc\n (univ.sup fun i \u21a6 \u2016x i * y i\u2016\u208a) \u2264 univ.sup ((\u2016x \u00b7\u2016\u208a) * (\u2016y \u00b7\u2016\u208a)) :=\n sup_mono_fun fun _ _ \u21a6 nnnorm_mul_le _ _\n _ \u2264 (univ.sup (\u2016x \u00b7\u2016\u208a)) * univ.sup (\u2016y \u00b7\u2016\u208a) :=\n sup_mul_le_mul_sup_of_nonneg (fun _ _ \u21a6 zero_le _) fun _ _ \u21a6 zero_le _ }\n\nend NonUnitalSeminormedRing\n\nsection SeminormedRing\n\nvariable [SeminormedRing \u03b1]\n\n/-- Seminormed ring structure on the product of finitely many seminormed rings,\n using the sup norm. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.Pi (L63-L66)\ninstance Pi.seminormedRing {R : \u03b9 \u2192 Type*} [Fintype \u03b9] [\u2200 i, SeminormedRing (R i)] :\n SeminormedRing (\u2200 i, R i) :=\n{ Pi.nonUnitalSeminormedRing, Pi.ring with }\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.RingHom (L67-L71)\nlemma RingHom.isometry {\ud835\udd5c\u2081 \ud835\udd5c\u2082 : Type*} [SeminormedRing \ud835\udd5c\u2081] [SeminormedRing \ud835\udd5c\u2082]\n (\u03c3 : \ud835\udd5c\u2081 \u2192+* \ud835\udd5c\u2082) [RingHomIsometric \u03c3] :\n Isometry \u03c3 := AddMonoidHomClass.isometry_of_norm _ fun _ => RingHomIsometric.norm_map\n/-- If `\u03c3` and `\u03c3'` are mutually inverse, then one is `RingHomIsometric` if the other is. Not an\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.RingHomIsometric (L73-L77)\nlemma RingHomIsometric.inv {\ud835\udd5c\u2081 \ud835\udd5c\u2082 : Type*} [SeminormedRing \ud835\udd5c\u2081] [SeminormedRing \ud835\udd5c\u2082]\n (\u03c3 : \ud835\udd5c\u2081 \u2192+* \ud835\udd5c\u2082) {\u03c3' : \ud835\udd5c\u2082 \u2192+* \ud835\udd5c\u2081} [RingHomInvPair \u03c3 \u03c3'] [RingHomIsometric \u03c3] :\n RingHomIsometric \u03c3' :=\n\u27e8fun {x} \u21a6 by rw [\u2190 RingHomIsometric.norm_map (\u03c3 := \u03c3), RingHomInvPair.comp_apply_eq\u2082]\u27e9\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.tendsto_pow_cobounded_cobounded (L78-L91)\nlemma tendsto_pow_cobounded_cobounded\n [NormOneClass \u03b1] [NormMulClass \u03b1] {m : \u2115} (hm : m \u2260 0) :\n Tendsto (\u00b7 ^ m) (cobounded \u03b1) (cobounded \u03b1) := by\nsimpa [\u2190 tendsto_norm_atTop_iff_cobounded] using\n (tendsto_pow_atTop hm).comp (tendsto_norm_cobounded_atTop (E := \u03b1))\n\nend SeminormedRing\n\nsection NonUnitalNormedRing\n\nvariable [NonUnitalNormedRing \u03b1]\n\n/-- Normed ring structure on the product of finitely many non-unital normed rings, using the sup\nnorm. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.Pi (L92-L102)\ninstance Pi.nonUnitalNormedRing {R : \u03b9 \u2192 Type*} [Fintype \u03b9] [\u2200 i, NonUnitalNormedRing (R i)] :\n NonUnitalNormedRing (\u2200 i, R i) :=\n{ Pi.nonUnitalSeminormedRing, Pi.normedAddCommGroup with }\n\nend NonUnitalNormedRing\n\nsection NormedRing\n\nvariable [NormedRing \u03b1]\n\n/-- Normed ring structure on the product of finitely many normed rings, using the sup norm. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.Pi (L103-L114)\ninstance Pi.normedRing {R : \u03b9 \u2192 Type*} [Fintype \u03b9] [\u2200 i, NormedRing (R i)] :\n NormedRing (\u2200 i, R i) :=\n{ Pi.seminormedRing, Pi.normedAddCommGroup with }\n\nend NormedRing\n\nsection NonUnitalSeminormedCommRing\n\nvariable [NonUnitalSeminormedCommRing \u03b1]\n\n/-- Non-unital seminormed commutative ring structure on the product of finitely many non-unital\nseminormed commutative rings, using the sup norm. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.Pi (L115-L126)\ninstance Pi.nonUnitalSeminormedCommRing {R : \u03b9 \u2192 Type*} [Fintype \u03b9]\n [\u2200 i, NonUnitalSeminormedCommRing (R i)] : NonUnitalSeminormedCommRing (\u2200 i, R i) :=\n{ Pi.nonUnitalSeminormedRing, Pi.nonUnitalCommRing with }\n\nend NonUnitalSeminormedCommRing\n\nsection NonUnitalNormedCommRing\n\nvariable [NonUnitalNormedCommRing \u03b1]\n\n/-- Normed commutative ring structure on the product of finitely many non-unital normed\ncommutative rings, using the sup norm. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.Pi (L127-L138)\ninstance Pi.nonUnitalNormedCommRing {R : \u03b9 \u2192 Type*} [Fintype \u03b9]\n [\u2200 i, NonUnitalNormedCommRing (R i)] : NonUnitalNormedCommRing (\u2200 i, R i) :=\n{ Pi.nonUnitalSeminormedCommRing, Pi.normedAddCommGroup with }\n\nend NonUnitalNormedCommRing\n\nsection SeminormedCommRing\n\nvariable [SeminormedCommRing \u03b1]\n\n/-- Seminormed commutative ring structure on the product of finitely many seminormed commutative\nrings, using the sup norm. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.Pi (L139-L150)\ninstance Pi.seminormedCommRing {R : \u03b9 \u2192 Type*} [Fintype \u03b9] [\u2200 i, SeminormedCommRing (R i)] :\n SeminormedCommRing (\u2200 i, R i) :=\n{ Pi.nonUnitalSeminormedCommRing, Pi.ring with }\n\nend SeminormedCommRing\n\nsection NormedCommRing\n\nvariable [NormedCommRing \u03b1]\n\n/-- Normed commutative ring structure on the product of finitely many normed commutative rings,\nusing the sup norm. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.Pi (L151-L157)\ninstance Pi.normedCommutativeRing {R : \u03b9 \u2192 Type*} [Fintype \u03b9] [\u2200 i, NormedCommRing (R i)] :\n NormedCommRing (\u2200 i, R i) :=\n{ Pi.seminormedCommRing, Pi.normedAddCommGroup with }\n\nend NormedCommRing\n\n-- see Note [lower instance priority]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.lipschitzWith_sub (L212-L221)\nlemma lipschitzWith_sub : LipschitzWith 2 (fun (p : \u211d\u22650 \u00d7 \u211d\u22650) \u21a6 p.1 - p.2) := by\nrw [\u2190 NNReal.isometry_coe.lipschitzWith_iff]\n have : Isometry (Prod.map ((\u2191) : \u211d\u22650 \u2192 \u211d) ((\u2191) : \u211d\u22650 \u2192 \u211d)) :=\n NNReal.isometry_coe.prodMap NNReal.isometry_coe\n convert (((LipschitzWith.prod_fst.comp this.lipschitz).sub\n (LipschitzWith.prod_snd.comp this.lipschitz)).max_const 0)\n norm_num\n\nend NNReal\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.antilipschitzWith_mul_left (L236-L238)\nlemma antilipschitzWith_mul_left {a : \u03b1} (ha : a \u2260 0) : AntilipschitzWith (\u2016a\u2016\u208a\u207b\u00b9) (a * \u00b7) :=\nAntilipschitzWith.of_le_mul_dist fun _ _ \u21a6 by simp [dist_eq_norm, \u2190 mul_sub, ha]\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_self_homothety (L123-L125)\ntheorem dist_self_homothety (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n dist p\u2082 (homothety p\u2081 c p\u2082) = \u20161 - c\u2016 * dist p\u2081 p\u2082 := by rw [dist_comm, dist_homothety_self]\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_lineMap_lineMap (L60-L65)\ntheorem dist_lineMap_lineMap (p\u2081 p\u2082 : P) (c\u2081 c\u2082 : \ud835\udd5c) :\n dist (lineMap p\u2081 p\u2082 c\u2081) (lineMap p\u2081 p\u2082 c\u2082) = dist c\u2081 c\u2082 * dist p\u2081 p\u2082 := by\nrw [dist_comm p\u2081 p\u2082]\n simp only [lineMap_apply, dist_eq_norm_vsub, vadd_vsub_vadd_cancel_right,\n \u2190 sub_smul, norm_smul, vsub_eq_sub]\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_left_midpoint (L140-L143)\ntheorem nndist_left_midpoint (p\u2081 p\u2082 : P) :\n nndist p\u2081 (midpoint \ud835\udd5c p\u2081 p\u2082) = \u2016(2 : \ud835\udd5c)\u2016\u208a\u207b\u00b9 * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_left_midpoint _ _\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_lineMap_left (L76-L78)\ntheorem dist_lineMap_left (p\u2081 p\u2082 : P) (c : \ud835\udd5c) : dist (lineMap p\u2081 p\u2082 c) p\u2081 = \u2016c\u2016 * dist p\u2081 p\u2082 := by\nsimpa only [lineMap_apply_zero, dist_zero_right] using dist_lineMap_lineMap p\u2081 p\u2082 c 0\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_homothety_self (L118-L121)\ntheorem nndist_homothety_self (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist (homothety p\u2081 c p\u2082) p\u2082 = \u20161 - c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_homothety_self _ _ _\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_homothety_center (L51-L53)\ntheorem dist_homothety_center (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n dist (homothety p\u2081 c p\u2082) p\u2081 = \u2016c\u2016 * dist p\u2081 p\u2082 := by rw [dist_comm, dist_center_homothety]\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_homothety_self (L113-L116)\ntheorem dist_homothety_self (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n dist (homothety p\u2081 c p\u2082) p\u2082 = \u20161 - c\u2016 * dist p\u2081 p\u2082 := by\nrw [homothety_eq_lineMap, dist_lineMap_right]\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_left_midpoint (L136-L138)\ntheorem dist_left_midpoint (p\u2081 p\u2082 : P) : dist p\u2081 (midpoint \ud835\udd5c p\u2081 p\u2082) = \u2016(2 : \ud835\udd5c)\u2016\u207b\u00b9 * dist p\u2081 p\u2082 := by\nrw [midpoint, dist_comm, dist_lineMap_left, invOf_eq_inv, \u2190 norm_inv]\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_left_lineMap (L85-L87)\ntheorem dist_left_lineMap (p\u2081 p\u2082 : P) (c : \ud835\udd5c) : dist p\u2081 (lineMap p\u2081 p\u2082 c) = \u2016c\u2016 * dist p\u2081 p\u2082 :=\n(dist_comm _ _).trans (dist_lineMap_left _ _ _)\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_midpoint_left (L145-L147)\ntheorem dist_midpoint_left (p\u2081 p\u2082 : P) : dist (midpoint \ud835\udd5c p\u2081 p\u2082) p\u2081 = \u2016(2 : \ud835\udd5c)\u2016\u207b\u00b9 * dist p\u2081 p\u2082 := by\nrw [dist_comm, dist_left_midpoint]\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_right_lineMap (L108-L111)\ntheorem nndist_right_lineMap (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist p\u2082 (lineMap p\u2081 p\u2082 c) = \u20161 - c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_right_lineMap _ _ _\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_center_homothety (L41-L44)\ntheorem dist_center_homothety (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n dist p\u2081 (homothety p\u2081 c p\u2082) = \u2016c\u2016 * dist p\u2081 p\u2082 := by\nsimp [homothety_def, norm_smul, \u2190 dist_eq_norm_vsub, dist_comm]\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_midpoint_right (L154-L157)\ntheorem dist_midpoint_right (p\u2081 p\u2082 : P) :\n dist (midpoint \ud835\udd5c p\u2081 p\u2082) p\u2082 = \u2016(2 : \ud835\udd5c)\u2016\u207b\u00b9 * dist p\u2081 p\u2082 := by\nrw [midpoint_comm, dist_midpoint_left, dist_comm]\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_midpoint_right (L159-L162)\ntheorem nndist_midpoint_right (p\u2081 p\u2082 : P) :\n nndist (midpoint \ud835\udd5c p\u2081 p\u2082) p\u2082 = \u2016(2 : \ud835\udd5c)\u2016\u208a\u207b\u00b9 * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_midpoint_right _ _\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_right_lineMap (L104-L106)\ntheorem dist_right_lineMap (p\u2081 p\u2082 : P) (c : \ud835\udd5c) : dist p\u2082 (lineMap p\u2081 p\u2082 c) = \u20161 - c\u2016 * dist p\u2081 p\u2082 :=\n(dist_comm _ _).trans (dist_lineMap_right _ _ _)\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_self_homothety (L127-L134)\ntheorem nndist_self_homothety (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist p\u2082 (homothety p\u2081 c p\u2082) = \u20161 - c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_self_homothety _ _ _\n\nsection invertibleTwo\n\nvariable [Invertible (2 : \ud835\udd5c)]\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_homothety_center (L55-L58)\ntheorem nndist_homothety_center (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist (homothety p\u2081 c p\u2082) p\u2081 = \u2016c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_homothety_center _ _ _\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.lipschitzWith_lineMap (L71-L74)\ntheorem lipschitzWith_lineMap (p\u2081 p\u2082 : P) : LipschitzWith (nndist p\u2081 p\u2082) (lineMap p\u2081 p\u2082 : \ud835\udd5c \u2192 P) :=\nLipschitzWith.of_dist_le_mul fun c\u2081 c\u2082 =>\n ((dist_lineMap_lineMap p\u2081 p\u2082 c\u2081 c\u2082).trans (mul_comm _ _)).le\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_left_lineMap (L89-L92)\ntheorem nndist_left_lineMap (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist p\u2081 (lineMap p\u2081 p\u2082 c) = \u2016c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_left_lineMap _ _ _\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_lineMap_right (L99-L102)\ntheorem nndist_lineMap_right (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist (lineMap p\u2081 p\u2082 c) p\u2082 = \u20161 - c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_lineMap_right _ _ _\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_midpoint_left (L149-L152)\ntheorem nndist_midpoint_left (p\u2081 p\u2082 : P) :\n nndist (midpoint \ud835\udd5c p\u2081 p\u2082) p\u2081 = \u2016(2 : \ud835\udd5c)\u2016\u208a\u207b\u00b9 * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_midpoint_left _ _\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_center_homothety (L46-L49)\ntheorem nndist_center_homothety (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist p\u2081 (homothety p\u2081 c p\u2082) = \u2016c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_center_homothety _ _ _\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_lineMap_left (L80-L83)\ntheorem nndist_lineMap_left (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist (lineMap p\u2081 p\u2082 c) p\u2081 = \u2016c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_lineMap_left _ _ _\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_lineMap_lineMap (L67-L70)\ntheorem nndist_lineMap_lineMap (p\u2081 p\u2082 : P) (c\u2081 c\u2082 : \ud835\udd5c) :\n nndist (lineMap p\u2081 p\u2082 c\u2081) (lineMap p\u2081 p\u2082 c\u2082) = nndist c\u2081 c\u2082 * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_lineMap_lineMap _ _ _ _\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_lineMap_right (L94-L97)\ntheorem dist_lineMap_right (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n dist (lineMap p\u2081 p\u2082 c) p\u2082 = \u20161 - c\u2016 * dist p\u2081 p\u2082 := by\nsimpa only [lineMap_apply_one, dist_eq_norm'] using dist_lineMap_lineMap p\u2081 p\u2082 c 1\n```\n", "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.Analysis.Normed.Ring.Lemmas).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ninstance Int.instNormedCommRing : NormedCommRing \u2124 where\n __\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.Filter (L32-L36)\ntheorem Filter.Tendsto.zero_mul_isBoundedUnder_le {f g : \u03b9 \u2192 \u03b1} {l : Filter \u03b9}\n (hf : Tendsto f l (\ud835\udcdd 0)) (hg : IsBoundedUnder (\u00b7 \u2264 \u00b7) l ((\u2016\u00b7\u2016) \u2218 g)) :\n Tendsto (fun x => f x * g x) l (\ud835\udcdd 0) :=\nhf.op_zero_isBoundedUnder_le hg (\u00b7 * \u00b7) norm_mul_le\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.Filter (L37-L45)\ntheorem Filter.isBoundedUnder_le_mul_tendsto_zero {f g : \u03b9 \u2192 \u03b1} {l : Filter \u03b9}\n (hf : IsBoundedUnder (\u00b7 \u2264 \u00b7) l (norm \u2218 f)) (hg : Tendsto g l (\ud835\udcdd 0)) :\n Tendsto (fun x => f x * g x) l (\ud835\udcdd 0) :=\nhg.op_zero_isBoundedUnder_le hf (flip (\u00b7 * \u00b7)) fun x y =>\n (norm_mul_le y x).trans_eq (mul_comm _ _)\n\nopen Finset in\n/-- Non-unital seminormed ring structure on the product of finitely many non-unital seminormed\nrings, using the sup norm. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.Pi (L46-L62)\ninstance Pi.nonUnitalSeminormedRing {R : \u03b9 \u2192 Type*} [Fintype \u03b9]\n [\u2200 i, NonUnitalSeminormedRing (R i)] : NonUnitalSeminormedRing (\u2200 i, R i) :=\n{ seminormedAddCommGroup, nonUnitalRing with\n norm_mul_le x y := NNReal.coe_mono <| calc\n (univ.sup fun i \u21a6 \u2016x i * y i\u2016\u208a) \u2264 univ.sup ((\u2016x \u00b7\u2016\u208a) * (\u2016y \u00b7\u2016\u208a)) :=\n sup_mono_fun fun _ _ \u21a6 nnnorm_mul_le _ _\n _ \u2264 (univ.sup (\u2016x \u00b7\u2016\u208a)) * univ.sup (\u2016y \u00b7\u2016\u208a) :=\n sup_mul_le_mul_sup_of_nonneg (fun _ _ \u21a6 zero_le _) fun _ _ \u21a6 zero_le _ }\n\nend NonUnitalSeminormedRing\n\nsection SeminormedRing\n\nvariable [SeminormedRing \u03b1]\n\n/-- Seminormed ring structure on the product of finitely many seminormed rings,\n using the sup norm. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.Pi (L63-L66)\ninstance Pi.seminormedRing {R : \u03b9 \u2192 Type*} [Fintype \u03b9] [\u2200 i, SeminormedRing (R i)] :\n SeminormedRing (\u2200 i, R i) :=\n{ Pi.nonUnitalSeminormedRing, Pi.ring with }\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.RingHom (L67-L71)\nlemma RingHom.isometry {\ud835\udd5c\u2081 \ud835\udd5c\u2082 : Type*} [SeminormedRing \ud835\udd5c\u2081] [SeminormedRing \ud835\udd5c\u2082]\n (\u03c3 : \ud835\udd5c\u2081 \u2192+* \ud835\udd5c\u2082) [RingHomIsometric \u03c3] :\n Isometry \u03c3 := AddMonoidHomClass.isometry_of_norm _ fun _ => RingHomIsometric.norm_map\n/-- If `\u03c3` and `\u03c3'` are mutually inverse, then one is `RingHomIsometric` if the other is. Not an\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.RingHomIsometric (L73-L77)\nlemma RingHomIsometric.inv {\ud835\udd5c\u2081 \ud835\udd5c\u2082 : Type*} [SeminormedRing \ud835\udd5c\u2081] [SeminormedRing \ud835\udd5c\u2082]\n (\u03c3 : \ud835\udd5c\u2081 \u2192+* \ud835\udd5c\u2082) {\u03c3' : \ud835\udd5c\u2082 \u2192+* \ud835\udd5c\u2081} [RingHomInvPair \u03c3 \u03c3'] [RingHomIsometric \u03c3] :\n RingHomIsometric \u03c3' :=\n\u27e8fun {x} \u21a6 by rw [\u2190 RingHomIsometric.norm_map (\u03c3 := \u03c3), RingHomInvPair.comp_apply_eq\u2082]\u27e9\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.tendsto_pow_cobounded_cobounded (L78-L91)\nlemma tendsto_pow_cobounded_cobounded\n [NormOneClass \u03b1] [NormMulClass \u03b1] {m : \u2115} (hm : m \u2260 0) :\n Tendsto (\u00b7 ^ m) (cobounded \u03b1) (cobounded \u03b1) := by\nsimpa [\u2190 tendsto_norm_atTop_iff_cobounded] using\n (tendsto_pow_atTop hm).comp (tendsto_norm_cobounded_atTop (E := \u03b1))\n\nend SeminormedRing\n\nsection NonUnitalNormedRing\n\nvariable [NonUnitalNormedRing \u03b1]\n\n/-- Normed ring structure on the product of finitely many non-unital normed rings, using the sup\nnorm. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.Pi (L92-L102)\ninstance Pi.nonUnitalNormedRing {R : \u03b9 \u2192 Type*} [Fintype \u03b9] [\u2200 i, NonUnitalNormedRing (R i)] :\n NonUnitalNormedRing (\u2200 i, R i) :=\n{ Pi.nonUnitalSeminormedRing, Pi.normedAddCommGroup with }\n\nend NonUnitalNormedRing\n\nsection NormedRing\n\nvariable [NormedRing \u03b1]\n\n/-- Normed ring structure on the product of finitely many normed rings, using the sup norm. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.Pi (L103-L114)\ninstance Pi.normedRing {R : \u03b9 \u2192 Type*} [Fintype \u03b9] [\u2200 i, NormedRing (R i)] :\n NormedRing (\u2200 i, R i) :=\n{ Pi.seminormedRing, Pi.normedAddCommGroup with }\n\nend NormedRing\n\nsection NonUnitalSeminormedCommRing\n\nvariable [NonUnitalSeminormedCommRing \u03b1]\n\n/-- Non-unital seminormed commutative ring structure on the product of finitely many non-unital\nseminormed commutative rings, using the sup norm. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.Pi (L115-L126)\ninstance Pi.nonUnitalSeminormedCommRing {R : \u03b9 \u2192 Type*} [Fintype \u03b9]\n [\u2200 i, NonUnitalSeminormedCommRing (R i)] : NonUnitalSeminormedCommRing (\u2200 i, R i) :=\n{ Pi.nonUnitalSeminormedRing, Pi.nonUnitalCommRing with }\n\nend NonUnitalSeminormedCommRing\n\nsection NonUnitalNormedCommRing\n\nvariable [NonUnitalNormedCommRing \u03b1]\n\n/-- Normed commutative ring structure on the product of finitely many non-unital normed\ncommutative rings, using the sup norm. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.Pi (L127-L138)\ninstance Pi.nonUnitalNormedCommRing {R : \u03b9 \u2192 Type*} [Fintype \u03b9]\n [\u2200 i, NonUnitalNormedCommRing (R i)] : NonUnitalNormedCommRing (\u2200 i, R i) :=\n{ Pi.nonUnitalSeminormedCommRing, Pi.normedAddCommGroup with }\n\nend NonUnitalNormedCommRing\n\nsection SeminormedCommRing\n\nvariable [SeminormedCommRing \u03b1]\n\n/-- Seminormed commutative ring structure on the product of finitely many seminormed commutative\nrings, using the sup norm. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.Pi (L139-L150)\ninstance Pi.seminormedCommRing {R : \u03b9 \u2192 Type*} [Fintype \u03b9] [\u2200 i, SeminormedCommRing (R i)] :\n SeminormedCommRing (\u2200 i, R i) :=\n{ Pi.nonUnitalSeminormedCommRing, Pi.ring with }\n\nend SeminormedCommRing\n\nsection NormedCommRing\n\nvariable [NormedCommRing \u03b1]\n\n/-- Normed commutative ring structure on the product of finitely many normed commutative rings,\nusing the sup norm. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.Pi (L151-L157)\ninstance Pi.normedCommutativeRing {R : \u03b9 \u2192 Type*} [Fintype \u03b9] [\u2200 i, NormedCommRing (R i)] :\n NormedCommRing (\u2200 i, R i) :=\n{ Pi.seminormedCommRing, Pi.normedAddCommGroup with }\n\nend NormedCommRing\n\n-- see Note [lower instance priority]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.lipschitzWith_sub (L212-L221)\nlemma lipschitzWith_sub : LipschitzWith 2 (fun (p : \u211d\u22650 \u00d7 \u211d\u22650) \u21a6 p.1 - p.2) := by\nrw [\u2190 NNReal.isometry_coe.lipschitzWith_iff]\n have : Isometry (Prod.map ((\u2191) : \u211d\u22650 \u2192 \u211d) ((\u2191) : \u211d\u22650 \u2192 \u211d)) :=\n NNReal.isometry_coe.prodMap NNReal.isometry_coe\n convert (((LipschitzWith.prod_fst.comp this.lipschitz).sub\n (LipschitzWith.prod_snd.comp this.lipschitz)).max_const 0)\n norm_num\n\nend NNReal\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Analysis.Normed.Ring.Lemmas.antilipschitzWith_mul_left (L236-L238)\nlemma antilipschitzWith_mul_left {a : \u03b1} (ha : a \u2260 0) : AntilipschitzWith (\u2016a\u2016\u208a\u207b\u00b9) (a * \u00b7) :=\nAntilipschitzWith.of_le_mul_dist fun _ _ \u21a6 by simp [dist_eq_norm, \u2190 mul_sub, ha]\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_self_homothety (L123-L125)\ntheorem dist_self_homothety (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n dist p\u2082 (homothety p\u2081 c p\u2082) = \u20161 - c\u2016 * dist p\u2081 p\u2082 := by rw [dist_comm, dist_homothety_self]\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_lineMap_lineMap (L60-L65)\ntheorem dist_lineMap_lineMap (p\u2081 p\u2082 : P) (c\u2081 c\u2082 : \ud835\udd5c) :\n dist (lineMap p\u2081 p\u2082 c\u2081) (lineMap p\u2081 p\u2082 c\u2082) = dist c\u2081 c\u2082 * dist p\u2081 p\u2082 := by\nrw [dist_comm p\u2081 p\u2082]\n simp only [lineMap_apply, dist_eq_norm_vsub, vadd_vsub_vadd_cancel_right,\n \u2190 sub_smul, norm_smul, vsub_eq_sub]\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_left_midpoint (L140-L143)\ntheorem nndist_left_midpoint (p\u2081 p\u2082 : P) :\n nndist p\u2081 (midpoint \ud835\udd5c p\u2081 p\u2082) = \u2016(2 : \ud835\udd5c)\u2016\u208a\u207b\u00b9 * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_left_midpoint _ _\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_lineMap_left (L76-L78)\ntheorem dist_lineMap_left (p\u2081 p\u2082 : P) (c : \ud835\udd5c) : dist (lineMap p\u2081 p\u2082 c) p\u2081 = \u2016c\u2016 * dist p\u2081 p\u2082 := by\nsimpa only [lineMap_apply_zero, dist_zero_right] using dist_lineMap_lineMap p\u2081 p\u2082 c 0\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_homothety_self (L118-L121)\ntheorem nndist_homothety_self (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist (homothety p\u2081 c p\u2082) p\u2082 = \u20161 - c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_homothety_self _ _ _\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_homothety_center (L51-L53)\ntheorem dist_homothety_center (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n dist (homothety p\u2081 c p\u2082) p\u2081 = \u2016c\u2016 * dist p\u2081 p\u2082 := by rw [dist_comm, dist_center_homothety]\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_homothety_self (L113-L116)\ntheorem dist_homothety_self (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n dist (homothety p\u2081 c p\u2082) p\u2082 = \u20161 - c\u2016 * dist p\u2081 p\u2082 := by\nrw [homothety_eq_lineMap, dist_lineMap_right]\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_left_midpoint (L136-L138)\ntheorem dist_left_midpoint (p\u2081 p\u2082 : P) : dist p\u2081 (midpoint \ud835\udd5c p\u2081 p\u2082) = \u2016(2 : \ud835\udd5c)\u2016\u207b\u00b9 * dist p\u2081 p\u2082 := by\nrw [midpoint, dist_comm, dist_lineMap_left, invOf_eq_inv, \u2190 norm_inv]\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_left_lineMap (L85-L87)\ntheorem dist_left_lineMap (p\u2081 p\u2082 : P) (c : \ud835\udd5c) : dist p\u2081 (lineMap p\u2081 p\u2082 c) = \u2016c\u2016 * dist p\u2081 p\u2082 :=\n(dist_comm _ _).trans (dist_lineMap_left _ _ _)\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_midpoint_left (L145-L147)\ntheorem dist_midpoint_left (p\u2081 p\u2082 : P) : dist (midpoint \ud835\udd5c p\u2081 p\u2082) p\u2081 = \u2016(2 : \ud835\udd5c)\u2016\u207b\u00b9 * dist p\u2081 p\u2082 := by\nrw [dist_comm, dist_left_midpoint]\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_right_lineMap (L108-L111)\ntheorem nndist_right_lineMap (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist p\u2082 (lineMap p\u2081 p\u2082 c) = \u20161 - c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_right_lineMap _ _ _\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_center_homothety (L41-L44)\ntheorem dist_center_homothety (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n dist p\u2081 (homothety p\u2081 c p\u2082) = \u2016c\u2016 * dist p\u2081 p\u2082 := by\nsimp [homothety_def, norm_smul, \u2190 dist_eq_norm_vsub, dist_comm]\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_midpoint_right (L154-L157)\ntheorem dist_midpoint_right (p\u2081 p\u2082 : P) :\n dist (midpoint \ud835\udd5c p\u2081 p\u2082) p\u2082 = \u2016(2 : \ud835\udd5c)\u2016\u207b\u00b9 * dist p\u2081 p\u2082 := by\nrw [midpoint_comm, dist_midpoint_left, dist_comm]\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_midpoint_right (L159-L162)\ntheorem nndist_midpoint_right (p\u2081 p\u2082 : P) :\n nndist (midpoint \ud835\udd5c p\u2081 p\u2082) p\u2082 = \u2016(2 : \ud835\udd5c)\u2016\u208a\u207b\u00b9 * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_midpoint_right _ _\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_right_lineMap (L104-L106)\ntheorem dist_right_lineMap (p\u2081 p\u2082 : P) (c : \ud835\udd5c) : dist p\u2082 (lineMap p\u2081 p\u2082 c) = \u20161 - c\u2016 * dist p\u2081 p\u2082 :=\n(dist_comm _ _).trans (dist_lineMap_right _ _ _)\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_self_homothety (L127-L134)\ntheorem nndist_self_homothety (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist p\u2082 (homothety p\u2081 c p\u2082) = \u20161 - c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_self_homothety _ _ _\n\nsection invertibleTwo\n\nvariable [Invertible (2 : \ud835\udd5c)]\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_homothety_center (L55-L58)\ntheorem nndist_homothety_center (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist (homothety p\u2081 c p\u2082) p\u2081 = \u2016c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_homothety_center _ _ _\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.lipschitzWith_lineMap (L71-L74)\ntheorem lipschitzWith_lineMap (p\u2081 p\u2082 : P) : LipschitzWith (nndist p\u2081 p\u2082) (lineMap p\u2081 p\u2082 : \ud835\udd5c \u2192 P) :=\nLipschitzWith.of_dist_le_mul fun c\u2081 c\u2082 =>\n ((dist_lineMap_lineMap p\u2081 p\u2082 c\u2081 c\u2082).trans (mul_comm _ _)).le\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_left_lineMap (L89-L92)\ntheorem nndist_left_lineMap (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist p\u2081 (lineMap p\u2081 p\u2082 c) = \u2016c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_left_lineMap _ _ _\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_lineMap_right (L99-L102)\ntheorem nndist_lineMap_right (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist (lineMap p\u2081 p\u2082 c) p\u2082 = \u20161 - c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_lineMap_right _ _ _\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_midpoint_left (L149-L152)\ntheorem nndist_midpoint_left (p\u2081 p\u2082 : P) :\n nndist (midpoint \ud835\udd5c p\u2081 p\u2082) p\u2081 = \u2016(2 : \ud835\udd5c)\u2016\u208a\u207b\u00b9 * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_midpoint_left _ _\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_center_homothety (L46-L49)\ntheorem nndist_center_homothety (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist p\u2081 (homothety p\u2081 c p\u2082) = \u2016c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_center_homothety _ _ _\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_lineMap_left (L80-L83)\ntheorem nndist_lineMap_left (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n nndist (lineMap p\u2081 p\u2082 c) p\u2081 = \u2016c\u2016\u208a * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_lineMap_left _ _ _\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.nndist_lineMap_lineMap (L67-L70)\ntheorem nndist_lineMap_lineMap (p\u2081 p\u2082 : P) (c\u2081 c\u2082 : \ud835\udd5c) :\n nndist (lineMap p\u2081 p\u2082 c\u2081) (lineMap p\u2081 p\u2082 c\u2082) = nndist c\u2081 c\u2082 * nndist p\u2081 p\u2082 :=\nNNReal.eq <| dist_lineMap_lineMap _ _ _ _\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Analysis.Normed.Affine.AddTorsor.dist_lineMap_right (L94-L97)\ntheorem dist_lineMap_right (p\u2081 p\u2082 : P) (c : \ud835\udd5c) :\n dist (lineMap p\u2081 p\u2082 c) p\u2082 = \u20161 - c\u2016 * dist p\u2081 p\u2082 := by\nsimpa only [lineMap_apply_one, dist_eq_norm'] using dist_lineMap_lineMap p\u2081 p\u2082 c 1\n```\n[/INST]", "sample_id": "C-Mathlib.Analysis.Normed.Ring.Lemmas.Int", "source": {"declaration": "Mathlib.Analysis.Normed.Ring.Lemmas.Int", "file": "Mathlib/Analysis/Normed/Ring/Lemmas.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Analysis.Normed.Ring.Lemmas", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Normed/Ring/Lemmas.lean#L222", "span": "L222-L226"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem IsOpen.dense_iUnion_preimage_smul [h : IsTopologicallyTransitive M \u03b1]\n {U : Set \u03b1} (hUo : IsOpen U) (hUne : U.Nonempty) : Dense (\u22c3 m : M, (m \u2022 \u00b7) \u207b\u00b9' U)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 567, "declarations_count": 63, "diagnostics_count": 0, "duplicate_fingerprint": "63c35037316561e8", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 177, "lean_code_chars": 164, "lean_code_ratio": 0.2892, "length_bucket": "tiny", "line_count": 8, "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.Dynamics.Transitive).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem IsOpen.dense_iUnion_preimage_smul [h : IsTopologicallyTransitive M \u03b1]\n {U : Set \u03b1} (hUo : IsOpen U) (hUne : U.Nonempty) : Dense (\u22c3 m : M, (m \u2022 \u00b7) \u207b\u00b9' U)\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.Transitive).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem IsOpen.dense_iUnion_preimage_smul [h : IsTopologicallyTransitive M \u03b1]\n {U : Set \u03b1} (hUo : IsOpen U) (hUne : U.Nonempty) : Dense (\u22c3 m : M, (m \u2022 \u00b7) \u207b\u00b9' U)\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.Transitive.IsOpen", "source": {"declaration": "Mathlib.Dynamics.Transitive.IsOpen", "file": "Mathlib/Dynamics/Transitive.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Dynamics.Transitive", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Dynamics/Transitive.lean#L86", "span": "L86-L91"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "lemma piAntidiag_empty (n : \u03bc) : piAntidiag (\u2205 : Finset \u03b9) n = if n = 0 then {0} else \u2205", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 497, "declarations_count": 56, "diagnostics_count": 0, "duplicate_fingerprint": "c452d76113cc5808", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 153, "lean_code_chars": 88, "lean_code_ratio": 0.1771, "length_bucket": "tiny", "line_count": 7, "natural_language_chars": 409, "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.Algebra.Order.Antidiag.Pi).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\nlemma piAntidiag_empty (n : \u03bc) : piAntidiag (\u2205 : Finset \u03b9) n = if n = 0 then {0} else \u2205\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.Algebra.Order.Antidiag.Pi).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma piAntidiag_empty (n : \u03bc) : piAntidiag (\u2205 : Finset \u03b9) n = if n = 0 then {0} else \u2205\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Algebra.Order.Antidiag.Pi.piAntidiag_empty", "source": {"declaration": "Mathlib.Algebra.Order.Antidiag.Pi.piAntidiag_empty", "file": "Mathlib/Algebra/Order/Antidiag/Pi.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Algebra.Order.Antidiag.Pi", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Order/Antidiag/Pi.lean#L147", "span": "L147-L149"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\ntheorem truncFinset_monomial_eq_zero {x : \u03c3 \u2192\u2080 \u2115} (r : R) (h : x \u2209 s) :\n truncFinset R s (monomial x r) = 0 := by\nclassical\n ext; simp [truncFinset, MvPolynomial.coeff_sum, coeff_monomial]\n grind\n```", "instruction": "Edit `truncFinset_monomial_eq_zero` so it still compiles and the proof is simplified where possible. Return the full updated `truncFinset_monomial_eq_zero` block.", "proof_is_oneliner": false, "target_span": "L104-L109", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 973, "declarations_count": 97, "diagnostics_count": 0, "duplicate_fingerprint": "83cdb96f9d7f55f2", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 337, "lean_code_chars": 201, "lean_code_ratio": 0.2066, "length_bucket": "tiny", "line_count": 14, "natural_language_chars": 772, "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.RingTheory.MvPowerSeries.Trunc).", "role": "system"}, {"content": "You are editing a file in `Mathlib/RingTheory/MvPowerSeries/Trunc.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.RingTheory.MvPowerSeries.Trunc.truncFinset_monomial_eq_zero`, L104-L109)\n```lean\ntheorem truncFinset_monomial_eq_zero {x : \u03c3 \u2192\u2080 \u2115} (r : R) (h : x \u2209 s) :\n truncFinset R s (monomial x r) = 0 := by\nclassical\n ext; simp [truncFinset, MvPolynomial.coeff_sum, coeff_monomial]\n grind\n```\n\n## Edit instruction\nEdit `truncFinset_monomial_eq_zero` so it still compiles and the proof is simplified where possible. Return the full updated `truncFinset_monomial_eq_zero` 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.RingTheory.MvPowerSeries.Trunc).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/RingTheory/MvPowerSeries/Trunc.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.RingTheory.MvPowerSeries.Trunc.truncFinset_monomial_eq_zero`, L104-L109)\n```lean\ntheorem truncFinset_monomial_eq_zero {x : \u03c3 \u2192\u2080 \u2115} (r : R) (h : x \u2209 s) :\n truncFinset R s (monomial x r) = 0 := by\nclassical\n ext; simp [truncFinset, MvPolynomial.coeff_sum, coeff_monomial]\n grind\n```\n\n## Edit instruction\nEdit `truncFinset_monomial_eq_zero` so it still compiles and the proof is simplified where possible. Return the full updated `truncFinset_monomial_eq_zero` block.\n[/INST]", "sample_id": "D-Mathlib.RingTheory.MvPowerSeries.Trunc.truncFinset_monomial_eq_zero", "source": {"declaration": "Mathlib.RingTheory.MvPowerSeries.Trunc.truncFinset_monomial_eq_zero", "file": "Mathlib/RingTheory/MvPowerSeries/Trunc.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.RingTheory.MvPowerSeries.Trunc", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/MvPowerSeries/Trunc.lean#L104", "span": "L104-L109"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "instance Prod.isEmpty_left {\u03b1 \u03b2} [IsEmpty \u03b1] : IsEmpty (\u03b1 \u00d7 \u03b2)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 465, "declarations_count": 50, "diagnostics_count": 0, "duplicate_fingerprint": "e52af8897b7f7cab", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 132, "lean_code_chars": 63, "lean_code_ratio": 0.1355, "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": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Logic.IsEmpty.Defs).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ninstance Prod.isEmpty_left {\u03b1 \u03b2} [IsEmpty \u03b1] : IsEmpty (\u03b1 \u00d7 \u03b2)\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.IsEmpty.Defs).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ninstance Prod.isEmpty_left {\u03b1 \u03b2} [IsEmpty \u03b1] : IsEmpty (\u03b1 \u00d7 \u03b2)\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.IsEmpty.Defs.Prod", "source": {"declaration": "Mathlib.Logic.IsEmpty.Defs.Prod", "file": "Mathlib/Logic/IsEmpty/Defs.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Logic.IsEmpty.Defs", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Logic/IsEmpty/Defs.lean#L61", "span": "L61-L63"}} {"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 root_apply_coroot {\u03b1 : Weight K H L} (h\u03b1 : \u03b1.IsNonZero) :\n \u03b1 (coroot \u03b1) = 2", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 596, "declarations_count": 55, "diagnostics_count": 0, "duplicate_fingerprint": "1687abacd0d070fe", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 182, "lean_code_chars": 85, "lean_code_ratio": 0.1426, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 511, "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.Algebra.Lie.Weights.Killing).", "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 root_apply_coroot {\u03b1 : Weight K H L} (h\u03b1 : \u03b1.IsNonZero) :\n \u03b1 (coroot \u03b1) = 2\n```\n\nDeclaration: `Mathlib.Algebra.Lie.Weights.Killing.root_apply_coroot` (module Mathlib.Algebra.Lie.Weights.Killing).", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.Lie.Weights.Killing).[/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 root_apply_coroot {\u03b1 : Weight K H L} (h\u03b1 : \u03b1.IsNonZero) :\n \u03b1 (coroot \u03b1) = 2\n```\n\nDeclaration: `Mathlib.Algebra.Lie.Weights.Killing.root_apply_coroot` (module Mathlib.Algebra.Lie.Weights.Killing).[/INST]", "sample_id": "F-Mathlib.Algebra.Lie.Weights.Killing.root_apply_coroot", "source": {"declaration": "Mathlib.Algebra.Lie.Weights.Killing.root_apply_coroot", "file": "Mathlib/Algebra/Lie/Weights/Killing.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Algebra.Lie.Weights.Killing", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Lie/Weights/Killing.lean#L449", "span": "L449-L453"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"trace_states": [{"state": "theorem induction_of_closure_eq_top_right {s : Set M} {motive : M \u2192 Prop} (hs : closure s = \u22a4)\n (x : M) (one : motive 1) (mul_right : \u2200 x, \u2200 y \u2208 s, motive x \u2192 motive (x * y)) : motive x", "tactic": "have : x \u2208 closure s := by simp [hs]"}, {"state": "", "tactic": "induction this using closure_induction_right with | one => exact one | mul_right x _ y hy ih => exact mul_right x y hy ih /-- The submonoid generated by an element. -/"}], "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1133, "declarations_count": 144, "diagnostics_count": 0, "duplicate_fingerprint": "7fa9b9fb3d9b060c", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 329, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "tiny", "line_count": 12, "natural_language_chars": 1133, "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.Algebra.Group.Submonoid.Membership).", "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.Algebra.Group.Submonoid.Membership.induction_of_closure_eq_top_right`:\nState 0: \u22a2 theorem induction_of_closure_eq_top_right {s : Set M} {motive : M \u2192 Prop} (hs : closure s = \u22a4)\n (x : M) (one : motive 1) (mul_right : \u2200 x, \u2200 y \u2208 s, motive x \u2192 motive (x * y)) : motive x\nTactic: have : x \u2208 closure s := by simp [hs]\nState 1: \u22a2 \nTactic: induction this using closure_induction_right with | one => exact one | mul_right x _ y hy ih => exact mul_right x y hy ih /-- The submonoid generated by an element. -/\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.Algebra.Group.Submonoid.Membership).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.Algebra.Group.Submonoid.Membership.induction_of_closure_eq_top_right`:\nState 0: \u22a2 theorem induction_of_closure_eq_top_right {s : Set M} {motive : M \u2192 Prop} (hs : closure s = \u22a4)\n (x : M) (one : motive 1) (mul_right : \u2200 x, \u2200 y \u2208 s, motive x \u2192 motive (x * y)) : motive x\nTactic: have : x \u2208 closure s := by simp [hs]\nState 1: \u22a2 \nTactic: induction this using closure_induction_right with | one => exact one | mul_right x _ y hy ih => exact mul_right x y hy ih /-- The submonoid generated by an element. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.Algebra.Group.Submonoid.Membership.induction_of_closure_eq_top_right", "source": {"declaration": "Mathlib.Algebra.Group.Submonoid.Membership.induction_of_closure_eq_top_right", "file": "Mathlib/Algebra/Group/Submonoid/Membership.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Algebra.Group.Submonoid.Membership", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Group/Submonoid/Membership.lean#L297", "span": "L297-L304"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "theorem inhomogeneousCochains.d_def (n : \u2115) :\n (inhomogeneousCochains A).d n (n + 1) = d A n\n:= by thisIsWrongLemmaNameXYZ\nsimp", "diagnostic": "[CompilationUnit(i_begin=0, i_end=105, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n inhomogeneousCochains\\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 `inhomogeneousCochains` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=5), pos_end=Position(line=2, column=28), severity=, kind=None), Message(data='unsolved goals\\nx\u271d : Sort u_1\\ninhomogeneousCochains : x\u271d\\n\u03b1\u271d M\u271d : Type u_2\\ns\u271d : CommRing \u03b1\u271d\\ninst\u271d : Monoid M\u271d\\nA : Rep.{u_3, u_2, u_2} \u03b1\u271d M\u271d\\nn : \u2115\\n\u22a2 sorry = d A n', pos=Position(line=3, column=3), pos_end=Position(line=3, column=29), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=105, i_end=132, 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": 1983, "declarations_count": 248, "diagnostics_count": 1, "duplicate_fingerprint": "29afdc9fdbee1a53", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 605, "lean_code_chars": 131, "lean_code_ratio": 0.0661, "length_bucket": "short", "line_count": 15, "natural_language_chars": 1852, "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.RepresentationTheory.Homological.GroupCohomology.Basic).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem inhomogeneousCochains.d_def (n : \u2115) :\n (inhomogeneousCochains A).d n (n + 1) = d A n\n:= by thisIsWrongLemmaNameXYZ\nsimp\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=105, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n inhomogeneousCochains\\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 `inhomogeneousCochains` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=5), pos_end=Position(line=2, column=28), severity=, kind=None), Message(data='unsolved goals\\nx\u271d : Sort u_1\\ninhomogeneousCochains : x\u271d\\n\u03b1\u271d M\u271d : Type u_2\\ns\u271d : CommRing \u03b1\u271d\\ninst\u271d : Monoid M\u271d\\nA : Rep.{u_3, u_2, u_2} \u03b1\u271d M\u271d\\nn : \u2115\\n\u22a2 sorry = d A n', pos=Position(line=3, column=3), pos_end=Position(line=3, column=29), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=105, i_end=132, 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.RepresentationTheory.Homological.GroupCohomology.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem inhomogeneousCochains.d_def (n : \u2115) :\n (inhomogeneousCochains A).d n (n + 1) = d A n\n:= by thisIsWrongLemmaNameXYZ\nsimp\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=105, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n inhomogeneousCochains\\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 `inhomogeneousCochains` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=5), pos_end=Position(line=2, column=28), severity=, kind=None), Message(data='unsolved goals\\nx\u271d : Sort u_1\\ninhomogeneousCochains : x\u271d\\n\u03b1\u271d M\u271d : Type u_2\\ns\u271d : CommRing \u03b1\u271d\\ninst\u271d : Monoid M\u271d\\nA : Rep.{u_3, u_2, u_2} \u03b1\u271d M\u271d\\nn : \u2115\\n\u22a2 sorry = d A n', pos=Position(line=3, column=3), pos_end=Position(line=3, column=29), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=105, i_end=132, 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.RepresentationTheory.Homological.GroupCohomology.Basic.inhomogeneousCochains", "source": {"declaration": "Mathlib.RepresentationTheory.Homological.GroupCohomology.Basic.inhomogeneousCochains", "file": "Mathlib/RepresentationTheory/Homological/GroupCohomology/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.RepresentationTheory.Homological.GroupCohomology.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RepresentationTheory/Homological/GroupCohomology/Basic.lean#L137", "span": "L137-L140"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\ntheorem ContDiffAt.sqrt (hf : ContDiffAt \u211d n f x) (hx : f x \u2260 0) :\n ContDiffAt \u211d n (fun y => \u221a(f y)) x := (contDiffAt_sqrt hx).comp x hf\n```", "instruction": "Edit `ContDiffAt` so it still compiles and the proof is simplified where possible. Return the full updated `ContDiffAt` block.", "proof_is_oneliner": false, "target_span": "L150-L153", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 858, "declarations_count": 97, "diagnostics_count": 0, "duplicate_fingerprint": "4e906b748de6c22e", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 284, "lean_code_chars": 140, "lean_code_ratio": 0.1632, "length_bucket": "tiny", "line_count": 11, "natural_language_chars": 718, "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.Analysis.SpecialFunctions.Sqrt).", "role": "system"}, {"content": "You are editing a file in `Mathlib/Analysis/SpecialFunctions/Sqrt.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Analysis.SpecialFunctions.Sqrt.ContDiffAt`, L150-L153)\n```lean\ntheorem ContDiffAt.sqrt (hf : ContDiffAt \u211d n f x) (hx : f x \u2260 0) :\n ContDiffAt \u211d n (fun y => \u221a(f y)) x := (contDiffAt_sqrt hx).comp x hf\n```\n\n## Edit instruction\nEdit `ContDiffAt` so it still compiles and the proof is simplified where possible. Return the full updated `ContDiffAt` 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.Analysis.SpecialFunctions.Sqrt).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Analysis/SpecialFunctions/Sqrt.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Analysis.SpecialFunctions.Sqrt.ContDiffAt`, L150-L153)\n```lean\ntheorem ContDiffAt.sqrt (hf : ContDiffAt \u211d n f x) (hx : f x \u2260 0) :\n ContDiffAt \u211d n (fun y => \u221a(f y)) x := (contDiffAt_sqrt hx).comp x hf\n```\n\n## Edit instruction\nEdit `ContDiffAt` so it still compiles and the proof is simplified where possible. Return the full updated `ContDiffAt` block.\n[/INST]", "sample_id": "D-Mathlib.Analysis.SpecialFunctions.Sqrt.ContDiffAt", "source": {"declaration": "Mathlib.Analysis.SpecialFunctions.Sqrt.ContDiffAt", "file": "Mathlib/Analysis/SpecialFunctions/Sqrt.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Analysis.SpecialFunctions.Sqrt", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/SpecialFunctions/Sqrt.lean#L150", "span": "L150-L153"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\ndef toArithmeticFunction {R : Type*} [Zero R] (f : \u2115 \u2192 R) : ArithmeticFunction R where\n toFun n := if n = 0 then 0 else f n\nmap_zero' := rfl\n```", "instruction": "Edit `toArithmeticFunction` so it still compiles and the proof is simplified where possible. Return the full updated `toArithmeticFunction` block.", "proof_is_oneliner": false, "target_span": "L40-L43", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 894, "declarations_count": 96, "diagnostics_count": 0, "duplicate_fingerprint": "534b292085bc8f03", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 273, "lean_code_chars": 142, "lean_code_ratio": 0.1588, "length_bucket": "tiny", "line_count": 12, "natural_language_chars": 752, "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.NumberTheory.LSeries.Convolution).", "role": "system"}, {"content": "You are editing a file in `Mathlib/NumberTheory/LSeries/Convolution.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.NumberTheory.LSeries.Convolution.toArithmeticFunction`, L40-L43)\n```lean\ndef toArithmeticFunction {R : Type*} [Zero R] (f : \u2115 \u2192 R) : ArithmeticFunction R where\n toFun n := if n = 0 then 0 else f n\nmap_zero' := rfl\n```\n\n## Edit instruction\nEdit `toArithmeticFunction` so it still compiles and the proof is simplified where possible. Return the full updated `toArithmeticFunction` 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.NumberTheory.LSeries.Convolution).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/NumberTheory/LSeries/Convolution.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.NumberTheory.LSeries.Convolution.toArithmeticFunction`, L40-L43)\n```lean\ndef toArithmeticFunction {R : Type*} [Zero R] (f : \u2115 \u2192 R) : ArithmeticFunction R where\n toFun n := if n = 0 then 0 else f n\nmap_zero' := rfl\n```\n\n## Edit instruction\nEdit `toArithmeticFunction` so it still compiles and the proof is simplified where possible. Return the full updated `toArithmeticFunction` block.\n[/INST]", "sample_id": "D-Mathlib.NumberTheory.LSeries.Convolution.toArithmeticFunction", "source": {"declaration": "Mathlib.NumberTheory.LSeries.Convolution.toArithmeticFunction", "file": "Mathlib/NumberTheory/LSeries/Convolution.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.NumberTheory.LSeries.Convolution", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/LSeries/Convolution.lean#L40", "span": "L40-L43"}} {"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 Cone.toStructuredArrow_comp_proj {F : J \u2964 C} (c : Cone F) :\n c.toStructuredArrow \u22d9 StructuredArrow.proj _ _ = \ud835\udfed J", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 642, "declarations_count": 59, "diagnostics_count": 0, "duplicate_fingerprint": "1b3b7ac9914c13c2", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 188, "lean_code_chars": 123, "lean_code_ratio": 0.1916, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 519, "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.CategoryTheory.Limits.ConeCategory).", "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 Cone.toStructuredArrow_comp_proj {F : J \u2964 C} (c : Cone F) :\n c.toStructuredArrow \u22d9 StructuredArrow.proj _ _ = \ud835\udfed J\n```\n\nDeclaration: `Mathlib.CategoryTheory.Limits.ConeCategory.Cone` (module Mathlib.CategoryTheory.Limits.ConeCategory).", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Limits.ConeCategory).[/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 Cone.toStructuredArrow_comp_proj {F : J \u2964 C} (c : Cone F) :\n c.toStructuredArrow \u22d9 StructuredArrow.proj _ _ = \ud835\udfed J\n```\n\nDeclaration: `Mathlib.CategoryTheory.Limits.ConeCategory.Cone` (module Mathlib.CategoryTheory.Limits.ConeCategory).[/INST]", "sample_id": "F-Mathlib.CategoryTheory.Limits.ConeCategory.Cone", "source": {"declaration": "Mathlib.CategoryTheory.Limits.ConeCategory.Cone", "file": "Mathlib/CategoryTheory/Limits/ConeCategory.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.CategoryTheory.Limits.ConeCategory", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Limits/ConeCategory.lean#L75", "span": "L75-L81"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem norm_lt_one_add {z1 z2 : \u2124_[p]} (hz1 : \u2016z1\u2016 < 1) (hz2 : \u2016z2\u2016 < 1) : \u2016z1 + z2\u2016 < 1", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 507, "declarations_count": 58, "diagnostics_count": 0, "duplicate_fingerprint": "9ef4d2731190013f", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 177, "lean_code_chars": 90, "lean_code_ratio": 0.1775, "length_bucket": "tiny", "line_count": 7, "natural_language_chars": 417, "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.NumberTheory.Padics.PadicIntegers).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem norm_lt_one_add {z1 z2 : \u2124_[p]} (hz1 : \u2016z1\u2016 < 1) (hz2 : \u2016z2\u2016 < 1) : \u2016z1 + z2\u2016 < 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.NumberTheory.Padics.PadicIntegers).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem norm_lt_one_add {z1 z2 : \u2124_[p]} (hz1 : \u2016z1\u2016 < 1) (hz2 : \u2016z2\u2016 < 1) : \u2016z1 + z2\u2016 < 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.NumberTheory.Padics.PadicIntegers.norm_lt_one_add", "source": {"declaration": "Mathlib.NumberTheory.Padics.PadicIntegers.norm_lt_one_add", "file": "Mathlib/NumberTheory/Padics/PadicIntegers.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.NumberTheory.Padics.PadicIntegers", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/Padics/PadicIntegers.lean#L375", "span": "L375-L377"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem restrict_mono' {_m0 : MeasurableSpace \u03b1} \u2983s s' : Set \u03b1\u2984 \u2983\u03bc \u03bd : Measure \u03b1\u2984 (hs : s \u2264\u1d50[\u03bc] s')\n (h\u03bc\u03bd : \u03bc \u2264 \u03bd) : \u03bc.restrict s \u2264 \u03bd.restrict s'", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 563, "declarations_count": 62, "diagnostics_count": 0, "duplicate_fingerprint": "06ddda1298eff439", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 188, "lean_code_chars": 149, "lean_code_ratio": 0.2647, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 414, "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.MeasureTheory.Measure.Restrict).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem restrict_mono' {_m0 : MeasurableSpace \u03b1} \u2983s s' : Set \u03b1\u2984 \u2983\u03bc \u03bd : Measure \u03b1\u2984 (hs : s \u2264\u1d50[\u03bc] s')\n (h\u03bc\u03bd : \u03bc \u2264 \u03bd) : \u03bc.restrict s \u2264 \u03bd.restrict s'\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.MeasureTheory.Measure.Restrict).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem restrict_mono' {_m0 : MeasurableSpace \u03b1} \u2983s s' : Set \u03b1\u2984 \u2983\u03bc \u03bd : Measure \u03b1\u2984 (hs : s \u2264\u1d50[\u03bc] s')\n (h\u03bc\u03bd : \u03bc \u2264 \u03bd) : \u03bc.restrict s \u2264 \u03bd.restrict s'\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.MeasureTheory.Measure.Restrict.restrict_mono'", "source": {"declaration": "Mathlib.MeasureTheory.Measure.Restrict.restrict_mono'", "file": "Mathlib/MeasureTheory/Measure/Restrict.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.MeasureTheory.Measure.Restrict", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Measure/Restrict.lean#L78", "span": "L78-L86"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.vsub_right_mem_direction_iff_mem (L56-L62)\ntheorem vsub_right_mem_direction_iff_mem {s : AffineSubspace k P} {p : P} (hp : p \u2208 s) (p\u2082 : P) :\n p\u2082 -\u1d65 p \u2208 s.direction \u2194 p\u2082 \u2208 s := by\nrw [mem_direction_iff_eq_vsub_right hp]\n simp\n\n/-- Given a point in an affine subspace, a result of subtracting that point on the left is in the\ndirection if and only if the other point is in the subspace. -/", "-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.vsub_left_mem_direction_iff_mem (L63-L67)\ntheorem vsub_left_mem_direction_iff_mem {s : AffineSubspace k P} {p : P} (hp : p \u2208 s) (p\u2082 : P) :\n p -\u1d65 p\u2082 \u2208 s.direction \u2194 p\u2082 \u2208 s := by\nrw [mem_direction_iff_eq_vsub_left hp]\n simp", "-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.toAddTorsor (L68-L83)\ninstance toAddTorsor (s : AffineSubspace k P) [Nonempty s] : AddTorsor s.direction s where\n vadd a b := \u27e8(a : V) +\u1d65 (b : P), vadd_mem_of_mem_direction a.2 b.2\u27e9\nzero_vadd := fun a => by\n ext\n exact zero_vadd _ _\n add_vadd a b c := by\n ext\n apply add_vadd\n vsub a b := \u27e8(a : P) -\u1d65 (b : P), (vsub_left_mem_direction_iff_mem a.2 _).mpr b.2\u27e9\n vsub_vadd' a b := by\n ext\n apply AddTorsor.vsub_vadd'\n vadd_vsub' a b := by\n ext\n apply AddTorsor.vadd_vsub'", "-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.coe_vsub (L85-L87)\ntheorem coe_vsub (s : AffineSubspace k P) [Nonempty s] (a b : s) : \u2191(a -\u1d65 b) = (a : P) -\u1d65 (b : P) :=\nrfl", "-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.coe_vadd (L89-L98)\ntheorem coe_vadd (s : AffineSubspace k P) [Nonempty s] (a : s.direction) (b : s) :\n \u2191(a +\u1d65 b) = (a : V) +\u1d65 (b : P) :=\nrfl\n\n/-- Embedding of an affine subspace to the ambient space, as an affine map. -/\nprotected def subtype (s : AffineSubspace k P) [Nonempty s] : s \u2192\u1d43[k] P where\n toFun := (\u2191)\n linear := s.direction.subtype\n map_vadd' _ _ := rfl", "-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.subtype_linear (L100-L102)\ntheorem subtype_linear (s : AffineSubspace k P) [Nonempty s] :\n s.subtype.linear = s.direction.subtype := rfl", "-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.subtype_apply (L104-L106)\ntheorem subtype_apply {s : AffineSubspace k P} [Nonempty s] (p : s) : s.subtype p = p :=\nrfl", "-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.subtype_injective (L107-L109)\ntheorem subtype_injective (s : AffineSubspace k P) [Nonempty s] : Function.Injective s.subtype :=\nSubtype.coe_injective", "-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.coe_subtype (L111-L115)\ntheorem coe_subtype (s : AffineSubspace k P) [Nonempty s] : (s.subtype : s \u2192 P) = ((\u2191) : s \u2192 P) :=\nrfl\n\nend AffineSubspace", "-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.coe_affineSpan_singleton (L137-L143)\ntheorem coe_affineSpan_singleton (p : P) : (affineSpan k ({p} : Set P) : Set P) = {p} := by\next x\n rw [mem_coe, \u2190 vsub_right_mem_direction_iff_mem (mem_affineSpan k (Set.mem_singleton p)) _,\n direction_affineSpan]\n simp\n\n/-- A point is in the affine span of a single point if and only if they are equal. -/", "-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.mem_affineSpan_singleton (L145-L147)\ntheorem mem_affineSpan_singleton : p\u2081 \u2208 affineSpan k ({p\u2082} : Set P) \u2194 p\u2081 = p\u2082 := by\nsimp [\u2190 mem_coe]", "-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.unique_affineSpan_singleton (L148-L151)\ninstance unique_affineSpan_singleton (p : P) : Unique (affineSpan k {p}) where\n default := \u27e8p, mem_affineSpan _ (Set.mem_singleton _)\u27e9\nuniq := fun x \u21a6 Subtype.ext ((mem_affineSpan_singleton _ _).1 x.property)", "-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.preimage_coe_affineSpan_singleton (L153-L160)\ntheorem preimage_coe_affineSpan_singleton (x : P) :\n ((\u2191) : affineSpan k ({x} : Set P) \u2192 P) \u207b\u00b9' {x} = univ :=\neq_univ_of_forall fun y => (AffineSubspace.mem_affineSpan_singleton _ _).1 y.2\n\nvariable (P)\n\n/-- The top affine subspace is linearly equivalent to the affine space.\nThis is the affine version of `Submodule.topEquiv`. -/", "-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.topEquiv (L162-L168)\ndef topEquiv : (\u22a4 : AffineSubspace k P) \u2243\u1d43[k] P where\n toEquiv := Equiv.Set.univ P\nlinear := .ofEq _ _ (direction_top _ _ _) \u226a\u226b\u2097 Submodule.topEquiv\n map_vadd' _ _ := rfl\n\nvariable {k V P}", "-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.subsingleton_of_subsingleton_span_eq_top (L169-L176)\ntheorem subsingleton_of_subsingleton_span_eq_top {s : Set P} (h\u2081 : s.Subsingleton)\n (h\u2082 : affineSpan k s = \u22a4) : Subsingleton P := by\nobtain \u27e8p, hp\u27e9 := AffineSubspace.nonempty_of_affineSpan_eq_top k V P h\u2082\n have : s = {p} := Subset.antisymm (fun q hq => h\u2081 hq hp) (by simp [hp])\n rw [this, AffineSubspace.ext_iff, AffineSubspace.coe_affineSpan_singleton,\n AffineSubspace.top_coe, eq_comm, \u2190 subsingleton_iff_singleton (mem_univ _)] at h\u2082\n exact subsingleton_of_univ_subsingleton h\u2082", "-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.coe_mk' (L153-L155)\ntheorem coe_mk' (e : P\u2081 \u2243 P\u2082) (e' : V\u2081 \u2243\u2097[k] V\u2082) (p h) : \u21d1(mk' e e' p h) = e :=\nrfl", "-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.toEquiv_inj (L132-L134)\ntheorem toEquiv_inj {e e' : P\u2081 \u2243\u1d43[k] P\u2082} : e.toEquiv = e'.toEquiv \u2194 e = e' :=\ntoEquiv_injective.eq_iff", "-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.map_vadd (L96-L98)\ntheorem map_vadd (e : P\u2081 \u2243\u1d43[k] P\u2082) (p : P\u2081) (v : V\u2081) : e (v +\u1d65 p) = e.linear v +\u1d65 e p :=\ne.map_vadd' p v", "-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.linear_toAffineMap (L74-L76)\ntheorem linear_toAffineMap (e : P\u2081 \u2243\u1d43[k] P\u2082) : e.toAffineMap.linear = e.linear :=\nrfl", "-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.coeFn_injective (L122-L124)\ntheorem coeFn_injective : @Injective (P\u2081 \u2243\u1d43[k] P\u2082) (P\u2081 \u2192 P\u2082) (\u21d1) :=\nDFunLike.coe_injective", "-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.coe_coe (L111-L113)\ntheorem coe_coe (e : P\u2081 \u2243\u1d43[k] P\u2082) : ((e : P\u2081 \u2192\u1d43[k] P\u2082) : P\u2081 \u2192 P\u2082) = e :=\nrfl", "-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.coe_symm_toEquiv (L175-L177)\ntheorem coe_symm_toEquiv (e : P\u2081 \u2243\u1d43[k] P\u2082) : \u21d1e.toEquiv.symm = e.symm :=\nrfl", "-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.coe_toAffineMap (L107-L109)\ntheorem coe_toAffineMap (e : P\u2081 \u2243\u1d43[k] P\u2082) : (e.toAffineMap : P\u2081 \u2192 P\u2082) = (e : P\u2081 \u2192 P\u2082) :=\nrfl", "-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.mk' (L143-L151)\ndef mk' (e : P\u2081 \u2192 P\u2082) (e' : V\u2081 \u2243\u2097[k] V\u2082) (p : P\u2081) (h : \u2200 p' : P\u2081, e p' = e' (p' -\u1d65 p) +\u1d65 e p) :\n P\u2081 \u2243\u1d43[k] P\u2082 where\n toFun := e\ninvFun := fun q' : P\u2082 => e'.symm (q' -\u1d65 e p) +\u1d65 p\n left_inv p' := by simp [h p', vadd_vsub, vsub_vadd]\n right_inv q' := by simp [h (e'.symm (q' -\u1d65 e p) +\u1d65 p), vadd_vsub, vsub_vadd]\n linear := e'\n map_vadd' p' v := by simp [h p', h (v +\u1d65 p'), vadd_vsub_assoc, vadd_vadd]", "-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.coe_linear (L115-L117)\ntheorem coe_linear (e : P\u2081 \u2243\u1d43[k] P\u2082) : (e : P\u2081 \u2192\u1d43[k] P\u2082).linear = e.linear :=\nrfl", "-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.coe_mk (L136-L142)\ntheorem coe_mk (e : P\u2081 \u2243 P\u2082) (e' : V\u2081 \u2243\u2097[k] V\u2082) (h) : ((\u27e8e, e', h\u27e9 : P\u2081 \u2243\u1d43[k] P\u2082) : P\u2081 \u2192 P\u2082) = e :=\nrfl\n\n/-- Construct an affine equivalence by verifying the relation between the map and its linear part at\none base point. Namely, this function takes a map `e : P\u2081 \u2192 P\u2082`, a linear equivalence\n`e' : V\u2081 \u2243\u2097[k] V\u2082`, and a point `p` such that for any other point `p'` we have\n`e p' = e' (p' -\u1d65 p) +\u1d65 e p`. -/", "-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.equivLike (L85-L91)\ninstance equivLike : EquivLike (P\u2081 \u2243\u1d43[k] P\u2082) P\u2081 P\u2082 where\n coe f := f.toFun\ninv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' _ _ h _ := toAffineMap_injective (DFunLike.coe_injective h)", "-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.toEquiv_symm (L171-L173)\ntheorem toEquiv_symm (e : P\u2081 \u2243\u1d43[k] P\u2082) : e.symm.toEquiv = e.toEquiv.symm :=\nrfl", "-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.symm (L162-L169)\ndef symm (e : P\u2081 \u2243\u1d43[k] P\u2082) : P\u2082 \u2243\u1d43[k] P\u2081 where\n toEquiv := e.toEquiv.symm\nlinear := e.linear.symm\n map_vadd' p v :=\n e.toEquiv.symm.apply_eq_iff_eq_symm_apply.2 <| by\n rw [Equiv.symm_symm, e.map_vadd' ((Equiv.symm e.toEquiv) p) ((LinearEquiv.symm e.linear) v),\n LinearEquiv.apply_symm_apply, Equiv.apply_symm_apply]", "-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.toAffineMap (L65-L67)\ndef toAffineMap (e : P\u2081 \u2243\u1d43[k] P\u2082) : P\u2081 \u2192\u1d43[k] P\u2082 :=\n{ e with }", "-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.coe_toEquiv (L100-L102)\ntheorem coe_toEquiv (e : P\u2081 \u2243\u1d43[k] P\u2082) : \u21d1e.toEquiv = e :=\nrfl", "-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.Simps (L183-L186)\ndef Simps.apply (e : P\u2081 \u2243\u1d43[k] P\u2082) : P\u2081 \u2192 P\u2082 :=\ne\n\n/-- See Note [custom simps projection] -/", "-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.linear_symm (L179-L182)\ntheorem linear_symm (e : P\u2081 \u2243\u1d43[k] P\u2082) : e.symm.linear = e.linear.symm :=\nrfl\n\n/-- See Note [custom simps projection] -/", "-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.toAffineMap_injective (L77-L80)\ntheorem toAffineMap_injective : Injective (toAffineMap : (P\u2081 \u2243\u1d43[k] P\u2082) \u2192 P\u2081 \u2192\u1d43[k] P\u2082) := by\nrintro \u27e8e, el, h\u27e9 \u27e8e', el', h'\u27e9 H\n simp_all", "-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.toAffineMap_mk (L69-L72)\ntheorem toAffineMap_mk (f : P\u2081 \u2243 P\u2082) (f' : V\u2081 \u2243\u2097[k] V\u2082) (h) :\n toAffineMap (mk f f' h) = \u27e8f, f', h\u27e9 :=\nrfl", "-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.toEquiv_injective (L128-L130)\ntheorem toEquiv_injective : Injective (toEquiv : (P\u2081 \u2243\u1d43[k] P\u2082) \u2192 P\u2081 \u2243 P\u2082) := fun _ _ H =>\next <| Equiv.ext_iff.1 H", "-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.toAffineMap_inj (L82-L84)\ntheorem toAffineMap_inj {e e' : P\u2081 \u2243\u1d43[k] P\u2082} : e.toAffineMap = e'.toAffineMap \u2194 e = e' :=\ntoAffineMap_injective.eq_iff", "-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.coeFn_inj (L126-L127)\ntheorem coeFn_inj {e e' : P\u2081 \u2243\u1d43[k] P\u2082} : (e : P\u2081 \u2192 P\u2082) = e' \u2194 e = e' := by simp", "-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.ext (L119-L121)\ntheorem ext {e e' : P\u2081 \u2243\u1d43[k] P\u2082} (h : \u2200 x, e x = e' x) : e = e' :=\nDFunLike.ext _ _ h", "-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.linear_mk' (L157-L160)\ntheorem linear_mk' (e : P\u2081 \u2243 P\u2082) (e' : V\u2081 \u2243\u2097[k] V\u2082) (p h) : (mk' e e' p h).linear = e' :=\nrfl\n\n/-- Inverse of an affine equivalence as an affine equivalence. -/"], "statement": "theorem AffineMap.map_vectorSpan {s : Set P\u2081} :\n Submodule.map f.linear (vectorSpan k s) = vectorSpan k (f '' s)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 11743, "declarations_count": 1227, "diagnostics_count": 0, "duplicate_fingerprint": "f117462ca95d54cb", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 4838, "lean_code_chars": 10220, "lean_code_ratio": 0.8703, "length_bucket": "medium", "line_count": 365, "natural_language_chars": 1523, "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.LinearAlgebra.AffineSpace.AffineSubspace.Basic).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem AffineMap.map_vectorSpan {s : Set P\u2081} :\n Submodule.map f.linear (vectorSpan k s) = vectorSpan k (f '' s)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.vsub_right_mem_direction_iff_mem (L56-L62)\ntheorem vsub_right_mem_direction_iff_mem {s : AffineSubspace k P} {p : P} (hp : p \u2208 s) (p\u2082 : P) :\n p\u2082 -\u1d65 p \u2208 s.direction \u2194 p\u2082 \u2208 s := by\nrw [mem_direction_iff_eq_vsub_right hp]\n simp\n\n/-- Given a point in an affine subspace, a result of subtracting that point on the left is in the\ndirection if and only if the other point is in the subspace. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.vsub_left_mem_direction_iff_mem (L63-L67)\ntheorem vsub_left_mem_direction_iff_mem {s : AffineSubspace k P} {p : P} (hp : p \u2208 s) (p\u2082 : P) :\n p -\u1d65 p\u2082 \u2208 s.direction \u2194 p\u2082 \u2208 s := by\nrw [mem_direction_iff_eq_vsub_left hp]\n simp\n```\n\n-- snippet 3\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.toAddTorsor (L68-L83)\ninstance toAddTorsor (s : AffineSubspace k P) [Nonempty s] : AddTorsor s.direction s where\n vadd a b := \u27e8(a : V) +\u1d65 (b : P), vadd_mem_of_mem_direction a.2 b.2\u27e9\nzero_vadd := fun a => by\n ext\n exact zero_vadd _ _\n add_vadd a b c := by\n ext\n apply add_vadd\n vsub a b := \u27e8(a : P) -\u1d65 (b : P), (vsub_left_mem_direction_iff_mem a.2 _).mpr b.2\u27e9\n vsub_vadd' a b := by\n ext\n apply AddTorsor.vsub_vadd'\n vadd_vsub' a b := by\n ext\n apply AddTorsor.vadd_vsub'\n```\n\n-- snippet 4\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.coe_vsub (L85-L87)\ntheorem coe_vsub (s : AffineSubspace k P) [Nonempty s] (a b : s) : \u2191(a -\u1d65 b) = (a : P) -\u1d65 (b : P) :=\nrfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.coe_vadd (L89-L98)\ntheorem coe_vadd (s : AffineSubspace k P) [Nonempty s] (a : s.direction) (b : s) :\n \u2191(a +\u1d65 b) = (a : V) +\u1d65 (b : P) :=\nrfl\n\n/-- Embedding of an affine subspace to the ambient space, as an affine map. -/\nprotected def subtype (s : AffineSubspace k P) [Nonempty s] : s \u2192\u1d43[k] P where\n toFun := (\u2191)\n linear := s.direction.subtype\n map_vadd' _ _ := rfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.subtype_linear (L100-L102)\ntheorem subtype_linear (s : AffineSubspace k P) [Nonempty s] :\n s.subtype.linear = s.direction.subtype := rfl\n```\n\n-- snippet 7\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.subtype_apply (L104-L106)\ntheorem subtype_apply {s : AffineSubspace k P} [Nonempty s] (p : s) : s.subtype p = p :=\nrfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.subtype_injective (L107-L109)\ntheorem subtype_injective (s : AffineSubspace k P) [Nonempty s] : Function.Injective s.subtype :=\nSubtype.coe_injective\n```\n\n-- snippet 9\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.coe_subtype (L111-L115)\ntheorem coe_subtype (s : AffineSubspace k P) [Nonempty s] : (s.subtype : s \u2192 P) = ((\u2191) : s \u2192 P) :=\nrfl\n\nend AffineSubspace\n```\n\n-- snippet 10\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.coe_affineSpan_singleton (L137-L143)\ntheorem coe_affineSpan_singleton (p : P) : (affineSpan k ({p} : Set P) : Set P) = {p} := by\next x\n rw [mem_coe, \u2190 vsub_right_mem_direction_iff_mem (mem_affineSpan k (Set.mem_singleton p)) _,\n direction_affineSpan]\n simp\n\n/-- A point is in the affine span of a single point if and only if they are equal. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.mem_affineSpan_singleton (L145-L147)\ntheorem mem_affineSpan_singleton : p\u2081 \u2208 affineSpan k ({p\u2082} : Set P) \u2194 p\u2081 = p\u2082 := by\nsimp [\u2190 mem_coe]\n```\n\n-- snippet 12\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.unique_affineSpan_singleton (L148-L151)\ninstance unique_affineSpan_singleton (p : P) : Unique (affineSpan k {p}) where\n default := \u27e8p, mem_affineSpan _ (Set.mem_singleton _)\u27e9\nuniq := fun x \u21a6 Subtype.ext ((mem_affineSpan_singleton _ _).1 x.property)\n```\n\n-- snippet 13\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.preimage_coe_affineSpan_singleton (L153-L160)\ntheorem preimage_coe_affineSpan_singleton (x : P) :\n ((\u2191) : affineSpan k ({x} : Set P) \u2192 P) \u207b\u00b9' {x} = univ :=\neq_univ_of_forall fun y => (AffineSubspace.mem_affineSpan_singleton _ _).1 y.2\n\nvariable (P)\n\n/-- The top affine subspace is linearly equivalent to the affine space.\nThis is the affine version of `Submodule.topEquiv`. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.topEquiv (L162-L168)\ndef topEquiv : (\u22a4 : AffineSubspace k P) \u2243\u1d43[k] P where\n toEquiv := Equiv.Set.univ P\nlinear := .ofEq _ _ (direction_top _ _ _) \u226a\u226b\u2097 Submodule.topEquiv\n map_vadd' _ _ := rfl\n\nvariable {k V P}\n```\n\n-- snippet 15\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.subsingleton_of_subsingleton_span_eq_top (L169-L176)\ntheorem subsingleton_of_subsingleton_span_eq_top {s : Set P} (h\u2081 : s.Subsingleton)\n (h\u2082 : affineSpan k s = \u22a4) : Subsingleton P := by\nobtain \u27e8p, hp\u27e9 := AffineSubspace.nonempty_of_affineSpan_eq_top k V P h\u2082\n have : s = {p} := Subset.antisymm (fun q hq => h\u2081 hq hp) (by simp [hp])\n rw [this, AffineSubspace.ext_iff, AffineSubspace.coe_affineSpan_singleton,\n AffineSubspace.top_coe, eq_comm, \u2190 subsingleton_iff_singleton (mem_univ _)] at h\u2082\n exact subsingleton_of_univ_subsingleton h\u2082\n```\n\n-- snippet 16\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.coe_mk' (L153-L155)\ntheorem coe_mk' (e : P\u2081 \u2243 P\u2082) (e' : V\u2081 \u2243\u2097[k] V\u2082) (p h) : \u21d1(mk' e e' p h) = e :=\nrfl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.toEquiv_inj (L132-L134)\ntheorem toEquiv_inj {e e' : P\u2081 \u2243\u1d43[k] P\u2082} : e.toEquiv = e'.toEquiv \u2194 e = e' :=\ntoEquiv_injective.eq_iff\n```\n\n-- snippet 18\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.map_vadd (L96-L98)\ntheorem map_vadd (e : P\u2081 \u2243\u1d43[k] P\u2082) (p : P\u2081) (v : V\u2081) : e (v +\u1d65 p) = e.linear v +\u1d65 e p :=\ne.map_vadd' p v\n```\n\n-- snippet 19\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.linear_toAffineMap (L74-L76)\ntheorem linear_toAffineMap (e : P\u2081 \u2243\u1d43[k] P\u2082) : e.toAffineMap.linear = e.linear :=\nrfl\n```\n\n-- snippet 20\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.coeFn_injective (L122-L124)\ntheorem coeFn_injective : @Injective (P\u2081 \u2243\u1d43[k] P\u2082) (P\u2081 \u2192 P\u2082) (\u21d1) :=\nDFunLike.coe_injective\n```\n\n-- snippet 21\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.coe_coe (L111-L113)\ntheorem coe_coe (e : P\u2081 \u2243\u1d43[k] P\u2082) : ((e : P\u2081 \u2192\u1d43[k] P\u2082) : P\u2081 \u2192 P\u2082) = e :=\nrfl\n```\n\n-- snippet 22\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.coe_symm_toEquiv (L175-L177)\ntheorem coe_symm_toEquiv (e : P\u2081 \u2243\u1d43[k] P\u2082) : \u21d1e.toEquiv.symm = e.symm :=\nrfl\n```\n\n-- snippet 23\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.coe_toAffineMap (L107-L109)\ntheorem coe_toAffineMap (e : P\u2081 \u2243\u1d43[k] P\u2082) : (e.toAffineMap : P\u2081 \u2192 P\u2082) = (e : P\u2081 \u2192 P\u2082) :=\nrfl\n```\n\n-- snippet 24\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.mk' (L143-L151)\ndef mk' (e : P\u2081 \u2192 P\u2082) (e' : V\u2081 \u2243\u2097[k] V\u2082) (p : P\u2081) (h : \u2200 p' : P\u2081, e p' = e' (p' -\u1d65 p) +\u1d65 e p) :\n P\u2081 \u2243\u1d43[k] P\u2082 where\n toFun := e\ninvFun := fun q' : P\u2082 => e'.symm (q' -\u1d65 e p) +\u1d65 p\n left_inv p' := by simp [h p', vadd_vsub, vsub_vadd]\n right_inv q' := by simp [h (e'.symm (q' -\u1d65 e p) +\u1d65 p), vadd_vsub, vsub_vadd]\n linear := e'\n map_vadd' p' v := by simp [h p', h (v +\u1d65 p'), vadd_vsub_assoc, vadd_vadd]\n```\n\n-- snippet 25\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.coe_linear (L115-L117)\ntheorem coe_linear (e : P\u2081 \u2243\u1d43[k] P\u2082) : (e : P\u2081 \u2192\u1d43[k] P\u2082).linear = e.linear :=\nrfl\n```\n\n-- snippet 26\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.coe_mk (L136-L142)\ntheorem coe_mk (e : P\u2081 \u2243 P\u2082) (e' : V\u2081 \u2243\u2097[k] V\u2082) (h) : ((\u27e8e, e', h\u27e9 : P\u2081 \u2243\u1d43[k] P\u2082) : P\u2081 \u2192 P\u2082) = e :=\nrfl\n\n/-- Construct an affine equivalence by verifying the relation between the map and its linear part at\none base point. Namely, this function takes a map `e : P\u2081 \u2192 P\u2082`, a linear equivalence\n`e' : V\u2081 \u2243\u2097[k] V\u2082`, and a point `p` such that for any other point `p'` we have\n`e p' = e' (p' -\u1d65 p) +\u1d65 e p`. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.equivLike (L85-L91)\ninstance equivLike : EquivLike (P\u2081 \u2243\u1d43[k] P\u2082) P\u2081 P\u2082 where\n coe f := f.toFun\ninv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' _ _ h _ := toAffineMap_injective (DFunLike.coe_injective h)\n```\n\n-- snippet 28\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.toEquiv_symm (L171-L173)\ntheorem toEquiv_symm (e : P\u2081 \u2243\u1d43[k] P\u2082) : e.symm.toEquiv = e.toEquiv.symm :=\nrfl\n```\n\n-- snippet 29\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.symm (L162-L169)\ndef symm (e : P\u2081 \u2243\u1d43[k] P\u2082) : P\u2082 \u2243\u1d43[k] P\u2081 where\n toEquiv := e.toEquiv.symm\nlinear := e.linear.symm\n map_vadd' p v :=\n e.toEquiv.symm.apply_eq_iff_eq_symm_apply.2 <| by\n rw [Equiv.symm_symm, e.map_vadd' ((Equiv.symm e.toEquiv) p) ((LinearEquiv.symm e.linear) v),\n LinearEquiv.apply_symm_apply, Equiv.apply_symm_apply]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.toAffineMap (L65-L67)\ndef toAffineMap (e : P\u2081 \u2243\u1d43[k] P\u2082) : P\u2081 \u2192\u1d43[k] P\u2082 :=\n{ e with }\n```\n\n-- snippet 31\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.coe_toEquiv (L100-L102)\ntheorem coe_toEquiv (e : P\u2081 \u2243\u1d43[k] P\u2082) : \u21d1e.toEquiv = e :=\nrfl\n```\n\n-- snippet 32\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.Simps (L183-L186)\ndef Simps.apply (e : P\u2081 \u2243\u1d43[k] P\u2082) : P\u2081 \u2192 P\u2082 :=\ne\n\n/-- See Note [custom simps projection] -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.linear_symm (L179-L182)\ntheorem linear_symm (e : P\u2081 \u2243\u1d43[k] P\u2082) : e.symm.linear = e.linear.symm :=\nrfl\n\n/-- See Note [custom simps projection] -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.toAffineMap_injective (L77-L80)\ntheorem toAffineMap_injective : Injective (toAffineMap : (P\u2081 \u2243\u1d43[k] P\u2082) \u2192 P\u2081 \u2192\u1d43[k] P\u2082) := by\nrintro \u27e8e, el, h\u27e9 \u27e8e', el', h'\u27e9 H\n simp_all\n```\n\n-- snippet 35\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.toAffineMap_mk (L69-L72)\ntheorem toAffineMap_mk (f : P\u2081 \u2243 P\u2082) (f' : V\u2081 \u2243\u2097[k] V\u2082) (h) :\n toAffineMap (mk f f' h) = \u27e8f, f', h\u27e9 :=\nrfl\n```\n\n-- snippet 36\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.toEquiv_injective (L128-L130)\ntheorem toEquiv_injective : Injective (toEquiv : (P\u2081 \u2243\u1d43[k] P\u2082) \u2192 P\u2081 \u2243 P\u2082) := fun _ _ H =>\next <| Equiv.ext_iff.1 H\n```\n\n-- snippet 37\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.toAffineMap_inj (L82-L84)\ntheorem toAffineMap_inj {e e' : P\u2081 \u2243\u1d43[k] P\u2082} : e.toAffineMap = e'.toAffineMap \u2194 e = e' :=\ntoAffineMap_injective.eq_iff\n```\n\n-- snippet 38\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.coeFn_inj (L126-L127)\ntheorem coeFn_inj {e e' : P\u2081 \u2243\u1d43[k] P\u2082} : (e : P\u2081 \u2192 P\u2082) = e' \u2194 e = e' := by simp\n```\n\n-- snippet 39\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.ext (L119-L121)\ntheorem ext {e e' : P\u2081 \u2243\u1d43[k] P\u2082} (h : \u2200 x, e x = e' x) : e = e' :=\nDFunLike.ext _ _ h\n```\n\n-- snippet 40\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.linear_mk' (L157-L160)\ntheorem linear_mk' (e : P\u2081 \u2243 P\u2082) (e' : V\u2081 \u2243\u2097[k] V\u2082) (p h) : (mk' e e' p h).linear = e' :=\nrfl\n\n/-- Inverse of an affine equivalence as an affine equivalence. -/\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.LinearAlgebra.AffineSpace.AffineSubspace.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 AffineMap.map_vectorSpan {s : Set P\u2081} :\n Submodule.map f.linear (vectorSpan k s) = vectorSpan k (f '' s)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.vsub_right_mem_direction_iff_mem (L56-L62)\ntheorem vsub_right_mem_direction_iff_mem {s : AffineSubspace k P} {p : P} (hp : p \u2208 s) (p\u2082 : P) :\n p\u2082 -\u1d65 p \u2208 s.direction \u2194 p\u2082 \u2208 s := by\nrw [mem_direction_iff_eq_vsub_right hp]\n simp\n\n/-- Given a point in an affine subspace, a result of subtracting that point on the left is in the\ndirection if and only if the other point is in the subspace. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.vsub_left_mem_direction_iff_mem (L63-L67)\ntheorem vsub_left_mem_direction_iff_mem {s : AffineSubspace k P} {p : P} (hp : p \u2208 s) (p\u2082 : P) :\n p -\u1d65 p\u2082 \u2208 s.direction \u2194 p\u2082 \u2208 s := by\nrw [mem_direction_iff_eq_vsub_left hp]\n simp\n```\n\n-- snippet 3\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.toAddTorsor (L68-L83)\ninstance toAddTorsor (s : AffineSubspace k P) [Nonempty s] : AddTorsor s.direction s where\n vadd a b := \u27e8(a : V) +\u1d65 (b : P), vadd_mem_of_mem_direction a.2 b.2\u27e9\nzero_vadd := fun a => by\n ext\n exact zero_vadd _ _\n add_vadd a b c := by\n ext\n apply add_vadd\n vsub a b := \u27e8(a : P) -\u1d65 (b : P), (vsub_left_mem_direction_iff_mem a.2 _).mpr b.2\u27e9\n vsub_vadd' a b := by\n ext\n apply AddTorsor.vsub_vadd'\n vadd_vsub' a b := by\n ext\n apply AddTorsor.vadd_vsub'\n```\n\n-- snippet 4\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.coe_vsub (L85-L87)\ntheorem coe_vsub (s : AffineSubspace k P) [Nonempty s] (a b : s) : \u2191(a -\u1d65 b) = (a : P) -\u1d65 (b : P) :=\nrfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.coe_vadd (L89-L98)\ntheorem coe_vadd (s : AffineSubspace k P) [Nonempty s] (a : s.direction) (b : s) :\n \u2191(a +\u1d65 b) = (a : V) +\u1d65 (b : P) :=\nrfl\n\n/-- Embedding of an affine subspace to the ambient space, as an affine map. -/\nprotected def subtype (s : AffineSubspace k P) [Nonempty s] : s \u2192\u1d43[k] P where\n toFun := (\u2191)\n linear := s.direction.subtype\n map_vadd' _ _ := rfl\n```\n\n-- snippet 6\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.subtype_linear (L100-L102)\ntheorem subtype_linear (s : AffineSubspace k P) [Nonempty s] :\n s.subtype.linear = s.direction.subtype := rfl\n```\n\n-- snippet 7\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.subtype_apply (L104-L106)\ntheorem subtype_apply {s : AffineSubspace k P} [Nonempty s] (p : s) : s.subtype p = p :=\nrfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.subtype_injective (L107-L109)\ntheorem subtype_injective (s : AffineSubspace k P) [Nonempty s] : Function.Injective s.subtype :=\nSubtype.coe_injective\n```\n\n-- snippet 9\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.coe_subtype (L111-L115)\ntheorem coe_subtype (s : AffineSubspace k P) [Nonempty s] : (s.subtype : s \u2192 P) = ((\u2191) : s \u2192 P) :=\nrfl\n\nend AffineSubspace\n```\n\n-- snippet 10\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.coe_affineSpan_singleton (L137-L143)\ntheorem coe_affineSpan_singleton (p : P) : (affineSpan k ({p} : Set P) : Set P) = {p} := by\next x\n rw [mem_coe, \u2190 vsub_right_mem_direction_iff_mem (mem_affineSpan k (Set.mem_singleton p)) _,\n direction_affineSpan]\n simp\n\n/-- A point is in the affine span of a single point if and only if they are equal. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.mem_affineSpan_singleton (L145-L147)\ntheorem mem_affineSpan_singleton : p\u2081 \u2208 affineSpan k ({p\u2082} : Set P) \u2194 p\u2081 = p\u2082 := by\nsimp [\u2190 mem_coe]\n```\n\n-- snippet 12\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.unique_affineSpan_singleton (L148-L151)\ninstance unique_affineSpan_singleton (p : P) : Unique (affineSpan k {p}) where\n default := \u27e8p, mem_affineSpan _ (Set.mem_singleton _)\u27e9\nuniq := fun x \u21a6 Subtype.ext ((mem_affineSpan_singleton _ _).1 x.property)\n```\n\n-- snippet 13\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.preimage_coe_affineSpan_singleton (L153-L160)\ntheorem preimage_coe_affineSpan_singleton (x : P) :\n ((\u2191) : affineSpan k ({x} : Set P) \u2192 P) \u207b\u00b9' {x} = univ :=\neq_univ_of_forall fun y => (AffineSubspace.mem_affineSpan_singleton _ _).1 y.2\n\nvariable (P)\n\n/-- The top affine subspace is linearly equivalent to the affine space.\nThis is the affine version of `Submodule.topEquiv`. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.topEquiv (L162-L168)\ndef topEquiv : (\u22a4 : AffineSubspace k P) \u2243\u1d43[k] P where\n toEquiv := Equiv.Set.univ P\nlinear := .ofEq _ _ (direction_top _ _ _) \u226a\u226b\u2097 Submodule.topEquiv\n map_vadd' _ _ := rfl\n\nvariable {k V P}\n```\n\n-- snippet 15\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.subsingleton_of_subsingleton_span_eq_top (L169-L176)\ntheorem subsingleton_of_subsingleton_span_eq_top {s : Set P} (h\u2081 : s.Subsingleton)\n (h\u2082 : affineSpan k s = \u22a4) : Subsingleton P := by\nobtain \u27e8p, hp\u27e9 := AffineSubspace.nonempty_of_affineSpan_eq_top k V P h\u2082\n have : s = {p} := Subset.antisymm (fun q hq => h\u2081 hq hp) (by simp [hp])\n rw [this, AffineSubspace.ext_iff, AffineSubspace.coe_affineSpan_singleton,\n AffineSubspace.top_coe, eq_comm, \u2190 subsingleton_iff_singleton (mem_univ _)] at h\u2082\n exact subsingleton_of_univ_subsingleton h\u2082\n```\n\n-- snippet 16\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.coe_mk' (L153-L155)\ntheorem coe_mk' (e : P\u2081 \u2243 P\u2082) (e' : V\u2081 \u2243\u2097[k] V\u2082) (p h) : \u21d1(mk' e e' p h) = e :=\nrfl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.toEquiv_inj (L132-L134)\ntheorem toEquiv_inj {e e' : P\u2081 \u2243\u1d43[k] P\u2082} : e.toEquiv = e'.toEquiv \u2194 e = e' :=\ntoEquiv_injective.eq_iff\n```\n\n-- snippet 18\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.map_vadd (L96-L98)\ntheorem map_vadd (e : P\u2081 \u2243\u1d43[k] P\u2082) (p : P\u2081) (v : V\u2081) : e (v +\u1d65 p) = e.linear v +\u1d65 e p :=\ne.map_vadd' p v\n```\n\n-- snippet 19\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.linear_toAffineMap (L74-L76)\ntheorem linear_toAffineMap (e : P\u2081 \u2243\u1d43[k] P\u2082) : e.toAffineMap.linear = e.linear :=\nrfl\n```\n\n-- snippet 20\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.coeFn_injective (L122-L124)\ntheorem coeFn_injective : @Injective (P\u2081 \u2243\u1d43[k] P\u2082) (P\u2081 \u2192 P\u2082) (\u21d1) :=\nDFunLike.coe_injective\n```\n\n-- snippet 21\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.coe_coe (L111-L113)\ntheorem coe_coe (e : P\u2081 \u2243\u1d43[k] P\u2082) : ((e : P\u2081 \u2192\u1d43[k] P\u2082) : P\u2081 \u2192 P\u2082) = e :=\nrfl\n```\n\n-- snippet 22\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.coe_symm_toEquiv (L175-L177)\ntheorem coe_symm_toEquiv (e : P\u2081 \u2243\u1d43[k] P\u2082) : \u21d1e.toEquiv.symm = e.symm :=\nrfl\n```\n\n-- snippet 23\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.coe_toAffineMap (L107-L109)\ntheorem coe_toAffineMap (e : P\u2081 \u2243\u1d43[k] P\u2082) : (e.toAffineMap : P\u2081 \u2192 P\u2082) = (e : P\u2081 \u2192 P\u2082) :=\nrfl\n```\n\n-- snippet 24\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.mk' (L143-L151)\ndef mk' (e : P\u2081 \u2192 P\u2082) (e' : V\u2081 \u2243\u2097[k] V\u2082) (p : P\u2081) (h : \u2200 p' : P\u2081, e p' = e' (p' -\u1d65 p) +\u1d65 e p) :\n P\u2081 \u2243\u1d43[k] P\u2082 where\n toFun := e\ninvFun := fun q' : P\u2082 => e'.symm (q' -\u1d65 e p) +\u1d65 p\n left_inv p' := by simp [h p', vadd_vsub, vsub_vadd]\n right_inv q' := by simp [h (e'.symm (q' -\u1d65 e p) +\u1d65 p), vadd_vsub, vsub_vadd]\n linear := e'\n map_vadd' p' v := by simp [h p', h (v +\u1d65 p'), vadd_vsub_assoc, vadd_vadd]\n```\n\n-- snippet 25\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.coe_linear (L115-L117)\ntheorem coe_linear (e : P\u2081 \u2243\u1d43[k] P\u2082) : (e : P\u2081 \u2192\u1d43[k] P\u2082).linear = e.linear :=\nrfl\n```\n\n-- snippet 26\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.coe_mk (L136-L142)\ntheorem coe_mk (e : P\u2081 \u2243 P\u2082) (e' : V\u2081 \u2243\u2097[k] V\u2082) (h) : ((\u27e8e, e', h\u27e9 : P\u2081 \u2243\u1d43[k] P\u2082) : P\u2081 \u2192 P\u2082) = e :=\nrfl\n\n/-- Construct an affine equivalence by verifying the relation between the map and its linear part at\none base point. Namely, this function takes a map `e : P\u2081 \u2192 P\u2082`, a linear equivalence\n`e' : V\u2081 \u2243\u2097[k] V\u2082`, and a point `p` such that for any other point `p'` we have\n`e p' = e' (p' -\u1d65 p) +\u1d65 e p`. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.equivLike (L85-L91)\ninstance equivLike : EquivLike (P\u2081 \u2243\u1d43[k] P\u2082) P\u2081 P\u2082 where\n coe f := f.toFun\ninv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' _ _ h _ := toAffineMap_injective (DFunLike.coe_injective h)\n```\n\n-- snippet 28\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.toEquiv_symm (L171-L173)\ntheorem toEquiv_symm (e : P\u2081 \u2243\u1d43[k] P\u2082) : e.symm.toEquiv = e.toEquiv.symm :=\nrfl\n```\n\n-- snippet 29\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.symm (L162-L169)\ndef symm (e : P\u2081 \u2243\u1d43[k] P\u2082) : P\u2082 \u2243\u1d43[k] P\u2081 where\n toEquiv := e.toEquiv.symm\nlinear := e.linear.symm\n map_vadd' p v :=\n e.toEquiv.symm.apply_eq_iff_eq_symm_apply.2 <| by\n rw [Equiv.symm_symm, e.map_vadd' ((Equiv.symm e.toEquiv) p) ((LinearEquiv.symm e.linear) v),\n LinearEquiv.apply_symm_apply, Equiv.apply_symm_apply]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.toAffineMap (L65-L67)\ndef toAffineMap (e : P\u2081 \u2243\u1d43[k] P\u2082) : P\u2081 \u2192\u1d43[k] P\u2082 :=\n{ e with }\n```\n\n-- snippet 31\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.coe_toEquiv (L100-L102)\ntheorem coe_toEquiv (e : P\u2081 \u2243\u1d43[k] P\u2082) : \u21d1e.toEquiv = e :=\nrfl\n```\n\n-- snippet 32\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.Simps (L183-L186)\ndef Simps.apply (e : P\u2081 \u2243\u1d43[k] P\u2082) : P\u2081 \u2192 P\u2082 :=\ne\n\n/-- See Note [custom simps projection] -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.linear_symm (L179-L182)\ntheorem linear_symm (e : P\u2081 \u2243\u1d43[k] P\u2082) : e.symm.linear = e.linear.symm :=\nrfl\n\n/-- See Note [custom simps projection] -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.toAffineMap_injective (L77-L80)\ntheorem toAffineMap_injective : Injective (toAffineMap : (P\u2081 \u2243\u1d43[k] P\u2082) \u2192 P\u2081 \u2192\u1d43[k] P\u2082) := by\nrintro \u27e8e, el, h\u27e9 \u27e8e', el', h'\u27e9 H\n simp_all\n```\n\n-- snippet 35\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.toAffineMap_mk (L69-L72)\ntheorem toAffineMap_mk (f : P\u2081 \u2243 P\u2082) (f' : V\u2081 \u2243\u2097[k] V\u2082) (h) :\n toAffineMap (mk f f' h) = \u27e8f, f', h\u27e9 :=\nrfl\n```\n\n-- snippet 36\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.toEquiv_injective (L128-L130)\ntheorem toEquiv_injective : Injective (toEquiv : (P\u2081 \u2243\u1d43[k] P\u2082) \u2192 P\u2081 \u2243 P\u2082) := fun _ _ H =>\next <| Equiv.ext_iff.1 H\n```\n\n-- snippet 37\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.toAffineMap_inj (L82-L84)\ntheorem toAffineMap_inj {e e' : P\u2081 \u2243\u1d43[k] P\u2082} : e.toAffineMap = e'.toAffineMap \u2194 e = e' :=\ntoAffineMap_injective.eq_iff\n```\n\n-- snippet 38\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.coeFn_inj (L126-L127)\ntheorem coeFn_inj {e e' : P\u2081 \u2243\u1d43[k] P\u2082} : (e : P\u2081 \u2192 P\u2082) = e' \u2194 e = e' := by simp\n```\n\n-- snippet 39\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.ext (L119-L121)\ntheorem ext {e e' : P\u2081 \u2243\u1d43[k] P\u2082} (h : \u2200 x, e x = e' x) : e = e' :=\nDFunLike.ext _ _ h\n```\n\n-- snippet 40\n```lean\n-- Mathlib.LinearAlgebra.AffineSpace.AffineEquiv.linear_mk' (L157-L160)\ntheorem linear_mk' (e : P\u2081 \u2243 P\u2082) (e' : V\u2081 \u2243\u2097[k] V\u2082) (p h) : (mk' e e' p h).linear = e' :=\nrfl\n\n/-- Inverse of an affine equivalence as an affine equivalence. -/\n```\n[/INST]", "sample_id": "C-Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.AffineMap", "source": {"declaration": "Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic.AffineMap", "file": "Mathlib/LinearAlgebra/AffineSpace/AffineSubspace/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/AffineSpace/AffineSubspace/Basic.lean#L519", "span": "L519-L523"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.arcsin_mem_Icc (L36-L39)\ntheorem arcsin_mem_Icc (x : \u211d) : arcsin x \u2208 Icc (-(\u03c0 / 2)) (\u03c0 / 2) :=\nSubtype.coe_prop _\n\nset_option backward.isDefEq.respectTransparency false in", "-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.range_arcsin (L41-L44)\ntheorem range_arcsin : range arcsin = Icc (-(\u03c0 / 2)) (\u03c0 / 2) := by\nrw [arcsin, range_comp Subtype.val]\n simp [Icc]", "-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.arcsin_le_pi_div_two (L45-L47)\ntheorem arcsin_le_pi_div_two (x : \u211d) : arcsin x \u2264 \u03c0 / 2 :=\n(arcsin_mem_Icc x).2", "-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.neg_pi_div_two_le_arcsin (L48-L50)\ntheorem neg_pi_div_two_le_arcsin (x : \u211d) : -(\u03c0 / 2) \u2264 arcsin x :=\n(arcsin_mem_Icc x).1", "-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.arcsin_projIcc (L51-L55)\ntheorem arcsin_projIcc (x : \u211d) :\n arcsin (projIcc (-1) 1 (neg_le_self zero_le_one) x) = arcsin x := by\nrw [arcsin, Function.comp_apply, IccExtend_val, Function.comp_apply, IccExtend,\n Function.comp_apply]", "-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.sin_arcsin' (L56-L59)\ntheorem sin_arcsin' {x : \u211d} (hx : x \u2208 Icc (-1 : \u211d) 1) : sin (arcsin x) = x := by\nsimpa [arcsin, IccExtend_of_mem _ _ hx, -OrderIso.apply_symm_apply] using\n Subtype.ext_iff.1 (sinOrderIso.apply_symm_apply \u27e8x, hx\u27e9)", "-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.sin_arcsin (L60-L62)\ntheorem sin_arcsin {x : \u211d} (hx\u2081 : -1 \u2264 x) (hx\u2082 : x \u2264 1) : sin (arcsin x) = x :=\nsin_arcsin' \u27e8hx\u2081, hx\u2082\u27e9", "-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.arcsin_sin' (L63-L65)\ntheorem arcsin_sin' {x : \u211d} (hx : x \u2208 Icc (-(\u03c0 / 2)) (\u03c0 / 2)) : arcsin (sin x) = x :=\ninjOn_sin (arcsin_mem_Icc _) hx <| by rw [sin_arcsin (neg_one_le_sin _) (sin_le_one _)]", "-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.arcsin_sin (L66-L68)\ntheorem arcsin_sin {x : \u211d} (hx\u2081 : -(\u03c0 / 2) \u2264 x) (hx\u2082 : x \u2264 \u03c0 / 2) : arcsin (sin x) = x :=\narcsin_sin' \u27e8hx\u2081, hx\u2082\u27e9", "-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.strictMonoOn_arcsin (L69-L72)\ntheorem strictMonoOn_arcsin : StrictMonoOn arcsin (Icc (-1) 1) :=\n(Subtype.strictMono_coe _).comp_strictMonoOn <|\n sinOrderIso.symm.strictMono.strictMonoOn_IccExtend _", "-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.arcsin_lt_arcsin (L74-L77)\ntheorem arcsin_lt_arcsin {x y : \u211d} (hx : -1 \u2264 x) (hlt : x < y) (hy : y \u2264 1) :\n arcsin x < arcsin y :=\nstrictMonoOn_arcsin \u27e8hx, hlt.le.trans hy\u27e9 \u27e8hx.trans hlt.le, hy\u27e9 hlt", "-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.monotone_arcsin (L78-L80)\ntheorem monotone_arcsin : Monotone arcsin :=\n(Subtype.mono_coe _).comp <| sinOrderIso.symm.monotone.IccExtend _", "-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.arcsin_le_arcsin (L82-L83)\ntheorem arcsin_le_arcsin {x y : \u211d} (h : x \u2264 y) : arcsin x \u2264 arcsin y := monotone_arcsin h", "-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.injOn_arcsin (L84-L86)\ntheorem injOn_arcsin : InjOn arcsin (Icc (-1) 1) :=\nstrictMonoOn_arcsin.injOn", "-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.arcsin_inj (L87-L90)\ntheorem arcsin_inj {x y : \u211d} (hx\u2081 : -1 \u2264 x) (hx\u2082 : x \u2264 1) (hy\u2081 : -1 \u2264 y) (hy\u2082 : y \u2264 1) :\n arcsin x = arcsin y \u2194 x = y :=\ninjOn_arcsin.eq_iff \u27e8hx\u2081, hx\u2082\u27e9 \u27e8hy\u2081, hy\u2082\u27e9", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.tanh_arcosh (L89-L92)\ntheorem tanh_arcosh {x : \u211d} (hx : 1 \u2264 x) : tanh (arcosh x) = \u221a(x ^ 2 - 1) / x := by\nrw [tanh_eq_sinh_div_cosh, sinh_arcosh hx, cosh_arcosh hx]\n\n/-- `arcosh` is the left inverse of `cosh` over $[0, \u221e)$. -/", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.hasStrictDerivAt_arcosh (L153-L159)\ntheorem hasStrictDerivAt_arcosh {x : \u211d} (hx : x \u2208 Ioi 1) :\n HasStrictDerivAt arcosh (\u221a(x ^ 2 - 1))\u207b\u00b9 x := by\nrw [\u2190 sinh_arcosh (le_of_lt hx)]\n refine coshOpenPartialHomeomorph.hasStrictDerivAt_symm hx ?_ (hasStrictDerivAt_cosh _)\n rw [ne_eq, sinh_eq_zero]\n exact ne_of_gt (arcosh_pos hx)", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_lt_arcosh (L119-L122)\ntheorem arcosh_lt_arcosh {x y : \u211d} (hx : 0 < x) (hy : 0 < y) : arcosh x < arcosh y \u2194 x < y :=\nstrictMonoOn_arcosh.lt_iff_lt hx hy\n\n/-- `Real.cosh` as a `PartialEquiv` from $[0, \u221e)$ to $[1, \u221e)$. -/", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.hasDerivAt_arcosh (L160-L162)\ntheorem hasDerivAt_arcosh {x : \u211d} (hx : x \u2208 Ioi 1) : HasDerivAt arcosh (\u221a(x ^ 2 - 1))\u207b\u00b9 x :=\n(hasStrictDerivAt_arcosh hx).hasDerivAt", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.contDiffOn_arcosh (L175-L178)\ntheorem contDiffOn_arcosh {n : WithTop \u2115\u221e} : ContDiffOn \u211d n arcosh (Ioi 1) := fun _ hx =>\n(contDiffAt_arcosh hx).contDiffWithinAt\n\n/-- The function `Real.arcosh` is real analytic. -/", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.continuousOn_arcosh (L133-L138)\ntheorem continuousOn_arcosh : ContinuousOn arcosh (Ici 1) :=\nhave {x : \u211d} (hx : x \u2208 Ici 1) : 0 < x + \u221a(x ^ 2 - 1) :=\n add_pos_of_pos_of_nonneg (show 0 < x by grind) (sqrt_nonneg _)\n continuousOn_log.comp (by fun_prop) (by grind [MapsTo])\n\n/-- `Real.cosh` as an `OpenPartialHomeomorph` from $(0, \u221e)$ to $(1, \u221e)$. -/", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_eq_zero_iff (L81-L84)\ntheorem arcosh_eq_zero_iff {x : \u211d} (hx : 1 \u2264 x) : arcosh x = 0 \u2194 x = 1 := by\nrw [\u2190 exp_injective.eq_iff, exp_arcosh hx, exp_zero]\n grind", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_le_arcosh (L115-L118)\ntheorem arcosh_le_arcosh {x y : \u211d} (hx : 0 < x) (hy : 0 < y) : arcosh x \u2264 arcosh y \u2194 x \u2264 y :=\nstrictMonoOn_arcosh.le_iff_le hx hy\n\n/-- This holds for `0 < x, y \u2264 1` due to junk values. -/", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.differentiableOn_arcosh (L166-L168)\ntheorem differentiableOn_arcosh : DifferentiableOn \u211d arcosh (Ioi 1) := fun _ hx =>\n(differentiableAt_arcosh hx).differentiableWithinAt", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.analyticWithinAt_arcosh (L184-L188)\nlemma analyticWithinAt_arcosh {s : Set \u211d} {x : \u211d} (hx : x \u2208 Ioi 1) :\n AnalyticWithinAt \u211d arcosh s x :=\n(contDiffAt_arcosh hx).contDiffWithinAt.analyticWithinAt\n\n/-- The function `Real.arcosh` is real analytic. -/", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_zero (L69-L70)\ntheorem arcosh_zero : arcosh 1 = 0 := by simp [arcosh]", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.sinh_arcosh (L85-L88)\ntheorem sinh_arcosh {x : \u211d} (hx : 1 \u2264 x) : sinh (arcosh x) = \u221a(x ^ 2 - 1) := by\nrw [arcosh, sinh_eq, exp_neg, exp_log (by positivity), add_sqrt_self_sq_sub_one_inv hx]\n ring", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.exp_arcosh (L64-L67)\ntheorem exp_arcosh {x : \u211d} (hx : 1 \u2264 x) : exp (arcosh x) = x + \u221a(x ^ 2 - 1) := by\napply exp_log\n positivity", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.strictMonoOn_arcosh (L110-L114)\ntheorem strictMonoOn_arcosh : StrictMonoOn arcosh (Ioi 0) := by\nrefine strictMonoOn_log.comp ?_ fun x (hx : 0 < x) \u21a6 show 0 < x + \u221a(x ^ 2 - 1) by positivity\n exact strictMonoOn_id.add_monotone fun x (hx : 0 < x) y (hy : 0 < y) hxy \u21a6 by gcongr\n\n/-- This holds for `0 < x, y \u2264 1` due to junk values. -/", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.coshOpenPartialHomeomorph (L139-L152)\ndef coshOpenPartialHomeomorph : OpenPartialHomeomorph \u211d \u211d where\n toFun := cosh\ninvFun := arcosh\n source := Ioi 0\n target := Ioi 1\n map_source' _ hr := one_lt_cosh.mpr (ne_of_lt hr).symm\n map_target' _ hr := arcosh_pos hr\n left_inv' _ hr := arcosh_cosh (le_of_lt hr)\n right_inv' _ hr := cosh_arcosh (le_of_lt hr)\n open_source := isOpen_Ioi\n open_target := isOpen_Ioi\n continuousOn_toFun := by fun_prop\n continuousOn_invFun := continuousOn_arcosh.mono Ioi_subset_Ici_self", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_pos (L103-L109)\ntheorem arcosh_pos {x : \u211d} (hx : 1 < x) : 0 < arcosh x := by\napply log_pos\n calc\n 1 < x + 0 := by simpa\n _ \u2264 x + \u221a(x ^ 2 - 1) := by gcongr; positivity\n\n/-- This holds for `Ioi 0` instead of only `Ici 1` due to junk values. -/", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.add_sqrt_self_sq_sub_one_inv (L71-L76)\nlemma add_sqrt_self_sq_sub_one_inv {x : \u211d} (hx : 1 \u2264 x) :\n (x + \u221a(x ^ 2 - 1))\u207b\u00b9 = x - \u221a(x ^ 2 - 1) := by\napply inv_eq_of_mul_eq_one_right\n rw [\u2190 pow_two_sub_pow_two, sq_sqrt (sub_nonneg_of_le (one_le_pow\u2080 hx)), sub_sub_cancel]\n\n/-- `arcosh` is the right inverse of `cosh` over $[1, \u221e)$. -/", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_nonneg (L97-L102)\ntheorem arcosh_nonneg {x : \u211d} (hx : 1 \u2264 x) : 0 \u2264 arcosh x := by\napply log_nonneg\n calc\n 1 \u2264 x + 0 := by simpa\n _ \u2264 x + \u221a(x ^ 2 - 1) := by gcongr; positivity", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.contDiffAt_arcosh (L169-L174)\ntheorem contDiffAt_arcosh {n : WithTop \u2115\u221e} {x : \u211d} (hx : x \u2208 Ioi 1) : ContDiffAt \u211d n arcosh x := by\nrefine coshOpenPartialHomeomorph.contDiffAt_symm_deriv ?_ hx (hasDerivAt_cosh _)\n contDiff_cosh.contDiffAt\n rw [ne_eq, sinh_eq_zero]\n exact (arcosh_pos hx).ne'", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_cosh (L93-L96)\ntheorem arcosh_cosh {x : \u211d} (hx : 0 \u2264 x) : arcosh (cosh x) = x := by\nrw [arcosh, \u2190 exp_eq_exp, exp_log (by positivity), \u2190 eq_sub_iff_add_eq', exp_sub_cosh,\n \u2190 sq_eq_sq\u2080 (sqrt_nonneg _) (sinh_nonneg_iff.mpr hx), \u2190 sinh_sq, sq_sqrt (pow_two_nonneg _)]", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.cosh_arcosh (L77-L80)\ntheorem cosh_arcosh {x : \u211d} (hx : 1 \u2264 x) : cosh (arcosh x) = x := by\nrw [arcosh, cosh_eq, exp_neg, exp_log (by positivity), add_sqrt_self_sq_sub_one_inv hx]\n ring", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh (L61-L63)\ndef arcosh (x : \u211d) :=\nlog (x + \u221a(x ^ 2 - 1))", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.differentiableAt_arcosh (L163-L165)\ntheorem differentiableAt_arcosh {x : \u211d} (hx : x \u2208 Ioi 1) : DifferentiableAt \u211d arcosh x :=\n(hasDerivAt_arcosh hx).differentiableAt", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.analyticAt_arcosh (L180-L183)\nlemma analyticAt_arcosh {x : \u211d} (hx : x \u2208 Ioi 1) : AnalyticAt \u211d arcosh x :=\n(contDiffAt_arcosh hx).analyticAt\n\n/-- The function `Real.arcosh` is real analytic. -/", "-- Mathlib.Analysis.SpecialFunctions.Arcosh.coshPartialEquiv (L123-L132)\ndef coshPartialEquiv : PartialEquiv \u211d \u211d where\n toFun := cosh\ninvFun := arcosh\n source := Ici 0\n target := Ici 1\n map_source' r _ := one_le_cosh r\n map_target' _ hr := arcosh_nonneg hr\n left_inv' _ hr := arcosh_cosh hr\n right_inv' _ hr := cosh_arcosh hr"], "statement": "theorem cos_arcsin_nonneg (x : \u211d) : 0 \u2264 cos (arcsin x)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 11802, "declarations_count": 1024, "diagnostics_count": 0, "duplicate_fingerprint": "db30637644cc555c", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 4779, "lean_code_chars": 10278, "lean_code_ratio": 0.8709, "length_bucket": "medium", "line_count": 356, "natural_language_chars": 1524, "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.Analysis.SpecialFunctions.Trigonometric.Inverse).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem cos_arcsin_nonneg (x : \u211d) : 0 \u2264 cos (arcsin x)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.arcsin_mem_Icc (L36-L39)\ntheorem arcsin_mem_Icc (x : \u211d) : arcsin x \u2208 Icc (-(\u03c0 / 2)) (\u03c0 / 2) :=\nSubtype.coe_prop _\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.range_arcsin (L41-L44)\ntheorem range_arcsin : range arcsin = Icc (-(\u03c0 / 2)) (\u03c0 / 2) := by\nrw [arcsin, range_comp Subtype.val]\n simp [Icc]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.arcsin_le_pi_div_two (L45-L47)\ntheorem arcsin_le_pi_div_two (x : \u211d) : arcsin x \u2264 \u03c0 / 2 :=\n(arcsin_mem_Icc x).2\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.neg_pi_div_two_le_arcsin (L48-L50)\ntheorem neg_pi_div_two_le_arcsin (x : \u211d) : -(\u03c0 / 2) \u2264 arcsin x :=\n(arcsin_mem_Icc x).1\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.arcsin_projIcc (L51-L55)\ntheorem arcsin_projIcc (x : \u211d) :\n arcsin (projIcc (-1) 1 (neg_le_self zero_le_one) x) = arcsin x := by\nrw [arcsin, Function.comp_apply, IccExtend_val, Function.comp_apply, IccExtend,\n Function.comp_apply]\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.sin_arcsin' (L56-L59)\ntheorem sin_arcsin' {x : \u211d} (hx : x \u2208 Icc (-1 : \u211d) 1) : sin (arcsin x) = x := by\nsimpa [arcsin, IccExtend_of_mem _ _ hx, -OrderIso.apply_symm_apply] using\n Subtype.ext_iff.1 (sinOrderIso.apply_symm_apply \u27e8x, hx\u27e9)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.sin_arcsin (L60-L62)\ntheorem sin_arcsin {x : \u211d} (hx\u2081 : -1 \u2264 x) (hx\u2082 : x \u2264 1) : sin (arcsin x) = x :=\nsin_arcsin' \u27e8hx\u2081, hx\u2082\u27e9\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.arcsin_sin' (L63-L65)\ntheorem arcsin_sin' {x : \u211d} (hx : x \u2208 Icc (-(\u03c0 / 2)) (\u03c0 / 2)) : arcsin (sin x) = x :=\ninjOn_sin (arcsin_mem_Icc _) hx <| by rw [sin_arcsin (neg_one_le_sin _) (sin_le_one _)]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.arcsin_sin (L66-L68)\ntheorem arcsin_sin {x : \u211d} (hx\u2081 : -(\u03c0 / 2) \u2264 x) (hx\u2082 : x \u2264 \u03c0 / 2) : arcsin (sin x) = x :=\narcsin_sin' \u27e8hx\u2081, hx\u2082\u27e9\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.strictMonoOn_arcsin (L69-L72)\ntheorem strictMonoOn_arcsin : StrictMonoOn arcsin (Icc (-1) 1) :=\n(Subtype.strictMono_coe _).comp_strictMonoOn <|\n sinOrderIso.symm.strictMono.strictMonoOn_IccExtend _\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.arcsin_lt_arcsin (L74-L77)\ntheorem arcsin_lt_arcsin {x y : \u211d} (hx : -1 \u2264 x) (hlt : x < y) (hy : y \u2264 1) :\n arcsin x < arcsin y :=\nstrictMonoOn_arcsin \u27e8hx, hlt.le.trans hy\u27e9 \u27e8hx.trans hlt.le, hy\u27e9 hlt\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.monotone_arcsin (L78-L80)\ntheorem monotone_arcsin : Monotone arcsin :=\n(Subtype.mono_coe _).comp <| sinOrderIso.symm.monotone.IccExtend _\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.arcsin_le_arcsin (L82-L83)\ntheorem arcsin_le_arcsin {x y : \u211d} (h : x \u2264 y) : arcsin x \u2264 arcsin y := monotone_arcsin h\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.injOn_arcsin (L84-L86)\ntheorem injOn_arcsin : InjOn arcsin (Icc (-1) 1) :=\nstrictMonoOn_arcsin.injOn\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.arcsin_inj (L87-L90)\ntheorem arcsin_inj {x y : \u211d} (hx\u2081 : -1 \u2264 x) (hx\u2082 : x \u2264 1) (hy\u2081 : -1 \u2264 y) (hy\u2082 : y \u2264 1) :\n arcsin x = arcsin y \u2194 x = y :=\ninjOn_arcsin.eq_iff \u27e8hx\u2081, hx\u2082\u27e9 \u27e8hy\u2081, hy\u2082\u27e9\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.tanh_arcosh (L89-L92)\ntheorem tanh_arcosh {x : \u211d} (hx : 1 \u2264 x) : tanh (arcosh x) = \u221a(x ^ 2 - 1) / x := by\nrw [tanh_eq_sinh_div_cosh, sinh_arcosh hx, cosh_arcosh hx]\n\n/-- `arcosh` is the left inverse of `cosh` over $[0, \u221e)$. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.hasStrictDerivAt_arcosh (L153-L159)\ntheorem hasStrictDerivAt_arcosh {x : \u211d} (hx : x \u2208 Ioi 1) :\n HasStrictDerivAt arcosh (\u221a(x ^ 2 - 1))\u207b\u00b9 x := by\nrw [\u2190 sinh_arcosh (le_of_lt hx)]\n refine coshOpenPartialHomeomorph.hasStrictDerivAt_symm hx ?_ (hasStrictDerivAt_cosh _)\n rw [ne_eq, sinh_eq_zero]\n exact ne_of_gt (arcosh_pos hx)\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_lt_arcosh (L119-L122)\ntheorem arcosh_lt_arcosh {x y : \u211d} (hx : 0 < x) (hy : 0 < y) : arcosh x < arcosh y \u2194 x < y :=\nstrictMonoOn_arcosh.lt_iff_lt hx hy\n\n/-- `Real.cosh` as a `PartialEquiv` from $[0, \u221e)$ to $[1, \u221e)$. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.hasDerivAt_arcosh (L160-L162)\ntheorem hasDerivAt_arcosh {x : \u211d} (hx : x \u2208 Ioi 1) : HasDerivAt arcosh (\u221a(x ^ 2 - 1))\u207b\u00b9 x :=\n(hasStrictDerivAt_arcosh hx).hasDerivAt\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.contDiffOn_arcosh (L175-L178)\ntheorem contDiffOn_arcosh {n : WithTop \u2115\u221e} : ContDiffOn \u211d n arcosh (Ioi 1) := fun _ hx =>\n(contDiffAt_arcosh hx).contDiffWithinAt\n\n/-- The function `Real.arcosh` is real analytic. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.continuousOn_arcosh (L133-L138)\ntheorem continuousOn_arcosh : ContinuousOn arcosh (Ici 1) :=\nhave {x : \u211d} (hx : x \u2208 Ici 1) : 0 < x + \u221a(x ^ 2 - 1) :=\n add_pos_of_pos_of_nonneg (show 0 < x by grind) (sqrt_nonneg _)\n continuousOn_log.comp (by fun_prop) (by grind [MapsTo])\n\n/-- `Real.cosh` as an `OpenPartialHomeomorph` from $(0, \u221e)$ to $(1, \u221e)$. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_eq_zero_iff (L81-L84)\ntheorem arcosh_eq_zero_iff {x : \u211d} (hx : 1 \u2264 x) : arcosh x = 0 \u2194 x = 1 := by\nrw [\u2190 exp_injective.eq_iff, exp_arcosh hx, exp_zero]\n grind\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_le_arcosh (L115-L118)\ntheorem arcosh_le_arcosh {x y : \u211d} (hx : 0 < x) (hy : 0 < y) : arcosh x \u2264 arcosh y \u2194 x \u2264 y :=\nstrictMonoOn_arcosh.le_iff_le hx hy\n\n/-- This holds for `0 < x, y \u2264 1` due to junk values. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.differentiableOn_arcosh (L166-L168)\ntheorem differentiableOn_arcosh : DifferentiableOn \u211d arcosh (Ioi 1) := fun _ hx =>\n(differentiableAt_arcosh hx).differentiableWithinAt\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.analyticWithinAt_arcosh (L184-L188)\nlemma analyticWithinAt_arcosh {s : Set \u211d} {x : \u211d} (hx : x \u2208 Ioi 1) :\n AnalyticWithinAt \u211d arcosh s x :=\n(contDiffAt_arcosh hx).contDiffWithinAt.analyticWithinAt\n\n/-- The function `Real.arcosh` is real analytic. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_zero (L69-L70)\ntheorem arcosh_zero : arcosh 1 = 0 := by simp [arcosh]\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.sinh_arcosh (L85-L88)\ntheorem sinh_arcosh {x : \u211d} (hx : 1 \u2264 x) : sinh (arcosh x) = \u221a(x ^ 2 - 1) := by\nrw [arcosh, sinh_eq, exp_neg, exp_log (by positivity), add_sqrt_self_sq_sub_one_inv hx]\n ring\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.exp_arcosh (L64-L67)\ntheorem exp_arcosh {x : \u211d} (hx : 1 \u2264 x) : exp (arcosh x) = x + \u221a(x ^ 2 - 1) := by\napply exp_log\n positivity\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.strictMonoOn_arcosh (L110-L114)\ntheorem strictMonoOn_arcosh : StrictMonoOn arcosh (Ioi 0) := by\nrefine strictMonoOn_log.comp ?_ fun x (hx : 0 < x) \u21a6 show 0 < x + \u221a(x ^ 2 - 1) by positivity\n exact strictMonoOn_id.add_monotone fun x (hx : 0 < x) y (hy : 0 < y) hxy \u21a6 by gcongr\n\n/-- This holds for `0 < x, y \u2264 1` due to junk values. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.coshOpenPartialHomeomorph (L139-L152)\ndef coshOpenPartialHomeomorph : OpenPartialHomeomorph \u211d \u211d where\n toFun := cosh\ninvFun := arcosh\n source := Ioi 0\n target := Ioi 1\n map_source' _ hr := one_lt_cosh.mpr (ne_of_lt hr).symm\n map_target' _ hr := arcosh_pos hr\n left_inv' _ hr := arcosh_cosh (le_of_lt hr)\n right_inv' _ hr := cosh_arcosh (le_of_lt hr)\n open_source := isOpen_Ioi\n open_target := isOpen_Ioi\n continuousOn_toFun := by fun_prop\n continuousOn_invFun := continuousOn_arcosh.mono Ioi_subset_Ici_self\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_pos (L103-L109)\ntheorem arcosh_pos {x : \u211d} (hx : 1 < x) : 0 < arcosh x := by\napply log_pos\n calc\n 1 < x + 0 := by simpa\n _ \u2264 x + \u221a(x ^ 2 - 1) := by gcongr; positivity\n\n/-- This holds for `Ioi 0` instead of only `Ici 1` due to junk values. -/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.add_sqrt_self_sq_sub_one_inv (L71-L76)\nlemma add_sqrt_self_sq_sub_one_inv {x : \u211d} (hx : 1 \u2264 x) :\n (x + \u221a(x ^ 2 - 1))\u207b\u00b9 = x - \u221a(x ^ 2 - 1) := by\napply inv_eq_of_mul_eq_one_right\n rw [\u2190 pow_two_sub_pow_two, sq_sqrt (sub_nonneg_of_le (one_le_pow\u2080 hx)), sub_sub_cancel]\n\n/-- `arcosh` is the right inverse of `cosh` over $[1, \u221e)$. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_nonneg (L97-L102)\ntheorem arcosh_nonneg {x : \u211d} (hx : 1 \u2264 x) : 0 \u2264 arcosh x := by\napply log_nonneg\n calc\n 1 \u2264 x + 0 := by simpa\n _ \u2264 x + \u221a(x ^ 2 - 1) := by gcongr; positivity\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.contDiffAt_arcosh (L169-L174)\ntheorem contDiffAt_arcosh {n : WithTop \u2115\u221e} {x : \u211d} (hx : x \u2208 Ioi 1) : ContDiffAt \u211d n arcosh x := by\nrefine coshOpenPartialHomeomorph.contDiffAt_symm_deriv ?_ hx (hasDerivAt_cosh _)\n contDiff_cosh.contDiffAt\n rw [ne_eq, sinh_eq_zero]\n exact (arcosh_pos hx).ne'\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_cosh (L93-L96)\ntheorem arcosh_cosh {x : \u211d} (hx : 0 \u2264 x) : arcosh (cosh x) = x := by\nrw [arcosh, \u2190 exp_eq_exp, exp_log (by positivity), \u2190 eq_sub_iff_add_eq', exp_sub_cosh,\n \u2190 sq_eq_sq\u2080 (sqrt_nonneg _) (sinh_nonneg_iff.mpr hx), \u2190 sinh_sq, sq_sqrt (pow_two_nonneg _)]\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.cosh_arcosh (L77-L80)\ntheorem cosh_arcosh {x : \u211d} (hx : 1 \u2264 x) : cosh (arcosh x) = x := by\nrw [arcosh, cosh_eq, exp_neg, exp_log (by positivity), add_sqrt_self_sq_sub_one_inv hx]\n ring\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh (L61-L63)\ndef arcosh (x : \u211d) :=\nlog (x + \u221a(x ^ 2 - 1))\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.differentiableAt_arcosh (L163-L165)\ntheorem differentiableAt_arcosh {x : \u211d} (hx : x \u2208 Ioi 1) : DifferentiableAt \u211d arcosh x :=\n(hasDerivAt_arcosh hx).differentiableAt\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.analyticAt_arcosh (L180-L183)\nlemma analyticAt_arcosh {x : \u211d} (hx : x \u2208 Ioi 1) : AnalyticAt \u211d arcosh x :=\n(contDiffAt_arcosh hx).analyticAt\n\n/-- The function `Real.arcosh` is real analytic. -/\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.coshPartialEquiv (L123-L132)\ndef coshPartialEquiv : PartialEquiv \u211d \u211d where\n toFun := cosh\ninvFun := arcosh\n source := Ici 0\n target := Ici 1\n map_source' r _ := one_le_cosh r\n map_target' _ hr := arcosh_nonneg hr\n left_inv' _ hr := arcosh_cosh hr\n right_inv' _ hr := cosh_arcosh hr\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.Analysis.SpecialFunctions.Trigonometric.Inverse).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem cos_arcsin_nonneg (x : \u211d) : 0 \u2264 cos (arcsin x)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.arcsin_mem_Icc (L36-L39)\ntheorem arcsin_mem_Icc (x : \u211d) : arcsin x \u2208 Icc (-(\u03c0 / 2)) (\u03c0 / 2) :=\nSubtype.coe_prop _\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.range_arcsin (L41-L44)\ntheorem range_arcsin : range arcsin = Icc (-(\u03c0 / 2)) (\u03c0 / 2) := by\nrw [arcsin, range_comp Subtype.val]\n simp [Icc]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.arcsin_le_pi_div_two (L45-L47)\ntheorem arcsin_le_pi_div_two (x : \u211d) : arcsin x \u2264 \u03c0 / 2 :=\n(arcsin_mem_Icc x).2\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.neg_pi_div_two_le_arcsin (L48-L50)\ntheorem neg_pi_div_two_le_arcsin (x : \u211d) : -(\u03c0 / 2) \u2264 arcsin x :=\n(arcsin_mem_Icc x).1\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.arcsin_projIcc (L51-L55)\ntheorem arcsin_projIcc (x : \u211d) :\n arcsin (projIcc (-1) 1 (neg_le_self zero_le_one) x) = arcsin x := by\nrw [arcsin, Function.comp_apply, IccExtend_val, Function.comp_apply, IccExtend,\n Function.comp_apply]\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.sin_arcsin' (L56-L59)\ntheorem sin_arcsin' {x : \u211d} (hx : x \u2208 Icc (-1 : \u211d) 1) : sin (arcsin x) = x := by\nsimpa [arcsin, IccExtend_of_mem _ _ hx, -OrderIso.apply_symm_apply] using\n Subtype.ext_iff.1 (sinOrderIso.apply_symm_apply \u27e8x, hx\u27e9)\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.sin_arcsin (L60-L62)\ntheorem sin_arcsin {x : \u211d} (hx\u2081 : -1 \u2264 x) (hx\u2082 : x \u2264 1) : sin (arcsin x) = x :=\nsin_arcsin' \u27e8hx\u2081, hx\u2082\u27e9\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.arcsin_sin' (L63-L65)\ntheorem arcsin_sin' {x : \u211d} (hx : x \u2208 Icc (-(\u03c0 / 2)) (\u03c0 / 2)) : arcsin (sin x) = x :=\ninjOn_sin (arcsin_mem_Icc _) hx <| by rw [sin_arcsin (neg_one_le_sin _) (sin_le_one _)]\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.arcsin_sin (L66-L68)\ntheorem arcsin_sin {x : \u211d} (hx\u2081 : -(\u03c0 / 2) \u2264 x) (hx\u2082 : x \u2264 \u03c0 / 2) : arcsin (sin x) = x :=\narcsin_sin' \u27e8hx\u2081, hx\u2082\u27e9\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.strictMonoOn_arcsin (L69-L72)\ntheorem strictMonoOn_arcsin : StrictMonoOn arcsin (Icc (-1) 1) :=\n(Subtype.strictMono_coe _).comp_strictMonoOn <|\n sinOrderIso.symm.strictMono.strictMonoOn_IccExtend _\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.arcsin_lt_arcsin (L74-L77)\ntheorem arcsin_lt_arcsin {x y : \u211d} (hx : -1 \u2264 x) (hlt : x < y) (hy : y \u2264 1) :\n arcsin x < arcsin y :=\nstrictMonoOn_arcsin \u27e8hx, hlt.le.trans hy\u27e9 \u27e8hx.trans hlt.le, hy\u27e9 hlt\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.monotone_arcsin (L78-L80)\ntheorem monotone_arcsin : Monotone arcsin :=\n(Subtype.mono_coe _).comp <| sinOrderIso.symm.monotone.IccExtend _\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.arcsin_le_arcsin (L82-L83)\ntheorem arcsin_le_arcsin {x y : \u211d} (h : x \u2264 y) : arcsin x \u2264 arcsin y := monotone_arcsin h\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.injOn_arcsin (L84-L86)\ntheorem injOn_arcsin : InjOn arcsin (Icc (-1) 1) :=\nstrictMonoOn_arcsin.injOn\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.arcsin_inj (L87-L90)\ntheorem arcsin_inj {x y : \u211d} (hx\u2081 : -1 \u2264 x) (hx\u2082 : x \u2264 1) (hy\u2081 : -1 \u2264 y) (hy\u2082 : y \u2264 1) :\n arcsin x = arcsin y \u2194 x = y :=\ninjOn_arcsin.eq_iff \u27e8hx\u2081, hx\u2082\u27e9 \u27e8hy\u2081, hy\u2082\u27e9\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.tanh_arcosh (L89-L92)\ntheorem tanh_arcosh {x : \u211d} (hx : 1 \u2264 x) : tanh (arcosh x) = \u221a(x ^ 2 - 1) / x := by\nrw [tanh_eq_sinh_div_cosh, sinh_arcosh hx, cosh_arcosh hx]\n\n/-- `arcosh` is the left inverse of `cosh` over $[0, \u221e)$. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.hasStrictDerivAt_arcosh (L153-L159)\ntheorem hasStrictDerivAt_arcosh {x : \u211d} (hx : x \u2208 Ioi 1) :\n HasStrictDerivAt arcosh (\u221a(x ^ 2 - 1))\u207b\u00b9 x := by\nrw [\u2190 sinh_arcosh (le_of_lt hx)]\n refine coshOpenPartialHomeomorph.hasStrictDerivAt_symm hx ?_ (hasStrictDerivAt_cosh _)\n rw [ne_eq, sinh_eq_zero]\n exact ne_of_gt (arcosh_pos hx)\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_lt_arcosh (L119-L122)\ntheorem arcosh_lt_arcosh {x y : \u211d} (hx : 0 < x) (hy : 0 < y) : arcosh x < arcosh y \u2194 x < y :=\nstrictMonoOn_arcosh.lt_iff_lt hx hy\n\n/-- `Real.cosh` as a `PartialEquiv` from $[0, \u221e)$ to $[1, \u221e)$. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.hasDerivAt_arcosh (L160-L162)\ntheorem hasDerivAt_arcosh {x : \u211d} (hx : x \u2208 Ioi 1) : HasDerivAt arcosh (\u221a(x ^ 2 - 1))\u207b\u00b9 x :=\n(hasStrictDerivAt_arcosh hx).hasDerivAt\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.contDiffOn_arcosh (L175-L178)\ntheorem contDiffOn_arcosh {n : WithTop \u2115\u221e} : ContDiffOn \u211d n arcosh (Ioi 1) := fun _ hx =>\n(contDiffAt_arcosh hx).contDiffWithinAt\n\n/-- The function `Real.arcosh` is real analytic. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.continuousOn_arcosh (L133-L138)\ntheorem continuousOn_arcosh : ContinuousOn arcosh (Ici 1) :=\nhave {x : \u211d} (hx : x \u2208 Ici 1) : 0 < x + \u221a(x ^ 2 - 1) :=\n add_pos_of_pos_of_nonneg (show 0 < x by grind) (sqrt_nonneg _)\n continuousOn_log.comp (by fun_prop) (by grind [MapsTo])\n\n/-- `Real.cosh` as an `OpenPartialHomeomorph` from $(0, \u221e)$ to $(1, \u221e)$. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_eq_zero_iff (L81-L84)\ntheorem arcosh_eq_zero_iff {x : \u211d} (hx : 1 \u2264 x) : arcosh x = 0 \u2194 x = 1 := by\nrw [\u2190 exp_injective.eq_iff, exp_arcosh hx, exp_zero]\n grind\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_le_arcosh (L115-L118)\ntheorem arcosh_le_arcosh {x y : \u211d} (hx : 0 < x) (hy : 0 < y) : arcosh x \u2264 arcosh y \u2194 x \u2264 y :=\nstrictMonoOn_arcosh.le_iff_le hx hy\n\n/-- This holds for `0 < x, y \u2264 1` due to junk values. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.differentiableOn_arcosh (L166-L168)\ntheorem differentiableOn_arcosh : DifferentiableOn \u211d arcosh (Ioi 1) := fun _ hx =>\n(differentiableAt_arcosh hx).differentiableWithinAt\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.analyticWithinAt_arcosh (L184-L188)\nlemma analyticWithinAt_arcosh {s : Set \u211d} {x : \u211d} (hx : x \u2208 Ioi 1) :\n AnalyticWithinAt \u211d arcosh s x :=\n(contDiffAt_arcosh hx).contDiffWithinAt.analyticWithinAt\n\n/-- The function `Real.arcosh` is real analytic. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_zero (L69-L70)\ntheorem arcosh_zero : arcosh 1 = 0 := by simp [arcosh]\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.sinh_arcosh (L85-L88)\ntheorem sinh_arcosh {x : \u211d} (hx : 1 \u2264 x) : sinh (arcosh x) = \u221a(x ^ 2 - 1) := by\nrw [arcosh, sinh_eq, exp_neg, exp_log (by positivity), add_sqrt_self_sq_sub_one_inv hx]\n ring\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.exp_arcosh (L64-L67)\ntheorem exp_arcosh {x : \u211d} (hx : 1 \u2264 x) : exp (arcosh x) = x + \u221a(x ^ 2 - 1) := by\napply exp_log\n positivity\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.strictMonoOn_arcosh (L110-L114)\ntheorem strictMonoOn_arcosh : StrictMonoOn arcosh (Ioi 0) := by\nrefine strictMonoOn_log.comp ?_ fun x (hx : 0 < x) \u21a6 show 0 < x + \u221a(x ^ 2 - 1) by positivity\n exact strictMonoOn_id.add_monotone fun x (hx : 0 < x) y (hy : 0 < y) hxy \u21a6 by gcongr\n\n/-- This holds for `0 < x, y \u2264 1` due to junk values. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.coshOpenPartialHomeomorph (L139-L152)\ndef coshOpenPartialHomeomorph : OpenPartialHomeomorph \u211d \u211d where\n toFun := cosh\ninvFun := arcosh\n source := Ioi 0\n target := Ioi 1\n map_source' _ hr := one_lt_cosh.mpr (ne_of_lt hr).symm\n map_target' _ hr := arcosh_pos hr\n left_inv' _ hr := arcosh_cosh (le_of_lt hr)\n right_inv' _ hr := cosh_arcosh (le_of_lt hr)\n open_source := isOpen_Ioi\n open_target := isOpen_Ioi\n continuousOn_toFun := by fun_prop\n continuousOn_invFun := continuousOn_arcosh.mono Ioi_subset_Ici_self\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_pos (L103-L109)\ntheorem arcosh_pos {x : \u211d} (hx : 1 < x) : 0 < arcosh x := by\napply log_pos\n calc\n 1 < x + 0 := by simpa\n _ \u2264 x + \u221a(x ^ 2 - 1) := by gcongr; positivity\n\n/-- This holds for `Ioi 0` instead of only `Ici 1` due to junk values. -/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.add_sqrt_self_sq_sub_one_inv (L71-L76)\nlemma add_sqrt_self_sq_sub_one_inv {x : \u211d} (hx : 1 \u2264 x) :\n (x + \u221a(x ^ 2 - 1))\u207b\u00b9 = x - \u221a(x ^ 2 - 1) := by\napply inv_eq_of_mul_eq_one_right\n rw [\u2190 pow_two_sub_pow_two, sq_sqrt (sub_nonneg_of_le (one_le_pow\u2080 hx)), sub_sub_cancel]\n\n/-- `arcosh` is the right inverse of `cosh` over $[1, \u221e)$. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_nonneg (L97-L102)\ntheorem arcosh_nonneg {x : \u211d} (hx : 1 \u2264 x) : 0 \u2264 arcosh x := by\napply log_nonneg\n calc\n 1 \u2264 x + 0 := by simpa\n _ \u2264 x + \u221a(x ^ 2 - 1) := by gcongr; positivity\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.contDiffAt_arcosh (L169-L174)\ntheorem contDiffAt_arcosh {n : WithTop \u2115\u221e} {x : \u211d} (hx : x \u2208 Ioi 1) : ContDiffAt \u211d n arcosh x := by\nrefine coshOpenPartialHomeomorph.contDiffAt_symm_deriv ?_ hx (hasDerivAt_cosh _)\n contDiff_cosh.contDiffAt\n rw [ne_eq, sinh_eq_zero]\n exact (arcosh_pos hx).ne'\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh_cosh (L93-L96)\ntheorem arcosh_cosh {x : \u211d} (hx : 0 \u2264 x) : arcosh (cosh x) = x := by\nrw [arcosh, \u2190 exp_eq_exp, exp_log (by positivity), \u2190 eq_sub_iff_add_eq', exp_sub_cosh,\n \u2190 sq_eq_sq\u2080 (sqrt_nonneg _) (sinh_nonneg_iff.mpr hx), \u2190 sinh_sq, sq_sqrt (pow_two_nonneg _)]\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.cosh_arcosh (L77-L80)\ntheorem cosh_arcosh {x : \u211d} (hx : 1 \u2264 x) : cosh (arcosh x) = x := by\nrw [arcosh, cosh_eq, exp_neg, exp_log (by positivity), add_sqrt_self_sq_sub_one_inv hx]\n ring\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.arcosh (L61-L63)\ndef arcosh (x : \u211d) :=\nlog (x + \u221a(x ^ 2 - 1))\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.differentiableAt_arcosh (L163-L165)\ntheorem differentiableAt_arcosh {x : \u211d} (hx : x \u2208 Ioi 1) : DifferentiableAt \u211d arcosh x :=\n(hasDerivAt_arcosh hx).differentiableAt\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.analyticAt_arcosh (L180-L183)\nlemma analyticAt_arcosh {x : \u211d} (hx : x \u2208 Ioi 1) : AnalyticAt \u211d arcosh x :=\n(contDiffAt_arcosh hx).analyticAt\n\n/-- The function `Real.arcosh` is real analytic. -/\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Analysis.SpecialFunctions.Arcosh.coshPartialEquiv (L123-L132)\ndef coshPartialEquiv : PartialEquiv \u211d \u211d where\n toFun := cosh\ninvFun := arcosh\n source := Ici 0\n target := Ici 1\n map_source' r _ := one_le_cosh r\n map_target' _ hr := arcosh_nonneg hr\n left_inv' _ hr := arcosh_cosh hr\n right_inv' _ hr := cosh_arcosh hr\n```\n[/INST]", "sample_id": "C-Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.cos_arcsin_nonneg", "source": {"declaration": "Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse.cos_arcsin_nonneg", "file": "Mathlib/Analysis/SpecialFunctions/Trigonometric/Inverse.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/SpecialFunctions/Trigonometric/Inverse.lean#L240", "span": "L240-L243"}} {"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 add_pow_char_of_commute (h : Commute x y) : (x + y) ^ p = x ^ p + y ^ p", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 574, "declarations_count": 59, "diagnostics_count": 0, "duplicate_fingerprint": "16224a304bf0f946", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 176, "lean_code_chars": 78, "lean_code_ratio": 0.1359, "length_bucket": "tiny", "line_count": 7, "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.Algebra.CharP.Lemmas).", "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 add_pow_char_of_commute (h : Commute x y) : (x + y) ^ p = x ^ p + y ^ p\n```\n\nDeclaration: `Mathlib.Algebra.CharP.Lemmas.add_pow_char_of_commute` (module Mathlib.Algebra.CharP.Lemmas).", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.CharP.Lemmas).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\nlemma add_pow_char_of_commute (h : Commute x y) : (x + y) ^ p = x ^ p + y ^ p\n```\n\nDeclaration: `Mathlib.Algebra.CharP.Lemmas.add_pow_char_of_commute` (module Mathlib.Algebra.CharP.Lemmas).[/INST]", "sample_id": "F-Mathlib.Algebra.CharP.Lemmas.add_pow_char_of_commute", "source": {"declaration": "Mathlib.Algebra.CharP.Lemmas.add_pow_char_of_commute", "file": "Mathlib/Algebra/CharP/Lemmas.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Algebra.CharP.Lemmas", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/CharP/Lemmas.lean#L143", "span": "L143-L145"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"trace_states": [{"state": "theorem exists_elementarySubstructure_card_eq (s : Set M) (\u03ba : Cardinal.{w'}) (h1 : \u2135\u2080 \u2264 \u03ba)\n (h2 : Cardinal.lift.{w'} #s \u2264 Cardinal.lift.{w} \u03ba)\n (h3 : Cardinal.lift.{w'} L.card \u2264 Cardinal.lift.{max u v} \u03ba)\n (h4 : Cardinal.lift.{w} \u03ba \u2264 Cardinal.lift.{w'} #M) :\n \u2203 S : L.ElementarySubstructure M, s \u2286 S \u2227 Cardinal.lift.{w'} #S = Cardinal.lift.{w} \u03ba", "tactic": "obtain \u27e8s', hs'\u27e9 := Cardinal.le_mk_iff_exists_set.1 h4"}, {"state": "", "tactic": "rw [\u2190 aleph0_le_lift.{_, w}] at h1"}, {"state": "", "tactic": "rw [\u2190 hs'] at h1 h2 \u22a2"}, {"state": "", "tactic": "refine \u27e8elementarySkolem\u2081Reduct (closure (L.sum L.skolem\u2081) (s \u222a Equiv.ulift '' s')), (s.subset_union_left).trans subset_closure, ?_\u27e9"}, {"state": "", "tactic": "have h := mk_image_eq_lift _ s' Equiv.ulift.injective"}, {"state": "", "tactic": "rw [lift_umax.{w, w'}, lift_id'.{w, w'}] at h"}, {"state": "", "tactic": "rw [coeSort_elementarySkolem\u2081Reduct, \u2190 h, lift_inj]"}, {"state": "", "tactic": "refine le_antisymm (lift_le.1 (lift_card_closure_le.trans ?_)) (mk_le_mk_of_subset ((s.subset_union_right).trans subset_closure))"}, {"state": "", "tactic": "rw [max_le_iff, aleph0_le_lift, \u2190 aleph0_le_lift.{_, w'}, h, add_eq_max, max_le_iff, lift_le] \u00b7 refine \u27e8h1, (mk_union_le _ _).trans ?_, (lift_le.2 card_functions_sum_skolem\u2081_le).trans ?_\u27e9 \u00b7 rw [\u2190 lift_le, lift_add, h, add_comm, add_eq_max h1]"}, {"state": "", "tactic": "exact max_le le_rfl h2 \u00b7 rw [lift_max, lift_aleph0, max_le_iff, aleph0_le_lift, and_comm, \u2190 lift_le.{w'}, lift_lift, lift_lift, \u2190 aleph0_le_lift, h]"}, {"state": "", "tactic": "refine \u27e8?_, h1\u27e9"}, {"state": "", "tactic": "rw [\u2190 lift_lift.{w', w}]"}, {"state": "", "tactic": "refine _root_.trans (lift_le.{w}.2 h3) ?_"}, {"state": "", "tactic": "rw [lift_lift, \u2190 lift_lift.{w, max u v}, \u2190 hs', \u2190 h, lift_lift] \u00b7 refine _root_.trans ?_ (lift_le.2 (mk_le_mk_of_subset Set.subset_union_right))"}, {"state": "", "tactic": "rw [aleph0_le_lift, \u2190 aleph0_le_lift, h]"}, {"state": "", "tactic": "exact h1 end Language end FirstOrder"}], "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 3303, "declarations_count": 393, "diagnostics_count": 0, "duplicate_fingerprint": "b9dfe586dfff00bc", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1295, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "short", "line_count": 43, "natural_language_chars": 3303, "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.ModelTheory.Skolem).", "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.ModelTheory.Skolem.exists_elementarySubstructure_card_eq`:\nState 0: \u22a2 theorem exists_elementarySubstructure_card_eq (s : Set M) (\u03ba : Cardinal.{w'}) (h1 : \u2135\u2080 \u2264 \u03ba)\n (h2 : Cardinal.lift.{w'} #s \u2264 Cardinal.lift.{w} \u03ba)\n (h3 : Cardinal.lift.{w'} L.card \u2264 Cardinal.lift.{max u v} \u03ba)\n (h4 : Cardinal.lift.{w} \u03ba \u2264 Cardinal.lift.{w'} #M) :\n \u2203 S : L.ElementarySubstructure M, s \u2286 S \u2227 Cardinal.lift.{w'} #S = Cardinal.lift.{w} \u03ba\nTactic: obtain \u27e8s', hs'\u27e9 := Cardinal.le_mk_iff_exists_set.1 h4\nState 1: \u22a2 \nTactic: rw [\u2190 aleph0_le_lift.{_, w}] at h1\nState 2: \u22a2 \nTactic: rw [\u2190 hs'] at h1 h2 \u22a2\nState 3: \u22a2 \nTactic: refine \u27e8elementarySkolem\u2081Reduct (closure (L.sum L.skolem\u2081) (s \u222a Equiv.ulift '' s')), (s.subset_union_left).trans subset_closure, ?_\u27e9\nState 4: \u22a2 \nTactic: have h := mk_image_eq_lift _ s' Equiv.ulift.injective\nState 5: \u22a2 \nTactic: rw [lift_umax.{w, w'}, lift_id'.{w, w'}] at h\nState 6: \u22a2 \nTactic: rw [coeSort_elementarySkolem\u2081Reduct, \u2190 h, lift_inj]\nState 7: \u22a2 \nTactic: refine le_antisymm (lift_le.1 (lift_card_closure_le.trans ?_)) (mk_le_mk_of_subset ((s.subset_union_right).trans subset_closure))\nState 8: \u22a2 \nTactic: rw [max_le_iff, aleph0_le_lift, \u2190 aleph0_le_lift.{_, w'}, h, add_eq_max, max_le_iff, lift_le] \u00b7 refine \u27e8h1, (mk_union_le _ _).trans ?_, (lift_le.2 card_functions_sum_skolem\u2081_le).trans ?_\u27e9 \u00b7 rw [\u2190 lift_le, lift_add, h, add_comm, add_eq_max h1]\nState 9: \u22a2 \nTactic: exact max_le le_rfl h2 \u00b7 rw [lift_max, lift_aleph0, max_le_iff, aleph0_le_lift, and_comm, \u2190 lift_le.{w'}, lift_lift, lift_lift, \u2190 aleph0_le_lift, h]\nState 10: \u22a2 \nTactic: refine \u27e8?_, h1\u27e9\nState 11: \u22a2 \nTactic: rw [\u2190 lift_lift.{w', w}]\nState 12: \u22a2 \nTactic: refine _root_.trans (lift_le.{w}.2 h3) ?_\nState 13: \u22a2 \nTactic: rw [lift_lift, \u2190 lift_lift.{w, max u v}, \u2190 hs', \u2190 h, lift_lift] \u00b7 refine _root_.trans ?_ (lift_le.2 (mk_le_mk_of_subset Set.subset_union_right))\nState 14: \u22a2 \nTactic: rw [aleph0_le_lift, \u2190 aleph0_le_lift, h]\nState 15: \u22a2 \nTactic: exact h1 end Language end FirstOrder\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.ModelTheory.Skolem).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.ModelTheory.Skolem.exists_elementarySubstructure_card_eq`:\nState 0: \u22a2 theorem exists_elementarySubstructure_card_eq (s : Set M) (\u03ba : Cardinal.{w'}) (h1 : \u2135\u2080 \u2264 \u03ba)\n (h2 : Cardinal.lift.{w'} #s \u2264 Cardinal.lift.{w} \u03ba)\n (h3 : Cardinal.lift.{w'} L.card \u2264 Cardinal.lift.{max u v} \u03ba)\n (h4 : Cardinal.lift.{w} \u03ba \u2264 Cardinal.lift.{w'} #M) :\n \u2203 S : L.ElementarySubstructure M, s \u2286 S \u2227 Cardinal.lift.{w'} #S = Cardinal.lift.{w} \u03ba\nTactic: obtain \u27e8s', hs'\u27e9 := Cardinal.le_mk_iff_exists_set.1 h4\nState 1: \u22a2 \nTactic: rw [\u2190 aleph0_le_lift.{_, w}] at h1\nState 2: \u22a2 \nTactic: rw [\u2190 hs'] at h1 h2 \u22a2\nState 3: \u22a2 \nTactic: refine \u27e8elementarySkolem\u2081Reduct (closure (L.sum L.skolem\u2081) (s \u222a Equiv.ulift '' s')), (s.subset_union_left).trans subset_closure, ?_\u27e9\nState 4: \u22a2 \nTactic: have h := mk_image_eq_lift _ s' Equiv.ulift.injective\nState 5: \u22a2 \nTactic: rw [lift_umax.{w, w'}, lift_id'.{w, w'}] at h\nState 6: \u22a2 \nTactic: rw [coeSort_elementarySkolem\u2081Reduct, \u2190 h, lift_inj]\nState 7: \u22a2 \nTactic: refine le_antisymm (lift_le.1 (lift_card_closure_le.trans ?_)) (mk_le_mk_of_subset ((s.subset_union_right).trans subset_closure))\nState 8: \u22a2 \nTactic: rw [max_le_iff, aleph0_le_lift, \u2190 aleph0_le_lift.{_, w'}, h, add_eq_max, max_le_iff, lift_le] \u00b7 refine \u27e8h1, (mk_union_le _ _).trans ?_, (lift_le.2 card_functions_sum_skolem\u2081_le).trans ?_\u27e9 \u00b7 rw [\u2190 lift_le, lift_add, h, add_comm, add_eq_max h1]\nState 9: \u22a2 \nTactic: exact max_le le_rfl h2 \u00b7 rw [lift_max, lift_aleph0, max_le_iff, aleph0_le_lift, and_comm, \u2190 lift_le.{w'}, lift_lift, lift_lift, \u2190 aleph0_le_lift, h]\nState 10: \u22a2 \nTactic: refine \u27e8?_, h1\u27e9\nState 11: \u22a2 \nTactic: rw [\u2190 lift_lift.{w', w}]\nState 12: \u22a2 \nTactic: refine _root_.trans (lift_le.{w}.2 h3) ?_\nState 13: \u22a2 \nTactic: rw [lift_lift, \u2190 lift_lift.{w, max u v}, \u2190 hs', \u2190 h, lift_lift] \u00b7 refine _root_.trans ?_ (lift_le.2 (mk_le_mk_of_subset Set.subset_union_right))\nState 14: \u22a2 \nTactic: rw [aleph0_le_lift, \u2190 aleph0_le_lift, h]\nState 15: \u22a2 \nTactic: exact h1 end Language end FirstOrder\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.ModelTheory.Skolem.exists_elementarySubstructure_card_eq", "source": {"declaration": "Mathlib.ModelTheory.Skolem.exists_elementarySubstructure_card_eq", "file": "Mathlib/ModelTheory/Skolem.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.ModelTheory.Skolem", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/ModelTheory/Skolem.lean#L122", "span": "L122-L155"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\ntheorem condition (t : PushoutCocone f g) : f \u226b inl t = g \u226b inr t := (t.w fst).trans (t.w snd).symm\n\nset_option backward.isDefEq.respectTransparency false in\n/-- To check whether a morphism is coequalized by the maps of a pushout cocone, it suffices to check\n it for `inl t` and `inr t` -/\n```", "instruction": "Edit `condition` so it still compiles and the proof is simplified where possible. Return the full updated `condition` block.", "proof_is_oneliner": false, "target_span": "L359-L364", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1066, "declarations_count": 124, "diagnostics_count": 0, "duplicate_fingerprint": "3c6589f8777306fa", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 337, "lean_code_chars": 291, "lean_code_ratio": 0.273, "length_bucket": "tiny", "line_count": 14, "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.CategoryTheory.Limits.Shapes.Pullback.PullbackCone).", "role": "system"}, {"content": "You are editing a file in `Mathlib/CategoryTheory/Limits/Shapes/Pullback/PullbackCone.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.CategoryTheory.Limits.Shapes.Pullback.PullbackCone.condition`, L359-L364)\n```lean\ntheorem condition (t : PushoutCocone f g) : f \u226b inl t = g \u226b inr t := (t.w fst).trans (t.w snd).symm\n\nset_option backward.isDefEq.respectTransparency false in\n/-- To check whether a morphism is coequalized by the maps of a pushout cocone, it suffices to check\n it for `inl t` and `inr t` -/\n```\n\n## Edit instruction\nEdit `condition` so it still compiles and the proof is simplified where possible. Return the full updated `condition` 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.CategoryTheory.Limits.Shapes.Pullback.PullbackCone).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/CategoryTheory/Limits/Shapes/Pullback/PullbackCone.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.CategoryTheory.Limits.Shapes.Pullback.PullbackCone.condition`, L359-L364)\n```lean\ntheorem condition (t : PushoutCocone f g) : f \u226b inl t = g \u226b inr t := (t.w fst).trans (t.w snd).symm\n\nset_option backward.isDefEq.respectTransparency false in\n/-- To check whether a morphism is coequalized by the maps of a pushout cocone, it suffices to check\n it for `inl t` and `inr t` -/\n```\n\n## Edit instruction\nEdit `condition` so it still compiles and the proof is simplified where possible. Return the full updated `condition` block.\n[/INST]", "sample_id": "D-Mathlib.CategoryTheory.Limits.Shapes.Pullback.PullbackCone.condition", "source": {"declaration": "Mathlib.CategoryTheory.Limits.Shapes.Pullback.PullbackCone.condition", "file": "Mathlib/CategoryTheory/Limits/Shapes/Pullback/PullbackCone.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.CategoryTheory.Limits.Shapes.Pullback.PullbackCone", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Limits/Shapes/Pullback/PullbackCone.lean#L359", "span": "L359-L364"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"trace_states": [{"state": "def d [Monoid G] (A : Rep k G) (n : \u2115) :\n ModuleCat.of k ((Fin n \u2192 G) \u2192 A) \u27f6 ModuleCat.of k ((Fin (n + 1) \u2192 G) \u2192 A)", "tactic": "ext"}, {"state": "", "tactic": "simp [Finset.sum_add_distrib, add_add_add_comm] map_smul' r f := by"}, {"state": "", "tactic": "ext"}, {"state": "", "tactic": "simp [Finset.smul_sum, \u2190 smul_assoc, mul_comm r] } variable [Group G] (A : Rep k G) (n : \u2115) set_option backward.isDefEq.respectTransparency false in"}], "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1174, "declarations_count": 138, "diagnostics_count": 0, "duplicate_fingerprint": "b79552b4846f5014", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 378, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "tiny", "line_count": 16, "natural_language_chars": 1174, "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.RepresentationTheory.Homological.GroupCohomology.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.RepresentationTheory.Homological.GroupCohomology.Basic.d`:\nState 0: \u22a2 def d [Monoid G] (A : Rep k G) (n : \u2115) :\n ModuleCat.of k ((Fin n \u2192 G) \u2192 A) \u27f6 ModuleCat.of k ((Fin (n + 1) \u2192 G) \u2192 A)\nTactic: ext\nState 1: \u22a2 \nTactic: simp [Finset.sum_add_distrib, add_add_add_comm] map_smul' r f := by\nState 2: \u22a2 \nTactic: ext\nState 3: \u22a2 \nTactic: simp [Finset.smul_sum, \u2190 smul_assoc, mul_comm r] } variable [Group G] (A : Rep k G) (n : \u2115) set_option backward.isDefEq.respectTransparency false in\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.RepresentationTheory.Homological.GroupCohomology.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.RepresentationTheory.Homological.GroupCohomology.Basic.d`:\nState 0: \u22a2 def d [Monoid G] (A : Rep k G) (n : \u2115) :\n ModuleCat.of k ((Fin n \u2192 G) \u2192 A) \u27f6 ModuleCat.of k ((Fin (n + 1) \u2192 G) \u2192 A)\nTactic: ext\nState 1: \u22a2 \nTactic: simp [Finset.sum_add_distrib, add_add_add_comm] map_smul' r f := by\nState 2: \u22a2 \nTactic: ext\nState 3: \u22a2 \nTactic: simp [Finset.smul_sum, \u2190 smul_assoc, mul_comm r] } variable [Group G] (A : Rep k G) (n : \u2115) set_option backward.isDefEq.respectTransparency false in\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.RepresentationTheory.Homological.GroupCohomology.Basic.d", "source": {"declaration": "Mathlib.RepresentationTheory.Homological.GroupCohomology.Basic.d", "file": "Mathlib/RepresentationTheory/Homological/GroupCohomology/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.RepresentationTheory.Homological.GroupCohomology.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RepresentationTheory/Homological/GroupCohomology/Basic.lean#L86", "span": "L86-L101"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\ntheorem IntegrableOn.congr_fun_ae (h : IntegrableOn f s \u03bc) (hst : f =\u1d50[\u03bc.restrict s] g) :\n IntegrableOn g s \u03bc := Integrable.congr h hst\n```", "instruction": "Edit `IntegrableOn` so it still compiles and the proof is simplified where possible. Return the full updated `IntegrableOn` block.", "proof_is_oneliner": false, "target_span": "L147-L150", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 878, "declarations_count": 92, "diagnostics_count": 0, "duplicate_fingerprint": "a5bd2528d4cb5acd", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 304, "lean_code_chars": 139, "lean_code_ratio": 0.1583, "length_bucket": "tiny", "line_count": 11, "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.MeasureTheory.Integral.IntegrableOn).", "role": "system"}, {"content": "You are editing a file in `Mathlib/MeasureTheory/Integral/IntegrableOn.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.MeasureTheory.Integral.IntegrableOn.IntegrableOn`, L147-L150)\n```lean\ntheorem IntegrableOn.congr_fun_ae (h : IntegrableOn f s \u03bc) (hst : f =\u1d50[\u03bc.restrict s] g) :\n IntegrableOn g s \u03bc := Integrable.congr h hst\n```\n\n## Edit instruction\nEdit `IntegrableOn` so it still compiles and the proof is simplified where possible. Return the full updated `IntegrableOn` 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.MeasureTheory.Integral.IntegrableOn).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/MeasureTheory/Integral/IntegrableOn.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.MeasureTheory.Integral.IntegrableOn.IntegrableOn`, L147-L150)\n```lean\ntheorem IntegrableOn.congr_fun_ae (h : IntegrableOn f s \u03bc) (hst : f =\u1d50[\u03bc.restrict s] g) :\n IntegrableOn g s \u03bc := Integrable.congr h hst\n```\n\n## Edit instruction\nEdit `IntegrableOn` so it still compiles and the proof is simplified where possible. Return the full updated `IntegrableOn` block.\n[/INST]", "sample_id": "D-Mathlib.MeasureTheory.Integral.IntegrableOn.IntegrableOn", "source": {"declaration": "Mathlib.MeasureTheory.Integral.IntegrableOn.IntegrableOn", "file": "Mathlib/MeasureTheory/Integral/IntegrableOn.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.MeasureTheory.Integral.IntegrableOn", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Integral/IntegrableOn.lean#L147", "span": "L147-L150"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Data.Multiset.Bind.join (L38-L40)\ndef join : Multiset (Multiset \u03b1) \u2192 Multiset \u03b1 :=\nsum", "-- Mathlib.Data.Multiset.Bind.coe_join (L41-L46)\ntheorem coe_join : \u2200 L : List (List \u03b1), join (L.map ((\u2191) : List \u03b1 \u2192 Multiset \u03b1) :\n Multiset (Multiset \u03b1)) = L.flatten\n | [] => rfl\n | l :: L => by\n exact congr_arg (fun s : Multiset \u03b1 => \u2191l + s) (coe_join L)", "-- Mathlib.Data.Multiset.Bind.join_zero (L48-L50)\ntheorem join_zero : @join \u03b1 0 = 0 :=\nrfl", "-- Mathlib.Data.Multiset.Bind.join_cons (L52-L54)\ntheorem join_cons (s S) : @join \u03b1 (s ::\u2098 S) = s + join S :=\nsum_cons _ _", "-- Mathlib.Data.Multiset.Bind.join_add (L56-L58)\ntheorem join_add (S T) : @join \u03b1 (S + T) = join S + join T :=\nsum_add _ _", "-- Mathlib.Data.Multiset.Bind.singleton_join (L60-L62)\ntheorem singleton_join (a) : join ({a} : Multiset (Multiset \u03b1)) = a :=\nsum_singleton _", "-- Mathlib.Data.Multiset.Bind.mem_join (L64-L67)\ntheorem mem_join {a S} : a \u2208 @join \u03b1 S \u2194 \u2203 s \u2208 S, a \u2208 s :=\nMultiset.induction_on S (by simp) <| by\n simp +contextual [or_and_right, exists_or]", "-- Mathlib.Data.Multiset.Bind.card_join (L69-L71)\ntheorem card_join (S) : card (@join \u03b1 S) = sum (map card S) :=\nMultiset.induction_on S (by simp) (by simp)", "-- Mathlib.Data.Multiset.Bind.map_join (L73-L78)\ntheorem map_join (f : \u03b1 \u2192 \u03b2) (S : Multiset (Multiset \u03b1)) :\n map f (join S) = join (map (map f) S) := by\ninduction S using Multiset.induction with\n | empty => simp\n | cons _ _ ih => simp [ih]", "-- Mathlib.Data.Multiset.Bind.prod_join (L80-L85)\ntheorem prod_join [CommMonoid \u03b1] {S : Multiset (Multiset \u03b1)} :\n prod (join S) = prod (map prod S) := by\ninduction S using Multiset.induction with\n | empty => simp\n | cons _ _ ih => simp [ih]", "-- Mathlib.Data.Multiset.Bind.rel_join (L86-L90)\ntheorem rel_join {r : \u03b1 \u2192 \u03b2 \u2192 Prop} {s t} (h : Rel (Rel r) s t) : Rel r s.join t.join := by\ninduction h with\n | zero => simp\n | cons hab hst ih => simpa using hab.add ih", "-- Mathlib.Data.Multiset.Bind.filter_join (L91-L96)\ntheorem filter_join (S : Multiset (Multiset \u03b1)) (p : \u03b1 \u2192 Prop) [DecidablePred p] :\n filter p (join S) = join (map (filter p) S) := by\ninduction S using Multiset.induction with\n | empty => simp\n | cons _ _ ih => simp [ih]", "-- Mathlib.Data.Multiset.Bind.filterMap_join (L97-L111)\ntheorem filterMap_join (S : Multiset (Multiset \u03b1)) (f : \u03b1 \u2192 Option \u03b2) :\n filterMap f (join S) = join (map (filterMap f) S) := by\ninduction S using Multiset.induction with\n | empty => simp\n | cons _ _ ih => simp [ih]\n\n/-! ### Bind -/\n\n\nsection Bind\n\nvariable (a : \u03b1) (s t : Multiset \u03b1) (f g : \u03b1 \u2192 Multiset \u03b2)\n\n/-- `s.bind f` is the monad bind operation, defined as `(s.map f).join`. It is the union of `f a` as\n`a` ranges over `s`. -/", "-- Mathlib.Data.Multiset.Bind.bind (L112-L114)\ndef bind (s : Multiset \u03b1) (f : \u03b1 \u2192 Multiset \u03b2) : Multiset \u03b2 :=\n(s.map f).join", "-- Mathlib.Data.Multiset.Bind.coe_bind (L116-L119)\ntheorem coe_bind (l : List \u03b1) (f : \u03b1 \u2192 List \u03b2) : (@bind \u03b1 \u03b2 l fun a => f a) = l.flatMap f := by\nrw [List.flatMap, \u2190 coe_join, List.map_map]\n rfl", "-- Mathlib.Data.Multiset.AddSub.le_add_right (L87-L89)\nlemma le_add_right (s t : Multiset \u03b1) : s \u2264 s + t := by\nsimpa using Multiset.add_le_add_left (zero_le t)", "-- Mathlib.Data.Multiset.AddSub.erase_of_notMem (L169-L171)\ntheorem erase_of_notMem {a : \u03b1} {s : Multiset \u03b1} : a \u2209 s \u2192 s.erase a = s :=\nQuot.inductionOn s fun _l h => congr_arg _ <| List.erase_of_not_mem h", "-- Mathlib.Data.Multiset.AddSub.erase_zero (L152-L154)\ntheorem erase_zero (a : \u03b1) : (0 : Multiset \u03b1).erase a = 0 :=\nrfl", "-- Mathlib.Data.Multiset.AddSub.le_iff_exists_add (L97-L103)\ntheorem le_iff_exists_add {s t : Multiset \u03b1} : s \u2264 t \u2194 \u2203 u, t = s + u :=\n\u27e8fun h =>\n leInductionOn h fun s =>\n let \u27e8l, p\u27e9 := s.exists_perm_append\n \u27e8l, Quot.sound p\u27e9,\n fun \u27e8_u, e\u27e9 => e.symm \u25b8 le_add_right _ _\u27e9", "-- Mathlib.Data.Multiset.AddSub.add_singleton_eq_iff (L186-L193)\ntheorem add_singleton_eq_iff {s t : Multiset \u03b1} {a : \u03b1} : s + {a} = t \u2194 a \u2208 t \u2227 s = t.erase a := by\nrw [Multiset.add_comm, singleton_add]\n constructor\n \u00b7 rintro rfl\n exact \u27e8s.mem_cons_self a, (s.erase_cons_head a).symm\u27e9\n \u00b7 rintro \u27e8h, rfl\u27e9\n exact cons_erase h", "-- Mathlib.Data.Multiset.AddSub.le_add_left (L90-L92)\nlemma le_add_left (s t : Multiset \u03b1) : s \u2264 t + s := by\nsimpa using Multiset.add_le_add_right (zero_le t)", "-- Mathlib.Data.Multiset.AddSub.le_cons_erase (L182-L185)\ntheorem le_cons_erase (s : Multiset \u03b1) (a : \u03b1) : s \u2264 a ::\u2098 s.erase a :=\nif h : a \u2208 s then le_of_eq (cons_erase h).symm\n else by rw [erase_of_notMem h]; apply le_cons_self", "-- Mathlib.Data.Multiset.AddSub.erase_singleton (L165-L167)\ntheorem erase_singleton (a : \u03b1) : ({a} : Multiset \u03b1).erase a = 0 :=\nerase_cons_head a 0", "-- Mathlib.Data.Multiset.AddSub.card_add (L132-L143)\ntheorem card_add (s t : Multiset \u03b1) : card (s + t) = card s + card t :=\nQuotient.inductionOn\u2082 s t fun _ _ => length_append\n\nend add\n\n/-! ### Erasing one copy of an element -/\n\nsection Erase\n\nvariable [DecidableEq \u03b1] {s t : Multiset \u03b1} {a b : \u03b1}\n\n/-- `erase s a` is the multiset that subtracts 1 from the multiplicity of `a`. -/", "-- Mathlib.Data.Multiset.AddSub.erase_cons_head (L156-L158)\ntheorem erase_cons_head (a : \u03b1) (s : Multiset \u03b1) : (a ::\u2098 s).erase a = s :=\nQuot.inductionOn s fun l => congr_arg _ <| List.erase_cons_head a l", "-- Mathlib.Data.Multiset.AddSub.erase_add_left_pos (L194-L196)\ntheorem erase_add_left_pos {a : \u03b1} {s : Multiset \u03b1} (t) : a \u2208 s \u2192 (s + t).erase a = s.erase a + t :=\nQuotient.inductionOn\u2082 s t fun _l\u2081 l\u2082 h => congr_arg _ <| erase_append_left l\u2082 h", "-- Mathlib.Data.Multiset.AddSub.count_add (L124-L130)\ntheorem count_add (a : \u03b1) : \u2200 s t, count a (s + t) = count a s + count a t :=\ncountP_add _\n\nprotected lemma add_left_inj : s + u = t + u \u2194 s = t := by classical simp [Multiset.ext]\n\nprotected lemma add_right_inj : s + t = s + u \u2194 t = u := by classical simp [Multiset.ext]", "-- Mathlib.Data.Multiset.AddSub.erase_cons_tail_of_mem (L176-L181)\ntheorem erase_cons_tail_of_mem (h : a \u2208 s) :\n (b ::\u2098 s).erase a = b ::\u2098 s.erase a := by\nrcases eq_or_ne a b with rfl | hab\n \u00b7 simp [cons_erase h]\n \u00b7 exact s.erase_cons_tail hab.symm", "-- Mathlib.Data.Multiset.AddSub.coe_erase (L148-L150)\ntheorem coe_erase (l : List \u03b1) (a : \u03b1) : erase (l : Multiset \u03b1) a = l.erase a :=\nrfl", "-- Mathlib.Data.Multiset.AddSub.erase (L144-L146)\ndef erase (s : Multiset \u03b1) (a : \u03b1) : Multiset \u03b1 :=\nQuot.liftOn s (fun l => (l.erase a : Multiset \u03b1)) fun _l\u2081 _l\u2082 p => Quot.sound (p.erase a)", "-- Mathlib.Data.Multiset.AddSub.coe_add (L58-L60)\ntheorem coe_add (s t : List \u03b1) : (s + t : Multiset \u03b1) = (s ++ t : List \u03b1) :=\nrfl", "-- Mathlib.Data.Multiset.AddSub.cons_add (L105-L107)\ntheorem cons_add (a : \u03b1) (s t : Multiset \u03b1) : a ::\u2098 s + t = a ::\u2098 (s + t) := by\nrw [\u2190 singleton_add, \u2190 singleton_add, Multiset.add_assoc]", "-- Mathlib.Data.Multiset.AddSub.erase_cons_tail (L160-L163)\ntheorem erase_cons_tail {a b : \u03b1} (s : Multiset \u03b1) (h : b \u2260 a) :\n (b ::\u2098 s).erase a = b ::\u2098 s.erase a :=\nQuot.inductionOn s fun _ => congr_arg _ <| List.erase_cons_tail (not_beq_of_ne h)", "-- Mathlib.Data.Multiset.AddSub.subset_add_right (L95-L96)\nlemma subset_add_right {s t : Multiset \u03b1} : s \u2286 t + s := subset_of_le <| le_add_left s t", "-- Mathlib.Data.Multiset.AddSub.subset_add_left (L93-L94)\nlemma subset_add_left {s t : Multiset \u03b1} : s \u2286 s + t := subset_of_le <| le_add_right s t", "-- Mathlib.Data.Multiset.AddSub.countP_add (L119-L122)\ntheorem countP_add (s t) : countP p (s + t) = countP p s + countP p t :=\nQuotient.inductionOn\u2082 s t fun _ _ => countP_append\n\nvariable [DecidableEq \u03b1] in", "-- Mathlib.Data.Multiset.AddSub.add_cons (L109-L111)\ntheorem add_cons (a : \u03b1) (s t : Multiset \u03b1) : s + a ::\u2098 t = a ::\u2098 (s + t) := by\nrw [Multiset.add_comm, cons_add, Multiset.add_comm]", "-- Mathlib.Data.Multiset.AddSub.mem_add (L113-L117)\ntheorem mem_add {a : \u03b1} {s t : Multiset \u03b1} : a \u2208 s + t \u2194 a \u2208 s \u2228 a \u2208 t :=\nQuotient.inductionOn\u2082 s t fun _l\u2081 _l\u2082 => mem_append\n\nvariable (p : \u03b1 \u2192 Prop) [DecidablePred p]", "-- Mathlib.Data.Multiset.AddSub.singleton_add (L62-L79)\ntheorem singleton_add (a : \u03b1) (s : Multiset \u03b1) : {a} + s = a ::\u2098 s :=\nrfl\n\nprotected lemma add_le_add_iff_left : s + t \u2264 s + u \u2194 t \u2264 u :=\n Quotient.inductionOn\u2083 s t u fun _ _ _ => subperm_append_left _\n\nprotected lemma add_le_add_iff_right : s + u \u2264 t + u \u2194 s \u2264 t :=\n Quotient.inductionOn\u2083 s t u fun _ _ _ => subperm_append_right _\n\nprotected alias \u27e8le_of_add_le_add_left, add_le_add_left\u27e9 := Multiset.add_le_add_iff_left\nprotected alias \u27e8le_of_add_le_add_right, add_le_add_right\u27e9 := Multiset.add_le_add_iff_right\n\nprotected lemma add_comm (s t : Multiset \u03b1) : s + t = t + s :=\n Quotient.inductionOn\u2082 s t fun _ _ \u21a6 Quot.sound perm_append_comm\n\nprotected lemma add_assoc (s t u : Multiset \u03b1) : s + t + u = s + (t + u) :=\n Quotient.inductionOn\u2083 s t u fun _ _ _ \u21a6 congr_arg _ <| append_assoc ..", "-- Mathlib.Data.Multiset.AddSub.cons_erase (L173-L175)\ntheorem cons_erase {s : Multiset \u03b1} {a : \u03b1} : a \u2208 s \u2192 a ::\u2098 s.erase a = s :=\nQuot.inductionOn s fun _l h => Quot.sound (perm_cons_erase h).symm"], "statement": "theorem zero_product : (0 : Multiset \u03b1) \u00d7\u02e2 t = 0", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 10459, "declarations_count": 1184, "diagnostics_count": 0, "duplicate_fingerprint": "deb0be6cdd7ab04d", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 3906, "lean_code_chars": 8964, "lean_code_ratio": 0.8571, "length_bucket": "medium", "line_count": 361, "natural_language_chars": 1495, "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.Data.Multiset.Bind).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem zero_product : (0 : Multiset \u03b1) \u00d7\u02e2 t = 0\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Data.Multiset.Bind.join (L38-L40)\ndef join : Multiset (Multiset \u03b1) \u2192 Multiset \u03b1 :=\nsum\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Data.Multiset.Bind.coe_join (L41-L46)\ntheorem coe_join : \u2200 L : List (List \u03b1), join (L.map ((\u2191) : List \u03b1 \u2192 Multiset \u03b1) :\n Multiset (Multiset \u03b1)) = L.flatten\n | [] => rfl\n | l :: L => by\n exact congr_arg (fun s : Multiset \u03b1 => \u2191l + s) (coe_join L)\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Data.Multiset.Bind.join_zero (L48-L50)\ntheorem join_zero : @join \u03b1 0 = 0 :=\nrfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Data.Multiset.Bind.join_cons (L52-L54)\ntheorem join_cons (s S) : @join \u03b1 (s ::\u2098 S) = s + join S :=\nsum_cons _ _\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Data.Multiset.Bind.join_add (L56-L58)\ntheorem join_add (S T) : @join \u03b1 (S + T) = join S + join T :=\nsum_add _ _\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Data.Multiset.Bind.singleton_join (L60-L62)\ntheorem singleton_join (a) : join ({a} : Multiset (Multiset \u03b1)) = a :=\nsum_singleton _\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Data.Multiset.Bind.mem_join (L64-L67)\ntheorem mem_join {a S} : a \u2208 @join \u03b1 S \u2194 \u2203 s \u2208 S, a \u2208 s :=\nMultiset.induction_on S (by simp) <| by\n simp +contextual [or_and_right, exists_or]\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Data.Multiset.Bind.card_join (L69-L71)\ntheorem card_join (S) : card (@join \u03b1 S) = sum (map card S) :=\nMultiset.induction_on S (by simp) (by simp)\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Data.Multiset.Bind.map_join (L73-L78)\ntheorem map_join (f : \u03b1 \u2192 \u03b2) (S : Multiset (Multiset \u03b1)) :\n map f (join S) = join (map (map f) S) := by\ninduction S using Multiset.induction with\n | empty => simp\n | cons _ _ ih => simp [ih]\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Data.Multiset.Bind.prod_join (L80-L85)\ntheorem prod_join [CommMonoid \u03b1] {S : Multiset (Multiset \u03b1)} :\n prod (join S) = prod (map prod S) := by\ninduction S using Multiset.induction with\n | empty => simp\n | cons _ _ ih => simp [ih]\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Data.Multiset.Bind.rel_join (L86-L90)\ntheorem rel_join {r : \u03b1 \u2192 \u03b2 \u2192 Prop} {s t} (h : Rel (Rel r) s t) : Rel r s.join t.join := by\ninduction h with\n | zero => simp\n | cons hab hst ih => simpa using hab.add ih\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Data.Multiset.Bind.filter_join (L91-L96)\ntheorem filter_join (S : Multiset (Multiset \u03b1)) (p : \u03b1 \u2192 Prop) [DecidablePred p] :\n filter p (join S) = join (map (filter p) S) := by\ninduction S using Multiset.induction with\n | empty => simp\n | cons _ _ ih => simp [ih]\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Data.Multiset.Bind.filterMap_join (L97-L111)\ntheorem filterMap_join (S : Multiset (Multiset \u03b1)) (f : \u03b1 \u2192 Option \u03b2) :\n filterMap f (join S) = join (map (filterMap f) S) := by\ninduction S using Multiset.induction with\n | empty => simp\n | cons _ _ ih => simp [ih]\n\n/-! ### Bind -/\n\n\nsection Bind\n\nvariable (a : \u03b1) (s t : Multiset \u03b1) (f g : \u03b1 \u2192 Multiset \u03b2)\n\n/-- `s.bind f` is the monad bind operation, defined as `(s.map f).join`. It is the union of `f a` as\n`a` ranges over `s`. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Data.Multiset.Bind.bind (L112-L114)\ndef bind (s : Multiset \u03b1) (f : \u03b1 \u2192 Multiset \u03b2) : Multiset \u03b2 :=\n(s.map f).join\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Data.Multiset.Bind.coe_bind (L116-L119)\ntheorem coe_bind (l : List \u03b1) (f : \u03b1 \u2192 List \u03b2) : (@bind \u03b1 \u03b2 l fun a => f a) = l.flatMap f := by\nrw [List.flatMap, \u2190 coe_join, List.map_map]\n rfl\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Data.Multiset.AddSub.le_add_right (L87-L89)\nlemma le_add_right (s t : Multiset \u03b1) : s \u2264 s + t := by\nsimpa using Multiset.add_le_add_left (zero_le t)\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Data.Multiset.AddSub.erase_of_notMem (L169-L171)\ntheorem erase_of_notMem {a : \u03b1} {s : Multiset \u03b1} : a \u2209 s \u2192 s.erase a = s :=\nQuot.inductionOn s fun _l h => congr_arg _ <| List.erase_of_not_mem h\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Data.Multiset.AddSub.erase_zero (L152-L154)\ntheorem erase_zero (a : \u03b1) : (0 : Multiset \u03b1).erase a = 0 :=\nrfl\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Data.Multiset.AddSub.le_iff_exists_add (L97-L103)\ntheorem le_iff_exists_add {s t : Multiset \u03b1} : s \u2264 t \u2194 \u2203 u, t = s + u :=\n\u27e8fun h =>\n leInductionOn h fun s =>\n let \u27e8l, p\u27e9 := s.exists_perm_append\n \u27e8l, Quot.sound p\u27e9,\n fun \u27e8_u, e\u27e9 => e.symm \u25b8 le_add_right _ _\u27e9\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Data.Multiset.AddSub.add_singleton_eq_iff (L186-L193)\ntheorem add_singleton_eq_iff {s t : Multiset \u03b1} {a : \u03b1} : s + {a} = t \u2194 a \u2208 t \u2227 s = t.erase a := by\nrw [Multiset.add_comm, singleton_add]\n constructor\n \u00b7 rintro rfl\n exact \u27e8s.mem_cons_self a, (s.erase_cons_head a).symm\u27e9\n \u00b7 rintro \u27e8h, rfl\u27e9\n exact cons_erase h\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Data.Multiset.AddSub.le_add_left (L90-L92)\nlemma le_add_left (s t : Multiset \u03b1) : s \u2264 t + s := by\nsimpa using Multiset.add_le_add_right (zero_le t)\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Data.Multiset.AddSub.le_cons_erase (L182-L185)\ntheorem le_cons_erase (s : Multiset \u03b1) (a : \u03b1) : s \u2264 a ::\u2098 s.erase a :=\nif h : a \u2208 s then le_of_eq (cons_erase h).symm\n else by rw [erase_of_notMem h]; apply le_cons_self\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Data.Multiset.AddSub.erase_singleton (L165-L167)\ntheorem erase_singleton (a : \u03b1) : ({a} : Multiset \u03b1).erase a = 0 :=\nerase_cons_head a 0\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Data.Multiset.AddSub.card_add (L132-L143)\ntheorem card_add (s t : Multiset \u03b1) : card (s + t) = card s + card t :=\nQuotient.inductionOn\u2082 s t fun _ _ => length_append\n\nend add\n\n/-! ### Erasing one copy of an element -/\n\nsection Erase\n\nvariable [DecidableEq \u03b1] {s t : Multiset \u03b1} {a b : \u03b1}\n\n/-- `erase s a` is the multiset that subtracts 1 from the multiplicity of `a`. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Data.Multiset.AddSub.erase_cons_head (L156-L158)\ntheorem erase_cons_head (a : \u03b1) (s : Multiset \u03b1) : (a ::\u2098 s).erase a = s :=\nQuot.inductionOn s fun l => congr_arg _ <| List.erase_cons_head a l\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Data.Multiset.AddSub.erase_add_left_pos (L194-L196)\ntheorem erase_add_left_pos {a : \u03b1} {s : Multiset \u03b1} (t) : a \u2208 s \u2192 (s + t).erase a = s.erase a + t :=\nQuotient.inductionOn\u2082 s t fun _l\u2081 l\u2082 h => congr_arg _ <| erase_append_left l\u2082 h\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Data.Multiset.AddSub.count_add (L124-L130)\ntheorem count_add (a : \u03b1) : \u2200 s t, count a (s + t) = count a s + count a t :=\ncountP_add _\n\nprotected lemma add_left_inj : s + u = t + u \u2194 s = t := by classical simp [Multiset.ext]\n\nprotected lemma add_right_inj : s + t = s + u \u2194 t = u := by classical simp [Multiset.ext]\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Data.Multiset.AddSub.erase_cons_tail_of_mem (L176-L181)\ntheorem erase_cons_tail_of_mem (h : a \u2208 s) :\n (b ::\u2098 s).erase a = b ::\u2098 s.erase a := by\nrcases eq_or_ne a b with rfl | hab\n \u00b7 simp [cons_erase h]\n \u00b7 exact s.erase_cons_tail hab.symm\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Data.Multiset.AddSub.coe_erase (L148-L150)\ntheorem coe_erase (l : List \u03b1) (a : \u03b1) : erase (l : Multiset \u03b1) a = l.erase a :=\nrfl\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Data.Multiset.AddSub.erase (L144-L146)\ndef erase (s : Multiset \u03b1) (a : \u03b1) : Multiset \u03b1 :=\nQuot.liftOn s (fun l => (l.erase a : Multiset \u03b1)) fun _l\u2081 _l\u2082 p => Quot.sound (p.erase a)\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Data.Multiset.AddSub.coe_add (L58-L60)\ntheorem coe_add (s t : List \u03b1) : (s + t : Multiset \u03b1) = (s ++ t : List \u03b1) :=\nrfl\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Data.Multiset.AddSub.cons_add (L105-L107)\ntheorem cons_add (a : \u03b1) (s t : Multiset \u03b1) : a ::\u2098 s + t = a ::\u2098 (s + t) := by\nrw [\u2190 singleton_add, \u2190 singleton_add, Multiset.add_assoc]\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Data.Multiset.AddSub.erase_cons_tail (L160-L163)\ntheorem erase_cons_tail {a b : \u03b1} (s : Multiset \u03b1) (h : b \u2260 a) :\n (b ::\u2098 s).erase a = b ::\u2098 s.erase a :=\nQuot.inductionOn s fun _ => congr_arg _ <| List.erase_cons_tail (not_beq_of_ne h)\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Data.Multiset.AddSub.subset_add_right (L95-L96)\nlemma subset_add_right {s t : Multiset \u03b1} : s \u2286 t + s := subset_of_le <| le_add_left s t\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Data.Multiset.AddSub.subset_add_left (L93-L94)\nlemma subset_add_left {s t : Multiset \u03b1} : s \u2286 s + t := subset_of_le <| le_add_right s t\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Data.Multiset.AddSub.countP_add (L119-L122)\ntheorem countP_add (s t) : countP p (s + t) = countP p s + countP p t :=\nQuotient.inductionOn\u2082 s t fun _ _ => countP_append\n\nvariable [DecidableEq \u03b1] in\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Data.Multiset.AddSub.add_cons (L109-L111)\ntheorem add_cons (a : \u03b1) (s t : Multiset \u03b1) : s + a ::\u2098 t = a ::\u2098 (s + t) := by\nrw [Multiset.add_comm, cons_add, Multiset.add_comm]\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Data.Multiset.AddSub.mem_add (L113-L117)\ntheorem mem_add {a : \u03b1} {s t : Multiset \u03b1} : a \u2208 s + t \u2194 a \u2208 s \u2228 a \u2208 t :=\nQuotient.inductionOn\u2082 s t fun _l\u2081 _l\u2082 => mem_append\n\nvariable (p : \u03b1 \u2192 Prop) [DecidablePred p]\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Data.Multiset.AddSub.singleton_add (L62-L79)\ntheorem singleton_add (a : \u03b1) (s : Multiset \u03b1) : {a} + s = a ::\u2098 s :=\nrfl\n\nprotected lemma add_le_add_iff_left : s + t \u2264 s + u \u2194 t \u2264 u :=\n Quotient.inductionOn\u2083 s t u fun _ _ _ => subperm_append_left _\n\nprotected lemma add_le_add_iff_right : s + u \u2264 t + u \u2194 s \u2264 t :=\n Quotient.inductionOn\u2083 s t u fun _ _ _ => subperm_append_right _\n\nprotected alias \u27e8le_of_add_le_add_left, add_le_add_left\u27e9 := Multiset.add_le_add_iff_left\nprotected alias \u27e8le_of_add_le_add_right, add_le_add_right\u27e9 := Multiset.add_le_add_iff_right\n\nprotected lemma add_comm (s t : Multiset \u03b1) : s + t = t + s :=\n Quotient.inductionOn\u2082 s t fun _ _ \u21a6 Quot.sound perm_append_comm\n\nprotected lemma add_assoc (s t u : Multiset \u03b1) : s + t + u = s + (t + u) :=\n Quotient.inductionOn\u2083 s t u fun _ _ _ \u21a6 congr_arg _ <| append_assoc ..\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Data.Multiset.AddSub.cons_erase (L173-L175)\ntheorem cons_erase {s : Multiset \u03b1} {a : \u03b1} : a \u2208 s \u2192 a ::\u2098 s.erase a = s :=\nQuot.inductionOn s fun _l h => Quot.sound (perm_cons_erase h).symm\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.Data.Multiset.Bind).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem zero_product : (0 : Multiset \u03b1) \u00d7\u02e2 t = 0\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Data.Multiset.Bind.join (L38-L40)\ndef join : Multiset (Multiset \u03b1) \u2192 Multiset \u03b1 :=\nsum\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Data.Multiset.Bind.coe_join (L41-L46)\ntheorem coe_join : \u2200 L : List (List \u03b1), join (L.map ((\u2191) : List \u03b1 \u2192 Multiset \u03b1) :\n Multiset (Multiset \u03b1)) = L.flatten\n | [] => rfl\n | l :: L => by\n exact congr_arg (fun s : Multiset \u03b1 => \u2191l + s) (coe_join L)\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Data.Multiset.Bind.join_zero (L48-L50)\ntheorem join_zero : @join \u03b1 0 = 0 :=\nrfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Data.Multiset.Bind.join_cons (L52-L54)\ntheorem join_cons (s S) : @join \u03b1 (s ::\u2098 S) = s + join S :=\nsum_cons _ _\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Data.Multiset.Bind.join_add (L56-L58)\ntheorem join_add (S T) : @join \u03b1 (S + T) = join S + join T :=\nsum_add _ _\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Data.Multiset.Bind.singleton_join (L60-L62)\ntheorem singleton_join (a) : join ({a} : Multiset (Multiset \u03b1)) = a :=\nsum_singleton _\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Data.Multiset.Bind.mem_join (L64-L67)\ntheorem mem_join {a S} : a \u2208 @join \u03b1 S \u2194 \u2203 s \u2208 S, a \u2208 s :=\nMultiset.induction_on S (by simp) <| by\n simp +contextual [or_and_right, exists_or]\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Data.Multiset.Bind.card_join (L69-L71)\ntheorem card_join (S) : card (@join \u03b1 S) = sum (map card S) :=\nMultiset.induction_on S (by simp) (by simp)\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Data.Multiset.Bind.map_join (L73-L78)\ntheorem map_join (f : \u03b1 \u2192 \u03b2) (S : Multiset (Multiset \u03b1)) :\n map f (join S) = join (map (map f) S) := by\ninduction S using Multiset.induction with\n | empty => simp\n | cons _ _ ih => simp [ih]\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Data.Multiset.Bind.prod_join (L80-L85)\ntheorem prod_join [CommMonoid \u03b1] {S : Multiset (Multiset \u03b1)} :\n prod (join S) = prod (map prod S) := by\ninduction S using Multiset.induction with\n | empty => simp\n | cons _ _ ih => simp [ih]\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Data.Multiset.Bind.rel_join (L86-L90)\ntheorem rel_join {r : \u03b1 \u2192 \u03b2 \u2192 Prop} {s t} (h : Rel (Rel r) s t) : Rel r s.join t.join := by\ninduction h with\n | zero => simp\n | cons hab hst ih => simpa using hab.add ih\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Data.Multiset.Bind.filter_join (L91-L96)\ntheorem filter_join (S : Multiset (Multiset \u03b1)) (p : \u03b1 \u2192 Prop) [DecidablePred p] :\n filter p (join S) = join (map (filter p) S) := by\ninduction S using Multiset.induction with\n | empty => simp\n | cons _ _ ih => simp [ih]\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Data.Multiset.Bind.filterMap_join (L97-L111)\ntheorem filterMap_join (S : Multiset (Multiset \u03b1)) (f : \u03b1 \u2192 Option \u03b2) :\n filterMap f (join S) = join (map (filterMap f) S) := by\ninduction S using Multiset.induction with\n | empty => simp\n | cons _ _ ih => simp [ih]\n\n/-! ### Bind -/\n\n\nsection Bind\n\nvariable (a : \u03b1) (s t : Multiset \u03b1) (f g : \u03b1 \u2192 Multiset \u03b2)\n\n/-- `s.bind f` is the monad bind operation, defined as `(s.map f).join`. It is the union of `f a` as\n`a` ranges over `s`. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Data.Multiset.Bind.bind (L112-L114)\ndef bind (s : Multiset \u03b1) (f : \u03b1 \u2192 Multiset \u03b2) : Multiset \u03b2 :=\n(s.map f).join\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Data.Multiset.Bind.coe_bind (L116-L119)\ntheorem coe_bind (l : List \u03b1) (f : \u03b1 \u2192 List \u03b2) : (@bind \u03b1 \u03b2 l fun a => f a) = l.flatMap f := by\nrw [List.flatMap, \u2190 coe_join, List.map_map]\n rfl\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Data.Multiset.AddSub.le_add_right (L87-L89)\nlemma le_add_right (s t : Multiset \u03b1) : s \u2264 s + t := by\nsimpa using Multiset.add_le_add_left (zero_le t)\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Data.Multiset.AddSub.erase_of_notMem (L169-L171)\ntheorem erase_of_notMem {a : \u03b1} {s : Multiset \u03b1} : a \u2209 s \u2192 s.erase a = s :=\nQuot.inductionOn s fun _l h => congr_arg _ <| List.erase_of_not_mem h\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Data.Multiset.AddSub.erase_zero (L152-L154)\ntheorem erase_zero (a : \u03b1) : (0 : Multiset \u03b1).erase a = 0 :=\nrfl\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Data.Multiset.AddSub.le_iff_exists_add (L97-L103)\ntheorem le_iff_exists_add {s t : Multiset \u03b1} : s \u2264 t \u2194 \u2203 u, t = s + u :=\n\u27e8fun h =>\n leInductionOn h fun s =>\n let \u27e8l, p\u27e9 := s.exists_perm_append\n \u27e8l, Quot.sound p\u27e9,\n fun \u27e8_u, e\u27e9 => e.symm \u25b8 le_add_right _ _\u27e9\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Data.Multiset.AddSub.add_singleton_eq_iff (L186-L193)\ntheorem add_singleton_eq_iff {s t : Multiset \u03b1} {a : \u03b1} : s + {a} = t \u2194 a \u2208 t \u2227 s = t.erase a := by\nrw [Multiset.add_comm, singleton_add]\n constructor\n \u00b7 rintro rfl\n exact \u27e8s.mem_cons_self a, (s.erase_cons_head a).symm\u27e9\n \u00b7 rintro \u27e8h, rfl\u27e9\n exact cons_erase h\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Data.Multiset.AddSub.le_add_left (L90-L92)\nlemma le_add_left (s t : Multiset \u03b1) : s \u2264 t + s := by\nsimpa using Multiset.add_le_add_right (zero_le t)\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Data.Multiset.AddSub.le_cons_erase (L182-L185)\ntheorem le_cons_erase (s : Multiset \u03b1) (a : \u03b1) : s \u2264 a ::\u2098 s.erase a :=\nif h : a \u2208 s then le_of_eq (cons_erase h).symm\n else by rw [erase_of_notMem h]; apply le_cons_self\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Data.Multiset.AddSub.erase_singleton (L165-L167)\ntheorem erase_singleton (a : \u03b1) : ({a} : Multiset \u03b1).erase a = 0 :=\nerase_cons_head a 0\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Data.Multiset.AddSub.card_add (L132-L143)\ntheorem card_add (s t : Multiset \u03b1) : card (s + t) = card s + card t :=\nQuotient.inductionOn\u2082 s t fun _ _ => length_append\n\nend add\n\n/-! ### Erasing one copy of an element -/\n\nsection Erase\n\nvariable [DecidableEq \u03b1] {s t : Multiset \u03b1} {a b : \u03b1}\n\n/-- `erase s a` is the multiset that subtracts 1 from the multiplicity of `a`. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Data.Multiset.AddSub.erase_cons_head (L156-L158)\ntheorem erase_cons_head (a : \u03b1) (s : Multiset \u03b1) : (a ::\u2098 s).erase a = s :=\nQuot.inductionOn s fun l => congr_arg _ <| List.erase_cons_head a l\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Data.Multiset.AddSub.erase_add_left_pos (L194-L196)\ntheorem erase_add_left_pos {a : \u03b1} {s : Multiset \u03b1} (t) : a \u2208 s \u2192 (s + t).erase a = s.erase a + t :=\nQuotient.inductionOn\u2082 s t fun _l\u2081 l\u2082 h => congr_arg _ <| erase_append_left l\u2082 h\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Data.Multiset.AddSub.count_add (L124-L130)\ntheorem count_add (a : \u03b1) : \u2200 s t, count a (s + t) = count a s + count a t :=\ncountP_add _\n\nprotected lemma add_left_inj : s + u = t + u \u2194 s = t := by classical simp [Multiset.ext]\n\nprotected lemma add_right_inj : s + t = s + u \u2194 t = u := by classical simp [Multiset.ext]\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Data.Multiset.AddSub.erase_cons_tail_of_mem (L176-L181)\ntheorem erase_cons_tail_of_mem (h : a \u2208 s) :\n (b ::\u2098 s).erase a = b ::\u2098 s.erase a := by\nrcases eq_or_ne a b with rfl | hab\n \u00b7 simp [cons_erase h]\n \u00b7 exact s.erase_cons_tail hab.symm\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Data.Multiset.AddSub.coe_erase (L148-L150)\ntheorem coe_erase (l : List \u03b1) (a : \u03b1) : erase (l : Multiset \u03b1) a = l.erase a :=\nrfl\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Data.Multiset.AddSub.erase (L144-L146)\ndef erase (s : Multiset \u03b1) (a : \u03b1) : Multiset \u03b1 :=\nQuot.liftOn s (fun l => (l.erase a : Multiset \u03b1)) fun _l\u2081 _l\u2082 p => Quot.sound (p.erase a)\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Data.Multiset.AddSub.coe_add (L58-L60)\ntheorem coe_add (s t : List \u03b1) : (s + t : Multiset \u03b1) = (s ++ t : List \u03b1) :=\nrfl\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Data.Multiset.AddSub.cons_add (L105-L107)\ntheorem cons_add (a : \u03b1) (s t : Multiset \u03b1) : a ::\u2098 s + t = a ::\u2098 (s + t) := by\nrw [\u2190 singleton_add, \u2190 singleton_add, Multiset.add_assoc]\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Data.Multiset.AddSub.erase_cons_tail (L160-L163)\ntheorem erase_cons_tail {a b : \u03b1} (s : Multiset \u03b1) (h : b \u2260 a) :\n (b ::\u2098 s).erase a = b ::\u2098 s.erase a :=\nQuot.inductionOn s fun _ => congr_arg _ <| List.erase_cons_tail (not_beq_of_ne h)\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Data.Multiset.AddSub.subset_add_right (L95-L96)\nlemma subset_add_right {s t : Multiset \u03b1} : s \u2286 t + s := subset_of_le <| le_add_left s t\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Data.Multiset.AddSub.subset_add_left (L93-L94)\nlemma subset_add_left {s t : Multiset \u03b1} : s \u2286 s + t := subset_of_le <| le_add_right s t\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Data.Multiset.AddSub.countP_add (L119-L122)\ntheorem countP_add (s t) : countP p (s + t) = countP p s + countP p t :=\nQuotient.inductionOn\u2082 s t fun _ _ => countP_append\n\nvariable [DecidableEq \u03b1] in\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Data.Multiset.AddSub.add_cons (L109-L111)\ntheorem add_cons (a : \u03b1) (s t : Multiset \u03b1) : s + a ::\u2098 t = a ::\u2098 (s + t) := by\nrw [Multiset.add_comm, cons_add, Multiset.add_comm]\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Data.Multiset.AddSub.mem_add (L113-L117)\ntheorem mem_add {a : \u03b1} {s t : Multiset \u03b1} : a \u2208 s + t \u2194 a \u2208 s \u2228 a \u2208 t :=\nQuotient.inductionOn\u2082 s t fun _l\u2081 _l\u2082 => mem_append\n\nvariable (p : \u03b1 \u2192 Prop) [DecidablePred p]\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Data.Multiset.AddSub.singleton_add (L62-L79)\ntheorem singleton_add (a : \u03b1) (s : Multiset \u03b1) : {a} + s = a ::\u2098 s :=\nrfl\n\nprotected lemma add_le_add_iff_left : s + t \u2264 s + u \u2194 t \u2264 u :=\n Quotient.inductionOn\u2083 s t u fun _ _ _ => subperm_append_left _\n\nprotected lemma add_le_add_iff_right : s + u \u2264 t + u \u2194 s \u2264 t :=\n Quotient.inductionOn\u2083 s t u fun _ _ _ => subperm_append_right _\n\nprotected alias \u27e8le_of_add_le_add_left, add_le_add_left\u27e9 := Multiset.add_le_add_iff_left\nprotected alias \u27e8le_of_add_le_add_right, add_le_add_right\u27e9 := Multiset.add_le_add_iff_right\n\nprotected lemma add_comm (s t : Multiset \u03b1) : s + t = t + s :=\n Quotient.inductionOn\u2082 s t fun _ _ \u21a6 Quot.sound perm_append_comm\n\nprotected lemma add_assoc (s t u : Multiset \u03b1) : s + t + u = s + (t + u) :=\n Quotient.inductionOn\u2083 s t u fun _ _ _ \u21a6 congr_arg _ <| append_assoc ..\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Data.Multiset.AddSub.cons_erase (L173-L175)\ntheorem cons_erase {s : Multiset \u03b1} {a : \u03b1} : a \u2208 s \u2192 a ::\u2098 s.erase a = s :=\nQuot.inductionOn s fun _l h => Quot.sound (perm_cons_erase h).symm\n```\n[/INST]", "sample_id": "C-Mathlib.Data.Multiset.Bind.zero_product", "source": {"declaration": "Mathlib.Data.Multiset.Bind.zero_product", "file": "Mathlib/Data/Multiset/Bind.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Data.Multiset.Bind", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Multiset/Bind.lean#L307", "span": "L307-L309"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem SeparatingLeft.toMatrix\u2082' (h : B.SeparatingLeft) : (toMatrix\u2082' R B).SeparatingLeft", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 512, "declarations_count": 54, "diagnostics_count": 0, "duplicate_fingerprint": "f73251ca57e4a536", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 146, "lean_code_chars": 91, "lean_code_ratio": 0.1777, "length_bucket": "tiny", "line_count": 7, "natural_language_chars": 421, "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.LinearAlgebra.Matrix.SesquilinearForm).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem SeparatingLeft.toMatrix\u2082' (h : B.SeparatingLeft) : (toMatrix\u2082' R B).SeparatingLeft\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.LinearAlgebra.Matrix.SesquilinearForm).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem SeparatingLeft.toMatrix\u2082' (h : B.SeparatingLeft) : (toMatrix\u2082' R B).SeparatingLeft\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.LinearAlgebra.Matrix.SesquilinearForm.SeparatingLeft", "source": {"declaration": "Mathlib.LinearAlgebra.Matrix.SesquilinearForm.SeparatingLeft", "file": "Mathlib/LinearAlgebra/Matrix/SesquilinearForm.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.LinearAlgebra.Matrix.SesquilinearForm", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/Matrix/SesquilinearForm.lean#L724", "span": "L724-L726"}} {"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 rand (\u03b1 : Type u) [Random m \u03b1] [RandomGen g] : RandGT g m \u03b1", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 523, "declarations_count": 57, "diagnostics_count": 0, "duplicate_fingerprint": "56d653304454d365", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 145, "lean_code_chars": 64, "lean_code_ratio": 0.1224, "length_bucket": "tiny", "line_count": 7, "natural_language_chars": 459, "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.Random).", "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 rand (\u03b1 : Type u) [Random m \u03b1] [RandomGen g] : RandGT g m \u03b1\n```\n\nDeclaration: `Mathlib.Control.Random.rand` (module Mathlib.Control.Random).", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Control.Random).[/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 rand (\u03b1 : Type u) [Random m \u03b1] [RandomGen g] : RandGT g m \u03b1\n```\n\nDeclaration: `Mathlib.Control.Random.rand` (module Mathlib.Control.Random).[/INST]", "sample_id": "F-Mathlib.Control.Random.rand", "source": {"declaration": "Mathlib.Control.Random.rand", "file": "Mathlib/Control/Random.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Control.Random", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Control/Random.lean#L93", "span": "L93-L95"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "def toList : t \u03b1 \u2192 List \u03b1\n:= thisIsWrongLemmaNameXYZ\nList.reverse \u2218 foldl (flip List.cons) []", "diagnostic": "[CompilationUnit(i_begin=0, i_end=99, messages=[Message(data=\"Function expected at\\n t\\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 `t` 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=13), pos_end=Position(line=1, column=16), severity=, kind=None), Message(data='Unknown identifier `thisIsWrongLemmaNameXYZ`', pos=Position(line=2, column=3), pos_end=Position(line=2, column=26), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `foldl`', pos=Position(line=3, column=15), pos_end=Position(line=3, column=20), 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": 1688, "declarations_count": 208, "diagnostics_count": 1, "duplicate_fingerprint": "018052a601f73e81", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 453, "lean_code_chars": 94, "lean_code_ratio": 0.0557, "length_bucket": "tiny", "line_count": 14, "natural_language_chars": 1594, "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.Fold).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef toList : t \u03b1 \u2192 List \u03b1\n:= thisIsWrongLemmaNameXYZ\nList.reverse \u2218 foldl (flip List.cons) []\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=99, messages=[Message(data=\"Function expected at\\n t\\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 `t` 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=13), pos_end=Position(line=1, column=16), severity=, kind=None), Message(data='Unknown identifier `thisIsWrongLemmaNameXYZ`', pos=Position(line=2, column=3), pos_end=Position(line=2, column=26), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `foldl`', pos=Position(line=3, column=15), pos_end=Position(line=3, column=20), 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.Fold).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef toList : t \u03b1 \u2192 List \u03b1\n:= thisIsWrongLemmaNameXYZ\nList.reverse \u2218 foldl (flip List.cons) []\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=99, messages=[Message(data=\"Function expected at\\n t\\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 `t` 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=13), pos_end=Position(line=1, column=16), severity=, kind=None), Message(data='Unknown identifier `thisIsWrongLemmaNameXYZ`', pos=Position(line=2, column=3), pos_end=Position(line=2, column=26), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='Unknown identifier `foldl`', pos=Position(line=3, column=15), pos_end=Position(line=3, column=20), 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.Fold.toList", "source": {"declaration": "Mathlib.Control.Fold.toList", "file": "Mathlib/Control/Fold.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Control.Fold", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Control/Fold.lean#L208", "span": "L208-L210"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "lemma Integrable.of_finite [Finite \u03b1] [MeasurableSingletonClass \u03b1] [IsFiniteMeasure \u03bc] {f : \u03b1 \u2192 \u03b2} :\n Integrable f \u03bc", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 545, "declarations_count": 54, "diagnostics_count": 0, "duplicate_fingerprint": "63cba3d697a8164b", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 161, "lean_code_chars": 120, "lean_code_ratio": 0.2202, "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.MeasureTheory.Function.L1Space.Integrable).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\nlemma Integrable.of_finite [Finite \u03b1] [MeasurableSingletonClass \u03b1] [IsFiniteMeasure \u03bc] {f : \u03b1 \u2192 \u03b2} :\n Integrable 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": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Function.L1Space.Integrable).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma Integrable.of_finite [Finite \u03b1] [MeasurableSingletonClass \u03b1] [IsFiniteMeasure \u03bc] {f : \u03b1 \u2192 \u03b2} :\n Integrable f \u03bc\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.MeasureTheory.Function.L1Space.Integrable.Integrable", "source": {"declaration": "Mathlib.MeasureTheory.Function.L1Space.Integrable.Integrable", "file": "Mathlib/MeasureTheory/Function/L1Space/Integrable.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.MeasureTheory.Function.L1Space.Integrable", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Function/L1Space/Integrable.lean#L167", "span": "L167-L170"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "theorem mem_sUnion_of_mem {x y z : ZFSet} (hy : y \u2208 z) (hz : z \u2208 x) : y \u2208 \u22c3\u2080 x\n:= .someMissingNamespaceXYZ\nmem_sUnion.2 \u27e8z, hz, hy\u27e9", "diagnostic": "[CompilationUnit(i_begin=0, i_end=145, messages=[Message(data='overloaded, errors \\n 1:77 Application type mismatch: The argument\\n x\\n has type\\n ZFSet.{?u.409}\\n but is expected to have type\\n PSet.{?u.409}\\n in the application\\n \u22c3\u2080 x\\n \\n 1:77 Application type mismatch: The argument\\n x\\n has type\\n ZFSet.{?u.2}\\n but is expected to have type\\n Set (Set ?m.10)\\n in the application\\n \u22c3\u2080 x', pos=Position(line=1, column=74), pos_end=Position(line=1, column=78), 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": 1226, "declarations_count": 163, "diagnostics_count": 1, "duplicate_fingerprint": "4078e580fd0109c0", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 403, "lean_code_chars": 132, "lean_code_ratio": 0.1077, "length_bucket": "tiny", "line_count": 14, "natural_language_chars": 1094, "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.SetTheory.ZFC.Basic).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem mem_sUnion_of_mem {x y z : ZFSet} (hy : y \u2208 z) (hz : z \u2208 x) : y \u2208 \u22c3\u2080 x\n:= .someMissingNamespaceXYZ\nmem_sUnion.2 \u27e8z, hz, hy\u27e9\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=145, messages=[Message(data='overloaded, errors \\n 1:77 Application type mismatch: The argument\\n x\\n has type\\n ZFSet.{?u.409}\\n but is expected to have type\\n PSet.{?u.409}\\n in the application\\n \u22c3\u2080 x\\n \\n 1:77 Application type mismatch: The argument\\n x\\n has type\\n ZFSet.{?u.2}\\n but is expected to have type\\n Set (Set ?m.10)\\n in the application\\n \u22c3\u2080 x', pos=Position(line=1, column=74), pos_end=Position(line=1, column=78), 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.SetTheory.ZFC.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem mem_sUnion_of_mem {x y z : ZFSet} (hy : y \u2208 z) (hz : z \u2208 x) : y \u2208 \u22c3\u2080 x\n:= .someMissingNamespaceXYZ\nmem_sUnion.2 \u27e8z, hz, hy\u27e9\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=145, messages=[Message(data='overloaded, errors \\n 1:77 Application type mismatch: The argument\\n x\\n has type\\n ZFSet.{?u.409}\\n but is expected to have type\\n PSet.{?u.409}\\n in the application\\n \u22c3\u2080 x\\n \\n 1:77 Application type mismatch: The argument\\n x\\n has type\\n ZFSet.{?u.2}\\n but is expected to have type\\n Set (Set ?m.10)\\n in the application\\n \u22c3\u2080 x', pos=Position(line=1, column=74), pos_end=Position(line=1, column=78), 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.SetTheory.ZFC.Basic.mem_sUnion_of_mem", "source": {"declaration": "Mathlib.SetTheory.ZFC.Basic.mem_sUnion_of_mem", "file": "Mathlib/SetTheory/ZFC/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.SetTheory.ZFC.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/SetTheory/ZFC/Basic.lean#L517", "span": "L517-L519"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "def ProjGenLinGroup (n : Type*) [Fintype n] [DecidableEq n] (R : Type*) [CommRing R] : Type _\n:= .someMissingNamespaceXYZ\nGL n R \u29f8 Subgroup.center (GL n R)\n deriving Group", "diagnostic": "[CompilationUnit(i_begin=0, i_end=174, messages=[Message(data='Invalid dotted identifier notation: Not supported on type universe\\n Type ?u.31', pos=Position(line=2, column=3), pos_end=Position(line=2, column=27), severity=, kind='lean.invalidDottedIdent._namedError'), Message(data='Failed to delta derive `Group` instance for `ProjGenLinGroup`.\\n\\nNote: Delta deriving tries the following strategies: (1) inserting the definition into each explicit non-out-param parameter of a class and (2) unfolding definitions further.', pos=Position(line=4, column=11), pos_end=Position(line=4, column=16), 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": 1416, "declarations_count": 163, "diagnostics_count": 1, "duplicate_fingerprint": "f47feebd8483dfe0", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 385, "lean_code_chars": 173, "lean_code_ratio": 0.1222, "length_bucket": "tiny", "line_count": 15, "natural_language_chars": 1243, "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.LinearAlgebra.Matrix.GeneralLinearGroup.Projective).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef ProjGenLinGroup (n : Type*) [Fintype n] [DecidableEq n] (R : Type*) [CommRing R] : Type _\n:= .someMissingNamespaceXYZ\nGL n R \u29f8 Subgroup.center (GL n R)\n deriving Group\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=174, messages=[Message(data='Invalid dotted identifier notation: Not supported on type universe\\n Type ?u.31', pos=Position(line=2, column=3), pos_end=Position(line=2, column=27), severity=, kind='lean.invalidDottedIdent._namedError'), Message(data='Failed to delta derive `Group` instance for `ProjGenLinGroup`.\\n\\nNote: Delta deriving tries the following strategies: (1) inserting the definition into each explicit non-out-param parameter of a class and (2) unfolding definitions further.', pos=Position(line=4, column=11), pos_end=Position(line=4, column=16), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.", "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.LinearAlgebra.Matrix.GeneralLinearGroup.Projective).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef ProjGenLinGroup (n : Type*) [Fintype n] [DecidableEq n] (R : Type*) [CommRing R] : Type _\n:= .someMissingNamespaceXYZ\nGL n R \u29f8 Subgroup.center (GL n R)\n deriving Group\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=174, messages=[Message(data='Invalid dotted identifier notation: Not supported on type universe\\n Type ?u.31', pos=Position(line=2, column=3), pos_end=Position(line=2, column=27), severity=, kind='lean.invalidDottedIdent._namedError'), Message(data='Failed to delta derive `Group` instance for `ProjGenLinGroup`.\\n\\nNote: Delta deriving tries the following strategies: (1) inserting the definition into each explicit non-out-param parameter of a class and (2) unfolding definitions further.', pos=Position(line=4, column=11), pos_end=Position(line=4, column=16), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "sample_id": "B-Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Projective.ProjGenLinGroup", "source": {"declaration": "Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Projective.ProjGenLinGroup", "file": "Mathlib/LinearAlgebra/Matrix/GeneralLinearGroup/Projective.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Projective", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/Matrix/GeneralLinearGroup/Projective.lean#L28", "span": "L28-L31"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "theorem leftInverse_splittingOfFunOnFintypeSurjective [Finite \u03b1] (f : M \u2192\u2097[R] \u03b1 \u2192 R)\n (s : Surjective f) : LeftInverse f (splittingOfFunOnFintypeSurjective f s)\n:= fun g => .someMissingNamespaceXYZ\nLinearMap.congr_fun (splittingOfFunOnFintypeSurjective_splits f s) g", "diagnostic": "[CompilationUnit(i_begin=0, i_end=277, messages=[Message(data='failed to synthesize instance of type class\\n NonAssocSemiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=70), pos_end=Position(line=1, column=83), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=70), pos_end=Position(line=1, column=83), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"Function expected at\\n Surjective\\nbut this term has type\\n ?m.4\\n\\nNote: Expected a function because this term is being applied to the argument\\n f\\n\\nHint: The identifier `Surjective` 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=9), pos_end=Position(line=2, column=21), severity=, kind=None), Message(data=\"Function expected at\\n LeftInverse\\nbut this term has type\\n ?m.5\\n\\nNote: Expected a function because this term is being applied to the argument\\n f\\n\\nHint: The identifier `LeftInverse` 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=25), pos_end=Position(line=2, column=78), severity=, kind=None), Message(data='stuck at solving universe constraint\\n max ?u.24856 (?u.25167+1) =?= ?u.24859+1\\nwhile trying to unify\\n Sort (max ?u.24856 (?u.25167 + 1)) : Type (max ?u.24856 (?u.25167 + 1))\\nwith\\n Type ?u.24859 : Type (?u.24859 + 1)', pos=Position(line=1, column=0), pos_end=Position(line=2, column=78), 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": 3185, "declarations_count": 412, "diagnostics_count": 1, "duplicate_fingerprint": "2c1ac7408155389c", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 913, "lean_code_chars": 270, "lean_code_ratio": 0.0848, "length_bucket": "short", "line_count": 15, "natural_language_chars": 2915, "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.LinearAlgebra.Finsupp.Pi).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem leftInverse_splittingOfFunOnFintypeSurjective [Finite \u03b1] (f : M \u2192\u2097[R] \u03b1 \u2192 R)\n (s : Surjective f) : LeftInverse f (splittingOfFunOnFintypeSurjective f s)\n:= fun g => .someMissingNamespaceXYZ\nLinearMap.congr_fun (splittingOfFunOnFintypeSurjective_splits f s) g\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=277, messages=[Message(data='failed to synthesize instance of type class\\n NonAssocSemiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=70), pos_end=Position(line=1, column=83), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=70), pos_end=Position(line=1, column=83), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"Function expected at\\n Surjective\\nbut this term has type\\n ?m.4\\n\\nNote: Expected a function because this term is being applied to the argument\\n f\\n\\nHint: The identifier `Surjective` 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=9), pos_end=Position(line=2, column=21), severity=, kind=None), Message(data=\"Function expected at\\n LeftInverse\\nbut this term has type\\n ?m.5\\n\\nNote: Expected a function because this term is being applied to the argument\\n f\\n\\nHint: The identifier `LeftInverse` 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=25), pos_end=Position(line=2, column=78), severity=, kind=None), Message(data='stuck at solving universe constraint\\n max ?u.24856 (?u.25167+1) =?= ?u.24859+1\\nwhile trying to unify\\n Sort (max ?u.24856 (?u.25167 + 1)) : Type (max ?u.24856 (?u.25167 + 1))\\nwith\\n Type ?u.24859 : Type (?u.24859 + 1)', pos=Position(line=1, column=0), pos_end=Position(line=2, column=78), 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.LinearAlgebra.Finsupp.Pi).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem leftInverse_splittingOfFunOnFintypeSurjective [Finite \u03b1] (f : M \u2192\u2097[R] \u03b1 \u2192 R)\n (s : Surjective f) : LeftInverse f (splittingOfFunOnFintypeSurjective f s)\n:= fun g => .someMissingNamespaceXYZ\nLinearMap.congr_fun (splittingOfFunOnFintypeSurjective_splits f s) g\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=277, messages=[Message(data='failed to synthesize instance of type class\\n NonAssocSemiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=70), pos_end=Position(line=1, column=83), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=70), pos_end=Position(line=1, column=83), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"Function expected at\\n Surjective\\nbut this term has type\\n ?m.4\\n\\nNote: Expected a function because this term is being applied to the argument\\n f\\n\\nHint: The identifier `Surjective` 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=9), pos_end=Position(line=2, column=21), severity=, kind=None), Message(data=\"Function expected at\\n LeftInverse\\nbut this term has type\\n ?m.5\\n\\nNote: Expected a function because this term is being applied to the argument\\n f\\n\\nHint: The identifier `LeftInverse` 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=25), pos_end=Position(line=2, column=78), severity=, kind=None), Message(data='stuck at solving universe constraint\\n max ?u.24856 (?u.25167+1) =?= ?u.24859+1\\nwhile trying to unify\\n Sort (max ?u.24856 (?u.25167 + 1)) : Type (max ?u.24856 (?u.25167 + 1))\\nwith\\n Type ?u.24859 : Type (?u.24859 + 1)', pos=Position(line=1, column=0), pos_end=Position(line=2, column=78), 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.LinearAlgebra.Finsupp.Pi.leftInverse_splittingOfFunOnFintypeSurjective", "source": {"declaration": "Mathlib.LinearAlgebra.Finsupp.Pi.leftInverse_splittingOfFunOnFintypeSurjective", "file": "Mathlib/LinearAlgebra/Finsupp/Pi.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.LinearAlgebra.Finsupp.Pi", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/Finsupp/Pi.lean#L175", "span": "L175-L178"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.CategoryTheory.IsConnected.isoConstant (L107-L115)\ndef isoConstant [IsPreconnected J] {\u03b1 : Type u\u2082} (F : J \u2964 Discrete \u03b1) (j : J) :\n F \u2245 (Functor.const J).obj (F.obj j) :=\n(IsPreconnected.IsoConstantAux.factorThroughDiscrete F).symm\n \u226a\u226b isoWhiskerRight (IsPreconnected.iso_constant _ j).some _\n \u226a\u226b NatIso.ofComponents (fun _ => eqToIso Function.apply_invFun_apply) (by simp)\n\n/-- If `J` is connected, any functor to a discrete category is constant on objects.\nThe converse is given in `IsConnected.of_any_functor_const_on_obj`.\n-/", "-- Mathlib.CategoryTheory.IsConnected.any_functor_const_on_obj (L116-L122)\ntheorem any_functor_const_on_obj [IsPreconnected J] {\u03b1 : Type u\u2082} (F : J \u2964 Discrete \u03b1) (j j' : J) :\n F.obj j = F.obj j' := by\next; exact ((isoConstant F j').hom.app j).down.1\n\n/-- If any functor to a discrete category is constant on objects, J is connected.\nThe converse of `any_functor_const_on_obj`.\n-/", "-- Mathlib.CategoryTheory.IsConnected.IsPreconnected (L123-L127)\ntheorem IsPreconnected.of_any_functor_const_on_obj\n (h : \u2200 {\u03b1 : Type u\u2081} (F : J \u2964 Discrete \u03b1), \u2200 j j' : J, F.obj j = F.obj j') :\n IsPreconnected J where\n iso_constant := fun F j' => \u27e8NatIso.ofComponents fun j => eqToIso (h F j j')\u27e9", "-- Mathlib.CategoryTheory.IsConnected.IsPreconnected (L128-L132)\ninstance IsPreconnected.prod [IsPreconnected J] [IsPreconnected K] : IsPreconnected (J \u00d7 K) := by\nrefine .of_any_functor_const_on_obj (fun {a} F \u27e8j, k\u27e9 \u27e8j', k'\u27e9 => ?_)\n exact (any_functor_const_on_obj (Prod.sectL J k \u22d9 F) j j').trans\n (any_functor_const_on_obj (Prod.sectR j' K \u22d9 F) k k')", "-- Mathlib.CategoryTheory.IsConnected.IsConnected (L133-L137)\ninstance IsConnected.prod [IsConnected J] [IsConnected K] : IsConnected (J \u00d7 K) where\n\n/-- If any functor to a discrete category is constant on objects, J is connected.\nThe converse of `any_functor_const_on_obj`.\n-/", "-- Mathlib.CategoryTheory.IsConnected.IsConnected (L138-L147)\ntheorem IsConnected.of_any_functor_const_on_obj [Nonempty J]\n (h : \u2200 {\u03b1 : Type u\u2081} (F : J \u2964 Discrete \u03b1), \u2200 j j' : J, F.obj j = F.obj j') : IsConnected J :=\n{ IsPreconnected.of_any_functor_const_on_obj h with }\n\n/-- If `J` is connected, then given any function `F` such that the presence of a\nmorphism `j\u2081 \u27f6 j\u2082` implies `F j\u2081 = F j\u2082`, we have that `F` is constant.\nThis can be thought of as a local-to-global property.\n\nThe converse is shown in `IsConnected.of_constant_of_preserves_morphisms`\n-/", "-- Mathlib.CategoryTheory.IsConnected.constant_of_preserves_morphisms (L148-L163)\ntheorem constant_of_preserves_morphisms [IsPreconnected J] {\u03b1 : Type u\u2082} (F : J \u2192 \u03b1)\n (h : \u2200 (j\u2081 j\u2082 : J) (_ : j\u2081 \u27f6 j\u2082), F j\u2081 = F j\u2082) (j j' : J) : F j = F j' := by\nsimpa using\n any_functor_const_on_obj\n { obj := Discrete.mk \u2218 F\n map := fun f => eqToHom (by ext; exact h _ _ f) }\n j j'\n\n/-- If `J` is connected, then given any function `F` such that the presence of a\nmorphism `j\u2081 \u27f6 j\u2082` implies `F j\u2081 = F j\u2082`, there exists `a` such that `F j = a`\nholds for any `j`. See `constant_of_preserves_morphisms` for a different\nformulation of the fact that `F` is constant.\nThis can be thought of as a local-to-global property.\n\nThe converse is shown in `IsConnected.of_constant_of_preserves_morphisms`\n-/", "-- Mathlib.CategoryTheory.IsConnected.constant_of_preserves_morphisms' (L164-L174)\ntheorem constant_of_preserves_morphisms' [IsConnected J] {\u03b1 : Type u\u2082} (F : J \u2192 \u03b1)\n (h : \u2200 (j\u2081 j\u2082 : J) (_ : j\u2081 \u27f6 j\u2082), F j\u2081 = F j\u2082) :\n \u2203 (a : \u03b1), \u2200 (j : J), F j = a :=\n\u27e8F (Classical.arbitrary _), fun _ \u21a6 constant_of_preserves_morphisms _ h _ _\u27e9\n\n/-- `J` is connected if: given any function `F : J \u2192 \u03b1` which is constant for any\n`j\u2081, j\u2082` for which there is a morphism `j\u2081 \u27f6 j\u2082`, then `F` is constant.\nThis can be thought of as a local-to-global property.\n\nThe converse of `constant_of_preserves_morphisms`.\n-/", "-- Mathlib.CategoryTheory.IsConnected.IsPreconnected (L175-L187)\ntheorem IsPreconnected.of_constant_of_preserves_morphisms\n (h : \u2200 {\u03b1 : Type u\u2081} (F : J \u2192 \u03b1),\n (\u2200 {j\u2081 j\u2082 : J} (_ : j\u2081 \u27f6 j\u2082), F j\u2081 = F j\u2082) \u2192 \u2200 j j' : J, F j = F j') :\n IsPreconnected J :=\nIsPreconnected.of_any_functor_const_on_obj fun F =>\n h F.obj fun f => by ext; exact Discrete.eq_of_hom (F.map f)\n\n/-- `J` is connected if: given any function `F : J \u2192 \u03b1` which is constant for any\n`j\u2081, j\u2082` for which there is a morphism `j\u2081 \u27f6 j\u2082`, then `F` is constant.\nThis can be thought of as a local-to-global property.\n\nThe converse of `constant_of_preserves_morphisms`.\n-/", "-- Mathlib.CategoryTheory.IsConnected.IsConnected (L188-L199)\ntheorem IsConnected.of_constant_of_preserves_morphisms [Nonempty J]\n (h : \u2200 {\u03b1 : Type u\u2081} (F : J \u2192 \u03b1),\n (\u2200 {j\u2081 j\u2082 : J} (_ : j\u2081 \u27f6 j\u2082), F j\u2081 = F j\u2082) \u2192 \u2200 j j' : J, F j = F j') :\n IsConnected J :=\n{ IsPreconnected.of_constant_of_preserves_morphisms h with }\n\n/-- An inductive-like property for the objects of a connected category.\nIf the set `p` is nonempty, and `p` is closed under morphisms of `J`,\nthen `p` contains all of `J`.\n\nThe converse is given in `IsConnected.of_induct`.\n-/", "-- Mathlib.CategoryTheory.IsConnected.induct_on_objects (L200-L210)\ntheorem induct_on_objects [IsPreconnected J] (p : Set J) {j\u2080 : J} (h0 : j\u2080 \u2208 p)\n (h1 : \u2200 {j\u2081 j\u2082 : J} (_ : j\u2081 \u27f6 j\u2082), j\u2081 \u2208 p \u2194 j\u2082 \u2208 p) (j : J) : j \u2208 p := by\nlet aux (j\u2081 j\u2082 : J) (f : j\u2081 \u27f6 j\u2082) := congrArg ULift.up <| (h1 f).eq\n injection constant_of_preserves_morphisms (fun k => ULift.up.{u\u2081} (k \u2208 p)) aux j j\u2080 with i\n rwa [i]\n\n/--\nIf any maximal connected component containing some element j\u2080 of J is all of J, then J is connected.\n\nThe converse of `induct_on_objects`.\n-/", "-- Mathlib.CategoryTheory.IsConnected.IsConnected (L211-L221)\ntheorem IsConnected.of_induct {j\u2080 : J}\n (h : \u2200 p : Set J, j\u2080 \u2208 p \u2192 (\u2200 {j\u2081 j\u2082 : J} (_ : j\u2081 \u27f6 j\u2082), j\u2081 \u2208 p \u2194 j\u2082 \u2208 p) \u2192 \u2200 j : J, j \u2208 p) :\n IsConnected J :=\nhave := Nonempty.intro j\u2080\n IsConnected.of_constant_of_preserves_morphisms fun {\u03b1} F a => by\n have w := h { j | F j = F j\u2080 } rfl (fun {j\u2081} {j\u2082} f => by\n change F j\u2081 = F j\u2080 \u2194 F j\u2082 = F j\u2080\n simp [a f])\n intro j j'\n rw [w j, w j']", "-- Mathlib.CategoryTheory.IsConnected.isPreconnected_induction (L238-L245)\ntheorem isPreconnected_induction [IsPreconnected J] (Z : J \u2192 Sort*)\n (h\u2081 : \u2200 {j\u2081 j\u2082 : J} (_ : j\u2081 \u27f6 j\u2082), Z j\u2081 \u2192 Z j\u2082) (h\u2082 : \u2200 {j\u2081 j\u2082 : J} (_ : j\u2081 \u27f6 j\u2082), Z j\u2082 \u2192 Z j\u2081)\n {j\u2080 : J} (x : Z j\u2080) (j : J) : Nonempty (Z j) :=\n(induct_on_objects { j | Nonempty (Z j) } \u27e8x\u27e9\n (fun f => \u27e8by rintro \u27e8y\u27e9; exact \u27e8h\u2081 f y\u27e9, by rintro \u27e8y\u27e9; exact \u27e8h\u2082 f y\u27e9\u27e9)\n j :)\n\n/-- If `J` and `K` are equivalent, then if `J` is preconnected then `K` is as well. -/", "-- Mathlib.CategoryTheory.IsConnected.isPreconnected_of_equivalent (L246-L256)\ntheorem isPreconnected_of_equivalent {K : Type u\u2082} [Category.{v\u2082} K] [IsPreconnected J]\n (e : J \u224c K) : IsPreconnected K where\n iso_constant F k :=\n\u27e8calc\n F \u2245 e.inverse \u22d9 e.functor \u22d9 F := (e.invFunIdAssoc F).symm\n _ \u2245 e.inverse \u22d9 (Functor.const J).obj ((e.functor \u22d9 F).obj (e.inverse.obj k)) :=\n isoWhiskerLeft e.inverse (isoConstant (e.functor \u22d9 F) (e.inverse.obj k))\n _ \u2245 e.inverse \u22d9 (Functor.const J).obj (F.obj k) :=\n isoWhiskerLeft _ ((F \u22d9 Functor.const J).mapIso (e.counitIso.app k))\n _ \u2245 (Functor.const K).obj (F.obj k) := NatIso.ofComponents fun _ => Iso.refl _\u27e9", "-- Mathlib.CategoryTheory.IsConnected.isPreconnected_iff_of_equivalence (L257-L261)\nlemma isPreconnected_iff_of_equivalence {K : Type u\u2082} [Category.{v\u2082} K] (e : J \u224c K) :\n IsPreconnected J \u2194 IsPreconnected K :=\n\u27e8fun _ => isPreconnected_of_equivalent e, fun _ => isPreconnected_of_equivalent e.symm\u27e9\n\n/-- If `J` and `K` are equivalent, then if `J` is connected then `K` is as well. -/"], "statement": "theorem Zigzag.of_hom_hom {j\u2081 j\u2082 j\u2083 : J} (f\u2081\u2082 : j\u2081 \u27f6 j\u2082) (f\u2082\u2083 : j\u2082 \u27f6 j\u2083) : Zigzag j\u2081 j\u2083", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 8559, "declarations_count": 1068, "diagnostics_count": 0, "duplicate_fingerprint": "e0b7f78f87c92993", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 3167, "lean_code_chars": 7731, "lean_code_ratio": 0.9033, "length_bucket": "medium", "line_count": 217, "natural_language_chars": 828, "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.CategoryTheory.IsConnected).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem Zigzag.of_hom_hom {j\u2081 j\u2082 j\u2083 : J} (f\u2081\u2082 : j\u2081 \u27f6 j\u2082) (f\u2082\u2083 : j\u2082 \u27f6 j\u2083) : Zigzag j\u2081 j\u2083\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.CategoryTheory.IsConnected.isoConstant (L107-L115)\ndef isoConstant [IsPreconnected J] {\u03b1 : Type u\u2082} (F : J \u2964 Discrete \u03b1) (j : J) :\n F \u2245 (Functor.const J).obj (F.obj j) :=\n(IsPreconnected.IsoConstantAux.factorThroughDiscrete F).symm\n \u226a\u226b isoWhiskerRight (IsPreconnected.iso_constant _ j).some _\n \u226a\u226b NatIso.ofComponents (fun _ => eqToIso Function.apply_invFun_apply) (by simp)\n\n/-- If `J` is connected, any functor to a discrete category is constant on objects.\nThe converse is given in `IsConnected.of_any_functor_const_on_obj`.\n-/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.CategoryTheory.IsConnected.any_functor_const_on_obj (L116-L122)\ntheorem any_functor_const_on_obj [IsPreconnected J] {\u03b1 : Type u\u2082} (F : J \u2964 Discrete \u03b1) (j j' : J) :\n F.obj j = F.obj j' := by\next; exact ((isoConstant F j').hom.app j).down.1\n\n/-- If any functor to a discrete category is constant on objects, J is connected.\nThe converse of `any_functor_const_on_obj`.\n-/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.CategoryTheory.IsConnected.IsPreconnected (L123-L127)\ntheorem IsPreconnected.of_any_functor_const_on_obj\n (h : \u2200 {\u03b1 : Type u\u2081} (F : J \u2964 Discrete \u03b1), \u2200 j j' : J, F.obj j = F.obj j') :\n IsPreconnected J where\n iso_constant := fun F j' => \u27e8NatIso.ofComponents fun j => eqToIso (h F j j')\u27e9\n```\n\n-- snippet 4\n```lean\n-- Mathlib.CategoryTheory.IsConnected.IsPreconnected (L128-L132)\ninstance IsPreconnected.prod [IsPreconnected J] [IsPreconnected K] : IsPreconnected (J \u00d7 K) := by\nrefine .of_any_functor_const_on_obj (fun {a} F \u27e8j, k\u27e9 \u27e8j', k'\u27e9 => ?_)\n exact (any_functor_const_on_obj (Prod.sectL J k \u22d9 F) j j').trans\n (any_functor_const_on_obj (Prod.sectR j' K \u22d9 F) k k')\n```\n\n-- snippet 5\n```lean\n-- Mathlib.CategoryTheory.IsConnected.IsConnected (L133-L137)\ninstance IsConnected.prod [IsConnected J] [IsConnected K] : IsConnected (J \u00d7 K) where\n\n/-- If any functor to a discrete category is constant on objects, J is connected.\nThe converse of `any_functor_const_on_obj`.\n-/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.CategoryTheory.IsConnected.IsConnected (L138-L147)\ntheorem IsConnected.of_any_functor_const_on_obj [Nonempty J]\n (h : \u2200 {\u03b1 : Type u\u2081} (F : J \u2964 Discrete \u03b1), \u2200 j j' : J, F.obj j = F.obj j') : IsConnected J :=\n{ IsPreconnected.of_any_functor_const_on_obj h with }\n\n/-- If `J` is connected, then given any function `F` such that the presence of a\nmorphism `j\u2081 \u27f6 j\u2082` implies `F j\u2081 = F j\u2082`, we have that `F` is constant.\nThis can be thought of as a local-to-global property.\n\nThe converse is shown in `IsConnected.of_constant_of_preserves_morphisms`\n-/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.CategoryTheory.IsConnected.constant_of_preserves_morphisms (L148-L163)\ntheorem constant_of_preserves_morphisms [IsPreconnected J] {\u03b1 : Type u\u2082} (F : J \u2192 \u03b1)\n (h : \u2200 (j\u2081 j\u2082 : J) (_ : j\u2081 \u27f6 j\u2082), F j\u2081 = F j\u2082) (j j' : J) : F j = F j' := by\nsimpa using\n any_functor_const_on_obj\n { obj := Discrete.mk \u2218 F\n map := fun f => eqToHom (by ext; exact h _ _ f) }\n j j'\n\n/-- If `J` is connected, then given any function `F` such that the presence of a\nmorphism `j\u2081 \u27f6 j\u2082` implies `F j\u2081 = F j\u2082`, there exists `a` such that `F j = a`\nholds for any `j`. See `constant_of_preserves_morphisms` for a different\nformulation of the fact that `F` is constant.\nThis can be thought of as a local-to-global property.\n\nThe converse is shown in `IsConnected.of_constant_of_preserves_morphisms`\n-/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.CategoryTheory.IsConnected.constant_of_preserves_morphisms' (L164-L174)\ntheorem constant_of_preserves_morphisms' [IsConnected J] {\u03b1 : Type u\u2082} (F : J \u2192 \u03b1)\n (h : \u2200 (j\u2081 j\u2082 : J) (_ : j\u2081 \u27f6 j\u2082), F j\u2081 = F j\u2082) :\n \u2203 (a : \u03b1), \u2200 (j : J), F j = a :=\n\u27e8F (Classical.arbitrary _), fun _ \u21a6 constant_of_preserves_morphisms _ h _ _\u27e9\n\n/-- `J` is connected if: given any function `F : J \u2192 \u03b1` which is constant for any\n`j\u2081, j\u2082` for which there is a morphism `j\u2081 \u27f6 j\u2082`, then `F` is constant.\nThis can be thought of as a local-to-global property.\n\nThe converse of `constant_of_preserves_morphisms`.\n-/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.CategoryTheory.IsConnected.IsPreconnected (L175-L187)\ntheorem IsPreconnected.of_constant_of_preserves_morphisms\n (h : \u2200 {\u03b1 : Type u\u2081} (F : J \u2192 \u03b1),\n (\u2200 {j\u2081 j\u2082 : J} (_ : j\u2081 \u27f6 j\u2082), F j\u2081 = F j\u2082) \u2192 \u2200 j j' : J, F j = F j') :\n IsPreconnected J :=\nIsPreconnected.of_any_functor_const_on_obj fun F =>\n h F.obj fun f => by ext; exact Discrete.eq_of_hom (F.map f)\n\n/-- `J` is connected if: given any function `F : J \u2192 \u03b1` which is constant for any\n`j\u2081, j\u2082` for which there is a morphism `j\u2081 \u27f6 j\u2082`, then `F` is constant.\nThis can be thought of as a local-to-global property.\n\nThe converse of `constant_of_preserves_morphisms`.\n-/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.CategoryTheory.IsConnected.IsConnected (L188-L199)\ntheorem IsConnected.of_constant_of_preserves_morphisms [Nonempty J]\n (h : \u2200 {\u03b1 : Type u\u2081} (F : J \u2192 \u03b1),\n (\u2200 {j\u2081 j\u2082 : J} (_ : j\u2081 \u27f6 j\u2082), F j\u2081 = F j\u2082) \u2192 \u2200 j j' : J, F j = F j') :\n IsConnected J :=\n{ IsPreconnected.of_constant_of_preserves_morphisms h with }\n\n/-- An inductive-like property for the objects of a connected category.\nIf the set `p` is nonempty, and `p` is closed under morphisms of `J`,\nthen `p` contains all of `J`.\n\nThe converse is given in `IsConnected.of_induct`.\n-/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.CategoryTheory.IsConnected.induct_on_objects (L200-L210)\ntheorem induct_on_objects [IsPreconnected J] (p : Set J) {j\u2080 : J} (h0 : j\u2080 \u2208 p)\n (h1 : \u2200 {j\u2081 j\u2082 : J} (_ : j\u2081 \u27f6 j\u2082), j\u2081 \u2208 p \u2194 j\u2082 \u2208 p) (j : J) : j \u2208 p := by\nlet aux (j\u2081 j\u2082 : J) (f : j\u2081 \u27f6 j\u2082) := congrArg ULift.up <| (h1 f).eq\n injection constant_of_preserves_morphisms (fun k => ULift.up.{u\u2081} (k \u2208 p)) aux j j\u2080 with i\n rwa [i]\n\n/--\nIf any maximal connected component containing some element j\u2080 of J is all of J, then J is connected.\n\nThe converse of `induct_on_objects`.\n-/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.CategoryTheory.IsConnected.IsConnected (L211-L221)\ntheorem IsConnected.of_induct {j\u2080 : J}\n (h : \u2200 p : Set J, j\u2080 \u2208 p \u2192 (\u2200 {j\u2081 j\u2082 : J} (_ : j\u2081 \u27f6 j\u2082), j\u2081 \u2208 p \u2194 j\u2082 \u2208 p) \u2192 \u2200 j : J, j \u2208 p) :\n IsConnected J :=\nhave := Nonempty.intro j\u2080\n IsConnected.of_constant_of_preserves_morphisms fun {\u03b1} F a => by\n have w := h { j | F j = F j\u2080 } rfl (fun {j\u2081} {j\u2082} f => by\n change F j\u2081 = F j\u2080 \u2194 F j\u2082 = F j\u2080\n simp [a f])\n intro j j'\n rw [w j, w j']\n```\n\n-- snippet 13\n```lean\n-- Mathlib.CategoryTheory.IsConnected.isPreconnected_induction (L238-L245)\ntheorem isPreconnected_induction [IsPreconnected J] (Z : J \u2192 Sort*)\n (h\u2081 : \u2200 {j\u2081 j\u2082 : J} (_ : j\u2081 \u27f6 j\u2082), Z j\u2081 \u2192 Z j\u2082) (h\u2082 : \u2200 {j\u2081 j\u2082 : J} (_ : j\u2081 \u27f6 j\u2082), Z j\u2082 \u2192 Z j\u2081)\n {j\u2080 : J} (x : Z j\u2080) (j : J) : Nonempty (Z j) :=\n(induct_on_objects { j | Nonempty (Z j) } \u27e8x\u27e9\n (fun f => \u27e8by rintro \u27e8y\u27e9; exact \u27e8h\u2081 f y\u27e9, by rintro \u27e8y\u27e9; exact \u27e8h\u2082 f y\u27e9\u27e9)\n j :)\n\n/-- If `J` and `K` are equivalent, then if `J` is preconnected then `K` is as well. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.CategoryTheory.IsConnected.isPreconnected_of_equivalent (L246-L256)\ntheorem isPreconnected_of_equivalent {K : Type u\u2082} [Category.{v\u2082} K] [IsPreconnected J]\n (e : J \u224c K) : IsPreconnected K where\n iso_constant F k :=\n\u27e8calc\n F \u2245 e.inverse \u22d9 e.functor \u22d9 F := (e.invFunIdAssoc F).symm\n _ \u2245 e.inverse \u22d9 (Functor.const J).obj ((e.functor \u22d9 F).obj (e.inverse.obj k)) :=\n isoWhiskerLeft e.inverse (isoConstant (e.functor \u22d9 F) (e.inverse.obj k))\n _ \u2245 e.inverse \u22d9 (Functor.const J).obj (F.obj k) :=\n isoWhiskerLeft _ ((F \u22d9 Functor.const J).mapIso (e.counitIso.app k))\n _ \u2245 (Functor.const K).obj (F.obj k) := NatIso.ofComponents fun _ => Iso.refl _\u27e9\n```\n\n-- snippet 15\n```lean\n-- Mathlib.CategoryTheory.IsConnected.isPreconnected_iff_of_equivalence (L257-L261)\nlemma isPreconnected_iff_of_equivalence {K : Type u\u2082} [Category.{v\u2082} K] (e : J \u224c K) :\n IsPreconnected J \u2194 IsPreconnected K :=\n\u27e8fun _ => isPreconnected_of_equivalent e, fun _ => isPreconnected_of_equivalent e.symm\u27e9\n\n/-- If `J` and `K` are equivalent, then if `J` is connected then `K` is as well. -/\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.CategoryTheory.IsConnected).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem Zigzag.of_hom_hom {j\u2081 j\u2082 j\u2083 : J} (f\u2081\u2082 : j\u2081 \u27f6 j\u2082) (f\u2082\u2083 : j\u2082 \u27f6 j\u2083) : Zigzag j\u2081 j\u2083\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.CategoryTheory.IsConnected.isoConstant (L107-L115)\ndef isoConstant [IsPreconnected J] {\u03b1 : Type u\u2082} (F : J \u2964 Discrete \u03b1) (j : J) :\n F \u2245 (Functor.const J).obj (F.obj j) :=\n(IsPreconnected.IsoConstantAux.factorThroughDiscrete F).symm\n \u226a\u226b isoWhiskerRight (IsPreconnected.iso_constant _ j).some _\n \u226a\u226b NatIso.ofComponents (fun _ => eqToIso Function.apply_invFun_apply) (by simp)\n\n/-- If `J` is connected, any functor to a discrete category is constant on objects.\nThe converse is given in `IsConnected.of_any_functor_const_on_obj`.\n-/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.CategoryTheory.IsConnected.any_functor_const_on_obj (L116-L122)\ntheorem any_functor_const_on_obj [IsPreconnected J] {\u03b1 : Type u\u2082} (F : J \u2964 Discrete \u03b1) (j j' : J) :\n F.obj j = F.obj j' := by\next; exact ((isoConstant F j').hom.app j).down.1\n\n/-- If any functor to a discrete category is constant on objects, J is connected.\nThe converse of `any_functor_const_on_obj`.\n-/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.CategoryTheory.IsConnected.IsPreconnected (L123-L127)\ntheorem IsPreconnected.of_any_functor_const_on_obj\n (h : \u2200 {\u03b1 : Type u\u2081} (F : J \u2964 Discrete \u03b1), \u2200 j j' : J, F.obj j = F.obj j') :\n IsPreconnected J where\n iso_constant := fun F j' => \u27e8NatIso.ofComponents fun j => eqToIso (h F j j')\u27e9\n```\n\n-- snippet 4\n```lean\n-- Mathlib.CategoryTheory.IsConnected.IsPreconnected (L128-L132)\ninstance IsPreconnected.prod [IsPreconnected J] [IsPreconnected K] : IsPreconnected (J \u00d7 K) := by\nrefine .of_any_functor_const_on_obj (fun {a} F \u27e8j, k\u27e9 \u27e8j', k'\u27e9 => ?_)\n exact (any_functor_const_on_obj (Prod.sectL J k \u22d9 F) j j').trans\n (any_functor_const_on_obj (Prod.sectR j' K \u22d9 F) k k')\n```\n\n-- snippet 5\n```lean\n-- Mathlib.CategoryTheory.IsConnected.IsConnected (L133-L137)\ninstance IsConnected.prod [IsConnected J] [IsConnected K] : IsConnected (J \u00d7 K) where\n\n/-- If any functor to a discrete category is constant on objects, J is connected.\nThe converse of `any_functor_const_on_obj`.\n-/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.CategoryTheory.IsConnected.IsConnected (L138-L147)\ntheorem IsConnected.of_any_functor_const_on_obj [Nonempty J]\n (h : \u2200 {\u03b1 : Type u\u2081} (F : J \u2964 Discrete \u03b1), \u2200 j j' : J, F.obj j = F.obj j') : IsConnected J :=\n{ IsPreconnected.of_any_functor_const_on_obj h with }\n\n/-- If `J` is connected, then given any function `F` such that the presence of a\nmorphism `j\u2081 \u27f6 j\u2082` implies `F j\u2081 = F j\u2082`, we have that `F` is constant.\nThis can be thought of as a local-to-global property.\n\nThe converse is shown in `IsConnected.of_constant_of_preserves_morphisms`\n-/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.CategoryTheory.IsConnected.constant_of_preserves_morphisms (L148-L163)\ntheorem constant_of_preserves_morphisms [IsPreconnected J] {\u03b1 : Type u\u2082} (F : J \u2192 \u03b1)\n (h : \u2200 (j\u2081 j\u2082 : J) (_ : j\u2081 \u27f6 j\u2082), F j\u2081 = F j\u2082) (j j' : J) : F j = F j' := by\nsimpa using\n any_functor_const_on_obj\n { obj := Discrete.mk \u2218 F\n map := fun f => eqToHom (by ext; exact h _ _ f) }\n j j'\n\n/-- If `J` is connected, then given any function `F` such that the presence of a\nmorphism `j\u2081 \u27f6 j\u2082` implies `F j\u2081 = F j\u2082`, there exists `a` such that `F j = a`\nholds for any `j`. See `constant_of_preserves_morphisms` for a different\nformulation of the fact that `F` is constant.\nThis can be thought of as a local-to-global property.\n\nThe converse is shown in `IsConnected.of_constant_of_preserves_morphisms`\n-/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.CategoryTheory.IsConnected.constant_of_preserves_morphisms' (L164-L174)\ntheorem constant_of_preserves_morphisms' [IsConnected J] {\u03b1 : Type u\u2082} (F : J \u2192 \u03b1)\n (h : \u2200 (j\u2081 j\u2082 : J) (_ : j\u2081 \u27f6 j\u2082), F j\u2081 = F j\u2082) :\n \u2203 (a : \u03b1), \u2200 (j : J), F j = a :=\n\u27e8F (Classical.arbitrary _), fun _ \u21a6 constant_of_preserves_morphisms _ h _ _\u27e9\n\n/-- `J` is connected if: given any function `F : J \u2192 \u03b1` which is constant for any\n`j\u2081, j\u2082` for which there is a morphism `j\u2081 \u27f6 j\u2082`, then `F` is constant.\nThis can be thought of as a local-to-global property.\n\nThe converse of `constant_of_preserves_morphisms`.\n-/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.CategoryTheory.IsConnected.IsPreconnected (L175-L187)\ntheorem IsPreconnected.of_constant_of_preserves_morphisms\n (h : \u2200 {\u03b1 : Type u\u2081} (F : J \u2192 \u03b1),\n (\u2200 {j\u2081 j\u2082 : J} (_ : j\u2081 \u27f6 j\u2082), F j\u2081 = F j\u2082) \u2192 \u2200 j j' : J, F j = F j') :\n IsPreconnected J :=\nIsPreconnected.of_any_functor_const_on_obj fun F =>\n h F.obj fun f => by ext; exact Discrete.eq_of_hom (F.map f)\n\n/-- `J` is connected if: given any function `F : J \u2192 \u03b1` which is constant for any\n`j\u2081, j\u2082` for which there is a morphism `j\u2081 \u27f6 j\u2082`, then `F` is constant.\nThis can be thought of as a local-to-global property.\n\nThe converse of `constant_of_preserves_morphisms`.\n-/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.CategoryTheory.IsConnected.IsConnected (L188-L199)\ntheorem IsConnected.of_constant_of_preserves_morphisms [Nonempty J]\n (h : \u2200 {\u03b1 : Type u\u2081} (F : J \u2192 \u03b1),\n (\u2200 {j\u2081 j\u2082 : J} (_ : j\u2081 \u27f6 j\u2082), F j\u2081 = F j\u2082) \u2192 \u2200 j j' : J, F j = F j') :\n IsConnected J :=\n{ IsPreconnected.of_constant_of_preserves_morphisms h with }\n\n/-- An inductive-like property for the objects of a connected category.\nIf the set `p` is nonempty, and `p` is closed under morphisms of `J`,\nthen `p` contains all of `J`.\n\nThe converse is given in `IsConnected.of_induct`.\n-/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.CategoryTheory.IsConnected.induct_on_objects (L200-L210)\ntheorem induct_on_objects [IsPreconnected J] (p : Set J) {j\u2080 : J} (h0 : j\u2080 \u2208 p)\n (h1 : \u2200 {j\u2081 j\u2082 : J} (_ : j\u2081 \u27f6 j\u2082), j\u2081 \u2208 p \u2194 j\u2082 \u2208 p) (j : J) : j \u2208 p := by\nlet aux (j\u2081 j\u2082 : J) (f : j\u2081 \u27f6 j\u2082) := congrArg ULift.up <| (h1 f).eq\n injection constant_of_preserves_morphisms (fun k => ULift.up.{u\u2081} (k \u2208 p)) aux j j\u2080 with i\n rwa [i]\n\n/--\nIf any maximal connected component containing some element j\u2080 of J is all of J, then J is connected.\n\nThe converse of `induct_on_objects`.\n-/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.CategoryTheory.IsConnected.IsConnected (L211-L221)\ntheorem IsConnected.of_induct {j\u2080 : J}\n (h : \u2200 p : Set J, j\u2080 \u2208 p \u2192 (\u2200 {j\u2081 j\u2082 : J} (_ : j\u2081 \u27f6 j\u2082), j\u2081 \u2208 p \u2194 j\u2082 \u2208 p) \u2192 \u2200 j : J, j \u2208 p) :\n IsConnected J :=\nhave := Nonempty.intro j\u2080\n IsConnected.of_constant_of_preserves_morphisms fun {\u03b1} F a => by\n have w := h { j | F j = F j\u2080 } rfl (fun {j\u2081} {j\u2082} f => by\n change F j\u2081 = F j\u2080 \u2194 F j\u2082 = F j\u2080\n simp [a f])\n intro j j'\n rw [w j, w j']\n```\n\n-- snippet 13\n```lean\n-- Mathlib.CategoryTheory.IsConnected.isPreconnected_induction (L238-L245)\ntheorem isPreconnected_induction [IsPreconnected J] (Z : J \u2192 Sort*)\n (h\u2081 : \u2200 {j\u2081 j\u2082 : J} (_ : j\u2081 \u27f6 j\u2082), Z j\u2081 \u2192 Z j\u2082) (h\u2082 : \u2200 {j\u2081 j\u2082 : J} (_ : j\u2081 \u27f6 j\u2082), Z j\u2082 \u2192 Z j\u2081)\n {j\u2080 : J} (x : Z j\u2080) (j : J) : Nonempty (Z j) :=\n(induct_on_objects { j | Nonempty (Z j) } \u27e8x\u27e9\n (fun f => \u27e8by rintro \u27e8y\u27e9; exact \u27e8h\u2081 f y\u27e9, by rintro \u27e8y\u27e9; exact \u27e8h\u2082 f y\u27e9\u27e9)\n j :)\n\n/-- If `J` and `K` are equivalent, then if `J` is preconnected then `K` is as well. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.CategoryTheory.IsConnected.isPreconnected_of_equivalent (L246-L256)\ntheorem isPreconnected_of_equivalent {K : Type u\u2082} [Category.{v\u2082} K] [IsPreconnected J]\n (e : J \u224c K) : IsPreconnected K where\n iso_constant F k :=\n\u27e8calc\n F \u2245 e.inverse \u22d9 e.functor \u22d9 F := (e.invFunIdAssoc F).symm\n _ \u2245 e.inverse \u22d9 (Functor.const J).obj ((e.functor \u22d9 F).obj (e.inverse.obj k)) :=\n isoWhiskerLeft e.inverse (isoConstant (e.functor \u22d9 F) (e.inverse.obj k))\n _ \u2245 e.inverse \u22d9 (Functor.const J).obj (F.obj k) :=\n isoWhiskerLeft _ ((F \u22d9 Functor.const J).mapIso (e.counitIso.app k))\n _ \u2245 (Functor.const K).obj (F.obj k) := NatIso.ofComponents fun _ => Iso.refl _\u27e9\n```\n\n-- snippet 15\n```lean\n-- Mathlib.CategoryTheory.IsConnected.isPreconnected_iff_of_equivalence (L257-L261)\nlemma isPreconnected_iff_of_equivalence {K : Type u\u2082} [Category.{v\u2082} K] (e : J \u224c K) :\n IsPreconnected J \u2194 IsPreconnected K :=\n\u27e8fun _ => isPreconnected_of_equivalent e, fun _ => isPreconnected_of_equivalent e.symm\u27e9\n\n/-- If `J` and `K` are equivalent, then if `J` is connected then `K` is as well. -/\n```\n[/INST]", "sample_id": "C-Mathlib.CategoryTheory.IsConnected.Zigzag", "source": {"declaration": "Mathlib.CategoryTheory.IsConnected.Zigzag", "file": "Mathlib/CategoryTheory/IsConnected.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.CategoryTheory.IsConnected", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/IsConnected.lean#L353", "span": "L353-L355"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem coe_ideal_mul_inv (I : Ideal A) (hI0 : I \u2260 \u22a5) : I * (I : FractionalIdeal A\u2070 K)\u207b\u00b9 = 1", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 514, "declarations_count": 58, "diagnostics_count": 0, "duplicate_fingerprint": "966e60321ef9f180", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 165, "lean_code_chars": 93, "lean_code_ratio": 0.1809, "length_bucket": "tiny", "line_count": 7, "natural_language_chars": 421, "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.RingTheory.DedekindDomain.Ideal.Basic).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem coe_ideal_mul_inv (I : Ideal A) (hI0 : I \u2260 \u22a5) : I * (I : FractionalIdeal A\u2070 K)\u207b\u00b9 = 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.RingTheory.DedekindDomain.Ideal.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem coe_ideal_mul_inv (I : Ideal A) (hI0 : I \u2260 \u22a5) : I * (I : FractionalIdeal A\u2070 K)\u207b\u00b9 = 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.RingTheory.DedekindDomain.Ideal.Basic.coe_ideal_mul_inv", "source": {"declaration": "Mathlib.RingTheory.DedekindDomain.Ideal.Basic.coe_ideal_mul_inv", "file": "Mathlib/RingTheory/DedekindDomain/Ideal/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.RingTheory.DedekindDomain.Ideal.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/DedekindDomain/Ideal/Basic.lean#L289", "span": "L289-L334"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"trace_states": [{"state": "lemma coe_chainBotCoeff_eq_sSup :\n P.chainBotCoeff i j = sSup {k : \u2124 | P.root j - k \u2022 P.root i \u2208 range P.root}", "tactic": "rw [setOf_root_sub_zsmul_mem_eq_Icc h]"}, {"state": "", "tactic": "simp omit h private lemma chainCoeff_reflectionPerm_left_aux : letI := P.indexNeg Icc (-P.chainTopCoeff i j : \u2124) (P.chainBotCoeff i j) = Icc (-P.chainBotCoeff (-i) j : \u2124) (P.chainTopCoeff (-i) j) := by letI := P.indexNeg by_cases h : LinearIndependent R ![P.root i, P.root j] \u00b7 have h' : LinearIndependent R ![P.root (-i), P.root j] := by simpa"}, {"state": "", "tactic": "ext z"}, {"state": "", "tactic": "rw [\u2190 P.root_add_zsmul_mem_range_iff h', indexNeg_neg, root_reflectionPerm, mem_Icc, reflection_apply_self, smul_neg, \u2190 neg_smul, P.root_add_zsmul_mem_range_iff h, mem_Icc] grind \u00b7 have h' : \u00ac LinearIndependent R ![P.root (-i), P.root j] := by simpa"}, {"state": "", "tactic": "simp only [chainTopCoeff_of_not_linearIndependent h, chainTopCoeff_of_not_linearIndependent h', chainBotCoeff_of_not_linearIndependent h, chainBotCoeff_of_not_linearIndependent h'] private lemma chainCoeff_reflectionPerm_right_aux : letI := P.indexNeg Icc (-P.chainTopCoeff i j : \u2124) (P.chainBotCoeff i j) = Icc (-P.chainBotCoeff i (-j) : \u2124) (P.chainTopCoeff i (-j)) := by letI := P.indexNeg by_cases h : LinearIndependent R ![P.root i, P.root j] \u00b7 have h' : LinearIndependent R ![P.root i, P.root (-j)] := by simpa"}, {"state": "", "tactic": "ext z"}, {"state": "", "tactic": "rw [\u2190 P.root_add_zsmul_mem_range_iff h', indexNeg_neg, root_reflectionPerm, mem_Icc, reflection_apply_self, \u2190 sub_neg_eq_add, \u2190 neg_sub', neg_mem_range_root_iff, P.root_sub_zsmul_mem_range_iff h, mem_Icc] \u00b7 have h' : \u00ac LinearIndependent R ![P.root i, P.root (-j)] := by simpa"}, {"state": "", "tactic": "simp only [chainTopCoeff_of_not_linearIndependent h, chainTopCoeff_of_not_linearIndependent h', chainBotCoeff_of_not_linearIndependent h, chainBotCoeff_of_not_linearIndependent h']"}], "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 2952, "declarations_count": 298, "diagnostics_count": 0, "duplicate_fingerprint": "9b1a0f7a19e3af9e", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 989, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "short", "line_count": 24, "natural_language_chars": 2952, "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.LinearAlgebra.RootSystem.Chain).", "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.LinearAlgebra.RootSystem.Chain.coe_chainBotCoeff_eq_sSup`:\nState 0: \u22a2 lemma coe_chainBotCoeff_eq_sSup :\n P.chainBotCoeff i j = sSup {k : \u2124 | P.root j - k \u2022 P.root i \u2208 range P.root}\nTactic: rw [setOf_root_sub_zsmul_mem_eq_Icc h]\nState 1: \u22a2 \nTactic: simp omit h private lemma chainCoeff_reflectionPerm_left_aux : letI := P.indexNeg Icc (-P.chainTopCoeff i j : \u2124) (P.chainBotCoeff i j) = Icc (-P.chainBotCoeff (-i) j : \u2124) (P.chainTopCoeff (-i) j) := by letI := P.indexNeg by_cases h : LinearIndependent R ![P.root i, P.root j] \u00b7 have h' : LinearIndependent R ![P.root (-i), P.root j] := by simpa\nState 2: \u22a2 \nTactic: ext z\nState 3: \u22a2 \nTactic: rw [\u2190 P.root_add_zsmul_mem_range_iff h', indexNeg_neg, root_reflectionPerm, mem_Icc, reflection_apply_self, smul_neg, \u2190 neg_smul, P.root_add_zsmul_mem_range_iff h, mem_Icc] grind \u00b7 have h' : \u00ac LinearIndependent R ![P.root (-i), P.root j] := by simpa\nState 4: \u22a2 \nTactic: simp only [chainTopCoeff_of_not_linearIndependent h, chainTopCoeff_of_not_linearIndependent h', chainBotCoeff_of_not_linearIndependent h, chainBotCoeff_of_not_linearIndependent h'] private lemma chainCoeff_reflectionPerm_right_aux : letI := P.indexNeg Icc (-P.chainTopCoeff i j : \u2124) (P.chainBotCoeff i j) = Icc (-P.chainBotCoeff i (-j) : \u2124) (P.chainTopCoeff i (-j)) := by letI := P.indexNeg by_cases h : LinearIndependent R ![P.root i, P.root j] \u00b7 have h' : LinearIndependent R ![P.root i, P.root (-j)] := by simpa\nState 5: \u22a2 \nTactic: ext z\nState 6: \u22a2 \nTactic: rw [\u2190 P.root_add_zsmul_mem_range_iff h', indexNeg_neg, root_reflectionPerm, mem_Icc, reflection_apply_self, \u2190 sub_neg_eq_add, \u2190 neg_sub', neg_mem_range_root_iff, P.root_sub_zsmul_mem_range_iff h, mem_Icc] \u00b7 have h' : \u00ac LinearIndependent R ![P.root i, P.root (-j)] := by simpa\nState 7: \u22a2 \nTactic: simp only [chainTopCoeff_of_not_linearIndependent h, chainTopCoeff_of_not_linearIndependent h', chainBotCoeff_of_not_linearIndependent h, chainBotCoeff_of_not_linearIndependent 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.LinearAlgebra.RootSystem.Chain).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.LinearAlgebra.RootSystem.Chain.coe_chainBotCoeff_eq_sSup`:\nState 0: \u22a2 lemma coe_chainBotCoeff_eq_sSup :\n P.chainBotCoeff i j = sSup {k : \u2124 | P.root j - k \u2022 P.root i \u2208 range P.root}\nTactic: rw [setOf_root_sub_zsmul_mem_eq_Icc h]\nState 1: \u22a2 \nTactic: simp omit h private lemma chainCoeff_reflectionPerm_left_aux : letI := P.indexNeg Icc (-P.chainTopCoeff i j : \u2124) (P.chainBotCoeff i j) = Icc (-P.chainBotCoeff (-i) j : \u2124) (P.chainTopCoeff (-i) j) := by letI := P.indexNeg by_cases h : LinearIndependent R ![P.root i, P.root j] \u00b7 have h' : LinearIndependent R ![P.root (-i), P.root j] := by simpa\nState 2: \u22a2 \nTactic: ext z\nState 3: \u22a2 \nTactic: rw [\u2190 P.root_add_zsmul_mem_range_iff h', indexNeg_neg, root_reflectionPerm, mem_Icc, reflection_apply_self, smul_neg, \u2190 neg_smul, P.root_add_zsmul_mem_range_iff h, mem_Icc] grind \u00b7 have h' : \u00ac LinearIndependent R ![P.root (-i), P.root j] := by simpa\nState 4: \u22a2 \nTactic: simp only [chainTopCoeff_of_not_linearIndependent h, chainTopCoeff_of_not_linearIndependent h', chainBotCoeff_of_not_linearIndependent h, chainBotCoeff_of_not_linearIndependent h'] private lemma chainCoeff_reflectionPerm_right_aux : letI := P.indexNeg Icc (-P.chainTopCoeff i j : \u2124) (P.chainBotCoeff i j) = Icc (-P.chainBotCoeff i (-j) : \u2124) (P.chainTopCoeff i (-j)) := by letI := P.indexNeg by_cases h : LinearIndependent R ![P.root i, P.root j] \u00b7 have h' : LinearIndependent R ![P.root i, P.root (-j)] := by simpa\nState 5: \u22a2 \nTactic: ext z\nState 6: \u22a2 \nTactic: rw [\u2190 P.root_add_zsmul_mem_range_iff h', indexNeg_neg, root_reflectionPerm, mem_Icc, reflection_apply_self, \u2190 sub_neg_eq_add, \u2190 neg_sub', neg_mem_range_root_iff, P.root_sub_zsmul_mem_range_iff h, mem_Icc] \u00b7 have h' : \u00ac LinearIndependent R ![P.root i, P.root (-j)] := by simpa\nState 7: \u22a2 \nTactic: simp only [chainTopCoeff_of_not_linearIndependent h, chainTopCoeff_of_not_linearIndependent h', chainBotCoeff_of_not_linearIndependent h, chainBotCoeff_of_not_linearIndependent h']\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.LinearAlgebra.RootSystem.Chain.coe_chainBotCoeff_eq_sSup", "source": {"declaration": "Mathlib.LinearAlgebra.RootSystem.Chain.coe_chainBotCoeff_eq_sSup", "file": "Mathlib/LinearAlgebra/RootSystem/Chain.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.LinearAlgebra.RootSystem.Chain", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/RootSystem/Chain.lean#L218", "span": "L218-L254"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"trace_states": [{"state": "theorem FiniteDimensional.of_exists_primitive_element [Algebra.IsAlgebraic F E]\n (h : \u2203 \u03b1 : E, F\u27ee\u03b1\u27ef = \u22a4) : FiniteDimensional F E", "tactic": "obtain \u27e8\u03b1, hprim\u27e9 := h"}, {"state": "", "tactic": "have hfin := adjoin.finiteDimensional (Algebra.IsIntegral.isIntegral (R := F) \u03b1)"}, {"state": "", "tactic": "rw [hprim] at hfin"}, {"state": "", "tactic": "exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields"}], "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1233, "declarations_count": 135, "diagnostics_count": 0, "duplicate_fingerprint": "0865dceae98a400b", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 377, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "tiny", "line_count": 16, "natural_language_chars": 1233, "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.FieldTheory.PrimitiveElement).", "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.FieldTheory.PrimitiveElement.FiniteDimensional`:\nState 0: \u22a2 theorem FiniteDimensional.of_exists_primitive_element [Algebra.IsAlgebraic F E]\n (h : \u2203 \u03b1 : E, F\u27ee\u03b1\u27ef = \u22a4) : FiniteDimensional F E\nTactic: obtain \u27e8\u03b1, hprim\u27e9 := h\nState 1: \u22a2 \nTactic: have hfin := adjoin.finiteDimensional (Algebra.IsIntegral.isIntegral (R := F) \u03b1)\nState 2: \u22a2 \nTactic: rw [hprim] at hfin\nState 3: \u22a2 \nTactic: exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields\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.FieldTheory.PrimitiveElement).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.FieldTheory.PrimitiveElement.FiniteDimensional`:\nState 0: \u22a2 theorem FiniteDimensional.of_exists_primitive_element [Algebra.IsAlgebraic F E]\n (h : \u2203 \u03b1 : E, F\u27ee\u03b1\u27ef = \u22a4) : FiniteDimensional F E\nTactic: obtain \u27e8\u03b1, hprim\u27e9 := h\nState 1: \u22a2 \nTactic: have hfin := adjoin.finiteDimensional (Algebra.IsIntegral.isIntegral (R := F) \u03b1)\nState 2: \u22a2 \nTactic: rw [hprim] at hfin\nState 3: \u22a2 \nTactic: exact topEquiv.toLinearEquiv.finiteDimensional -- A finite simple extension has only finitely many intermediate fields\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.FieldTheory.PrimitiveElement.FiniteDimensional", "source": {"declaration": "Mathlib.FieldTheory.PrimitiveElement.FiniteDimensional", "file": "Mathlib/FieldTheory/PrimitiveElement.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.FieldTheory.PrimitiveElement", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/FieldTheory/PrimitiveElement.lean#L301", "span": "L301-L308"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "lemma edist_le_of_mem_pairSet (ha : 1 < a) (hJ_card : #J \u2264 a ^ n) {s t : T}\n (h : (s, t) \u2208 pairSet J a c) : edist s t \u2264 n * c", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 548, "declarations_count": 69, "diagnostics_count": 0, "duplicate_fingerprint": "6c749ee082827ffd", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 173, "lean_code_chars": 129, "lean_code_ratio": 0.2354, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 419, "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.Topology.EMetricSpace.PairReduction).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\nlemma edist_le_of_mem_pairSet (ha : 1 < a) (hJ_card : #J \u2264 a ^ n) {s t : T}\n (h : (s, t) \u2208 pairSet J a c) : edist s t \u2264 n * c\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.Topology.EMetricSpace.PairReduction).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma edist_le_of_mem_pairSet (ha : 1 < a) (hJ_card : #J \u2264 a ^ n) {s t : T}\n (h : (s, t) \u2208 pairSet J a c) : edist s t \u2264 n * c\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Topology.EMetricSpace.PairReduction.edist_le_of_mem_pairSet", "source": {"declaration": "Mathlib.Topology.EMetricSpace.PairReduction.edist_le_of_mem_pairSet", "file": "Mathlib/Topology/EMetricSpace/PairReduction.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Topology.EMetricSpace.PairReduction", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/EMetricSpace/PairReduction.lean#L377", "span": "L377-L392"}} {"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": "instance isScalarTower_closedBall_ball_ball :\n IsScalarTower (closedBall (0 : \ud835\udd5c) 1) (ball (0 : \ud835\udd5c') 1) (ball (0 : \ud835\udd5c') 1)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 672, "declarations_count": 52, "diagnostics_count": 0, "duplicate_fingerprint": "06cace734bea6452", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 212, "lean_code_chars": 123, "lean_code_ratio": 0.183, "length_bucket": "tiny", "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.Analysis.Normed.Module.Ball.Action).", "role": "system"}, {"content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\ninstance isScalarTower_closedBall_ball_ball :\n IsScalarTower (closedBall (0 : \ud835\udd5c) 1) (ball (0 : \ud835\udd5c') 1) (ball (0 : \ud835\udd5c') 1)\n```\n\nDeclaration: `Mathlib.Analysis.Normed.Module.Ball.Action.isScalarTower_closedBall_ball_ball` (module Mathlib.Analysis.Normed.Module.Ball.Action).", "role": "user"}], "rendered_text": "[SYSTEM_PROMPT]You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Normed.Module.Ball.Action).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\n```lean\ninstance isScalarTower_closedBall_ball_ball :\n IsScalarTower (closedBall (0 : \ud835\udd5c) 1) (ball (0 : \ud835\udd5c') 1) (ball (0 : \ud835\udd5c') 1)\n```\n\nDeclaration: `Mathlib.Analysis.Normed.Module.Ball.Action.isScalarTower_closedBall_ball_ball` (module Mathlib.Analysis.Normed.Module.Ball.Action).[/INST]", "sample_id": "F-Mathlib.Analysis.Normed.Module.Ball.Action.isScalarTower_closedBall_ball_ball", "source": {"declaration": "Mathlib.Analysis.Normed.Module.Ball.Action.isScalarTower_closedBall_ball_ball", "file": "Mathlib/Analysis/Normed/Module/Ball/Action.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Analysis.Normed.Module.Ball.Action", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Normed/Module/Ball/Action.lean#L130", "span": "L130-L139"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "theorem eventually_mapsTo_of_isOpen_of_omegaLimit_subset [CompactSpace \u03b2] {v : Set \u03b2}\n (hv\u2081 : IsOpen v) (hv\u2082 : \u03c9 f \u03d5 s \u2286 v) : \u2200\u1da0 t in f, MapsTo (\u03d5 t) s v\n:= by .someMissingNamespaceXYZ\nrcases eventually_closure_subset_of_isOpen_of_omegaLimit_subset f \u03d5 s hv\u2081 hv\u2082 with \u27e8u, hu_mem, hu\u27e9\n refine mem_of_superset hu_mem fun t ht x hx \u21a6 ?_\n exact hu (subset_closure <| mem_image2_of_mem ht hx)\n\n/-- The \u03c9-limit of a nonempty set w.r.t. a nontrivial filter is nonempty. -/", "diagnostic": "[CompilationUnit(i_begin=0, i_end=180, 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=180, i_end=497, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=8, column=76), 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": 1472, "declarations_count": 168, "diagnostics_count": 1, "duplicate_fingerprint": "48cf7e8ff9185ff7", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 448, "lean_code_chars": 471, "lean_code_ratio": 0.32, "length_bucket": "tiny", "line_count": 19, "natural_language_chars": 1001, "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.OmegaLimit).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem eventually_mapsTo_of_isOpen_of_omegaLimit_subset [CompactSpace \u03b2] {v : Set \u03b2}\n (hv\u2081 : IsOpen v) (hv\u2082 : \u03c9 f \u03d5 s \u2286 v) : \u2200\u1da0 t in f, MapsTo (\u03d5 t) s v\n:= by .someMissingNamespaceXYZ\nrcases eventually_closure_subset_of_isOpen_of_omegaLimit_subset f \u03d5 s hv\u2081 hv\u2082 with \u27e8u, hu_mem, hu\u27e9\n refine mem_of_superset hu_mem fun t ht x hx \u21a6 ?_\n exact hu (subset_closure <| mem_image2_of_mem ht hx)\n\n/-- The \u03c9-limit of a nonempty set w.r.t. a nontrivial filter is nonempty. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=180, 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=180, i_end=497, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=8, column=76), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.", "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.OmegaLimit).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem eventually_mapsTo_of_isOpen_of_omegaLimit_subset [CompactSpace \u03b2] {v : Set \u03b2}\n (hv\u2081 : IsOpen v) (hv\u2082 : \u03c9 f \u03d5 s \u2286 v) : \u2200\u1da0 t in f, MapsTo (\u03d5 t) s v\n:= by .someMissingNamespaceXYZ\nrcases eventually_closure_subset_of_isOpen_of_omegaLimit_subset f \u03d5 s hv\u2081 hv\u2082 with \u27e8u, hu_mem, hu\u27e9\n refine mem_of_superset hu_mem fun t ht x hx \u21a6 ?_\n exact hu (subset_closure <| mem_image2_of_mem ht hx)\n\n/-- The \u03c9-limit of a nonempty set w.r.t. a nontrivial filter is nonempty. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=180, 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=180, i_end=497, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=8, column=76), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "sample_id": "B-Mathlib.Dynamics.OmegaLimit.eventually_mapsTo_of_isOpen_of_omegaLimit_subset", "source": {"declaration": "Mathlib.Dynamics.OmegaLimit.eventually_mapsTo_of_isOpen_of_omegaLimit_subset", "file": "Mathlib/Dynamics/OmegaLimit.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Dynamics.OmegaLimit", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Dynamics/OmegaLimit.lean#L267", "span": "L267-L273"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.tensorDistrib (L48-L59)\ndef tensorDistrib :\n QuadraticMap A M\u2081 N\u2081 \u2297[R] QuadraticMap R M\u2082 N\u2082 \u2192\u2097[A] QuadraticMap A (M\u2081 \u2297[R] M\u2082) (N\u2081 \u2297[R] N\u2082) :=\nletI : Invertible (2 : A) := (Invertible.map (algebraMap R A) 2).copy 2 (map_ofNat _ _).symm\n -- while `letI`s would produce a better term than `let`, they would make this already-slow\n -- definition even slower.\n let toQ := BilinMap.toQuadraticMapLinearMap A A (M\u2081 \u2297[R] M\u2082)\n let tmulB := BilinMap.tensorDistrib R A (M\u2081 := M\u2081) (M\u2082 := M\u2082)\n let toB := AlgebraTensorModule.map\n (QuadraticMap.associated : QuadraticMap A M\u2081 N\u2081 \u2192\u2097[A] BilinMap A M\u2081 N\u2081)\n (QuadraticMap.associated : QuadraticMap R M\u2082 N\u2082 \u2192\u2097[R] BilinMap R M\u2082 N\u2082)\n toQ \u2218\u2097 tmulB \u2218\u2097 toB", "-- Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.associated_tmul (L72-L89)\ntheorem associated_tmul [Invertible (2 : A)]\n (Q\u2081 : QuadraticMap A M\u2081 N\u2081) (Q\u2082 : QuadraticMap R M\u2082 N\u2082) :\n (Q\u2081.tmul Q\u2082).associated = Q\u2081.associated.tmul Q\u2082.associated := by\nletI : Invertible (2 : A) := (Invertible.map (algebraMap R A) 2).copy 2 (map_ofNat _ _).symm\n rw [QuadraticMap.tmul, BilinMap.tmul]\n have : Subsingleton (Invertible (2 : A)) := inferInstance\n convert associated_left_inverse A (LinearMap.BilinMap.tmul_isSymm\n (QuadraticMap.associated_isSymm A Q\u2081) (QuadraticMap.associated_isSymm R Q\u2082))\n\nend QuadraticMap\n\nnamespace QuadraticForm\n\nvariable (R A) in\n/-- The tensor product of two quadratic forms injects into quadratic forms on tensor products.\n\nNote this is heterobasic; the quadratic form on the left can take values in a larger ring than\nthe one on the right. -/", "-- Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.tensorDistrib (L90-L95)\ndef tensorDistrib :\n QuadraticForm A M\u2081 \u2297[R] QuadraticForm R M\u2082 \u2192\u2097[A] QuadraticForm A (M\u2081 \u2297[R] M\u2082) :=\n(AlgebraTensorModule.rid R A A).congrQuadraticMap.toLinearMap \u2218\u2097 QuadraticMap.tensorDistrib R A\n\n-- TODO: make the RHS `MulOpposite.op (Q\u2082 m\u2082) \u2022 Q\u2081 m\u2081` so that this has a nicer defeq for\n-- `R = A` of `Q\u2081 m\u2081 * Q\u2082 m\u2082`.", "-- Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.associated_tmul (L108-L114)\ntheorem associated_tmul [Invertible (2 : A)] (Q\u2081 : QuadraticForm A M\u2081) (Q\u2082 : QuadraticForm R M\u2082) :\n (Q\u2081.tmul Q\u2082).associated = BilinForm.tmul Q\u2081.associated Q\u2082.associated := by\nrw [BilinForm.tmul, BilinForm.tensorDistrib, LinearMap.comp_apply, \u2190 BilinMap.tmul,\n \u2190 QuadraticMap.associated_tmul Q\u2081 Q\u2082]\n aesop\n\nset_option backward.isDefEq.respectTransparency false in", "-- Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.polarBilin_tmul (L115-L126)\ntheorem polarBilin_tmul [Invertible (2 : A)] (Q\u2081 : QuadraticForm A M\u2081) (Q\u2082 : QuadraticForm R M\u2082) :\n polarBilin (Q\u2081.tmul Q\u2082) = \u215f(2 : A) \u2022 BilinForm.tmul (polarBilin Q\u2081) (polarBilin Q\u2082) := by\nsimp_rw [\u2190 two_nsmul_associated A, \u2190 two_nsmul_associated R, BilinForm.tmul, tmul_smul,\n \u2190 smul_tmul', map_nsmul, associated_tmul]\n rw [smul_comm (_ : A) (_ : \u2115), \u2190 smul_assoc, two_smul _ (_ : A), invOf_two_add_invOf_two,\n one_smul]\n\nvariable (A) in\n/-- The base change of a quadratic form. -/\nprotected def baseChange (Q : QuadraticForm R M\u2082) : QuadraticForm A (A \u2297[R] M\u2082) :=\n QuadraticForm.tmul (R := R) (A := A) (M\u2081 := A) (M\u2082 := M\u2082) (QuadraticMap.sq (R := A)) Q", "-- Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.baseChange_tmul (L128-L131)\ntheorem baseChange_tmul (Q : QuadraticForm R M\u2082) (a : A) (m\u2082 : M\u2082) :\n Q.baseChange A (a \u2297\u209c m\u2082) = Q m\u2082 \u2022 (a * a) :=\ntensorDistrib_tmul _ _ _ _", "-- Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.associated_baseChange (L132-L137)\ntheorem associated_baseChange [Invertible (2 : A)] (Q : QuadraticForm R M\u2082) :\n associated (R := A) (Q.baseChange A) = BilinForm.baseChange A (associated (R := R) Q) := by\ndsimp only [QuadraticForm.baseChange, LinearMap.baseChange]\n rw [associated_tmul (QuadraticMap.sq (R := A)) Q, associated_sq]\n exact rfl", "-- Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.polarBilin_baseChange (L138-L152)\ntheorem polarBilin_baseChange [Invertible (2 : A)] (Q : QuadraticForm R M\u2082) :\n polarBilin (Q.baseChange A) = BilinForm.baseChange A (polarBilin Q) := by\nrw [QuadraticForm.baseChange, BilinForm.baseChange, polarBilin_tmul, BilinForm.tmul,\n \u2190 map_smul, smul_tmul', \u2190 two_nsmul_associated R, coe_associatedHom, associated_sq,\n smul_comm, \u2190 smul_assoc, two_smul, invOf_two_add_invOf_two, one_smul]\n\nend QuadraticForm\n\nend InvertibleTwo\n\n/-- If two quadratic maps from `A \u2297[R] M\u2082` agree on elements of the form `1 \u2297 m`, they are equal.\n\nIn other words, if a base change exists for a quadratic map, it is unique.\n\nNote that unlike `QuadraticForm.baseChange`, this does not need `Invertible (2 : R)`. -/", "-- Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.baseChange_ext (L154-L172)\ntheorem baseChange_ext \u2983Q\u2081 Q\u2082 : QuadraticMap A (A \u2297[R] M\u2082) N\u2081\u2984\n (h : \u2200 m, Q\u2081 (1 \u2297\u209c m) = Q\u2082 (1 \u2297\u209c m)) :\n Q\u2081 = Q\u2082 := by\nreplace h (a m) : Q\u2081 (a \u2297\u209c m) = Q\u2082 (a \u2297\u209c m) := by\n rw [\u2190 mul_one a, \u2190 smul_eq_mul, \u2190 smul_tmul', QuadraticMap.map_smul, QuadraticMap.map_smul, h]\n ext x\n induction x with\n | tmul => simp [h]\n | zero => simp\n | add x y hx hy =>\n have : Q\u2081.polarBilin = Q\u2082.polarBilin := by\n ext\n dsimp [polar]\n rw [\u2190 TensorProduct.tmul_add, h, h, h]\n replace := congr($this x y)\n dsimp [polar] at this\n linear_combination (norm := module) this + hx + hy\n\nend CommRing", "-- Mathlib.LinearAlgebra.QuadraticForm.Basic.congr_fun (L198-L207)\ntheorem congr_fun (h : Q = Q') (x : M) : Q x = Q' x :=\nDFunLike.congr_fun h _\n\n/-- Copy of a `QuadraticMap` with a new `toFun` equal to the old one. Useful to fix definitional\nequalities. -/\nprotected def copy (Q : QuadraticMap R M N) (Q' : M \u2192 N) (h : Q' = \u21d1Q) : QuadraticMap R M N where\n toFun := Q'\n toFun_smul := h.symm \u25b8 Q.toFun_smul\n exists_companion' := h.symm \u25b8 Q.exists_companion'", "-- Mathlib.LinearAlgebra.QuadraticForm.Basic.map_smul_of_tower (L246-L251)\ntheorem map_smul_of_tower [CommSemiring S] [Algebra S R] [SMul S M] [IsScalarTower S R M]\n [Module S N] [IsScalarTower S R N] (a : S)\n (x : M) : Q (a \u2022 x) = (a * a) \u2022 Q x := by\nrw [\u2190 IsScalarTower.algebraMap_smul R a x, Q.map_smul, \u2190 map_mul, algebraMap_smul]\n\n/-- Restrict the domain of a quadratic map -/", "-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polar_zero_left (L272-L274)\ntheorem polar_zero_left (y : M) : polar Q 0 y = 0 := by\nsimp only [polar, zero_add, QuadraticMap.map_zero, sub_zero, sub_self]", "-- Mathlib.LinearAlgebra.QuadraticForm.AlgClosed.equivalent_of_isAlgClosed (L59-L67)\ntheorem equivalent_of_isAlgClosed [Invertible (2 : K)] {M : Type*} [AddCommGroup M] [Module K M]\n [FiniteDimensional K M] (Q\u2081 Q\u2082 : QuadraticForm K M)\n (hQ\u2081 : (associated Q\u2081).SeparatingLeft)\n (hQ\u2082 : (associated Q\u2082).SeparatingLeft) : Equivalent Q\u2081 Q\u2082 :=\nopen Classical in\n (Q\u2081.equivalent_weightedSumSquares_of_isAlgClosed hQ\u2081).trans\n (Q\u2082.equivalent_weightedSumSquares_of_isAlgClosed hQ\u2082).symm\n\nend QuadraticForm", "-- Mathlib.LinearAlgebra.QuadraticForm.Basic.map_add_self (L235-L242)\ntheorem map_add_self (x : M) : Q (x + x) = 4 \u2022 Q x := by\nrw [\u2190 two_smul R x, Q.map_smul, \u2190 Nat.cast_smul_eq_nsmul R]\n norm_num\n\n-- not @[simp] because it is superseded by `ZeroHomClass.map_zero`\nprotected theorem map_zero : Q 0 = 0 := by\n rw [\u2190 @zero_smul R _ _ _ _ (0 : M), Q.map_smul, zero_mul, zero_smul]", "-- Mathlib.LinearAlgebra.QuadraticForm.Basic.coe_mk (L186-L193)\ntheorem coe_mk (toFun : M \u2192 N) (toFun_smul exists_companion') :\n \u21d1({toFun, toFun_smul, exists_companion'} : QuadraticMap R M N) = toFun := rfl\n-- this must come after the instFunLike definition\ninitialize_simps_projections QuadraticMap (toFun \u2192 apply)\n\nvariable {Q}", "-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polar_smul (L114-L116)\ntheorem polar_smul [Monoid S] [DistribMulAction S N] (f : M \u2192 N) (s : S) (x y : M) :\n polar (s \u2022 f) x y = s \u2022 polar f x y := by simp only [polar, Pi.smul_apply, smul_sub]", "-- Mathlib.LinearAlgebra.QuadraticForm.Basic.zeroHomClass (L243-L245)\ninstance zeroHomClass : ZeroHomClass (QuadraticMap R M N) M N :=\n{ QuadraticMap.instFunLike (R := R) (M := M) (N := N) with map_zero := QuadraticMap.map_zero }", "-- Mathlib.LinearAlgebra.QuadraticForm.AlgClosed.equivalent_weightedSumSquares_of_isAlgClosed (L49-L58)\ntheorem equivalent_weightedSumSquares_of_isAlgClosed [Invertible (2 : K)] {M : Type*}\n [AddCommGroup M] [Module K M]\n [FiniteDimensional K M] (Q : QuadraticForm K M) (hQ : (associated Q).SeparatingLeft) :\n Equivalent Q (weightedSumSquares K (1 : Fin (Module.finrank K M) \u2192 K)) :=\nopen Classical in\n let \u27e8w, \u27e8hw\u2081\u27e9\u27e9 := Q.equivalent_weightedSumSquares_units_of_nondegenerate' hQ\n \u27e8hw\u2081.trans (isometryEquivSumSquaresUnits w)\u27e9\n\n/-- All nondegenerate quadratic forms on an algebraically closed field of characteristic not equal\nto 2 are equivalent. -/", "-- Mathlib.LinearAlgebra.QuadraticForm.Basic.QuadraticForm (L163-L173)\nabbrev QuadraticForm : Type _ := QuadraticMap R M R\nend QuadraticForm\n\nnamespace QuadraticMap\n\nsection DFunLike\n\nvariable [CommSemiring R] [AddCommMonoid M] [Module R M] [AddCommMonoid N] [Module R N]\nvariable {Q Q' : QuadraticMap R M N}", "-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polar_add_left_iff (L121-L129)\ntheorem polar_add_left_iff {f : M \u2192 N} {x x' y : M} :\n polar f (x + x') y = polar f x y + polar f x' y \u2194\n f (x + x' + y) + (f x + f x' + f y) = f (x + x') + f (x' + y) + f (y + x) := by\nsimp only [\u2190 add_assoc]\n simp only [polar, sub_eq_iff_eq_add, eq_sub_iff_add_eq, sub_add_eq_add_sub, add_sub]\n simp only [add_right_comm _ (f y) _, add_right_comm _ (f x') (f x)]\n rw [add_comm y x, add_right_comm _ _ (f (x + y)), add_comm _ (f (x + y)),\n add_right_comm (f (x + y)), add_left_inj]", "-- Mathlib.LinearAlgebra.QuadraticForm.Basic.coe_copy (L209-L211)\ntheorem coe_copy (Q : QuadraticMap R M N) (Q' : M \u2192 N) (h : Q' = \u21d1Q) : \u21d1(Q.copy Q' h) = Q' :=\nrfl", "-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polarSym2 (L136-L138)\ndef polarSym2 (f : M \u2192 N) : Sym2 M \u2192 N :=\nSym2.lift \u27e8polar f, polar_comm _\u27e9", "-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polar (L99-L106)\ndef polar (f : M \u2192 N) (x y : M) :=\nf (x + y) - f x - f y\n\nprotected theorem map_add (f : M \u2192 N) (x y : M) :\n f (x + y) = f x + f y + polar f x y := by\n rw [polar]\n abel", "-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polarSym2_sym2Mk (L140-L162)\nlemma polarSym2_sym2Mk (f : M \u2192 N) (x y : M) : polarSym2 f s(x, y) = polar f x y := rfl\nend QuadraticMap\n\nend Polar\n\n/-- A quadratic map on a module.\n\nFor a more familiar constructor when `R` is a ring, see `QuadraticMap.ofPolar`. -/\nstructure QuadraticMap (R : Type u) (M : Type v) (N : Type w) [CommSemiring R] [AddCommMonoid M]\n [Module R M] [AddCommMonoid N] [Module R N] where\n /-- The underlying function.\n\n Do NOT use directly. Use the coercion instead. -/\n toFun : M \u2192 N\n toFun_smul : \u2200 (a : R) (x : M), toFun (a \u2022 x) = (a * a) \u2022 toFun x\n exists_companion' : \u2203 B : BilinMap R M N, \u2200 x y, toFun (x + y) = toFun x + toFun y + B x y\n\nsection QuadraticForm\n\nvariable (R : Type u) (M : Type v) [CommSemiring R] [AddCommMonoid M] [Module R M]\n\n/-- A quadratic form on a module. -/", "-- Mathlib.LinearAlgebra.QuadraticForm.Basic.ext (L195-L197)\ntheorem ext (H : \u2200 x : M, Q x = Q' x) : Q = Q' :=\nDFunLike.ext _ _ H", "-- Mathlib.LinearAlgebra.QuadraticForm.Basic.instFunLike (L174-L180)\ninstance instFunLike : FunLike (QuadraticMap R M N) M N where\n coe := toFun\ncoe_injective' x y h := by cases x; cases y; congr\n\nvariable (Q)\n\n/-- The `simp` normal form for a quadratic map is `DFunLike.coe`, not `toFun`. -/", "-- Mathlib.LinearAlgebra.QuadraticForm.Basic.map_add_add_add_map (L228-L234)\ntheorem map_add_add_add_map (x y z : M) :\n Q (x + y + z) + (Q x + Q y + Q z) = Q (x + y) + Q (y + z) + Q (z + x) := by\nobtain \u27e8B, h\u27e9 := Q.exists_companion\n rw [add_comm z x]\n simp only [h, LinearMap.map_add\u2082]\n abel", "-- Mathlib.LinearAlgebra.QuadraticForm.Basic.toFun_eq_coe (L182-L184)\ntheorem toFun_eq_coe : Q.toFun = \u21d1Q :=\nrfl", "-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polar_neg (L111-L113)\ntheorem polar_neg (f : M \u2192 N) (x y : M) : polar (-f) x y = -polar f x y := by\nsimp only [polar, Pi.neg_apply, sub_eq_add_neg, neg_add]", "-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polar_comm (L117-L120)\ntheorem polar_comm (f : M \u2192 N) (x y : M) : polar f x y = polar f y x := by\nrw [polar, polar, add_comm, sub_sub, sub_sub, add_comm (f x) (f y)]\n\n/-- Auxiliary lemma to express bilinearity of `QuadraticMap.polar` without subtraction. -/", "-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polar_add (L107-L110)\ntheorem polar_add (f g : M \u2192 N) (x y : M) : polar (f + g) x y = polar f x y + polar g x y := by\nsimp only [polar, Pi.add_apply]\n abel", "-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polar_comp (L130-L135)\ntheorem polar_comp {F : Type*} [AddCommGroup S] [FunLike F N S] [AddMonoidHomClass F N S]\n (f : M \u2192 N) (g : F) (x y : M) :\n polar (g \u2218 f) x y = g (polar f x y) := by\nsimp only [polar, Function.comp_apply, map_sub]\n\n/-- `QuadraticMap.polar` as a function from `Sym2`. -/", "-- Mathlib.LinearAlgebra.QuadraticForm.Basic.exists_companion (L225-L227)\ntheorem exists_companion : \u2203 B : BilinMap R M N, \u2200 x y, Q (x + y) = Q x + Q y + B x y :=\nQ.exists_companion'", "-- Mathlib.LinearAlgebra.QuadraticForm.Basic.copy_eq (L212-L224)\ntheorem copy_eq (Q : QuadraticMap R M N) (Q' : M \u2192 N) (h : Q' = \u21d1Q) : Q.copy Q' h = Q :=\nDFunLike.ext' h\n\nend DFunLike\n\nsection CommSemiring\n\nvariable [CommSemiring R] [AddCommMonoid M] [Module R M] [AddCommMonoid N] [Module R N]\nvariable (Q : QuadraticMap R M N)\n\nprotected theorem map_smul (a : R) (x : M) : Q (a \u2022 x) = (a * a) \u2022 Q x :=\n Q.toFun_smul a x"], "statement": "theorem tensorDistrib_tmul (Q\u2081 : QuadraticForm A M\u2081) (Q\u2082 : QuadraticForm R M\u2082) (m\u2081 : M\u2081) (m\u2082 : M\u2082) :\n tensorDistrib R A (Q\u2081 \u2297\u209c Q\u2082) (m\u2081 \u2297\u209c m\u2082) = Q\u2082 m\u2082 \u2022 Q\u2081 m\u2081", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 15034, "declarations_count": 1785, "diagnostics_count": 0, "duplicate_fingerprint": "fdbebe3f24afdce9", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 5747, "lean_code_chars": 13678, "lean_code_ratio": 0.9098, "length_bucket": "medium", "line_count": 422, "natural_language_chars": 1356, "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.LinearAlgebra.QuadraticForm.TensorProduct).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem tensorDistrib_tmul (Q\u2081 : QuadraticForm A M\u2081) (Q\u2082 : QuadraticForm R M\u2082) (m\u2081 : M\u2081) (m\u2082 : M\u2082) :\n tensorDistrib R A (Q\u2081 \u2297\u209c Q\u2082) (m\u2081 \u2297\u209c m\u2082) = Q\u2082 m\u2082 \u2022 Q\u2081 m\u2081\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.tensorDistrib (L48-L59)\ndef tensorDistrib :\n QuadraticMap A M\u2081 N\u2081 \u2297[R] QuadraticMap R M\u2082 N\u2082 \u2192\u2097[A] QuadraticMap A (M\u2081 \u2297[R] M\u2082) (N\u2081 \u2297[R] N\u2082) :=\nletI : Invertible (2 : A) := (Invertible.map (algebraMap R A) 2).copy 2 (map_ofNat _ _).symm\n -- while `letI`s would produce a better term than `let`, they would make this already-slow\n -- definition even slower.\n let toQ := BilinMap.toQuadraticMapLinearMap A A (M\u2081 \u2297[R] M\u2082)\n let tmulB := BilinMap.tensorDistrib R A (M\u2081 := M\u2081) (M\u2082 := M\u2082)\n let toB := AlgebraTensorModule.map\n (QuadraticMap.associated : QuadraticMap A M\u2081 N\u2081 \u2192\u2097[A] BilinMap A M\u2081 N\u2081)\n (QuadraticMap.associated : QuadraticMap R M\u2082 N\u2082 \u2192\u2097[R] BilinMap R M\u2082 N\u2082)\n toQ \u2218\u2097 tmulB \u2218\u2097 toB\n```\n\n-- snippet 2\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.associated_tmul (L72-L89)\ntheorem associated_tmul [Invertible (2 : A)]\n (Q\u2081 : QuadraticMap A M\u2081 N\u2081) (Q\u2082 : QuadraticMap R M\u2082 N\u2082) :\n (Q\u2081.tmul Q\u2082).associated = Q\u2081.associated.tmul Q\u2082.associated := by\nletI : Invertible (2 : A) := (Invertible.map (algebraMap R A) 2).copy 2 (map_ofNat _ _).symm\n rw [QuadraticMap.tmul, BilinMap.tmul]\n have : Subsingleton (Invertible (2 : A)) := inferInstance\n convert associated_left_inverse A (LinearMap.BilinMap.tmul_isSymm\n (QuadraticMap.associated_isSymm A Q\u2081) (QuadraticMap.associated_isSymm R Q\u2082))\n\nend QuadraticMap\n\nnamespace QuadraticForm\n\nvariable (R A) in\n/-- The tensor product of two quadratic forms injects into quadratic forms on tensor products.\n\nNote this is heterobasic; the quadratic form on the left can take values in a larger ring than\nthe one on the right. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.tensorDistrib (L90-L95)\ndef tensorDistrib :\n QuadraticForm A M\u2081 \u2297[R] QuadraticForm R M\u2082 \u2192\u2097[A] QuadraticForm A (M\u2081 \u2297[R] M\u2082) :=\n(AlgebraTensorModule.rid R A A).congrQuadraticMap.toLinearMap \u2218\u2097 QuadraticMap.tensorDistrib R A\n\n-- TODO: make the RHS `MulOpposite.op (Q\u2082 m\u2082) \u2022 Q\u2081 m\u2081` so that this has a nicer defeq for\n-- `R = A` of `Q\u2081 m\u2081 * Q\u2082 m\u2082`.\n```\n\n-- snippet 4\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.associated_tmul (L108-L114)\ntheorem associated_tmul [Invertible (2 : A)] (Q\u2081 : QuadraticForm A M\u2081) (Q\u2082 : QuadraticForm R M\u2082) :\n (Q\u2081.tmul Q\u2082).associated = BilinForm.tmul Q\u2081.associated Q\u2082.associated := by\nrw [BilinForm.tmul, BilinForm.tensorDistrib, LinearMap.comp_apply, \u2190 BilinMap.tmul,\n \u2190 QuadraticMap.associated_tmul Q\u2081 Q\u2082]\n aesop\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 5\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.polarBilin_tmul (L115-L126)\ntheorem polarBilin_tmul [Invertible (2 : A)] (Q\u2081 : QuadraticForm A M\u2081) (Q\u2082 : QuadraticForm R M\u2082) :\n polarBilin (Q\u2081.tmul Q\u2082) = \u215f(2 : A) \u2022 BilinForm.tmul (polarBilin Q\u2081) (polarBilin Q\u2082) := by\nsimp_rw [\u2190 two_nsmul_associated A, \u2190 two_nsmul_associated R, BilinForm.tmul, tmul_smul,\n \u2190 smul_tmul', map_nsmul, associated_tmul]\n rw [smul_comm (_ : A) (_ : \u2115), \u2190 smul_assoc, two_smul _ (_ : A), invOf_two_add_invOf_two,\n one_smul]\n\nvariable (A) in\n/-- The base change of a quadratic form. -/\nprotected def baseChange (Q : QuadraticForm R M\u2082) : QuadraticForm A (A \u2297[R] M\u2082) :=\n QuadraticForm.tmul (R := R) (A := A) (M\u2081 := A) (M\u2082 := M\u2082) (QuadraticMap.sq (R := A)) Q\n```\n\n-- snippet 6\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.baseChange_tmul (L128-L131)\ntheorem baseChange_tmul (Q : QuadraticForm R M\u2082) (a : A) (m\u2082 : M\u2082) :\n Q.baseChange A (a \u2297\u209c m\u2082) = Q m\u2082 \u2022 (a * a) :=\ntensorDistrib_tmul _ _ _ _\n```\n\n-- snippet 7\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.associated_baseChange (L132-L137)\ntheorem associated_baseChange [Invertible (2 : A)] (Q : QuadraticForm R M\u2082) :\n associated (R := A) (Q.baseChange A) = BilinForm.baseChange A (associated (R := R) Q) := by\ndsimp only [QuadraticForm.baseChange, LinearMap.baseChange]\n rw [associated_tmul (QuadraticMap.sq (R := A)) Q, associated_sq]\n exact rfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.polarBilin_baseChange (L138-L152)\ntheorem polarBilin_baseChange [Invertible (2 : A)] (Q : QuadraticForm R M\u2082) :\n polarBilin (Q.baseChange A) = BilinForm.baseChange A (polarBilin Q) := by\nrw [QuadraticForm.baseChange, BilinForm.baseChange, polarBilin_tmul, BilinForm.tmul,\n \u2190 map_smul, smul_tmul', \u2190 two_nsmul_associated R, coe_associatedHom, associated_sq,\n smul_comm, \u2190 smul_assoc, two_smul, invOf_two_add_invOf_two, one_smul]\n\nend QuadraticForm\n\nend InvertibleTwo\n\n/-- If two quadratic maps from `A \u2297[R] M\u2082` agree on elements of the form `1 \u2297 m`, they are equal.\n\nIn other words, if a base change exists for a quadratic map, it is unique.\n\nNote that unlike `QuadraticForm.baseChange`, this does not need `Invertible (2 : R)`. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.baseChange_ext (L154-L172)\ntheorem baseChange_ext \u2983Q\u2081 Q\u2082 : QuadraticMap A (A \u2297[R] M\u2082) N\u2081\u2984\n (h : \u2200 m, Q\u2081 (1 \u2297\u209c m) = Q\u2082 (1 \u2297\u209c m)) :\n Q\u2081 = Q\u2082 := by\nreplace h (a m) : Q\u2081 (a \u2297\u209c m) = Q\u2082 (a \u2297\u209c m) := by\n rw [\u2190 mul_one a, \u2190 smul_eq_mul, \u2190 smul_tmul', QuadraticMap.map_smul, QuadraticMap.map_smul, h]\n ext x\n induction x with\n | tmul => simp [h]\n | zero => simp\n | add x y hx hy =>\n have : Q\u2081.polarBilin = Q\u2082.polarBilin := by\n ext\n dsimp [polar]\n rw [\u2190 TensorProduct.tmul_add, h, h, h]\n replace := congr($this x y)\n dsimp [polar] at this\n linear_combination (norm := module) this + hx + hy\n\nend CommRing\n```\n\n-- snippet 10\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.congr_fun (L198-L207)\ntheorem congr_fun (h : Q = Q') (x : M) : Q x = Q' x :=\nDFunLike.congr_fun h _\n\n/-- Copy of a `QuadraticMap` with a new `toFun` equal to the old one. Useful to fix definitional\nequalities. -/\nprotected def copy (Q : QuadraticMap R M N) (Q' : M \u2192 N) (h : Q' = \u21d1Q) : QuadraticMap R M N where\n toFun := Q'\n toFun_smul := h.symm \u25b8 Q.toFun_smul\n exists_companion' := h.symm \u25b8 Q.exists_companion'\n```\n\n-- snippet 11\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.map_smul_of_tower (L246-L251)\ntheorem map_smul_of_tower [CommSemiring S] [Algebra S R] [SMul S M] [IsScalarTower S R M]\n [Module S N] [IsScalarTower S R N] (a : S)\n (x : M) : Q (a \u2022 x) = (a * a) \u2022 Q x := by\nrw [\u2190 IsScalarTower.algebraMap_smul R a x, Q.map_smul, \u2190 map_mul, algebraMap_smul]\n\n/-- Restrict the domain of a quadratic map -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polar_zero_left (L272-L274)\ntheorem polar_zero_left (y : M) : polar Q 0 y = 0 := by\nsimp only [polar, zero_add, QuadraticMap.map_zero, sub_zero, sub_self]\n```\n\n-- snippet 13\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.AlgClosed.equivalent_of_isAlgClosed (L59-L67)\ntheorem equivalent_of_isAlgClosed [Invertible (2 : K)] {M : Type*} [AddCommGroup M] [Module K M]\n [FiniteDimensional K M] (Q\u2081 Q\u2082 : QuadraticForm K M)\n (hQ\u2081 : (associated Q\u2081).SeparatingLeft)\n (hQ\u2082 : (associated Q\u2082).SeparatingLeft) : Equivalent Q\u2081 Q\u2082 :=\nopen Classical in\n (Q\u2081.equivalent_weightedSumSquares_of_isAlgClosed hQ\u2081).trans\n (Q\u2082.equivalent_weightedSumSquares_of_isAlgClosed hQ\u2082).symm\n\nend QuadraticForm\n```\n\n-- snippet 14\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.map_add_self (L235-L242)\ntheorem map_add_self (x : M) : Q (x + x) = 4 \u2022 Q x := by\nrw [\u2190 two_smul R x, Q.map_smul, \u2190 Nat.cast_smul_eq_nsmul R]\n norm_num\n\n-- not @[simp] because it is superseded by `ZeroHomClass.map_zero`\nprotected theorem map_zero : Q 0 = 0 := by\n rw [\u2190 @zero_smul R _ _ _ _ (0 : M), Q.map_smul, zero_mul, zero_smul]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.coe_mk (L186-L193)\ntheorem coe_mk (toFun : M \u2192 N) (toFun_smul exists_companion') :\n \u21d1({toFun, toFun_smul, exists_companion'} : QuadraticMap R M N) = toFun := rfl\n-- this must come after the instFunLike definition\ninitialize_simps_projections QuadraticMap (toFun \u2192 apply)\n\nvariable {Q}\n```\n\n-- snippet 16\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polar_smul (L114-L116)\ntheorem polar_smul [Monoid S] [DistribMulAction S N] (f : M \u2192 N) (s : S) (x y : M) :\n polar (s \u2022 f) x y = s \u2022 polar f x y := by simp only [polar, Pi.smul_apply, smul_sub]\n```\n\n-- snippet 17\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.zeroHomClass (L243-L245)\ninstance zeroHomClass : ZeroHomClass (QuadraticMap R M N) M N :=\n{ QuadraticMap.instFunLike (R := R) (M := M) (N := N) with map_zero := QuadraticMap.map_zero }\n```\n\n-- snippet 18\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.AlgClosed.equivalent_weightedSumSquares_of_isAlgClosed (L49-L58)\ntheorem equivalent_weightedSumSquares_of_isAlgClosed [Invertible (2 : K)] {M : Type*}\n [AddCommGroup M] [Module K M]\n [FiniteDimensional K M] (Q : QuadraticForm K M) (hQ : (associated Q).SeparatingLeft) :\n Equivalent Q (weightedSumSquares K (1 : Fin (Module.finrank K M) \u2192 K)) :=\nopen Classical in\n let \u27e8w, \u27e8hw\u2081\u27e9\u27e9 := Q.equivalent_weightedSumSquares_units_of_nondegenerate' hQ\n \u27e8hw\u2081.trans (isometryEquivSumSquaresUnits w)\u27e9\n\n/-- All nondegenerate quadratic forms on an algebraically closed field of characteristic not equal\nto 2 are equivalent. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.QuadraticForm (L163-L173)\nabbrev QuadraticForm : Type _ := QuadraticMap R M R\nend QuadraticForm\n\nnamespace QuadraticMap\n\nsection DFunLike\n\nvariable [CommSemiring R] [AddCommMonoid M] [Module R M] [AddCommMonoid N] [Module R N]\nvariable {Q Q' : QuadraticMap R M N}\n```\n\n-- snippet 20\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polar_add_left_iff (L121-L129)\ntheorem polar_add_left_iff {f : M \u2192 N} {x x' y : M} :\n polar f (x + x') y = polar f x y + polar f x' y \u2194\n f (x + x' + y) + (f x + f x' + f y) = f (x + x') + f (x' + y) + f (y + x) := by\nsimp only [\u2190 add_assoc]\n simp only [polar, sub_eq_iff_eq_add, eq_sub_iff_add_eq, sub_add_eq_add_sub, add_sub]\n simp only [add_right_comm _ (f y) _, add_right_comm _ (f x') (f x)]\n rw [add_comm y x, add_right_comm _ _ (f (x + y)), add_comm _ (f (x + y)),\n add_right_comm (f (x + y)), add_left_inj]\n```\n\n-- snippet 21\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.coe_copy (L209-L211)\ntheorem coe_copy (Q : QuadraticMap R M N) (Q' : M \u2192 N) (h : Q' = \u21d1Q) : \u21d1(Q.copy Q' h) = Q' :=\nrfl\n```\n\n-- snippet 22\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polarSym2 (L136-L138)\ndef polarSym2 (f : M \u2192 N) : Sym2 M \u2192 N :=\nSym2.lift \u27e8polar f, polar_comm _\u27e9\n```\n\n-- snippet 23\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polar (L99-L106)\ndef polar (f : M \u2192 N) (x y : M) :=\nf (x + y) - f x - f y\n\nprotected theorem map_add (f : M \u2192 N) (x y : M) :\n f (x + y) = f x + f y + polar f x y := by\n rw [polar]\n abel\n```\n\n-- snippet 24\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polarSym2_sym2Mk (L140-L162)\nlemma polarSym2_sym2Mk (f : M \u2192 N) (x y : M) : polarSym2 f s(x, y) = polar f x y := rfl\nend QuadraticMap\n\nend Polar\n\n/-- A quadratic map on a module.\n\nFor a more familiar constructor when `R` is a ring, see `QuadraticMap.ofPolar`. -/\nstructure QuadraticMap (R : Type u) (M : Type v) (N : Type w) [CommSemiring R] [AddCommMonoid M]\n [Module R M] [AddCommMonoid N] [Module R N] where\n /-- The underlying function.\n\n Do NOT use directly. Use the coercion instead. -/\n toFun : M \u2192 N\n toFun_smul : \u2200 (a : R) (x : M), toFun (a \u2022 x) = (a * a) \u2022 toFun x\n exists_companion' : \u2203 B : BilinMap R M N, \u2200 x y, toFun (x + y) = toFun x + toFun y + B x y\n\nsection QuadraticForm\n\nvariable (R : Type u) (M : Type v) [CommSemiring R] [AddCommMonoid M] [Module R M]\n\n/-- A quadratic form on a module. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.ext (L195-L197)\ntheorem ext (H : \u2200 x : M, Q x = Q' x) : Q = Q' :=\nDFunLike.ext _ _ H\n```\n\n-- snippet 26\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.instFunLike (L174-L180)\ninstance instFunLike : FunLike (QuadraticMap R M N) M N where\n coe := toFun\ncoe_injective' x y h := by cases x; cases y; congr\n\nvariable (Q)\n\n/-- The `simp` normal form for a quadratic map is `DFunLike.coe`, not `toFun`. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.map_add_add_add_map (L228-L234)\ntheorem map_add_add_add_map (x y z : M) :\n Q (x + y + z) + (Q x + Q y + Q z) = Q (x + y) + Q (y + z) + Q (z + x) := by\nobtain \u27e8B, h\u27e9 := Q.exists_companion\n rw [add_comm z x]\n simp only [h, LinearMap.map_add\u2082]\n abel\n```\n\n-- snippet 28\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.toFun_eq_coe (L182-L184)\ntheorem toFun_eq_coe : Q.toFun = \u21d1Q :=\nrfl\n```\n\n-- snippet 29\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polar_neg (L111-L113)\ntheorem polar_neg (f : M \u2192 N) (x y : M) : polar (-f) x y = -polar f x y := by\nsimp only [polar, Pi.neg_apply, sub_eq_add_neg, neg_add]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polar_comm (L117-L120)\ntheorem polar_comm (f : M \u2192 N) (x y : M) : polar f x y = polar f y x := by\nrw [polar, polar, add_comm, sub_sub, sub_sub, add_comm (f x) (f y)]\n\n/-- Auxiliary lemma to express bilinearity of `QuadraticMap.polar` without subtraction. -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polar_add (L107-L110)\ntheorem polar_add (f g : M \u2192 N) (x y : M) : polar (f + g) x y = polar f x y + polar g x y := by\nsimp only [polar, Pi.add_apply]\n abel\n```\n\n-- snippet 32\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polar_comp (L130-L135)\ntheorem polar_comp {F : Type*} [AddCommGroup S] [FunLike F N S] [AddMonoidHomClass F N S]\n (f : M \u2192 N) (g : F) (x y : M) :\n polar (g \u2218 f) x y = g (polar f x y) := by\nsimp only [polar, Function.comp_apply, map_sub]\n\n/-- `QuadraticMap.polar` as a function from `Sym2`. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.exists_companion (L225-L227)\ntheorem exists_companion : \u2203 B : BilinMap R M N, \u2200 x y, Q (x + y) = Q x + Q y + B x y :=\nQ.exists_companion'\n```\n\n-- snippet 34\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.copy_eq (L212-L224)\ntheorem copy_eq (Q : QuadraticMap R M N) (Q' : M \u2192 N) (h : Q' = \u21d1Q) : Q.copy Q' h = Q :=\nDFunLike.ext' h\n\nend DFunLike\n\nsection CommSemiring\n\nvariable [CommSemiring R] [AddCommMonoid M] [Module R M] [AddCommMonoid N] [Module R N]\nvariable (Q : QuadraticMap R M N)\n\nprotected theorem map_smul (a : R) (x : M) : Q (a \u2022 x) = (a * a) \u2022 Q x :=\n Q.toFun_smul a 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.LinearAlgebra.QuadraticForm.TensorProduct).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem tensorDistrib_tmul (Q\u2081 : QuadraticForm A M\u2081) (Q\u2082 : QuadraticForm R M\u2082) (m\u2081 : M\u2081) (m\u2082 : M\u2082) :\n tensorDistrib R A (Q\u2081 \u2297\u209c Q\u2082) (m\u2081 \u2297\u209c m\u2082) = Q\u2082 m\u2082 \u2022 Q\u2081 m\u2081\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.tensorDistrib (L48-L59)\ndef tensorDistrib :\n QuadraticMap A M\u2081 N\u2081 \u2297[R] QuadraticMap R M\u2082 N\u2082 \u2192\u2097[A] QuadraticMap A (M\u2081 \u2297[R] M\u2082) (N\u2081 \u2297[R] N\u2082) :=\nletI : Invertible (2 : A) := (Invertible.map (algebraMap R A) 2).copy 2 (map_ofNat _ _).symm\n -- while `letI`s would produce a better term than `let`, they would make this already-slow\n -- definition even slower.\n let toQ := BilinMap.toQuadraticMapLinearMap A A (M\u2081 \u2297[R] M\u2082)\n let tmulB := BilinMap.tensorDistrib R A (M\u2081 := M\u2081) (M\u2082 := M\u2082)\n let toB := AlgebraTensorModule.map\n (QuadraticMap.associated : QuadraticMap A M\u2081 N\u2081 \u2192\u2097[A] BilinMap A M\u2081 N\u2081)\n (QuadraticMap.associated : QuadraticMap R M\u2082 N\u2082 \u2192\u2097[R] BilinMap R M\u2082 N\u2082)\n toQ \u2218\u2097 tmulB \u2218\u2097 toB\n```\n\n-- snippet 2\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.associated_tmul (L72-L89)\ntheorem associated_tmul [Invertible (2 : A)]\n (Q\u2081 : QuadraticMap A M\u2081 N\u2081) (Q\u2082 : QuadraticMap R M\u2082 N\u2082) :\n (Q\u2081.tmul Q\u2082).associated = Q\u2081.associated.tmul Q\u2082.associated := by\nletI : Invertible (2 : A) := (Invertible.map (algebraMap R A) 2).copy 2 (map_ofNat _ _).symm\n rw [QuadraticMap.tmul, BilinMap.tmul]\n have : Subsingleton (Invertible (2 : A)) := inferInstance\n convert associated_left_inverse A (LinearMap.BilinMap.tmul_isSymm\n (QuadraticMap.associated_isSymm A Q\u2081) (QuadraticMap.associated_isSymm R Q\u2082))\n\nend QuadraticMap\n\nnamespace QuadraticForm\n\nvariable (R A) in\n/-- The tensor product of two quadratic forms injects into quadratic forms on tensor products.\n\nNote this is heterobasic; the quadratic form on the left can take values in a larger ring than\nthe one on the right. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.tensorDistrib (L90-L95)\ndef tensorDistrib :\n QuadraticForm A M\u2081 \u2297[R] QuadraticForm R M\u2082 \u2192\u2097[A] QuadraticForm A (M\u2081 \u2297[R] M\u2082) :=\n(AlgebraTensorModule.rid R A A).congrQuadraticMap.toLinearMap \u2218\u2097 QuadraticMap.tensorDistrib R A\n\n-- TODO: make the RHS `MulOpposite.op (Q\u2082 m\u2082) \u2022 Q\u2081 m\u2081` so that this has a nicer defeq for\n-- `R = A` of `Q\u2081 m\u2081 * Q\u2082 m\u2082`.\n```\n\n-- snippet 4\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.associated_tmul (L108-L114)\ntheorem associated_tmul [Invertible (2 : A)] (Q\u2081 : QuadraticForm A M\u2081) (Q\u2082 : QuadraticForm R M\u2082) :\n (Q\u2081.tmul Q\u2082).associated = BilinForm.tmul Q\u2081.associated Q\u2082.associated := by\nrw [BilinForm.tmul, BilinForm.tensorDistrib, LinearMap.comp_apply, \u2190 BilinMap.tmul,\n \u2190 QuadraticMap.associated_tmul Q\u2081 Q\u2082]\n aesop\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 5\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.polarBilin_tmul (L115-L126)\ntheorem polarBilin_tmul [Invertible (2 : A)] (Q\u2081 : QuadraticForm A M\u2081) (Q\u2082 : QuadraticForm R M\u2082) :\n polarBilin (Q\u2081.tmul Q\u2082) = \u215f(2 : A) \u2022 BilinForm.tmul (polarBilin Q\u2081) (polarBilin Q\u2082) := by\nsimp_rw [\u2190 two_nsmul_associated A, \u2190 two_nsmul_associated R, BilinForm.tmul, tmul_smul,\n \u2190 smul_tmul', map_nsmul, associated_tmul]\n rw [smul_comm (_ : A) (_ : \u2115), \u2190 smul_assoc, two_smul _ (_ : A), invOf_two_add_invOf_two,\n one_smul]\n\nvariable (A) in\n/-- The base change of a quadratic form. -/\nprotected def baseChange (Q : QuadraticForm R M\u2082) : QuadraticForm A (A \u2297[R] M\u2082) :=\n QuadraticForm.tmul (R := R) (A := A) (M\u2081 := A) (M\u2082 := M\u2082) (QuadraticMap.sq (R := A)) Q\n```\n\n-- snippet 6\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.baseChange_tmul (L128-L131)\ntheorem baseChange_tmul (Q : QuadraticForm R M\u2082) (a : A) (m\u2082 : M\u2082) :\n Q.baseChange A (a \u2297\u209c m\u2082) = Q m\u2082 \u2022 (a * a) :=\ntensorDistrib_tmul _ _ _ _\n```\n\n-- snippet 7\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.associated_baseChange (L132-L137)\ntheorem associated_baseChange [Invertible (2 : A)] (Q : QuadraticForm R M\u2082) :\n associated (R := A) (Q.baseChange A) = BilinForm.baseChange A (associated (R := R) Q) := by\ndsimp only [QuadraticForm.baseChange, LinearMap.baseChange]\n rw [associated_tmul (QuadraticMap.sq (R := A)) Q, associated_sq]\n exact rfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.polarBilin_baseChange (L138-L152)\ntheorem polarBilin_baseChange [Invertible (2 : A)] (Q : QuadraticForm R M\u2082) :\n polarBilin (Q.baseChange A) = BilinForm.baseChange A (polarBilin Q) := by\nrw [QuadraticForm.baseChange, BilinForm.baseChange, polarBilin_tmul, BilinForm.tmul,\n \u2190 map_smul, smul_tmul', \u2190 two_nsmul_associated R, coe_associatedHom, associated_sq,\n smul_comm, \u2190 smul_assoc, two_smul, invOf_two_add_invOf_two, one_smul]\n\nend QuadraticForm\n\nend InvertibleTwo\n\n/-- If two quadratic maps from `A \u2297[R] M\u2082` agree on elements of the form `1 \u2297 m`, they are equal.\n\nIn other words, if a base change exists for a quadratic map, it is unique.\n\nNote that unlike `QuadraticForm.baseChange`, this does not need `Invertible (2 : R)`. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.baseChange_ext (L154-L172)\ntheorem baseChange_ext \u2983Q\u2081 Q\u2082 : QuadraticMap A (A \u2297[R] M\u2082) N\u2081\u2984\n (h : \u2200 m, Q\u2081 (1 \u2297\u209c m) = Q\u2082 (1 \u2297\u209c m)) :\n Q\u2081 = Q\u2082 := by\nreplace h (a m) : Q\u2081 (a \u2297\u209c m) = Q\u2082 (a \u2297\u209c m) := by\n rw [\u2190 mul_one a, \u2190 smul_eq_mul, \u2190 smul_tmul', QuadraticMap.map_smul, QuadraticMap.map_smul, h]\n ext x\n induction x with\n | tmul => simp [h]\n | zero => simp\n | add x y hx hy =>\n have : Q\u2081.polarBilin = Q\u2082.polarBilin := by\n ext\n dsimp [polar]\n rw [\u2190 TensorProduct.tmul_add, h, h, h]\n replace := congr($this x y)\n dsimp [polar] at this\n linear_combination (norm := module) this + hx + hy\n\nend CommRing\n```\n\n-- snippet 10\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.congr_fun (L198-L207)\ntheorem congr_fun (h : Q = Q') (x : M) : Q x = Q' x :=\nDFunLike.congr_fun h _\n\n/-- Copy of a `QuadraticMap` with a new `toFun` equal to the old one. Useful to fix definitional\nequalities. -/\nprotected def copy (Q : QuadraticMap R M N) (Q' : M \u2192 N) (h : Q' = \u21d1Q) : QuadraticMap R M N where\n toFun := Q'\n toFun_smul := h.symm \u25b8 Q.toFun_smul\n exists_companion' := h.symm \u25b8 Q.exists_companion'\n```\n\n-- snippet 11\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.map_smul_of_tower (L246-L251)\ntheorem map_smul_of_tower [CommSemiring S] [Algebra S R] [SMul S M] [IsScalarTower S R M]\n [Module S N] [IsScalarTower S R N] (a : S)\n (x : M) : Q (a \u2022 x) = (a * a) \u2022 Q x := by\nrw [\u2190 IsScalarTower.algebraMap_smul R a x, Q.map_smul, \u2190 map_mul, algebraMap_smul]\n\n/-- Restrict the domain of a quadratic map -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polar_zero_left (L272-L274)\ntheorem polar_zero_left (y : M) : polar Q 0 y = 0 := by\nsimp only [polar, zero_add, QuadraticMap.map_zero, sub_zero, sub_self]\n```\n\n-- snippet 13\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.AlgClosed.equivalent_of_isAlgClosed (L59-L67)\ntheorem equivalent_of_isAlgClosed [Invertible (2 : K)] {M : Type*} [AddCommGroup M] [Module K M]\n [FiniteDimensional K M] (Q\u2081 Q\u2082 : QuadraticForm K M)\n (hQ\u2081 : (associated Q\u2081).SeparatingLeft)\n (hQ\u2082 : (associated Q\u2082).SeparatingLeft) : Equivalent Q\u2081 Q\u2082 :=\nopen Classical in\n (Q\u2081.equivalent_weightedSumSquares_of_isAlgClosed hQ\u2081).trans\n (Q\u2082.equivalent_weightedSumSquares_of_isAlgClosed hQ\u2082).symm\n\nend QuadraticForm\n```\n\n-- snippet 14\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.map_add_self (L235-L242)\ntheorem map_add_self (x : M) : Q (x + x) = 4 \u2022 Q x := by\nrw [\u2190 two_smul R x, Q.map_smul, \u2190 Nat.cast_smul_eq_nsmul R]\n norm_num\n\n-- not @[simp] because it is superseded by `ZeroHomClass.map_zero`\nprotected theorem map_zero : Q 0 = 0 := by\n rw [\u2190 @zero_smul R _ _ _ _ (0 : M), Q.map_smul, zero_mul, zero_smul]\n```\n\n-- snippet 15\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.coe_mk (L186-L193)\ntheorem coe_mk (toFun : M \u2192 N) (toFun_smul exists_companion') :\n \u21d1({toFun, toFun_smul, exists_companion'} : QuadraticMap R M N) = toFun := rfl\n-- this must come after the instFunLike definition\ninitialize_simps_projections QuadraticMap (toFun \u2192 apply)\n\nvariable {Q}\n```\n\n-- snippet 16\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polar_smul (L114-L116)\ntheorem polar_smul [Monoid S] [DistribMulAction S N] (f : M \u2192 N) (s : S) (x y : M) :\n polar (s \u2022 f) x y = s \u2022 polar f x y := by simp only [polar, Pi.smul_apply, smul_sub]\n```\n\n-- snippet 17\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.zeroHomClass (L243-L245)\ninstance zeroHomClass : ZeroHomClass (QuadraticMap R M N) M N :=\n{ QuadraticMap.instFunLike (R := R) (M := M) (N := N) with map_zero := QuadraticMap.map_zero }\n```\n\n-- snippet 18\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.AlgClosed.equivalent_weightedSumSquares_of_isAlgClosed (L49-L58)\ntheorem equivalent_weightedSumSquares_of_isAlgClosed [Invertible (2 : K)] {M : Type*}\n [AddCommGroup M] [Module K M]\n [FiniteDimensional K M] (Q : QuadraticForm K M) (hQ : (associated Q).SeparatingLeft) :\n Equivalent Q (weightedSumSquares K (1 : Fin (Module.finrank K M) \u2192 K)) :=\nopen Classical in\n let \u27e8w, \u27e8hw\u2081\u27e9\u27e9 := Q.equivalent_weightedSumSquares_units_of_nondegenerate' hQ\n \u27e8hw\u2081.trans (isometryEquivSumSquaresUnits w)\u27e9\n\n/-- All nondegenerate quadratic forms on an algebraically closed field of characteristic not equal\nto 2 are equivalent. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.QuadraticForm (L163-L173)\nabbrev QuadraticForm : Type _ := QuadraticMap R M R\nend QuadraticForm\n\nnamespace QuadraticMap\n\nsection DFunLike\n\nvariable [CommSemiring R] [AddCommMonoid M] [Module R M] [AddCommMonoid N] [Module R N]\nvariable {Q Q' : QuadraticMap R M N}\n```\n\n-- snippet 20\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polar_add_left_iff (L121-L129)\ntheorem polar_add_left_iff {f : M \u2192 N} {x x' y : M} :\n polar f (x + x') y = polar f x y + polar f x' y \u2194\n f (x + x' + y) + (f x + f x' + f y) = f (x + x') + f (x' + y) + f (y + x) := by\nsimp only [\u2190 add_assoc]\n simp only [polar, sub_eq_iff_eq_add, eq_sub_iff_add_eq, sub_add_eq_add_sub, add_sub]\n simp only [add_right_comm _ (f y) _, add_right_comm _ (f x') (f x)]\n rw [add_comm y x, add_right_comm _ _ (f (x + y)), add_comm _ (f (x + y)),\n add_right_comm (f (x + y)), add_left_inj]\n```\n\n-- snippet 21\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.coe_copy (L209-L211)\ntheorem coe_copy (Q : QuadraticMap R M N) (Q' : M \u2192 N) (h : Q' = \u21d1Q) : \u21d1(Q.copy Q' h) = Q' :=\nrfl\n```\n\n-- snippet 22\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polarSym2 (L136-L138)\ndef polarSym2 (f : M \u2192 N) : Sym2 M \u2192 N :=\nSym2.lift \u27e8polar f, polar_comm _\u27e9\n```\n\n-- snippet 23\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polar (L99-L106)\ndef polar (f : M \u2192 N) (x y : M) :=\nf (x + y) - f x - f y\n\nprotected theorem map_add (f : M \u2192 N) (x y : M) :\n f (x + y) = f x + f y + polar f x y := by\n rw [polar]\n abel\n```\n\n-- snippet 24\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polarSym2_sym2Mk (L140-L162)\nlemma polarSym2_sym2Mk (f : M \u2192 N) (x y : M) : polarSym2 f s(x, y) = polar f x y := rfl\nend QuadraticMap\n\nend Polar\n\n/-- A quadratic map on a module.\n\nFor a more familiar constructor when `R` is a ring, see `QuadraticMap.ofPolar`. -/\nstructure QuadraticMap (R : Type u) (M : Type v) (N : Type w) [CommSemiring R] [AddCommMonoid M]\n [Module R M] [AddCommMonoid N] [Module R N] where\n /-- The underlying function.\n\n Do NOT use directly. Use the coercion instead. -/\n toFun : M \u2192 N\n toFun_smul : \u2200 (a : R) (x : M), toFun (a \u2022 x) = (a * a) \u2022 toFun x\n exists_companion' : \u2203 B : BilinMap R M N, \u2200 x y, toFun (x + y) = toFun x + toFun y + B x y\n\nsection QuadraticForm\n\nvariable (R : Type u) (M : Type v) [CommSemiring R] [AddCommMonoid M] [Module R M]\n\n/-- A quadratic form on a module. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.ext (L195-L197)\ntheorem ext (H : \u2200 x : M, Q x = Q' x) : Q = Q' :=\nDFunLike.ext _ _ H\n```\n\n-- snippet 26\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.instFunLike (L174-L180)\ninstance instFunLike : FunLike (QuadraticMap R M N) M N where\n coe := toFun\ncoe_injective' x y h := by cases x; cases y; congr\n\nvariable (Q)\n\n/-- The `simp` normal form for a quadratic map is `DFunLike.coe`, not `toFun`. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.map_add_add_add_map (L228-L234)\ntheorem map_add_add_add_map (x y z : M) :\n Q (x + y + z) + (Q x + Q y + Q z) = Q (x + y) + Q (y + z) + Q (z + x) := by\nobtain \u27e8B, h\u27e9 := Q.exists_companion\n rw [add_comm z x]\n simp only [h, LinearMap.map_add\u2082]\n abel\n```\n\n-- snippet 28\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.toFun_eq_coe (L182-L184)\ntheorem toFun_eq_coe : Q.toFun = \u21d1Q :=\nrfl\n```\n\n-- snippet 29\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polar_neg (L111-L113)\ntheorem polar_neg (f : M \u2192 N) (x y : M) : polar (-f) x y = -polar f x y := by\nsimp only [polar, Pi.neg_apply, sub_eq_add_neg, neg_add]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polar_comm (L117-L120)\ntheorem polar_comm (f : M \u2192 N) (x y : M) : polar f x y = polar f y x := by\nrw [polar, polar, add_comm, sub_sub, sub_sub, add_comm (f x) (f y)]\n\n/-- Auxiliary lemma to express bilinearity of `QuadraticMap.polar` without subtraction. -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polar_add (L107-L110)\ntheorem polar_add (f g : M \u2192 N) (x y : M) : polar (f + g) x y = polar f x y + polar g x y := by\nsimp only [polar, Pi.add_apply]\n abel\n```\n\n-- snippet 32\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.polar_comp (L130-L135)\ntheorem polar_comp {F : Type*} [AddCommGroup S] [FunLike F N S] [AddMonoidHomClass F N S]\n (f : M \u2192 N) (g : F) (x y : M) :\n polar (g \u2218 f) x y = g (polar f x y) := by\nsimp only [polar, Function.comp_apply, map_sub]\n\n/-- `QuadraticMap.polar` as a function from `Sym2`. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.exists_companion (L225-L227)\ntheorem exists_companion : \u2203 B : BilinMap R M N, \u2200 x y, Q (x + y) = Q x + Q y + B x y :=\nQ.exists_companion'\n```\n\n-- snippet 34\n```lean\n-- Mathlib.LinearAlgebra.QuadraticForm.Basic.copy_eq (L212-L224)\ntheorem copy_eq (Q : QuadraticMap R M N) (Q' : M \u2192 N) (h : Q' = \u21d1Q) : Q.copy Q' h = Q :=\nDFunLike.ext' h\n\nend DFunLike\n\nsection CommSemiring\n\nvariable [CommSemiring R] [AddCommMonoid M] [Module R M] [AddCommMonoid N] [Module R N]\nvariable (Q : QuadraticMap R M N)\n\nprotected theorem map_smul (a : R) (x : M) : Q (a \u2022 x) = (a * a) \u2022 Q x :=\n Q.toFun_smul a x\n```\n[/INST]", "sample_id": "C-Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.tensorDistrib_tmul", "source": {"declaration": "Mathlib.LinearAlgebra.QuadraticForm.TensorProduct.tensorDistrib_tmul", "file": "Mathlib/LinearAlgebra/QuadraticForm/TensorProduct.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.LinearAlgebra.QuadraticForm.TensorProduct", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/QuadraticForm/TensorProduct.lean#L97", "span": "L97-L107"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"trace_states": [{"state": "theorem factorsThrough_of_pullbackCondition {Z B : C} {\u03c0 : Z \u27f6 B} [HasPullback \u03c0 \u03c0]\n [PreservesLimit (cospan \u03c0 \u03c0) G]\n {a : C(G.obj Z, X)}\n (ha : a \u2218 (G.map (pullback.fst _ _)) = a \u2218 (G.map (pullback.snd \u03c0 \u03c0))) :\n Function.FactorsThrough a (G.map \u03c0)", "tactic": "intro x y hxy let xy : G.obj (pullback \u03c0 \u03c0) := (PreservesPullback.iso G \u03c0 \u03c0).inv <| (TopCat.pullbackIsoProdSubtype (G.map \u03c0) (G.map \u03c0)).inv \u27e8(x, y), hxy\u27e9"}, {"state": "", "tactic": "have ha' := congr_fun ha xy dsimp at ha'"}, {"state": "", "tactic": "have h\u2081 : \u2200 y, G.map (pullback.fst _ _) ((PreservesPullback.iso G \u03c0 \u03c0).inv y) = pullback.fst (G.map \u03c0) (G.map \u03c0) y := by"}, {"state": "", "tactic": "simp only [\u2190 PreservesPullback.iso_inv_fst]; intro y; rfl"}, {"state": "", "tactic": "have h\u2082 : \u2200 y, G.map (pullback.snd _ _) ((PreservesPullback.iso G \u03c0 \u03c0).inv y) = pullback.snd (G.map \u03c0) (G.map \u03c0) y := by"}, {"state": "", "tactic": "simp only [\u2190 PreservesPullback.iso_inv_snd]; intro y; rfl"}, {"state": "", "tactic": "rw [h\u2081, h\u2082, TopCat.pullbackIsoProdSubtype_inv_fst_apply, TopCat.pullbackIsoProdSubtype_inv_snd_apply] at ha'"}, {"state": "", "tactic": "simpa using ha' set_option backward.isDefEq.respectTransparency false in /-- If `G` preserves the relevant pullbacks and every effective epi in `C` is a quotient map (which is the case when `C` is `CompHaus` or `Profinite`), then `yonedaPresheaf` satisfies the equalizer condition which is required to be a sheaf for the regular topology. -/"}], "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 2523, "declarations_count": 304, "diagnostics_count": 0, "duplicate_fingerprint": "383d42fd63ab19b8", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 874, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "short", "line_count": 27, "natural_language_chars": 2523, "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.TopComparison).", "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.TopComparison.factorsThrough_of_pullbackCondition`:\nState 0: \u22a2 theorem factorsThrough_of_pullbackCondition {Z B : C} {\u03c0 : Z \u27f6 B} [HasPullback \u03c0 \u03c0]\n [PreservesLimit (cospan \u03c0 \u03c0) G]\n {a : C(G.obj Z, X)}\n (ha : a \u2218 (G.map (pullback.fst _ _)) = a \u2218 (G.map (pullback.snd \u03c0 \u03c0))) :\n Function.FactorsThrough a (G.map \u03c0)\nTactic: intro x y hxy let xy : G.obj (pullback \u03c0 \u03c0) := (PreservesPullback.iso G \u03c0 \u03c0).inv <| (TopCat.pullbackIsoProdSubtype (G.map \u03c0) (G.map \u03c0)).inv \u27e8(x, y), hxy\u27e9\nState 1: \u22a2 \nTactic: have ha' := congr_fun ha xy dsimp at ha'\nState 2: \u22a2 \nTactic: have h\u2081 : \u2200 y, G.map (pullback.fst _ _) ((PreservesPullback.iso G \u03c0 \u03c0).inv y) = pullback.fst (G.map \u03c0) (G.map \u03c0) y := by\nState 3: \u22a2 \nTactic: simp only [\u2190 PreservesPullback.iso_inv_fst]; intro y; rfl\nState 4: \u22a2 \nTactic: have h\u2082 : \u2200 y, G.map (pullback.snd _ _) ((PreservesPullback.iso G \u03c0 \u03c0).inv y) = pullback.snd (G.map \u03c0) (G.map \u03c0) y := by\nState 5: \u22a2 \nTactic: simp only [\u2190 PreservesPullback.iso_inv_snd]; intro y; rfl\nState 6: \u22a2 \nTactic: rw [h\u2081, h\u2082, TopCat.pullbackIsoProdSubtype_inv_fst_apply, TopCat.pullbackIsoProdSubtype_inv_snd_apply] at ha'\nState 7: \u22a2 \nTactic: simpa using ha' set_option backward.isDefEq.respectTransparency false in /-- If `G` preserves the relevant pullbacks and every effective epi in `C` is a quotient map (which is the case when `C` is `CompHaus` or `Profinite`), then `yonedaPresheaf` satisfies the equalizer condition which is required to be a sheaf for the regular topology. -/\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.TopComparison).[/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.TopComparison.factorsThrough_of_pullbackCondition`:\nState 0: \u22a2 theorem factorsThrough_of_pullbackCondition {Z B : C} {\u03c0 : Z \u27f6 B} [HasPullback \u03c0 \u03c0]\n [PreservesLimit (cospan \u03c0 \u03c0) G]\n {a : C(G.obj Z, X)}\n (ha : a \u2218 (G.map (pullback.fst _ _)) = a \u2218 (G.map (pullback.snd \u03c0 \u03c0))) :\n Function.FactorsThrough a (G.map \u03c0)\nTactic: intro x y hxy let xy : G.obj (pullback \u03c0 \u03c0) := (PreservesPullback.iso G \u03c0 \u03c0).inv <| (TopCat.pullbackIsoProdSubtype (G.map \u03c0) (G.map \u03c0)).inv \u27e8(x, y), hxy\u27e9\nState 1: \u22a2 \nTactic: have ha' := congr_fun ha xy dsimp at ha'\nState 2: \u22a2 \nTactic: have h\u2081 : \u2200 y, G.map (pullback.fst _ _) ((PreservesPullback.iso G \u03c0 \u03c0).inv y) = pullback.fst (G.map \u03c0) (G.map \u03c0) y := by\nState 3: \u22a2 \nTactic: simp only [\u2190 PreservesPullback.iso_inv_fst]; intro y; rfl\nState 4: \u22a2 \nTactic: have h\u2082 : \u2200 y, G.map (pullback.snd _ _) ((PreservesPullback.iso G \u03c0 \u03c0).inv y) = pullback.snd (G.map \u03c0) (G.map \u03c0) y := by\nState 5: \u22a2 \nTactic: simp only [\u2190 PreservesPullback.iso_inv_snd]; intro y; rfl\nState 6: \u22a2 \nTactic: rw [h\u2081, h\u2082, TopCat.pullbackIsoProdSubtype_inv_fst_apply, TopCat.pullbackIsoProdSubtype_inv_snd_apply] at ha'\nState 7: \u22a2 \nTactic: simpa using ha' set_option backward.isDefEq.respectTransparency false in /-- If `G` preserves the relevant pullbacks and every effective epi in `C` is a quotient map (which is the case when `C` is `CompHaus` or `Profinite`), then `yonedaPresheaf` satisfies the equalizer condition which is required to be a sheaf for the regular topology. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.Condensed.TopComparison.factorsThrough_of_pullbackCondition", "source": {"declaration": "Mathlib.Condensed.TopComparison.factorsThrough_of_pullbackCondition", "file": "Mathlib/Condensed/TopComparison.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Condensed.TopComparison", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Condensed/TopComparison.lean#L39", "span": "L39-L64"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "def rewrite (e eq : Expr) : MetaM Expr\n:= do \u27e8\u27e9\u27e8\u27e9\nlet \u27e8_, eq', []\u27e9 \u2190 (\u2190 mkFreshExprMVar none).mvarId!.rewrite e eq\n | throwError \"Expr.rewrite may not produce subgoals.\"\n return eq'\n\n/--\nRewrites the type of `e` via some `eq`, then moves `e` into the new type via `Eq.mp`.\n\nRewrites with a fresh metavariable as the ambient goal.\nFails if the rewrite produces any subgoals.\n-/", "diagnostic": "[CompilationUnit(i_begin=0, i_end=58, 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 Expr\\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=28), 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=58, i_end=396, 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=\"unexpected end of input; expected 'lemma'\", pos=Position(line=12, 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": 2053, "declarations_count": 273, "diagnostics_count": 1, "duplicate_fingerprint": "8d1098acbedf4125", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 572, "lean_code_chars": 381, "lean_code_ratio": 0.1856, "length_bucket": "short", "line_count": 23, "natural_language_chars": 1672, "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.Tactic.Rewrite).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef rewrite (e eq : Expr) : MetaM Expr\n:= do \u27e8\u27e9\u27e8\u27e9\nlet \u27e8_, eq', []\u27e9 \u2190 (\u2190 mkFreshExprMVar none).mvarId!.rewrite e eq\n | throwError \"Expr.rewrite may not produce subgoals.\"\n return eq'\n\n/--\nRewrites the type of `e` via some `eq`, then moves `e` into the new type via `Eq.mp`.\n\nRewrites with a fresh metavariable as the ambient goal.\nFails if the rewrite produces any subgoals.\n-/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=58, 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 Expr\\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=28), 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=58, i_end=396, 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=\"unexpected end of input; expected 'lemma'\", pos=Position(line=12, 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.Tactic.Rewrite).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef rewrite (e eq : Expr) : MetaM Expr\n:= do \u27e8\u27e9\u27e8\u27e9\nlet \u27e8_, eq', []\u27e9 \u2190 (\u2190 mkFreshExprMVar none).mvarId!.rewrite e eq\n | throwError \"Expr.rewrite may not produce subgoals.\"\n return eq'\n\n/--\nRewrites the type of `e` via some `eq`, then moves `e` into the new type via `Eq.mp`.\n\nRewrites with a fresh metavariable as the ambient goal.\nFails if the rewrite produces any subgoals.\n-/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=58, 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 Expr\\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=28), 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=58, i_end=396, 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=\"unexpected end of input; expected 'lemma'\", pos=Position(line=12, 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.Tactic.Rewrite.rewrite", "source": {"declaration": "Mathlib.Lean.Meta.Tactic.Rewrite.rewrite", "file": "Mathlib/Lean/Meta/Tactic/Rewrite.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Lean.Meta.Tactic.Rewrite", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Lean/Meta/Tactic/Rewrite.lean#L27", "span": "L27-L37"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\ninstance Unitization.instCStarRing : CStarRing (Unitization \ud835\udd5c E) where\n norm_mul_self_le x := by\n-- rewrite both sides as a `\u2294`\n simp only [Unitization.norm_def, Prod.norm_def]\n -- Show that `(Unitization.splitMul \ud835\udd5c E x).snd` satisfies the C\u22c6-property, in two stages:\n have h\u2081 : \u2200 x : Unitization \ud835\udd5c E,\n \u2016(Unitization.splitMul \ud835\udd5c E x).snd\u2016 \u2264 \u2016(Unitization.splitMul \ud835\udd5c E (star x)).snd\u2016 := by\n simp only [Unitization.splitMul_apply, Unitization.snd_star, Unitization.fst_star]\n intro x\n /- split based on whether the term inside the norm is zero or not. If so, it's trivial.\n If not, then apply `norm_splitMul_snd_sq` and cancel one copy of the norm -/\n by_cases h : algebraMap \ud835\udd5c (E \u2192L[\ud835\udd5c] E) x.fst + mul \ud835\udd5c E x.snd = 0\n \u00b7 simp only [h, norm_zero]\n exact norm_nonneg _\n \u00b7 have : \u2016(Unitization.splitMul \ud835\udd5c E x).snd\u2016 ^ 2 \u2264\n \u2016(Unitization.splitMul \ud835\udd5c E (star x)).snd\u2016 * \u2016(Unitization.splitMul \ud835\udd5c E x).snd\u2016 :=\n (norm_splitMul_snd_sq \ud835\udd5c x).trans <| by\n rw [map_mul, Prod.snd_mul]\n exact norm_mul_le _ _\n rw [sq] at this\n rw [\u2190 Ne, \u2190 norm_pos_iff] at h\n simp only [Unitization.splitMul_apply, Unitization.snd_star,\n Unitization.fst_star] at this\n exact (mul_le_mul_iff_left\u2080 h).mp this\n -- in this step we make use of the key lemma `norm_splitMul_snd_sq`\n have h\u2082 : \u2016(Unitization.splitMul \ud835\udd5c E (star x * x)).snd\u2016\n = \u2016(Unitization.splitMul \ud835\udd5c E x).snd\u2016 ^ 2 := by\n refine le_antisymm ?_ (norm_splitMul_snd_sq \ud835\udd5c x)\n rw [map_mul, Prod.snd_mul]\n exact (norm_mul_le _ _).trans <| by\n rw [sq]\n gcongr\n simpa only [star_star] using h\u2081 (star x)\n -- Show that `(Unitization.splitMul \ud835\udd5c E x).fst` satisfies the C\u22c6-property\n have h\u2083 : \u2016(Unitization.splitMul \ud835\udd5c E (star x * x)).fst\u2016\n = \u2016(Unitization.splitMul \ud835\udd5c E x).fst\u2016 ^ 2 := by\n simp only [Unitization.splitMul_apply, Unitization.fst_mul, Unitization.fst_star,\n norm_mul, norm_star, sq]\n rw [h\u2082, h\u2083]\n /- use the definition of the norm, and split into cases based on whether the norm in the first\n coordinate is bigger or smaller than the norm in the second coordinate. -/\n by_cases! h : \u2016(Unitization.splitMul \ud835\udd5c E x).fst\u2016 \u2264 \u2016(Unitization.splitMul \ud835\udd5c E x).snd\u2016\n \u00b7 rw [sq, sq, sup_eq_right.mpr h, sup_eq_right.mpr (mul_self_le_mul_self (norm_nonneg _) h)]\n \u00b7 replace h := h.le\n rw [sq, sq, sup_eq_left.mpr h, sup_eq_left.mpr (mul_self_le_mul_self (norm_nonneg _) h)]\n\n/-- The minimal unitization (over `\u2102`) of a C\u22c6-algebra, equipped with the C\u22c6-norm. When `A` is\nunital, `A\u207a\u00b9 \u2243\u22c6\u2090[\u2102] (\u2102 \u00d7 A)`. -/\nscoped[CStarAlgebra] postfix:max \"\u207a\u00b9\" => Unitization \u2102\n\nnoncomputable instance Unitization.instCStarAlgebra {A : Type*} [NonUnitalCStarAlgebra A] :\n CStarAlgebra (Unitization \u2102 A) where\n\nnoncomputable instance Unitization.instCommCStarAlgebra {A : Type*} [NonUnitalCommCStarAlgebra A] :\n CommCStarAlgebra (Unitization \u2102 A) where\n\nend CStarProperty\n```", "instruction": "Edit `Unitization` so it still compiles and the proof is simplified where possible. Return the full updated `Unitization` block.", "proof_is_oneliner": false, "target_span": "L131-L187", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 3729, "declarations_count": 413, "diagnostics_count": 0, "duplicate_fingerprint": "e46a40011a990bd7", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1343, "lean_code_chars": 2999, "lean_code_ratio": 0.8042, "length_bucket": "short", "line_count": 66, "natural_language_chars": 730, "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.Analysis.CStarAlgebra.Unitization).", "role": "system"}, {"content": "You are editing a file in `Mathlib/Analysis/CStarAlgebra/Unitization.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Analysis.CStarAlgebra.Unitization.Unitization`, L131-L187)\n```lean\ninstance Unitization.instCStarRing : CStarRing (Unitization \ud835\udd5c E) where\n norm_mul_self_le x := by\n-- rewrite both sides as a `\u2294`\n simp only [Unitization.norm_def, Prod.norm_def]\n -- Show that `(Unitization.splitMul \ud835\udd5c E x).snd` satisfies the C\u22c6-property, in two stages:\n have h\u2081 : \u2200 x : Unitization \ud835\udd5c E,\n \u2016(Unitization.splitMul \ud835\udd5c E x).snd\u2016 \u2264 \u2016(Unitization.splitMul \ud835\udd5c E (star x)).snd\u2016 := by\n simp only [Unitization.splitMul_apply, Unitization.snd_star, Unitization.fst_star]\n intro x\n /- split based on whether the term inside the norm is zero or not. If so, it's trivial.\n If not, then apply `norm_splitMul_snd_sq` and cancel one copy of the norm -/\n by_cases h : algebraMap \ud835\udd5c (E \u2192L[\ud835\udd5c] E) x.fst + mul \ud835\udd5c E x.snd = 0\n \u00b7 simp only [h, norm_zero]\n exact norm_nonneg _\n \u00b7 have : \u2016(Unitization.splitMul \ud835\udd5c E x).snd\u2016 ^ 2 \u2264\n \u2016(Unitization.splitMul \ud835\udd5c E (star x)).snd\u2016 * \u2016(Unitization.splitMul \ud835\udd5c E x).snd\u2016 :=\n (norm_splitMul_snd_sq \ud835\udd5c x).trans <| by\n rw [map_mul, Prod.snd_mul]\n exact norm_mul_le _ _\n rw [sq] at this\n rw [\u2190 Ne, \u2190 norm_pos_iff] at h\n simp only [Unitization.splitMul_apply, Unitization.snd_star,\n Unitization.fst_star] at this\n exact (mul_le_mul_iff_left\u2080 h).mp this\n -- in this step we make use of the key lemma `norm_splitMul_snd_sq`\n have h\u2082 : \u2016(Unitization.splitMul \ud835\udd5c E (star x * x)).snd\u2016\n = \u2016(Unitization.splitMul \ud835\udd5c E x).snd\u2016 ^ 2 := by\n refine le_antisymm ?_ (norm_splitMul_snd_sq \ud835\udd5c x)\n rw [map_mul, Prod.snd_mul]\n exact (norm_mul_le _ _).trans <| by\n rw [sq]\n gcongr\n simpa only [star_star] using h\u2081 (star x)\n -- Show that `(Unitization.splitMul \ud835\udd5c E x).fst` satisfies the C\u22c6-property\n have h\u2083 : \u2016(Unitization.splitMul \ud835\udd5c E (star x * x)).fst\u2016\n = \u2016(Unitization.splitMul \ud835\udd5c E x).fst\u2016 ^ 2 := by\n simp only [Unitization.splitMul_apply, Unitization.fst_mul, Unitization.fst_star,\n norm_mul, norm_star, sq]\n rw [h\u2082, h\u2083]\n /- use the definition of the norm, and split into cases based on whether the norm in the first\n coordinate is bigger or smaller than the norm in the second coordinate. -/\n by_cases! h : \u2016(Unitization.splitMul \ud835\udd5c E x).fst\u2016 \u2264 \u2016(Unitization.splitMul \ud835\udd5c E x).snd\u2016\n \u00b7 rw [sq, sq, sup_eq_right.mpr h, sup_eq_right.mpr (mul_self_le_mul_self (norm_nonneg _) h)]\n \u00b7 replace h := h.le\n rw [sq, sq, sup_eq_left.mpr h, sup_eq_left.mpr (mul_self_le_mul_self (norm_nonneg _) h)]\n\n/-- The minimal unitization (over `\u2102`) of a C\u22c6-algebra, equipped with the C\u22c6-norm. When `A` is\nunital, `A\u207a\u00b9 \u2243\u22c6\u2090[\u2102] (\u2102 \u00d7 A)`. -/\nscoped[CStarAlgebra] postfix:max \"\u207a\u00b9\" => Unitization \u2102\n\nnoncomputable instance Unitization.instCStarAlgebra {A : Type*} [NonUnitalCStarAlgebra A] :\n CStarAlgebra (Unitization \u2102 A) where\n\nnoncomputable instance Unitization.instCommCStarAlgebra {A : Type*} [NonUnitalCommCStarAlgebra A] :\n CommCStarAlgebra (Unitization \u2102 A) where\n\nend CStarProperty\n```\n\n## Edit instruction\nEdit `Unitization` so it still compiles and the proof is simplified where possible. Return the full updated `Unitization` 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.Analysis.CStarAlgebra.Unitization).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Analysis/CStarAlgebra/Unitization.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Analysis.CStarAlgebra.Unitization.Unitization`, L131-L187)\n```lean\ninstance Unitization.instCStarRing : CStarRing (Unitization \ud835\udd5c E) where\n norm_mul_self_le x := by\n-- rewrite both sides as a `\u2294`\n simp only [Unitization.norm_def, Prod.norm_def]\n -- Show that `(Unitization.splitMul \ud835\udd5c E x).snd` satisfies the C\u22c6-property, in two stages:\n have h\u2081 : \u2200 x : Unitization \ud835\udd5c E,\n \u2016(Unitization.splitMul \ud835\udd5c E x).snd\u2016 \u2264 \u2016(Unitization.splitMul \ud835\udd5c E (star x)).snd\u2016 := by\n simp only [Unitization.splitMul_apply, Unitization.snd_star, Unitization.fst_star]\n intro x\n /- split based on whether the term inside the norm is zero or not. If so, it's trivial.\n If not, then apply `norm_splitMul_snd_sq` and cancel one copy of the norm -/\n by_cases h : algebraMap \ud835\udd5c (E \u2192L[\ud835\udd5c] E) x.fst + mul \ud835\udd5c E x.snd = 0\n \u00b7 simp only [h, norm_zero]\n exact norm_nonneg _\n \u00b7 have : \u2016(Unitization.splitMul \ud835\udd5c E x).snd\u2016 ^ 2 \u2264\n \u2016(Unitization.splitMul \ud835\udd5c E (star x)).snd\u2016 * \u2016(Unitization.splitMul \ud835\udd5c E x).snd\u2016 :=\n (norm_splitMul_snd_sq \ud835\udd5c x).trans <| by\n rw [map_mul, Prod.snd_mul]\n exact norm_mul_le _ _\n rw [sq] at this\n rw [\u2190 Ne, \u2190 norm_pos_iff] at h\n simp only [Unitization.splitMul_apply, Unitization.snd_star,\n Unitization.fst_star] at this\n exact (mul_le_mul_iff_left\u2080 h).mp this\n -- in this step we make use of the key lemma `norm_splitMul_snd_sq`\n have h\u2082 : \u2016(Unitization.splitMul \ud835\udd5c E (star x * x)).snd\u2016\n = \u2016(Unitization.splitMul \ud835\udd5c E x).snd\u2016 ^ 2 := by\n refine le_antisymm ?_ (norm_splitMul_snd_sq \ud835\udd5c x)\n rw [map_mul, Prod.snd_mul]\n exact (norm_mul_le _ _).trans <| by\n rw [sq]\n gcongr\n simpa only [star_star] using h\u2081 (star x)\n -- Show that `(Unitization.splitMul \ud835\udd5c E x).fst` satisfies the C\u22c6-property\n have h\u2083 : \u2016(Unitization.splitMul \ud835\udd5c E (star x * x)).fst\u2016\n = \u2016(Unitization.splitMul \ud835\udd5c E x).fst\u2016 ^ 2 := by\n simp only [Unitization.splitMul_apply, Unitization.fst_mul, Unitization.fst_star,\n norm_mul, norm_star, sq]\n rw [h\u2082, h\u2083]\n /- use the definition of the norm, and split into cases based on whether the norm in the first\n coordinate is bigger or smaller than the norm in the second coordinate. -/\n by_cases! h : \u2016(Unitization.splitMul \ud835\udd5c E x).fst\u2016 \u2264 \u2016(Unitization.splitMul \ud835\udd5c E x).snd\u2016\n \u00b7 rw [sq, sq, sup_eq_right.mpr h, sup_eq_right.mpr (mul_self_le_mul_self (norm_nonneg _) h)]\n \u00b7 replace h := h.le\n rw [sq, sq, sup_eq_left.mpr h, sup_eq_left.mpr (mul_self_le_mul_self (norm_nonneg _) h)]\n\n/-- The minimal unitization (over `\u2102`) of a C\u22c6-algebra, equipped with the C\u22c6-norm. When `A` is\nunital, `A\u207a\u00b9 \u2243\u22c6\u2090[\u2102] (\u2102 \u00d7 A)`. -/\nscoped[CStarAlgebra] postfix:max \"\u207a\u00b9\" => Unitization \u2102\n\nnoncomputable instance Unitization.instCStarAlgebra {A : Type*} [NonUnitalCStarAlgebra A] :\n CStarAlgebra (Unitization \u2102 A) where\n\nnoncomputable instance Unitization.instCommCStarAlgebra {A : Type*} [NonUnitalCommCStarAlgebra A] :\n CommCStarAlgebra (Unitization \u2102 A) where\n\nend CStarProperty\n```\n\n## Edit instruction\nEdit `Unitization` so it still compiles and the proof is simplified where possible. Return the full updated `Unitization` block.\n[/INST]", "sample_id": "D-Mathlib.Analysis.CStarAlgebra.Unitization.Unitization", "source": {"declaration": "Mathlib.Analysis.CStarAlgebra.Unitization.Unitization", "file": "Mathlib/Analysis/CStarAlgebra/Unitization.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Analysis.CStarAlgebra.Unitization", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/CStarAlgebra/Unitization.lean#L131", "span": "L131-L187"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "lemma Scheme.IsGermInjective.Spec\n (H : \u2200 I : Ideal R, I.IsPrime \u2192\n \u2203 f : R, f \u2209 I \u2227 \u2200 (x y : R), y * x = 0 \u2192 y \u2209 I \u2192 \u2203 n, f ^ n * x = 0) :\n (Spec R).IsGermInjective\n:= by thisIsWrongLemmaNameXYZ\nrefine fun p \u21a6 \u27e8?_\u27e9\n obtain \u27e8f, hf, H\u27e9 := H p.asIdeal p.2\n refine \u27e8PrimeSpectrum.basicOpen f, hf, ?_, ?_\u27e9\n \u00b7 rw [\u2190 basicOpen_eq_of_affine]\n exact (isAffineOpen_top (Spec R)).basicOpen _\n rw [RingHom.injective_iff_ker_eq_bot, RingHom.ker_eq_bot_iff_eq_zero]\n intro x hx\n obtain \u27e8x, s, rfl\u27e9 := IsLocalization.exists_mk'_eq\n (S := ((Spec.structureSheaf R).obj.obj (.op <| PrimeSpectrum.basicOpen f))) (.powers f) x\n rw [\u2190 RingHom.mem_ker, IsLocalization.mk'_eq_mul_mk'_one, Ideal.mul_unit_mem_iff_mem,\n RingHom.mem_ker] at hx\n swap; \u00b7 exact @isUnit_of_invertible _ _ _ (@IsLocalization.invertible_mk'_one ..)\n -- There is an `Opposite.unop (Opposite.op _)` in `hx` which doesn't seem removable using\n -- `simp`/`rw`.\n erw [elementwise_of% StructureSheaf.algebraMap_germ] at hx\n obtain \u27e8\u27e8y, hy\u27e9, hy'\u27e9 := (IsLocalization.map_eq_zero_iff p.asIdeal.primeCompl\n ((Spec.structureSheaf R).presheaf.stalk p) _).mp hx\n obtain \u27e8n, hn\u27e9 := H x y hy' hy\n refine (@IsLocalization.mk'_eq_zero_iff ..).mpr ?_\n exact \u27e8\u27e8_, n, rfl\u27e9, hn\u27e9", "diagnostic": "[CompilationUnit(i_begin=0, i_end=204, messages=[Message(data='unknown tactic', pos=Position(line=5, column=7), pos_end=None, severity=, kind=None), Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=2, column=15), pos_end=Position(line=2, column=22), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n HMul R R ?m.11\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=3, column=36), pos_end=Position(line=3, column=41), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n HMul R R ?m.27\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=3, column=61), pos_end=Position(line=3, column=70), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='Unknown identifier `Spec`', pos=Position(line=4, column=5), pos_end=Position(line=4, column=9), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='unsolved goals\\nR : Type u_1\\nH : \u2200 (I : sorry) (a : sorry), \u2203 f, \u00acsorry \u2227 \u2200 (x y : R) (a : sorry), \u00acsorry \u2192 \u2203 n, sorry\\n\u22a2 sorry', pos=Position(line=5, column=3), pos_end=Position(line=5, column=29), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=204, i_end=1312, 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": 3624, "declarations_count": 406, "diagnostics_count": 1, "duplicate_fingerprint": "65ed9885a3a395e4", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1187, "lean_code_chars": 1249, "lean_code_ratio": 0.3446, "length_bucket": "short", "line_count": 36, "natural_language_chars": 2375, "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.AlgebraicGeometry.SpreadingOut).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma Scheme.IsGermInjective.Spec\n (H : \u2200 I : Ideal R, I.IsPrime \u2192\n \u2203 f : R, f \u2209 I \u2227 \u2200 (x y : R), y * x = 0 \u2192 y \u2209 I \u2192 \u2203 n, f ^ n * x = 0) :\n (Spec R).IsGermInjective\n:= by thisIsWrongLemmaNameXYZ\nrefine fun p \u21a6 \u27e8?_\u27e9\n obtain \u27e8f, hf, H\u27e9 := H p.asIdeal p.2\n refine \u27e8PrimeSpectrum.basicOpen f, hf, ?_, ?_\u27e9\n \u00b7 rw [\u2190 basicOpen_eq_of_affine]\n exact (isAffineOpen_top (Spec R)).basicOpen _\n rw [RingHom.injective_iff_ker_eq_bot, RingHom.ker_eq_bot_iff_eq_zero]\n intro x hx\n obtain \u27e8x, s, rfl\u27e9 := IsLocalization.exists_mk'_eq\n (S := ((Spec.structureSheaf R).obj.obj (.op <| PrimeSpectrum.basicOpen f))) (.powers f) x\n rw [\u2190 RingHom.mem_ker, IsLocalization.mk'_eq_mul_mk'_one, Ideal.mul_unit_mem_iff_mem,\n RingHom.mem_ker] at hx\n swap; \u00b7 exact @isUnit_of_invertible _ _ _ (@IsLocalization.invertible_mk'_one ..)\n -- There is an `Opposite.unop (Opposite.op _)` in `hx` which doesn't seem removable using\n -- `simp`/`rw`.\n erw [elementwise_of% StructureSheaf.algebraMap_germ] at hx\n obtain \u27e8\u27e8y, hy\u27e9, hy'\u27e9 := (IsLocalization.map_eq_zero_iff p.asIdeal.primeCompl\n ((Spec.structureSheaf R).presheaf.stalk p) _).mp hx\n obtain \u27e8n, hn\u27e9 := H x y hy' hy\n refine (@IsLocalization.mk'_eq_zero_iff ..).mpr ?_\n exact \u27e8\u27e8_, n, rfl\u27e9, hn\u27e9\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=204, messages=[Message(data='unknown tactic', pos=Position(line=5, column=7), pos_end=None, severity=, kind=None), Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=2, column=15), pos_end=Position(line=2, column=22), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n HMul R R ?m.11\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=3, column=36), pos_end=Position(line=3, column=41), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n HMul R R ?m.27\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=3, column=61), pos_end=Position(line=3, column=70), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='Unknown identifier `Spec`', pos=Position(line=4, column=5), pos_end=Position(line=4, column=9), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='unsolved goals\\nR : Type u_1\\nH : \u2200 (I : sorry) (a : sorry), \u2203 f, \u00acsorry \u2227 \u2200 (x y : R) (a : sorry), \u00acsorry \u2192 \u2203 n, sorry\\n\u22a2 sorry', pos=Position(line=5, column=3), pos_end=Position(line=5, column=29), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=204, i_end=1312, 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.AlgebraicGeometry.SpreadingOut).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma Scheme.IsGermInjective.Spec\n (H : \u2200 I : Ideal R, I.IsPrime \u2192\n \u2203 f : R, f \u2209 I \u2227 \u2200 (x y : R), y * x = 0 \u2192 y \u2209 I \u2192 \u2203 n, f ^ n * x = 0) :\n (Spec R).IsGermInjective\n:= by thisIsWrongLemmaNameXYZ\nrefine fun p \u21a6 \u27e8?_\u27e9\n obtain \u27e8f, hf, H\u27e9 := H p.asIdeal p.2\n refine \u27e8PrimeSpectrum.basicOpen f, hf, ?_, ?_\u27e9\n \u00b7 rw [\u2190 basicOpen_eq_of_affine]\n exact (isAffineOpen_top (Spec R)).basicOpen _\n rw [RingHom.injective_iff_ker_eq_bot, RingHom.ker_eq_bot_iff_eq_zero]\n intro x hx\n obtain \u27e8x, s, rfl\u27e9 := IsLocalization.exists_mk'_eq\n (S := ((Spec.structureSheaf R).obj.obj (.op <| PrimeSpectrum.basicOpen f))) (.powers f) x\n rw [\u2190 RingHom.mem_ker, IsLocalization.mk'_eq_mul_mk'_one, Ideal.mul_unit_mem_iff_mem,\n RingHom.mem_ker] at hx\n swap; \u00b7 exact @isUnit_of_invertible _ _ _ (@IsLocalization.invertible_mk'_one ..)\n -- There is an `Opposite.unop (Opposite.op _)` in `hx` which doesn't seem removable using\n -- `simp`/`rw`.\n erw [elementwise_of% StructureSheaf.algebraMap_germ] at hx\n obtain \u27e8\u27e8y, hy\u27e9, hy'\u27e9 := (IsLocalization.map_eq_zero_iff p.asIdeal.primeCompl\n ((Spec.structureSheaf R).presheaf.stalk p) _).mp hx\n obtain \u27e8n, hn\u27e9 := H x y hy' hy\n refine (@IsLocalization.mk'_eq_zero_iff ..).mpr ?_\n exact \u27e8\u27e8_, n, rfl\u27e9, hn\u27e9\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=204, messages=[Message(data='unknown tactic', pos=Position(line=5, column=7), pos_end=None, severity=, kind=None), Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=2, column=15), pos_end=Position(line=2, column=22), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n HMul R R ?m.11\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=3, column=36), pos_end=Position(line=3, column=41), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n HMul R R ?m.27\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=3, column=61), pos_end=Position(line=3, column=70), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='Unknown identifier `Spec`', pos=Position(line=4, column=5), pos_end=Position(line=4, column=9), severity=, kind='lean.unknownIdentifier._namedError'), Message(data='unsolved goals\\nR : Type u_1\\nH : \u2200 (I : sorry) (a : sorry), \u2203 f, \u00acsorry \u2227 \u2200 (x y : R) (a : sorry), \u00acsorry \u2192 \u2203 n, sorry\\n\u22a2 sorry', pos=Position(line=5, column=3), pos_end=Position(line=5, column=29), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=204, i_end=1312, 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.AlgebraicGeometry.SpreadingOut.Scheme", "source": {"declaration": "Mathlib.AlgebraicGeometry.SpreadingOut.Scheme", "file": "Mathlib/AlgebraicGeometry/SpreadingOut.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicGeometry.SpreadingOut", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicGeometry/SpreadingOut.lean#L133", "span": "L133-L157"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "abbrev AlgebraicIndepOn (s : Set \u03b9) : Prop", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 463, "declarations_count": 51, "diagnostics_count": 0, "duplicate_fingerprint": "b36aa4d4b45edd99", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 131, "lean_code_chars": 43, "lean_code_ratio": 0.0929, "length_bucket": "tiny", "line_count": 7, "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.RingTheory.AlgebraicIndependent.Defs).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\nabbrev AlgebraicIndepOn (s : Set \u03b9) : Prop\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.RingTheory.AlgebraicIndependent.Defs).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nabbrev AlgebraicIndepOn (s : Set \u03b9) : Prop\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.RingTheory.AlgebraicIndependent.Defs.AlgebraicIndepOn", "source": {"declaration": "Mathlib.RingTheory.AlgebraicIndependent.Defs.AlgebraicIndepOn", "file": "Mathlib/RingTheory/AlgebraicIndependent/Defs.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.RingTheory.AlgebraicIndependent.Defs", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/AlgebraicIndependent/Defs.lean#L59", "span": "L59-L62"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem setIntegral_compProd_univ_right (f : \u03b2 \u00d7 \u03b3 \u2192 E) {s : Set \u03b2} (hs : MeasurableSet s)\n (hf : IntegrableOn f (s \u00d7\u02e2 univ) ((\u03ba \u2297\u2096 \u03b7) a)) :\n \u222b z in s \u00d7\u02e2 univ, f z \u2202(\u03ba \u2297\u2096 \u03b7) a = \u222b x in s, \u222b y, f (x, y) \u2202\u03b7 (a, x) \u2202\u03ba a", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 654, "declarations_count": 78, "diagnostics_count": 0, "duplicate_fingerprint": "553807c089296ae2", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 237, "lean_code_chars": 223, "lean_code_ratio": 0.341, "length_bucket": "tiny", "line_count": 9, "natural_language_chars": 431, "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.Probability.Kernel.Composition.IntegralCompProd).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem setIntegral_compProd_univ_right (f : \u03b2 \u00d7 \u03b3 \u2192 E) {s : Set \u03b2} (hs : MeasurableSet s)\n (hf : IntegrableOn f (s \u00d7\u02e2 univ) ((\u03ba \u2297\u2096 \u03b7) a)) :\n \u222b z in s \u00d7\u02e2 univ, f z \u2202(\u03ba \u2297\u2096 \u03b7) a = \u222b x in s, \u222b y, f (x, y) \u2202\u03b7 (a, x) \u2202\u03ba 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.Probability.Kernel.Composition.IntegralCompProd).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem setIntegral_compProd_univ_right (f : \u03b2 \u00d7 \u03b3 \u2192 E) {s : Set \u03b2} (hs : MeasurableSet s)\n (hf : IntegrableOn f (s \u00d7\u02e2 univ) ((\u03ba \u2297\u2096 \u03b7) a)) :\n \u222b z in s \u00d7\u02e2 univ, f z \u2202(\u03ba \u2297\u2096 \u03b7) a = \u222b x in s, \u222b y, f (x, y) \u2202\u03b7 (a, x) \u2202\u03ba 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.Probability.Kernel.Composition.IntegralCompProd.setIntegral_compProd_univ_right", "source": {"declaration": "Mathlib.Probability.Kernel.Composition.IntegralCompProd.setIntegral_compProd_univ_right", "file": "Mathlib/Probability/Kernel/Composition/IntegralCompProd.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Probability.Kernel.Composition.IntegralCompProd", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Probability/Kernel/Composition/IntegralCompProd.lean#L271", "span": "L271-L275"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.CategoryTheory.Limits.Over.hasColimit_of_hasColimit_comp_forget (L39-L42)\ninstance hasColimit_of_hasColimit_comp_forget (F : J \u2964 Over X) [i : HasColimit (F \u22d9 forget X)] :\n HasColimit F :=\nCostructuredArrow.hasColimit (i\u2081 := i)", "-- Mathlib.CategoryTheory.Limits.Over.createsColimitsOfSize (L54-L57)\ninstance createsColimitsOfSize : CreatesColimitsOfSize.{w, w'} (forget X) :=\nCostructuredArrow.createsColimitsOfSize\n\n-- We can automatically infer that the forgetful functor preserves and reflects colimits.", "-- Mathlib.CategoryTheory.Limits.Over.epi_left_of_epi (L65-L67)\ntheorem epi_left_of_epi [HasPushouts C] {f g : Over X} (h : f \u27f6 g) [Epi h] : Epi h.left :=\nCostructuredArrow.epi_left_of_epi _", "-- Mathlib.CategoryTheory.Limits.Over.epi_iff_epi_left (L68-L70)\ntheorem epi_iff_epi_left [HasPushouts C] {f g : Over X} (h : f \u27f6 g) : Epi h \u2194 Epi h.left :=\nCostructuredArrow.epi_iff_epi_left _", "-- Mathlib.CategoryTheory.Limits.Over.preservesColimitsOfSize_map (L75-L79)\ninstance preservesColimitsOfSize_map [HasColimitsOfSize.{w, w'} C] {Y : C} (f : X \u27f6 Y) :\n PreservesColimitsOfSize.{w, w'} (map f) :=\npreservesColimits_of_reflects_of_preserves (map f) (forget Y)\n\n/-- If `c` is a colimit cocone, then so is the cocone `c.toOver` with cocone point `\ud835\udfd9 c.pt`. -/", "-- Mathlib.CategoryTheory.Limits.Over.isColimitToOver (L80-L84)\ndef isColimitToOver {F : J \u2964 C} {c : Cocone F} (hc : IsColimit c) : IsColimit c.toOver :=\nisColimitOfReflects (forget c.pt) <| IsColimit.equivIsoColimit c.mapCoconeToOver.symm hc\n\n/-- If `F` has a colimit, then the cocone `colimit.toOver F` with cocone point `\ud835\udfd9 (colimit F)` is\n also a colimit cocone. -/", "-- Mathlib.CategoryTheory.Limits.Over.hasLimit_of_hasLimit_comp_forget (L105-L108)\ninstance hasLimit_of_hasLimit_comp_forget (F : J \u2964 Under X) [i : HasLimit (F \u22d9 forget X)] :\n HasLimit F :=\nStructuredArrow.hasLimit (i\u2081 := i)", "-- Mathlib.CategoryTheory.Limits.Over.mono_right_of_mono (L115-L117)\ntheorem mono_right_of_mono [HasPullbacks C] {f g : Under X} (h : f \u27f6 g) [Mono h] : Mono h.right :=\nStructuredArrow.mono_right_of_mono _", "-- Mathlib.CategoryTheory.Limits.Over.mono_iff_mono_right (L118-L120)\ntheorem mono_iff_mono_right [HasPullbacks C] {f g : Under X} (h : f \u27f6 g) : Mono h \u2194 Mono h.right :=\nStructuredArrow.mono_iff_mono_right _", "-- Mathlib.CategoryTheory.Limits.Over.createsLimitsOfSize (L121-L124)\ninstance createsLimitsOfSize : CreatesLimitsOfSize.{w, w'} (forget X) :=\nStructuredArrow.createsLimitsOfSize\n\n-- We can automatically infer that the forgetful functor preserves and reflects limits.", "-- Mathlib.CategoryTheory.Limits.Over.createLimitsOfSizeMapCompForget (L131-L134)\ninstance createLimitsOfSizeMapCompForget {Y : C} (f : X \u27f6 Y) :\n CreatesLimitsOfSize.{w, w'} (map f \u22d9 forget X) :=\nshow CreatesLimitsOfSize.{w, w'} (forget Y) from inferInstance", "-- Mathlib.CategoryTheory.Limits.Over.preservesLimitsOfSize_map (L135-L139)\ninstance preservesLimitsOfSize_map [HasLimitsOfSize.{w, w'} C] {Y : C} (f : X \u27f6 Y) :\n PreservesLimitsOfSize.{w, w'} (map f) :=\npreservesLimits_of_reflects_of_preserves (map f) (forget X)\n\n/-- If `c` is a limit cone, then so is the cone `c.toUnder` with cone point `\ud835\udfd9 c.pt`. -/", "-- Mathlib.CategoryTheory.Limits.Over.isLimitToUnder (L140-L144)\ndef isLimitToUnder {F : J \u2964 C} {c : Cone F} (hc : IsLimit c) : IsLimit c.toUnder :=\nisLimitOfReflects (forget c.pt) (IsLimit.equivIsoLimit c.mapConeToUnder.symm hc)\n\n/-- If `F` has a limit, then the cone `limit.toUnder F` with cone point `\ud835\udfd9 (limit F)` is\n also a limit cone. -/", "-- Mathlib.CategoryTheory.Limits.Comma.preservesColimitsOfShape_leftFunc (L204-L207)\ninstance preservesColimitsOfShape_leftFunc [HasColimitsOfShape J T] :\n PreservesColimitsOfShape J (Arrow.leftFunc : _ \u2964 T) := by\napply Comma.preservesColimitsOfShape_fst", "-- Mathlib.CategoryTheory.Limits.Comma.preservesColimitsOfShape_snd (L169-L180)\ninstance preservesColimitsOfShape_snd [HasColimitsOfShape J A] [HasColimitsOfShape J B]\n [PreservesColimitsOfShape J L] : PreservesColimitsOfShape J (Comma.snd L R) where\n preservesColimit :=\npreservesColimit_of_preserves_colimit_cocone\n (coconeOfPreservesIsColimit _ (colimit.isColimit _) (colimit.isColimit _))\n (colimit.isColimit _)\n\nend Comma\n\nnamespace Arrow\n\nset_option backward.isDefEq.respectTransparency false in", "-- Mathlib.CategoryTheory.Limits.Comma.hasLimits (L189-L192)\ninstance hasLimits [HasLimits T] : HasLimits (Arrow T) :=\n\u27e8fun _ _ => inferInstance\u27e9\n\nset_option backward.isDefEq.respectTransparency false in", "-- Mathlib.CategoryTheory.Limits.ColimitLimit.\u03b9_colimitLimitToLimitColimit_\u03c0 (L91-L96)\ntheorem \u03b9_colimitLimitToLimitColimit_\u03c0 (j) (k) :\n colimit.\u03b9 _ k \u226b colimitLimitToLimitColimit F \u226b limit.\u03c0 _ j =\n limit.\u03c0 ((curry.obj (Prod.swap K J \u22d9 F)).obj k) j \u226b colimit.\u03b9 ((curry.obj F).obj j) k := by\ndsimp [colimitLimitToLimitColimit]\n simp", "-- Mathlib.CategoryTheory.Limits.Comma.hasColimit (L151-L154)\ninstance hasColimit (F : J \u2964 Comma L R) [HasColimit (F \u22d9 fst L R)] [HasColimit (F \u22d9 snd L R)]\n [PreservesColimit (F \u22d9 fst L R) L] : HasColimit F :=\nHasColimit.mk \u27e8_, coconeOfPreservesIsColimit _ (colimit.isColimit _) (colimit.isColimit _)\u27e9", "-- Mathlib.CategoryTheory.Limits.Comma.colimitAuxiliaryCocone (L94-L101)\ndef colimitAuxiliaryCocone (c\u2082 : Cocone (F \u22d9 snd L R)) : Cocone ((F \u22d9 fst L R) \u22d9 L) :=\n(Cocone.precompose (whiskerLeft F (Comma.natTrans L R) :)).obj (R.mapCocone c\u2082)\n\n/--\nIf `L` preserves the appropriate colimit, then given a colimit cocone for `F \u22d9 fst L R : J \u2964 L` and\na cocone for `F \u22d9 snd L R : J \u2964 R` we can build a cocone for `F` which will turn out to be a\ncolimit cocone.\n-/", "-- Mathlib.CategoryTheory.Limits.Comma.mono_right_of_mono (L247-L250)\ninstance mono_right_of_mono [HasPullbacks A] [PreservesLimitsOfShape WalkingCospan G]\n {Y Z : StructuredArrow X G} (f : Y \u27f6 Z) [Mono f] : Mono f.right :=\nshow Mono ((proj X G).map f) from inferInstance", "-- Mathlib.CategoryTheory.Limits.Comma.hasLimit (L140-L143)\ninstance hasLimit (F : J \u2964 Comma L R) [HasLimit (F \u22d9 fst L R)] [HasLimit (F \u22d9 snd L R)]\n [PreservesLimit (F \u22d9 snd L R) R] : HasLimit F :=\nHasLimit.mk \u27e8_, coneOfPreservesIsLimit _ (limit.isLimit _) (limit.isLimit _)\u27e9", "-- Mathlib.CategoryTheory.Limits.ColimitLimit.map_id_right_eq_curry_swap_map (L47-L89)\ntheorem map_id_right_eq_curry_swap_map {j j' : J} {f : j \u27f6 j'} {k : K} :\n F.map (f \u00d7\u2098 \ud835\udfd9 k) = ((curry.obj (Prod.swap K J \u22d9 F)).obj k).map f :=\nrfl\n\nvariable [HasLimitsOfShape J C]\nvariable [HasColimitsOfShape K C]\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The universal morphism\n$\\colim_k \\lim_j F(j,k) \u2192 \\lim_j \\colim_k F(j, k)$.\n-/\nnoncomputable def colimitLimitToLimitColimit :\n colimit (curry.obj (Prod.swap K J \u22d9 F) \u22d9 lim) \u27f6 limit (curry.obj F \u22d9 colim) :=\n limit.lift (curry.obj F \u22d9 colim)\n { pt := _\n \u03c0 :=\n { app := fun j =>\n colimit.desc (curry.obj (Prod.swap K J \u22d9 F) \u22d9 lim)\n { pt := _\n \u03b9 :=\n { app := fun k =>\n limit.\u03c0 ((curry.obj (Prod.swap K J \u22d9 F)).obj k) j \u226b\n colimit.\u03b9 ((curry.obj F).obj j) k\n naturality := by\n intro k k' f\n simp only [Functor.comp_obj, lim_obj, colimit.cocone_x,\n Functor.const_obj_obj, Functor.comp_map, lim_map,\n curry_obj_obj_obj, Prod.swap_obj, limMap_\u03c0_assoc, curry_obj_map_app,\n Prod.swap_map, Functor.const_obj_map, Category.comp_id]\n rw [map_id_left_eq_curry_map, colimit.w] } }\n naturality := by\n intro j j' f\n dsimp\n ext k\n simp only [Functor.comp_obj, lim_obj, Category.id_comp, colimit.\u03b9_desc,\n colimit.\u03b9_desc_assoc, Category.assoc, \u03b9_colimMap,\n curry_obj_obj_obj, curry_obj_map_app]\n rw [map_id_right_eq_curry_swap_map, limit.w_assoc] } }\n\nset_option backward.isDefEq.respectTransparency false in\n/-- Since `colimit_limit_to_limit_colimit` is a morphism from a colimit to a limit,\nthis lemma characterises it.\n-/", "-- Mathlib.CategoryTheory.Limits.Bicones.finBiconeHom (L124-L157)\ninstance finBiconeHom [FinCategory J] (j k : Bicone J) : Fintype (j \u27f6 k) := by\ncases j <;> cases k\n \u00b7 exact\n { elems := {BiconeHom.left_id}\n complete := fun f => by cases f; simp }\n \u00b7 exact\n { elems := \u2205\n complete := fun f => by cases f }\n \u00b7 exact\n { elems := {BiconeHom.left _}\n complete := fun f => by cases f; simp }\n \u00b7 exact\n { elems := \u2205\n complete := fun f => by cases f }\n \u00b7 exact\n { elems := {BiconeHom.right_id}\n complete := fun f => by cases f; simp }\n \u00b7 exact\n { elems := {BiconeHom.right _}\n complete := fun f => by cases f; simp }\n \u00b7 exact\n { elems := \u2205\n complete := fun f => by cases f }\n \u00b7 exact\n { elems := \u2205\n complete := fun f => by cases f }\n \u00b7 exact\n { elems := Finset.image BiconeHom.diagram Fintype.elems\n complete := fun f => by\n rcases f with (_ | _ | _ | _ | f)\n simp only [Finset.mem_image]\n use f\n simpa using Fintype.complete _ }", "-- Mathlib.CategoryTheory.Limits.ColimitLimit.\u03b9_colimitLimitToLimitColimit_\u03c0_apply (L98-L106)\ntheorem \u03b9_colimitLimitToLimitColimit_\u03c0_apply [Small.{v} J] [Small.{v} K] (F : J \u00d7 K \u2964 Type v)\n (j : J) (k : K) (f) : limit.\u03c0 (curry.obj F \u22d9 colim) j\n (colimitLimitToLimitColimit F (colimit.\u03b9 (curry.obj (Prod.swap K J \u22d9 F) \u22d9 lim) k f)) =\n colimit.\u03b9 ((curry.obj F).obj j) k (limit.\u03c0 ((curry.obj (Prod.swap K J \u22d9 F)).obj k) j f) := by\ndsimp [colimitLimitToLimitColimit]\n simp\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The map `colimit_limit_to_limit_colimit` realized as a map of cones. -/", "-- Mathlib.CategoryTheory.Limits.Comma.hasColimits (L201-L203)\ninstance hasColimits [HasColimits T] : HasColimits (Arrow T) :=\n\u27e8fun _ _ => inferInstance\u27e9", "-- Mathlib.CategoryTheory.Limits.Comma.preservesColimitsOfShape_fst (L162-L168)\ninstance preservesColimitsOfShape_fst [HasColimitsOfShape J A] [HasColimitsOfShape J B]\n [PreservesColimitsOfShape J L] : PreservesColimitsOfShape J (Comma.fst L R) where\n preservesColimit :=\npreservesColimit_of_preserves_colimit_cocone\n (coconeOfPreservesIsColimit _ (colimit.isColimit _) (colimit.isColimit _))\n (colimit.isColimit _)", "-- Mathlib.CategoryTheory.Limits.ColimitLimit.map_id_left_eq_curry_map (L43-L46)\ntheorem map_id_left_eq_curry_map {j : J} {k k' : K} {f : k \u27f6 k'} :\n F.map (\ud835\udfd9 j \u00d7\u2098 f) = ((curry.obj F).obj j).map f :=\nrfl", "-- Mathlib.CategoryTheory.Limits.Comma.hasColimitsOfSize (L158-L161)\ninstance hasColimitsOfSize [HasColimitsOfSize.{w, w'} A] [HasColimitsOfSize.{w, w'} B]\n [PreservesColimitsOfSize.{w, w'} L] : HasColimitsOfSize.{w, w'} (Comma L R) :=\n\u27e8fun _ _ => inferInstance\u27e9", "-- Mathlib.CategoryTheory.Limits.Bicones.biconeSmallCategory (L158-L160)\ninstance biconeSmallCategory : SmallCategory (Bicone J) :=\nCategoryTheory.biconeCategory J", "-- Mathlib.CategoryTheory.Limits.Comma.mono_iff_mono_right (L251-L260)\ntheorem mono_iff_mono_right [HasPullbacks A] [PreservesLimitsOfShape WalkingCospan G]\n {Y Z : StructuredArrow X G} (f : Y \u27f6 Z) : Mono f \u2194 Mono f.right :=\n\u27e8fun _ => inferInstance, fun _ => mono_of_mono_right f\u27e9\n\nend StructuredArrow\n\nnamespace CostructuredArrow\n\nvariable {G : A \u2964 T} {X : T} (F : J \u2964 CostructuredArrow G X)", "-- Mathlib.CategoryTheory.Limits.Bicones.biconeCategoryStruct (L74-L87)\ninstance biconeCategoryStruct : CategoryStruct (Bicone J) where\n Hom := BiconeHom J\nid j := Bicone.casesOn j BiconeHom.left_id BiconeHom.right_id fun k => BiconeHom.diagram (\ud835\udfd9 k)\n comp f g := by\n rcases f with (_ | _ | _ | _ | f)\n \u00b7 exact g\n \u00b7 exact g\n \u00b7 cases g\n apply BiconeHom.left\n \u00b7 cases g\n apply BiconeHom.right\n \u00b7 rcases g with (_ | _ | _ | _ | g)\n exact BiconeHom.diagram (f \u226b g)", "-- Mathlib.CategoryTheory.Limits.Comma.limitAuxiliaryCone (L47-L53)\ndef limitAuxiliaryCone (c\u2081 : Cone (F \u22d9 fst L R)) : Cone ((F \u22d9 snd L R) \u22d9 R) :=\n(Cone.postcompose (whiskerLeft F (Comma.natTrans L R) :)).obj (L.mapCone c\u2081)\n\n/-- If `R` preserves the appropriate limit, then given a cone for `F \u22d9 fst L R : J \u2964 L` and a\nlimit cone for `F \u22d9 snd L R : J \u2964 R` we can build a cone for `F` which will turn out to be a limit\ncone.\n-/", "-- Mathlib.CategoryTheory.Limits.Bicones.biconeCategory (L88-L100)\ninstance biconeCategory : Category (Bicone J) where\n id_comp f := by cases f <;> simp\ncomp_id f := by cases f <;> simp\n assoc f g h := by cases f <;> cases g <;> cases h <;> simp\n\nend Bicone\n\nsection SmallCategory\n\nvariable (J : Type v\u2081) [SmallCategory J]\n\n/-- Given a diagram `F : J \u2964 C` and two `Cone F`s, we can join them into a diagram `Bicone J \u2964 C`.\n-/", "-- Mathlib.CategoryTheory.Limits.Bicones.BiconeHom (L70-L72)\ninstance BiconeHom.decidableEq {j k : Bicone J} : DecidableEq (BiconeHom J j k) := fun f g => by\nclassical cases f <;> cases g <;> simp only [diagram.injEq] <;> infer_instance", "-- Mathlib.CategoryTheory.Limits.Bicones.finBicone (L52-L66)\ninstance finBicone [Fintype J] : Fintype (Bicone J) where\n elems := [Bicone.left, Bicone.right].toFinset \u222a Finset.image Bicone.diagram Fintype.elems\ncomplete j := by\n cases j <;> simp [Fintype.complete]\n\nvariable [Category.{v\u2081} J]\n\n/-- The homs for a walking `Bicone J`. -/\ninductive BiconeHom : Bicone J \u2192 Bicone J \u2192 Type max u\u2081 v\u2081\n | left_id : BiconeHom Bicone.left Bicone.left\n | right_id : BiconeHom Bicone.right Bicone.right\n | left (j : J) : BiconeHom Bicone.left (Bicone.diagram j)\n | right (j : J) : BiconeHom Bicone.right (Bicone.diagram j)\n | diagram {j k : J} (f : j \u27f6 k) : BiconeHom (Bicone.diagram j) (Bicone.diagram k)", "-- Mathlib.CategoryTheory.Limits.Bicones.biconeMk (L102-L123)\ndef biconeMk {C : Type u\u2081} [Category.{v\u2081} C] {F : J \u2964 C} (c\u2081 c\u2082 : Cone F) : Bicone J \u2964 C where\n obj X := Bicone.casesOn X c\u2081.pt c\u2082.pt fun j => F.obj j\nmap f := by\n rcases f with (_ | _ | _ | _ | f)\n \u00b7 exact \ud835\udfd9 _\n \u00b7 exact \ud835\udfd9 _\n \u00b7 exact c\u2081.\u03c0.app _\n \u00b7 exact c\u2082.\u03c0.app _\n \u00b7 exact F.map f\n map_id X := by cases X <;> simp\n map_comp f g := by\n rcases f with (_ | _ | _ | _ | _)\n \u00b7 exact (Category.id_comp _).symm\n \u00b7 exact (Category.id_comp _).symm\n \u00b7 cases g\n exact (Category.id_comp _).symm.trans (c\u2081.\u03c0.naturality _)\n \u00b7 cases g\n exact (Category.id_comp _).symm.trans (c\u2082.\u03c0.naturality _)\n \u00b7 cases g\n apply F.map_comp\n\nopen scoped Classical in", "-- Mathlib.CategoryTheory.Limits.Comma.hasLimitsOfSize (L147-L150)\ninstance hasLimitsOfSize [HasLimitsOfSize.{w, w'} A] [HasLimitsOfSize.{w, w'} B]\n [PreservesLimitsOfSize.{w, w'} R] : HasLimitsOfSize.{w, w'} (Comma L R) :=\n\u27e8fun _ _ => inferInstance\u27e9", "-- Mathlib.CategoryTheory.Limits.Comma.preservesColimitsOfShape_rightFunc (L208-L218)\ninstance preservesColimitsOfShape_rightFunc [HasColimitsOfShape J T] :\n PreservesColimitsOfShape J (Arrow.rightFunc : _ \u2964 T) := by\napply Comma.preservesColimitsOfShape_snd\n\nend Arrow\n\nnamespace StructuredArrow\n\nvariable {X : T} {G : A \u2964 T} (F : J \u2964 StructuredArrow X G)\n\nset_option backward.isDefEq.respectTransparency false in"], "statement": "instance createsColimitsOfSizeMapCompForget {Y : C} (f : X \u27f6 Y) :\n CreatesColimitsOfSize.{w, w'} (map f \u22d9 forget Y)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 16635, "declarations_count": 1753, "diagnostics_count": 0, "duplicate_fingerprint": "16132ba47d21c745", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 5942, "lean_code_chars": 15186, "lean_code_ratio": 0.9129, "length_bucket": "medium", "line_count": 479, "natural_language_chars": 1449, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 38, "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.CategoryTheory.Limits.Over).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ninstance createsColimitsOfSizeMapCompForget {Y : C} (f : X \u27f6 Y) :\n CreatesColimitsOfSize.{w, w'} (map f \u22d9 forget Y)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.CategoryTheory.Limits.Over.hasColimit_of_hasColimit_comp_forget (L39-L42)\ninstance hasColimit_of_hasColimit_comp_forget (F : J \u2964 Over X) [i : HasColimit (F \u22d9 forget X)] :\n HasColimit F :=\nCostructuredArrow.hasColimit (i\u2081 := i)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.CategoryTheory.Limits.Over.createsColimitsOfSize (L54-L57)\ninstance createsColimitsOfSize : CreatesColimitsOfSize.{w, w'} (forget X) :=\nCostructuredArrow.createsColimitsOfSize\n\n-- We can automatically infer that the forgetful functor preserves and reflects colimits.\n```\n\n-- snippet 3\n```lean\n-- Mathlib.CategoryTheory.Limits.Over.epi_left_of_epi (L65-L67)\ntheorem epi_left_of_epi [HasPushouts C] {f g : Over X} (h : f \u27f6 g) [Epi h] : Epi h.left :=\nCostructuredArrow.epi_left_of_epi _\n```\n\n-- snippet 4\n```lean\n-- Mathlib.CategoryTheory.Limits.Over.epi_iff_epi_left (L68-L70)\ntheorem epi_iff_epi_left [HasPushouts C] {f g : Over X} (h : f \u27f6 g) : Epi h \u2194 Epi h.left :=\nCostructuredArrow.epi_iff_epi_left _\n```\n\n-- snippet 5\n```lean\n-- Mathlib.CategoryTheory.Limits.Over.preservesColimitsOfSize_map (L75-L79)\ninstance preservesColimitsOfSize_map [HasColimitsOfSize.{w, w'} C] {Y : C} (f : X \u27f6 Y) :\n PreservesColimitsOfSize.{w, w'} (map f) :=\npreservesColimits_of_reflects_of_preserves (map f) (forget Y)\n\n/-- If `c` is a colimit cocone, then so is the cocone `c.toOver` with cocone point `\ud835\udfd9 c.pt`. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.CategoryTheory.Limits.Over.isColimitToOver (L80-L84)\ndef isColimitToOver {F : J \u2964 C} {c : Cocone F} (hc : IsColimit c) : IsColimit c.toOver :=\nisColimitOfReflects (forget c.pt) <| IsColimit.equivIsoColimit c.mapCoconeToOver.symm hc\n\n/-- If `F` has a colimit, then the cocone `colimit.toOver F` with cocone point `\ud835\udfd9 (colimit F)` is\n also a colimit cocone. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.CategoryTheory.Limits.Over.hasLimit_of_hasLimit_comp_forget (L105-L108)\ninstance hasLimit_of_hasLimit_comp_forget (F : J \u2964 Under X) [i : HasLimit (F \u22d9 forget X)] :\n HasLimit F :=\nStructuredArrow.hasLimit (i\u2081 := i)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.CategoryTheory.Limits.Over.mono_right_of_mono (L115-L117)\ntheorem mono_right_of_mono [HasPullbacks C] {f g : Under X} (h : f \u27f6 g) [Mono h] : Mono h.right :=\nStructuredArrow.mono_right_of_mono _\n```\n\n-- snippet 9\n```lean\n-- Mathlib.CategoryTheory.Limits.Over.mono_iff_mono_right (L118-L120)\ntheorem mono_iff_mono_right [HasPullbacks C] {f g : Under X} (h : f \u27f6 g) : Mono h \u2194 Mono h.right :=\nStructuredArrow.mono_iff_mono_right _\n```\n\n-- snippet 10\n```lean\n-- Mathlib.CategoryTheory.Limits.Over.createsLimitsOfSize (L121-L124)\ninstance createsLimitsOfSize : CreatesLimitsOfSize.{w, w'} (forget X) :=\nStructuredArrow.createsLimitsOfSize\n\n-- We can automatically infer that the forgetful functor preserves and reflects limits.\n```\n\n-- snippet 11\n```lean\n-- Mathlib.CategoryTheory.Limits.Over.createLimitsOfSizeMapCompForget (L131-L134)\ninstance createLimitsOfSizeMapCompForget {Y : C} (f : X \u27f6 Y) :\n CreatesLimitsOfSize.{w, w'} (map f \u22d9 forget X) :=\nshow CreatesLimitsOfSize.{w, w'} (forget Y) from inferInstance\n```\n\n-- snippet 12\n```lean\n-- Mathlib.CategoryTheory.Limits.Over.preservesLimitsOfSize_map (L135-L139)\ninstance preservesLimitsOfSize_map [HasLimitsOfSize.{w, w'} C] {Y : C} (f : X \u27f6 Y) :\n PreservesLimitsOfSize.{w, w'} (map f) :=\npreservesLimits_of_reflects_of_preserves (map f) (forget X)\n\n/-- If `c` is a limit cone, then so is the cone `c.toUnder` with cone point `\ud835\udfd9 c.pt`. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.CategoryTheory.Limits.Over.isLimitToUnder (L140-L144)\ndef isLimitToUnder {F : J \u2964 C} {c : Cone F} (hc : IsLimit c) : IsLimit c.toUnder :=\nisLimitOfReflects (forget c.pt) (IsLimit.equivIsoLimit c.mapConeToUnder.symm hc)\n\n/-- If `F` has a limit, then the cone `limit.toUnder F` with cone point `\ud835\udfd9 (limit F)` is\n also a limit cone. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.preservesColimitsOfShape_leftFunc (L204-L207)\ninstance preservesColimitsOfShape_leftFunc [HasColimitsOfShape J T] :\n PreservesColimitsOfShape J (Arrow.leftFunc : _ \u2964 T) := by\napply Comma.preservesColimitsOfShape_fst\n```\n\n-- snippet 15\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.preservesColimitsOfShape_snd (L169-L180)\ninstance preservesColimitsOfShape_snd [HasColimitsOfShape J A] [HasColimitsOfShape J B]\n [PreservesColimitsOfShape J L] : PreservesColimitsOfShape J (Comma.snd L R) where\n preservesColimit :=\npreservesColimit_of_preserves_colimit_cocone\n (coconeOfPreservesIsColimit _ (colimit.isColimit _) (colimit.isColimit _))\n (colimit.isColimit _)\n\nend Comma\n\nnamespace Arrow\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 16\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasLimits (L189-L192)\ninstance hasLimits [HasLimits T] : HasLimits (Arrow T) :=\n\u27e8fun _ _ => inferInstance\u27e9\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 17\n```lean\n-- Mathlib.CategoryTheory.Limits.ColimitLimit.\u03b9_colimitLimitToLimitColimit_\u03c0 (L91-L96)\ntheorem \u03b9_colimitLimitToLimitColimit_\u03c0 (j) (k) :\n colimit.\u03b9 _ k \u226b colimitLimitToLimitColimit F \u226b limit.\u03c0 _ j =\n limit.\u03c0 ((curry.obj (Prod.swap K J \u22d9 F)).obj k) j \u226b colimit.\u03b9 ((curry.obj F).obj j) k := by\ndsimp [colimitLimitToLimitColimit]\n simp\n```\n\n-- snippet 18\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasColimit (L151-L154)\ninstance hasColimit (F : J \u2964 Comma L R) [HasColimit (F \u22d9 fst L R)] [HasColimit (F \u22d9 snd L R)]\n [PreservesColimit (F \u22d9 fst L R) L] : HasColimit F :=\nHasColimit.mk \u27e8_, coconeOfPreservesIsColimit _ (colimit.isColimit _) (colimit.isColimit _)\u27e9\n```\n\n-- snippet 19\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.colimitAuxiliaryCocone (L94-L101)\ndef colimitAuxiliaryCocone (c\u2082 : Cocone (F \u22d9 snd L R)) : Cocone ((F \u22d9 fst L R) \u22d9 L) :=\n(Cocone.precompose (whiskerLeft F (Comma.natTrans L R) :)).obj (R.mapCocone c\u2082)\n\n/--\nIf `L` preserves the appropriate colimit, then given a colimit cocone for `F \u22d9 fst L R : J \u2964 L` and\na cocone for `F \u22d9 snd L R : J \u2964 R` we can build a cocone for `F` which will turn out to be a\ncolimit cocone.\n-/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.mono_right_of_mono (L247-L250)\ninstance mono_right_of_mono [HasPullbacks A] [PreservesLimitsOfShape WalkingCospan G]\n {Y Z : StructuredArrow X G} (f : Y \u27f6 Z) [Mono f] : Mono f.right :=\nshow Mono ((proj X G).map f) from inferInstance\n```\n\n-- snippet 21\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasLimit (L140-L143)\ninstance hasLimit (F : J \u2964 Comma L R) [HasLimit (F \u22d9 fst L R)] [HasLimit (F \u22d9 snd L R)]\n [PreservesLimit (F \u22d9 snd L R) R] : HasLimit F :=\nHasLimit.mk \u27e8_, coneOfPreservesIsLimit _ (limit.isLimit _) (limit.isLimit _)\u27e9\n```\n\n-- snippet 22\n```lean\n-- Mathlib.CategoryTheory.Limits.ColimitLimit.map_id_right_eq_curry_swap_map (L47-L89)\ntheorem map_id_right_eq_curry_swap_map {j j' : J} {f : j \u27f6 j'} {k : K} :\n F.map (f \u00d7\u2098 \ud835\udfd9 k) = ((curry.obj (Prod.swap K J \u22d9 F)).obj k).map f :=\nrfl\n\nvariable [HasLimitsOfShape J C]\nvariable [HasColimitsOfShape K C]\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The universal morphism\n$\\colim_k \\lim_j F(j,k) \u2192 \\lim_j \\colim_k F(j, k)$.\n-/\nnoncomputable def colimitLimitToLimitColimit :\n colimit (curry.obj (Prod.swap K J \u22d9 F) \u22d9 lim) \u27f6 limit (curry.obj F \u22d9 colim) :=\n limit.lift (curry.obj F \u22d9 colim)\n { pt := _\n \u03c0 :=\n { app := fun j =>\n colimit.desc (curry.obj (Prod.swap K J \u22d9 F) \u22d9 lim)\n { pt := _\n \u03b9 :=\n { app := fun k =>\n limit.\u03c0 ((curry.obj (Prod.swap K J \u22d9 F)).obj k) j \u226b\n colimit.\u03b9 ((curry.obj F).obj j) k\n naturality := by\n intro k k' f\n simp only [Functor.comp_obj, lim_obj, colimit.cocone_x,\n Functor.const_obj_obj, Functor.comp_map, lim_map,\n curry_obj_obj_obj, Prod.swap_obj, limMap_\u03c0_assoc, curry_obj_map_app,\n Prod.swap_map, Functor.const_obj_map, Category.comp_id]\n rw [map_id_left_eq_curry_map, colimit.w] } }\n naturality := by\n intro j j' f\n dsimp\n ext k\n simp only [Functor.comp_obj, lim_obj, Category.id_comp, colimit.\u03b9_desc,\n colimit.\u03b9_desc_assoc, Category.assoc, \u03b9_colimMap,\n curry_obj_obj_obj, curry_obj_map_app]\n rw [map_id_right_eq_curry_swap_map, limit.w_assoc] } }\n\nset_option backward.isDefEq.respectTransparency false in\n/-- Since `colimit_limit_to_limit_colimit` is a morphism from a colimit to a limit,\nthis lemma characterises it.\n-/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.finBiconeHom (L124-L157)\ninstance finBiconeHom [FinCategory J] (j k : Bicone J) : Fintype (j \u27f6 k) := by\ncases j <;> cases k\n \u00b7 exact\n { elems := {BiconeHom.left_id}\n complete := fun f => by cases f; simp }\n \u00b7 exact\n { elems := \u2205\n complete := fun f => by cases f }\n \u00b7 exact\n { elems := {BiconeHom.left _}\n complete := fun f => by cases f; simp }\n \u00b7 exact\n { elems := \u2205\n complete := fun f => by cases f }\n \u00b7 exact\n { elems := {BiconeHom.right_id}\n complete := fun f => by cases f; simp }\n \u00b7 exact\n { elems := {BiconeHom.right _}\n complete := fun f => by cases f; simp }\n \u00b7 exact\n { elems := \u2205\n complete := fun f => by cases f }\n \u00b7 exact\n { elems := \u2205\n complete := fun f => by cases f }\n \u00b7 exact\n { elems := Finset.image BiconeHom.diagram Fintype.elems\n complete := fun f => by\n rcases f with (_ | _ | _ | _ | f)\n simp only [Finset.mem_image]\n use f\n simpa using Fintype.complete _ }\n```\n\n-- snippet 24\n```lean\n-- Mathlib.CategoryTheory.Limits.ColimitLimit.\u03b9_colimitLimitToLimitColimit_\u03c0_apply (L98-L106)\ntheorem \u03b9_colimitLimitToLimitColimit_\u03c0_apply [Small.{v} J] [Small.{v} K] (F : J \u00d7 K \u2964 Type v)\n (j : J) (k : K) (f) : limit.\u03c0 (curry.obj F \u22d9 colim) j\n (colimitLimitToLimitColimit F (colimit.\u03b9 (curry.obj (Prod.swap K J \u22d9 F) \u22d9 lim) k f)) =\n colimit.\u03b9 ((curry.obj F).obj j) k (limit.\u03c0 ((curry.obj (Prod.swap K J \u22d9 F)).obj k) j f) := by\ndsimp [colimitLimitToLimitColimit]\n simp\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The map `colimit_limit_to_limit_colimit` realized as a map of cones. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasColimits (L201-L203)\ninstance hasColimits [HasColimits T] : HasColimits (Arrow T) :=\n\u27e8fun _ _ => inferInstance\u27e9\n```\n\n-- snippet 26\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.preservesColimitsOfShape_fst (L162-L168)\ninstance preservesColimitsOfShape_fst [HasColimitsOfShape J A] [HasColimitsOfShape J B]\n [PreservesColimitsOfShape J L] : PreservesColimitsOfShape J (Comma.fst L R) where\n preservesColimit :=\npreservesColimit_of_preserves_colimit_cocone\n (coconeOfPreservesIsColimit _ (colimit.isColimit _) (colimit.isColimit _))\n (colimit.isColimit _)\n```\n\n-- snippet 27\n```lean\n-- Mathlib.CategoryTheory.Limits.ColimitLimit.map_id_left_eq_curry_map (L43-L46)\ntheorem map_id_left_eq_curry_map {j : J} {k k' : K} {f : k \u27f6 k'} :\n F.map (\ud835\udfd9 j \u00d7\u2098 f) = ((curry.obj F).obj j).map f :=\nrfl\n```\n\n-- snippet 28\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasColimitsOfSize (L158-L161)\ninstance hasColimitsOfSize [HasColimitsOfSize.{w, w'} A] [HasColimitsOfSize.{w, w'} B]\n [PreservesColimitsOfSize.{w, w'} L] : HasColimitsOfSize.{w, w'} (Comma L R) :=\n\u27e8fun _ _ => inferInstance\u27e9\n```\n\n-- snippet 29\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeSmallCategory (L158-L160)\ninstance biconeSmallCategory : SmallCategory (Bicone J) :=\nCategoryTheory.biconeCategory J\n```\n\n-- snippet 30\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.mono_iff_mono_right (L251-L260)\ntheorem mono_iff_mono_right [HasPullbacks A] [PreservesLimitsOfShape WalkingCospan G]\n {Y Z : StructuredArrow X G} (f : Y \u27f6 Z) : Mono f \u2194 Mono f.right :=\n\u27e8fun _ => inferInstance, fun _ => mono_of_mono_right f\u27e9\n\nend StructuredArrow\n\nnamespace CostructuredArrow\n\nvariable {G : A \u2964 T} {X : T} (F : J \u2964 CostructuredArrow G X)\n```\n\n-- snippet 31\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeCategoryStruct (L74-L87)\ninstance biconeCategoryStruct : CategoryStruct (Bicone J) where\n Hom := BiconeHom J\nid j := Bicone.casesOn j BiconeHom.left_id BiconeHom.right_id fun k => BiconeHom.diagram (\ud835\udfd9 k)\n comp f g := by\n rcases f with (_ | _ | _ | _ | f)\n \u00b7 exact g\n \u00b7 exact g\n \u00b7 cases g\n apply BiconeHom.left\n \u00b7 cases g\n apply BiconeHom.right\n \u00b7 rcases g with (_ | _ | _ | _ | g)\n exact BiconeHom.diagram (f \u226b g)\n```\n\n-- snippet 32\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.limitAuxiliaryCone (L47-L53)\ndef limitAuxiliaryCone (c\u2081 : Cone (F \u22d9 fst L R)) : Cone ((F \u22d9 snd L R) \u22d9 R) :=\n(Cone.postcompose (whiskerLeft F (Comma.natTrans L R) :)).obj (L.mapCone c\u2081)\n\n/-- If `R` preserves the appropriate limit, then given a cone for `F \u22d9 fst L R : J \u2964 L` and a\nlimit cone for `F \u22d9 snd L R : J \u2964 R` we can build a cone for `F` which will turn out to be a limit\ncone.\n-/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeCategory (L88-L100)\ninstance biconeCategory : Category (Bicone J) where\n id_comp f := by cases f <;> simp\ncomp_id f := by cases f <;> simp\n assoc f g h := by cases f <;> cases g <;> cases h <;> simp\n\nend Bicone\n\nsection SmallCategory\n\nvariable (J : Type v\u2081) [SmallCategory J]\n\n/-- Given a diagram `F : J \u2964 C` and two `Cone F`s, we can join them into a diagram `Bicone J \u2964 C`.\n-/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.BiconeHom (L70-L72)\ninstance BiconeHom.decidableEq {j k : Bicone J} : DecidableEq (BiconeHom J j k) := fun f g => by\nclassical cases f <;> cases g <;> simp only [diagram.injEq] <;> infer_instance\n```\n\n-- snippet 35\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.finBicone (L52-L66)\ninstance finBicone [Fintype J] : Fintype (Bicone J) where\n elems := [Bicone.left, Bicone.right].toFinset \u222a Finset.image Bicone.diagram Fintype.elems\ncomplete j := by\n cases j <;> simp [Fintype.complete]\n\nvariable [Category.{v\u2081} J]\n\n/-- The homs for a walking `Bicone J`. -/\ninductive BiconeHom : Bicone J \u2192 Bicone J \u2192 Type max u\u2081 v\u2081\n | left_id : BiconeHom Bicone.left Bicone.left\n | right_id : BiconeHom Bicone.right Bicone.right\n | left (j : J) : BiconeHom Bicone.left (Bicone.diagram j)\n | right (j : J) : BiconeHom Bicone.right (Bicone.diagram j)\n | diagram {j k : J} (f : j \u27f6 k) : BiconeHom (Bicone.diagram j) (Bicone.diagram k)\n```\n\n-- snippet 36\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeMk (L102-L123)\ndef biconeMk {C : Type u\u2081} [Category.{v\u2081} C] {F : J \u2964 C} (c\u2081 c\u2082 : Cone F) : Bicone J \u2964 C where\n obj X := Bicone.casesOn X c\u2081.pt c\u2082.pt fun j => F.obj j\nmap f := by\n rcases f with (_ | _ | _ | _ | f)\n \u00b7 exact \ud835\udfd9 _\n \u00b7 exact \ud835\udfd9 _\n \u00b7 exact c\u2081.\u03c0.app _\n \u00b7 exact c\u2082.\u03c0.app _\n \u00b7 exact F.map f\n map_id X := by cases X <;> simp\n map_comp f g := by\n rcases f with (_ | _ | _ | _ | _)\n \u00b7 exact (Category.id_comp _).symm\n \u00b7 exact (Category.id_comp _).symm\n \u00b7 cases g\n exact (Category.id_comp _).symm.trans (c\u2081.\u03c0.naturality _)\n \u00b7 cases g\n exact (Category.id_comp _).symm.trans (c\u2082.\u03c0.naturality _)\n \u00b7 cases g\n apply F.map_comp\n\nopen scoped Classical in\n```\n\n-- snippet 37\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasLimitsOfSize (L147-L150)\ninstance hasLimitsOfSize [HasLimitsOfSize.{w, w'} A] [HasLimitsOfSize.{w, w'} B]\n [PreservesLimitsOfSize.{w, w'} R] : HasLimitsOfSize.{w, w'} (Comma L R) :=\n\u27e8fun _ _ => inferInstance\u27e9\n```\n\n-- snippet 38\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.preservesColimitsOfShape_rightFunc (L208-L218)\ninstance preservesColimitsOfShape_rightFunc [HasColimitsOfShape J T] :\n PreservesColimitsOfShape J (Arrow.rightFunc : _ \u2964 T) := by\napply Comma.preservesColimitsOfShape_snd\n\nend Arrow\n\nnamespace StructuredArrow\n\nvariable {X : T} {G : A \u2964 T} (F : J \u2964 StructuredArrow X G)\n\nset_option backward.isDefEq.respectTransparency false in\n```\n", "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.CategoryTheory.Limits.Over).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ninstance createsColimitsOfSizeMapCompForget {Y : C} (f : X \u27f6 Y) :\n CreatesColimitsOfSize.{w, w'} (map f \u22d9 forget Y)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.CategoryTheory.Limits.Over.hasColimit_of_hasColimit_comp_forget (L39-L42)\ninstance hasColimit_of_hasColimit_comp_forget (F : J \u2964 Over X) [i : HasColimit (F \u22d9 forget X)] :\n HasColimit F :=\nCostructuredArrow.hasColimit (i\u2081 := i)\n```\n\n-- snippet 2\n```lean\n-- Mathlib.CategoryTheory.Limits.Over.createsColimitsOfSize (L54-L57)\ninstance createsColimitsOfSize : CreatesColimitsOfSize.{w, w'} (forget X) :=\nCostructuredArrow.createsColimitsOfSize\n\n-- We can automatically infer that the forgetful functor preserves and reflects colimits.\n```\n\n-- snippet 3\n```lean\n-- Mathlib.CategoryTheory.Limits.Over.epi_left_of_epi (L65-L67)\ntheorem epi_left_of_epi [HasPushouts C] {f g : Over X} (h : f \u27f6 g) [Epi h] : Epi h.left :=\nCostructuredArrow.epi_left_of_epi _\n```\n\n-- snippet 4\n```lean\n-- Mathlib.CategoryTheory.Limits.Over.epi_iff_epi_left (L68-L70)\ntheorem epi_iff_epi_left [HasPushouts C] {f g : Over X} (h : f \u27f6 g) : Epi h \u2194 Epi h.left :=\nCostructuredArrow.epi_iff_epi_left _\n```\n\n-- snippet 5\n```lean\n-- Mathlib.CategoryTheory.Limits.Over.preservesColimitsOfSize_map (L75-L79)\ninstance preservesColimitsOfSize_map [HasColimitsOfSize.{w, w'} C] {Y : C} (f : X \u27f6 Y) :\n PreservesColimitsOfSize.{w, w'} (map f) :=\npreservesColimits_of_reflects_of_preserves (map f) (forget Y)\n\n/-- If `c` is a colimit cocone, then so is the cocone `c.toOver` with cocone point `\ud835\udfd9 c.pt`. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.CategoryTheory.Limits.Over.isColimitToOver (L80-L84)\ndef isColimitToOver {F : J \u2964 C} {c : Cocone F} (hc : IsColimit c) : IsColimit c.toOver :=\nisColimitOfReflects (forget c.pt) <| IsColimit.equivIsoColimit c.mapCoconeToOver.symm hc\n\n/-- If `F` has a colimit, then the cocone `colimit.toOver F` with cocone point `\ud835\udfd9 (colimit F)` is\n also a colimit cocone. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.CategoryTheory.Limits.Over.hasLimit_of_hasLimit_comp_forget (L105-L108)\ninstance hasLimit_of_hasLimit_comp_forget (F : J \u2964 Under X) [i : HasLimit (F \u22d9 forget X)] :\n HasLimit F :=\nStructuredArrow.hasLimit (i\u2081 := i)\n```\n\n-- snippet 8\n```lean\n-- Mathlib.CategoryTheory.Limits.Over.mono_right_of_mono (L115-L117)\ntheorem mono_right_of_mono [HasPullbacks C] {f g : Under X} (h : f \u27f6 g) [Mono h] : Mono h.right :=\nStructuredArrow.mono_right_of_mono _\n```\n\n-- snippet 9\n```lean\n-- Mathlib.CategoryTheory.Limits.Over.mono_iff_mono_right (L118-L120)\ntheorem mono_iff_mono_right [HasPullbacks C] {f g : Under X} (h : f \u27f6 g) : Mono h \u2194 Mono h.right :=\nStructuredArrow.mono_iff_mono_right _\n```\n\n-- snippet 10\n```lean\n-- Mathlib.CategoryTheory.Limits.Over.createsLimitsOfSize (L121-L124)\ninstance createsLimitsOfSize : CreatesLimitsOfSize.{w, w'} (forget X) :=\nStructuredArrow.createsLimitsOfSize\n\n-- We can automatically infer that the forgetful functor preserves and reflects limits.\n```\n\n-- snippet 11\n```lean\n-- Mathlib.CategoryTheory.Limits.Over.createLimitsOfSizeMapCompForget (L131-L134)\ninstance createLimitsOfSizeMapCompForget {Y : C} (f : X \u27f6 Y) :\n CreatesLimitsOfSize.{w, w'} (map f \u22d9 forget X) :=\nshow CreatesLimitsOfSize.{w, w'} (forget Y) from inferInstance\n```\n\n-- snippet 12\n```lean\n-- Mathlib.CategoryTheory.Limits.Over.preservesLimitsOfSize_map (L135-L139)\ninstance preservesLimitsOfSize_map [HasLimitsOfSize.{w, w'} C] {Y : C} (f : X \u27f6 Y) :\n PreservesLimitsOfSize.{w, w'} (map f) :=\npreservesLimits_of_reflects_of_preserves (map f) (forget X)\n\n/-- If `c` is a limit cone, then so is the cone `c.toUnder` with cone point `\ud835\udfd9 c.pt`. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.CategoryTheory.Limits.Over.isLimitToUnder (L140-L144)\ndef isLimitToUnder {F : J \u2964 C} {c : Cone F} (hc : IsLimit c) : IsLimit c.toUnder :=\nisLimitOfReflects (forget c.pt) (IsLimit.equivIsoLimit c.mapConeToUnder.symm hc)\n\n/-- If `F` has a limit, then the cone `limit.toUnder F` with cone point `\ud835\udfd9 (limit F)` is\n also a limit cone. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.preservesColimitsOfShape_leftFunc (L204-L207)\ninstance preservesColimitsOfShape_leftFunc [HasColimitsOfShape J T] :\n PreservesColimitsOfShape J (Arrow.leftFunc : _ \u2964 T) := by\napply Comma.preservesColimitsOfShape_fst\n```\n\n-- snippet 15\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.preservesColimitsOfShape_snd (L169-L180)\ninstance preservesColimitsOfShape_snd [HasColimitsOfShape J A] [HasColimitsOfShape J B]\n [PreservesColimitsOfShape J L] : PreservesColimitsOfShape J (Comma.snd L R) where\n preservesColimit :=\npreservesColimit_of_preserves_colimit_cocone\n (coconeOfPreservesIsColimit _ (colimit.isColimit _) (colimit.isColimit _))\n (colimit.isColimit _)\n\nend Comma\n\nnamespace Arrow\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 16\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasLimits (L189-L192)\ninstance hasLimits [HasLimits T] : HasLimits (Arrow T) :=\n\u27e8fun _ _ => inferInstance\u27e9\n\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 17\n```lean\n-- Mathlib.CategoryTheory.Limits.ColimitLimit.\u03b9_colimitLimitToLimitColimit_\u03c0 (L91-L96)\ntheorem \u03b9_colimitLimitToLimitColimit_\u03c0 (j) (k) :\n colimit.\u03b9 _ k \u226b colimitLimitToLimitColimit F \u226b limit.\u03c0 _ j =\n limit.\u03c0 ((curry.obj (Prod.swap K J \u22d9 F)).obj k) j \u226b colimit.\u03b9 ((curry.obj F).obj j) k := by\ndsimp [colimitLimitToLimitColimit]\n simp\n```\n\n-- snippet 18\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasColimit (L151-L154)\ninstance hasColimit (F : J \u2964 Comma L R) [HasColimit (F \u22d9 fst L R)] [HasColimit (F \u22d9 snd L R)]\n [PreservesColimit (F \u22d9 fst L R) L] : HasColimit F :=\nHasColimit.mk \u27e8_, coconeOfPreservesIsColimit _ (colimit.isColimit _) (colimit.isColimit _)\u27e9\n```\n\n-- snippet 19\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.colimitAuxiliaryCocone (L94-L101)\ndef colimitAuxiliaryCocone (c\u2082 : Cocone (F \u22d9 snd L R)) : Cocone ((F \u22d9 fst L R) \u22d9 L) :=\n(Cocone.precompose (whiskerLeft F (Comma.natTrans L R) :)).obj (R.mapCocone c\u2082)\n\n/--\nIf `L` preserves the appropriate colimit, then given a colimit cocone for `F \u22d9 fst L R : J \u2964 L` and\na cocone for `F \u22d9 snd L R : J \u2964 R` we can build a cocone for `F` which will turn out to be a\ncolimit cocone.\n-/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.mono_right_of_mono (L247-L250)\ninstance mono_right_of_mono [HasPullbacks A] [PreservesLimitsOfShape WalkingCospan G]\n {Y Z : StructuredArrow X G} (f : Y \u27f6 Z) [Mono f] : Mono f.right :=\nshow Mono ((proj X G).map f) from inferInstance\n```\n\n-- snippet 21\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasLimit (L140-L143)\ninstance hasLimit (F : J \u2964 Comma L R) [HasLimit (F \u22d9 fst L R)] [HasLimit (F \u22d9 snd L R)]\n [PreservesLimit (F \u22d9 snd L R) R] : HasLimit F :=\nHasLimit.mk \u27e8_, coneOfPreservesIsLimit _ (limit.isLimit _) (limit.isLimit _)\u27e9\n```\n\n-- snippet 22\n```lean\n-- Mathlib.CategoryTheory.Limits.ColimitLimit.map_id_right_eq_curry_swap_map (L47-L89)\ntheorem map_id_right_eq_curry_swap_map {j j' : J} {f : j \u27f6 j'} {k : K} :\n F.map (f \u00d7\u2098 \ud835\udfd9 k) = ((curry.obj (Prod.swap K J \u22d9 F)).obj k).map f :=\nrfl\n\nvariable [HasLimitsOfShape J C]\nvariable [HasColimitsOfShape K C]\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The universal morphism\n$\\colim_k \\lim_j F(j,k) \u2192 \\lim_j \\colim_k F(j, k)$.\n-/\nnoncomputable def colimitLimitToLimitColimit :\n colimit (curry.obj (Prod.swap K J \u22d9 F) \u22d9 lim) \u27f6 limit (curry.obj F \u22d9 colim) :=\n limit.lift (curry.obj F \u22d9 colim)\n { pt := _\n \u03c0 :=\n { app := fun j =>\n colimit.desc (curry.obj (Prod.swap K J \u22d9 F) \u22d9 lim)\n { pt := _\n \u03b9 :=\n { app := fun k =>\n limit.\u03c0 ((curry.obj (Prod.swap K J \u22d9 F)).obj k) j \u226b\n colimit.\u03b9 ((curry.obj F).obj j) k\n naturality := by\n intro k k' f\n simp only [Functor.comp_obj, lim_obj, colimit.cocone_x,\n Functor.const_obj_obj, Functor.comp_map, lim_map,\n curry_obj_obj_obj, Prod.swap_obj, limMap_\u03c0_assoc, curry_obj_map_app,\n Prod.swap_map, Functor.const_obj_map, Category.comp_id]\n rw [map_id_left_eq_curry_map, colimit.w] } }\n naturality := by\n intro j j' f\n dsimp\n ext k\n simp only [Functor.comp_obj, lim_obj, Category.id_comp, colimit.\u03b9_desc,\n colimit.\u03b9_desc_assoc, Category.assoc, \u03b9_colimMap,\n curry_obj_obj_obj, curry_obj_map_app]\n rw [map_id_right_eq_curry_swap_map, limit.w_assoc] } }\n\nset_option backward.isDefEq.respectTransparency false in\n/-- Since `colimit_limit_to_limit_colimit` is a morphism from a colimit to a limit,\nthis lemma characterises it.\n-/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.finBiconeHom (L124-L157)\ninstance finBiconeHom [FinCategory J] (j k : Bicone J) : Fintype (j \u27f6 k) := by\ncases j <;> cases k\n \u00b7 exact\n { elems := {BiconeHom.left_id}\n complete := fun f => by cases f; simp }\n \u00b7 exact\n { elems := \u2205\n complete := fun f => by cases f }\n \u00b7 exact\n { elems := {BiconeHom.left _}\n complete := fun f => by cases f; simp }\n \u00b7 exact\n { elems := \u2205\n complete := fun f => by cases f }\n \u00b7 exact\n { elems := {BiconeHom.right_id}\n complete := fun f => by cases f; simp }\n \u00b7 exact\n { elems := {BiconeHom.right _}\n complete := fun f => by cases f; simp }\n \u00b7 exact\n { elems := \u2205\n complete := fun f => by cases f }\n \u00b7 exact\n { elems := \u2205\n complete := fun f => by cases f }\n \u00b7 exact\n { elems := Finset.image BiconeHom.diagram Fintype.elems\n complete := fun f => by\n rcases f with (_ | _ | _ | _ | f)\n simp only [Finset.mem_image]\n use f\n simpa using Fintype.complete _ }\n```\n\n-- snippet 24\n```lean\n-- Mathlib.CategoryTheory.Limits.ColimitLimit.\u03b9_colimitLimitToLimitColimit_\u03c0_apply (L98-L106)\ntheorem \u03b9_colimitLimitToLimitColimit_\u03c0_apply [Small.{v} J] [Small.{v} K] (F : J \u00d7 K \u2964 Type v)\n (j : J) (k : K) (f) : limit.\u03c0 (curry.obj F \u22d9 colim) j\n (colimitLimitToLimitColimit F (colimit.\u03b9 (curry.obj (Prod.swap K J \u22d9 F) \u22d9 lim) k f)) =\n colimit.\u03b9 ((curry.obj F).obj j) k (limit.\u03c0 ((curry.obj (Prod.swap K J \u22d9 F)).obj k) j f) := by\ndsimp [colimitLimitToLimitColimit]\n simp\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The map `colimit_limit_to_limit_colimit` realized as a map of cones. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasColimits (L201-L203)\ninstance hasColimits [HasColimits T] : HasColimits (Arrow T) :=\n\u27e8fun _ _ => inferInstance\u27e9\n```\n\n-- snippet 26\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.preservesColimitsOfShape_fst (L162-L168)\ninstance preservesColimitsOfShape_fst [HasColimitsOfShape J A] [HasColimitsOfShape J B]\n [PreservesColimitsOfShape J L] : PreservesColimitsOfShape J (Comma.fst L R) where\n preservesColimit :=\npreservesColimit_of_preserves_colimit_cocone\n (coconeOfPreservesIsColimit _ (colimit.isColimit _) (colimit.isColimit _))\n (colimit.isColimit _)\n```\n\n-- snippet 27\n```lean\n-- Mathlib.CategoryTheory.Limits.ColimitLimit.map_id_left_eq_curry_map (L43-L46)\ntheorem map_id_left_eq_curry_map {j : J} {k k' : K} {f : k \u27f6 k'} :\n F.map (\ud835\udfd9 j \u00d7\u2098 f) = ((curry.obj F).obj j).map f :=\nrfl\n```\n\n-- snippet 28\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasColimitsOfSize (L158-L161)\ninstance hasColimitsOfSize [HasColimitsOfSize.{w, w'} A] [HasColimitsOfSize.{w, w'} B]\n [PreservesColimitsOfSize.{w, w'} L] : HasColimitsOfSize.{w, w'} (Comma L R) :=\n\u27e8fun _ _ => inferInstance\u27e9\n```\n\n-- snippet 29\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeSmallCategory (L158-L160)\ninstance biconeSmallCategory : SmallCategory (Bicone J) :=\nCategoryTheory.biconeCategory J\n```\n\n-- snippet 30\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.mono_iff_mono_right (L251-L260)\ntheorem mono_iff_mono_right [HasPullbacks A] [PreservesLimitsOfShape WalkingCospan G]\n {Y Z : StructuredArrow X G} (f : Y \u27f6 Z) : Mono f \u2194 Mono f.right :=\n\u27e8fun _ => inferInstance, fun _ => mono_of_mono_right f\u27e9\n\nend StructuredArrow\n\nnamespace CostructuredArrow\n\nvariable {G : A \u2964 T} {X : T} (F : J \u2964 CostructuredArrow G X)\n```\n\n-- snippet 31\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeCategoryStruct (L74-L87)\ninstance biconeCategoryStruct : CategoryStruct (Bicone J) where\n Hom := BiconeHom J\nid j := Bicone.casesOn j BiconeHom.left_id BiconeHom.right_id fun k => BiconeHom.diagram (\ud835\udfd9 k)\n comp f g := by\n rcases f with (_ | _ | _ | _ | f)\n \u00b7 exact g\n \u00b7 exact g\n \u00b7 cases g\n apply BiconeHom.left\n \u00b7 cases g\n apply BiconeHom.right\n \u00b7 rcases g with (_ | _ | _ | _ | g)\n exact BiconeHom.diagram (f \u226b g)\n```\n\n-- snippet 32\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.limitAuxiliaryCone (L47-L53)\ndef limitAuxiliaryCone (c\u2081 : Cone (F \u22d9 fst L R)) : Cone ((F \u22d9 snd L R) \u22d9 R) :=\n(Cone.postcompose (whiskerLeft F (Comma.natTrans L R) :)).obj (L.mapCone c\u2081)\n\n/-- If `R` preserves the appropriate limit, then given a cone for `F \u22d9 fst L R : J \u2964 L` and a\nlimit cone for `F \u22d9 snd L R : J \u2964 R` we can build a cone for `F` which will turn out to be a limit\ncone.\n-/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeCategory (L88-L100)\ninstance biconeCategory : Category (Bicone J) where\n id_comp f := by cases f <;> simp\ncomp_id f := by cases f <;> simp\n assoc f g h := by cases f <;> cases g <;> cases h <;> simp\n\nend Bicone\n\nsection SmallCategory\n\nvariable (J : Type v\u2081) [SmallCategory J]\n\n/-- Given a diagram `F : J \u2964 C` and two `Cone F`s, we can join them into a diagram `Bicone J \u2964 C`.\n-/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.BiconeHom (L70-L72)\ninstance BiconeHom.decidableEq {j k : Bicone J} : DecidableEq (BiconeHom J j k) := fun f g => by\nclassical cases f <;> cases g <;> simp only [diagram.injEq] <;> infer_instance\n```\n\n-- snippet 35\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.finBicone (L52-L66)\ninstance finBicone [Fintype J] : Fintype (Bicone J) where\n elems := [Bicone.left, Bicone.right].toFinset \u222a Finset.image Bicone.diagram Fintype.elems\ncomplete j := by\n cases j <;> simp [Fintype.complete]\n\nvariable [Category.{v\u2081} J]\n\n/-- The homs for a walking `Bicone J`. -/\ninductive BiconeHom : Bicone J \u2192 Bicone J \u2192 Type max u\u2081 v\u2081\n | left_id : BiconeHom Bicone.left Bicone.left\n | right_id : BiconeHom Bicone.right Bicone.right\n | left (j : J) : BiconeHom Bicone.left (Bicone.diagram j)\n | right (j : J) : BiconeHom Bicone.right (Bicone.diagram j)\n | diagram {j k : J} (f : j \u27f6 k) : BiconeHom (Bicone.diagram j) (Bicone.diagram k)\n```\n\n-- snippet 36\n```lean\n-- Mathlib.CategoryTheory.Limits.Bicones.biconeMk (L102-L123)\ndef biconeMk {C : Type u\u2081} [Category.{v\u2081} C] {F : J \u2964 C} (c\u2081 c\u2082 : Cone F) : Bicone J \u2964 C where\n obj X := Bicone.casesOn X c\u2081.pt c\u2082.pt fun j => F.obj j\nmap f := by\n rcases f with (_ | _ | _ | _ | f)\n \u00b7 exact \ud835\udfd9 _\n \u00b7 exact \ud835\udfd9 _\n \u00b7 exact c\u2081.\u03c0.app _\n \u00b7 exact c\u2082.\u03c0.app _\n \u00b7 exact F.map f\n map_id X := by cases X <;> simp\n map_comp f g := by\n rcases f with (_ | _ | _ | _ | _)\n \u00b7 exact (Category.id_comp _).symm\n \u00b7 exact (Category.id_comp _).symm\n \u00b7 cases g\n exact (Category.id_comp _).symm.trans (c\u2081.\u03c0.naturality _)\n \u00b7 cases g\n exact (Category.id_comp _).symm.trans (c\u2082.\u03c0.naturality _)\n \u00b7 cases g\n apply F.map_comp\n\nopen scoped Classical in\n```\n\n-- snippet 37\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.hasLimitsOfSize (L147-L150)\ninstance hasLimitsOfSize [HasLimitsOfSize.{w, w'} A] [HasLimitsOfSize.{w, w'} B]\n [PreservesLimitsOfSize.{w, w'} R] : HasLimitsOfSize.{w, w'} (Comma L R) :=\n\u27e8fun _ _ => inferInstance\u27e9\n```\n\n-- snippet 38\n```lean\n-- Mathlib.CategoryTheory.Limits.Comma.preservesColimitsOfShape_rightFunc (L208-L218)\ninstance preservesColimitsOfShape_rightFunc [HasColimitsOfShape J T] :\n PreservesColimitsOfShape J (Arrow.rightFunc : _ \u2964 T) := by\napply Comma.preservesColimitsOfShape_snd\n\nend Arrow\n\nnamespace StructuredArrow\n\nvariable {X : T} {G : A \u2964 T} (F : J \u2964 StructuredArrow X G)\n\nset_option backward.isDefEq.respectTransparency false in\n```\n[/INST]", "sample_id": "C-Mathlib.CategoryTheory.Limits.Over.createsColimitsOfSizeMapCompForget", "source": {"declaration": "Mathlib.CategoryTheory.Limits.Over.createsColimitsOfSizeMapCompForget", "file": "Mathlib/CategoryTheory/Limits/Over.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.CategoryTheory.Limits.Over", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Limits/Over.lean#L71", "span": "L71-L74"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\ntheorem comp_inv_eq (\u03b1 : X \u2245 Y) {f : Z \u27f6 Y} {g : Z \u27f6 X} : f \u226b \u03b1.inv = g \u2194 f = g \u226b \u03b1.hom := \u27e8fun H => by simp [H.symm], fun H => by simp [H]\u27e9\n```", "instruction": "Edit `comp_inv_eq` so it still compiles and the proof is simplified where possible. Return the full updated `comp_inv_eq` block.", "proof_is_oneliner": false, "target_span": "L197-L199", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 826, "declarations_count": 100, "diagnostics_count": 0, "duplicate_fingerprint": "e46923865977f0ee", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 286, "lean_code_chars": 141, "lean_code_ratio": 0.1707, "length_bucket": "tiny", "line_count": 10, "natural_language_chars": 685, "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.CategoryTheory.Iso).", "role": "system"}, {"content": "You are editing a file in `Mathlib/CategoryTheory/Iso.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.CategoryTheory.Iso.comp_inv_eq`, L197-L199)\n```lean\ntheorem comp_inv_eq (\u03b1 : X \u2245 Y) {f : Z \u27f6 Y} {g : Z \u27f6 X} : f \u226b \u03b1.inv = g \u2194 f = g \u226b \u03b1.hom := \u27e8fun H => by simp [H.symm], fun H => by simp [H]\u27e9\n```\n\n## Edit instruction\nEdit `comp_inv_eq` so it still compiles and the proof is simplified where possible. Return the full updated `comp_inv_eq` 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.CategoryTheory.Iso).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/CategoryTheory/Iso.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.CategoryTheory.Iso.comp_inv_eq`, L197-L199)\n```lean\ntheorem comp_inv_eq (\u03b1 : X \u2245 Y) {f : Z \u27f6 Y} {g : Z \u27f6 X} : f \u226b \u03b1.inv = g \u2194 f = g \u226b \u03b1.hom := \u27e8fun H => by simp [H.symm], fun H => by simp [H]\u27e9\n```\n\n## Edit instruction\nEdit `comp_inv_eq` so it still compiles and the proof is simplified where possible. Return the full updated `comp_inv_eq` block.\n[/INST]", "sample_id": "D-Mathlib.CategoryTheory.Iso.comp_inv_eq", "source": {"declaration": "Mathlib.CategoryTheory.Iso.comp_inv_eq", "file": "Mathlib/CategoryTheory/Iso.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.CategoryTheory.Iso", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Iso.lean#L197", "span": "L197-L199"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"trace_states": [{"state": "theorem starProjection_orthogonalComplement_singleton_eq_zero (v : E) :\n (\ud835\udd5c \u2219 v)\u15ee.starProjection v = 0", "tactic": "rw [starProjection_apply, coe_eq_zero]"}, {"state": "", "tactic": "exact orthogonalProjection_orthogonalComplement_singleton_eq_zero v /-- If the orthogonal projection to `K` is well-defined, then a vector splits as the sum of its orthogonal projections onto a complete submodule `K` and onto the orthogonal complement of `K`. -/"}], "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1186, "declarations_count": 126, "diagnostics_count": 0, "duplicate_fingerprint": "78f27f8f6a65bf44", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 317, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "tiny", "line_count": 12, "natural_language_chars": 1186, "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.Analysis.InnerProductSpace.Projection.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.Analysis.InnerProductSpace.Projection.Basic.starProjection_orthogonalComplement_singleton_eq_zero`:\nState 0: \u22a2 theorem starProjection_orthogonalComplement_singleton_eq_zero (v : E) :\n (\ud835\udd5c \u2219 v)\u15ee.starProjection v = 0\nTactic: rw [starProjection_apply, coe_eq_zero]\nState 1: \u22a2 \nTactic: exact orthogonalProjection_orthogonalComplement_singleton_eq_zero v /-- If the orthogonal projection to `K` is well-defined, then a vector splits as the sum of its orthogonal projections onto a complete submodule `K` and onto the orthogonal complement of `K`. -/\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.Analysis.InnerProductSpace.Projection.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.Analysis.InnerProductSpace.Projection.Basic.starProjection_orthogonalComplement_singleton_eq_zero`:\nState 0: \u22a2 theorem starProjection_orthogonalComplement_singleton_eq_zero (v : E) :\n (\ud835\udd5c \u2219 v)\u15ee.starProjection v = 0\nTactic: rw [starProjection_apply, coe_eq_zero]\nState 1: \u22a2 \nTactic: exact orthogonalProjection_orthogonalComplement_singleton_eq_zero v /-- If the orthogonal projection to `K` is well-defined, then a vector splits as the sum of its orthogonal projections onto a complete submodule `K` and onto the orthogonal complement of `K`. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.Analysis.InnerProductSpace.Projection.Basic.starProjection_orthogonalComplement_singleton_eq_zero", "source": {"declaration": "Mathlib.Analysis.InnerProductSpace.Projection.Basic.starProjection_orthogonalComplement_singleton_eq_zero", "file": "Mathlib/Analysis/InnerProductSpace/Projection/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Analysis.InnerProductSpace.Projection.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/InnerProductSpace/Projection/Basic.lean#L518", "span": "L518-L524"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.RingTheory.Ideal.Over.comap_eq_of_scalar_tower_quotient (L52-L62)\ntheorem comap_eq_of_scalar_tower_quotient [Algebra R S] [Algebra (R \u29f8 p) (S \u29f8 P)]\n [IsScalarTower R (R \u29f8 p) (S \u29f8 P)] (h : Function.Injective (algebraMap (R \u29f8 p) (S \u29f8 P))) :\n comap (algebraMap R S) P = p := by\next x\n rw [mem_comap, \u2190 Quotient.eq_zero_iff_mem, \u2190 Quotient.eq_zero_iff_mem, Quotient.mk_algebraMap,\n IsScalarTower.algebraMap_apply R (R \u29f8 p) (S \u29f8 P), Quotient.algebraMap_eq]\n exact map_eq_zero_iff _ h\n\nvariable [Algebra R S]\n\n/-- `R / p` has a canonical map to `S / pS`. -/", "-- Mathlib.RingTheory.Ideal.Over.Quotient (L63-L65)\ninstance Quotient.algebraQuotientMapQuotient : Algebra (R \u29f8 p) (S \u29f8 map (algebraMap R S) p) :=\nIdeal.Quotient.algebraQuotientOfLEComap le_comap_map", "-- Mathlib.RingTheory.Ideal.Over.Quotient (L67-L72)\ntheorem Quotient.algebraMap_quotient_map_quotient (x : R) :\n letI f := algebraMap R S\nalgebraMap (R \u29f8 p) (S \u29f8 map f p) (Ideal.Quotient.mk p x) =\n Ideal.Quotient.mk (map f p) (f x) :=\n rfl", "-- Mathlib.RingTheory.Ideal.Over.Quotient (L74-L78)\ntheorem Quotient.mk_smul_mk_quotient_map_quotient (x : R) (y : S) :\n letI f := algebraMap R S\nQuotient.mk p x \u2022 Quotient.mk (map f p) y = Quotient.mk (map f p) (f x * y) :=\n Algebra.smul_def _ _", "-- Mathlib.RingTheory.Ideal.Over.Quotient (L79-L95)\ninstance Quotient.tower_quotient_map_quotient :\n IsScalarTower R (R \u29f8 p) (S \u29f8 map (algebraMap R S) p) :=\nIsScalarTower.of_algebraMap_eq fun x => by\n rw [Quotient.algebraMap_eq, Quotient.algebraMap_quotient_map_quotient,\n Quotient.mk_algebraMap]\n\nend CommRing\n\nsection ideal_liesOver\n\nsection Semiring\n\nvariable (A : Type*) [CommSemiring A] {B C : Type*} [Semiring B] [Semiring C] [Algebra A B]\n [Algebra A C] (P : Ideal B) {Q : Ideal C} (p : Ideal A)\n {G : Type*} [Group G] [MulSemiringAction G B] [SMulCommClass G A B] (g : G)\n\n/-- The ideal obtained by pulling back the ideal `P` from `B` to `A`. -/", "-- Mathlib.RingTheory.Ideal.Over.under (L96-L97)\nabbrev under : Ideal A := Ideal.comap (algebraMap A B) P", "-- Mathlib.RingTheory.Ideal.Over.under_def (L98-L99)\ntheorem under_def : P.under A = Ideal.comap (algebraMap A B) P := rfl", "-- Mathlib.RingTheory.Ideal.Over.IsPrime (L100-L102)\ninstance IsPrime.under [hP : P.IsPrime] : (P.under A).IsPrime :=\nhP.comap (algebraMap A B)", "-- Mathlib.RingTheory.Ideal.Over.under_smul (L104-L108)\nlemma under_smul : (g \u2022 P : Ideal B).under A = P.under A := by\next a\n rw [mem_comap, mem_comap, mem_pointwise_smul_iff_inv_smul_mem, smul_algebraMap]\n\nvariable (B) in", "-- Mathlib.RingTheory.Ideal.Over.under_top (L109-L113)\ntheorem under_top : under A (\u22a4 : Ideal B) = \u22a4 := comap_top\nvariable {A}\n\n/-- `P` lies over `p` if `p` is the preimage of `P` by the `algebraMap`. -/", "-- Mathlib.RingTheory.Ideal.Over.over_under (L117-L118)\ninstance over_under : P.LiesOver (P.under A) where over := rfl", "-- Mathlib.RingTheory.Ideal.Over.over_def (L119-L120)\ntheorem over_def [P.LiesOver p] : p = P.under A := LiesOver.over", "-- Mathlib.RingTheory.Ideal.Over.mem_of_liesOver (L121-L125)\ntheorem mem_of_liesOver [P.LiesOver p] (x : A) : x \u2208 p \u2194 algebraMap A B x \u2208 P := by\nrw [P.over_def p]\n rfl\n\nvariable (A B) in", "-- Mathlib.RingTheory.Ideal.Over.top_liesOver_top (L126-L128)\ninstance top_liesOver_top : (\u22a4 : Ideal B).LiesOver (\u22a4 : Ideal A) where\n over := (under_top A B).symm", "-- Mathlib.RingTheory.Ideal.Over.eq_top_iff_of_liesOver (L129-L132)\ntheorem eq_top_iff_of_liesOver [P.LiesOver p] : P = \u22a4 \u2194 p = \u22a4 := by\nrw [P.over_def p]\n exact comap_eq_top_iff.symm", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.IsNoetherianRing (L92-L117)\ntheorem IsNoetherianRing.exists_relSeries_isQuotientEquivQuotientPrime :\n \u2203 s : RelSeries {(N\u2081, N\u2082) | Submodule.IsQuotientEquivQuotientPrime (A := A) (M := M) N\u2081 N\u2082},\ns.head = \u22a5 \u2227 s.last = \u22a4 := by\n refine WellFoundedGT.induction_top \u27e8\u22a5, .singleton _ \u22a5, rfl, rfl\u27e9 ?_\n rintro N hN \u27e8s, hs\u2081, hs\u2082\u27e9\n have := Submodule.Quotient.nontrivial_iff.mpr hN\n obtain \u27e8p, hp\u27e9 := associatedPrimes.nonempty A (M \u29f8 N)\n rw [AssociatedPrimes.mem_iff, isAssociatedPrime_iff] at hp\n obtain \u27e8hp, x, rfl\u27e9 := hp\n obtain \u27e8x, rfl\u27e9 := Submodule.mkQ_surjective _ x\n have hxN : x \u2209 N := fun h \u21a6 hp.ne_top (by rw [show N.mkQ x = 0 by simpa]; simp)\n have := Submodule.isQuotientEquivQuotientPrime_iff.mpr \u27e8x, hp, rfl\u27e9\n refine \u27e8_, by simpa [hs\u2082], s.snoc _ (hs\u2082 \u25b8 this), by simpa, rfl\u27e9\n\n/-- If a property on finitely generated modules over a Noetherian ring satisfies that:\n\n- it holds for zero module (it's formalized as it holds for any module which is subsingleton),\n- it holds for `A \u29f8 p` for every prime ideal `p` of `A` (to avoid universe problem,\n it's formalized as it holds for any module isomorphic to `A \u29f8 p`),\n- it is stable by short exact sequences,\n\nthen the property holds for every finitely generated modules.\n\nNOTE: This should be the induction principle for `M`, but due to the bug\nhttps://github.com/leanprover/lean4/issues/4246\ncurrently it is induction for `Module.Finite A M`. -/", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.biUnion_associatedPrimes_eq_zero_divisors (L229-L239)\ntheorem biUnion_associatedPrimes_eq_zero_divisors [IsNoetherianRing R] :\n \u22c3 p \u2208 associatedPrimes R M, p = { r : R | \u2203 x : M, x \u2260 0 \u2227 r \u2022 x = 0 } := by\nsimp only [AssociatedPrimes.mem_iff, isAssociatedPrime_iff]\n refine subset_antisymm (Set.iUnion\u2082_subset ?_) ?_\n \u00b7 rintro _ \u27e8h, x, \u27e8\u27e9\u27e9 r h'\n exact \u27e8x, by simpa using h.ne_top, by simpa using h'\u27e9\n \u00b7 intro r \u27e8x, h, h'\u27e9\n obtain \u27e8P, hP, hx\u27e9 := exists_le_isAssociatedPrime_of_isNoetherianRing R x h\n rw [isAssociatedPrime_iff] at hP\n exact Set.mem_iUnion\u2082_of_mem hP (hx (by rwa [mem_colon_singleton]))", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.prod (L206-L211)\ntheorem prod : associatedPrimes R (M \u00d7 M') = associatedPrimes R M \u222a associatedPrimes R M' :=\n(subset_union_of_exact LinearMap.inl_injective .inl_snd).antisymm (Set.union_subset_iff.2\n \u27e8subset_of_injective LinearMap.inl_injective, subset_of_injective LinearMap.inr_injective\u27e9)\n\nend associatedPrimes", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.associatedPrimes (L158-L169)\ntheorem associatedPrimes.finite : (associatedPrimes A M).Finite := by\ninduction \u2039Module.Finite A M\u203a using\n IsNoetherianRing.induction_on_isQuotientEquivQuotientPrime A with\n | subsingleton N => simp [associatedPrimes.eq_empty_of_subsingleton]\n | quotient N p f =>\n have := associatedPrimes.eq_singleton_of_isPrimary p.2.isPrimary\n simp [LinearEquiv.AssociatedPrimes.eq f, this]\n | exact N\u2081 N\u2082 N\u2083 f g hf _ hfg h\u2081 h\u2083 =>\n exact (h\u2081.union h\u2083).subset (associatedPrimes.subset_union_of_exact hf hfg)\n\n/-- Every maximal ideal of a commutative Noetherian total ring of fractions `A` is\nan associated prime of the `A`-module `A`. -/", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.subset_union_of_exact (L171-L204)\ntheorem subset_union_of_exact (hf : Function.Injective f) (hfg : Function.Exact f g) :\n associatedPrimes R M' \u2286 associatedPrimes R M \u222a associatedPrimes R M'' := by\nrintro p \u27e8_, x, hx\u27e9\n by_cases! h : \u2203 a \u2208 p.primeCompl, \u2203 y : M, \u2203 k, f y = a ^ k \u2022 x\n \u00b7 obtain \u27e8a, ha, y, k, h\u27e9 := h\n left\n refine \u27e8\u2039_\u203a, y, le_antisymm (fun b hb \u21a6 ?_) (fun b \u27e8n, hb\u27e9 \u21a6 ?_)\u27e9\n \u00b7 rw [hx] at hb\n obtain \u27e8n, hb\u27e9 := hb\n use n\n rw [mem_colon_singleton, mem_bot] at hb \u22a2\n apply_fun _ using hf\n rw [map_smul, h, smul_comm, hb, smul_zero, map_zero]\n \u00b7 rw [mem_colon_singleton, mem_bot] at hb\n apply_fun f at hb\n rw [map_smul, map_zero, h, \u2190 mul_smul, \u2190 mem_bot R, \u2190 mem_colon_singleton] at hb\n replace hb := hx.ge (Ideal.le_radical hb)\n contrapose hb\n exact p.primeCompl.mul_mem (p.primeCompl.pow_mem hb n) (p.primeCompl.pow_mem ha k)\n \u00b7 right\n refine \u27e8\u2039_\u203a, g x, le_antisymm (fun b hb \u21a6 ?_) (fun b \u27e8n, hb\u27e9 \u21a6 ?_)\u27e9\n \u00b7 rw [hx] at hb\n refine Ideal.radical_mono (fun b hb \u21a6 ?_) hb\n rw [mem_colon_singleton, mem_bot] at hb \u22a2\n rw [\u2190 map_smul, hb, map_zero]\n \u00b7 rw [mem_colon_singleton, mem_bot, \u2190 map_smul, \u2190 LinearMap.mem_ker,\n hfg.linearMap_ker_eq] at hb\n obtain \u27e8y, hy\u27e9 := hb\n by_contra H\n exact h b H y n hy\n\nvariable (R M M') in\n/-- The set of associated primes of the product of two modules is equal to\nthe union of those of the two modules. -/", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.mem_associatedPrimes_atPrime_of_mem_associatedPrimes (L70-L77)\nlemma mem_associatedPrimes_atPrime_of_mem_associatedPrimes\n {p : Ideal R} [p.IsPrime] (ass : p \u2208 associatedPrimes R M) :\n maximalIdeal (Localization.AtPrime p) \u2208\n associatedPrimes (Localization.AtPrime p) (LocalizedModule.AtPrime p M) := by\napply mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule\n p.primeCompl (LocalizedModule.mkLinearMap p.primeCompl M)\n simpa [Localization.AtPrime.comap_maximalIdeal] using ass", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.Ideal (L170-L179)\ntheorem Ideal.IsMaximal.mem_associatedPrimes_of_isFractionRing [IsFractionRing A A]\n (I : Ideal A) [hI : I.IsMaximal] : I \u2208 associatedPrimes A A :=\nhave fin := associatedPrimes.finite A A\n have \u27e8P, hP\u27e9 := (I.subset_union_prime_finite fin (f := id) 0 0 fun _ h _ _ \u21a6 h.isPrime).1 <| by\n simp_rw [id, biUnion_associatedPrimes_eq_compl_nonZeroDivisors]\n exact fun x hx h \u21a6 hI.ne_top <| I.eq_top_of_isUnit_mem hx\n (IsFractionRing.self_iff_nonZeroDivisors_le_isUnit.mp \u2039_\u203a h)\n hI.eq_of_le hP.1.isPrime.ne_top hP.2 \u25b8 hP.1\n\n/-- A commutative Noetherian total ring of fractions is semilocal. -/", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.associatedPrimes (L103-L107)\ndef associatedPrimes : Set (Ideal R) :=\n{ I | IsAssociatedPrime I M }\n\nvariable {I J M} {M' : Type*} [AddCommMonoid M'] [Module R M'] (f : M \u2192\u2097[R] M')", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.minimalPrimes_annihilator_subset_associatedPrimes (L131-L150)\nlemma minimalPrimes_annihilator_subset_associatedPrimes [IsNoetherianRing R] [Module.Finite R M] :\n (Module.annihilator R M).minimalPrimes \u2286 associatedPrimes R M := by\nintro p hp\n have prime := hp.1.1\n let R\u209a := Localization.AtPrime p\n have : Nontrivial (LocalizedModule p.primeCompl M) := by\n simpa [\u2190 Module.mem_support_iff (p := \u27e8p, prime\u27e9), Module.support_eq_zeroLocus] using hp.1.2\n rcases associatedPrimes.nonempty R\u209a (LocalizedModule p.primeCompl M) with \u27e8q, hq\u27e9\n have q_prime : q.IsPrime := IsAssociatedPrime.isPrime hq\n simp only [\u2190 preimage_comap_associatedPrimes_eq_associatedPrimes_of_isLocalizedModule p.primeCompl\n R\u209a (LocalizedModule.mkLinearMap p.primeCompl M), Set.mem_preimage] at hq\n have ann_le : Module.annihilator R M \u2264 Ideal.comap (algebraMap R R\u209a) q :=\n le_of_eq_of_le Submodule.annihilator_top.symm (IsAssociatedPrime.annihilator_le hq)\n have le : Ideal.comap (algebraMap R R\u209a) q \u2264 p := by\n have := (IsLocalization.disjoint_comap_iff p.primeCompl R\u209a q).mpr q_prime.ne_top\n simpa only [Ideal.primeCompl, Submonoid.coe_set_mk, Subsemigroup.coe_set_mk,\n Set.disjoint_compl_left_iff_subset] using this\n simpa [Minimal.eq_of_le hp.out \u27e8IsAssociatedPrime.isPrime hq, ann_le\u27e9 le] using hq\n\nend Module.associatedPrimes", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.comap_mem_associatedPrimes_of_mem_associatedPrimes_of_isLocalizedModule_of_fg (L84-L120)\nlemma comap_mem_associatedPrimes_of_mem_associatedPrimes_of_isLocalizedModule_of_fg (p : Ideal R')\n (ass : p \u2208 associatedPrimes R' M') (fg : (p.comap (algebraMap R R')).FG) :\n p.comap (algebraMap R R') \u2208 associatedPrimes R M := by\nrcases ass with \u27e8hp, x, hx\u27e9\n rcases fg with \u27e8T, hT\u27e9\n rcases IsLocalizedModule.mk'_surjective S f x with \u27e8\u27e8m, s\u27e9, rfl\u27e9\n simp only [Function.uncurry_apply_pair] at hx\n have mem (a : T) : algebraMap R R' a \u2208 p := by\n simpa [\u2190 Ideal.mem_comap, \u2190 hT] using Ideal.subset_span a.2\n simp only [hx, Ideal.mem_radical_iff, mem_bot, mem_colon_singleton, \u2190 map_pow, algebraMap_smul,\n \u2190 IsLocalizedModule.mk'_smul, IsLocalizedModule.mk'_eq_zero' f] at mem\n choose e g hg using mem\n refine \u27e8.under R p, (\u220f a, g a).1 \u2022 m, le_antisymm ?_ fun r hr \u21a6 ?_\u27e9\n \u00b7 rw [\u2190 hT, Ideal.span_le]\n intro a ha\n simp only [SetLike.mem_coe, Ideal.mem_radical_iff, mem_bot, mem_colon_singleton]\n obtain \u27e8u, hu\u27e9 : g \u27e8a, ha\u27e9 \u2223 (\u220f a, g a) := by\n apply Finset.dvd_prod_of_mem g (Finset.mem_univ \u27e8a, ha\u27e9)\n use e \u27e8a, ha\u27e9\n rw [hu, Submonoid.coe_mul, smul_smul, \u2190 mul_assoc, mul_comm, \u2190 smul_smul, mul_comm, \u2190 smul_smul]\n exact smul_eq_zero_of_right u.1 (hg \u27e8a, ha\u27e9)\n \u00b7 simp only [Ideal.mem_radical_iff, mem_bot, mem_colon_singleton, smul_smul] at hr\n obtain \u27e8k, hk\u27e9 := hr\n have mem : r ^ k * (\u220f a, g a).1 \u2208 Ideal.comap (algebraMap R R') p := by\n rw [hx]\n use 1\n simp_rw [pow_one, mem_colon_singleton, algebraMap_smul, \u2190 IsLocalizedModule.mk'_smul,\n hk, IsLocalizedModule.mk'_zero, mem_bot]\n apply hp.mem_of_pow_mem k\n rw [\u2190 map_pow]\n exact ((hp.under R).mul_mem_iff_mem_or_mem.mp mem).resolve_right\n (Set.disjoint_left.mp ((IsLocalization.disjoint_comap_iff S R' p).mpr hp.1) (\u220f a, g a).2)\n\nvariable (R')\n\ninclude S f in\nopen Set in", "-- Mathlib.RingTheory.Ideal.Basic.pi (L50-L55)\ndef pi : Ideal (\u03a0 i, R i) where\n carrier := { r | \u2200 i, r i \u2208 I i }\nzero_mem' i := (I i).zero_mem\n add_mem' ha hb i := (I i).add_mem (ha i) (hb i)\n smul_mem' a _b hb i := (I i).mul_mem_left (a i) (hb i)", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.subset_of_injective (L165-L169)\ntheorem subset_of_injective (hf : Function.Injective f) :\n associatedPrimes R M \u2286 associatedPrimes R M' := fun _I h => h.map_of_injective f hf\n/-- If `0 \u2192 M \u2192 M' \u2192 M''` is an exact sequence, then the set of associated primes of `M'` is\ncontained in the union of those of `M` and `M''`. -/", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.biUnion_associatedPrimes_eq_compl_nonZeroDivisors (L240-L246)\ntheorem biUnion_associatedPrimes_eq_compl_nonZeroDivisors [IsNoetherianRing R] :\n \u22c3 p \u2208 associatedPrimes R R, p = (nonZeroDivisors R : Set R)\u1d9c :=\n(biUnion_associatedPrimes_eq_zero_divisors R R).trans <| by\n ext; simp [\u2190 nonZeroDivisorsLeft_eq_nonZeroDivisors, and_comm]\n\nvariable {R M}", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.not_isAssociatedPrime_of_subsingleton (L133-L138)\ntheorem not_isAssociatedPrime_of_subsingleton [Subsingleton M] : \u00acIsAssociatedPrime I M := by\nrintro \u27e8hI, x, hx\u27e9\n apply hI.ne_top\n simp [hx, Subsingleton.elim x 0]\n\nvariable (R) in", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.IsAssociatedPrime (L98-L102)\ndef IsAssociatedPrime : Prop :=\n(\u22a5 : Submodule R M).IsAssociatedPrime I\n\nvariable (R) in\n/-- The set of associated primes of a module. -/", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.isAssociatedPrime_iff_exists_injective_linearMap (L257-L267)\ntheorem isAssociatedPrime_iff_exists_injective_linearMap [IsNoetherianRing R] :\n IsAssociatedPrime I M \u2194 I.IsPrime \u2227 \u2203 (f : R \u29f8 I \u2192\u2097[R] M), Function.Injective f := by\nrw [isAssociatedPrime_iff, and_congr_right_iff]\n refine fun _ \u21a6 \u27e8fun \u27e8x, h\u27e9 \u21a6 ?_, fun \u27e8f, h\u27e9 \u21a6 \u27e8(f \u2218\u2097 mkQ I) 1, ?_\u27e9\u27e9\n \u00b7 replace h : I = ker (toSpanSingleton R M x) := by simp [h, SetLike.ext_iff]\n exact \u27e8liftQ _ _ h.le, ker_eq_bot.mp (ker_liftQ_eq_bot' _ _ h)\u27e9\n \u00b7 conv_lhs => rw [\u2190 I.ker_mkQ, \u2190 ker_comp_of_ker_eq_bot (mkQ I) (ker_eq_bot_of_injective h)]\n simp [SetLike.ext_iff, \u2190 Ideal.Quotient.algebraMap_eq, Algebra.algebraMap_eq_smul_one]\n\nvariable {I J M}", "-- Mathlib.RingTheory.Ideal.Basic.mem_pi (L56-L58)\ntheorem mem_pi (r : \u03a0 i, R i) : r \u2208 pi I \u2194 \u2200 i, r i \u2208 I i :=\nIff.rfl", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.exists_le_isAssociatedPrime_of_isNoetherianRing (L139-L163)\ntheorem exists_le_isAssociatedPrime_of_isNoetherianRing [H : IsNoetherianRing R] (x : M)\n (hx : x \u2260 0) : \u2203 P : Ideal R, IsAssociatedPrime P M \u2227 (\u22a5 : Submodule R M).colon {x} \u2264 P := by\nsimp only [isAssociatedPrime_iff]\n obtain \u27e8P, \u27e8l, h\u2081, y, rfl\u27e9, h\u2083\u27e9 :=\n set_has_maximal_iff_noetherian.mpr H\n { P | (\u22a5 : Submodule R M).colon {x} \u2264 P \u2227 P \u2260 \u22a4 \u2227 \u2203 y : M, P = (\u22a5 : Submodule R M).colon {y} }\n \u27e8_, rfl.le, by simpa, x, rfl\u27e9\n refine \u27e8_, \u27e8\u27e8h\u2081, ?_\u27e9, y, rfl\u27e9, l\u27e9\n intro a b hab\n rw [or_iff_not_imp_left]\n intro ha\n rw [mem_colon_singleton] at ha hab\n have H\u2081 : (\u22a5 : Submodule R M).colon {y} \u2264 (\u22a5 : Submodule R M).colon {a \u2022 y} := by\n intro c hc\n rw [mem_colon_singleton, mem_bot] at hc \u22a2\n rw [smul_comm, hc, smul_zero]\n rwa [H\u2081.eq_of_not_lt (h\u2083 _ \u27e8l.trans H\u2081, by simpa, _, rfl\u27e9),\n mem_colon_singleton, smul_comm, smul_smul]\n\nnamespace associatedPrimes\n\nvariable {f} {M'' : Type*} [AddCommMonoid M''] [Module R M''] {g : M' \u2192\u2097[R] M''}\n\n/-- If `M \u2192 M'` is injective, then the set of associated primes of `M` is\ncontained in that of `M'`. -/", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.AssociatedPrimes (L108-L109)\ntheorem AssociatedPrimes.mem_iff : I \u2208 associatedPrimes R M \u2194 IsAssociatedPrime I M := Iff.rfl", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.preimage_comap_associatedPrimes_eq_associatedPrimes_of_isLocalizedModule (L122-L130)\nlemma preimage_comap_associatedPrimes_eq_associatedPrimes_of_isLocalizedModule\n [IsNoetherianRing R] :\n (Ideal.comap (algebraMap R R')) \u207b\u00b9' (associatedPrimes R M) = associatedPrimes R' M' := by\next p\n exact \u27e8mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule S f p,\n fun h \u21a6 comap_mem_associatedPrimes_of_mem_associatedPrimes_of_isLocalizedModule_of_fg S f p h\n ((isNoetherianRing_iff_ideal_fg R).mp \u2039_\u203a _)\u27e9\n\nvariable (R M) in", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule (L40-L69)\nlemma mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule\n (p : Ideal R') (ass : p.comap (algebraMap R R') \u2208 associatedPrimes R M) :\n p \u2208 associatedPrimes R' M' := by\nrcases ass with \u27e8hp, x, hx\u27e9\n constructor\n \u00b7 refine (IsLocalization.isPrime_iff_isPrime_disjoint S _ _).mpr\n \u27e8hp, (IsLocalization.disjoint_comap_iff S R' p).mpr ?_\u27e9\n by_contra eqtop\n simp [eqtop, Ideal.comap_top, Ideal.isPrime_iff] at hp\n \u00b7 use f x\n ext t\n rcases IsLocalization.exists_mk'_eq S t with \u27e8r, s, hrs\u27e9\n simp_rw [\u2190 hrs, Ideal.mem_radical_iff, mem_colon_singleton, \u2190 IsLocalizedModule.mk'_one S f,\n \u2190 IsLocalization.mk'_pow, IsLocalizedModule.mk'_smul_mk', mul_one, mem_bot,\n IsLocalizedModule.mk'_eq_zero']\n refine \u27e8fun h \u21a6 exists_comm.mp \u27e81, ?_\u27e9, fun \u27e8n, t, ht\u27e9 \u21a6 ?_\u27e9\n \u00b7 simp only [\u2190 mem_colon_singleton, one_smul, \u2190 mem_bot R, \u2190 hx, \u2190 Ideal.mem_radical_iff]\n exact hSR'.mk'_mem_iff.mp h\n \u00b7 have : hSR'.mk' R' r s = hSR'.mk' R' (t.1 * r) 1 * hSR'.mk' R' 1 (t * s) := by\n rw [\u2190 hSR'.mk'_mul, mul_one, one_mul, \u2190 sub_eq_zero, \u2190 hSR'.mk'_sub, Submonoid.coe_mul]\n simp [\u2190 mul_assoc, mul_comm r t.1, IsLocalization.mk'_zero]\n rw [this]\n apply Ideal.IsTwoSided.mul_mem_of_left\n rw [IsLocalization.mk'_one, \u2190 Ideal.mem_comap, hx]\n rcases eq_zero_or_pos n with rfl | hn\n \u00b7 exact Ideal.IsTwoSided.mul_mem_of_left _ \u27e81, by simpa using ht\u27e9\n \u00b7 use n\n rw [mem_colon_singleton, mul_pow, mul_smul, \u2190 mem_colon_singleton]\n exact Ideal.pow_mem_of_mem _ (by simpa using ht) n hn", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.Submodule (L51-L55)\ndef Submodule.IsQuotientEquivQuotientPrime (N\u2081 N\u2082 : Submodule A M) :=\nN\u2081 \u2264 N\u2082 \u2227 \u2203 (p : PrimeSpectrum A), Nonempty ((\u21a5N\u2082 \u29f8 N\u2081.submoduleOf N\u2082) \u2243\u2097[A] A \u29f8 p.1)\n\nset_option backward.isDefEq.respectTransparency false in\nopen LinearMap in", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.LinearEquiv (L128-L132)\ntheorem LinearEquiv.isAssociatedPrime_iff (l : M \u2243\u2097[R] M') :\n IsAssociatedPrime I M \u2194 IsAssociatedPrime I M' :=\n\u27e8fun h => h.map_of_injective l l.injective,\n fun h => h.map_of_injective l.symm l.symm.injective\u27e9", "-- Mathlib.RingTheory.Ideal.Basic.single_mem_pi (L67-L72)\ntheorem single_mem_pi [DecidableEq \u03b9] {i : \u03b9} {r : R i} (hr : r \u2208 I i) : Pi.single i r \u2208 pi I := by\nintro j\n obtain rfl | ne := eq_or_ne i j\n \u00b7 simpa\n \u00b7 simp [ne]", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.isAssociatedPrime_iff (L117-L120)\ntheorem isAssociatedPrime_iff [IsNoetherianRing R] :\n IsAssociatedPrime I M \u2194 I.IsPrime \u2227 \u2203 x : M, I = colon \u22a5 {x} :=\n(\u22a5 : Submodule R M).isAssociatedPrime_iff"], "statement": "def algEquivOfEqComap (h : P = Q.comap \u03c3) : (B \u29f8 P) \u2243\u2090[A \u29f8 p] (C \u29f8 Q)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 21763, "declarations_count": 2275, "diagnostics_count": 0, "duplicate_fingerprint": "377fab6e9e38af2f", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 8251, "lean_code_chars": 20265, "lean_code_ratio": 0.9312, "length_bucket": "long", "line_count": 555, "natural_language_chars": 1498, "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.RingTheory.Ideal.Over).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef algEquivOfEqComap (h : P = Q.comap \u03c3) : (B \u29f8 P) \u2243\u2090[A \u29f8 p] (C \u29f8 Q)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.RingTheory.Ideal.Over.comap_eq_of_scalar_tower_quotient (L52-L62)\ntheorem comap_eq_of_scalar_tower_quotient [Algebra R S] [Algebra (R \u29f8 p) (S \u29f8 P)]\n [IsScalarTower R (R \u29f8 p) (S \u29f8 P)] (h : Function.Injective (algebraMap (R \u29f8 p) (S \u29f8 P))) :\n comap (algebraMap R S) P = p := by\next x\n rw [mem_comap, \u2190 Quotient.eq_zero_iff_mem, \u2190 Quotient.eq_zero_iff_mem, Quotient.mk_algebraMap,\n IsScalarTower.algebraMap_apply R (R \u29f8 p) (S \u29f8 P), Quotient.algebraMap_eq]\n exact map_eq_zero_iff _ h\n\nvariable [Algebra R S]\n\n/-- `R / p` has a canonical map to `S / pS`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.RingTheory.Ideal.Over.Quotient (L63-L65)\ninstance Quotient.algebraQuotientMapQuotient : Algebra (R \u29f8 p) (S \u29f8 map (algebraMap R S) p) :=\nIdeal.Quotient.algebraQuotientOfLEComap le_comap_map\n```\n\n-- snippet 3\n```lean\n-- Mathlib.RingTheory.Ideal.Over.Quotient (L67-L72)\ntheorem Quotient.algebraMap_quotient_map_quotient (x : R) :\n letI f := algebraMap R S\nalgebraMap (R \u29f8 p) (S \u29f8 map f p) (Ideal.Quotient.mk p x) =\n Ideal.Quotient.mk (map f p) (f x) :=\n rfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.RingTheory.Ideal.Over.Quotient (L74-L78)\ntheorem Quotient.mk_smul_mk_quotient_map_quotient (x : R) (y : S) :\n letI f := algebraMap R S\nQuotient.mk p x \u2022 Quotient.mk (map f p) y = Quotient.mk (map f p) (f x * y) :=\n Algebra.smul_def _ _\n```\n\n-- snippet 5\n```lean\n-- Mathlib.RingTheory.Ideal.Over.Quotient (L79-L95)\ninstance Quotient.tower_quotient_map_quotient :\n IsScalarTower R (R \u29f8 p) (S \u29f8 map (algebraMap R S) p) :=\nIsScalarTower.of_algebraMap_eq fun x => by\n rw [Quotient.algebraMap_eq, Quotient.algebraMap_quotient_map_quotient,\n Quotient.mk_algebraMap]\n\nend CommRing\n\nsection ideal_liesOver\n\nsection Semiring\n\nvariable (A : Type*) [CommSemiring A] {B C : Type*} [Semiring B] [Semiring C] [Algebra A B]\n [Algebra A C] (P : Ideal B) {Q : Ideal C} (p : Ideal A)\n {G : Type*} [Group G] [MulSemiringAction G B] [SMulCommClass G A B] (g : G)\n\n/-- The ideal obtained by pulling back the ideal `P` from `B` to `A`. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.RingTheory.Ideal.Over.under (L96-L97)\nabbrev under : Ideal A := Ideal.comap (algebraMap A B) P\n```\n\n-- snippet 7\n```lean\n-- Mathlib.RingTheory.Ideal.Over.under_def (L98-L99)\ntheorem under_def : P.under A = Ideal.comap (algebraMap A B) P := rfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.RingTheory.Ideal.Over.IsPrime (L100-L102)\ninstance IsPrime.under [hP : P.IsPrime] : (P.under A).IsPrime :=\nhP.comap (algebraMap A B)\n```\n\n-- snippet 9\n```lean\n-- Mathlib.RingTheory.Ideal.Over.under_smul (L104-L108)\nlemma under_smul : (g \u2022 P : Ideal B).under A = P.under A := by\next a\n rw [mem_comap, mem_comap, mem_pointwise_smul_iff_inv_smul_mem, smul_algebraMap]\n\nvariable (B) in\n```\n\n-- snippet 10\n```lean\n-- Mathlib.RingTheory.Ideal.Over.under_top (L109-L113)\ntheorem under_top : under A (\u22a4 : Ideal B) = \u22a4 := comap_top\nvariable {A}\n\n/-- `P` lies over `p` if `p` is the preimage of `P` by the `algebraMap`. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.RingTheory.Ideal.Over.over_under (L117-L118)\ninstance over_under : P.LiesOver (P.under A) where over := rfl\n```\n\n-- snippet 12\n```lean\n-- Mathlib.RingTheory.Ideal.Over.over_def (L119-L120)\ntheorem over_def [P.LiesOver p] : p = P.under A := LiesOver.over\n```\n\n-- snippet 13\n```lean\n-- Mathlib.RingTheory.Ideal.Over.mem_of_liesOver (L121-L125)\ntheorem mem_of_liesOver [P.LiesOver p] (x : A) : x \u2208 p \u2194 algebraMap A B x \u2208 P := by\nrw [P.over_def p]\n rfl\n\nvariable (A B) in\n```\n\n-- snippet 14\n```lean\n-- Mathlib.RingTheory.Ideal.Over.top_liesOver_top (L126-L128)\ninstance top_liesOver_top : (\u22a4 : Ideal B).LiesOver (\u22a4 : Ideal A) where\n over := (under_top A B).symm\n```\n\n-- snippet 15\n```lean\n-- Mathlib.RingTheory.Ideal.Over.eq_top_iff_of_liesOver (L129-L132)\ntheorem eq_top_iff_of_liesOver [P.LiesOver p] : P = \u22a4 \u2194 p = \u22a4 := by\nrw [P.over_def p]\n exact comap_eq_top_iff.symm\n```\n\n-- snippet 16\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.IsNoetherianRing (L92-L117)\ntheorem IsNoetherianRing.exists_relSeries_isQuotientEquivQuotientPrime :\n \u2203 s : RelSeries {(N\u2081, N\u2082) | Submodule.IsQuotientEquivQuotientPrime (A := A) (M := M) N\u2081 N\u2082},\ns.head = \u22a5 \u2227 s.last = \u22a4 := by\n refine WellFoundedGT.induction_top \u27e8\u22a5, .singleton _ \u22a5, rfl, rfl\u27e9 ?_\n rintro N hN \u27e8s, hs\u2081, hs\u2082\u27e9\n have := Submodule.Quotient.nontrivial_iff.mpr hN\n obtain \u27e8p, hp\u27e9 := associatedPrimes.nonempty A (M \u29f8 N)\n rw [AssociatedPrimes.mem_iff, isAssociatedPrime_iff] at hp\n obtain \u27e8hp, x, rfl\u27e9 := hp\n obtain \u27e8x, rfl\u27e9 := Submodule.mkQ_surjective _ x\n have hxN : x \u2209 N := fun h \u21a6 hp.ne_top (by rw [show N.mkQ x = 0 by simpa]; simp)\n have := Submodule.isQuotientEquivQuotientPrime_iff.mpr \u27e8x, hp, rfl\u27e9\n refine \u27e8_, by simpa [hs\u2082], s.snoc _ (hs\u2082 \u25b8 this), by simpa, rfl\u27e9\n\n/-- If a property on finitely generated modules over a Noetherian ring satisfies that:\n\n- it holds for zero module (it's formalized as it holds for any module which is subsingleton),\n- it holds for `A \u29f8 p` for every prime ideal `p` of `A` (to avoid universe problem,\n it's formalized as it holds for any module isomorphic to `A \u29f8 p`),\n- it is stable by short exact sequences,\n\nthen the property holds for every finitely generated modules.\n\nNOTE: This should be the induction principle for `M`, but due to the bug\nhttps://github.com/leanprover/lean4/issues/4246\ncurrently it is induction for `Module.Finite A M`. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.biUnion_associatedPrimes_eq_zero_divisors (L229-L239)\ntheorem biUnion_associatedPrimes_eq_zero_divisors [IsNoetherianRing R] :\n \u22c3 p \u2208 associatedPrimes R M, p = { r : R | \u2203 x : M, x \u2260 0 \u2227 r \u2022 x = 0 } := by\nsimp only [AssociatedPrimes.mem_iff, isAssociatedPrime_iff]\n refine subset_antisymm (Set.iUnion\u2082_subset ?_) ?_\n \u00b7 rintro _ \u27e8h, x, \u27e8\u27e9\u27e9 r h'\n exact \u27e8x, by simpa using h.ne_top, by simpa using h'\u27e9\n \u00b7 intro r \u27e8x, h, h'\u27e9\n obtain \u27e8P, hP, hx\u27e9 := exists_le_isAssociatedPrime_of_isNoetherianRing R x h\n rw [isAssociatedPrime_iff] at hP\n exact Set.mem_iUnion\u2082_of_mem hP (hx (by rwa [mem_colon_singleton]))\n```\n\n-- snippet 18\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.prod (L206-L211)\ntheorem prod : associatedPrimes R (M \u00d7 M') = associatedPrimes R M \u222a associatedPrimes R M' :=\n(subset_union_of_exact LinearMap.inl_injective .inl_snd).antisymm (Set.union_subset_iff.2\n \u27e8subset_of_injective LinearMap.inl_injective, subset_of_injective LinearMap.inr_injective\u27e9)\n\nend associatedPrimes\n```\n\n-- snippet 19\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.associatedPrimes (L158-L169)\ntheorem associatedPrimes.finite : (associatedPrimes A M).Finite := by\ninduction \u2039Module.Finite A M\u203a using\n IsNoetherianRing.induction_on_isQuotientEquivQuotientPrime A with\n | subsingleton N => simp [associatedPrimes.eq_empty_of_subsingleton]\n | quotient N p f =>\n have := associatedPrimes.eq_singleton_of_isPrimary p.2.isPrimary\n simp [LinearEquiv.AssociatedPrimes.eq f, this]\n | exact N\u2081 N\u2082 N\u2083 f g hf _ hfg h\u2081 h\u2083 =>\n exact (h\u2081.union h\u2083).subset (associatedPrimes.subset_union_of_exact hf hfg)\n\n/-- Every maximal ideal of a commutative Noetherian total ring of fractions `A` is\nan associated prime of the `A`-module `A`. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.subset_union_of_exact (L171-L204)\ntheorem subset_union_of_exact (hf : Function.Injective f) (hfg : Function.Exact f g) :\n associatedPrimes R M' \u2286 associatedPrimes R M \u222a associatedPrimes R M'' := by\nrintro p \u27e8_, x, hx\u27e9\n by_cases! h : \u2203 a \u2208 p.primeCompl, \u2203 y : M, \u2203 k, f y = a ^ k \u2022 x\n \u00b7 obtain \u27e8a, ha, y, k, h\u27e9 := h\n left\n refine \u27e8\u2039_\u203a, y, le_antisymm (fun b hb \u21a6 ?_) (fun b \u27e8n, hb\u27e9 \u21a6 ?_)\u27e9\n \u00b7 rw [hx] at hb\n obtain \u27e8n, hb\u27e9 := hb\n use n\n rw [mem_colon_singleton, mem_bot] at hb \u22a2\n apply_fun _ using hf\n rw [map_smul, h, smul_comm, hb, smul_zero, map_zero]\n \u00b7 rw [mem_colon_singleton, mem_bot] at hb\n apply_fun f at hb\n rw [map_smul, map_zero, h, \u2190 mul_smul, \u2190 mem_bot R, \u2190 mem_colon_singleton] at hb\n replace hb := hx.ge (Ideal.le_radical hb)\n contrapose hb\n exact p.primeCompl.mul_mem (p.primeCompl.pow_mem hb n) (p.primeCompl.pow_mem ha k)\n \u00b7 right\n refine \u27e8\u2039_\u203a, g x, le_antisymm (fun b hb \u21a6 ?_) (fun b \u27e8n, hb\u27e9 \u21a6 ?_)\u27e9\n \u00b7 rw [hx] at hb\n refine Ideal.radical_mono (fun b hb \u21a6 ?_) hb\n rw [mem_colon_singleton, mem_bot] at hb \u22a2\n rw [\u2190 map_smul, hb, map_zero]\n \u00b7 rw [mem_colon_singleton, mem_bot, \u2190 map_smul, \u2190 LinearMap.mem_ker,\n hfg.linearMap_ker_eq] at hb\n obtain \u27e8y, hy\u27e9 := hb\n by_contra H\n exact h b H y n hy\n\nvariable (R M M') in\n/-- The set of associated primes of the product of two modules is equal to\nthe union of those of the two modules. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.mem_associatedPrimes_atPrime_of_mem_associatedPrimes (L70-L77)\nlemma mem_associatedPrimes_atPrime_of_mem_associatedPrimes\n {p : Ideal R} [p.IsPrime] (ass : p \u2208 associatedPrimes R M) :\n maximalIdeal (Localization.AtPrime p) \u2208\n associatedPrimes (Localization.AtPrime p) (LocalizedModule.AtPrime p M) := by\napply mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule\n p.primeCompl (LocalizedModule.mkLinearMap p.primeCompl M)\n simpa [Localization.AtPrime.comap_maximalIdeal] using ass\n```\n\n-- snippet 22\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.Ideal (L170-L179)\ntheorem Ideal.IsMaximal.mem_associatedPrimes_of_isFractionRing [IsFractionRing A A]\n (I : Ideal A) [hI : I.IsMaximal] : I \u2208 associatedPrimes A A :=\nhave fin := associatedPrimes.finite A A\n have \u27e8P, hP\u27e9 := (I.subset_union_prime_finite fin (f := id) 0 0 fun _ h _ _ \u21a6 h.isPrime).1 <| by\n simp_rw [id, biUnion_associatedPrimes_eq_compl_nonZeroDivisors]\n exact fun x hx h \u21a6 hI.ne_top <| I.eq_top_of_isUnit_mem hx\n (IsFractionRing.self_iff_nonZeroDivisors_le_isUnit.mp \u2039_\u203a h)\n hI.eq_of_le hP.1.isPrime.ne_top hP.2 \u25b8 hP.1\n\n/-- A commutative Noetherian total ring of fractions is semilocal. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.associatedPrimes (L103-L107)\ndef associatedPrimes : Set (Ideal R) :=\n{ I | IsAssociatedPrime I M }\n\nvariable {I J M} {M' : Type*} [AddCommMonoid M'] [Module R M'] (f : M \u2192\u2097[R] M')\n```\n\n-- snippet 24\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.minimalPrimes_annihilator_subset_associatedPrimes (L131-L150)\nlemma minimalPrimes_annihilator_subset_associatedPrimes [IsNoetherianRing R] [Module.Finite R M] :\n (Module.annihilator R M).minimalPrimes \u2286 associatedPrimes R M := by\nintro p hp\n have prime := hp.1.1\n let R\u209a := Localization.AtPrime p\n have : Nontrivial (LocalizedModule p.primeCompl M) := by\n simpa [\u2190 Module.mem_support_iff (p := \u27e8p, prime\u27e9), Module.support_eq_zeroLocus] using hp.1.2\n rcases associatedPrimes.nonempty R\u209a (LocalizedModule p.primeCompl M) with \u27e8q, hq\u27e9\n have q_prime : q.IsPrime := IsAssociatedPrime.isPrime hq\n simp only [\u2190 preimage_comap_associatedPrimes_eq_associatedPrimes_of_isLocalizedModule p.primeCompl\n R\u209a (LocalizedModule.mkLinearMap p.primeCompl M), Set.mem_preimage] at hq\n have ann_le : Module.annihilator R M \u2264 Ideal.comap (algebraMap R R\u209a) q :=\n le_of_eq_of_le Submodule.annihilator_top.symm (IsAssociatedPrime.annihilator_le hq)\n have le : Ideal.comap (algebraMap R R\u209a) q \u2264 p := by\n have := (IsLocalization.disjoint_comap_iff p.primeCompl R\u209a q).mpr q_prime.ne_top\n simpa only [Ideal.primeCompl, Submonoid.coe_set_mk, Subsemigroup.coe_set_mk,\n Set.disjoint_compl_left_iff_subset] using this\n simpa [Minimal.eq_of_le hp.out \u27e8IsAssociatedPrime.isPrime hq, ann_le\u27e9 le] using hq\n\nend Module.associatedPrimes\n```\n\n-- snippet 25\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.comap_mem_associatedPrimes_of_mem_associatedPrimes_of_isLocalizedModule_of_fg (L84-L120)\nlemma comap_mem_associatedPrimes_of_mem_associatedPrimes_of_isLocalizedModule_of_fg (p : Ideal R')\n (ass : p \u2208 associatedPrimes R' M') (fg : (p.comap (algebraMap R R')).FG) :\n p.comap (algebraMap R R') \u2208 associatedPrimes R M := by\nrcases ass with \u27e8hp, x, hx\u27e9\n rcases fg with \u27e8T, hT\u27e9\n rcases IsLocalizedModule.mk'_surjective S f x with \u27e8\u27e8m, s\u27e9, rfl\u27e9\n simp only [Function.uncurry_apply_pair] at hx\n have mem (a : T) : algebraMap R R' a \u2208 p := by\n simpa [\u2190 Ideal.mem_comap, \u2190 hT] using Ideal.subset_span a.2\n simp only [hx, Ideal.mem_radical_iff, mem_bot, mem_colon_singleton, \u2190 map_pow, algebraMap_smul,\n \u2190 IsLocalizedModule.mk'_smul, IsLocalizedModule.mk'_eq_zero' f] at mem\n choose e g hg using mem\n refine \u27e8.under R p, (\u220f a, g a).1 \u2022 m, le_antisymm ?_ fun r hr \u21a6 ?_\u27e9\n \u00b7 rw [\u2190 hT, Ideal.span_le]\n intro a ha\n simp only [SetLike.mem_coe, Ideal.mem_radical_iff, mem_bot, mem_colon_singleton]\n obtain \u27e8u, hu\u27e9 : g \u27e8a, ha\u27e9 \u2223 (\u220f a, g a) := by\n apply Finset.dvd_prod_of_mem g (Finset.mem_univ \u27e8a, ha\u27e9)\n use e \u27e8a, ha\u27e9\n rw [hu, Submonoid.coe_mul, smul_smul, \u2190 mul_assoc, mul_comm, \u2190 smul_smul, mul_comm, \u2190 smul_smul]\n exact smul_eq_zero_of_right u.1 (hg \u27e8a, ha\u27e9)\n \u00b7 simp only [Ideal.mem_radical_iff, mem_bot, mem_colon_singleton, smul_smul] at hr\n obtain \u27e8k, hk\u27e9 := hr\n have mem : r ^ k * (\u220f a, g a).1 \u2208 Ideal.comap (algebraMap R R') p := by\n rw [hx]\n use 1\n simp_rw [pow_one, mem_colon_singleton, algebraMap_smul, \u2190 IsLocalizedModule.mk'_smul,\n hk, IsLocalizedModule.mk'_zero, mem_bot]\n apply hp.mem_of_pow_mem k\n rw [\u2190 map_pow]\n exact ((hp.under R).mul_mem_iff_mem_or_mem.mp mem).resolve_right\n (Set.disjoint_left.mp ((IsLocalization.disjoint_comap_iff S R' p).mpr hp.1) (\u220f a, g a).2)\n\nvariable (R')\n\ninclude S f in\nopen Set in\n```\n\n-- snippet 26\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.pi (L50-L55)\ndef pi : Ideal (\u03a0 i, R i) where\n carrier := { r | \u2200 i, r i \u2208 I i }\nzero_mem' i := (I i).zero_mem\n add_mem' ha hb i := (I i).add_mem (ha i) (hb i)\n smul_mem' a _b hb i := (I i).mul_mem_left (a i) (hb i)\n```\n\n-- snippet 27\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.subset_of_injective (L165-L169)\ntheorem subset_of_injective (hf : Function.Injective f) :\n associatedPrimes R M \u2286 associatedPrimes R M' := fun _I h => h.map_of_injective f hf\n/-- If `0 \u2192 M \u2192 M' \u2192 M''` is an exact sequence, then the set of associated primes of `M'` is\ncontained in the union of those of `M` and `M''`. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.biUnion_associatedPrimes_eq_compl_nonZeroDivisors (L240-L246)\ntheorem biUnion_associatedPrimes_eq_compl_nonZeroDivisors [IsNoetherianRing R] :\n \u22c3 p \u2208 associatedPrimes R R, p = (nonZeroDivisors R : Set R)\u1d9c :=\n(biUnion_associatedPrimes_eq_zero_divisors R R).trans <| by\n ext; simp [\u2190 nonZeroDivisorsLeft_eq_nonZeroDivisors, and_comm]\n\nvariable {R M}\n```\n\n-- snippet 29\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.not_isAssociatedPrime_of_subsingleton (L133-L138)\ntheorem not_isAssociatedPrime_of_subsingleton [Subsingleton M] : \u00acIsAssociatedPrime I M := by\nrintro \u27e8hI, x, hx\u27e9\n apply hI.ne_top\n simp [hx, Subsingleton.elim x 0]\n\nvariable (R) in\n```\n\n-- snippet 30\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.IsAssociatedPrime (L98-L102)\ndef IsAssociatedPrime : Prop :=\n(\u22a5 : Submodule R M).IsAssociatedPrime I\n\nvariable (R) in\n/-- The set of associated primes of a module. -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.isAssociatedPrime_iff_exists_injective_linearMap (L257-L267)\ntheorem isAssociatedPrime_iff_exists_injective_linearMap [IsNoetherianRing R] :\n IsAssociatedPrime I M \u2194 I.IsPrime \u2227 \u2203 (f : R \u29f8 I \u2192\u2097[R] M), Function.Injective f := by\nrw [isAssociatedPrime_iff, and_congr_right_iff]\n refine fun _ \u21a6 \u27e8fun \u27e8x, h\u27e9 \u21a6 ?_, fun \u27e8f, h\u27e9 \u21a6 \u27e8(f \u2218\u2097 mkQ I) 1, ?_\u27e9\u27e9\n \u00b7 replace h : I = ker (toSpanSingleton R M x) := by simp [h, SetLike.ext_iff]\n exact \u27e8liftQ _ _ h.le, ker_eq_bot.mp (ker_liftQ_eq_bot' _ _ h)\u27e9\n \u00b7 conv_lhs => rw [\u2190 I.ker_mkQ, \u2190 ker_comp_of_ker_eq_bot (mkQ I) (ker_eq_bot_of_injective h)]\n simp [SetLike.ext_iff, \u2190 Ideal.Quotient.algebraMap_eq, Algebra.algebraMap_eq_smul_one]\n\nvariable {I J M}\n```\n\n-- snippet 32\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.mem_pi (L56-L58)\ntheorem mem_pi (r : \u03a0 i, R i) : r \u2208 pi I \u2194 \u2200 i, r i \u2208 I i :=\nIff.rfl\n```\n\n-- snippet 33\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.exists_le_isAssociatedPrime_of_isNoetherianRing (L139-L163)\ntheorem exists_le_isAssociatedPrime_of_isNoetherianRing [H : IsNoetherianRing R] (x : M)\n (hx : x \u2260 0) : \u2203 P : Ideal R, IsAssociatedPrime P M \u2227 (\u22a5 : Submodule R M).colon {x} \u2264 P := by\nsimp only [isAssociatedPrime_iff]\n obtain \u27e8P, \u27e8l, h\u2081, y, rfl\u27e9, h\u2083\u27e9 :=\n set_has_maximal_iff_noetherian.mpr H\n { P | (\u22a5 : Submodule R M).colon {x} \u2264 P \u2227 P \u2260 \u22a4 \u2227 \u2203 y : M, P = (\u22a5 : Submodule R M).colon {y} }\n \u27e8_, rfl.le, by simpa, x, rfl\u27e9\n refine \u27e8_, \u27e8\u27e8h\u2081, ?_\u27e9, y, rfl\u27e9, l\u27e9\n intro a b hab\n rw [or_iff_not_imp_left]\n intro ha\n rw [mem_colon_singleton] at ha hab\n have H\u2081 : (\u22a5 : Submodule R M).colon {y} \u2264 (\u22a5 : Submodule R M).colon {a \u2022 y} := by\n intro c hc\n rw [mem_colon_singleton, mem_bot] at hc \u22a2\n rw [smul_comm, hc, smul_zero]\n rwa [H\u2081.eq_of_not_lt (h\u2083 _ \u27e8l.trans H\u2081, by simpa, _, rfl\u27e9),\n mem_colon_singleton, smul_comm, smul_smul]\n\nnamespace associatedPrimes\n\nvariable {f} {M'' : Type*} [AddCommMonoid M''] [Module R M''] {g : M' \u2192\u2097[R] M''}\n\n/-- If `M \u2192 M'` is injective, then the set of associated primes of `M` is\ncontained in that of `M'`. -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.AssociatedPrimes (L108-L109)\ntheorem AssociatedPrimes.mem_iff : I \u2208 associatedPrimes R M \u2194 IsAssociatedPrime I M := Iff.rfl\n```\n\n-- snippet 35\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.preimage_comap_associatedPrimes_eq_associatedPrimes_of_isLocalizedModule (L122-L130)\nlemma preimage_comap_associatedPrimes_eq_associatedPrimes_of_isLocalizedModule\n [IsNoetherianRing R] :\n (Ideal.comap (algebraMap R R')) \u207b\u00b9' (associatedPrimes R M) = associatedPrimes R' M' := by\next p\n exact \u27e8mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule S f p,\n fun h \u21a6 comap_mem_associatedPrimes_of_mem_associatedPrimes_of_isLocalizedModule_of_fg S f p h\n ((isNoetherianRing_iff_ideal_fg R).mp \u2039_\u203a _)\u27e9\n\nvariable (R M) in\n```\n\n-- snippet 36\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule (L40-L69)\nlemma mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule\n (p : Ideal R') (ass : p.comap (algebraMap R R') \u2208 associatedPrimes R M) :\n p \u2208 associatedPrimes R' M' := by\nrcases ass with \u27e8hp, x, hx\u27e9\n constructor\n \u00b7 refine (IsLocalization.isPrime_iff_isPrime_disjoint S _ _).mpr\n \u27e8hp, (IsLocalization.disjoint_comap_iff S R' p).mpr ?_\u27e9\n by_contra eqtop\n simp [eqtop, Ideal.comap_top, Ideal.isPrime_iff] at hp\n \u00b7 use f x\n ext t\n rcases IsLocalization.exists_mk'_eq S t with \u27e8r, s, hrs\u27e9\n simp_rw [\u2190 hrs, Ideal.mem_radical_iff, mem_colon_singleton, \u2190 IsLocalizedModule.mk'_one S f,\n \u2190 IsLocalization.mk'_pow, IsLocalizedModule.mk'_smul_mk', mul_one, mem_bot,\n IsLocalizedModule.mk'_eq_zero']\n refine \u27e8fun h \u21a6 exists_comm.mp \u27e81, ?_\u27e9, fun \u27e8n, t, ht\u27e9 \u21a6 ?_\u27e9\n \u00b7 simp only [\u2190 mem_colon_singleton, one_smul, \u2190 mem_bot R, \u2190 hx, \u2190 Ideal.mem_radical_iff]\n exact hSR'.mk'_mem_iff.mp h\n \u00b7 have : hSR'.mk' R' r s = hSR'.mk' R' (t.1 * r) 1 * hSR'.mk' R' 1 (t * s) := by\n rw [\u2190 hSR'.mk'_mul, mul_one, one_mul, \u2190 sub_eq_zero, \u2190 hSR'.mk'_sub, Submonoid.coe_mul]\n simp [\u2190 mul_assoc, mul_comm r t.1, IsLocalization.mk'_zero]\n rw [this]\n apply Ideal.IsTwoSided.mul_mem_of_left\n rw [IsLocalization.mk'_one, \u2190 Ideal.mem_comap, hx]\n rcases eq_zero_or_pos n with rfl | hn\n \u00b7 exact Ideal.IsTwoSided.mul_mem_of_left _ \u27e81, by simpa using ht\u27e9\n \u00b7 use n\n rw [mem_colon_singleton, mul_pow, mul_smul, \u2190 mem_colon_singleton]\n exact Ideal.pow_mem_of_mem _ (by simpa using ht) n hn\n```\n\n-- snippet 37\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.Submodule (L51-L55)\ndef Submodule.IsQuotientEquivQuotientPrime (N\u2081 N\u2082 : Submodule A M) :=\nN\u2081 \u2264 N\u2082 \u2227 \u2203 (p : PrimeSpectrum A), Nonempty ((\u21a5N\u2082 \u29f8 N\u2081.submoduleOf N\u2082) \u2243\u2097[A] A \u29f8 p.1)\n\nset_option backward.isDefEq.respectTransparency false in\nopen LinearMap in\n```\n\n-- snippet 38\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.LinearEquiv (L128-L132)\ntheorem LinearEquiv.isAssociatedPrime_iff (l : M \u2243\u2097[R] M') :\n IsAssociatedPrime I M \u2194 IsAssociatedPrime I M' :=\n\u27e8fun h => h.map_of_injective l l.injective,\n fun h => h.map_of_injective l.symm l.symm.injective\u27e9\n```\n\n-- snippet 39\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.single_mem_pi (L67-L72)\ntheorem single_mem_pi [DecidableEq \u03b9] {i : \u03b9} {r : R i} (hr : r \u2208 I i) : Pi.single i r \u2208 pi I := by\nintro j\n obtain rfl | ne := eq_or_ne i j\n \u00b7 simpa\n \u00b7 simp [ne]\n```\n\n-- snippet 40\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.isAssociatedPrime_iff (L117-L120)\ntheorem isAssociatedPrime_iff [IsNoetherianRing R] :\n IsAssociatedPrime I M \u2194 I.IsPrime \u2227 \u2203 x : M, I = colon \u22a5 {x} :=\n(\u22a5 : Submodule R M).isAssociatedPrime_iff\n```\n", "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.RingTheory.Ideal.Over).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef algEquivOfEqComap (h : P = Q.comap \u03c3) : (B \u29f8 P) \u2243\u2090[A \u29f8 p] (C \u29f8 Q)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.RingTheory.Ideal.Over.comap_eq_of_scalar_tower_quotient (L52-L62)\ntheorem comap_eq_of_scalar_tower_quotient [Algebra R S] [Algebra (R \u29f8 p) (S \u29f8 P)]\n [IsScalarTower R (R \u29f8 p) (S \u29f8 P)] (h : Function.Injective (algebraMap (R \u29f8 p) (S \u29f8 P))) :\n comap (algebraMap R S) P = p := by\next x\n rw [mem_comap, \u2190 Quotient.eq_zero_iff_mem, \u2190 Quotient.eq_zero_iff_mem, Quotient.mk_algebraMap,\n IsScalarTower.algebraMap_apply R (R \u29f8 p) (S \u29f8 P), Quotient.algebraMap_eq]\n exact map_eq_zero_iff _ h\n\nvariable [Algebra R S]\n\n/-- `R / p` has a canonical map to `S / pS`. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.RingTheory.Ideal.Over.Quotient (L63-L65)\ninstance Quotient.algebraQuotientMapQuotient : Algebra (R \u29f8 p) (S \u29f8 map (algebraMap R S) p) :=\nIdeal.Quotient.algebraQuotientOfLEComap le_comap_map\n```\n\n-- snippet 3\n```lean\n-- Mathlib.RingTheory.Ideal.Over.Quotient (L67-L72)\ntheorem Quotient.algebraMap_quotient_map_quotient (x : R) :\n letI f := algebraMap R S\nalgebraMap (R \u29f8 p) (S \u29f8 map f p) (Ideal.Quotient.mk p x) =\n Ideal.Quotient.mk (map f p) (f x) :=\n rfl\n```\n\n-- snippet 4\n```lean\n-- Mathlib.RingTheory.Ideal.Over.Quotient (L74-L78)\ntheorem Quotient.mk_smul_mk_quotient_map_quotient (x : R) (y : S) :\n letI f := algebraMap R S\nQuotient.mk p x \u2022 Quotient.mk (map f p) y = Quotient.mk (map f p) (f x * y) :=\n Algebra.smul_def _ _\n```\n\n-- snippet 5\n```lean\n-- Mathlib.RingTheory.Ideal.Over.Quotient (L79-L95)\ninstance Quotient.tower_quotient_map_quotient :\n IsScalarTower R (R \u29f8 p) (S \u29f8 map (algebraMap R S) p) :=\nIsScalarTower.of_algebraMap_eq fun x => by\n rw [Quotient.algebraMap_eq, Quotient.algebraMap_quotient_map_quotient,\n Quotient.mk_algebraMap]\n\nend CommRing\n\nsection ideal_liesOver\n\nsection Semiring\n\nvariable (A : Type*) [CommSemiring A] {B C : Type*} [Semiring B] [Semiring C] [Algebra A B]\n [Algebra A C] (P : Ideal B) {Q : Ideal C} (p : Ideal A)\n {G : Type*} [Group G] [MulSemiringAction G B] [SMulCommClass G A B] (g : G)\n\n/-- The ideal obtained by pulling back the ideal `P` from `B` to `A`. -/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.RingTheory.Ideal.Over.under (L96-L97)\nabbrev under : Ideal A := Ideal.comap (algebraMap A B) P\n```\n\n-- snippet 7\n```lean\n-- Mathlib.RingTheory.Ideal.Over.under_def (L98-L99)\ntheorem under_def : P.under A = Ideal.comap (algebraMap A B) P := rfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.RingTheory.Ideal.Over.IsPrime (L100-L102)\ninstance IsPrime.under [hP : P.IsPrime] : (P.under A).IsPrime :=\nhP.comap (algebraMap A B)\n```\n\n-- snippet 9\n```lean\n-- Mathlib.RingTheory.Ideal.Over.under_smul (L104-L108)\nlemma under_smul : (g \u2022 P : Ideal B).under A = P.under A := by\next a\n rw [mem_comap, mem_comap, mem_pointwise_smul_iff_inv_smul_mem, smul_algebraMap]\n\nvariable (B) in\n```\n\n-- snippet 10\n```lean\n-- Mathlib.RingTheory.Ideal.Over.under_top (L109-L113)\ntheorem under_top : under A (\u22a4 : Ideal B) = \u22a4 := comap_top\nvariable {A}\n\n/-- `P` lies over `p` if `p` is the preimage of `P` by the `algebraMap`. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.RingTheory.Ideal.Over.over_under (L117-L118)\ninstance over_under : P.LiesOver (P.under A) where over := rfl\n```\n\n-- snippet 12\n```lean\n-- Mathlib.RingTheory.Ideal.Over.over_def (L119-L120)\ntheorem over_def [P.LiesOver p] : p = P.under A := LiesOver.over\n```\n\n-- snippet 13\n```lean\n-- Mathlib.RingTheory.Ideal.Over.mem_of_liesOver (L121-L125)\ntheorem mem_of_liesOver [P.LiesOver p] (x : A) : x \u2208 p \u2194 algebraMap A B x \u2208 P := by\nrw [P.over_def p]\n rfl\n\nvariable (A B) in\n```\n\n-- snippet 14\n```lean\n-- Mathlib.RingTheory.Ideal.Over.top_liesOver_top (L126-L128)\ninstance top_liesOver_top : (\u22a4 : Ideal B).LiesOver (\u22a4 : Ideal A) where\n over := (under_top A B).symm\n```\n\n-- snippet 15\n```lean\n-- Mathlib.RingTheory.Ideal.Over.eq_top_iff_of_liesOver (L129-L132)\ntheorem eq_top_iff_of_liesOver [P.LiesOver p] : P = \u22a4 \u2194 p = \u22a4 := by\nrw [P.over_def p]\n exact comap_eq_top_iff.symm\n```\n\n-- snippet 16\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.IsNoetherianRing (L92-L117)\ntheorem IsNoetherianRing.exists_relSeries_isQuotientEquivQuotientPrime :\n \u2203 s : RelSeries {(N\u2081, N\u2082) | Submodule.IsQuotientEquivQuotientPrime (A := A) (M := M) N\u2081 N\u2082},\ns.head = \u22a5 \u2227 s.last = \u22a4 := by\n refine WellFoundedGT.induction_top \u27e8\u22a5, .singleton _ \u22a5, rfl, rfl\u27e9 ?_\n rintro N hN \u27e8s, hs\u2081, hs\u2082\u27e9\n have := Submodule.Quotient.nontrivial_iff.mpr hN\n obtain \u27e8p, hp\u27e9 := associatedPrimes.nonempty A (M \u29f8 N)\n rw [AssociatedPrimes.mem_iff, isAssociatedPrime_iff] at hp\n obtain \u27e8hp, x, rfl\u27e9 := hp\n obtain \u27e8x, rfl\u27e9 := Submodule.mkQ_surjective _ x\n have hxN : x \u2209 N := fun h \u21a6 hp.ne_top (by rw [show N.mkQ x = 0 by simpa]; simp)\n have := Submodule.isQuotientEquivQuotientPrime_iff.mpr \u27e8x, hp, rfl\u27e9\n refine \u27e8_, by simpa [hs\u2082], s.snoc _ (hs\u2082 \u25b8 this), by simpa, rfl\u27e9\n\n/-- If a property on finitely generated modules over a Noetherian ring satisfies that:\n\n- it holds for zero module (it's formalized as it holds for any module which is subsingleton),\n- it holds for `A \u29f8 p` for every prime ideal `p` of `A` (to avoid universe problem,\n it's formalized as it holds for any module isomorphic to `A \u29f8 p`),\n- it is stable by short exact sequences,\n\nthen the property holds for every finitely generated modules.\n\nNOTE: This should be the induction principle for `M`, but due to the bug\nhttps://github.com/leanprover/lean4/issues/4246\ncurrently it is induction for `Module.Finite A M`. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.biUnion_associatedPrimes_eq_zero_divisors (L229-L239)\ntheorem biUnion_associatedPrimes_eq_zero_divisors [IsNoetherianRing R] :\n \u22c3 p \u2208 associatedPrimes R M, p = { r : R | \u2203 x : M, x \u2260 0 \u2227 r \u2022 x = 0 } := by\nsimp only [AssociatedPrimes.mem_iff, isAssociatedPrime_iff]\n refine subset_antisymm (Set.iUnion\u2082_subset ?_) ?_\n \u00b7 rintro _ \u27e8h, x, \u27e8\u27e9\u27e9 r h'\n exact \u27e8x, by simpa using h.ne_top, by simpa using h'\u27e9\n \u00b7 intro r \u27e8x, h, h'\u27e9\n obtain \u27e8P, hP, hx\u27e9 := exists_le_isAssociatedPrime_of_isNoetherianRing R x h\n rw [isAssociatedPrime_iff] at hP\n exact Set.mem_iUnion\u2082_of_mem hP (hx (by rwa [mem_colon_singleton]))\n```\n\n-- snippet 18\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.prod (L206-L211)\ntheorem prod : associatedPrimes R (M \u00d7 M') = associatedPrimes R M \u222a associatedPrimes R M' :=\n(subset_union_of_exact LinearMap.inl_injective .inl_snd).antisymm (Set.union_subset_iff.2\n \u27e8subset_of_injective LinearMap.inl_injective, subset_of_injective LinearMap.inr_injective\u27e9)\n\nend associatedPrimes\n```\n\n-- snippet 19\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.associatedPrimes (L158-L169)\ntheorem associatedPrimes.finite : (associatedPrimes A M).Finite := by\ninduction \u2039Module.Finite A M\u203a using\n IsNoetherianRing.induction_on_isQuotientEquivQuotientPrime A with\n | subsingleton N => simp [associatedPrimes.eq_empty_of_subsingleton]\n | quotient N p f =>\n have := associatedPrimes.eq_singleton_of_isPrimary p.2.isPrimary\n simp [LinearEquiv.AssociatedPrimes.eq f, this]\n | exact N\u2081 N\u2082 N\u2083 f g hf _ hfg h\u2081 h\u2083 =>\n exact (h\u2081.union h\u2083).subset (associatedPrimes.subset_union_of_exact hf hfg)\n\n/-- Every maximal ideal of a commutative Noetherian total ring of fractions `A` is\nan associated prime of the `A`-module `A`. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.subset_union_of_exact (L171-L204)\ntheorem subset_union_of_exact (hf : Function.Injective f) (hfg : Function.Exact f g) :\n associatedPrimes R M' \u2286 associatedPrimes R M \u222a associatedPrimes R M'' := by\nrintro p \u27e8_, x, hx\u27e9\n by_cases! h : \u2203 a \u2208 p.primeCompl, \u2203 y : M, \u2203 k, f y = a ^ k \u2022 x\n \u00b7 obtain \u27e8a, ha, y, k, h\u27e9 := h\n left\n refine \u27e8\u2039_\u203a, y, le_antisymm (fun b hb \u21a6 ?_) (fun b \u27e8n, hb\u27e9 \u21a6 ?_)\u27e9\n \u00b7 rw [hx] at hb\n obtain \u27e8n, hb\u27e9 := hb\n use n\n rw [mem_colon_singleton, mem_bot] at hb \u22a2\n apply_fun _ using hf\n rw [map_smul, h, smul_comm, hb, smul_zero, map_zero]\n \u00b7 rw [mem_colon_singleton, mem_bot] at hb\n apply_fun f at hb\n rw [map_smul, map_zero, h, \u2190 mul_smul, \u2190 mem_bot R, \u2190 mem_colon_singleton] at hb\n replace hb := hx.ge (Ideal.le_radical hb)\n contrapose hb\n exact p.primeCompl.mul_mem (p.primeCompl.pow_mem hb n) (p.primeCompl.pow_mem ha k)\n \u00b7 right\n refine \u27e8\u2039_\u203a, g x, le_antisymm (fun b hb \u21a6 ?_) (fun b \u27e8n, hb\u27e9 \u21a6 ?_)\u27e9\n \u00b7 rw [hx] at hb\n refine Ideal.radical_mono (fun b hb \u21a6 ?_) hb\n rw [mem_colon_singleton, mem_bot] at hb \u22a2\n rw [\u2190 map_smul, hb, map_zero]\n \u00b7 rw [mem_colon_singleton, mem_bot, \u2190 map_smul, \u2190 LinearMap.mem_ker,\n hfg.linearMap_ker_eq] at hb\n obtain \u27e8y, hy\u27e9 := hb\n by_contra H\n exact h b H y n hy\n\nvariable (R M M') in\n/-- The set of associated primes of the product of two modules is equal to\nthe union of those of the two modules. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.mem_associatedPrimes_atPrime_of_mem_associatedPrimes (L70-L77)\nlemma mem_associatedPrimes_atPrime_of_mem_associatedPrimes\n {p : Ideal R} [p.IsPrime] (ass : p \u2208 associatedPrimes R M) :\n maximalIdeal (Localization.AtPrime p) \u2208\n associatedPrimes (Localization.AtPrime p) (LocalizedModule.AtPrime p M) := by\napply mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule\n p.primeCompl (LocalizedModule.mkLinearMap p.primeCompl M)\n simpa [Localization.AtPrime.comap_maximalIdeal] using ass\n```\n\n-- snippet 22\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.Ideal (L170-L179)\ntheorem Ideal.IsMaximal.mem_associatedPrimes_of_isFractionRing [IsFractionRing A A]\n (I : Ideal A) [hI : I.IsMaximal] : I \u2208 associatedPrimes A A :=\nhave fin := associatedPrimes.finite A A\n have \u27e8P, hP\u27e9 := (I.subset_union_prime_finite fin (f := id) 0 0 fun _ h _ _ \u21a6 h.isPrime).1 <| by\n simp_rw [id, biUnion_associatedPrimes_eq_compl_nonZeroDivisors]\n exact fun x hx h \u21a6 hI.ne_top <| I.eq_top_of_isUnit_mem hx\n (IsFractionRing.self_iff_nonZeroDivisors_le_isUnit.mp \u2039_\u203a h)\n hI.eq_of_le hP.1.isPrime.ne_top hP.2 \u25b8 hP.1\n\n/-- A commutative Noetherian total ring of fractions is semilocal. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.associatedPrimes (L103-L107)\ndef associatedPrimes : Set (Ideal R) :=\n{ I | IsAssociatedPrime I M }\n\nvariable {I J M} {M' : Type*} [AddCommMonoid M'] [Module R M'] (f : M \u2192\u2097[R] M')\n```\n\n-- snippet 24\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.minimalPrimes_annihilator_subset_associatedPrimes (L131-L150)\nlemma minimalPrimes_annihilator_subset_associatedPrimes [IsNoetherianRing R] [Module.Finite R M] :\n (Module.annihilator R M).minimalPrimes \u2286 associatedPrimes R M := by\nintro p hp\n have prime := hp.1.1\n let R\u209a := Localization.AtPrime p\n have : Nontrivial (LocalizedModule p.primeCompl M) := by\n simpa [\u2190 Module.mem_support_iff (p := \u27e8p, prime\u27e9), Module.support_eq_zeroLocus] using hp.1.2\n rcases associatedPrimes.nonempty R\u209a (LocalizedModule p.primeCompl M) with \u27e8q, hq\u27e9\n have q_prime : q.IsPrime := IsAssociatedPrime.isPrime hq\n simp only [\u2190 preimage_comap_associatedPrimes_eq_associatedPrimes_of_isLocalizedModule p.primeCompl\n R\u209a (LocalizedModule.mkLinearMap p.primeCompl M), Set.mem_preimage] at hq\n have ann_le : Module.annihilator R M \u2264 Ideal.comap (algebraMap R R\u209a) q :=\n le_of_eq_of_le Submodule.annihilator_top.symm (IsAssociatedPrime.annihilator_le hq)\n have le : Ideal.comap (algebraMap R R\u209a) q \u2264 p := by\n have := (IsLocalization.disjoint_comap_iff p.primeCompl R\u209a q).mpr q_prime.ne_top\n simpa only [Ideal.primeCompl, Submonoid.coe_set_mk, Subsemigroup.coe_set_mk,\n Set.disjoint_compl_left_iff_subset] using this\n simpa [Minimal.eq_of_le hp.out \u27e8IsAssociatedPrime.isPrime hq, ann_le\u27e9 le] using hq\n\nend Module.associatedPrimes\n```\n\n-- snippet 25\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.comap_mem_associatedPrimes_of_mem_associatedPrimes_of_isLocalizedModule_of_fg (L84-L120)\nlemma comap_mem_associatedPrimes_of_mem_associatedPrimes_of_isLocalizedModule_of_fg (p : Ideal R')\n (ass : p \u2208 associatedPrimes R' M') (fg : (p.comap (algebraMap R R')).FG) :\n p.comap (algebraMap R R') \u2208 associatedPrimes R M := by\nrcases ass with \u27e8hp, x, hx\u27e9\n rcases fg with \u27e8T, hT\u27e9\n rcases IsLocalizedModule.mk'_surjective S f x with \u27e8\u27e8m, s\u27e9, rfl\u27e9\n simp only [Function.uncurry_apply_pair] at hx\n have mem (a : T) : algebraMap R R' a \u2208 p := by\n simpa [\u2190 Ideal.mem_comap, \u2190 hT] using Ideal.subset_span a.2\n simp only [hx, Ideal.mem_radical_iff, mem_bot, mem_colon_singleton, \u2190 map_pow, algebraMap_smul,\n \u2190 IsLocalizedModule.mk'_smul, IsLocalizedModule.mk'_eq_zero' f] at mem\n choose e g hg using mem\n refine \u27e8.under R p, (\u220f a, g a).1 \u2022 m, le_antisymm ?_ fun r hr \u21a6 ?_\u27e9\n \u00b7 rw [\u2190 hT, Ideal.span_le]\n intro a ha\n simp only [SetLike.mem_coe, Ideal.mem_radical_iff, mem_bot, mem_colon_singleton]\n obtain \u27e8u, hu\u27e9 : g \u27e8a, ha\u27e9 \u2223 (\u220f a, g a) := by\n apply Finset.dvd_prod_of_mem g (Finset.mem_univ \u27e8a, ha\u27e9)\n use e \u27e8a, ha\u27e9\n rw [hu, Submonoid.coe_mul, smul_smul, \u2190 mul_assoc, mul_comm, \u2190 smul_smul, mul_comm, \u2190 smul_smul]\n exact smul_eq_zero_of_right u.1 (hg \u27e8a, ha\u27e9)\n \u00b7 simp only [Ideal.mem_radical_iff, mem_bot, mem_colon_singleton, smul_smul] at hr\n obtain \u27e8k, hk\u27e9 := hr\n have mem : r ^ k * (\u220f a, g a).1 \u2208 Ideal.comap (algebraMap R R') p := by\n rw [hx]\n use 1\n simp_rw [pow_one, mem_colon_singleton, algebraMap_smul, \u2190 IsLocalizedModule.mk'_smul,\n hk, IsLocalizedModule.mk'_zero, mem_bot]\n apply hp.mem_of_pow_mem k\n rw [\u2190 map_pow]\n exact ((hp.under R).mul_mem_iff_mem_or_mem.mp mem).resolve_right\n (Set.disjoint_left.mp ((IsLocalization.disjoint_comap_iff S R' p).mpr hp.1) (\u220f a, g a).2)\n\nvariable (R')\n\ninclude S f in\nopen Set in\n```\n\n-- snippet 26\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.pi (L50-L55)\ndef pi : Ideal (\u03a0 i, R i) where\n carrier := { r | \u2200 i, r i \u2208 I i }\nzero_mem' i := (I i).zero_mem\n add_mem' ha hb i := (I i).add_mem (ha i) (hb i)\n smul_mem' a _b hb i := (I i).mul_mem_left (a i) (hb i)\n```\n\n-- snippet 27\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.subset_of_injective (L165-L169)\ntheorem subset_of_injective (hf : Function.Injective f) :\n associatedPrimes R M \u2286 associatedPrimes R M' := fun _I h => h.map_of_injective f hf\n/-- If `0 \u2192 M \u2192 M' \u2192 M''` is an exact sequence, then the set of associated primes of `M'` is\ncontained in the union of those of `M` and `M''`. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.biUnion_associatedPrimes_eq_compl_nonZeroDivisors (L240-L246)\ntheorem biUnion_associatedPrimes_eq_compl_nonZeroDivisors [IsNoetherianRing R] :\n \u22c3 p \u2208 associatedPrimes R R, p = (nonZeroDivisors R : Set R)\u1d9c :=\n(biUnion_associatedPrimes_eq_zero_divisors R R).trans <| by\n ext; simp [\u2190 nonZeroDivisorsLeft_eq_nonZeroDivisors, and_comm]\n\nvariable {R M}\n```\n\n-- snippet 29\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.not_isAssociatedPrime_of_subsingleton (L133-L138)\ntheorem not_isAssociatedPrime_of_subsingleton [Subsingleton M] : \u00acIsAssociatedPrime I M := by\nrintro \u27e8hI, x, hx\u27e9\n apply hI.ne_top\n simp [hx, Subsingleton.elim x 0]\n\nvariable (R) in\n```\n\n-- snippet 30\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.IsAssociatedPrime (L98-L102)\ndef IsAssociatedPrime : Prop :=\n(\u22a5 : Submodule R M).IsAssociatedPrime I\n\nvariable (R) in\n/-- The set of associated primes of a module. -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.isAssociatedPrime_iff_exists_injective_linearMap (L257-L267)\ntheorem isAssociatedPrime_iff_exists_injective_linearMap [IsNoetherianRing R] :\n IsAssociatedPrime I M \u2194 I.IsPrime \u2227 \u2203 (f : R \u29f8 I \u2192\u2097[R] M), Function.Injective f := by\nrw [isAssociatedPrime_iff, and_congr_right_iff]\n refine fun _ \u21a6 \u27e8fun \u27e8x, h\u27e9 \u21a6 ?_, fun \u27e8f, h\u27e9 \u21a6 \u27e8(f \u2218\u2097 mkQ I) 1, ?_\u27e9\u27e9\n \u00b7 replace h : I = ker (toSpanSingleton R M x) := by simp [h, SetLike.ext_iff]\n exact \u27e8liftQ _ _ h.le, ker_eq_bot.mp (ker_liftQ_eq_bot' _ _ h)\u27e9\n \u00b7 conv_lhs => rw [\u2190 I.ker_mkQ, \u2190 ker_comp_of_ker_eq_bot (mkQ I) (ker_eq_bot_of_injective h)]\n simp [SetLike.ext_iff, \u2190 Ideal.Quotient.algebraMap_eq, Algebra.algebraMap_eq_smul_one]\n\nvariable {I J M}\n```\n\n-- snippet 32\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.mem_pi (L56-L58)\ntheorem mem_pi (r : \u03a0 i, R i) : r \u2208 pi I \u2194 \u2200 i, r i \u2208 I i :=\nIff.rfl\n```\n\n-- snippet 33\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.exists_le_isAssociatedPrime_of_isNoetherianRing (L139-L163)\ntheorem exists_le_isAssociatedPrime_of_isNoetherianRing [H : IsNoetherianRing R] (x : M)\n (hx : x \u2260 0) : \u2203 P : Ideal R, IsAssociatedPrime P M \u2227 (\u22a5 : Submodule R M).colon {x} \u2264 P := by\nsimp only [isAssociatedPrime_iff]\n obtain \u27e8P, \u27e8l, h\u2081, y, rfl\u27e9, h\u2083\u27e9 :=\n set_has_maximal_iff_noetherian.mpr H\n { P | (\u22a5 : Submodule R M).colon {x} \u2264 P \u2227 P \u2260 \u22a4 \u2227 \u2203 y : M, P = (\u22a5 : Submodule R M).colon {y} }\n \u27e8_, rfl.le, by simpa, x, rfl\u27e9\n refine \u27e8_, \u27e8\u27e8h\u2081, ?_\u27e9, y, rfl\u27e9, l\u27e9\n intro a b hab\n rw [or_iff_not_imp_left]\n intro ha\n rw [mem_colon_singleton] at ha hab\n have H\u2081 : (\u22a5 : Submodule R M).colon {y} \u2264 (\u22a5 : Submodule R M).colon {a \u2022 y} := by\n intro c hc\n rw [mem_colon_singleton, mem_bot] at hc \u22a2\n rw [smul_comm, hc, smul_zero]\n rwa [H\u2081.eq_of_not_lt (h\u2083 _ \u27e8l.trans H\u2081, by simpa, _, rfl\u27e9),\n mem_colon_singleton, smul_comm, smul_smul]\n\nnamespace associatedPrimes\n\nvariable {f} {M'' : Type*} [AddCommMonoid M''] [Module R M''] {g : M' \u2192\u2097[R] M''}\n\n/-- If `M \u2192 M'` is injective, then the set of associated primes of `M` is\ncontained in that of `M'`. -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.AssociatedPrimes (L108-L109)\ntheorem AssociatedPrimes.mem_iff : I \u2208 associatedPrimes R M \u2194 IsAssociatedPrime I M := Iff.rfl\n```\n\n-- snippet 35\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.preimage_comap_associatedPrimes_eq_associatedPrimes_of_isLocalizedModule (L122-L130)\nlemma preimage_comap_associatedPrimes_eq_associatedPrimes_of_isLocalizedModule\n [IsNoetherianRing R] :\n (Ideal.comap (algebraMap R R')) \u207b\u00b9' (associatedPrimes R M) = associatedPrimes R' M' := by\next p\n exact \u27e8mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule S f p,\n fun h \u21a6 comap_mem_associatedPrimes_of_mem_associatedPrimes_of_isLocalizedModule_of_fg S f p h\n ((isNoetherianRing_iff_ideal_fg R).mp \u2039_\u203a _)\u27e9\n\nvariable (R M) in\n```\n\n-- snippet 36\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule (L40-L69)\nlemma mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule\n (p : Ideal R') (ass : p.comap (algebraMap R R') \u2208 associatedPrimes R M) :\n p \u2208 associatedPrimes R' M' := by\nrcases ass with \u27e8hp, x, hx\u27e9\n constructor\n \u00b7 refine (IsLocalization.isPrime_iff_isPrime_disjoint S _ _).mpr\n \u27e8hp, (IsLocalization.disjoint_comap_iff S R' p).mpr ?_\u27e9\n by_contra eqtop\n simp [eqtop, Ideal.comap_top, Ideal.isPrime_iff] at hp\n \u00b7 use f x\n ext t\n rcases IsLocalization.exists_mk'_eq S t with \u27e8r, s, hrs\u27e9\n simp_rw [\u2190 hrs, Ideal.mem_radical_iff, mem_colon_singleton, \u2190 IsLocalizedModule.mk'_one S f,\n \u2190 IsLocalization.mk'_pow, IsLocalizedModule.mk'_smul_mk', mul_one, mem_bot,\n IsLocalizedModule.mk'_eq_zero']\n refine \u27e8fun h \u21a6 exists_comm.mp \u27e81, ?_\u27e9, fun \u27e8n, t, ht\u27e9 \u21a6 ?_\u27e9\n \u00b7 simp only [\u2190 mem_colon_singleton, one_smul, \u2190 mem_bot R, \u2190 hx, \u2190 Ideal.mem_radical_iff]\n exact hSR'.mk'_mem_iff.mp h\n \u00b7 have : hSR'.mk' R' r s = hSR'.mk' R' (t.1 * r) 1 * hSR'.mk' R' 1 (t * s) := by\n rw [\u2190 hSR'.mk'_mul, mul_one, one_mul, \u2190 sub_eq_zero, \u2190 hSR'.mk'_sub, Submonoid.coe_mul]\n simp [\u2190 mul_assoc, mul_comm r t.1, IsLocalization.mk'_zero]\n rw [this]\n apply Ideal.IsTwoSided.mul_mem_of_left\n rw [IsLocalization.mk'_one, \u2190 Ideal.mem_comap, hx]\n rcases eq_zero_or_pos n with rfl | hn\n \u00b7 exact Ideal.IsTwoSided.mul_mem_of_left _ \u27e81, by simpa using ht\u27e9\n \u00b7 use n\n rw [mem_colon_singleton, mul_pow, mul_smul, \u2190 mem_colon_singleton]\n exact Ideal.pow_mem_of_mem _ (by simpa using ht) n hn\n```\n\n-- snippet 37\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.Submodule (L51-L55)\ndef Submodule.IsQuotientEquivQuotientPrime (N\u2081 N\u2082 : Submodule A M) :=\nN\u2081 \u2264 N\u2082 \u2227 \u2203 (p : PrimeSpectrum A), Nonempty ((\u21a5N\u2082 \u29f8 N\u2081.submoduleOf N\u2082) \u2243\u2097[A] A \u29f8 p.1)\n\nset_option backward.isDefEq.respectTransparency false in\nopen LinearMap in\n```\n\n-- snippet 38\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.LinearEquiv (L128-L132)\ntheorem LinearEquiv.isAssociatedPrime_iff (l : M \u2243\u2097[R] M') :\n IsAssociatedPrime I M \u2194 IsAssociatedPrime I M' :=\n\u27e8fun h => h.map_of_injective l l.injective,\n fun h => h.map_of_injective l.symm l.symm.injective\u27e9\n```\n\n-- snippet 39\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.single_mem_pi (L67-L72)\ntheorem single_mem_pi [DecidableEq \u03b9] {i : \u03b9} {r : R i} (hr : r \u2208 I i) : Pi.single i r \u2208 pi I := by\nintro j\n obtain rfl | ne := eq_or_ne i j\n \u00b7 simpa\n \u00b7 simp [ne]\n```\n\n-- snippet 40\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.isAssociatedPrime_iff (L117-L120)\ntheorem isAssociatedPrime_iff [IsNoetherianRing R] :\n IsAssociatedPrime I M \u2194 I.IsPrime \u2227 \u2203 x : M, I = colon \u22a5 {x} :=\n(\u22a5 : Submodule R M).isAssociatedPrime_iff\n```\n[/INST]", "sample_id": "C-Mathlib.RingTheory.Ideal.Over.algEquivOfEqComap", "source": {"declaration": "Mathlib.RingTheory.Ideal.Over.algEquivOfEqComap", "file": "Mathlib/RingTheory/Ideal/Over.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.RingTheory.Ideal.Over", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Ideal/Over.lean#L304", "span": "L304-L306"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "theorem one_eq_lift_iff {a : Cardinal.{u}} :\n (1 : Cardinal) = lift.{v} a \u2194 1 = a\n:= by .someMissingNamespaceXYZ\nsimpa using nat_eq_lift_iff (n := 1)", "diagnostic": "[CompilationUnit(i_begin=0, i_end=95, messages=[Message(data='unknown tactic', pos=Position(line=3, column=8), pos_end=None, severity=, kind=None), Message(data='invalid use of explicit universe parameters, `lift` is a local variable', pos=Position(line=2, column=21), pos_end=Position(line=2, column=25), severity=, kind=None), Message(data='unsolved goals\\nx\u271d : Sort u_1\\nlift : x\u271d\\na : Cardinal.{u}\\n\u22a2 1 = sorry \u2194 1 = a', pos=Position(line=3, column=6), pos_end=Position(line=3, column=30), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=95, i_end=154, 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": 1437, "declarations_count": 160, "diagnostics_count": 1, "duplicate_fingerprint": "d25fd5db13a12b31", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 432, "lean_code_chars": 153, "lean_code_ratio": 0.1065, "length_bucket": "tiny", "line_count": 15, "natural_language_chars": 1284, "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.SetTheory.Cardinal.Order).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem one_eq_lift_iff {a : Cardinal.{u}} :\n (1 : Cardinal) = lift.{v} a \u2194 1 = a\n:= by .someMissingNamespaceXYZ\nsimpa using nat_eq_lift_iff (n := 1)\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=95, messages=[Message(data='unknown tactic', pos=Position(line=3, column=8), pos_end=None, severity=, kind=None), Message(data='invalid use of explicit universe parameters, `lift` is a local variable', pos=Position(line=2, column=21), pos_end=Position(line=2, column=25), severity=, kind=None), Message(data='unsolved goals\\nx\u271d : Sort u_1\\nlift : x\u271d\\na : Cardinal.{u}\\n\u22a2 1 = sorry \u2194 1 = a', pos=Position(line=3, column=6), pos_end=Position(line=3, column=30), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=95, i_end=154, 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.SetTheory.Cardinal.Order).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem one_eq_lift_iff {a : Cardinal.{u}} :\n (1 : Cardinal) = lift.{v} a \u2194 1 = a\n:= by .someMissingNamespaceXYZ\nsimpa using nat_eq_lift_iff (n := 1)\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=95, messages=[Message(data='unknown tactic', pos=Position(line=3, column=8), pos_end=None, severity=, kind=None), Message(data='invalid use of explicit universe parameters, `lift` is a local variable', pos=Position(line=2, column=21), pos_end=Position(line=2, column=25), severity=, kind=None), Message(data='unsolved goals\\nx\u271d : Sort u_1\\nlift : x\u271d\\na : Cardinal.{u}\\n\u22a2 1 = sorry \u2194 1 = a', pos=Position(line=3, column=6), pos_end=Position(line=3, column=30), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=95, i_end=154, 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.SetTheory.Cardinal.Order.one_eq_lift_iff", "source": {"declaration": "Mathlib.SetTheory.Cardinal.Order.one_eq_lift_iff", "file": "Mathlib/SetTheory/Cardinal/Order.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.SetTheory.Cardinal.Order", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/SetTheory/Cardinal/Order.lean#L644", "span": "L644-L647"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.RingTheory.PowerSeries.WeierstrassPreparation.isWeierstrassDivisionAt_zero (L125-L134)\ntheorem isWeierstrassDivisionAt_zero : IsWeierstrassDivisionAt 0 g 0 0 I", "-- Mathlib.RingTheory.PowerSeries.WeierstrassPreparation.coeff_f_sub_r_mem (L135-L144)\ntheorem coeff_f_sub_r_mem (H : f.IsWeierstrassDivisionAt g q r I)\n {i : \u2115} (hi : i < (g.map (Ideal.Quotient.mk I)).order.toNat) :\n coeff i (f - r : A\u27e6X\u27e7) \u2208 I", "-- Mathlib.RingTheory.PowerSeries.WeierstrassPreparation.add (L145-L150)\ntheorem add {f' q' r'} (H : f.IsWeierstrassDivisionAt g q r I)\n (H' : f'.IsWeierstrassDivisionAt g q' r' I) :\n (f + f').IsWeierstrassDivisionAt g (q + q') (r + r') I", "-- Mathlib.RingTheory.PowerSeries.WeierstrassPreparation.smul (L151-L170)\ntheorem smul (H : f.IsWeierstrassDivisionAt g q r I) (a : A) :\n (a \u2022 f).IsWeierstrassDivisionAt g (a \u2022 q) (a \u2022 r) I", "-- Mathlib.RingTheory.PowerSeries.WeierstrassPreparation.IsWeierstrassDivisorAt (L171-L175)\ndef IsWeierstrassDivisorAt : Prop", "-- Mathlib.RingTheory.PowerSeries.WeierstrassPreparation.IsWeierstrassDivisor (L176-L181)\nabbrev IsWeierstrassDivisor [IsLocalRing A] : Prop", "-- Mathlib.RingTheory.PowerSeries.WeierstrassPreparation.IsWeierstrassDivisor (L182-L188)\ntheorem IsWeierstrassDivisor.of_map_ne_zero [IsLocalRing A]\n (hg : g.map (IsLocalRing.residue A) \u2260 0) : g.IsWeierstrassDivisor", "-- Mathlib.RingTheory.PowerSeries.WeierstrassPreparation.isUnit_shift (L214-L226)\ntheorem isUnit_shift : IsUnit <| mk fun i \u21a6\n coeff (i + (g.map (Ideal.Quotient.mk I)).order.toNat) g", "-- Mathlib.RingTheory.PowerSeries.Basic.PowerSeries (L58-L77)\nabbrev PowerSeries (R : Type*)", "-- Mathlib.RingTheory.PowerSeries.Basic.forall_coeff_eq_zero (L98-L103)\ntheorem forall_coeff_eq_zero (\u03c6 : R\u27e6X\u27e7) : (\u2200 n, coeff n \u03c6 = 0) \u2194 \u03c6 = 0", "-- Mathlib.RingTheory.PowerSeries.Basic.coeff (L78-L81)\ndef coeff (n : \u2115) : R\u27e6X\u27e7 \u2192\u2097[R] R", "-- Mathlib.RingTheory.PowerSeries.Basic.monomial (L82-L84)\ndef monomial (n : \u2115) : R \u2192\u2097[R] R\u27e6X\u27e7", "-- Mathlib.RingTheory.PowerSeries.Basic.ext (L91-L96)\ntheorem ext {\u03c6 \u03c8 : R\u27e6X\u27e7} (h : \u2200 n, coeff n \u03c6 = coeff n \u03c8) : \u03c6 = \u03c8", "-- Mathlib.RingTheory.PowerSeries.Basic.coeff_def (L85-L89)\ntheorem coeff_def {s : Unit \u2192\u2080 \u2115} {n : \u2115} (h : s () = n) :\n coeff (R"], "statement": "theorem IsWeierstrassDivision.unique [IsAdicComplete (IsLocalRing.maximalIdeal A) A]\n {q : A\u27e6X\u27e7} {r : A[X]}\n (H : f.IsWeierstrassDivision g q r) : q = f /\u02b7 g \u2227 r = f %\u02b7 g", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 3202, "declarations_count": 287, "diagnostics_count": 0, "duplicate_fingerprint": "f10ee288093c46db", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1263, "lean_code_chars": 2382, "lean_code_ratio": 0.7439, "length_bucket": "short", "line_count": 101, "natural_language_chars": 820, "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.RingTheory.PowerSeries.WeierstrassPreparation).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem IsWeierstrassDivision.unique [IsAdicComplete (IsLocalRing.maximalIdeal A) A]\n {q : A\u27e6X\u27e7} {r : A[X]}\n (H : f.IsWeierstrassDivision g q r) : q = f /\u02b7 g \u2227 r = f %\u02b7 g\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.RingTheory.PowerSeries.WeierstrassPreparation.isWeierstrassDivisionAt_zero (L125-L134)\ntheorem isWeierstrassDivisionAt_zero : IsWeierstrassDivisionAt 0 g 0 0 I\n```\n\n-- snippet 2\n```lean\n-- Mathlib.RingTheory.PowerSeries.WeierstrassPreparation.coeff_f_sub_r_mem (L135-L144)\ntheorem coeff_f_sub_r_mem (H : f.IsWeierstrassDivisionAt g q r I)\n {i : \u2115} (hi : i < (g.map (Ideal.Quotient.mk I)).order.toNat) :\n coeff i (f - r : A\u27e6X\u27e7) \u2208 I\n```\n\n-- snippet 3\n```lean\n-- Mathlib.RingTheory.PowerSeries.WeierstrassPreparation.add (L145-L150)\ntheorem add {f' q' r'} (H : f.IsWeierstrassDivisionAt g q r I)\n (H' : f'.IsWeierstrassDivisionAt g q' r' I) :\n (f + f').IsWeierstrassDivisionAt g (q + q') (r + r') I\n```\n\n-- snippet 4\n```lean\n-- Mathlib.RingTheory.PowerSeries.WeierstrassPreparation.smul (L151-L170)\ntheorem smul (H : f.IsWeierstrassDivisionAt g q r I) (a : A) :\n (a \u2022 f).IsWeierstrassDivisionAt g (a \u2022 q) (a \u2022 r) I\n```\n\n-- snippet 5\n```lean\n-- Mathlib.RingTheory.PowerSeries.WeierstrassPreparation.IsWeierstrassDivisorAt (L171-L175)\ndef IsWeierstrassDivisorAt : Prop\n```\n\n-- snippet 6\n```lean\n-- Mathlib.RingTheory.PowerSeries.WeierstrassPreparation.IsWeierstrassDivisor (L176-L181)\nabbrev IsWeierstrassDivisor [IsLocalRing A] : Prop\n```\n\n-- snippet 7\n```lean\n-- Mathlib.RingTheory.PowerSeries.WeierstrassPreparation.IsWeierstrassDivisor (L182-L188)\ntheorem IsWeierstrassDivisor.of_map_ne_zero [IsLocalRing A]\n (hg : g.map (IsLocalRing.residue A) \u2260 0) : g.IsWeierstrassDivisor\n```\n\n-- snippet 8\n```lean\n-- Mathlib.RingTheory.PowerSeries.WeierstrassPreparation.isUnit_shift (L214-L226)\ntheorem isUnit_shift : IsUnit <| mk fun i \u21a6\n coeff (i + (g.map (Ideal.Quotient.mk I)).order.toNat) g\n```\n\n-- snippet 9\n```lean\n-- Mathlib.RingTheory.PowerSeries.Basic.PowerSeries (L58-L77)\nabbrev PowerSeries (R : Type*)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.RingTheory.PowerSeries.Basic.forall_coeff_eq_zero (L98-L103)\ntheorem forall_coeff_eq_zero (\u03c6 : R\u27e6X\u27e7) : (\u2200 n, coeff n \u03c6 = 0) \u2194 \u03c6 = 0\n```\n\n-- snippet 11\n```lean\n-- Mathlib.RingTheory.PowerSeries.Basic.coeff (L78-L81)\ndef coeff (n : \u2115) : R\u27e6X\u27e7 \u2192\u2097[R] R\n```\n\n-- snippet 12\n```lean\n-- Mathlib.RingTheory.PowerSeries.Basic.monomial (L82-L84)\ndef monomial (n : \u2115) : R \u2192\u2097[R] R\u27e6X\u27e7\n```\n\n-- snippet 13\n```lean\n-- Mathlib.RingTheory.PowerSeries.Basic.ext (L91-L96)\ntheorem ext {\u03c6 \u03c8 : R\u27e6X\u27e7} (h : \u2200 n, coeff n \u03c6 = coeff n \u03c8) : \u03c6 = \u03c8\n```\n\n-- snippet 14\n```lean\n-- Mathlib.RingTheory.PowerSeries.Basic.coeff_def (L85-L89)\ntheorem coeff_def {s : Unit \u2192\u2080 \u2115} {n : \u2115} (h : s () = n) :\n coeff (R\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.RingTheory.PowerSeries.WeierstrassPreparation).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem IsWeierstrassDivision.unique [IsAdicComplete (IsLocalRing.maximalIdeal A) A]\n {q : A\u27e6X\u27e7} {r : A[X]}\n (H : f.IsWeierstrassDivision g q r) : q = f /\u02b7 g \u2227 r = f %\u02b7 g\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.RingTheory.PowerSeries.WeierstrassPreparation.isWeierstrassDivisionAt_zero (L125-L134)\ntheorem isWeierstrassDivisionAt_zero : IsWeierstrassDivisionAt 0 g 0 0 I\n```\n\n-- snippet 2\n```lean\n-- Mathlib.RingTheory.PowerSeries.WeierstrassPreparation.coeff_f_sub_r_mem (L135-L144)\ntheorem coeff_f_sub_r_mem (H : f.IsWeierstrassDivisionAt g q r I)\n {i : \u2115} (hi : i < (g.map (Ideal.Quotient.mk I)).order.toNat) :\n coeff i (f - r : A\u27e6X\u27e7) \u2208 I\n```\n\n-- snippet 3\n```lean\n-- Mathlib.RingTheory.PowerSeries.WeierstrassPreparation.add (L145-L150)\ntheorem add {f' q' r'} (H : f.IsWeierstrassDivisionAt g q r I)\n (H' : f'.IsWeierstrassDivisionAt g q' r' I) :\n (f + f').IsWeierstrassDivisionAt g (q + q') (r + r') I\n```\n\n-- snippet 4\n```lean\n-- Mathlib.RingTheory.PowerSeries.WeierstrassPreparation.smul (L151-L170)\ntheorem smul (H : f.IsWeierstrassDivisionAt g q r I) (a : A) :\n (a \u2022 f).IsWeierstrassDivisionAt g (a \u2022 q) (a \u2022 r) I\n```\n\n-- snippet 5\n```lean\n-- Mathlib.RingTheory.PowerSeries.WeierstrassPreparation.IsWeierstrassDivisorAt (L171-L175)\ndef IsWeierstrassDivisorAt : Prop\n```\n\n-- snippet 6\n```lean\n-- Mathlib.RingTheory.PowerSeries.WeierstrassPreparation.IsWeierstrassDivisor (L176-L181)\nabbrev IsWeierstrassDivisor [IsLocalRing A] : Prop\n```\n\n-- snippet 7\n```lean\n-- Mathlib.RingTheory.PowerSeries.WeierstrassPreparation.IsWeierstrassDivisor (L182-L188)\ntheorem IsWeierstrassDivisor.of_map_ne_zero [IsLocalRing A]\n (hg : g.map (IsLocalRing.residue A) \u2260 0) : g.IsWeierstrassDivisor\n```\n\n-- snippet 8\n```lean\n-- Mathlib.RingTheory.PowerSeries.WeierstrassPreparation.isUnit_shift (L214-L226)\ntheorem isUnit_shift : IsUnit <| mk fun i \u21a6\n coeff (i + (g.map (Ideal.Quotient.mk I)).order.toNat) g\n```\n\n-- snippet 9\n```lean\n-- Mathlib.RingTheory.PowerSeries.Basic.PowerSeries (L58-L77)\nabbrev PowerSeries (R : Type*)\n```\n\n-- snippet 10\n```lean\n-- Mathlib.RingTheory.PowerSeries.Basic.forall_coeff_eq_zero (L98-L103)\ntheorem forall_coeff_eq_zero (\u03c6 : R\u27e6X\u27e7) : (\u2200 n, coeff n \u03c6 = 0) \u2194 \u03c6 = 0\n```\n\n-- snippet 11\n```lean\n-- Mathlib.RingTheory.PowerSeries.Basic.coeff (L78-L81)\ndef coeff (n : \u2115) : R\u27e6X\u27e7 \u2192\u2097[R] R\n```\n\n-- snippet 12\n```lean\n-- Mathlib.RingTheory.PowerSeries.Basic.monomial (L82-L84)\ndef monomial (n : \u2115) : R \u2192\u2097[R] R\u27e6X\u27e7\n```\n\n-- snippet 13\n```lean\n-- Mathlib.RingTheory.PowerSeries.Basic.ext (L91-L96)\ntheorem ext {\u03c6 \u03c8 : R\u27e6X\u27e7} (h : \u2200 n, coeff n \u03c6 = coeff n \u03c8) : \u03c6 = \u03c8\n```\n\n-- snippet 14\n```lean\n-- Mathlib.RingTheory.PowerSeries.Basic.coeff_def (L85-L89)\ntheorem coeff_def {s : Unit \u2192\u2080 \u2115} {n : \u2115} (h : s () = n) :\n coeff (R\n```\n[/INST]", "sample_id": "C-Mathlib.RingTheory.PowerSeries.WeierstrassPreparation.IsWeierstrassDivision", "source": {"declaration": "Mathlib.RingTheory.PowerSeries.WeierstrassPreparation.IsWeierstrassDivision", "file": "Mathlib/RingTheory/PowerSeries/WeierstrassPreparation.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.RingTheory.PowerSeries.WeierstrassPreparation", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/PowerSeries/WeierstrassPreparation.lean#L593", "span": "L593-L597"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "def Finsupp.toFreeAbelianGroup : (X \u2192\u2080 \u2124) \u2192+ FreeAbelianGroup X", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 480, "declarations_count": 51, "diagnostics_count": 0, "duplicate_fingerprint": "f56fe400bd07a0ed", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 140, "lean_code_chars": 64, "lean_code_ratio": 0.1333, "length_bucket": "tiny", "line_count": 7, "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": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.FreeAbelianGroup.Finsupp).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ndef Finsupp.toFreeAbelianGroup : (X \u2192\u2080 \u2124) \u2192+ FreeAbelianGroup 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.Algebra.FreeAbelianGroup.Finsupp).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ndef Finsupp.toFreeAbelianGroup : (X \u2192\u2080 \u2124) \u2192+ FreeAbelianGroup 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.Algebra.FreeAbelianGroup.Finsupp.Finsupp", "source": {"declaration": "Mathlib.Algebra.FreeAbelianGroup.Finsupp.Finsupp", "file": "Mathlib/Algebra/FreeAbelianGroup/Finsupp.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Algebra.FreeAbelianGroup.Finsupp", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/FreeAbelianGroup/Finsupp.lean#L38", "span": "L38-L40"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "instance setLike : SetLike (Submodule R M) M where\n coe s\n frobnicateTacticThatDoesNotExist := s.carrier\ncoe_injective' p q h := by cases p; cases q; congr; exact SetLike.coe_injective' h", "diagnostic": "[CompilationUnit(i_begin=0, i_end=61, messages=[Message(data='unexpected identifier; expected structInstFieldDecl', pos=Position(line=2, column=7), pos_end=Position(line=3, column=34), severity=, kind=None), Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=28), pos_end=Position(line=1, column=41), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=61, i_end=189, 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": 1461, "declarations_count": 161, "diagnostics_count": 1, "duplicate_fingerprint": "878577e321568e64", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 396, "lean_code_chars": 190, "lean_code_ratio": 0.13, "length_bucket": "tiny", "line_count": 15, "natural_language_chars": 1271, "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.Algebra.Module.Submodule.Defs).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ninstance setLike : SetLike (Submodule R M) M where\n coe s\n frobnicateTacticThatDoesNotExist := s.carrier\ncoe_injective' p q h := by cases p; cases q; congr; exact SetLike.coe_injective' h\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=61, messages=[Message(data='unexpected identifier; expected structInstFieldDecl', pos=Position(line=2, column=7), pos_end=Position(line=3, column=34), severity=, kind=None), Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=28), pos_end=Position(line=1, column=41), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=61, i_end=189, 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.Algebra.Module.Submodule.Defs).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ninstance setLike : SetLike (Submodule R M) M where\n coe s\n frobnicateTacticThatDoesNotExist := s.carrier\ncoe_injective' p q h := by cases p; cases q; congr; exact SetLike.coe_injective' h\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=61, messages=[Message(data='unexpected identifier; expected structInstFieldDecl', pos=Position(line=2, column=7), pos_end=Position(line=3, column=34), severity=, kind=None), Message(data='failed to synthesize instance of type class\\n Semiring R\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=28), pos_end=Position(line=1, column=41), severity=, kind='lean.synthInstanceFailed._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=61, i_end=189, 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.Algebra.Module.Submodule.Defs.setLike", "source": {"declaration": "Mathlib.Algebra.Module.Submodule.Defs.setLike", "file": "Mathlib/Algebra/Module/Submodule/Defs.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Algebra.Module.Submodule.Defs", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Module/Submodule/Defs.lean#L54", "span": "L54-L57"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "lemma whiskerLeft_\u03bc_\u03b4 (X Y : C) (T : D) : T \u25c1 \u03bc F X Y \u226b T \u25c1 \u03b4 F X Y = \ud835\udfd9 _\n:= by thisIsWrongLemmaNameXYZ\nrw [\u2190 MonoidalCategory.whiskerLeft_comp, \u03bc_\u03b4, MonoidalCategory.whiskerLeft_id]", "diagnostic": "[CompilationUnit(i_begin=0, i_end=46, messages=[Message(data='expected token', pos=Position(line=1, column=44), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=46, i_end=199, 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": 1050, "declarations_count": 115, "diagnostics_count": 1, "duplicate_fingerprint": "5a124a9a0f8a03aa", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 313, "lean_code_chars": 183, "lean_code_ratio": 0.1743, "length_bucket": "tiny", "line_count": 14, "natural_language_chars": 867, "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.CategoryTheory.Monoidal.Functor).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma whiskerLeft_\u03bc_\u03b4 (X Y : C) (T : D) : T \u25c1 \u03bc F X Y \u226b T \u25c1 \u03b4 F X Y = \ud835\udfd9 _\n:= by thisIsWrongLemmaNameXYZ\nrw [\u2190 MonoidalCategory.whiskerLeft_comp, \u03bc_\u03b4, MonoidalCategory.whiskerLeft_id]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=46, messages=[Message(data='expected token', pos=Position(line=1, column=44), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=46, i_end=199, 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.CategoryTheory.Monoidal.Functor).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma whiskerLeft_\u03bc_\u03b4 (X Y : C) (T : D) : T \u25c1 \u03bc F X Y \u226b T \u25c1 \u03b4 F X Y = \ud835\udfd9 _\n:= by thisIsWrongLemmaNameXYZ\nrw [\u2190 MonoidalCategory.whiskerLeft_comp, \u03bc_\u03b4, MonoidalCategory.whiskerLeft_id]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=46, messages=[Message(data='expected token', pos=Position(line=1, column=44), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=46, i_end=199, 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.CategoryTheory.Monoidal.Functor.whiskerLeft_\u03bc_\u03b4", "source": {"declaration": "Mathlib.CategoryTheory.Monoidal.Functor.whiskerLeft_\u03bc_\u03b4", "file": "Mathlib/CategoryTheory/Monoidal/Functor.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.CategoryTheory.Monoidal.Functor", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Monoidal/Functor.lean#L439", "span": "L439-L441"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem HasProdLocallyUniformly.hasProdLocallyUniformlyOn (h : HasProdLocallyUniformly f g) :\n HasProdLocallyUniformlyOn f g s", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 552, "declarations_count": 56, "diagnostics_count": 0, "duplicate_fingerprint": "6df695ccd9c90134", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 154, "lean_code_chars": 130, "lean_code_ratio": 0.2355, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 422, "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.Topology.Algebra.InfiniteSum.UniformOn).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem HasProdLocallyUniformly.hasProdLocallyUniformlyOn (h : HasProdLocallyUniformly f g) :\n HasProdLocallyUniformlyOn f g s\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.Topology.Algebra.InfiniteSum.UniformOn).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem HasProdLocallyUniformly.hasProdLocallyUniformlyOn (h : HasProdLocallyUniformly f g) :\n HasProdLocallyUniformlyOn f g s\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Topology.Algebra.InfiniteSum.UniformOn.HasProdLocallyUniformly", "source": {"declaration": "Mathlib.Topology.Algebra.InfiniteSum.UniformOn.HasProdLocallyUniformly", "file": "Mathlib/Topology/Algebra/InfiniteSum/UniformOn.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Topology.Algebra.InfiniteSum.UniformOn", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Topology/Algebra/InfiniteSum/UniformOn.lean#L412", "span": "L412-L415"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Algebra.Category.ModuleCat.Sheaf.hom_ext (L54-L56)\nlemma hom_ext {X Y : SheafOfModules.{v} R} {f g : X \u27f6 Y} (h : f.val = g.val) : f = g :=\nHom.ext h", "-- Mathlib.Algebra.Category.ModuleCat.Sheaf.id_val (L58-L59)\nlemma id_val (X : SheafOfModules.{v} R) : Hom.val (\ud835\udfd9 X) = \ud835\udfd9 X.val := rfl", "-- Mathlib.Algebra.Category.ModuleCat.Sheaf.comp_val (L61-L65)\nlemma comp_val {X Y Z : SheafOfModules.{v} R} (f : X \u27f6 Y) (g : Y \u27f6 Z) :\n (f \u226b g).val = f.val \u226b g.val := rfl\nvariable (R)\n/-- The forgetful functor `SheafOfModules.{v} R \u2964 PresheafOfModules R.val`. -/", "-- Mathlib.Algebra.Category.ModuleCat.Sheaf.forget (L67-L71)\ndef forget : SheafOfModules.{v} R \u2964 PresheafOfModules R.obj where\n obj F := F.val\nmap \u03c6 := \u03c6.val\n\n/-- The forget functor `SheafOfModules R \u2964 PresheafOfModules R.val` is fully faithful. -/", "-- Mathlib.Algebra.Category.ModuleCat.Sheaf.fullyFaithfulForget (L73-L75)\ndef fullyFaithfulForget : (forget.{v} R).FullyFaithful where\n preimage \u03c6 := \u27e8\u03c6\u27e9", "-- Mathlib.Algebra.Category.ModuleCat.Sheaf.evaluation (L84-L87)\ndef evaluation (X : C\u1d52\u1d56) : SheafOfModules.{v} R \u2964 ModuleCat.{v} (R.obj.obj X) :=\nforget _ \u22d9 PresheafOfModules.evaluation _ X\n\n/-- The forget functor `SheafOfModules R \u2964 Sheaf J AddCommGrpCat`. -/", "-- Mathlib.Algebra.Category.ModuleCat.Sheaf.add_val (L120-L122)\nlemma add_val {M N : SheafOfModules.{v} R} (f g : M \u27f6 N) :\n (f + g).val = f.val + g.val := rfl", "-- Mathlib.Algebra.Category.ModuleCat.Sheaf.sections (L134-L136)\nabbrev sections (M : SheafOfModules.{v} R) : Type _ := M.val.sections\n/-- The map `M.sections \u2192 N.sections` induced by a morphism `M \u27f6 N` of sheaves of modules. -/", "-- Mathlib.Algebra.Category.ModuleCat.Sheaf.sectionsMap (L137-L139)\nabbrev sectionsMap {M N : SheafOfModules.{v} R} (f : M \u27f6 N) (s : M.sections) : N.sections :=\nPresheafOfModules.sectionsMap f.val s", "-- Mathlib.Algebra.Category.ModuleCat.Sheaf.sectionsMap_comp (L141-L143)\nlemma sectionsMap_comp {M N P : SheafOfModules.{v} R} (f : M \u27f6 N) (g : N \u27f6 P) (s : M.sections) :\n sectionsMap (f \u226b g) s = sectionsMap g (sectionsMap f s) := rfl", "-- Mathlib.Algebra.Category.ModuleCat.Sheaf.sectionsMap_id (L145-L149)\nlemma sectionsMap_id {M : SheafOfModules.{v} R} (s : M.sections) :\n sectionsMap (\ud835\udfd9 M) s = s := rfl\nvariable (R) in\n/-- The functor which sends a sheaf of modules to its type of sections. -/", "-- Mathlib.Algebra.Category.ModuleCat.Sheaf.sectionsFunctor (L151-L158)\ndef sectionsFunctor : SheafOfModules.{v} R \u2964 Type _ where\n obj := sections\nmap f := sectionsMap f\n\nvariable [J.HasSheafCompose (forget\u2082 RingCat.{u} AddCommGrpCat.{u})]\n\nvariable (R) in\n/-- The obvious free sheaf of modules of rank `1`. -/", "-- Mathlib.Algebra.Category.ModuleCat.Sheaf.unitHomEquiv_apply_coe (L170-L172)\nlemma unitHomEquiv_apply_coe (M : SheafOfModules R) (f : unit R \u27f6 M) (X : C\u1d52\u1d56) :\n (M.unitHomEquiv f).val X = f.val.app X (1 : R.obj.obj X) := rfl", "-- Mathlib.Algebra.Category.ModuleCat.Sheaf.unitHomEquiv_comp_apply (L173-L176)\nlemma unitHomEquiv_comp_apply {M N : SheafOfModules.{u} R}\n (f : unit R \u27f6 M) (p : M \u27f6 N) :\n N.unitHomEquiv (f \u226b p) = sectionsMap p (M.unitHomEquiv f) := rfl", "-- Mathlib.Algebra.Category.ModuleCat.Sheaf.IsLocallySurjective (L190-L194)\nabbrev IsLocallySurjective : Prop :=\nPresheaf.IsLocallySurjective J ((PresheafOfModules.toPresheaf R).map f)\n\n/-- A morphism of presheaves of modules is locally injective\nif the underlying morphism of presheaves of abelian groups is. -/", "-- Mathlib.Algebra.Category.AlgCat.Basic.coe_of (L56-L61)\nlemma coe_of (X : Type v) [Ring X] [Algebra R X] : (of R X : Type v) = X :=\nrfl\n\nvariable {R} in\nset_option backward.privateInPublic true in\n/-- The type of morphisms in `AlgCat R`. -/", "-- Mathlib.Algebra.Category.AlgCat.Basic.of (L53-L55)\nabbrev of (X : Type v) [Ring X] [Algebra R X] : AlgCat.{v} R :=\n\u27e8X\u27e9", "-- Mathlib.Algebra.Category.AlgCat.Basic.ofHom_apply (L139-L141)\nlemma ofHom_apply {R : Type u} [CommRing R] {X Y : Type v} [Ring X] [Algebra R X] [Ring Y]\n [Algebra R Y] (f : X \u2192\u2090[R] Y) (x : X) : ofHom f x = f x := rfl", "-- Mathlib.Algebra.Category.AlgCat.Basic.ofHom_hom (L127-L129)\nlemma ofHom_hom {A B : AlgCat.{v} R} (f : A \u27f6 B) :\n ofHom (Hom.hom f) = f := rfl", "-- Mathlib.Algebra.Category.AlgCat.Basic.hom_id (L104-L106)\nlemma hom_id {A : AlgCat.{v} R} : (\ud835\udfd9 A : A \u27f6 A).hom = AlgHom.id R A := rfl\n/- Provided for rewriting. -/", "-- Mathlib.Algebra.Category.AlgCat.Basic.id_apply (L107-L109)\nlemma id_apply (A : AlgCat.{v} R) (a : A) :\n (\ud835\udfd9 A : A \u27f6 A) a = a := by simp", "-- Mathlib.Algebra.Category.AlgCat.Basic.ofHom_comp (L134-L138)\nlemma ofHom_comp {X Y Z : Type v} [Ring X] [Ring Y] [Ring Z] [Algebra R X] [Algebra R Y]\n [Algebra R Z] (f : X \u2192\u2090[R] Y) (g : Y \u2192\u2090[R] Z) :\n ofHom (g.comp f) = ofHom f \u226b ofHom g :=\nrfl", "-- Mathlib.Algebra.Category.AlgCat.Basic.ofHom (L88-L93)\nabbrev ofHom {A B : Type v} [Ring A] [Ring B] [Algebra R A] [Algebra R B] (f : A \u2192\u2090[R] B) :\n of R A \u27f6 of R B :=\nConcreteCategory.ofHom (C := AlgCat R) f\n\nvariable {R} in\n/-- Use the `ConcreteCategory.hom` projection for `@[simps]` lemmas. -/", "-- Mathlib.Algebra.Category.AlgCat.Basic.hom_comp (L111-L114)\nlemma hom_comp {A B C : AlgCat.{v} R} (f : A \u27f6 B) (g : B \u27f6 C) :\n (f \u226b g).hom = g.hom.comp f.hom := rfl\n/- Provided for rewriting. -/", "-- Mathlib.Algebra.Category.AlgCat.Basic.hom_ofHom (L123-L125)\nlemma hom_ofHom {R : Type u} [CommRing R] {X Y : Type v} [Ring X] [Algebra R X] [Ring Y]\n [Algebra R Y] (f : X \u2192\u2090[R] Y) : (ofHom f).hom = f := rfl", "-- Mathlib.Algebra.Category.AlgCat.Basic.forget\u2082_module_obj (L174-L177)\nlemma forget\u2082_module_obj (X : AlgCat.{v} R) :\n (forget\u2082 (AlgCat.{v} R) (ModuleCat.{v} R)).obj X = ModuleCat.of R X :=\nrfl", "-- Mathlib.Algebra.Category.AlgCat.Basic.comp_apply (L115-L117)\nlemma comp_apply {A B C : AlgCat.{v} R} (f : A \u27f6 B) (g : B \u27f6 C) (a : A) :\n (f \u226b g) a = g (f a) := by simp", "-- Mathlib.Algebra.Category.AlgCat.Basic.free (L185-L190)\ndef free : Type u \u2964 AlgCat.{u} R where\n obj S := of R (FreeAlgebra R S)\nmap f := ofHom <| FreeAlgebra.lift _ <| FreeAlgebra.\u03b9 _ \u2218 f\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The free/forget adjunction for `R`-algebras. -/", "-- Mathlib.Algebra.Category.AlgCat.Basic.adj (L191-L198)\ndef adj : free.{u} R \u22a3 forget (AlgCat.{u} R) :=\nAdjunction.mkOfHomEquiv\n { homEquiv := fun _ _ =>\n { toFun := fun f \u21a6 (FreeAlgebra.lift _).symm f.hom\n invFun := fun f \u21a6 ofHom <| (FreeAlgebra.lift _) f\n left_inv := fun f \u21a6 by aesop\n right_inv := fun f \u21a6 by simp [forget_obj] } }", "-- Mathlib.Algebra.Category.AlgCat.Basic.forget_map (L153-L156)\nlemma forget_map {A B : AlgCat.{v} R} (f : A \u27f6 B) :\n (forget (AlgCat.{v} R)).map f = (f : _ \u2192 _) :=\nrfl", "-- Mathlib.Algebra.Category.AlgCat.Basic.hom_ext (L119-L121)\nlemma hom_ext {A B : AlgCat.{v} R} {f g : A \u27f6 B} (hf : f.hom = g.hom) : f = g :=\nHom.ext hf", "-- Mathlib.Algebra.Category.AlgCat.Basic.inv_hom_apply (L142-L144)\nlemma inv_hom_apply {A B : AlgCat.{v} R} (e : A \u2245 B) (x : A) : e.inv (e.hom x) = x := by\nsimp", "-- Mathlib.Algebra.Category.AlgCat.Basic.forget_obj (L151-L152)\nlemma forget_obj {A : AlgCat.{v} R} : (forget (AlgCat.{v} R)).obj A = A := rfl", "-- Mathlib.Algebra.Category.AlgCat.Basic.Hom (L83-L87)\nabbrev Hom.hom {A B : AlgCat.{v} R} (f : Hom A B) :=\nConcreteCategory.hom (C := AlgCat R) f\n\nvariable {R} in\n/-- Typecheck an `AlgHom` as a morphism in `AlgCat`. -/", "-- Mathlib.Algebra.Category.AlgCat.Basic.hom_inv_apply (L145-L147)\nlemma hom_inv_apply {A B : AlgCat.{v} R} (e : A \u2245 B) (x : B) : e.hom (e.inv x) = x := by\nsimp", "-- Mathlib.Algebra.Category.AlgCat.Basic.hasForgetToModule (L168-L172)\ninstance hasForgetToModule : HasForget\u2082 (AlgCat.{v} R) (ModuleCat.{v} R) where\n forget\u2082 :=\n{ obj := fun M => ModuleCat.of R M\n map := fun f => ModuleCat.ofHom f.hom.toLinearMap }", "-- Mathlib.Algebra.Category.AlgCat.Basic.forget\u2082_module_map (L179-L183)\nlemma forget\u2082_module_map {X Y : AlgCat.{v} R} (f : X \u27f6 Y) :\n (forget\u2082 (AlgCat.{v} R) (ModuleCat.{v} R)).map f = ModuleCat.ofHom f.hom.toLinearMap :=\nrfl\n\n/-- The \"free algebra\" functor, sending a type `S` to the free algebra on `S`. -/", "-- Mathlib.Algebra.Category.AlgCat.Basic.hasForgetToRing (L163-L167)\ninstance hasForgetToRing : HasForget\u2082 (AlgCat.{v} R) RingCat.{v} where\n forget\u2082 :=\n{ obj := fun A => RingCat.of A\n map := fun f => RingCat.ofHom f.hom.toRingHom }", "-- Mathlib.Algebra.Category.AlgCat.Basic.AlgEquiv (L208-L215)\ndef AlgEquiv.toAlgebraIso {g\u2081 : Ring X\u2081} {g\u2082 : Ring X\u2082} {m\u2081 : Algebra R X\u2081} {m\u2082 : Algebra R X\u2082}\n (e : X\u2081 \u2243\u2090[R] X\u2082) : AlgCat.of R X\u2081 \u2245 AlgCat.of R X\u2082 where\n hom := AlgCat.ofHom (e : X\u2081 \u2192\u2090[R] X\u2082)\ninv := AlgCat.ofHom (e.symm : X\u2082 \u2192\u2090[R] X\u2081)\n\nnamespace CategoryTheory.Iso\n\n/-- Build an `AlgEquiv` from an isomorphism in the category `AlgCat R`. -/", "-- Mathlib.Algebra.Category.AlgCat.Basic.ofHom_id (L131-L132)\nlemma ofHom_id {X : Type v} [Ring X] [Algebra R X] : ofHom (AlgHom.id R X) = \ud835\udfd9 (of R X) := rfl"], "statement": "lemma unitHomEquiv_symm_comp {M N : SheafOfModules.{u} R} (s : M.sections) (p : M \u27f6 N) :\n M.unitHomEquiv.symm s \u226b p = N.unitHomEquiv.symm (sectionsMap p s)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 10511, "declarations_count": 1232, "diagnostics_count": 0, "duplicate_fingerprint": "1fcb35ed64b756a0", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 4079, "lean_code_chars": 9002, "lean_code_ratio": 0.8564, "length_bucket": "medium", "line_count": 342, "natural_language_chars": 1509, "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.Algebra.Category.ModuleCat.Sheaf).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma unitHomEquiv_symm_comp {M N : SheafOfModules.{u} R} (s : M.sections) (p : M \u27f6 N) :\n M.unitHomEquiv.symm s \u226b p = N.unitHomEquiv.symm (sectionsMap p s)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.hom_ext (L54-L56)\nlemma hom_ext {X Y : SheafOfModules.{v} R} {f g : X \u27f6 Y} (h : f.val = g.val) : f = g :=\nHom.ext h\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.id_val (L58-L59)\nlemma id_val (X : SheafOfModules.{v} R) : Hom.val (\ud835\udfd9 X) = \ud835\udfd9 X.val := rfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.comp_val (L61-L65)\nlemma comp_val {X Y Z : SheafOfModules.{v} R} (f : X \u27f6 Y) (g : Y \u27f6 Z) :\n (f \u226b g).val = f.val \u226b g.val := rfl\nvariable (R)\n/-- The forgetful functor `SheafOfModules.{v} R \u2964 PresheafOfModules R.val`. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.forget (L67-L71)\ndef forget : SheafOfModules.{v} R \u2964 PresheafOfModules R.obj where\n obj F := F.val\nmap \u03c6 := \u03c6.val\n\n/-- The forget functor `SheafOfModules R \u2964 PresheafOfModules R.val` is fully faithful. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.fullyFaithfulForget (L73-L75)\ndef fullyFaithfulForget : (forget.{v} R).FullyFaithful where\n preimage \u03c6 := \u27e8\u03c6\u27e9\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.evaluation (L84-L87)\ndef evaluation (X : C\u1d52\u1d56) : SheafOfModules.{v} R \u2964 ModuleCat.{v} (R.obj.obj X) :=\nforget _ \u22d9 PresheafOfModules.evaluation _ X\n\n/-- The forget functor `SheafOfModules R \u2964 Sheaf J AddCommGrpCat`. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.add_val (L120-L122)\nlemma add_val {M N : SheafOfModules.{v} R} (f g : M \u27f6 N) :\n (f + g).val = f.val + g.val := rfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.sections (L134-L136)\nabbrev sections (M : SheafOfModules.{v} R) : Type _ := M.val.sections\n/-- The map `M.sections \u2192 N.sections` induced by a morphism `M \u27f6 N` of sheaves of modules. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.sectionsMap (L137-L139)\nabbrev sectionsMap {M N : SheafOfModules.{v} R} (f : M \u27f6 N) (s : M.sections) : N.sections :=\nPresheafOfModules.sectionsMap f.val s\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.sectionsMap_comp (L141-L143)\nlemma sectionsMap_comp {M N P : SheafOfModules.{v} R} (f : M \u27f6 N) (g : N \u27f6 P) (s : M.sections) :\n sectionsMap (f \u226b g) s = sectionsMap g (sectionsMap f s) := rfl\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.sectionsMap_id (L145-L149)\nlemma sectionsMap_id {M : SheafOfModules.{v} R} (s : M.sections) :\n sectionsMap (\ud835\udfd9 M) s = s := rfl\nvariable (R) in\n/-- The functor which sends a sheaf of modules to its type of sections. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.sectionsFunctor (L151-L158)\ndef sectionsFunctor : SheafOfModules.{v} R \u2964 Type _ where\n obj := sections\nmap f := sectionsMap f\n\nvariable [J.HasSheafCompose (forget\u2082 RingCat.{u} AddCommGrpCat.{u})]\n\nvariable (R) in\n/-- The obvious free sheaf of modules of rank `1`. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.unitHomEquiv_apply_coe (L170-L172)\nlemma unitHomEquiv_apply_coe (M : SheafOfModules R) (f : unit R \u27f6 M) (X : C\u1d52\u1d56) :\n (M.unitHomEquiv f).val X = f.val.app X (1 : R.obj.obj X) := rfl\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.unitHomEquiv_comp_apply (L173-L176)\nlemma unitHomEquiv_comp_apply {M N : SheafOfModules.{u} R}\n (f : unit R \u27f6 M) (p : M \u27f6 N) :\n N.unitHomEquiv (f \u226b p) = sectionsMap p (M.unitHomEquiv f) := rfl\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.IsLocallySurjective (L190-L194)\nabbrev IsLocallySurjective : Prop :=\nPresheaf.IsLocallySurjective J ((PresheafOfModules.toPresheaf R).map f)\n\n/-- A morphism of presheaves of modules is locally injective\nif the underlying morphism of presheaves of abelian groups is. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.coe_of (L56-L61)\nlemma coe_of (X : Type v) [Ring X] [Algebra R X] : (of R X : Type v) = X :=\nrfl\n\nvariable {R} in\nset_option backward.privateInPublic true in\n/-- The type of morphisms in `AlgCat R`. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.of (L53-L55)\nabbrev of (X : Type v) [Ring X] [Algebra R X] : AlgCat.{v} R :=\n\u27e8X\u27e9\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.ofHom_apply (L139-L141)\nlemma ofHom_apply {R : Type u} [CommRing R] {X Y : Type v} [Ring X] [Algebra R X] [Ring Y]\n [Algebra R Y] (f : X \u2192\u2090[R] Y) (x : X) : ofHom f x = f x := rfl\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.ofHom_hom (L127-L129)\nlemma ofHom_hom {A B : AlgCat.{v} R} (f : A \u27f6 B) :\n ofHom (Hom.hom f) = f := rfl\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.hom_id (L104-L106)\nlemma hom_id {A : AlgCat.{v} R} : (\ud835\udfd9 A : A \u27f6 A).hom = AlgHom.id R A := rfl\n/- Provided for rewriting. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.id_apply (L107-L109)\nlemma id_apply (A : AlgCat.{v} R) (a : A) :\n (\ud835\udfd9 A : A \u27f6 A) a = a := by simp\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.ofHom_comp (L134-L138)\nlemma ofHom_comp {X Y Z : Type v} [Ring X] [Ring Y] [Ring Z] [Algebra R X] [Algebra R Y]\n [Algebra R Z] (f : X \u2192\u2090[R] Y) (g : Y \u2192\u2090[R] Z) :\n ofHom (g.comp f) = ofHom f \u226b ofHom g :=\nrfl\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.ofHom (L88-L93)\nabbrev ofHom {A B : Type v} [Ring A] [Ring B] [Algebra R A] [Algebra R B] (f : A \u2192\u2090[R] B) :\n of R A \u27f6 of R B :=\nConcreteCategory.ofHom (C := AlgCat R) f\n\nvariable {R} in\n/-- Use the `ConcreteCategory.hom` projection for `@[simps]` lemmas. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.hom_comp (L111-L114)\nlemma hom_comp {A B C : AlgCat.{v} R} (f : A \u27f6 B) (g : B \u27f6 C) :\n (f \u226b g).hom = g.hom.comp f.hom := rfl\n/- Provided for rewriting. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.hom_ofHom (L123-L125)\nlemma hom_ofHom {R : Type u} [CommRing R] {X Y : Type v} [Ring X] [Algebra R X] [Ring Y]\n [Algebra R Y] (f : X \u2192\u2090[R] Y) : (ofHom f).hom = f := rfl\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.forget\u2082_module_obj (L174-L177)\nlemma forget\u2082_module_obj (X : AlgCat.{v} R) :\n (forget\u2082 (AlgCat.{v} R) (ModuleCat.{v} R)).obj X = ModuleCat.of R X :=\nrfl\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.comp_apply (L115-L117)\nlemma comp_apply {A B C : AlgCat.{v} R} (f : A \u27f6 B) (g : B \u27f6 C) (a : A) :\n (f \u226b g) a = g (f a) := by simp\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.free (L185-L190)\ndef free : Type u \u2964 AlgCat.{u} R where\n obj S := of R (FreeAlgebra R S)\nmap f := ofHom <| FreeAlgebra.lift _ <| FreeAlgebra.\u03b9 _ \u2218 f\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The free/forget adjunction for `R`-algebras. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.adj (L191-L198)\ndef adj : free.{u} R \u22a3 forget (AlgCat.{u} R) :=\nAdjunction.mkOfHomEquiv\n { homEquiv := fun _ _ =>\n { toFun := fun f \u21a6 (FreeAlgebra.lift _).symm f.hom\n invFun := fun f \u21a6 ofHom <| (FreeAlgebra.lift _) f\n left_inv := fun f \u21a6 by aesop\n right_inv := fun f \u21a6 by simp [forget_obj] } }\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.forget_map (L153-L156)\nlemma forget_map {A B : AlgCat.{v} R} (f : A \u27f6 B) :\n (forget (AlgCat.{v} R)).map f = (f : _ \u2192 _) :=\nrfl\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.hom_ext (L119-L121)\nlemma hom_ext {A B : AlgCat.{v} R} {f g : A \u27f6 B} (hf : f.hom = g.hom) : f = g :=\nHom.ext hf\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.inv_hom_apply (L142-L144)\nlemma inv_hom_apply {A B : AlgCat.{v} R} (e : A \u2245 B) (x : A) : e.inv (e.hom x) = x := by\nsimp\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.forget_obj (L151-L152)\nlemma forget_obj {A : AlgCat.{v} R} : (forget (AlgCat.{v} R)).obj A = A := rfl\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.Hom (L83-L87)\nabbrev Hom.hom {A B : AlgCat.{v} R} (f : Hom A B) :=\nConcreteCategory.hom (C := AlgCat R) f\n\nvariable {R} in\n/-- Typecheck an `AlgHom` as a morphism in `AlgCat`. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.hom_inv_apply (L145-L147)\nlemma hom_inv_apply {A B : AlgCat.{v} R} (e : A \u2245 B) (x : B) : e.hom (e.inv x) = x := by\nsimp\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.hasForgetToModule (L168-L172)\ninstance hasForgetToModule : HasForget\u2082 (AlgCat.{v} R) (ModuleCat.{v} R) where\n forget\u2082 :=\n{ obj := fun M => ModuleCat.of R M\n map := fun f => ModuleCat.ofHom f.hom.toLinearMap }\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.forget\u2082_module_map (L179-L183)\nlemma forget\u2082_module_map {X Y : AlgCat.{v} R} (f : X \u27f6 Y) :\n (forget\u2082 (AlgCat.{v} R) (ModuleCat.{v} R)).map f = ModuleCat.ofHom f.hom.toLinearMap :=\nrfl\n\n/-- The \"free algebra\" functor, sending a type `S` to the free algebra on `S`. -/\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.hasForgetToRing (L163-L167)\ninstance hasForgetToRing : HasForget\u2082 (AlgCat.{v} R) RingCat.{v} where\n forget\u2082 :=\n{ obj := fun A => RingCat.of A\n map := fun f => RingCat.ofHom f.hom.toRingHom }\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.AlgEquiv (L208-L215)\ndef AlgEquiv.toAlgebraIso {g\u2081 : Ring X\u2081} {g\u2082 : Ring X\u2082} {m\u2081 : Algebra R X\u2081} {m\u2082 : Algebra R X\u2082}\n (e : X\u2081 \u2243\u2090[R] X\u2082) : AlgCat.of R X\u2081 \u2245 AlgCat.of R X\u2082 where\n hom := AlgCat.ofHom (e : X\u2081 \u2192\u2090[R] X\u2082)\ninv := AlgCat.ofHom (e.symm : X\u2082 \u2192\u2090[R] X\u2081)\n\nnamespace CategoryTheory.Iso\n\n/-- Build an `AlgEquiv` from an isomorphism in the category `AlgCat R`. -/\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.ofHom_id (L131-L132)\nlemma ofHom_id {X : Type v} [Ring X] [Algebra R X] : ofHom (AlgHom.id R X) = \ud835\udfd9 (of R X) := rfl\n```\n", "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.Algebra.Category.ModuleCat.Sheaf).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma unitHomEquiv_symm_comp {M N : SheafOfModules.{u} R} (s : M.sections) (p : M \u27f6 N) :\n M.unitHomEquiv.symm s \u226b p = N.unitHomEquiv.symm (sectionsMap p s)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.hom_ext (L54-L56)\nlemma hom_ext {X Y : SheafOfModules.{v} R} {f g : X \u27f6 Y} (h : f.val = g.val) : f = g :=\nHom.ext h\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.id_val (L58-L59)\nlemma id_val (X : SheafOfModules.{v} R) : Hom.val (\ud835\udfd9 X) = \ud835\udfd9 X.val := rfl\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.comp_val (L61-L65)\nlemma comp_val {X Y Z : SheafOfModules.{v} R} (f : X \u27f6 Y) (g : Y \u27f6 Z) :\n (f \u226b g).val = f.val \u226b g.val := rfl\nvariable (R)\n/-- The forgetful functor `SheafOfModules.{v} R \u2964 PresheafOfModules R.val`. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.forget (L67-L71)\ndef forget : SheafOfModules.{v} R \u2964 PresheafOfModules R.obj where\n obj F := F.val\nmap \u03c6 := \u03c6.val\n\n/-- The forget functor `SheafOfModules R \u2964 PresheafOfModules R.val` is fully faithful. -/\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.fullyFaithfulForget (L73-L75)\ndef fullyFaithfulForget : (forget.{v} R).FullyFaithful where\n preimage \u03c6 := \u27e8\u03c6\u27e9\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.evaluation (L84-L87)\ndef evaluation (X : C\u1d52\u1d56) : SheafOfModules.{v} R \u2964 ModuleCat.{v} (R.obj.obj X) :=\nforget _ \u22d9 PresheafOfModules.evaluation _ X\n\n/-- The forget functor `SheafOfModules R \u2964 Sheaf J AddCommGrpCat`. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.add_val (L120-L122)\nlemma add_val {M N : SheafOfModules.{v} R} (f g : M \u27f6 N) :\n (f + g).val = f.val + g.val := rfl\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.sections (L134-L136)\nabbrev sections (M : SheafOfModules.{v} R) : Type _ := M.val.sections\n/-- The map `M.sections \u2192 N.sections` induced by a morphism `M \u27f6 N` of sheaves of modules. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.sectionsMap (L137-L139)\nabbrev sectionsMap {M N : SheafOfModules.{v} R} (f : M \u27f6 N) (s : M.sections) : N.sections :=\nPresheafOfModules.sectionsMap f.val s\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.sectionsMap_comp (L141-L143)\nlemma sectionsMap_comp {M N P : SheafOfModules.{v} R} (f : M \u27f6 N) (g : N \u27f6 P) (s : M.sections) :\n sectionsMap (f \u226b g) s = sectionsMap g (sectionsMap f s) := rfl\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.sectionsMap_id (L145-L149)\nlemma sectionsMap_id {M : SheafOfModules.{v} R} (s : M.sections) :\n sectionsMap (\ud835\udfd9 M) s = s := rfl\nvariable (R) in\n/-- The functor which sends a sheaf of modules to its type of sections. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.sectionsFunctor (L151-L158)\ndef sectionsFunctor : SheafOfModules.{v} R \u2964 Type _ where\n obj := sections\nmap f := sectionsMap f\n\nvariable [J.HasSheafCompose (forget\u2082 RingCat.{u} AddCommGrpCat.{u})]\n\nvariable (R) in\n/-- The obvious free sheaf of modules of rank `1`. -/\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.unitHomEquiv_apply_coe (L170-L172)\nlemma unitHomEquiv_apply_coe (M : SheafOfModules R) (f : unit R \u27f6 M) (X : C\u1d52\u1d56) :\n (M.unitHomEquiv f).val X = f.val.app X (1 : R.obj.obj X) := rfl\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.unitHomEquiv_comp_apply (L173-L176)\nlemma unitHomEquiv_comp_apply {M N : SheafOfModules.{u} R}\n (f : unit R \u27f6 M) (p : M \u27f6 N) :\n N.unitHomEquiv (f \u226b p) = sectionsMap p (M.unitHomEquiv f) := rfl\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.Category.ModuleCat.Sheaf.IsLocallySurjective (L190-L194)\nabbrev IsLocallySurjective : Prop :=\nPresheaf.IsLocallySurjective J ((PresheafOfModules.toPresheaf R).map f)\n\n/-- A morphism of presheaves of modules is locally injective\nif the underlying morphism of presheaves of abelian groups is. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.coe_of (L56-L61)\nlemma coe_of (X : Type v) [Ring X] [Algebra R X] : (of R X : Type v) = X :=\nrfl\n\nvariable {R} in\nset_option backward.privateInPublic true in\n/-- The type of morphisms in `AlgCat R`. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.of (L53-L55)\nabbrev of (X : Type v) [Ring X] [Algebra R X] : AlgCat.{v} R :=\n\u27e8X\u27e9\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.ofHom_apply (L139-L141)\nlemma ofHom_apply {R : Type u} [CommRing R] {X Y : Type v} [Ring X] [Algebra R X] [Ring Y]\n [Algebra R Y] (f : X \u2192\u2090[R] Y) (x : X) : ofHom f x = f x := rfl\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.ofHom_hom (L127-L129)\nlemma ofHom_hom {A B : AlgCat.{v} R} (f : A \u27f6 B) :\n ofHom (Hom.hom f) = f := rfl\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.hom_id (L104-L106)\nlemma hom_id {A : AlgCat.{v} R} : (\ud835\udfd9 A : A \u27f6 A).hom = AlgHom.id R A := rfl\n/- Provided for rewriting. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.id_apply (L107-L109)\nlemma id_apply (A : AlgCat.{v} R) (a : A) :\n (\ud835\udfd9 A : A \u27f6 A) a = a := by simp\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.ofHom_comp (L134-L138)\nlemma ofHom_comp {X Y Z : Type v} [Ring X] [Ring Y] [Ring Z] [Algebra R X] [Algebra R Y]\n [Algebra R Z] (f : X \u2192\u2090[R] Y) (g : Y \u2192\u2090[R] Z) :\n ofHom (g.comp f) = ofHom f \u226b ofHom g :=\nrfl\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.ofHom (L88-L93)\nabbrev ofHom {A B : Type v} [Ring A] [Ring B] [Algebra R A] [Algebra R B] (f : A \u2192\u2090[R] B) :\n of R A \u27f6 of R B :=\nConcreteCategory.ofHom (C := AlgCat R) f\n\nvariable {R} in\n/-- Use the `ConcreteCategory.hom` projection for `@[simps]` lemmas. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.hom_comp (L111-L114)\nlemma hom_comp {A B C : AlgCat.{v} R} (f : A \u27f6 B) (g : B \u27f6 C) :\n (f \u226b g).hom = g.hom.comp f.hom := rfl\n/- Provided for rewriting. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.hom_ofHom (L123-L125)\nlemma hom_ofHom {R : Type u} [CommRing R] {X Y : Type v} [Ring X] [Algebra R X] [Ring Y]\n [Algebra R Y] (f : X \u2192\u2090[R] Y) : (ofHom f).hom = f := rfl\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.forget\u2082_module_obj (L174-L177)\nlemma forget\u2082_module_obj (X : AlgCat.{v} R) :\n (forget\u2082 (AlgCat.{v} R) (ModuleCat.{v} R)).obj X = ModuleCat.of R X :=\nrfl\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.comp_apply (L115-L117)\nlemma comp_apply {A B C : AlgCat.{v} R} (f : A \u27f6 B) (g : B \u27f6 C) (a : A) :\n (f \u226b g) a = g (f a) := by simp\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.free (L185-L190)\ndef free : Type u \u2964 AlgCat.{u} R where\n obj S := of R (FreeAlgebra R S)\nmap f := ofHom <| FreeAlgebra.lift _ <| FreeAlgebra.\u03b9 _ \u2218 f\n\nset_option backward.isDefEq.respectTransparency false in\n/-- The free/forget adjunction for `R`-algebras. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.adj (L191-L198)\ndef adj : free.{u} R \u22a3 forget (AlgCat.{u} R) :=\nAdjunction.mkOfHomEquiv\n { homEquiv := fun _ _ =>\n { toFun := fun f \u21a6 (FreeAlgebra.lift _).symm f.hom\n invFun := fun f \u21a6 ofHom <| (FreeAlgebra.lift _) f\n left_inv := fun f \u21a6 by aesop\n right_inv := fun f \u21a6 by simp [forget_obj] } }\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.forget_map (L153-L156)\nlemma forget_map {A B : AlgCat.{v} R} (f : A \u27f6 B) :\n (forget (AlgCat.{v} R)).map f = (f : _ \u2192 _) :=\nrfl\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.hom_ext (L119-L121)\nlemma hom_ext {A B : AlgCat.{v} R} {f g : A \u27f6 B} (hf : f.hom = g.hom) : f = g :=\nHom.ext hf\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.inv_hom_apply (L142-L144)\nlemma inv_hom_apply {A B : AlgCat.{v} R} (e : A \u2245 B) (x : A) : e.inv (e.hom x) = x := by\nsimp\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.forget_obj (L151-L152)\nlemma forget_obj {A : AlgCat.{v} R} : (forget (AlgCat.{v} R)).obj A = A := rfl\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.Hom (L83-L87)\nabbrev Hom.hom {A B : AlgCat.{v} R} (f : Hom A B) :=\nConcreteCategory.hom (C := AlgCat R) f\n\nvariable {R} in\n/-- Typecheck an `AlgHom` as a morphism in `AlgCat`. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.hom_inv_apply (L145-L147)\nlemma hom_inv_apply {A B : AlgCat.{v} R} (e : A \u2245 B) (x : B) : e.hom (e.inv x) = x := by\nsimp\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.hasForgetToModule (L168-L172)\ninstance hasForgetToModule : HasForget\u2082 (AlgCat.{v} R) (ModuleCat.{v} R) where\n forget\u2082 :=\n{ obj := fun M => ModuleCat.of R M\n map := fun f => ModuleCat.ofHom f.hom.toLinearMap }\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.forget\u2082_module_map (L179-L183)\nlemma forget\u2082_module_map {X Y : AlgCat.{v} R} (f : X \u27f6 Y) :\n (forget\u2082 (AlgCat.{v} R) (ModuleCat.{v} R)).map f = ModuleCat.ofHom f.hom.toLinearMap :=\nrfl\n\n/-- The \"free algebra\" functor, sending a type `S` to the free algebra on `S`. -/\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.hasForgetToRing (L163-L167)\ninstance hasForgetToRing : HasForget\u2082 (AlgCat.{v} R) RingCat.{v} where\n forget\u2082 :=\n{ obj := fun A => RingCat.of A\n map := fun f => RingCat.ofHom f.hom.toRingHom }\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.AlgEquiv (L208-L215)\ndef AlgEquiv.toAlgebraIso {g\u2081 : Ring X\u2081} {g\u2082 : Ring X\u2082} {m\u2081 : Algebra R X\u2081} {m\u2082 : Algebra R X\u2082}\n (e : X\u2081 \u2243\u2090[R] X\u2082) : AlgCat.of R X\u2081 \u2245 AlgCat.of R X\u2082 where\n hom := AlgCat.ofHom (e : X\u2081 \u2192\u2090[R] X\u2082)\ninv := AlgCat.ofHom (e.symm : X\u2082 \u2192\u2090[R] X\u2081)\n\nnamespace CategoryTheory.Iso\n\n/-- Build an `AlgEquiv` from an isomorphism in the category `AlgCat R`. -/\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Algebra.Category.AlgCat.Basic.ofHom_id (L131-L132)\nlemma ofHom_id {X : Type v} [Ring X] [Algebra R X] : ofHom (AlgHom.id R X) = \ud835\udfd9 (of R X) := rfl\n```\n[/INST]", "sample_id": "C-Mathlib.Algebra.Category.ModuleCat.Sheaf.unitHomEquiv_symm_comp", "source": {"declaration": "Mathlib.Algebra.Category.ModuleCat.Sheaf.unitHomEquiv_symm_comp", "file": "Mathlib/Algebra/Category/ModuleCat/Sheaf.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Algebra.Category.ModuleCat.Sheaf", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Category/ModuleCat/Sheaf.lean#L177", "span": "L177-L189"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "def IsTorsion\n:= thisIsWrongLemmaNameXYZ\n\u2200 g : G, IsOfFinOrder g\n\n/-- A monoid is not a torsion monoid if it has an element of infinite order. -/", "diagnostic": "[CompilationUnit(i_begin=0, i_end=41, messages=[Message(data='Unknown identifier `thisIsWrongLemmaNameXYZ`', pos=Position(line=2, column=3), pos_end=Position(line=2, column=26), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=41, i_end=147, messages=[Message(data=\"unexpected token '\u2200'; expected command\", pos=Position(line=3, column=0), pos_end=Position(line=3, column=1), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=5, column=79), 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": 1395, "declarations_count": 153, "diagnostics_count": 1, "duplicate_fingerprint": "e9ed2e2c5ca295ae", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 391, "lean_code_chars": 146, "lean_code_ratio": 0.1047, "length_bucket": "tiny", "line_count": 16, "natural_language_chars": 1249, "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.GroupTheory.Torsion).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef IsTorsion\n:= thisIsWrongLemmaNameXYZ\n\u2200 g : G, IsOfFinOrder g\n\n/-- A monoid is not a torsion monoid if it has an element of infinite order. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=41, messages=[Message(data='Unknown identifier `thisIsWrongLemmaNameXYZ`', pos=Position(line=2, column=3), pos_end=Position(line=2, column=26), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=41, i_end=147, messages=[Message(data=\"unexpected token '\u2200'; expected command\", pos=Position(line=3, column=0), pos_end=Position(line=3, column=1), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=5, 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.GroupTheory.Torsion).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef IsTorsion\n:= thisIsWrongLemmaNameXYZ\n\u2200 g : G, IsOfFinOrder g\n\n/-- A monoid is not a torsion monoid if it has an element of infinite order. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=41, messages=[Message(data='Unknown identifier `thisIsWrongLemmaNameXYZ`', pos=Position(line=2, column=3), pos_end=Position(line=2, column=26), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=41, i_end=147, messages=[Message(data=\"unexpected token '\u2200'; expected command\", pos=Position(line=3, column=0), pos_end=Position(line=3, column=1), severity=, kind=None), Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=5, 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.GroupTheory.Torsion.IsTorsion", "source": {"declaration": "Mathlib.GroupTheory.Torsion.IsTorsion", "file": "Mathlib/GroupTheory/Torsion.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.GroupTheory.Torsion", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/GroupTheory/Torsion.lean#L55", "span": "L55-L58"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Algebra.Lie.Derivation.BaseChange.ofDerivation (L37-L56)\ndef ofDerivation : Derivation R A A \u2192\u2097\u2045R\u2046 LieDerivation R (A \u2297[R] L) (A \u2297[R] L) where\n toFun d :=\n{ toFun := d.rTensor L\n map_add' := by simp\n map_smul' := by simp\n leibniz' x y := by\n simp only [LinearMap.coe_mk, AddHom.coe_mk]\n refine x.induction_on (by simp) (fun _ l \u21a6 ?_) (fun _ _ h1 h2 \u21a6 ?_)\n \u00b7 refine y.induction_on (by simp) (fun _ l' \u21a6 ?_) (fun _ _ h1 h2 \u21a6 ?_)\n \u00b7 simp [\u2190 lie_skew l' l, -lie_skew, add_tmul, tmul_neg]\n \u00b7 simp [h1, h2, sub_add_sub_comm]\n \u00b7 simp [h1, h2, sub_add_sub_comm] }\n map_add' _ _ := by ext; simp\n map_smul' _ _ := by ext; simp\n map_lie' {_ _} := by\n ext z\n refine z.induction_on (by simp) (by simp [sub_tmul]) (fun _ _ hx hy \u21a6 ?_)\n simp_all\n abel", "-- Mathlib.Algebra.Lie.Derivation.BaseChange.ofDerivation_apply (L58-L64)\nlemma ofDerivation_apply (d : Derivation R A A) (x : A \u2297[R] L) :\n ofDerivation L d x = d.toLinearMap.rTensor L x :=\nrfl\n\nvariable (A) in\n/-- A Lie derivation of an `R-`Lie algebra `L`, induces a Lie derivation of `A \u2297[R] L` for any\nAlgebra `A` over `R`. -/", "-- Mathlib.Algebra.Lie.Derivation.BaseChange.ofLieDerivation_apply (L92-L96)\nlemma ofLieDerivation_apply (d : LieDerivation R L L) (x : A \u2297[R] L) :\n ofLieDerivation A d x = d.toLinearMap.lTensor A x :=\nrfl\n\nend Lie.Derivation", "-- Mathlib.Algebra.Lie.Abelian.mem_maxTrivSubmodule (L172-L174)\ntheorem mem_maxTrivSubmodule (m : M) : m \u2208 maxTrivSubmodule R L M \u2194 \u2200 x : L, \u2045x, m\u2046 = 0 :=\nIff.rfl", "-- Mathlib.Algebra.Lie.Basic.leibniz_lie (L117-L119)\nlemma leibniz_lie [Add M] [IsLieTower L\u2081 L\u2082 M] (x : L\u2081) (y : L\u2082) (m : M) :\n \u2045x, \u2045y, m\u2046\u2046 = \u2045\u2045x, y\u2046, m\u2046 + \u2045y, \u2045x, m\u2046\u2046 := IsLieTower.leibniz_lie x y m", "-- Mathlib.Algebra.Lie.Abelian.toLinearMap_maxTrivLinearMapEquivLieModuleHom_symm (L273-L283)\ntheorem toLinearMap_maxTrivLinearMapEquivLieModuleHom_symm (f : M \u2192\u2097\u2045R,L\u2046 N) :\n (maxTrivLinearMapEquivLieModuleHom (M := M) (N := N) |>.symm f : M \u2192\u2097[R] N) = (f : M \u2192\u2097[R] N) :=\nrfl\n\nend LieModule\n\nnamespace LieAlgebra\n\n/-- The center of a Lie algebra is the set of elements that commute with everything. It can\nbe viewed as the maximal trivial submodule of the Lie algebra as a Lie module over itself via the\nadjoint representation. -/", "-- Mathlib.Algebra.Lie.BaseChange.instLieRingModule (L118-L122)\ninstance instLieRingModule : LieRingModule (A \u2297[R] L) (A \u2297[R] M) where\n add_lie x y z := by simp only [bracket_def, LinearMap.add_apply, map_add]\nlie_add x y z := by simp only [bracket_def, map_add]\n leibniz_lie := bracket_leibniz_lie R A L M", "-- Mathlib.Algebra.Lie.AdjointAction.Basic.LieAlgebra (L32-L37)\ntheorem LieAlgebra.commute_ad_of_commute {a b : A} (h : Commute a b) :\n Commute (LieAlgebra.ad R A a) (LieAlgebra.ad R A b) := by\nrw [Commute, SemiconjBy, \u2190 sub_eq_zero, \u2190 Ring.lie_def,\n \u2190 (LieAlgebra.ad R A).map_lie, Ring.lie_def, sub_eq_zero.mpr h, map_zero]\n\n/-- The adjoint of a nilpotent element is nilpotent. -/", "-- Mathlib.Algebra.Lie.Basic.LieAlgebra (L130-L134)\ntheorem LieAlgebra.toModule_injective (L : Type*) [LieRing L] :\n Function.Injective (@LieAlgebra.toModule _ _ _ _ : LieAlgebra \u211a L \u2192 Module \u211a L) := by\nrintro \u27e8h\u2081\u27e9 \u27e8h\u2082\u27e9 heq\n congr", "-- Mathlib.Algebra.Lie.BaseChange.instLieAlgebra (L114-L117)\ninstance instLieAlgebra : LieAlgebra A (A \u2297[R] L) where lie_smul _a _x _y := map_smul _ _ _\nset_option backward.privateInPublic true in\nset_option backward.privateInPublic.warn false in", "-- Mathlib.Algebra.Lie.Basic.lie_swap_lie (L120-L129)\nlemma lie_swap_lie [Bracket L\u2082 L\u2081] [AddCommGroup M] [IsLieTower L\u2081 L\u2082 M] [IsLieTower L\u2082 L\u2081 M]\n (x : L\u2081) (y : L\u2082) (m : M) : \u2045\u2045x, y\u2046, m\u2046 = -\u2045\u2045y, x\u2046, m\u2046 := by\nhave h1 := leibniz_lie x y m\n have h2 := leibniz_lie y x m\n convert congr($h1.symm - $h2) using 1 <;> simp only [add_sub_cancel_right, sub_add_cancel_right]\n\nend IsLieTower\n\nsection BasicProperties", "-- Mathlib.Algebra.Lie.Basic.zero_lie (L168-L170)\ntheorem zero_lie : \u2045(0 : L), m\u2046 = 0 :=\n(AddMonoidHom.mk' (fun x : L => \u2045x, m\u2046) fun x y => add_lie x y m).map_zero", "-- Mathlib.Algebra.Lie.Abelian.TrivialLieModule (L375-L380)\ndef TrivialLieModule (R L M : Type*) := M\nnamespace TrivialLieModule\n\nvariable (R L M : Type*) [CommRing R] [LieRing L] [LieAlgebra R L] [AddCommGroup M] [Module R M]", "-- Mathlib.Algebra.Lie.BaseChange.lie_baseChange (L234-L253)\nlemma lie_baseChange {I : LieIdeal R L} {N : LieSubmodule R L M} :\n \u2045I, N\u2046.baseChange A = \u2045I.baseChange A, N.baseChange A\u2046 := by\nset s : Set (A \u2297[R] M) := { m | \u2203 x \u2208 I, \u2203 n \u2208 N, 1 \u2297\u209c \u2045x, n\u2046 = m}\n have : (TensorProduct.mk R A M 1) '' {m | \u2203 x \u2208 I, \u2203 n \u2208 N, \u2045x, n\u2046 = m} = s := by ext; simp [s]\n rw [\u2190 toSubmodule_inj, coe_baseChange, lieIdeal_oper_eq_linear_span',\n Submodule.baseChange_span, this, lieIdeal_oper_eq_linear_span']\n refine le_antisymm (Submodule.span_mono ?_) (Submodule.span_le.mpr ?_)\n \u00b7 rintro - \u27e8x, hx, m, hm, rfl\u27e9\n exact \u27e81 \u2297\u209c x, tmul_mem_baseChange_of_mem 1 hx,\n 1 \u2297\u209c m, tmul_mem_baseChange_of_mem 1 hm, by simp\u27e9\n \u00b7 rintro - \u27e8x, hx, m, hm, rfl\u27e9\n rw [mem_baseChange_iff] at hx hm\n refine Submodule.span_induction\u2082 (p := fun x m _ _ \u21a6 \u2045x, m\u2046 \u2208 Submodule.span A s)\n ?_ (by simp) (by simp) ?_ ?_ ?_ ?_ hx hm\n \u00b7 rintro - - \u27e8x, hx, rfl\u27e9 \u27e8y, hy, rfl\u27e9; exact Submodule.subset_span \u27e8x, hx, y, hy, by simp\u27e9\n all_goals { intros; simp [add_mem, Submodule.smul_mem, *] }\n\nend LieSubmodule\n\nend ExtendScalars", "-- Mathlib.Algebra.Lie.Abelian.trivial_iff_le_maximal_trivial (L194-L198)\ntheorem trivial_iff_le_maximal_trivial (N : LieSubmodule R L M) :\n IsTrivial L N \u2194 N \u2264 maxTrivSubmodule R L M :=\n\u27e8fun h m hm x => IsTrivial.casesOn h fun h => Subtype.ext_iff.mp (h x \u27e8m, hm\u27e9), fun h =>\n { trivial := fun x m => Subtype.ext (h m.2 x) }\u27e9", "-- Mathlib.Algebra.Lie.Basic.lie_smul (L157-L159)\ntheorem lie_smul : \u2045x, t \u2022 m\u2046 = t \u2022 \u2045x, m\u2046 :=\nLieModule.lie_smul t x m", "-- Mathlib.Algebra.Lie.AdjointAction.Derivation.maxTrivSubmodule_eq_bot_of_center_eq_bot (L93-L104)\nlemma maxTrivSubmodule_eq_bot_of_center_eq_bot (h : LieAlgebra.center R L = \u22a5) :\n LieModule.maxTrivSubmodule R L (LieDerivation R L L) = \u22a5 := by\nrefine (LieSubmodule.eq_bot_iff _).mpr fun D hD \u21a6 ext fun x \u21a6 ?_\n have : ad R L (D x) = 0 := by\n rw [LieModule.mem_maxTrivSubmodule] at hD\n simp [ad_apply_lieDerivation, hD]\n rw [\u2190 LieHom.mem_ker, ad_ker_eq_center, h, LieSubmodule.mem_bot] at this\n simp [this]\n\nend AdjointAction\n\nend LieDerivation", "-- Mathlib.Algebra.Lie.AdjointAction.Derivation.ad_apply_lieDerivation (L60-L61)\nlemma ad_apply_lieDerivation (x : L) (D : LieDerivation R L L) : ad R L (D x) = -\u2045x, D\u2046 := rfl", "-- Mathlib.Algebra.Lie.Basic.add_lie (L145-L147)\ntheorem add_lie : \u2045x + y, m\u2046 = \u2045x, m\u2046 + \u2045y, m\u2046 :=\nLieRingModule.add_lie x y m", "-- Mathlib.Algebra.Lie.Abelian.equiv (L386-L387)\ndef equiv : (TrivialLieModule R L M) \u2243\u2097[R] M := LinearEquiv.refl R M", "-- Mathlib.Algebra.Lie.BaseChange.instLieModule (L123-L127)\ninstance instLieModule : LieModule A (A \u2297[R] L) (A \u2297[R] M) where\n smul_lie t x m := by simp only [bracket_def, map_smul, LinearMap.smul_apply]\nlie_smul _ _ _ := map_smul _ _ _\n\n/-- The Lie algebra homomorphism induced by an algebra map. -/", "-- Mathlib.Algebra.Lie.AdjointAction.Derivation.ad (L45-L57)\ndef ad : L \u2192\u2097\u2045R\u2046 LieDerivation R L L :=\n{ __ := - inner R L L\n map_lie' := by\n intro x y\n ext z\n simp only [AddHom.toFun_eq_coe, LinearMap.coe_toAddHom, LinearMap.neg_apply, coe_neg,\n Pi.neg_apply, inner_apply_apply, commutator_apply]\n rw [leibniz_lie, neg_lie, neg_lie, \u2190 lie_skew x]\n abel }\n\nvariable {R L}\n\n/-- The definitions `LieDerivation.ad` and `LieAlgebra.ad` agree. -/", "-- Mathlib.Algebra.Lie.Abelian.Function (L64-L72)\ntheorem Function.Injective.isLieAbelian {R : Type u} {L\u2081 : Type v} {L\u2082 : Type w} [CommRing R]\n [LieRing L\u2081] [LieRing L\u2082] [LieAlgebra R L\u2081] [LieAlgebra R L\u2082] {f : L\u2081 \u2192\u2097\u2045R\u2046 L\u2082}\n (h\u2081 : Function.Injective f) (_ : IsLieAbelian L\u2082) : IsLieAbelian L\u2081 :=\n{ trivial := fun x y => h\u2081 <|\n calc\n f \u2045x, y\u2046 = \u2045f x, f y\u2046 := LieHom.map_lie f x y\n _ = 0 := trivial_lie_zero _ _ _ _\n _ = f 0 := (map_zero _).symm }", "-- Mathlib.Algebra.Lie.Abelian.isTrivial_iff_max_triv_eq_top (L199-L207)\ntheorem isTrivial_iff_max_triv_eq_top : IsTrivial L M \u2194 maxTrivSubmodule R L M = \u22a4 := by\nconstructor\n \u00b7 rintro \u27e8h\u27e9; ext; simp only [mem_maxTrivSubmodule, h, forall_const, LieSubmodule.mem_top]\n \u00b7 intro h; constructor; intro x m; revert x\n rw [\u2190 mem_maxTrivSubmodule R L M, h]; exact LieSubmodule.mem_top m\n\nvariable {R L M N}\n\n/-- `maxTrivSubmodule` is functorial. -/", "-- Mathlib.Algebra.Lie.Basic.lie_self (L172-L174)\ntheorem lie_self : \u2045x, x\u2046 = 0 :=\nLieRing.lie_self x", "-- Mathlib.Algebra.Lie.Abelian.commute_toEnd_of_mem_center_left (L322-L325)\nlemma commute_toEnd_of_mem_center_left :\n Commute (toEnd R L M x) (toEnd R L M y) := by\nrw [Commute.symm_iff, commute_iff_lie_eq, \u2190 LieHom.map_lie, hx y, map_zero]", "-- Mathlib.Algebra.Lie.Abelian.le_max_triv_iff_bracket_eq_bot (L185-L193)\ntheorem le_max_triv_iff_bracket_eq_bot {N : LieSubmodule R L M} :\n N \u2264 maxTrivSubmodule R L M \u2194 \u2045(\u22a4 : LieIdeal R L), N\u2046 = \u22a5 := by\nrefine \u27e8fun h => ?_, fun h m hm => ?_\u27e9\n \u00b7 rw [\u2190 le_bot_iff, \u2190 ideal_oper_maxTrivSubmodule_eq_bot R L M \u22a4]\n exact LieSubmodule.mono_lie_right \u22a4 h\n \u00b7 rw [mem_maxTrivSubmodule]\n rw [LieSubmodule.lie_eq_bot_iff] at h\n exact fun x => h x (LieSubmodule.mem_top x) m hm", "-- Mathlib.Algebra.Lie.AdjointAction.Derivation.mem_ad_idealRange_iff (L89-L92)\nlemma mem_ad_idealRange_iff {D : LieDerivation R L L} :\n D \u2208 (ad R L).idealRange \u2194 \u2203 x : L, ad R L x = D :=\n(ad R L).mem_idealRange_iff (ad_isIdealMorphism R L)", "-- Mathlib.Algebra.Lie.BaseChange.map (L128-L139)\ndef map {R A B L L' : Type*} [CommRing R] [CommRing A] [Algebra R A] [CommRing B] [Algebra R B]\n [LieRing L] [LieAlgebra R L] [LieRing L'] [LieAlgebra R L'] (f : A \u2192\u2090[R] B) (g : L \u2192\u2097\u2045R\u2046 L') :\n A \u2297[R] L \u2192\u2097\u2045R\u2046 B \u2297[R] L' :=\n{ TensorProduct.map f.toLinearMap g with\n map_lie' {x y} := by\n simp only [bracket_def, AddHom.toFun_eq_coe, LinearMap.coe_toAddHom]\n refine x.induction_on (by simp) ?_ ?_\n \u00b7 intro _ _\n refine y.induction_on (by simp) (fun _ _ \u21a6 by simp) (fun _ _ h1 h2 \u21a6 by simp [h1, h2])\n \u00b7 intro _ _\n refine y.induction_on (by simp) (fun _ _ h \u21a6 by simp [h]) (by simp_all) }", "-- Mathlib.Algebra.Lie.Abelian.coe_maxTrivLinearMapEquivLieModuleHom (L259-L261)\ntheorem coe_maxTrivLinearMapEquivLieModuleHom (f : maxTrivSubmodule R L (M \u2192\u2097[R] N)) :\n (maxTrivLinearMapEquivLieModuleHom (M := M) (N := N) f : M \u2192 N) = f := by ext; rfl", "-- Mathlib.Algebra.Lie.Abelian.abelian_of_le_center (L299-L302)\ntheorem abelian_of_le_center (I : LieIdeal R L) (h : I \u2264 center R L) : IsLieAbelian I :=\nhaveI : LieModule.IsTrivial L I := (LieModule.trivial_iff_le_maximal_trivial R L L I).mpr h\n LieIdeal.isLieAbelian_of_trivial R L I", "-- Mathlib.Algebra.Lie.Abelian.commute_toEnd_of_mem_center_right (L326-L341)\nlemma commute_toEnd_of_mem_center_right :\n Commute (toEnd R L M y) (toEnd R L M x) :=\n(LieModule.commute_toEnd_of_mem_center_left M hx y).symm\n\nend LieModule\n\nend Center\n\nsection IdealOperations\n\nopen LieSubmodule LieSubalgebra\n\nvariable {R : Type u} {L : Type v} {M : Type w}\nvariable [CommRing R] [LieRing L] [LieAlgebra R L] [AddCommGroup M] [Module R M]\nvariable [LieRingModule L M] (N N' : LieSubmodule R L M) (I J : LieIdeal R L)", "-- Mathlib.Algebra.Lie.Abelian.self_module_ker_eq_center (L295-L298)\ntheorem self_module_ker_eq_center : LieModule.ker R L L = center R L := by\next y\n simp only [LieModule.mem_maxTrivSubmodule, LieModule.mem_ker, \u2190 lie_skew _ y, neg_eq_zero]", "-- Mathlib.Algebra.Lie.Abelian.center_eq_bot (L310-L321)\ntheorem center_eq_bot [LieModule.IsFaithful R L L] :\n center R L = \u22a5 :=\n(isFaithful_self_iff R L).mp inferInstance\n\nend LieAlgebra\n\nnamespace LieModule\n\nvariable {R L}\nvariable {x : L} (hx : x \u2208 LieAlgebra.center R L) (y : L)\ninclude hx", "-- Mathlib.Algebra.Lie.BaseChange.instLieRing (L106-L111)\ninstance instLieRing : LieRing (A \u2297[R] L) where\n add_lie x y z := by simp only [bracket_def, LinearMap.add_apply, map_add]\nlie_add x y z := by simp only [bracket_def, map_add]\n lie_self := bracket_lie_self R A L\n leibniz_lie := bracket_leibniz_lie R A L L", "-- Mathlib.Algebra.Lie.BaseChange.lieAlgebra (L161-L174)\ninstance lieAlgebra [CommRing R] [Algebra R A] : LieAlgebra R (RestrictScalars R A L) where\n lie_smul t x y := (lie_smul (algebraMap R A t) (RestrictScalars.addEquiv R A L x)\n(RestrictScalars.addEquiv R A L y) :)\n\nend RestrictScalars\n\nend LieAlgebra\n\nsection ExtendScalars\n\nvariable [CommRing R] [LieRing L] [LieAlgebra R L]\n [AddCommGroup M] [Module R M] [LieRingModule L M] [LieModule R L M]\n [CommRing A] [Algebra R A]", "-- Mathlib.Algebra.Lie.BaseChange.mem_baseChange_iff (L219-L223)\nlemma mem_baseChange_iff {m : A \u2297[R] M} :\n m \u2208 N.baseChange A \u2194\n m \u2208 Submodule.span A ((N : Submodule R M).map (TensorProduct.mk R A M 1)) := by\nrw [\u2190 Submodule.baseChange_eq_span]; rfl", "-- Mathlib.Algebra.Lie.Basic.smul_lie (L153-L155)\ntheorem smul_lie : \u2045t \u2022 x, m\u2046 = t \u2022 \u2045x, m\u2046 :=\nLieModule.smul_lie t x m", "-- Mathlib.Algebra.Lie.Abelian.lie_abelian_iff_equiv_lie_abelian (L81-L85)\ntheorem lie_abelian_iff_equiv_lie_abelian {R : Type u} {L\u2081 : Type v} {L\u2082 : Type w} [CommRing R]\n [LieRing L\u2081] [LieRing L\u2082] [LieAlgebra R L\u2081] [LieAlgebra R L\u2082] (e : L\u2081 \u2243\u2097\u2045R\u2046 L\u2082) :\n IsLieAbelian L\u2081 \u2194 IsLieAbelian L\u2082 :=\n\u27e8e.symm.injective.isLieAbelian, e.injective.isLieAbelian\u27e9", "-- Mathlib.Algebra.Lie.Abelian.IsLieAbelian (L57-L59)\nabbrev IsLieAbelian (L : Type v) [Bracket L L] [Zero L] : Prop :=\nLieModule.IsTrivial L L", "-- Mathlib.Algebra.Lie.BaseChange.map_apply_tmul (L141-L154)\nlemma map_apply_tmul {R A B L L' : Type*} [CommRing R] [CommRing A] [Algebra R A] [CommRing B]\n [Algebra R B] [LieRing L] [LieAlgebra R L] [LieRing L'] [LieAlgebra R L'] {f : A \u2192\u2090[R] B}\n {g : L \u2192\u2097\u2045R\u2046 L'} (a : A) (x : L) :\n map f g (a \u2297\u209c x) = (f a) \u2297\u209c (g x) :=\nrfl\n\nend ExtendScalars\n\nnamespace RestrictScalars\n\nopen RestrictScalars\n\nvariable [h : LieRing L]", "-- Mathlib.Algebra.Lie.AdjointAction.Basic.LieSubalgebra (L45-L51)\ntheorem LieSubalgebra.isNilpotent_ad_of_isNilpotent_ad {L : Type*} [LieRing L] [LieAlgebra R L]\n (K : LieSubalgebra R L) {x : K} (h : IsNilpotent (LieAlgebra.ad R L \u2191x)) :\n IsNilpotent (LieAlgebra.ad R K x) := by\nobtain \u27e8n, hn\u27e9 := h\n use n\n exact Module.End.submodule_pow_eq_zero_of_pow_eq_zero (K.ad_comp_incl_eq x) hn", "-- Mathlib.Algebra.Lie.Abelian.lie_eq_self_of_isAtom_of_ne_bot (L359-L362)\nlemma lie_eq_self_of_isAtom_of_ne_bot (hN : IsAtom N) (h : \u2045I, N\u2046 \u2260 \u22a5) : \u2045I, N\u2046 = N :=\n(hN.le_iff_eq h).mp <| LieSubmodule.lie_le_right N I\n\n-- TODO: introduce typeclass for perfect Lie algebras and use it here in the conclusion", "-- Mathlib.Algebra.Lie.Abelian.commutative_ring_iff_abelian_lie_ring (L86-L92)\ntheorem commutative_ring_iff_abelian_lie_ring {A : Type v} [Ring A] :\n Std.Commutative (\u03b1 := A) (\u00b7 * \u00b7) \u2194 IsLieAbelian A := by\nhave h\u2081 : Std.Commutative (\u03b1 := A) (\u00b7 * \u00b7) \u2194 \u2200 a b : A, a * b = b * a :=\n \u27e8fun h => h.1, fun h => \u27e8h\u27e9\u27e9\n have h\u2082 : IsLieAbelian A \u2194 \u2200 a b : A, \u2045a, b\u2046 = 0 := \u27e8fun h => h.1, fun h => \u27e8h\u27e9\u27e9\n simp only [h\u2081, h\u2082, LieRing.of_associative_ring_bracket, sub_eq_zero]", "-- Mathlib.Algebra.Lie.Abelian.isFaithful_self_iff (L306-L308)\ntheorem isFaithful_self_iff : LieModule.IsFaithful R L L \u2194 center R L = \u22a5 := by\nrw [LieModule.isFaithful_iff_ker_eq_bot, self_module_ker_eq_center]", "-- Mathlib.Algebra.Lie.AdjointAction.Derivation.ad_ker_eq_center (L66-L71)\nlemma ad_ker_eq_center : (ad R L).ker = LieAlgebra.center R L := by\next x\n rw [\u2190 LieAlgebra.self_module_ker_eq_center, LieHom.mem_ker, LieModule.mem_ker]\n simp [DFunLike.ext_iff]\n\n/-- If the center of a Lie algebra is trivial, then the adjoint action is injective. -/", "-- Mathlib.Algebra.Lie.BaseChange.tmul_mem_baseChange_of_mem (L215-L218)\nlemma tmul_mem_baseChange_of_mem (a : A) {m : M} (hm : m \u2208 N) :\n a \u2297\u209c[R] m \u2208 N.baseChange A :=\n(N : Submodule R M).tmul_mem_baseChange_of_mem a hm", "-- Mathlib.Algebra.Lie.Abelian.maxTrivSubmodule (L164-L170)\ndef maxTrivSubmodule : LieSubmodule R L M where\n carrier := { m | \u2200 x : L, \u2045x, m\u2046 = 0 }\nzero_mem' x := lie_zero x\n add_mem' {x y} hx hy z := by rw [lie_add, hx, hy, add_zero]\n smul_mem' c x hx y := by rw [lie_smul, hx, smul_zero]\n lie_mem {x m} hm y := by rw [hm, lie_zero]", "-- Mathlib.Algebra.Lie.Abelian.ideal_oper_maxTrivSubmodule_eq_bot (L178-L184)\ntheorem ideal_oper_maxTrivSubmodule_eq_bot (I : LieIdeal R L) :\n \u2045I, maxTrivSubmodule R L M\u2046 = \u22a5 := by\nrw [\u2190 LieSubmodule.toSubmodule_inj, LieSubmodule.lieIdeal_oper_eq_linear_span,\n LieSubmodule.bot_toSubmodule, Submodule.span_eq_bot]\n rintro m \u27e8\u27e8x, hx\u27e9, \u27e8\u27e8m, hm\u27e9, rfl\u27e9\u27e9\n exact hm x", "-- Mathlib.Algebra.Lie.BaseChange.bracket_tmul (L61-L105)\ntheorem bracket_tmul (s t : A) (x : L) (y : M) : \u2045s \u2297\u209c[R] x, t \u2297\u209c[R] y\u2046 = (s * t) \u2297\u209c \u2045x, y\u2046 := rfl\nset_option backward.privateInPublic true in\nprivate theorem bracket_lie_self (x : A \u2297[R] L) : \u2045x, x\u2046 = 0 := by\n simp only [bracket_def]\n refine x.induction_on ?_ ?_ ?_\n \u00b7 simp only [map_zero]\n \u00b7 intro a l\n simp only [bracket'_tmul, TensorProduct.tmul_zero, lie_self]\n \u00b7 intro z\u2081 z\u2082 h\u2081 h\u2082\n suffices bracket' R A L L z\u2081 z\u2082 + bracket' R A L L z\u2082 z\u2081 = 0 by\n rw [map_add, map_add, LinearMap.add_apply, LinearMap.add_apply, h\u2081, h\u2082,\n zero_add, add_zero, add_comm, this]\n refine z\u2081.induction_on ?_ ?_ ?_\n \u00b7 simp only [map_zero, add_zero, LinearMap.zero_apply]\n \u00b7 intro a\u2081 l\u2081; refine z\u2082.induction_on ?_ ?_ ?_\n \u00b7 simp only [map_zero, add_zero, LinearMap.zero_apply]\n \u00b7 intro a\u2082 l\u2082\n simp only [\u2190 lie_skew l\u2082 l\u2081, mul_comm a\u2081 a\u2082, TensorProduct.tmul_neg, bracket'_tmul,\n add_neg_cancel]\n \u00b7 intro y\u2081 y\u2082 hy\u2081 hy\u2082\n simp only [hy\u2081, hy\u2082, add_add_add_comm, add_zero, LinearMap.add_apply, map_add]\n \u00b7 intro y\u2081 y\u2082 hy\u2081 hy\u2082\n simp only [add_add_add_comm, hy\u2081, hy\u2082, add_zero, LinearMap.add_apply, map_add]\n\nset_option backward.privateInPublic true in\nprivate theorem bracket_leibniz_lie (x y : A \u2297[R] L) (z : A \u2297[R] M) :\n \u2045x, \u2045y, z\u2046\u2046 = \u2045\u2045x, y\u2046, z\u2046 + \u2045y, \u2045x, z\u2046\u2046 := by\n simp only [bracket_def]\n refine x.induction_on ?_ ?_ ?_\n \u00b7 simp only [map_zero, add_zero, LinearMap.zero_apply]\n \u00b7 intro a\u2081 l\u2081\n refine y.induction_on ?_ ?_ ?_\n \u00b7 simp only [map_zero, add_zero, LinearMap.zero_apply]\n \u00b7 intro a\u2082 l\u2082\n refine z.induction_on ?_ ?_ ?_\n \u00b7 simp only [map_zero, add_zero]\n \u00b7 intro a\u2083 l\u2083; simp only [bracket'_tmul]\n rw [mul_left_comm a\u2082 a\u2081 a\u2083, mul_assoc, leibniz_lie, TensorProduct.tmul_add]\n \u00b7 grind\n \u00b7 grind [LinearMap.add_apply]\n \u00b7 grind [LinearMap.add_apply]\n\nset_option backward.privateInPublic true in\nset_option backward.privateInPublic.warn false in", "-- Mathlib.Algebra.Lie.AdjointAction.Derivation.lie_der_ad_eq_ad_der (L77-L82)\nlemma lie_der_ad_eq_ad_der (D : LieDerivation R L L) (x : L) : \u2045D, ad R L x\u2046 = ad R L (D x) := by\nrw [ad_apply_lieDerivation, \u2190 lie_ad, lie_skew]\n\nvariable (R L) in\n/-- The range of the adjoint action homomorphism from a Lie algebra `L` to the Lie algebra of its\nderivations is an ideal of the latter. -/", "-- Mathlib.Algebra.Lie.Abelian.isLieAbelian_iff_center_eq_top (L303-L305)\ntheorem isLieAbelian_iff_center_eq_top : IsLieAbelian L \u2194 center R L = \u22a4 :=\nLieModule.isTrivial_iff_max_triv_eq_top R L L", "-- Mathlib.Algebra.Lie.Basic.lie_zero (L164-L166)\ntheorem lie_zero : \u2045x, 0\u2046 = (0 : M) :=\n(AddMonoidHom.mk' _ (lie_add x)).map_zero", "-- Mathlib.Algebra.Lie.Abelian.maxTrivEquiv_of_equiv_symm_eq_symm (L240-L245)\ntheorem maxTrivEquiv_of_equiv_symm_eq_symm (e : M \u2243\u2097\u2045R,L\u2046 N) :\n (maxTrivEquiv e).symm = maxTrivEquiv e.symm :=\nrfl\n\n/-- A linear map between two Lie modules is a morphism of Lie modules iff the Lie algebra action\non it is trivial. -/", "-- Mathlib.Algebra.Lie.AdjointAction.Derivation.ad_isIdealMorphism (L83-L88)\nlemma ad_isIdealMorphism : (ad R L).IsIdealMorphism := by\nsimp_rw [LieHom.isIdealMorphism_iff, lie_der_ad_eq_ad_der]\n tauto\n\n/-- A derivation `D` belongs to the ideal range of the adjoint action iff it is of the form `ad x`\nfor some `x` in the Lie algebra `L`. -/", "-- Mathlib.Algebra.Lie.Basic.lieAlgebraSelfModule (L184-L187)\ninstance lieAlgebraSelfModule : LieModule R L L where\n smul_lie t x m := by rw [\u2190 lie_skew, \u2190 lie_skew x m, LieAlgebra.lie_smul, smul_neg]\nlie_smul := by apply LieAlgebra.lie_smul", "-- Mathlib.Algebra.Lie.Abelian.LieIdeal (L60-L63)\ninstance LieIdeal.isLieAbelian_of_trivial (R : Type u) (L : Type v) [CommRing R] [LieRing L]\n [LieAlgebra R L] (I : LieIdeal R L) [h : LieModule.IsTrivial L I] : IsLieAbelian I where\n trivial x y := by apply h.trivial", "-- Mathlib.Algebra.Lie.Abelian.lie_eq_self_of_isAtom_of_nonabelian (L363-L373)\nlemma lie_eq_self_of_isAtom_of_nonabelian {R L : Type*} [CommRing R] [LieRing L] [LieAlgebra R L]\n (I : LieIdeal R L) (hI : IsAtom I) (h : \u00acIsLieAbelian I) :\n \u2045I, I\u2046 = I :=\nlie_eq_self_of_isAtom_of_ne_bot hI <| not_imp_not.mpr (lie_abelian_iff_lie_self_eq_bot I).mpr h\n\nend IdealOperations\n\nsection TrivialLieModule\n\nset_option linter.unusedVariables false in\n/-- A type synonym for an `R`-module to have a trivial Lie module structure. -/", "-- Mathlib.Algebra.Lie.Abelian.LieSubmodule (L343-L347)\ntheorem LieSubmodule.trivial_lie_oper_zero [LieModule.IsTrivial L M] : \u2045I, N\u2046 = \u22a5 := by\nsuffices \u2045I, N\u2046 \u2264 \u22a5 from le_bot_iff.mp this\n rw [lieIdeal_oper_eq_span, LieSubmodule.lieSpan_le]\n rintro m \u27e8x, n, h\u27e9; rw [trivial_lie_zero] at h; simp [\u2190 h]", "-- Mathlib.Algebra.Lie.Abelian.coe_maxTrivEquiv_apply (L230-L233)\ntheorem coe_maxTrivEquiv_apply (e : M \u2243\u2097\u2045R,L\u2046 N) (m : maxTrivSubmodule R L M) :\n (maxTrivEquiv e m : N) = e \u2191m :=\nrfl", "-- Mathlib.Algebra.Lie.Abelian.maxTrivLinearMapEquivLieModuleHom (L246-L257)\ndef maxTrivLinearMapEquivLieModuleHom : maxTrivSubmodule R L (M \u2192\u2097[R] N) \u2243\u2097[R] M \u2192\u2097\u2045R,L\u2046 N where\n toFun f :=\n{ toLinearMap := f.val\n map_lie' := fun {x m} => by\n have hf : \u2045x, f.val\u2046 m = 0 := by rw [f.property x, LinearMap.zero_apply]\n rw [LieHom.lie_apply, sub_eq_zero, \u2190 LinearMap.toFun_eq_coe] at hf; exact hf.symm }\n map_add' f g := by ext; simp\n map_smul' F G := by ext; simp\n invFun F := \u27e8F, fun x => by ext; simp\u27e9\n left_inv f := by simp\n right_inv F := by simp", "-- Mathlib.Algebra.Lie.Abelian.coe_maxTrivHom_apply (L217-L221)\ntheorem coe_maxTrivHom_apply (f : M \u2192\u2097\u2045R,L\u2046 N) (m : maxTrivSubmodule R L M) :\n (maxTrivHom f m : N) = f m :=\nrfl\n\n/-- The maximal trivial submodules of Lie-equivalent Lie modules are Lie-equivalent. -/", "-- Mathlib.Algebra.Lie.AdjointAction.Derivation.injective_ad_of_center_eq_bot (L72-L76)\nlemma injective_ad_of_center_eq_bot (h : LieAlgebra.center R L = \u22a5) :\n Function.Injective (ad R L) := by\nrw [\u2190 LieHom.ker_eq_bot, ad_ker_eq_center, h]\n\n/-- The commutator of a derivation `D` and a derivation of the form `ad x` is `ad (D x)`. -/", "-- Mathlib.Algebra.Lie.Abelian.isFaithful_iff_ker_eq_bot (L155-L158)\nlemma isFaithful_iff_ker_eq_bot : IsFaithful R L M \u2194 LieModule.ker R L M = \u22a5 := by\nrw [isFaithful_iff', LieSubmodule.ext_iff]\n aesop", "-- Mathlib.Algebra.Lie.BaseChange.coe_baseChange (L208-L214)\nlemma coe_baseChange :\n (N.baseChange A : Submodule A (A \u2297[R] M)) = (N : Submodule R M).baseChange A :=\nrfl\n\nvariable {N}\n\nvariable {R A L M} in", "-- Mathlib.Algebra.Lie.Abelian.maxTrivHom (L208-L215)\ndef maxTrivHom (f : M \u2192\u2097\u2045R,L\u2046 N) : maxTrivSubmodule R L M \u2192\u2097\u2045R,L\u2046 maxTrivSubmodule R L N where\n toFun m := \u27e8f m, fun x =>\n(LieModuleHom.map_lie _ _ _).symm.trans <|\n (congr_arg f (m.property x)).trans (map_zero _)\u27e9\n map_add' m n := by ext; simp\n map_smul' t m := by ext; simp\n map_lie' {x m} := by simp", "-- Mathlib.Algebra.Lie.AdjointAction.Derivation.lie_ad (L62-L65)\nlemma lie_ad (x : L) (D : LieDerivation R L L) : \u2045ad R L x, D\u2046 = \u2045x, D\u2046 := by ext; simp\nvariable (R L) in\n/-- The kernel of the adjoint action on a Lie algebra is equal to its center. -/", "-- Mathlib.Algebra.Lie.Abelian.ad_ker_eq_self_module_ker (L291-L293)\ntheorem ad_ker_eq_self_module_ker : (ad R L).ker = LieModule.ker R L L :=\nrfl", "-- Mathlib.Algebra.Lie.BaseChange.baseChange_top (L230-L233)\nlemma baseChange_top : (\u22a4 : LieSubmodule R L M).baseChange A = \u22a4 := by\nsimp only [baseChange, top_toSubmodule, Submodule.baseChange_top]\n rfl", "-- Mathlib.Algebra.Lie.Basic.lie_add (L149-L151)\ntheorem lie_add : \u2045x, m + n\u2046 = \u2045x, m\u2046 + \u2045x, n\u2046 :=\nLieRingModule.lie_add x m n", "-- Mathlib.Algebra.Lie.Abelian.toLinearMap_maxTrivLinearMapEquivLieModuleHom (L268-L271)\ntheorem toLinearMap_maxTrivLinearMapEquivLieModuleHom (f : maxTrivSubmodule R L (M \u2192\u2097[R] N)) :\n (maxTrivLinearMapEquivLieModuleHom (M := M) (N := N) f : M \u2192\u2097[R] N) = (f : M \u2192\u2097[R] N) := by\next; rfl", "-- Mathlib.Algebra.Lie.Basic.lie_skew (L179-L183)\ntheorem lie_skew : -\u2045y, x\u2046 = \u2045x, y\u2046 := by\nhave h : \u2045x + y, x\u2046 + \u2045x + y, y\u2046 = 0 := by rw [\u2190 lie_add]; apply lie_self\n simpa [neg_eq_iff_add_eq_zero] using h\n\n/-- Every Lie algebra is a module over itself. -/", "-- Mathlib.Algebra.Lie.BaseChange.baseChange (L191-L206)\ndef baseChange : LieSubmodule A (A \u2297[R] L) (A \u2297[R] M) :=\n{ (N : Submodule R M).baseChange A with\n lie_mem := by\n intro x m hm\n rw [Submodule.mem_carrier, SetLike.mem_coe] at hm \u22a2\n rw [Submodule.baseChange_eq_span] at hm\n obtain \u27e8c, rfl\u27e9 := (Finsupp.mem_span_iff_linearCombination _ _ _).mp hm\n refine x.induction_on (by simp) (fun a y \u21a6 ?_) (fun y z hy hz \u21a6 ?_)\n \u00b7 change toEnd A (A \u2297[R] L) (A \u2297[R] M) _ _ \u2208 _\n simp_rw [Finsupp.linearCombination_apply, Finsupp.sum, map_sum, map_smul, toEnd_apply_apply]\n refine Submodule.sum_mem _ fun \u27e8_, n, hn, h\u27e9 _ \u21a6 Submodule.smul_mem _ _ ?_\n rw [Subtype.coe_mk, \u2190 h]\n exact Submodule.tmul_mem_baseChange_of_mem _ (N.lie_mem hn)\n \u00b7 rw [add_lie]\n exact ((N : Submodule R M).baseChange A).add_mem hy hz }", "-- Mathlib.Algebra.Lie.Abelian.trivial_lie_zero (L44-L47)\ntheorem trivial_lie_zero (L : Type v) (M : Type w) [Bracket L M] [Zero M] [LieModule.IsTrivial L M]\n (x : L) (m : M) : \u2045x, m\u2046 = 0 :=\nLieModule.IsTrivial.trivial x m", "-- Mathlib.Algebra.Lie.BaseChange.instBaseLieAlgebra (L112-L113)\ninstance instBaseLieAlgebra : LieAlgebra R (A \u2297[R] L) where lie_smul := by simp [bracket_def]", "-- Mathlib.Algebra.Lie.Abelian.coe_maxTrivLinearMapEquivLieModuleHom_symm (L263-L266)\ntheorem coe_maxTrivLinearMapEquivLieModuleHom_symm (f : M \u2192\u2097\u2045R,L\u2046 N) :\n (maxTrivLinearMapEquivLieModuleHom (M := M) (N := N) |>.symm f : M \u2192 N) = f :=\nrfl", "-- Mathlib.Algebra.Lie.BaseChange.baseChange_bot (L225-L228)\nlemma baseChange_bot : (\u22a5 : LieSubmodule R L M).baseChange A = \u22a5 := by\nsimp only [baseChange, bot_toSubmodule, Submodule.baseChange_bot]\n rfl", "-- Mathlib.Algebra.Lie.Basic.lieRingSelfModule (L175-L177)\ninstance lieRingSelfModule : LieRingModule L L :=\n{ (inferInstance : LieRing L) with }", "-- Mathlib.Algebra.Lie.Abelian.maxTrivEquiv_of_refl_eq_refl (L235-L238)\ntheorem maxTrivEquiv_of_refl_eq_refl :\n maxTrivEquiv (LieModuleEquiv.refl : M \u2243\u2097\u2045R,L\u2046 M) = LieModuleEquiv.refl := by\next; simp only [coe_maxTrivEquiv_apply, LieModuleEquiv.refl_apply]", "-- Mathlib.Algebra.Lie.Abelian.maxTrivEquiv (L222-L228)\ndef maxTrivEquiv (e : M \u2243\u2097\u2045R,L\u2046 N) : maxTrivSubmodule R L M \u2243\u2097\u2045R,L\u2046 maxTrivSubmodule R L N :=\n{ maxTrivHom (e : M \u2192\u2097\u2045R,L\u2046 N) with\n toFun := maxTrivHom (e : M \u2192\u2097\u2045R,L\u2046 N)\n invFun := maxTrivHom (e.symm : N \u2192\u2097\u2045R,L\u2046 M)\n left_inv := fun m => by ext; simp\n right_inv := fun n => by ext; simp }", "-- Mathlib.Algebra.Lie.BaseChange.LieModule (L176-L190)\nlemma LieModule.toEnd_baseChange (x : L) :\n toEnd A (A \u2297[R] L) (A \u2297[R] M) (1 \u2297\u209c x) = (toEnd R L M x).baseChange A := by\next; simp\n\nnamespace LieSubmodule\n\nvariable (N : LieSubmodule R L M)\n\nopen LieModule\n\nvariable {R L M} in\n/-- If `A` is an `R`-algebra, any Lie submodule of a Lie module `M` with coefficients in `R` may be\npushed forward to a Lie submodule of `A \u2297 M` with coefficients in `A`.\n\nThis \"base change\" operation is also known as \"extension of scalars\". -/", "-- Mathlib.Algebra.Lie.Abelian.LieModule (L48-L51)\ninstance LieModule.instIsTrivialOfSubsingleton {L M : Type*}\n [LieRing L] [AddCommGroup M] [LieRingModule L M] [Subsingleton L] : LieModule.IsTrivial L M :=\n\u27e8fun x m \u21a6 by rw [Subsingleton.eq_zero x, zero_lie]\u27e9", "-- Mathlib.Algebra.Lie.Abelian.center (L284-L286)\nabbrev center : LieIdeal R L :=\nLieModule.maxTrivSubmodule R L L"], "statement": "def ofLieDerivation : (LieDerivation R L L) \u2192\u2097\u2045R\u2046 (LieDerivation R (A \u2297[R] L) (A \u2297[R] L)) where\n toFun d", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 30904, "declarations_count": 3602, "diagnostics_count": 0, "duplicate_fingerprint": "b54345448668d2a9", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 12259, "lean_code_chars": 28233, "lean_code_ratio": 0.9136, "length_bucket": "long", "line_count": 923, "natural_language_chars": 2671, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 83, "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.Algebra.Lie.Derivation.BaseChange).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef ofLieDerivation : (LieDerivation R L L) \u2192\u2097\u2045R\u2046 (LieDerivation R (A \u2297[R] L) (A \u2297[R] L)) where\n toFun d\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Lie.Derivation.BaseChange.ofDerivation (L37-L56)\ndef ofDerivation : Derivation R A A \u2192\u2097\u2045R\u2046 LieDerivation R (A \u2297[R] L) (A \u2297[R] L) where\n toFun d :=\n{ toFun := d.rTensor L\n map_add' := by simp\n map_smul' := by simp\n leibniz' x y := by\n simp only [LinearMap.coe_mk, AddHom.coe_mk]\n refine x.induction_on (by simp) (fun _ l \u21a6 ?_) (fun _ _ h1 h2 \u21a6 ?_)\n \u00b7 refine y.induction_on (by simp) (fun _ l' \u21a6 ?_) (fun _ _ h1 h2 \u21a6 ?_)\n \u00b7 simp [\u2190 lie_skew l' l, -lie_skew, add_tmul, tmul_neg]\n \u00b7 simp [h1, h2, sub_add_sub_comm]\n \u00b7 simp [h1, h2, sub_add_sub_comm] }\n map_add' _ _ := by ext; simp\n map_smul' _ _ := by ext; simp\n map_lie' {_ _} := by\n ext z\n refine z.induction_on (by simp) (by simp [sub_tmul]) (fun _ _ hx hy \u21a6 ?_)\n simp_all\n abel\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Lie.Derivation.BaseChange.ofDerivation_apply (L58-L64)\nlemma ofDerivation_apply (d : Derivation R A A) (x : A \u2297[R] L) :\n ofDerivation L d x = d.toLinearMap.rTensor L x :=\nrfl\n\nvariable (A) in\n/-- A Lie derivation of an `R-`Lie algebra `L`, induces a Lie derivation of `A \u2297[R] L` for any\nAlgebra `A` over `R`. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Lie.Derivation.BaseChange.ofLieDerivation_apply (L92-L96)\nlemma ofLieDerivation_apply (d : LieDerivation R L L) (x : A \u2297[R] L) :\n ofLieDerivation A d x = d.toLinearMap.lTensor A x :=\nrfl\n\nend Lie.Derivation\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Lie.Abelian.mem_maxTrivSubmodule (L172-L174)\ntheorem mem_maxTrivSubmodule (m : M) : m \u2208 maxTrivSubmodule R L M \u2194 \u2200 x : L, \u2045x, m\u2046 = 0 :=\nIff.rfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Lie.Basic.leibniz_lie (L117-L119)\nlemma leibniz_lie [Add M] [IsLieTower L\u2081 L\u2082 M] (x : L\u2081) (y : L\u2082) (m : M) :\n \u2045x, \u2045y, m\u2046\u2046 = \u2045\u2045x, y\u2046, m\u2046 + \u2045y, \u2045x, m\u2046\u2046 := IsLieTower.leibniz_lie x y m\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Lie.Abelian.toLinearMap_maxTrivLinearMapEquivLieModuleHom_symm (L273-L283)\ntheorem toLinearMap_maxTrivLinearMapEquivLieModuleHom_symm (f : M \u2192\u2097\u2045R,L\u2046 N) :\n (maxTrivLinearMapEquivLieModuleHom (M := M) (N := N) |>.symm f : M \u2192\u2097[R] N) = (f : M \u2192\u2097[R] N) :=\nrfl\n\nend LieModule\n\nnamespace LieAlgebra\n\n/-- The center of a Lie algebra is the set of elements that commute with everything. It can\nbe viewed as the maximal trivial submodule of the Lie algebra as a Lie module over itself via the\nadjoint representation. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.instLieRingModule (L118-L122)\ninstance instLieRingModule : LieRingModule (A \u2297[R] L) (A \u2297[R] M) where\n add_lie x y z := by simp only [bracket_def, LinearMap.add_apply, map_add]\nlie_add x y z := by simp only [bracket_def, map_add]\n leibniz_lie := bracket_leibniz_lie R A L M\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Lie.AdjointAction.Basic.LieAlgebra (L32-L37)\ntheorem LieAlgebra.commute_ad_of_commute {a b : A} (h : Commute a b) :\n Commute (LieAlgebra.ad R A a) (LieAlgebra.ad R A b) := by\nrw [Commute, SemiconjBy, \u2190 sub_eq_zero, \u2190 Ring.lie_def,\n \u2190 (LieAlgebra.ad R A).map_lie, Ring.lie_def, sub_eq_zero.mpr h, map_zero]\n\n/-- The adjoint of a nilpotent element is nilpotent. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Lie.Basic.LieAlgebra (L130-L134)\ntheorem LieAlgebra.toModule_injective (L : Type*) [LieRing L] :\n Function.Injective (@LieAlgebra.toModule _ _ _ _ : LieAlgebra \u211a L \u2192 Module \u211a L) := by\nrintro \u27e8h\u2081\u27e9 \u27e8h\u2082\u27e9 heq\n congr\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.instLieAlgebra (L114-L117)\ninstance instLieAlgebra : LieAlgebra A (A \u2297[R] L) where lie_smul _a _x _y := map_smul _ _ _\nset_option backward.privateInPublic true in\nset_option backward.privateInPublic.warn false in\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Lie.Basic.lie_swap_lie (L120-L129)\nlemma lie_swap_lie [Bracket L\u2082 L\u2081] [AddCommGroup M] [IsLieTower L\u2081 L\u2082 M] [IsLieTower L\u2082 L\u2081 M]\n (x : L\u2081) (y : L\u2082) (m : M) : \u2045\u2045x, y\u2046, m\u2046 = -\u2045\u2045y, x\u2046, m\u2046 := by\nhave h1 := leibniz_lie x y m\n have h2 := leibniz_lie y x m\n convert congr($h1.symm - $h2) using 1 <;> simp only [add_sub_cancel_right, sub_add_cancel_right]\n\nend IsLieTower\n\nsection BasicProperties\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Lie.Basic.zero_lie (L168-L170)\ntheorem zero_lie : \u2045(0 : L), m\u2046 = 0 :=\n(AddMonoidHom.mk' (fun x : L => \u2045x, m\u2046) fun x y => add_lie x y m).map_zero\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Lie.Abelian.TrivialLieModule (L375-L380)\ndef TrivialLieModule (R L M : Type*) := M\nnamespace TrivialLieModule\n\nvariable (R L M : Type*) [CommRing R] [LieRing L] [LieAlgebra R L] [AddCommGroup M] [Module R M]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.lie_baseChange (L234-L253)\nlemma lie_baseChange {I : LieIdeal R L} {N : LieSubmodule R L M} :\n \u2045I, N\u2046.baseChange A = \u2045I.baseChange A, N.baseChange A\u2046 := by\nset s : Set (A \u2297[R] M) := { m | \u2203 x \u2208 I, \u2203 n \u2208 N, 1 \u2297\u209c \u2045x, n\u2046 = m}\n have : (TensorProduct.mk R A M 1) '' {m | \u2203 x \u2208 I, \u2203 n \u2208 N, \u2045x, n\u2046 = m} = s := by ext; simp [s]\n rw [\u2190 toSubmodule_inj, coe_baseChange, lieIdeal_oper_eq_linear_span',\n Submodule.baseChange_span, this, lieIdeal_oper_eq_linear_span']\n refine le_antisymm (Submodule.span_mono ?_) (Submodule.span_le.mpr ?_)\n \u00b7 rintro - \u27e8x, hx, m, hm, rfl\u27e9\n exact \u27e81 \u2297\u209c x, tmul_mem_baseChange_of_mem 1 hx,\n 1 \u2297\u209c m, tmul_mem_baseChange_of_mem 1 hm, by simp\u27e9\n \u00b7 rintro - \u27e8x, hx, m, hm, rfl\u27e9\n rw [mem_baseChange_iff] at hx hm\n refine Submodule.span_induction\u2082 (p := fun x m _ _ \u21a6 \u2045x, m\u2046 \u2208 Submodule.span A s)\n ?_ (by simp) (by simp) ?_ ?_ ?_ ?_ hx hm\n \u00b7 rintro - - \u27e8x, hx, rfl\u27e9 \u27e8y, hy, rfl\u27e9; exact Submodule.subset_span \u27e8x, hx, y, hy, by simp\u27e9\n all_goals { intros; simp [add_mem, Submodule.smul_mem, *] }\n\nend LieSubmodule\n\nend ExtendScalars\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.Lie.Abelian.trivial_iff_le_maximal_trivial (L194-L198)\ntheorem trivial_iff_le_maximal_trivial (N : LieSubmodule R L M) :\n IsTrivial L N \u2194 N \u2264 maxTrivSubmodule R L M :=\n\u27e8fun h m hm x => IsTrivial.casesOn h fun h => Subtype.ext_iff.mp (h x \u27e8m, hm\u27e9), fun h =>\n { trivial := fun x m => Subtype.ext (h m.2 x) }\u27e9\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.Lie.Basic.lie_smul (L157-L159)\ntheorem lie_smul : \u2045x, t \u2022 m\u2046 = t \u2022 \u2045x, m\u2046 :=\nLieModule.lie_smul t x m\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.Lie.AdjointAction.Derivation.maxTrivSubmodule_eq_bot_of_center_eq_bot (L93-L104)\nlemma maxTrivSubmodule_eq_bot_of_center_eq_bot (h : LieAlgebra.center R L = \u22a5) :\n LieModule.maxTrivSubmodule R L (LieDerivation R L L) = \u22a5 := by\nrefine (LieSubmodule.eq_bot_iff _).mpr fun D hD \u21a6 ext fun x \u21a6 ?_\n have : ad R L (D x) = 0 := by\n rw [LieModule.mem_maxTrivSubmodule] at hD\n simp [ad_apply_lieDerivation, hD]\n rw [\u2190 LieHom.mem_ker, ad_ker_eq_center, h, LieSubmodule.mem_bot] at this\n simp [this]\n\nend AdjointAction\n\nend LieDerivation\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.Lie.AdjointAction.Derivation.ad_apply_lieDerivation (L60-L61)\nlemma ad_apply_lieDerivation (x : L) (D : LieDerivation R L L) : ad R L (D x) = -\u2045x, D\u2046 := rfl\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.Lie.Basic.add_lie (L145-L147)\ntheorem add_lie : \u2045x + y, m\u2046 = \u2045x, m\u2046 + \u2045y, m\u2046 :=\nLieRingModule.add_lie x y m\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.Lie.Abelian.equiv (L386-L387)\ndef equiv : (TrivialLieModule R L M) \u2243\u2097[R] M := LinearEquiv.refl R M\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.instLieModule (L123-L127)\ninstance instLieModule : LieModule A (A \u2297[R] L) (A \u2297[R] M) where\n smul_lie t x m := by simp only [bracket_def, map_smul, LinearMap.smul_apply]\nlie_smul _ _ _ := map_smul _ _ _\n\n/-- The Lie algebra homomorphism induced by an algebra map. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Algebra.Lie.AdjointAction.Derivation.ad (L45-L57)\ndef ad : L \u2192\u2097\u2045R\u2046 LieDerivation R L L :=\n{ __ := - inner R L L\n map_lie' := by\n intro x y\n ext z\n simp only [AddHom.toFun_eq_coe, LinearMap.coe_toAddHom, LinearMap.neg_apply, coe_neg,\n Pi.neg_apply, inner_apply_apply, commutator_apply]\n rw [leibniz_lie, neg_lie, neg_lie, \u2190 lie_skew x]\n abel }\n\nvariable {R L}\n\n/-- The definitions `LieDerivation.ad` and `LieAlgebra.ad` agree. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Algebra.Lie.Abelian.Function (L64-L72)\ntheorem Function.Injective.isLieAbelian {R : Type u} {L\u2081 : Type v} {L\u2082 : Type w} [CommRing R]\n [LieRing L\u2081] [LieRing L\u2082] [LieAlgebra R L\u2081] [LieAlgebra R L\u2082] {f : L\u2081 \u2192\u2097\u2045R\u2046 L\u2082}\n (h\u2081 : Function.Injective f) (_ : IsLieAbelian L\u2082) : IsLieAbelian L\u2081 :=\n{ trivial := fun x y => h\u2081 <|\n calc\n f \u2045x, y\u2046 = \u2045f x, f y\u2046 := LieHom.map_lie f x y\n _ = 0 := trivial_lie_zero _ _ _ _\n _ = f 0 := (map_zero _).symm }\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Algebra.Lie.Abelian.isTrivial_iff_max_triv_eq_top (L199-L207)\ntheorem isTrivial_iff_max_triv_eq_top : IsTrivial L M \u2194 maxTrivSubmodule R L M = \u22a4 := by\nconstructor\n \u00b7 rintro \u27e8h\u27e9; ext; simp only [mem_maxTrivSubmodule, h, forall_const, LieSubmodule.mem_top]\n \u00b7 intro h; constructor; intro x m; revert x\n rw [\u2190 mem_maxTrivSubmodule R L M, h]; exact LieSubmodule.mem_top m\n\nvariable {R L M N}\n\n/-- `maxTrivSubmodule` is functorial. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Algebra.Lie.Basic.lie_self (L172-L174)\ntheorem lie_self : \u2045x, x\u2046 = 0 :=\nLieRing.lie_self x\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Algebra.Lie.Abelian.commute_toEnd_of_mem_center_left (L322-L325)\nlemma commute_toEnd_of_mem_center_left :\n Commute (toEnd R L M x) (toEnd R L M y) := by\nrw [Commute.symm_iff, commute_iff_lie_eq, \u2190 LieHom.map_lie, hx y, map_zero]\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Algebra.Lie.Abelian.le_max_triv_iff_bracket_eq_bot (L185-L193)\ntheorem le_max_triv_iff_bracket_eq_bot {N : LieSubmodule R L M} :\n N \u2264 maxTrivSubmodule R L M \u2194 \u2045(\u22a4 : LieIdeal R L), N\u2046 = \u22a5 := by\nrefine \u27e8fun h => ?_, fun h m hm => ?_\u27e9\n \u00b7 rw [\u2190 le_bot_iff, \u2190 ideal_oper_maxTrivSubmodule_eq_bot R L M \u22a4]\n exact LieSubmodule.mono_lie_right \u22a4 h\n \u00b7 rw [mem_maxTrivSubmodule]\n rw [LieSubmodule.lie_eq_bot_iff] at h\n exact fun x => h x (LieSubmodule.mem_top x) m hm\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Algebra.Lie.AdjointAction.Derivation.mem_ad_idealRange_iff (L89-L92)\nlemma mem_ad_idealRange_iff {D : LieDerivation R L L} :\n D \u2208 (ad R L).idealRange \u2194 \u2203 x : L, ad R L x = D :=\n(ad R L).mem_idealRange_iff (ad_isIdealMorphism R L)\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.map (L128-L139)\ndef map {R A B L L' : Type*} [CommRing R] [CommRing A] [Algebra R A] [CommRing B] [Algebra R B]\n [LieRing L] [LieAlgebra R L] [LieRing L'] [LieAlgebra R L'] (f : A \u2192\u2090[R] B) (g : L \u2192\u2097\u2045R\u2046 L') :\n A \u2297[R] L \u2192\u2097\u2045R\u2046 B \u2297[R] L' :=\n{ TensorProduct.map f.toLinearMap g with\n map_lie' {x y} := by\n simp only [bracket_def, AddHom.toFun_eq_coe, LinearMap.coe_toAddHom]\n refine x.induction_on (by simp) ?_ ?_\n \u00b7 intro _ _\n refine y.induction_on (by simp) (fun _ _ \u21a6 by simp) (fun _ _ h1 h2 \u21a6 by simp [h1, h2])\n \u00b7 intro _ _\n refine y.induction_on (by simp) (fun _ _ h \u21a6 by simp [h]) (by simp_all) }\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Algebra.Lie.Abelian.coe_maxTrivLinearMapEquivLieModuleHom (L259-L261)\ntheorem coe_maxTrivLinearMapEquivLieModuleHom (f : maxTrivSubmodule R L (M \u2192\u2097[R] N)) :\n (maxTrivLinearMapEquivLieModuleHom (M := M) (N := N) f : M \u2192 N) = f := by ext; rfl\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Algebra.Lie.Abelian.abelian_of_le_center (L299-L302)\ntheorem abelian_of_le_center (I : LieIdeal R L) (h : I \u2264 center R L) : IsLieAbelian I :=\nhaveI : LieModule.IsTrivial L I := (LieModule.trivial_iff_le_maximal_trivial R L L I).mpr h\n LieIdeal.isLieAbelian_of_trivial R L I\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Algebra.Lie.Abelian.commute_toEnd_of_mem_center_right (L326-L341)\nlemma commute_toEnd_of_mem_center_right :\n Commute (toEnd R L M y) (toEnd R L M x) :=\n(LieModule.commute_toEnd_of_mem_center_left M hx y).symm\n\nend LieModule\n\nend Center\n\nsection IdealOperations\n\nopen LieSubmodule LieSubalgebra\n\nvariable {R : Type u} {L : Type v} {M : Type w}\nvariable [CommRing R] [LieRing L] [LieAlgebra R L] [AddCommGroup M] [Module R M]\nvariable [LieRingModule L M] (N N' : LieSubmodule R L M) (I J : LieIdeal R L)\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Algebra.Lie.Abelian.self_module_ker_eq_center (L295-L298)\ntheorem self_module_ker_eq_center : LieModule.ker R L L = center R L := by\next y\n simp only [LieModule.mem_maxTrivSubmodule, LieModule.mem_ker, \u2190 lie_skew _ y, neg_eq_zero]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Algebra.Lie.Abelian.center_eq_bot (L310-L321)\ntheorem center_eq_bot [LieModule.IsFaithful R L L] :\n center R L = \u22a5 :=\n(isFaithful_self_iff R L).mp inferInstance\n\nend LieAlgebra\n\nnamespace LieModule\n\nvariable {R L}\nvariable {x : L} (hx : x \u2208 LieAlgebra.center R L) (y : L)\ninclude hx\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.instLieRing (L106-L111)\ninstance instLieRing : LieRing (A \u2297[R] L) where\n add_lie x y z := by simp only [bracket_def, LinearMap.add_apply, map_add]\nlie_add x y z := by simp only [bracket_def, map_add]\n lie_self := bracket_lie_self R A L\n leibniz_lie := bracket_leibniz_lie R A L L\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.lieAlgebra (L161-L174)\ninstance lieAlgebra [CommRing R] [Algebra R A] : LieAlgebra R (RestrictScalars R A L) where\n lie_smul t x y := (lie_smul (algebraMap R A t) (RestrictScalars.addEquiv R A L x)\n(RestrictScalars.addEquiv R A L y) :)\n\nend RestrictScalars\n\nend LieAlgebra\n\nsection ExtendScalars\n\nvariable [CommRing R] [LieRing L] [LieAlgebra R L]\n [AddCommGroup M] [Module R M] [LieRingModule L M] [LieModule R L M]\n [CommRing A] [Algebra R A]\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.mem_baseChange_iff (L219-L223)\nlemma mem_baseChange_iff {m : A \u2297[R] M} :\n m \u2208 N.baseChange A \u2194\n m \u2208 Submodule.span A ((N : Submodule R M).map (TensorProduct.mk R A M 1)) := by\nrw [\u2190 Submodule.baseChange_eq_span]; rfl\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Algebra.Lie.Basic.smul_lie (L153-L155)\ntheorem smul_lie : \u2045t \u2022 x, m\u2046 = t \u2022 \u2045x, m\u2046 :=\nLieModule.smul_lie t x m\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Algebra.Lie.Abelian.lie_abelian_iff_equiv_lie_abelian (L81-L85)\ntheorem lie_abelian_iff_equiv_lie_abelian {R : Type u} {L\u2081 : Type v} {L\u2082 : Type w} [CommRing R]\n [LieRing L\u2081] [LieRing L\u2082] [LieAlgebra R L\u2081] [LieAlgebra R L\u2082] (e : L\u2081 \u2243\u2097\u2045R\u2046 L\u2082) :\n IsLieAbelian L\u2081 \u2194 IsLieAbelian L\u2082 :=\n\u27e8e.symm.injective.isLieAbelian, e.injective.isLieAbelian\u27e9\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Algebra.Lie.Abelian.IsLieAbelian (L57-L59)\nabbrev IsLieAbelian (L : Type v) [Bracket L L] [Zero L] : Prop :=\nLieModule.IsTrivial L L\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.map_apply_tmul (L141-L154)\nlemma map_apply_tmul {R A B L L' : Type*} [CommRing R] [CommRing A] [Algebra R A] [CommRing B]\n [Algebra R B] [LieRing L] [LieAlgebra R L] [LieRing L'] [LieAlgebra R L'] {f : A \u2192\u2090[R] B}\n {g : L \u2192\u2097\u2045R\u2046 L'} (a : A) (x : L) :\n map f g (a \u2297\u209c x) = (f a) \u2297\u209c (g x) :=\nrfl\n\nend ExtendScalars\n\nnamespace RestrictScalars\n\nopen RestrictScalars\n\nvariable [h : LieRing L]\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Algebra.Lie.AdjointAction.Basic.LieSubalgebra (L45-L51)\ntheorem LieSubalgebra.isNilpotent_ad_of_isNilpotent_ad {L : Type*} [LieRing L] [LieAlgebra R L]\n (K : LieSubalgebra R L) {x : K} (h : IsNilpotent (LieAlgebra.ad R L \u2191x)) :\n IsNilpotent (LieAlgebra.ad R K x) := by\nobtain \u27e8n, hn\u27e9 := h\n use n\n exact Module.End.submodule_pow_eq_zero_of_pow_eq_zero (K.ad_comp_incl_eq x) hn\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Algebra.Lie.Abelian.lie_eq_self_of_isAtom_of_ne_bot (L359-L362)\nlemma lie_eq_self_of_isAtom_of_ne_bot (hN : IsAtom N) (h : \u2045I, N\u2046 \u2260 \u22a5) : \u2045I, N\u2046 = N :=\n(hN.le_iff_eq h).mp <| LieSubmodule.lie_le_right N I\n\n-- TODO: introduce typeclass for perfect Lie algebras and use it here in the conclusion\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Algebra.Lie.Abelian.commutative_ring_iff_abelian_lie_ring (L86-L92)\ntheorem commutative_ring_iff_abelian_lie_ring {A : Type v} [Ring A] :\n Std.Commutative (\u03b1 := A) (\u00b7 * \u00b7) \u2194 IsLieAbelian A := by\nhave h\u2081 : Std.Commutative (\u03b1 := A) (\u00b7 * \u00b7) \u2194 \u2200 a b : A, a * b = b * a :=\n \u27e8fun h => h.1, fun h => \u27e8h\u27e9\u27e9\n have h\u2082 : IsLieAbelian A \u2194 \u2200 a b : A, \u2045a, b\u2046 = 0 := \u27e8fun h => h.1, fun h => \u27e8h\u27e9\u27e9\n simp only [h\u2081, h\u2082, LieRing.of_associative_ring_bracket, sub_eq_zero]\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Algebra.Lie.Abelian.isFaithful_self_iff (L306-L308)\ntheorem isFaithful_self_iff : LieModule.IsFaithful R L L \u2194 center R L = \u22a5 := by\nrw [LieModule.isFaithful_iff_ker_eq_bot, self_module_ker_eq_center]\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Algebra.Lie.AdjointAction.Derivation.ad_ker_eq_center (L66-L71)\nlemma ad_ker_eq_center : (ad R L).ker = LieAlgebra.center R L := by\next x\n rw [\u2190 LieAlgebra.self_module_ker_eq_center, LieHom.mem_ker, LieModule.mem_ker]\n simp [DFunLike.ext_iff]\n\n/-- If the center of a Lie algebra is trivial, then the adjoint action is injective. -/\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.tmul_mem_baseChange_of_mem (L215-L218)\nlemma tmul_mem_baseChange_of_mem (a : A) {m : M} (hm : m \u2208 N) :\n a \u2297\u209c[R] m \u2208 N.baseChange A :=\n(N : Submodule R M).tmul_mem_baseChange_of_mem a hm\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Algebra.Lie.Abelian.maxTrivSubmodule (L164-L170)\ndef maxTrivSubmodule : LieSubmodule R L M where\n carrier := { m | \u2200 x : L, \u2045x, m\u2046 = 0 }\nzero_mem' x := lie_zero x\n add_mem' {x y} hx hy z := by rw [lie_add, hx, hy, add_zero]\n smul_mem' c x hx y := by rw [lie_smul, hx, smul_zero]\n lie_mem {x m} hm y := by rw [hm, lie_zero]\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Algebra.Lie.Abelian.ideal_oper_maxTrivSubmodule_eq_bot (L178-L184)\ntheorem ideal_oper_maxTrivSubmodule_eq_bot (I : LieIdeal R L) :\n \u2045I, maxTrivSubmodule R L M\u2046 = \u22a5 := by\nrw [\u2190 LieSubmodule.toSubmodule_inj, LieSubmodule.lieIdeal_oper_eq_linear_span,\n LieSubmodule.bot_toSubmodule, Submodule.span_eq_bot]\n rintro m \u27e8\u27e8x, hx\u27e9, \u27e8\u27e8m, hm\u27e9, rfl\u27e9\u27e9\n exact hm x\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.bracket_tmul (L61-L105)\ntheorem bracket_tmul (s t : A) (x : L) (y : M) : \u2045s \u2297\u209c[R] x, t \u2297\u209c[R] y\u2046 = (s * t) \u2297\u209c \u2045x, y\u2046 := rfl\nset_option backward.privateInPublic true in\nprivate theorem bracket_lie_self (x : A \u2297[R] L) : \u2045x, x\u2046 = 0 := by\n simp only [bracket_def]\n refine x.induction_on ?_ ?_ ?_\n \u00b7 simp only [map_zero]\n \u00b7 intro a l\n simp only [bracket'_tmul, TensorProduct.tmul_zero, lie_self]\n \u00b7 intro z\u2081 z\u2082 h\u2081 h\u2082\n suffices bracket' R A L L z\u2081 z\u2082 + bracket' R A L L z\u2082 z\u2081 = 0 by\n rw [map_add, map_add, LinearMap.add_apply, LinearMap.add_apply, h\u2081, h\u2082,\n zero_add, add_zero, add_comm, this]\n refine z\u2081.induction_on ?_ ?_ ?_\n \u00b7 simp only [map_zero, add_zero, LinearMap.zero_apply]\n \u00b7 intro a\u2081 l\u2081; refine z\u2082.induction_on ?_ ?_ ?_\n \u00b7 simp only [map_zero, add_zero, LinearMap.zero_apply]\n \u00b7 intro a\u2082 l\u2082\n simp only [\u2190 lie_skew l\u2082 l\u2081, mul_comm a\u2081 a\u2082, TensorProduct.tmul_neg, bracket'_tmul,\n add_neg_cancel]\n \u00b7 intro y\u2081 y\u2082 hy\u2081 hy\u2082\n simp only [hy\u2081, hy\u2082, add_add_add_comm, add_zero, LinearMap.add_apply, map_add]\n \u00b7 intro y\u2081 y\u2082 hy\u2081 hy\u2082\n simp only [add_add_add_comm, hy\u2081, hy\u2082, add_zero, LinearMap.add_apply, map_add]\n\nset_option backward.privateInPublic true in\nprivate theorem bracket_leibniz_lie (x y : A \u2297[R] L) (z : A \u2297[R] M) :\n \u2045x, \u2045y, z\u2046\u2046 = \u2045\u2045x, y\u2046, z\u2046 + \u2045y, \u2045x, z\u2046\u2046 := by\n simp only [bracket_def]\n refine x.induction_on ?_ ?_ ?_\n \u00b7 simp only [map_zero, add_zero, LinearMap.zero_apply]\n \u00b7 intro a\u2081 l\u2081\n refine y.induction_on ?_ ?_ ?_\n \u00b7 simp only [map_zero, add_zero, LinearMap.zero_apply]\n \u00b7 intro a\u2082 l\u2082\n refine z.induction_on ?_ ?_ ?_\n \u00b7 simp only [map_zero, add_zero]\n \u00b7 intro a\u2083 l\u2083; simp only [bracket'_tmul]\n rw [mul_left_comm a\u2082 a\u2081 a\u2083, mul_assoc, leibniz_lie, TensorProduct.tmul_add]\n \u00b7 grind\n \u00b7 grind [LinearMap.add_apply]\n \u00b7 grind [LinearMap.add_apply]\n\nset_option backward.privateInPublic true in\nset_option backward.privateInPublic.warn false in\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Algebra.Lie.AdjointAction.Derivation.lie_der_ad_eq_ad_der (L77-L82)\nlemma lie_der_ad_eq_ad_der (D : LieDerivation R L L) (x : L) : \u2045D, ad R L x\u2046 = ad R L (D x) := by\nrw [ad_apply_lieDerivation, \u2190 lie_ad, lie_skew]\n\nvariable (R L) in\n/-- The range of the adjoint action homomorphism from a Lie algebra `L` to the Lie algebra of its\nderivations is an ideal of the latter. -/\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Algebra.Lie.Abelian.isLieAbelian_iff_center_eq_top (L303-L305)\ntheorem isLieAbelian_iff_center_eq_top : IsLieAbelian L \u2194 center R L = \u22a4 :=\nLieModule.isTrivial_iff_max_triv_eq_top R L L\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Algebra.Lie.Basic.lie_zero (L164-L166)\ntheorem lie_zero : \u2045x, 0\u2046 = (0 : M) :=\n(AddMonoidHom.mk' _ (lie_add x)).map_zero\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Algebra.Lie.Abelian.maxTrivEquiv_of_equiv_symm_eq_symm (L240-L245)\ntheorem maxTrivEquiv_of_equiv_symm_eq_symm (e : M \u2243\u2097\u2045R,L\u2046 N) :\n (maxTrivEquiv e).symm = maxTrivEquiv e.symm :=\nrfl\n\n/-- A linear map between two Lie modules is a morphism of Lie modules iff the Lie algebra action\non it is trivial. -/\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Algebra.Lie.AdjointAction.Derivation.ad_isIdealMorphism (L83-L88)\nlemma ad_isIdealMorphism : (ad R L).IsIdealMorphism := by\nsimp_rw [LieHom.isIdealMorphism_iff, lie_der_ad_eq_ad_der]\n tauto\n\n/-- A derivation `D` belongs to the ideal range of the adjoint action iff it is of the form `ad x`\nfor some `x` in the Lie algebra `L`. -/\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Algebra.Lie.Basic.lieAlgebraSelfModule (L184-L187)\ninstance lieAlgebraSelfModule : LieModule R L L where\n smul_lie t x m := by rw [\u2190 lie_skew, \u2190 lie_skew x m, LieAlgebra.lie_smul, smul_neg]\nlie_smul := by apply LieAlgebra.lie_smul\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Algebra.Lie.Abelian.LieIdeal (L60-L63)\ninstance LieIdeal.isLieAbelian_of_trivial (R : Type u) (L : Type v) [CommRing R] [LieRing L]\n [LieAlgebra R L] (I : LieIdeal R L) [h : LieModule.IsTrivial L I] : IsLieAbelian I where\n trivial x y := by apply h.trivial\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Algebra.Lie.Abelian.lie_eq_self_of_isAtom_of_nonabelian (L363-L373)\nlemma lie_eq_self_of_isAtom_of_nonabelian {R L : Type*} [CommRing R] [LieRing L] [LieAlgebra R L]\n (I : LieIdeal R L) (hI : IsAtom I) (h : \u00acIsLieAbelian I) :\n \u2045I, I\u2046 = I :=\nlie_eq_self_of_isAtom_of_ne_bot hI <| not_imp_not.mpr (lie_abelian_iff_lie_self_eq_bot I).mpr h\n\nend IdealOperations\n\nsection TrivialLieModule\n\nset_option linter.unusedVariables false in\n/-- A type synonym for an `R`-module to have a trivial Lie module structure. -/\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Algebra.Lie.Abelian.LieSubmodule (L343-L347)\ntheorem LieSubmodule.trivial_lie_oper_zero [LieModule.IsTrivial L M] : \u2045I, N\u2046 = \u22a5 := by\nsuffices \u2045I, N\u2046 \u2264 \u22a5 from le_bot_iff.mp this\n rw [lieIdeal_oper_eq_span, LieSubmodule.lieSpan_le]\n rintro m \u27e8x, n, h\u27e9; rw [trivial_lie_zero] at h; simp [\u2190 h]\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Algebra.Lie.Abelian.coe_maxTrivEquiv_apply (L230-L233)\ntheorem coe_maxTrivEquiv_apply (e : M \u2243\u2097\u2045R,L\u2046 N) (m : maxTrivSubmodule R L M) :\n (maxTrivEquiv e m : N) = e \u2191m :=\nrfl\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Algebra.Lie.Abelian.maxTrivLinearMapEquivLieModuleHom (L246-L257)\ndef maxTrivLinearMapEquivLieModuleHom : maxTrivSubmodule R L (M \u2192\u2097[R] N) \u2243\u2097[R] M \u2192\u2097\u2045R,L\u2046 N where\n toFun f :=\n{ toLinearMap := f.val\n map_lie' := fun {x m} => by\n have hf : \u2045x, f.val\u2046 m = 0 := by rw [f.property x, LinearMap.zero_apply]\n rw [LieHom.lie_apply, sub_eq_zero, \u2190 LinearMap.toFun_eq_coe] at hf; exact hf.symm }\n map_add' f g := by ext; simp\n map_smul' F G := by ext; simp\n invFun F := \u27e8F, fun x => by ext; simp\u27e9\n left_inv f := by simp\n right_inv F := by simp\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Algebra.Lie.Abelian.coe_maxTrivHom_apply (L217-L221)\ntheorem coe_maxTrivHom_apply (f : M \u2192\u2097\u2045R,L\u2046 N) (m : maxTrivSubmodule R L M) :\n (maxTrivHom f m : N) = f m :=\nrfl\n\n/-- The maximal trivial submodules of Lie-equivalent Lie modules are Lie-equivalent. -/\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Algebra.Lie.AdjointAction.Derivation.injective_ad_of_center_eq_bot (L72-L76)\nlemma injective_ad_of_center_eq_bot (h : LieAlgebra.center R L = \u22a5) :\n Function.Injective (ad R L) := by\nrw [\u2190 LieHom.ker_eq_bot, ad_ker_eq_center, h]\n\n/-- The commutator of a derivation `D` and a derivation of the form `ad x` is `ad (D x)`. -/\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Algebra.Lie.Abelian.isFaithful_iff_ker_eq_bot (L155-L158)\nlemma isFaithful_iff_ker_eq_bot : IsFaithful R L M \u2194 LieModule.ker R L M = \u22a5 := by\nrw [isFaithful_iff', LieSubmodule.ext_iff]\n aesop\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.coe_baseChange (L208-L214)\nlemma coe_baseChange :\n (N.baseChange A : Submodule A (A \u2297[R] M)) = (N : Submodule R M).baseChange A :=\nrfl\n\nvariable {N}\n\nvariable {R A L M} in\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Algebra.Lie.Abelian.maxTrivHom (L208-L215)\ndef maxTrivHom (f : M \u2192\u2097\u2045R,L\u2046 N) : maxTrivSubmodule R L M \u2192\u2097\u2045R,L\u2046 maxTrivSubmodule R L N where\n toFun m := \u27e8f m, fun x =>\n(LieModuleHom.map_lie _ _ _).symm.trans <|\n (congr_arg f (m.property x)).trans (map_zero _)\u27e9\n map_add' m n := by ext; simp\n map_smul' t m := by ext; simp\n map_lie' {x m} := by simp\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Algebra.Lie.AdjointAction.Derivation.lie_ad (L62-L65)\nlemma lie_ad (x : L) (D : LieDerivation R L L) : \u2045ad R L x, D\u2046 = \u2045x, D\u2046 := by ext; simp\nvariable (R L) in\n/-- The kernel of the adjoint action on a Lie algebra is equal to its center. -/\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Algebra.Lie.Abelian.ad_ker_eq_self_module_ker (L291-L293)\ntheorem ad_ker_eq_self_module_ker : (ad R L).ker = LieModule.ker R L L :=\nrfl\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.baseChange_top (L230-L233)\nlemma baseChange_top : (\u22a4 : LieSubmodule R L M).baseChange A = \u22a4 := by\nsimp only [baseChange, top_toSubmodule, Submodule.baseChange_top]\n rfl\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Algebra.Lie.Basic.lie_add (L149-L151)\ntheorem lie_add : \u2045x, m + n\u2046 = \u2045x, m\u2046 + \u2045x, n\u2046 :=\nLieRingModule.lie_add x m n\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Algebra.Lie.Abelian.toLinearMap_maxTrivLinearMapEquivLieModuleHom (L268-L271)\ntheorem toLinearMap_maxTrivLinearMapEquivLieModuleHom (f : maxTrivSubmodule R L (M \u2192\u2097[R] N)) :\n (maxTrivLinearMapEquivLieModuleHom (M := M) (N := N) f : M \u2192\u2097[R] N) = (f : M \u2192\u2097[R] N) := by\next; rfl\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Algebra.Lie.Basic.lie_skew (L179-L183)\ntheorem lie_skew : -\u2045y, x\u2046 = \u2045x, y\u2046 := by\nhave h : \u2045x + y, x\u2046 + \u2045x + y, y\u2046 = 0 := by rw [\u2190 lie_add]; apply lie_self\n simpa [neg_eq_iff_add_eq_zero] using h\n\n/-- Every Lie algebra is a module over itself. -/\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.baseChange (L191-L206)\ndef baseChange : LieSubmodule A (A \u2297[R] L) (A \u2297[R] M) :=\n{ (N : Submodule R M).baseChange A with\n lie_mem := by\n intro x m hm\n rw [Submodule.mem_carrier, SetLike.mem_coe] at hm \u22a2\n rw [Submodule.baseChange_eq_span] at hm\n obtain \u27e8c, rfl\u27e9 := (Finsupp.mem_span_iff_linearCombination _ _ _).mp hm\n refine x.induction_on (by simp) (fun a y \u21a6 ?_) (fun y z hy hz \u21a6 ?_)\n \u00b7 change toEnd A (A \u2297[R] L) (A \u2297[R] M) _ _ \u2208 _\n simp_rw [Finsupp.linearCombination_apply, Finsupp.sum, map_sum, map_smul, toEnd_apply_apply]\n refine Submodule.sum_mem _ fun \u27e8_, n, hn, h\u27e9 _ \u21a6 Submodule.smul_mem _ _ ?_\n rw [Subtype.coe_mk, \u2190 h]\n exact Submodule.tmul_mem_baseChange_of_mem _ (N.lie_mem hn)\n \u00b7 rw [add_lie]\n exact ((N : Submodule R M).baseChange A).add_mem hy hz }\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Algebra.Lie.Abelian.trivial_lie_zero (L44-L47)\ntheorem trivial_lie_zero (L : Type v) (M : Type w) [Bracket L M] [Zero M] [LieModule.IsTrivial L M]\n (x : L) (m : M) : \u2045x, m\u2046 = 0 :=\nLieModule.IsTrivial.trivial x m\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.instBaseLieAlgebra (L112-L113)\ninstance instBaseLieAlgebra : LieAlgebra R (A \u2297[R] L) where lie_smul := by simp [bracket_def]\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Algebra.Lie.Abelian.coe_maxTrivLinearMapEquivLieModuleHom_symm (L263-L266)\ntheorem coe_maxTrivLinearMapEquivLieModuleHom_symm (f : M \u2192\u2097\u2045R,L\u2046 N) :\n (maxTrivLinearMapEquivLieModuleHom (M := M) (N := N) |>.symm f : M \u2192 N) = f :=\nrfl\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.baseChange_bot (L225-L228)\nlemma baseChange_bot : (\u22a5 : LieSubmodule R L M).baseChange A = \u22a5 := by\nsimp only [baseChange, bot_toSubmodule, Submodule.baseChange_bot]\n rfl\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Algebra.Lie.Basic.lieRingSelfModule (L175-L177)\ninstance lieRingSelfModule : LieRingModule L L :=\n{ (inferInstance : LieRing L) with }\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Algebra.Lie.Abelian.maxTrivEquiv_of_refl_eq_refl (L235-L238)\ntheorem maxTrivEquiv_of_refl_eq_refl :\n maxTrivEquiv (LieModuleEquiv.refl : M \u2243\u2097\u2045R,L\u2046 M) = LieModuleEquiv.refl := by\next; simp only [coe_maxTrivEquiv_apply, LieModuleEquiv.refl_apply]\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Algebra.Lie.Abelian.maxTrivEquiv (L222-L228)\ndef maxTrivEquiv (e : M \u2243\u2097\u2045R,L\u2046 N) : maxTrivSubmodule R L M \u2243\u2097\u2045R,L\u2046 maxTrivSubmodule R L N :=\n{ maxTrivHom (e : M \u2192\u2097\u2045R,L\u2046 N) with\n toFun := maxTrivHom (e : M \u2192\u2097\u2045R,L\u2046 N)\n invFun := maxTrivHom (e.symm : N \u2192\u2097\u2045R,L\u2046 M)\n left_inv := fun m => by ext; simp\n right_inv := fun n => by ext; simp }\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.LieModule (L176-L190)\nlemma LieModule.toEnd_baseChange (x : L) :\n toEnd A (A \u2297[R] L) (A \u2297[R] M) (1 \u2297\u209c x) = (toEnd R L M x).baseChange A := by\next; simp\n\nnamespace LieSubmodule\n\nvariable (N : LieSubmodule R L M)\n\nopen LieModule\n\nvariable {R L M} in\n/-- If `A` is an `R`-algebra, any Lie submodule of a Lie module `M` with coefficients in `R` may be\npushed forward to a Lie submodule of `A \u2297 M` with coefficients in `A`.\n\nThis \"base change\" operation is also known as \"extension of scalars\". -/\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Algebra.Lie.Abelian.LieModule (L48-L51)\ninstance LieModule.instIsTrivialOfSubsingleton {L M : Type*}\n [LieRing L] [AddCommGroup M] [LieRingModule L M] [Subsingleton L] : LieModule.IsTrivial L M :=\n\u27e8fun x m \u21a6 by rw [Subsingleton.eq_zero x, zero_lie]\u27e9\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Algebra.Lie.Abelian.center (L284-L286)\nabbrev center : LieIdeal R L :=\nLieModule.maxTrivSubmodule R L L\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.Algebra.Lie.Derivation.BaseChange).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ndef ofLieDerivation : (LieDerivation R L L) \u2192\u2097\u2045R\u2046 (LieDerivation R (A \u2297[R] L) (A \u2297[R] L)) where\n toFun d\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Algebra.Lie.Derivation.BaseChange.ofDerivation (L37-L56)\ndef ofDerivation : Derivation R A A \u2192\u2097\u2045R\u2046 LieDerivation R (A \u2297[R] L) (A \u2297[R] L) where\n toFun d :=\n{ toFun := d.rTensor L\n map_add' := by simp\n map_smul' := by simp\n leibniz' x y := by\n simp only [LinearMap.coe_mk, AddHom.coe_mk]\n refine x.induction_on (by simp) (fun _ l \u21a6 ?_) (fun _ _ h1 h2 \u21a6 ?_)\n \u00b7 refine y.induction_on (by simp) (fun _ l' \u21a6 ?_) (fun _ _ h1 h2 \u21a6 ?_)\n \u00b7 simp [\u2190 lie_skew l' l, -lie_skew, add_tmul, tmul_neg]\n \u00b7 simp [h1, h2, sub_add_sub_comm]\n \u00b7 simp [h1, h2, sub_add_sub_comm] }\n map_add' _ _ := by ext; simp\n map_smul' _ _ := by ext; simp\n map_lie' {_ _} := by\n ext z\n refine z.induction_on (by simp) (by simp [sub_tmul]) (fun _ _ hx hy \u21a6 ?_)\n simp_all\n abel\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Algebra.Lie.Derivation.BaseChange.ofDerivation_apply (L58-L64)\nlemma ofDerivation_apply (d : Derivation R A A) (x : A \u2297[R] L) :\n ofDerivation L d x = d.toLinearMap.rTensor L x :=\nrfl\n\nvariable (A) in\n/-- A Lie derivation of an `R-`Lie algebra `L`, induces a Lie derivation of `A \u2297[R] L` for any\nAlgebra `A` over `R`. -/\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Algebra.Lie.Derivation.BaseChange.ofLieDerivation_apply (L92-L96)\nlemma ofLieDerivation_apply (d : LieDerivation R L L) (x : A \u2297[R] L) :\n ofLieDerivation A d x = d.toLinearMap.lTensor A x :=\nrfl\n\nend Lie.Derivation\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Algebra.Lie.Abelian.mem_maxTrivSubmodule (L172-L174)\ntheorem mem_maxTrivSubmodule (m : M) : m \u2208 maxTrivSubmodule R L M \u2194 \u2200 x : L, \u2045x, m\u2046 = 0 :=\nIff.rfl\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Algebra.Lie.Basic.leibniz_lie (L117-L119)\nlemma leibniz_lie [Add M] [IsLieTower L\u2081 L\u2082 M] (x : L\u2081) (y : L\u2082) (m : M) :\n \u2045x, \u2045y, m\u2046\u2046 = \u2045\u2045x, y\u2046, m\u2046 + \u2045y, \u2045x, m\u2046\u2046 := IsLieTower.leibniz_lie x y m\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Algebra.Lie.Abelian.toLinearMap_maxTrivLinearMapEquivLieModuleHom_symm (L273-L283)\ntheorem toLinearMap_maxTrivLinearMapEquivLieModuleHom_symm (f : M \u2192\u2097\u2045R,L\u2046 N) :\n (maxTrivLinearMapEquivLieModuleHom (M := M) (N := N) |>.symm f : M \u2192\u2097[R] N) = (f : M \u2192\u2097[R] N) :=\nrfl\n\nend LieModule\n\nnamespace LieAlgebra\n\n/-- The center of a Lie algebra is the set of elements that commute with everything. It can\nbe viewed as the maximal trivial submodule of the Lie algebra as a Lie module over itself via the\nadjoint representation. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.instLieRingModule (L118-L122)\ninstance instLieRingModule : LieRingModule (A \u2297[R] L) (A \u2297[R] M) where\n add_lie x y z := by simp only [bracket_def, LinearMap.add_apply, map_add]\nlie_add x y z := by simp only [bracket_def, map_add]\n leibniz_lie := bracket_leibniz_lie R A L M\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Algebra.Lie.AdjointAction.Basic.LieAlgebra (L32-L37)\ntheorem LieAlgebra.commute_ad_of_commute {a b : A} (h : Commute a b) :\n Commute (LieAlgebra.ad R A a) (LieAlgebra.ad R A b) := by\nrw [Commute, SemiconjBy, \u2190 sub_eq_zero, \u2190 Ring.lie_def,\n \u2190 (LieAlgebra.ad R A).map_lie, Ring.lie_def, sub_eq_zero.mpr h, map_zero]\n\n/-- The adjoint of a nilpotent element is nilpotent. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Algebra.Lie.Basic.LieAlgebra (L130-L134)\ntheorem LieAlgebra.toModule_injective (L : Type*) [LieRing L] :\n Function.Injective (@LieAlgebra.toModule _ _ _ _ : LieAlgebra \u211a L \u2192 Module \u211a L) := by\nrintro \u27e8h\u2081\u27e9 \u27e8h\u2082\u27e9 heq\n congr\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.instLieAlgebra (L114-L117)\ninstance instLieAlgebra : LieAlgebra A (A \u2297[R] L) where lie_smul _a _x _y := map_smul _ _ _\nset_option backward.privateInPublic true in\nset_option backward.privateInPublic.warn false in\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Algebra.Lie.Basic.lie_swap_lie (L120-L129)\nlemma lie_swap_lie [Bracket L\u2082 L\u2081] [AddCommGroup M] [IsLieTower L\u2081 L\u2082 M] [IsLieTower L\u2082 L\u2081 M]\n (x : L\u2081) (y : L\u2082) (m : M) : \u2045\u2045x, y\u2046, m\u2046 = -\u2045\u2045y, x\u2046, m\u2046 := by\nhave h1 := leibniz_lie x y m\n have h2 := leibniz_lie y x m\n convert congr($h1.symm - $h2) using 1 <;> simp only [add_sub_cancel_right, sub_add_cancel_right]\n\nend IsLieTower\n\nsection BasicProperties\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Algebra.Lie.Basic.zero_lie (L168-L170)\ntheorem zero_lie : \u2045(0 : L), m\u2046 = 0 :=\n(AddMonoidHom.mk' (fun x : L => \u2045x, m\u2046) fun x y => add_lie x y m).map_zero\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Algebra.Lie.Abelian.TrivialLieModule (L375-L380)\ndef TrivialLieModule (R L M : Type*) := M\nnamespace TrivialLieModule\n\nvariable (R L M : Type*) [CommRing R] [LieRing L] [LieAlgebra R L] [AddCommGroup M] [Module R M]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.lie_baseChange (L234-L253)\nlemma lie_baseChange {I : LieIdeal R L} {N : LieSubmodule R L M} :\n \u2045I, N\u2046.baseChange A = \u2045I.baseChange A, N.baseChange A\u2046 := by\nset s : Set (A \u2297[R] M) := { m | \u2203 x \u2208 I, \u2203 n \u2208 N, 1 \u2297\u209c \u2045x, n\u2046 = m}\n have : (TensorProduct.mk R A M 1) '' {m | \u2203 x \u2208 I, \u2203 n \u2208 N, \u2045x, n\u2046 = m} = s := by ext; simp [s]\n rw [\u2190 toSubmodule_inj, coe_baseChange, lieIdeal_oper_eq_linear_span',\n Submodule.baseChange_span, this, lieIdeal_oper_eq_linear_span']\n refine le_antisymm (Submodule.span_mono ?_) (Submodule.span_le.mpr ?_)\n \u00b7 rintro - \u27e8x, hx, m, hm, rfl\u27e9\n exact \u27e81 \u2297\u209c x, tmul_mem_baseChange_of_mem 1 hx,\n 1 \u2297\u209c m, tmul_mem_baseChange_of_mem 1 hm, by simp\u27e9\n \u00b7 rintro - \u27e8x, hx, m, hm, rfl\u27e9\n rw [mem_baseChange_iff] at hx hm\n refine Submodule.span_induction\u2082 (p := fun x m _ _ \u21a6 \u2045x, m\u2046 \u2208 Submodule.span A s)\n ?_ (by simp) (by simp) ?_ ?_ ?_ ?_ hx hm\n \u00b7 rintro - - \u27e8x, hx, rfl\u27e9 \u27e8y, hy, rfl\u27e9; exact Submodule.subset_span \u27e8x, hx, y, hy, by simp\u27e9\n all_goals { intros; simp [add_mem, Submodule.smul_mem, *] }\n\nend LieSubmodule\n\nend ExtendScalars\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Algebra.Lie.Abelian.trivial_iff_le_maximal_trivial (L194-L198)\ntheorem trivial_iff_le_maximal_trivial (N : LieSubmodule R L M) :\n IsTrivial L N \u2194 N \u2264 maxTrivSubmodule R L M :=\n\u27e8fun h m hm x => IsTrivial.casesOn h fun h => Subtype.ext_iff.mp (h x \u27e8m, hm\u27e9), fun h =>\n { trivial := fun x m => Subtype.ext (h m.2 x) }\u27e9\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Algebra.Lie.Basic.lie_smul (L157-L159)\ntheorem lie_smul : \u2045x, t \u2022 m\u2046 = t \u2022 \u2045x, m\u2046 :=\nLieModule.lie_smul t x m\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Algebra.Lie.AdjointAction.Derivation.maxTrivSubmodule_eq_bot_of_center_eq_bot (L93-L104)\nlemma maxTrivSubmodule_eq_bot_of_center_eq_bot (h : LieAlgebra.center R L = \u22a5) :\n LieModule.maxTrivSubmodule R L (LieDerivation R L L) = \u22a5 := by\nrefine (LieSubmodule.eq_bot_iff _).mpr fun D hD \u21a6 ext fun x \u21a6 ?_\n have : ad R L (D x) = 0 := by\n rw [LieModule.mem_maxTrivSubmodule] at hD\n simp [ad_apply_lieDerivation, hD]\n rw [\u2190 LieHom.mem_ker, ad_ker_eq_center, h, LieSubmodule.mem_bot] at this\n simp [this]\n\nend AdjointAction\n\nend LieDerivation\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Algebra.Lie.AdjointAction.Derivation.ad_apply_lieDerivation (L60-L61)\nlemma ad_apply_lieDerivation (x : L) (D : LieDerivation R L L) : ad R L (D x) = -\u2045x, D\u2046 := rfl\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Algebra.Lie.Basic.add_lie (L145-L147)\ntheorem add_lie : \u2045x + y, m\u2046 = \u2045x, m\u2046 + \u2045y, m\u2046 :=\nLieRingModule.add_lie x y m\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Algebra.Lie.Abelian.equiv (L386-L387)\ndef equiv : (TrivialLieModule R L M) \u2243\u2097[R] M := LinearEquiv.refl R M\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.instLieModule (L123-L127)\ninstance instLieModule : LieModule A (A \u2297[R] L) (A \u2297[R] M) where\n smul_lie t x m := by simp only [bracket_def, map_smul, LinearMap.smul_apply]\nlie_smul _ _ _ := map_smul _ _ _\n\n/-- The Lie algebra homomorphism induced by an algebra map. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Algebra.Lie.AdjointAction.Derivation.ad (L45-L57)\ndef ad : L \u2192\u2097\u2045R\u2046 LieDerivation R L L :=\n{ __ := - inner R L L\n map_lie' := by\n intro x y\n ext z\n simp only [AddHom.toFun_eq_coe, LinearMap.coe_toAddHom, LinearMap.neg_apply, coe_neg,\n Pi.neg_apply, inner_apply_apply, commutator_apply]\n rw [leibniz_lie, neg_lie, neg_lie, \u2190 lie_skew x]\n abel }\n\nvariable {R L}\n\n/-- The definitions `LieDerivation.ad` and `LieAlgebra.ad` agree. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Algebra.Lie.Abelian.Function (L64-L72)\ntheorem Function.Injective.isLieAbelian {R : Type u} {L\u2081 : Type v} {L\u2082 : Type w} [CommRing R]\n [LieRing L\u2081] [LieRing L\u2082] [LieAlgebra R L\u2081] [LieAlgebra R L\u2082] {f : L\u2081 \u2192\u2097\u2045R\u2046 L\u2082}\n (h\u2081 : Function.Injective f) (_ : IsLieAbelian L\u2082) : IsLieAbelian L\u2081 :=\n{ trivial := fun x y => h\u2081 <|\n calc\n f \u2045x, y\u2046 = \u2045f x, f y\u2046 := LieHom.map_lie f x y\n _ = 0 := trivial_lie_zero _ _ _ _\n _ = f 0 := (map_zero _).symm }\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Algebra.Lie.Abelian.isTrivial_iff_max_triv_eq_top (L199-L207)\ntheorem isTrivial_iff_max_triv_eq_top : IsTrivial L M \u2194 maxTrivSubmodule R L M = \u22a4 := by\nconstructor\n \u00b7 rintro \u27e8h\u27e9; ext; simp only [mem_maxTrivSubmodule, h, forall_const, LieSubmodule.mem_top]\n \u00b7 intro h; constructor; intro x m; revert x\n rw [\u2190 mem_maxTrivSubmodule R L M, h]; exact LieSubmodule.mem_top m\n\nvariable {R L M N}\n\n/-- `maxTrivSubmodule` is functorial. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Algebra.Lie.Basic.lie_self (L172-L174)\ntheorem lie_self : \u2045x, x\u2046 = 0 :=\nLieRing.lie_self x\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Algebra.Lie.Abelian.commute_toEnd_of_mem_center_left (L322-L325)\nlemma commute_toEnd_of_mem_center_left :\n Commute (toEnd R L M x) (toEnd R L M y) := by\nrw [Commute.symm_iff, commute_iff_lie_eq, \u2190 LieHom.map_lie, hx y, map_zero]\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Algebra.Lie.Abelian.le_max_triv_iff_bracket_eq_bot (L185-L193)\ntheorem le_max_triv_iff_bracket_eq_bot {N : LieSubmodule R L M} :\n N \u2264 maxTrivSubmodule R L M \u2194 \u2045(\u22a4 : LieIdeal R L), N\u2046 = \u22a5 := by\nrefine \u27e8fun h => ?_, fun h m hm => ?_\u27e9\n \u00b7 rw [\u2190 le_bot_iff, \u2190 ideal_oper_maxTrivSubmodule_eq_bot R L M \u22a4]\n exact LieSubmodule.mono_lie_right \u22a4 h\n \u00b7 rw [mem_maxTrivSubmodule]\n rw [LieSubmodule.lie_eq_bot_iff] at h\n exact fun x => h x (LieSubmodule.mem_top x) m hm\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Algebra.Lie.AdjointAction.Derivation.mem_ad_idealRange_iff (L89-L92)\nlemma mem_ad_idealRange_iff {D : LieDerivation R L L} :\n D \u2208 (ad R L).idealRange \u2194 \u2203 x : L, ad R L x = D :=\n(ad R L).mem_idealRange_iff (ad_isIdealMorphism R L)\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.map (L128-L139)\ndef map {R A B L L' : Type*} [CommRing R] [CommRing A] [Algebra R A] [CommRing B] [Algebra R B]\n [LieRing L] [LieAlgebra R L] [LieRing L'] [LieAlgebra R L'] (f : A \u2192\u2090[R] B) (g : L \u2192\u2097\u2045R\u2046 L') :\n A \u2297[R] L \u2192\u2097\u2045R\u2046 B \u2297[R] L' :=\n{ TensorProduct.map f.toLinearMap g with\n map_lie' {x y} := by\n simp only [bracket_def, AddHom.toFun_eq_coe, LinearMap.coe_toAddHom]\n refine x.induction_on (by simp) ?_ ?_\n \u00b7 intro _ _\n refine y.induction_on (by simp) (fun _ _ \u21a6 by simp) (fun _ _ h1 h2 \u21a6 by simp [h1, h2])\n \u00b7 intro _ _\n refine y.induction_on (by simp) (fun _ _ h \u21a6 by simp [h]) (by simp_all) }\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Algebra.Lie.Abelian.coe_maxTrivLinearMapEquivLieModuleHom (L259-L261)\ntheorem coe_maxTrivLinearMapEquivLieModuleHom (f : maxTrivSubmodule R L (M \u2192\u2097[R] N)) :\n (maxTrivLinearMapEquivLieModuleHom (M := M) (N := N) f : M \u2192 N) = f := by ext; rfl\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Algebra.Lie.Abelian.abelian_of_le_center (L299-L302)\ntheorem abelian_of_le_center (I : LieIdeal R L) (h : I \u2264 center R L) : IsLieAbelian I :=\nhaveI : LieModule.IsTrivial L I := (LieModule.trivial_iff_le_maximal_trivial R L L I).mpr h\n LieIdeal.isLieAbelian_of_trivial R L I\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Algebra.Lie.Abelian.commute_toEnd_of_mem_center_right (L326-L341)\nlemma commute_toEnd_of_mem_center_right :\n Commute (toEnd R L M y) (toEnd R L M x) :=\n(LieModule.commute_toEnd_of_mem_center_left M hx y).symm\n\nend LieModule\n\nend Center\n\nsection IdealOperations\n\nopen LieSubmodule LieSubalgebra\n\nvariable {R : Type u} {L : Type v} {M : Type w}\nvariable [CommRing R] [LieRing L] [LieAlgebra R L] [AddCommGroup M] [Module R M]\nvariable [LieRingModule L M] (N N' : LieSubmodule R L M) (I J : LieIdeal R L)\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Algebra.Lie.Abelian.self_module_ker_eq_center (L295-L298)\ntheorem self_module_ker_eq_center : LieModule.ker R L L = center R L := by\next y\n simp only [LieModule.mem_maxTrivSubmodule, LieModule.mem_ker, \u2190 lie_skew _ y, neg_eq_zero]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Algebra.Lie.Abelian.center_eq_bot (L310-L321)\ntheorem center_eq_bot [LieModule.IsFaithful R L L] :\n center R L = \u22a5 :=\n(isFaithful_self_iff R L).mp inferInstance\n\nend LieAlgebra\n\nnamespace LieModule\n\nvariable {R L}\nvariable {x : L} (hx : x \u2208 LieAlgebra.center R L) (y : L)\ninclude hx\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.instLieRing (L106-L111)\ninstance instLieRing : LieRing (A \u2297[R] L) where\n add_lie x y z := by simp only [bracket_def, LinearMap.add_apply, map_add]\nlie_add x y z := by simp only [bracket_def, map_add]\n lie_self := bracket_lie_self R A L\n leibniz_lie := bracket_leibniz_lie R A L L\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.lieAlgebra (L161-L174)\ninstance lieAlgebra [CommRing R] [Algebra R A] : LieAlgebra R (RestrictScalars R A L) where\n lie_smul t x y := (lie_smul (algebraMap R A t) (RestrictScalars.addEquiv R A L x)\n(RestrictScalars.addEquiv R A L y) :)\n\nend RestrictScalars\n\nend LieAlgebra\n\nsection ExtendScalars\n\nvariable [CommRing R] [LieRing L] [LieAlgebra R L]\n [AddCommGroup M] [Module R M] [LieRingModule L M] [LieModule R L M]\n [CommRing A] [Algebra R A]\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.mem_baseChange_iff (L219-L223)\nlemma mem_baseChange_iff {m : A \u2297[R] M} :\n m \u2208 N.baseChange A \u2194\n m \u2208 Submodule.span A ((N : Submodule R M).map (TensorProduct.mk R A M 1)) := by\nrw [\u2190 Submodule.baseChange_eq_span]; rfl\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Algebra.Lie.Basic.smul_lie (L153-L155)\ntheorem smul_lie : \u2045t \u2022 x, m\u2046 = t \u2022 \u2045x, m\u2046 :=\nLieModule.smul_lie t x m\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Algebra.Lie.Abelian.lie_abelian_iff_equiv_lie_abelian (L81-L85)\ntheorem lie_abelian_iff_equiv_lie_abelian {R : Type u} {L\u2081 : Type v} {L\u2082 : Type w} [CommRing R]\n [LieRing L\u2081] [LieRing L\u2082] [LieAlgebra R L\u2081] [LieAlgebra R L\u2082] (e : L\u2081 \u2243\u2097\u2045R\u2046 L\u2082) :\n IsLieAbelian L\u2081 \u2194 IsLieAbelian L\u2082 :=\n\u27e8e.symm.injective.isLieAbelian, e.injective.isLieAbelian\u27e9\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Algebra.Lie.Abelian.IsLieAbelian (L57-L59)\nabbrev IsLieAbelian (L : Type v) [Bracket L L] [Zero L] : Prop :=\nLieModule.IsTrivial L L\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.map_apply_tmul (L141-L154)\nlemma map_apply_tmul {R A B L L' : Type*} [CommRing R] [CommRing A] [Algebra R A] [CommRing B]\n [Algebra R B] [LieRing L] [LieAlgebra R L] [LieRing L'] [LieAlgebra R L'] {f : A \u2192\u2090[R] B}\n {g : L \u2192\u2097\u2045R\u2046 L'} (a : A) (x : L) :\n map f g (a \u2297\u209c x) = (f a) \u2297\u209c (g x) :=\nrfl\n\nend ExtendScalars\n\nnamespace RestrictScalars\n\nopen RestrictScalars\n\nvariable [h : LieRing L]\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Algebra.Lie.AdjointAction.Basic.LieSubalgebra (L45-L51)\ntheorem LieSubalgebra.isNilpotent_ad_of_isNilpotent_ad {L : Type*} [LieRing L] [LieAlgebra R L]\n (K : LieSubalgebra R L) {x : K} (h : IsNilpotent (LieAlgebra.ad R L \u2191x)) :\n IsNilpotent (LieAlgebra.ad R K x) := by\nobtain \u27e8n, hn\u27e9 := h\n use n\n exact Module.End.submodule_pow_eq_zero_of_pow_eq_zero (K.ad_comp_incl_eq x) hn\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Algebra.Lie.Abelian.lie_eq_self_of_isAtom_of_ne_bot (L359-L362)\nlemma lie_eq_self_of_isAtom_of_ne_bot (hN : IsAtom N) (h : \u2045I, N\u2046 \u2260 \u22a5) : \u2045I, N\u2046 = N :=\n(hN.le_iff_eq h).mp <| LieSubmodule.lie_le_right N I\n\n-- TODO: introduce typeclass for perfect Lie algebras and use it here in the conclusion\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Algebra.Lie.Abelian.commutative_ring_iff_abelian_lie_ring (L86-L92)\ntheorem commutative_ring_iff_abelian_lie_ring {A : Type v} [Ring A] :\n Std.Commutative (\u03b1 := A) (\u00b7 * \u00b7) \u2194 IsLieAbelian A := by\nhave h\u2081 : Std.Commutative (\u03b1 := A) (\u00b7 * \u00b7) \u2194 \u2200 a b : A, a * b = b * a :=\n \u27e8fun h => h.1, fun h => \u27e8h\u27e9\u27e9\n have h\u2082 : IsLieAbelian A \u2194 \u2200 a b : A, \u2045a, b\u2046 = 0 := \u27e8fun h => h.1, fun h => \u27e8h\u27e9\u27e9\n simp only [h\u2081, h\u2082, LieRing.of_associative_ring_bracket, sub_eq_zero]\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Algebra.Lie.Abelian.isFaithful_self_iff (L306-L308)\ntheorem isFaithful_self_iff : LieModule.IsFaithful R L L \u2194 center R L = \u22a5 := by\nrw [LieModule.isFaithful_iff_ker_eq_bot, self_module_ker_eq_center]\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Algebra.Lie.AdjointAction.Derivation.ad_ker_eq_center (L66-L71)\nlemma ad_ker_eq_center : (ad R L).ker = LieAlgebra.center R L := by\next x\n rw [\u2190 LieAlgebra.self_module_ker_eq_center, LieHom.mem_ker, LieModule.mem_ker]\n simp [DFunLike.ext_iff]\n\n/-- If the center of a Lie algebra is trivial, then the adjoint action is injective. -/\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.tmul_mem_baseChange_of_mem (L215-L218)\nlemma tmul_mem_baseChange_of_mem (a : A) {m : M} (hm : m \u2208 N) :\n a \u2297\u209c[R] m \u2208 N.baseChange A :=\n(N : Submodule R M).tmul_mem_baseChange_of_mem a hm\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Algebra.Lie.Abelian.maxTrivSubmodule (L164-L170)\ndef maxTrivSubmodule : LieSubmodule R L M where\n carrier := { m | \u2200 x : L, \u2045x, m\u2046 = 0 }\nzero_mem' x := lie_zero x\n add_mem' {x y} hx hy z := by rw [lie_add, hx, hy, add_zero]\n smul_mem' c x hx y := by rw [lie_smul, hx, smul_zero]\n lie_mem {x m} hm y := by rw [hm, lie_zero]\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Algebra.Lie.Abelian.ideal_oper_maxTrivSubmodule_eq_bot (L178-L184)\ntheorem ideal_oper_maxTrivSubmodule_eq_bot (I : LieIdeal R L) :\n \u2045I, maxTrivSubmodule R L M\u2046 = \u22a5 := by\nrw [\u2190 LieSubmodule.toSubmodule_inj, LieSubmodule.lieIdeal_oper_eq_linear_span,\n LieSubmodule.bot_toSubmodule, Submodule.span_eq_bot]\n rintro m \u27e8\u27e8x, hx\u27e9, \u27e8\u27e8m, hm\u27e9, rfl\u27e9\u27e9\n exact hm x\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.bracket_tmul (L61-L105)\ntheorem bracket_tmul (s t : A) (x : L) (y : M) : \u2045s \u2297\u209c[R] x, t \u2297\u209c[R] y\u2046 = (s * t) \u2297\u209c \u2045x, y\u2046 := rfl\nset_option backward.privateInPublic true in\nprivate theorem bracket_lie_self (x : A \u2297[R] L) : \u2045x, x\u2046 = 0 := by\n simp only [bracket_def]\n refine x.induction_on ?_ ?_ ?_\n \u00b7 simp only [map_zero]\n \u00b7 intro a l\n simp only [bracket'_tmul, TensorProduct.tmul_zero, lie_self]\n \u00b7 intro z\u2081 z\u2082 h\u2081 h\u2082\n suffices bracket' R A L L z\u2081 z\u2082 + bracket' R A L L z\u2082 z\u2081 = 0 by\n rw [map_add, map_add, LinearMap.add_apply, LinearMap.add_apply, h\u2081, h\u2082,\n zero_add, add_zero, add_comm, this]\n refine z\u2081.induction_on ?_ ?_ ?_\n \u00b7 simp only [map_zero, add_zero, LinearMap.zero_apply]\n \u00b7 intro a\u2081 l\u2081; refine z\u2082.induction_on ?_ ?_ ?_\n \u00b7 simp only [map_zero, add_zero, LinearMap.zero_apply]\n \u00b7 intro a\u2082 l\u2082\n simp only [\u2190 lie_skew l\u2082 l\u2081, mul_comm a\u2081 a\u2082, TensorProduct.tmul_neg, bracket'_tmul,\n add_neg_cancel]\n \u00b7 intro y\u2081 y\u2082 hy\u2081 hy\u2082\n simp only [hy\u2081, hy\u2082, add_add_add_comm, add_zero, LinearMap.add_apply, map_add]\n \u00b7 intro y\u2081 y\u2082 hy\u2081 hy\u2082\n simp only [add_add_add_comm, hy\u2081, hy\u2082, add_zero, LinearMap.add_apply, map_add]\n\nset_option backward.privateInPublic true in\nprivate theorem bracket_leibniz_lie (x y : A \u2297[R] L) (z : A \u2297[R] M) :\n \u2045x, \u2045y, z\u2046\u2046 = \u2045\u2045x, y\u2046, z\u2046 + \u2045y, \u2045x, z\u2046\u2046 := by\n simp only [bracket_def]\n refine x.induction_on ?_ ?_ ?_\n \u00b7 simp only [map_zero, add_zero, LinearMap.zero_apply]\n \u00b7 intro a\u2081 l\u2081\n refine y.induction_on ?_ ?_ ?_\n \u00b7 simp only [map_zero, add_zero, LinearMap.zero_apply]\n \u00b7 intro a\u2082 l\u2082\n refine z.induction_on ?_ ?_ ?_\n \u00b7 simp only [map_zero, add_zero]\n \u00b7 intro a\u2083 l\u2083; simp only [bracket'_tmul]\n rw [mul_left_comm a\u2082 a\u2081 a\u2083, mul_assoc, leibniz_lie, TensorProduct.tmul_add]\n \u00b7 grind\n \u00b7 grind [LinearMap.add_apply]\n \u00b7 grind [LinearMap.add_apply]\n\nset_option backward.privateInPublic true in\nset_option backward.privateInPublic.warn false in\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Algebra.Lie.AdjointAction.Derivation.lie_der_ad_eq_ad_der (L77-L82)\nlemma lie_der_ad_eq_ad_der (D : LieDerivation R L L) (x : L) : \u2045D, ad R L x\u2046 = ad R L (D x) := by\nrw [ad_apply_lieDerivation, \u2190 lie_ad, lie_skew]\n\nvariable (R L) in\n/-- The range of the adjoint action homomorphism from a Lie algebra `L` to the Lie algebra of its\nderivations is an ideal of the latter. -/\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Algebra.Lie.Abelian.isLieAbelian_iff_center_eq_top (L303-L305)\ntheorem isLieAbelian_iff_center_eq_top : IsLieAbelian L \u2194 center R L = \u22a4 :=\nLieModule.isTrivial_iff_max_triv_eq_top R L L\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Algebra.Lie.Basic.lie_zero (L164-L166)\ntheorem lie_zero : \u2045x, 0\u2046 = (0 : M) :=\n(AddMonoidHom.mk' _ (lie_add x)).map_zero\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Algebra.Lie.Abelian.maxTrivEquiv_of_equiv_symm_eq_symm (L240-L245)\ntheorem maxTrivEquiv_of_equiv_symm_eq_symm (e : M \u2243\u2097\u2045R,L\u2046 N) :\n (maxTrivEquiv e).symm = maxTrivEquiv e.symm :=\nrfl\n\n/-- A linear map between two Lie modules is a morphism of Lie modules iff the Lie algebra action\non it is trivial. -/\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Algebra.Lie.AdjointAction.Derivation.ad_isIdealMorphism (L83-L88)\nlemma ad_isIdealMorphism : (ad R L).IsIdealMorphism := by\nsimp_rw [LieHom.isIdealMorphism_iff, lie_der_ad_eq_ad_der]\n tauto\n\n/-- A derivation `D` belongs to the ideal range of the adjoint action iff it is of the form `ad x`\nfor some `x` in the Lie algebra `L`. -/\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Algebra.Lie.Basic.lieAlgebraSelfModule (L184-L187)\ninstance lieAlgebraSelfModule : LieModule R L L where\n smul_lie t x m := by rw [\u2190 lie_skew, \u2190 lie_skew x m, LieAlgebra.lie_smul, smul_neg]\nlie_smul := by apply LieAlgebra.lie_smul\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Algebra.Lie.Abelian.LieIdeal (L60-L63)\ninstance LieIdeal.isLieAbelian_of_trivial (R : Type u) (L : Type v) [CommRing R] [LieRing L]\n [LieAlgebra R L] (I : LieIdeal R L) [h : LieModule.IsTrivial L I] : IsLieAbelian I where\n trivial x y := by apply h.trivial\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Algebra.Lie.Abelian.lie_eq_self_of_isAtom_of_nonabelian (L363-L373)\nlemma lie_eq_self_of_isAtom_of_nonabelian {R L : Type*} [CommRing R] [LieRing L] [LieAlgebra R L]\n (I : LieIdeal R L) (hI : IsAtom I) (h : \u00acIsLieAbelian I) :\n \u2045I, I\u2046 = I :=\nlie_eq_self_of_isAtom_of_ne_bot hI <| not_imp_not.mpr (lie_abelian_iff_lie_self_eq_bot I).mpr h\n\nend IdealOperations\n\nsection TrivialLieModule\n\nset_option linter.unusedVariables false in\n/-- A type synonym for an `R`-module to have a trivial Lie module structure. -/\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Algebra.Lie.Abelian.LieSubmodule (L343-L347)\ntheorem LieSubmodule.trivial_lie_oper_zero [LieModule.IsTrivial L M] : \u2045I, N\u2046 = \u22a5 := by\nsuffices \u2045I, N\u2046 \u2264 \u22a5 from le_bot_iff.mp this\n rw [lieIdeal_oper_eq_span, LieSubmodule.lieSpan_le]\n rintro m \u27e8x, n, h\u27e9; rw [trivial_lie_zero] at h; simp [\u2190 h]\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Algebra.Lie.Abelian.coe_maxTrivEquiv_apply (L230-L233)\ntheorem coe_maxTrivEquiv_apply (e : M \u2243\u2097\u2045R,L\u2046 N) (m : maxTrivSubmodule R L M) :\n (maxTrivEquiv e m : N) = e \u2191m :=\nrfl\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Algebra.Lie.Abelian.maxTrivLinearMapEquivLieModuleHom (L246-L257)\ndef maxTrivLinearMapEquivLieModuleHom : maxTrivSubmodule R L (M \u2192\u2097[R] N) \u2243\u2097[R] M \u2192\u2097\u2045R,L\u2046 N where\n toFun f :=\n{ toLinearMap := f.val\n map_lie' := fun {x m} => by\n have hf : \u2045x, f.val\u2046 m = 0 := by rw [f.property x, LinearMap.zero_apply]\n rw [LieHom.lie_apply, sub_eq_zero, \u2190 LinearMap.toFun_eq_coe] at hf; exact hf.symm }\n map_add' f g := by ext; simp\n map_smul' F G := by ext; simp\n invFun F := \u27e8F, fun x => by ext; simp\u27e9\n left_inv f := by simp\n right_inv F := by simp\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Algebra.Lie.Abelian.coe_maxTrivHom_apply (L217-L221)\ntheorem coe_maxTrivHom_apply (f : M \u2192\u2097\u2045R,L\u2046 N) (m : maxTrivSubmodule R L M) :\n (maxTrivHom f m : N) = f m :=\nrfl\n\n/-- The maximal trivial submodules of Lie-equivalent Lie modules are Lie-equivalent. -/\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Algebra.Lie.AdjointAction.Derivation.injective_ad_of_center_eq_bot (L72-L76)\nlemma injective_ad_of_center_eq_bot (h : LieAlgebra.center R L = \u22a5) :\n Function.Injective (ad R L) := by\nrw [\u2190 LieHom.ker_eq_bot, ad_ker_eq_center, h]\n\n/-- The commutator of a derivation `D` and a derivation of the form `ad x` is `ad (D x)`. -/\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Algebra.Lie.Abelian.isFaithful_iff_ker_eq_bot (L155-L158)\nlemma isFaithful_iff_ker_eq_bot : IsFaithful R L M \u2194 LieModule.ker R L M = \u22a5 := by\nrw [isFaithful_iff', LieSubmodule.ext_iff]\n aesop\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.coe_baseChange (L208-L214)\nlemma coe_baseChange :\n (N.baseChange A : Submodule A (A \u2297[R] M)) = (N : Submodule R M).baseChange A :=\nrfl\n\nvariable {N}\n\nvariable {R A L M} in\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Algebra.Lie.Abelian.maxTrivHom (L208-L215)\ndef maxTrivHom (f : M \u2192\u2097\u2045R,L\u2046 N) : maxTrivSubmodule R L M \u2192\u2097\u2045R,L\u2046 maxTrivSubmodule R L N where\n toFun m := \u27e8f m, fun x =>\n(LieModuleHom.map_lie _ _ _).symm.trans <|\n (congr_arg f (m.property x)).trans (map_zero _)\u27e9\n map_add' m n := by ext; simp\n map_smul' t m := by ext; simp\n map_lie' {x m} := by simp\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Algebra.Lie.AdjointAction.Derivation.lie_ad (L62-L65)\nlemma lie_ad (x : L) (D : LieDerivation R L L) : \u2045ad R L x, D\u2046 = \u2045x, D\u2046 := by ext; simp\nvariable (R L) in\n/-- The kernel of the adjoint action on a Lie algebra is equal to its center. -/\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Algebra.Lie.Abelian.ad_ker_eq_self_module_ker (L291-L293)\ntheorem ad_ker_eq_self_module_ker : (ad R L).ker = LieModule.ker R L L :=\nrfl\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.baseChange_top (L230-L233)\nlemma baseChange_top : (\u22a4 : LieSubmodule R L M).baseChange A = \u22a4 := by\nsimp only [baseChange, top_toSubmodule, Submodule.baseChange_top]\n rfl\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Algebra.Lie.Basic.lie_add (L149-L151)\ntheorem lie_add : \u2045x, m + n\u2046 = \u2045x, m\u2046 + \u2045x, n\u2046 :=\nLieRingModule.lie_add x m n\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Algebra.Lie.Abelian.toLinearMap_maxTrivLinearMapEquivLieModuleHom (L268-L271)\ntheorem toLinearMap_maxTrivLinearMapEquivLieModuleHom (f : maxTrivSubmodule R L (M \u2192\u2097[R] N)) :\n (maxTrivLinearMapEquivLieModuleHom (M := M) (N := N) f : M \u2192\u2097[R] N) = (f : M \u2192\u2097[R] N) := by\next; rfl\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Algebra.Lie.Basic.lie_skew (L179-L183)\ntheorem lie_skew : -\u2045y, x\u2046 = \u2045x, y\u2046 := by\nhave h : \u2045x + y, x\u2046 + \u2045x + y, y\u2046 = 0 := by rw [\u2190 lie_add]; apply lie_self\n simpa [neg_eq_iff_add_eq_zero] using h\n\n/-- Every Lie algebra is a module over itself. -/\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.baseChange (L191-L206)\ndef baseChange : LieSubmodule A (A \u2297[R] L) (A \u2297[R] M) :=\n{ (N : Submodule R M).baseChange A with\n lie_mem := by\n intro x m hm\n rw [Submodule.mem_carrier, SetLike.mem_coe] at hm \u22a2\n rw [Submodule.baseChange_eq_span] at hm\n obtain \u27e8c, rfl\u27e9 := (Finsupp.mem_span_iff_linearCombination _ _ _).mp hm\n refine x.induction_on (by simp) (fun a y \u21a6 ?_) (fun y z hy hz \u21a6 ?_)\n \u00b7 change toEnd A (A \u2297[R] L) (A \u2297[R] M) _ _ \u2208 _\n simp_rw [Finsupp.linearCombination_apply, Finsupp.sum, map_sum, map_smul, toEnd_apply_apply]\n refine Submodule.sum_mem _ fun \u27e8_, n, hn, h\u27e9 _ \u21a6 Submodule.smul_mem _ _ ?_\n rw [Subtype.coe_mk, \u2190 h]\n exact Submodule.tmul_mem_baseChange_of_mem _ (N.lie_mem hn)\n \u00b7 rw [add_lie]\n exact ((N : Submodule R M).baseChange A).add_mem hy hz }\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Algebra.Lie.Abelian.trivial_lie_zero (L44-L47)\ntheorem trivial_lie_zero (L : Type v) (M : Type w) [Bracket L M] [Zero M] [LieModule.IsTrivial L M]\n (x : L) (m : M) : \u2045x, m\u2046 = 0 :=\nLieModule.IsTrivial.trivial x m\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.instBaseLieAlgebra (L112-L113)\ninstance instBaseLieAlgebra : LieAlgebra R (A \u2297[R] L) where lie_smul := by simp [bracket_def]\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Algebra.Lie.Abelian.coe_maxTrivLinearMapEquivLieModuleHom_symm (L263-L266)\ntheorem coe_maxTrivLinearMapEquivLieModuleHom_symm (f : M \u2192\u2097\u2045R,L\u2046 N) :\n (maxTrivLinearMapEquivLieModuleHom (M := M) (N := N) |>.symm f : M \u2192 N) = f :=\nrfl\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.baseChange_bot (L225-L228)\nlemma baseChange_bot : (\u22a5 : LieSubmodule R L M).baseChange A = \u22a5 := by\nsimp only [baseChange, bot_toSubmodule, Submodule.baseChange_bot]\n rfl\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Algebra.Lie.Basic.lieRingSelfModule (L175-L177)\ninstance lieRingSelfModule : LieRingModule L L :=\n{ (inferInstance : LieRing L) with }\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Algebra.Lie.Abelian.maxTrivEquiv_of_refl_eq_refl (L235-L238)\ntheorem maxTrivEquiv_of_refl_eq_refl :\n maxTrivEquiv (LieModuleEquiv.refl : M \u2243\u2097\u2045R,L\u2046 M) = LieModuleEquiv.refl := by\next; simp only [coe_maxTrivEquiv_apply, LieModuleEquiv.refl_apply]\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Algebra.Lie.Abelian.maxTrivEquiv (L222-L228)\ndef maxTrivEquiv (e : M \u2243\u2097\u2045R,L\u2046 N) : maxTrivSubmodule R L M \u2243\u2097\u2045R,L\u2046 maxTrivSubmodule R L N :=\n{ maxTrivHom (e : M \u2192\u2097\u2045R,L\u2046 N) with\n toFun := maxTrivHom (e : M \u2192\u2097\u2045R,L\u2046 N)\n invFun := maxTrivHom (e.symm : N \u2192\u2097\u2045R,L\u2046 M)\n left_inv := fun m => by ext; simp\n right_inv := fun n => by ext; simp }\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Algebra.Lie.BaseChange.LieModule (L176-L190)\nlemma LieModule.toEnd_baseChange (x : L) :\n toEnd A (A \u2297[R] L) (A \u2297[R] M) (1 \u2297\u209c x) = (toEnd R L M x).baseChange A := by\next; simp\n\nnamespace LieSubmodule\n\nvariable (N : LieSubmodule R L M)\n\nopen LieModule\n\nvariable {R L M} in\n/-- If `A` is an `R`-algebra, any Lie submodule of a Lie module `M` with coefficients in `R` may be\npushed forward to a Lie submodule of `A \u2297 M` with coefficients in `A`.\n\nThis \"base change\" operation is also known as \"extension of scalars\". -/\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Algebra.Lie.Abelian.LieModule (L48-L51)\ninstance LieModule.instIsTrivialOfSubsingleton {L M : Type*}\n [LieRing L] [AddCommGroup M] [LieRingModule L M] [Subsingleton L] : LieModule.IsTrivial L M :=\n\u27e8fun x m \u21a6 by rw [Subsingleton.eq_zero x, zero_lie]\u27e9\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Algebra.Lie.Abelian.center (L284-L286)\nabbrev center : LieIdeal R L :=\nLieModule.maxTrivSubmodule R L L\n```\n[/INST]", "sample_id": "C-Mathlib.Algebra.Lie.Derivation.BaseChange.ofLieDerivation", "source": {"declaration": "Mathlib.Algebra.Lie.Derivation.BaseChange.ofLieDerivation", "file": "Mathlib/Algebra/Lie/Derivation/BaseChange.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Algebra.Lie.Derivation.BaseChange", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Lie/Derivation/BaseChange.lean#L65", "span": "L65-L90"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Probability.Independence.InfinitePi.iIndepFun_iff_map_fun_eq_infinitePi_map\u2080 (L41-L71)\nlemma iIndepFun_iff_map_fun_eq_infinitePi_map\u2080 (mX : AEMeasurable (fun \u03c9 i \u21a6 X i \u03c9) P) :\n iIndepFun X P \u2194 P.map (fun \u03c9 i \u21a6 X i \u03c9) = infinitePi (fun i \u21a6 P.map (X i)) where\n mp h", "-- Mathlib.Probability.Independence.InfinitePi.iIndepFun_iff_map_fun_eq_infinitePi_map\u2080' (L72-L76)\nlemma iIndepFun_iff_map_fun_eq_infinitePi_map\u2080' [Countable \u03b9] (mX : \u2200 i, AEMeasurable (X i) P) :\n iIndepFun X P \u2194 P.map (fun \u03c9 i \u21a6 X i \u03c9) = infinitePi (fun i \u21a6 P.map (X i))", "-- Mathlib.Probability.Independence.InfinitePi.iIndepFun_iff_map_fun_eq_infinitePi_map (L77-L82)\nlemma iIndepFun_iff_map_fun_eq_infinitePi_map (mX : \u2200 i, Measurable (X i)) :\n iIndepFun X P \u2194 P.map (fun \u03c9 i \u21a6 X i \u03c9) = infinitePi (fun i \u21a6 P.map (X i))", "-- Mathlib.Probability.Independence.InfinitePi.iIndepFun_uncurry (L105-L124)\nlemma iIndepFun_uncurry {X : (i : \u03b9) \u2192 (j : \u03ba i) \u2192 \u03a9 \u2192 \ud835\udce7 i j} (mX : \u2200 i j, Measurable (X i j))\n (h1 : iIndepFun (fun i \u03c9 \u21a6 (X i \u00b7 \u03c9)) P) (h2 : \u2200 i, iIndepFun (X i) P) :\n iIndepFun (fun (p : (i : \u03b9) \u00d7 (\u03ba i)) \u03c9 \u21a6 X p.1 p.2 \u03c9) P", "-- Mathlib.Probability.Independence.InfinitePi.iIndepFun_uncurry_infinitePi (L125-L165)\nlemma iIndepFun_uncurry_infinitePi {\u03a9 : (i : \u03b9) \u2192 \u03ba i \u2192 Type*} {m\u03a9 : \u2200 i j, MeasurableSpace (\u03a9 i j)}\n {X : (i : \u03b9) \u2192 (j : \u03ba i) \u2192 \u03a9 i j \u2192 \ud835\udce7 i j}\n (\u03bc : (i : \u03b9) \u2192 (j : \u03ba i) \u2192 Measure (\u03a9 i j)) [\u2200 i j, IsProbabilityMeasure (\u03bc i j)]\n (mX : \u2200 i j, Measurable (X i j)) :\n iIndepFun (fun (p : (i : \u03b9) \u00d7 \u03ba i) (\u03c9 : \u03a0 i, \u03a0 j, \u03a9 i j) \u21a6 X p.1 p.2 (\u03c9 p.1 p.2))\n (infinitePi (fun i \u21a6 infinitePi (\u03bc i)))", "-- Mathlib.Probability.Independence.InfinitePi.iIndepFun_uncurry' (L166-L172)\nlemma iIndepFun_uncurry' {X : (i : \u03b9) \u2192 (j : \u03ba) \u2192 \u03a9 \u2192 \ud835\udce7 i j} (mX : \u2200 i j, Measurable (X i j))\n (h1 : iIndepFun (fun i \u03c9 \u21a6 (X i \u00b7 \u03c9)) P) (h2 : \u2200 i, iIndepFun (X i) P) :\n iIndepFun (fun (p : \u03b9 \u00d7 \u03ba) \u03c9 \u21a6 X p.1 p.2 \u03c9) P", "-- Mathlib.Probability.Independence.InfinitePi.iIndepFun_uncurry_infinitePi' (L173-L185)\nlemma iIndepFun_uncurry_infinitePi' {\u03a9 : \u03b9 \u2192 \u03ba \u2192 Type*} {m\u03a9 : \u2200 i j, MeasurableSpace (\u03a9 i j)}\n {X : (i : \u03b9) \u2192 (j : \u03ba) \u2192 \u03a9 i j \u2192 \ud835\udce7 i j}\n (\u03bc : (i : \u03b9) \u2192 (j : \u03ba) \u2192 Measure (\u03a9 i j)) [\u2200 i j, IsProbabilityMeasure (\u03bc i j)]\n (mX : \u2200 i j, Measurable (X i j)) :\n iIndepFun (fun (p : \u03b9 \u00d7 \u03ba) (\u03c9 : \u03a0 i, \u03a0 j, \u03a9 i j) \u21a6 X p.1 p.2 (\u03c9 p.1 p.2))\n (infinitePi (fun i \u21a6 infinitePi (\u03bc i)))", "-- Mathlib.Probability.Independence.Basic.IndepSet (L129-L135)\ndef IndepSet {_m\u03a9 : MeasurableSpace \u03a9} (s t : Set \u03a9) (\u03bc : Measure \u03a9", "-- Mathlib.Probability.Independence.Basic.iIndepSets (L96-L101)\ndef iIndepSets {_m\u03a9 : MeasurableSpace \u03a9}\n (\u03c0 : \u03b9 \u2192 Set (Set \u03a9)) (\u03bc : Measure \u03a9", "-- Mathlib.Probability.Independence.Basic.Indep (L118-L123)\ndef Indep (m\u2081 m\u2082 : MeasurableSpace \u03a9)\n {_m\u03a9 : MeasurableSpace \u03a9} (\u03bc : Measure \u03a9", "-- Mathlib.Probability.Independence.Basic.iIndepSet (L124-L128)\ndef iIndepSet {_m\u03a9 : MeasurableSpace \u03a9} (s : \u03b9 \u2192 Set \u03a9) (\u03bc : Measure \u03a9", "-- Mathlib.Probability.Independence.Basic.iIndep (L111-L117)\ndef iIndep (m : \u03b9 \u2192 MeasurableSpace \u03a9) {_m\u03a9 : MeasurableSpace \u03a9} (\u03bc : Measure \u03a9", "-- Mathlib.Probability.Independence.Basic.IndepSets (L102-L107)\ndef IndepSets {_m\u03a9 : MeasurableSpace \u03a9}\n (s1 s2 : Set (Set \u03a9)) (\u03bc : Measure \u03a9"], "statement": "lemma iIndepFun_infinitePi {\u03a9 : \u03b9 \u2192 Type*} {m\u03a9 : \u2200 i, MeasurableSpace (\u03a9 i)}\n {P : (i : \u03b9) \u2192 Measure (\u03a9 i)} [\u2200 i, IsProbabilityMeasure (P i)] {X : (i : \u03b9) \u2192 \u03a9 i \u2192 \ud835\udce7 i}\n (mX : \u2200 i, Measurable (X i)) :\n iIndepFun (fun i \u03c9 \u21a6 X i (\u03c9 i)) (infinitePi P)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 4262, "declarations_count": 437, "diagnostics_count": 0, "duplicate_fingerprint": "8da6f64f1ef8fa31", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1764, "lean_code_chars": 3479, "lean_code_ratio": 0.8163, "length_bucket": "short", "line_count": 109, "natural_language_chars": 783, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 13, "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.Probability.Independence.InfinitePi).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma iIndepFun_infinitePi {\u03a9 : \u03b9 \u2192 Type*} {m\u03a9 : \u2200 i, MeasurableSpace (\u03a9 i)}\n {P : (i : \u03b9) \u2192 Measure (\u03a9 i)} [\u2200 i, IsProbabilityMeasure (P i)] {X : (i : \u03b9) \u2192 \u03a9 i \u2192 \ud835\udce7 i}\n (mX : \u2200 i, Measurable (X i)) :\n iIndepFun (fun i \u03c9 \u21a6 X i (\u03c9 i)) (infinitePi P)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Probability.Independence.InfinitePi.iIndepFun_iff_map_fun_eq_infinitePi_map\u2080 (L41-L71)\nlemma iIndepFun_iff_map_fun_eq_infinitePi_map\u2080 (mX : AEMeasurable (fun \u03c9 i \u21a6 X i \u03c9) P) :\n iIndepFun X P \u2194 P.map (fun \u03c9 i \u21a6 X i \u03c9) = infinitePi (fun i \u21a6 P.map (X i)) where\n mp h\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Probability.Independence.InfinitePi.iIndepFun_iff_map_fun_eq_infinitePi_map\u2080' (L72-L76)\nlemma iIndepFun_iff_map_fun_eq_infinitePi_map\u2080' [Countable \u03b9] (mX : \u2200 i, AEMeasurable (X i) P) :\n iIndepFun X P \u2194 P.map (fun \u03c9 i \u21a6 X i \u03c9) = infinitePi (fun i \u21a6 P.map (X i))\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Probability.Independence.InfinitePi.iIndepFun_iff_map_fun_eq_infinitePi_map (L77-L82)\nlemma iIndepFun_iff_map_fun_eq_infinitePi_map (mX : \u2200 i, Measurable (X i)) :\n iIndepFun X P \u2194 P.map (fun \u03c9 i \u21a6 X i \u03c9) = infinitePi (fun i \u21a6 P.map (X i))\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Probability.Independence.InfinitePi.iIndepFun_uncurry (L105-L124)\nlemma iIndepFun_uncurry {X : (i : \u03b9) \u2192 (j : \u03ba i) \u2192 \u03a9 \u2192 \ud835\udce7 i j} (mX : \u2200 i j, Measurable (X i j))\n (h1 : iIndepFun (fun i \u03c9 \u21a6 (X i \u00b7 \u03c9)) P) (h2 : \u2200 i, iIndepFun (X i) P) :\n iIndepFun (fun (p : (i : \u03b9) \u00d7 (\u03ba i)) \u03c9 \u21a6 X p.1 p.2 \u03c9) P\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Probability.Independence.InfinitePi.iIndepFun_uncurry_infinitePi (L125-L165)\nlemma iIndepFun_uncurry_infinitePi {\u03a9 : (i : \u03b9) \u2192 \u03ba i \u2192 Type*} {m\u03a9 : \u2200 i j, MeasurableSpace (\u03a9 i j)}\n {X : (i : \u03b9) \u2192 (j : \u03ba i) \u2192 \u03a9 i j \u2192 \ud835\udce7 i j}\n (\u03bc : (i : \u03b9) \u2192 (j : \u03ba i) \u2192 Measure (\u03a9 i j)) [\u2200 i j, IsProbabilityMeasure (\u03bc i j)]\n (mX : \u2200 i j, Measurable (X i j)) :\n iIndepFun (fun (p : (i : \u03b9) \u00d7 \u03ba i) (\u03c9 : \u03a0 i, \u03a0 j, \u03a9 i j) \u21a6 X p.1 p.2 (\u03c9 p.1 p.2))\n (infinitePi (fun i \u21a6 infinitePi (\u03bc i)))\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Probability.Independence.InfinitePi.iIndepFun_uncurry' (L166-L172)\nlemma iIndepFun_uncurry' {X : (i : \u03b9) \u2192 (j : \u03ba) \u2192 \u03a9 \u2192 \ud835\udce7 i j} (mX : \u2200 i j, Measurable (X i j))\n (h1 : iIndepFun (fun i \u03c9 \u21a6 (X i \u00b7 \u03c9)) P) (h2 : \u2200 i, iIndepFun (X i) P) :\n iIndepFun (fun (p : \u03b9 \u00d7 \u03ba) \u03c9 \u21a6 X p.1 p.2 \u03c9) P\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Probability.Independence.InfinitePi.iIndepFun_uncurry_infinitePi' (L173-L185)\nlemma iIndepFun_uncurry_infinitePi' {\u03a9 : \u03b9 \u2192 \u03ba \u2192 Type*} {m\u03a9 : \u2200 i j, MeasurableSpace (\u03a9 i j)}\n {X : (i : \u03b9) \u2192 (j : \u03ba) \u2192 \u03a9 i j \u2192 \ud835\udce7 i j}\n (\u03bc : (i : \u03b9) \u2192 (j : \u03ba) \u2192 Measure (\u03a9 i j)) [\u2200 i j, IsProbabilityMeasure (\u03bc i j)]\n (mX : \u2200 i j, Measurable (X i j)) :\n iIndepFun (fun (p : \u03b9 \u00d7 \u03ba) (\u03c9 : \u03a0 i, \u03a0 j, \u03a9 i j) \u21a6 X p.1 p.2 (\u03c9 p.1 p.2))\n (infinitePi (fun i \u21a6 infinitePi (\u03bc i)))\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Probability.Independence.Basic.IndepSet (L129-L135)\ndef IndepSet {_m\u03a9 : MeasurableSpace \u03a9} (s t : Set \u03a9) (\u03bc : Measure \u03a9\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Probability.Independence.Basic.iIndepSets (L96-L101)\ndef iIndepSets {_m\u03a9 : MeasurableSpace \u03a9}\n (\u03c0 : \u03b9 \u2192 Set (Set \u03a9)) (\u03bc : Measure \u03a9\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Probability.Independence.Basic.Indep (L118-L123)\ndef Indep (m\u2081 m\u2082 : MeasurableSpace \u03a9)\n {_m\u03a9 : MeasurableSpace \u03a9} (\u03bc : Measure \u03a9\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Probability.Independence.Basic.iIndepSet (L124-L128)\ndef iIndepSet {_m\u03a9 : MeasurableSpace \u03a9} (s : \u03b9 \u2192 Set \u03a9) (\u03bc : Measure \u03a9\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Probability.Independence.Basic.iIndep (L111-L117)\ndef iIndep (m : \u03b9 \u2192 MeasurableSpace \u03a9) {_m\u03a9 : MeasurableSpace \u03a9} (\u03bc : Measure \u03a9\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Probability.Independence.Basic.IndepSets (L102-L107)\ndef IndepSets {_m\u03a9 : MeasurableSpace \u03a9}\n (s1 s2 : Set (Set \u03a9)) (\u03bc : Measure \u03a9\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.Probability.Independence.InfinitePi).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma iIndepFun_infinitePi {\u03a9 : \u03b9 \u2192 Type*} {m\u03a9 : \u2200 i, MeasurableSpace (\u03a9 i)}\n {P : (i : \u03b9) \u2192 Measure (\u03a9 i)} [\u2200 i, IsProbabilityMeasure (P i)] {X : (i : \u03b9) \u2192 \u03a9 i \u2192 \ud835\udce7 i}\n (mX : \u2200 i, Measurable (X i)) :\n iIndepFun (fun i \u03c9 \u21a6 X i (\u03c9 i)) (infinitePi P)\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Probability.Independence.InfinitePi.iIndepFun_iff_map_fun_eq_infinitePi_map\u2080 (L41-L71)\nlemma iIndepFun_iff_map_fun_eq_infinitePi_map\u2080 (mX : AEMeasurable (fun \u03c9 i \u21a6 X i \u03c9) P) :\n iIndepFun X P \u2194 P.map (fun \u03c9 i \u21a6 X i \u03c9) = infinitePi (fun i \u21a6 P.map (X i)) where\n mp h\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Probability.Independence.InfinitePi.iIndepFun_iff_map_fun_eq_infinitePi_map\u2080' (L72-L76)\nlemma iIndepFun_iff_map_fun_eq_infinitePi_map\u2080' [Countable \u03b9] (mX : \u2200 i, AEMeasurable (X i) P) :\n iIndepFun X P \u2194 P.map (fun \u03c9 i \u21a6 X i \u03c9) = infinitePi (fun i \u21a6 P.map (X i))\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Probability.Independence.InfinitePi.iIndepFun_iff_map_fun_eq_infinitePi_map (L77-L82)\nlemma iIndepFun_iff_map_fun_eq_infinitePi_map (mX : \u2200 i, Measurable (X i)) :\n iIndepFun X P \u2194 P.map (fun \u03c9 i \u21a6 X i \u03c9) = infinitePi (fun i \u21a6 P.map (X i))\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Probability.Independence.InfinitePi.iIndepFun_uncurry (L105-L124)\nlemma iIndepFun_uncurry {X : (i : \u03b9) \u2192 (j : \u03ba i) \u2192 \u03a9 \u2192 \ud835\udce7 i j} (mX : \u2200 i j, Measurable (X i j))\n (h1 : iIndepFun (fun i \u03c9 \u21a6 (X i \u00b7 \u03c9)) P) (h2 : \u2200 i, iIndepFun (X i) P) :\n iIndepFun (fun (p : (i : \u03b9) \u00d7 (\u03ba i)) \u03c9 \u21a6 X p.1 p.2 \u03c9) P\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Probability.Independence.InfinitePi.iIndepFun_uncurry_infinitePi (L125-L165)\nlemma iIndepFun_uncurry_infinitePi {\u03a9 : (i : \u03b9) \u2192 \u03ba i \u2192 Type*} {m\u03a9 : \u2200 i j, MeasurableSpace (\u03a9 i j)}\n {X : (i : \u03b9) \u2192 (j : \u03ba i) \u2192 \u03a9 i j \u2192 \ud835\udce7 i j}\n (\u03bc : (i : \u03b9) \u2192 (j : \u03ba i) \u2192 Measure (\u03a9 i j)) [\u2200 i j, IsProbabilityMeasure (\u03bc i j)]\n (mX : \u2200 i j, Measurable (X i j)) :\n iIndepFun (fun (p : (i : \u03b9) \u00d7 \u03ba i) (\u03c9 : \u03a0 i, \u03a0 j, \u03a9 i j) \u21a6 X p.1 p.2 (\u03c9 p.1 p.2))\n (infinitePi (fun i \u21a6 infinitePi (\u03bc i)))\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Probability.Independence.InfinitePi.iIndepFun_uncurry' (L166-L172)\nlemma iIndepFun_uncurry' {X : (i : \u03b9) \u2192 (j : \u03ba) \u2192 \u03a9 \u2192 \ud835\udce7 i j} (mX : \u2200 i j, Measurable (X i j))\n (h1 : iIndepFun (fun i \u03c9 \u21a6 (X i \u00b7 \u03c9)) P) (h2 : \u2200 i, iIndepFun (X i) P) :\n iIndepFun (fun (p : \u03b9 \u00d7 \u03ba) \u03c9 \u21a6 X p.1 p.2 \u03c9) P\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Probability.Independence.InfinitePi.iIndepFun_uncurry_infinitePi' (L173-L185)\nlemma iIndepFun_uncurry_infinitePi' {\u03a9 : \u03b9 \u2192 \u03ba \u2192 Type*} {m\u03a9 : \u2200 i j, MeasurableSpace (\u03a9 i j)}\n {X : (i : \u03b9) \u2192 (j : \u03ba) \u2192 \u03a9 i j \u2192 \ud835\udce7 i j}\n (\u03bc : (i : \u03b9) \u2192 (j : \u03ba) \u2192 Measure (\u03a9 i j)) [\u2200 i j, IsProbabilityMeasure (\u03bc i j)]\n (mX : \u2200 i j, Measurable (X i j)) :\n iIndepFun (fun (p : \u03b9 \u00d7 \u03ba) (\u03c9 : \u03a0 i, \u03a0 j, \u03a9 i j) \u21a6 X p.1 p.2 (\u03c9 p.1 p.2))\n (infinitePi (fun i \u21a6 infinitePi (\u03bc i)))\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Probability.Independence.Basic.IndepSet (L129-L135)\ndef IndepSet {_m\u03a9 : MeasurableSpace \u03a9} (s t : Set \u03a9) (\u03bc : Measure \u03a9\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Probability.Independence.Basic.iIndepSets (L96-L101)\ndef iIndepSets {_m\u03a9 : MeasurableSpace \u03a9}\n (\u03c0 : \u03b9 \u2192 Set (Set \u03a9)) (\u03bc : Measure \u03a9\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Probability.Independence.Basic.Indep (L118-L123)\ndef Indep (m\u2081 m\u2082 : MeasurableSpace \u03a9)\n {_m\u03a9 : MeasurableSpace \u03a9} (\u03bc : Measure \u03a9\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Probability.Independence.Basic.iIndepSet (L124-L128)\ndef iIndepSet {_m\u03a9 : MeasurableSpace \u03a9} (s : \u03b9 \u2192 Set \u03a9) (\u03bc : Measure \u03a9\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Probability.Independence.Basic.iIndep (L111-L117)\ndef iIndep (m : \u03b9 \u2192 MeasurableSpace \u03a9) {_m\u03a9 : MeasurableSpace \u03a9} (\u03bc : Measure \u03a9\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Probability.Independence.Basic.IndepSets (L102-L107)\ndef IndepSets {_m\u03a9 : MeasurableSpace \u03a9}\n (s1 s2 : Set (Set \u03a9)) (\u03bc : Measure \u03a9\n```\n[/INST]", "sample_id": "C-Mathlib.Probability.Independence.InfinitePi.iIndepFun_infinitePi", "source": {"declaration": "Mathlib.Probability.Independence.InfinitePi.iIndepFun_infinitePi", "file": "Mathlib/Probability/Independence/InfinitePi.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Probability.Independence.InfinitePi", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Probability/Independence/InfinitePi.lean#L83", "span": "L83-L104"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "lemma iIndep.precomp (hg : Function.Injective g) (h : iIndep m \u03ba \u03bc) :\n iIndep (m \u2218 g) \u03ba \u03bc\n frobnicateTacticThatDoesNotExist :=\n(iIndepSets.precomp hg h :)", "diagnostic": "[CompilationUnit(i_begin=0, i_end=164, messages=[Message(data=\"Function expected at\\n iIndep\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n m\\n\\nHint: The identifier `iIndep` 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=1, column=66), severity=, kind=None), Message(data=\"Function expected at\\n iIndep\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n (m \u2218 g)\\n\\nHint: The identifier `iIndep` 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=3, column=34), severity=, kind=None), Message(data='Unknown identifier `iIndepSets.precomp`', pos=Position(line=4, column=1), pos_end=Position(line=4, column=19), severity=, kind='lean.unknownIdentifier._namedError')], 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": 2221, "declarations_count": 299, "diagnostics_count": 1, "duplicate_fingerprint": "b6a5f6596bedf802", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 605, "lean_code_chars": 159, "lean_code_ratio": 0.0716, "length_bucket": "short", "line_count": 15, "natural_language_chars": 2062, "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.Probability.Independence.Kernel.Indep).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma iIndep.precomp (hg : Function.Injective g) (h : iIndep m \u03ba \u03bc) :\n iIndep (m \u2218 g) \u03ba \u03bc\n frobnicateTacticThatDoesNotExist :=\n(iIndepSets.precomp hg h :)\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=164, messages=[Message(data=\"Function expected at\\n iIndep\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n m\\n\\nHint: The identifier `iIndep` 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=1, column=66), severity=, kind=None), Message(data=\"Function expected at\\n iIndep\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n (m \u2218 g)\\n\\nHint: The identifier `iIndep` 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=3, column=34), severity=, kind=None), Message(data='Unknown identifier `iIndepSets.precomp`', pos=Position(line=4, column=1), pos_end=Position(line=4, column=19), 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.Probability.Independence.Kernel.Indep).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma iIndep.precomp (hg : Function.Injective g) (h : iIndep m \u03ba \u03bc) :\n iIndep (m \u2218 g) \u03ba \u03bc\n frobnicateTacticThatDoesNotExist :=\n(iIndepSets.precomp hg h :)\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=164, messages=[Message(data=\"Function expected at\\n iIndep\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n m\\n\\nHint: The identifier `iIndep` 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=1, column=66), severity=, kind=None), Message(data=\"Function expected at\\n iIndep\\nbut this term has type\\n ?m.2\\n\\nNote: Expected a function because this term is being applied to the argument\\n (m \u2218 g)\\n\\nHint: The identifier `iIndep` 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=3, column=34), severity=, kind=None), Message(data='Unknown identifier `iIndepSets.precomp`', pos=Position(line=4, column=1), pos_end=Position(line=4, column=19), 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.Probability.Independence.Kernel.Indep.iIndep", "source": {"declaration": "Mathlib.Probability.Independence.Kernel.Indep.iIndep", "file": "Mathlib/Probability/Independence/Kernel/Indep.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Probability.Independence.Kernel.Indep", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Probability/Independence/Kernel/Indep.lean#L234", "span": "L234-L237"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\ntheorem Periodic.nat_mul_eq [NonAssocSemiring \u03b1] (h : Periodic f c) (n : \u2115) : f (n * c) = f 0 := (h.nat_mul n).eq\n```", "instruction": "Edit `Periodic` so it still compiles and the proof is simplified where possible. Return the full updated `Periodic` block.", "proof_is_oneliner": false, "target_span": "L187-L189", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 799, "declarations_count": 90, "diagnostics_count": 0, "duplicate_fingerprint": "8b0c02eacaa3bb2b", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 269, "lean_code_chars": 114, "lean_code_ratio": 0.1427, "length_bucket": "tiny", "line_count": 10, "natural_language_chars": 685, "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.Algebra.Ring.Periodic).", "role": "system"}, {"content": "You are editing a file in `Mathlib/Algebra/Ring/Periodic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.Ring.Periodic.Periodic`, L187-L189)\n```lean\ntheorem Periodic.nat_mul_eq [NonAssocSemiring \u03b1] (h : Periodic f c) (n : \u2115) : f (n * c) = f 0 := (h.nat_mul n).eq\n```\n\n## Edit instruction\nEdit `Periodic` so it still compiles and the proof is simplified where possible. Return the full updated `Periodic` 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.Algebra.Ring.Periodic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Algebra/Ring/Periodic.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.Ring.Periodic.Periodic`, L187-L189)\n```lean\ntheorem Periodic.nat_mul_eq [NonAssocSemiring \u03b1] (h : Periodic f c) (n : \u2115) : f (n * c) = f 0 := (h.nat_mul n).eq\n```\n\n## Edit instruction\nEdit `Periodic` so it still compiles and the proof is simplified where possible. Return the full updated `Periodic` block.\n[/INST]", "sample_id": "D-Mathlib.Algebra.Ring.Periodic.Periodic", "source": {"declaration": "Mathlib.Algebra.Ring.Periodic.Periodic", "file": "Mathlib/Algebra/Ring/Periodic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Algebra.Ring.Periodic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Ring/Periodic.lean#L187", "span": "L187-L189"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "lemma apply_eq_of_coe_eq [IsTrivial (\u03c1.comp S.subtype)] (g h : G) (hgh : (g : G \u29f8 S) = h) :\n \u03c1 g = \u03c1 h\n:= by _unbalancedParenXYZ\next x\n apply (\u03c1.apply_bijective g\u207b\u00b9).1\n simpa [\u2190 Module.End.mul_apply, \u2190 map_mul, -isTrivial_def] using\n (congr($(isTrivial_def (\u03c1.comp S.subtype) \u27e8g\u207b\u00b9 * h, QuotientGroup.eq.1 hgh\u27e9) x)).symm\n\nvariable [S.Normal]\n\n/-- Given a normal subgroup `S \u2264 G`, a `G`-representation `\u03c1` which is trivial on `S` factors\nthrough `G \u29f8 S`. -/", "diagnostic": "[CompilationUnit(i_begin=0, i_end=118, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=118, i_end=371, messages=[Message(data='Unknown identifier `S.Normal`', pos=Position(line=9, column=10), pos_end=Position(line=9, column=18), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=371, i_end=489, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=12, column=19), 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": 1796, "declarations_count": 196, "diagnostics_count": 1, "duplicate_fingerprint": "75e4d0ad0996853c", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 552, "lean_code_chars": 464, "lean_code_ratio": 0.2584, "length_bucket": "short", "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.RepresentationTheory.Basic).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma apply_eq_of_coe_eq [IsTrivial (\u03c1.comp S.subtype)] (g h : G) (hgh : (g : G \u29f8 S) = h) :\n \u03c1 g = \u03c1 h\n:= by _unbalancedParenXYZ\next x\n apply (\u03c1.apply_bijective g\u207b\u00b9).1\n simpa [\u2190 Module.End.mul_apply, \u2190 map_mul, -isTrivial_def] using\n (congr($(isTrivial_def (\u03c1.comp S.subtype) \u27e8g\u207b\u00b9 * h, QuotientGroup.eq.1 hgh\u27e9) x)).symm\n\nvariable [S.Normal]\n\n/-- Given a normal subgroup `S \u2264 G`, a `G`-representation `\u03c1` which is trivial on `S` factors\nthrough `G \u29f8 S`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=118, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=118, i_end=371, messages=[Message(data='Unknown identifier `S.Normal`', pos=Position(line=9, column=10), pos_end=Position(line=9, column=18), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=371, i_end=489, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=12, column=19), 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.RepresentationTheory.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma apply_eq_of_coe_eq [IsTrivial (\u03c1.comp S.subtype)] (g h : G) (hgh : (g : G \u29f8 S) = h) :\n \u03c1 g = \u03c1 h\n:= by _unbalancedParenXYZ\next x\n apply (\u03c1.apply_bijective g\u207b\u00b9).1\n simpa [\u2190 Module.End.mul_apply, \u2190 map_mul, -isTrivial_def] using\n (congr($(isTrivial_def (\u03c1.comp S.subtype) \u27e8g\u207b\u00b9 * h, QuotientGroup.eq.1 hgh\u27e9) x)).symm\n\nvariable [S.Normal]\n\n/-- Given a normal subgroup `S \u2264 G`, a `G`-representation `\u03c1` which is trivial on `S` factors\nthrough `G \u29f8 S`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=118, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=118, i_end=371, messages=[Message(data='Unknown identifier `S.Normal`', pos=Position(line=9, column=10), pos_end=Position(line=9, column=18), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=371, i_end=489, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=12, column=19), 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.RepresentationTheory.Basic.apply_eq_of_coe_eq", "source": {"declaration": "Mathlib.RepresentationTheory.Basic.apply_eq_of_coe_eq", "file": "Mathlib/RepresentationTheory/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.RepresentationTheory.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RepresentationTheory/Basic.lean#L341", "span": "L341-L351"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\ntheorem map_add_right (f : M \u2192\u209b\u2097[\u03c3\u2081\u2082] M\u2082) (g\u2081 g\u2082 : N \u2192\u209b\u2097[\u03c3\u2081\u2082] N\u2082) :\n map f (g\u2081 + g\u2082) = map f g\u2081 + map f g\u2082 := by\next\n simp only [tmul_add, compr\u2082\u209b\u2097_apply, mk_apply, map_tmul, add_apply]\n```", "instruction": "Edit `map_add_right` so it still compiles and the proof is simplified where possible. Return the full updated `map_add_right` block.", "proof_is_oneliner": false, "target_span": "L161-L165", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 920, "declarations_count": 104, "diagnostics_count": 0, "duplicate_fingerprint": "45e03781a6a597e1", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 322, "lean_code_chars": 190, "lean_code_ratio": 0.2065, "length_bucket": "tiny", "line_count": 13, "natural_language_chars": 730, "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.LinearAlgebra.TensorProduct.Map).", "role": "system"}, {"content": "You are editing a file in `Mathlib/LinearAlgebra/TensorProduct/Map.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.LinearAlgebra.TensorProduct.Map.map_add_right`, L161-L165)\n```lean\ntheorem map_add_right (f : M \u2192\u209b\u2097[\u03c3\u2081\u2082] M\u2082) (g\u2081 g\u2082 : N \u2192\u209b\u2097[\u03c3\u2081\u2082] N\u2082) :\n map f (g\u2081 + g\u2082) = map f g\u2081 + map f g\u2082 := by\next\n simp only [tmul_add, compr\u2082\u209b\u2097_apply, mk_apply, map_tmul, add_apply]\n```\n\n## Edit instruction\nEdit `map_add_right` so it still compiles and the proof is simplified where possible. Return the full updated `map_add_right` 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.LinearAlgebra.TensorProduct.Map).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/LinearAlgebra/TensorProduct/Map.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.LinearAlgebra.TensorProduct.Map.map_add_right`, L161-L165)\n```lean\ntheorem map_add_right (f : M \u2192\u209b\u2097[\u03c3\u2081\u2082] M\u2082) (g\u2081 g\u2082 : N \u2192\u209b\u2097[\u03c3\u2081\u2082] N\u2082) :\n map f (g\u2081 + g\u2082) = map f g\u2081 + map f g\u2082 := by\next\n simp only [tmul_add, compr\u2082\u209b\u2097_apply, mk_apply, map_tmul, add_apply]\n```\n\n## Edit instruction\nEdit `map_add_right` so it still compiles and the proof is simplified where possible. Return the full updated `map_add_right` block.\n[/INST]", "sample_id": "D-Mathlib.LinearAlgebra.TensorProduct.Map.map_add_right", "source": {"declaration": "Mathlib.LinearAlgebra.TensorProduct.Map.map_add_right", "file": "Mathlib/LinearAlgebra/TensorProduct/Map.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.LinearAlgebra.TensorProduct.Map", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/LinearAlgebra/TensorProduct/Map.lean#L161", "span": "L161-L165"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "lemma isUnit_basicOpen (f : R) :\n IsUnit ((algebraMap R \u0393(R, basicOpen f)) f)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 497, "declarations_count": 57, "diagnostics_count": 0, "duplicate_fingerprint": "7c737172e964dd41", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 141, "lean_code_chars": 81, "lean_code_ratio": 0.163, "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": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.AlgebraicGeometry.StructureSheaf).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\nlemma isUnit_basicOpen (f : R) :\n IsUnit ((algebraMap R \u0393(R, basicOpen f)) 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.AlgebraicGeometry.StructureSheaf).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma isUnit_basicOpen (f : R) :\n IsUnit ((algebraMap R \u0393(R, basicOpen f)) 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.AlgebraicGeometry.StructureSheaf.isUnit_basicOpen", "source": {"declaration": "Mathlib.AlgebraicGeometry.StructureSheaf.isUnit_basicOpen", "file": "Mathlib/AlgebraicGeometry/StructureSheaf.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicGeometry.StructureSheaf", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicGeometry/StructureSheaf.lean#L389", "span": "L389-L392"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "instance smooth_comp {Z : Scheme.{u}} (g : Y \u27f6 Z) [Smooth f] [Smooth g] :\n Smooth (f \u226b g)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 511, "declarations_count": 61, "diagnostics_count": 0, "duplicate_fingerprint": "03e951be7ed82a16", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 151, "lean_code_chars": 93, "lean_code_ratio": 0.182, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 418, "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.AlgebraicGeometry.Morphisms.Smooth).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ninstance smooth_comp {Z : Scheme.{u}} (g : Y \u27f6 Z) [Smooth f] [Smooth g] :\n Smooth (f \u226b g)\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.AlgebraicGeometry.Morphisms.Smooth).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ninstance smooth_comp {Z : Scheme.{u}} (g : Y \u27f6 Z) [Smooth f] [Smooth g] :\n Smooth (f \u226b g)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.AlgebraicGeometry.Morphisms.Smooth.smooth_comp", "source": {"declaration": "Mathlib.AlgebraicGeometry.Morphisms.Smooth.smooth_comp", "file": "Mathlib/AlgebraicGeometry/Morphisms/Smooth.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicGeometry.Morphisms.Smooth", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicGeometry/Morphisms/Smooth.lean#L109", "span": "L109-L112"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\ndef unsym : \u03b1\u02e2\u02b8\u1d50 \u2243 \u03b1 := Equiv.refl _\n```", "instruction": "Edit `unsym` so it still compiles and the proof is simplified where possible. Return the full updated `unsym` block.", "proof_is_oneliner": false, "target_span": "L60-L62", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 705, "declarations_count": 78, "diagnostics_count": 0, "duplicate_fingerprint": "9c65d6f2981d6585", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 235, "lean_code_chars": 37, "lean_code_ratio": 0.0525, "length_bucket": "tiny", "line_count": 10, "natural_language_chars": 668, "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.Algebra.Symmetrized).", "role": "system"}, {"content": "You are editing a file in `Mathlib/Algebra/Symmetrized.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.Symmetrized.unsym`, L60-L62)\n```lean\ndef unsym : \u03b1\u02e2\u02b8\u1d50 \u2243 \u03b1 := Equiv.refl _\n```\n\n## Edit instruction\nEdit `unsym` so it still compiles and the proof is simplified where possible. Return the full updated `unsym` 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.Algebra.Symmetrized).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Algebra/Symmetrized.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.Symmetrized.unsym`, L60-L62)\n```lean\ndef unsym : \u03b1\u02e2\u02b8\u1d50 \u2243 \u03b1 := Equiv.refl _\n```\n\n## Edit instruction\nEdit `unsym` so it still compiles and the proof is simplified where possible. Return the full updated `unsym` block.\n[/INST]", "sample_id": "D-Mathlib.Algebra.Symmetrized.unsym", "source": {"declaration": "Mathlib.Algebra.Symmetrized.unsym", "file": "Mathlib/Algebra/Symmetrized.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Algebra.Symmetrized", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Symmetrized.lean#L60", "span": "L60-L62"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"excerpt": "```lean\ninstance forget\u2082Mon_preservesLimits : PreservesLimits (forget\u2082 SemiRingCat MonCat.{u}) := SemiRingCat.forget\u2082Mon_preservesLimitsOfSize.{u, u}\n\n/-- The forgetful functor from semirings to types preserves all limits.\n-/\n```", "instruction": "Edit `forget\u2082Mon_preservesLimits` so it still compiles and the proof is simplified where possible. Return the full updated `forget\u2082Mon_preservesLimits` block.", "proof_is_oneliner": false, "target_span": "L172-L176", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 978, "declarations_count": 101, "diagnostics_count": 0, "duplicate_fingerprint": "224351f3b459043b", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 301, "lean_code_chars": 218, "lean_code_ratio": 0.2229, "length_bucket": "tiny", "line_count": 13, "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.Algebra.Category.Ring.Limits).", "role": "system"}, {"content": "You are editing a file in `Mathlib/Algebra/Category/Ring/Limits.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.Category.Ring.Limits.forget\u2082Mon_preservesLimits`, L172-L176)\n```lean\ninstance forget\u2082Mon_preservesLimits : PreservesLimits (forget\u2082 SemiRingCat MonCat.{u}) := SemiRingCat.forget\u2082Mon_preservesLimitsOfSize.{u, u}\n\n/-- The forgetful functor from semirings to types preserves all limits.\n-/\n```\n\n## Edit instruction\nEdit `forget\u2082Mon_preservesLimits` so it still compiles and the proof is simplified where possible. Return the full updated `forget\u2082Mon_preservesLimits` 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.Algebra.Category.Ring.Limits).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]You are editing a file in `Mathlib/Algebra/Category/Ring/Limits.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Algebra.Category.Ring.Limits.forget\u2082Mon_preservesLimits`, L172-L176)\n```lean\ninstance forget\u2082Mon_preservesLimits : PreservesLimits (forget\u2082 SemiRingCat MonCat.{u}) := SemiRingCat.forget\u2082Mon_preservesLimitsOfSize.{u, u}\n\n/-- The forgetful functor from semirings to types preserves all limits.\n-/\n```\n\n## Edit instruction\nEdit `forget\u2082Mon_preservesLimits` so it still compiles and the proof is simplified where possible. Return the full updated `forget\u2082Mon_preservesLimits` block.\n[/INST]", "sample_id": "D-Mathlib.Algebra.Category.Ring.Limits.forget\u2082Mon_preservesLimits", "source": {"declaration": "Mathlib.Algebra.Category.Ring.Limits.forget\u2082Mon_preservesLimits", "file": "Mathlib/Algebra/Category/Ring/Limits.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Algebra.Category.Ring.Limits", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Category/Ring/Limits.lean#L172", "span": "L172-L176"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem tendsto_lintegral_norm_of_dominated_convergence\n (F_measurable : \u2200 n, AEStronglyMeasurable (F n) \u03bc)\n (bound_hasFiniteIntegral : HasFiniteIntegral bound \u03bc)\n (h_bound : \u2200 n, \u2200\u1d50 a \u2202\u03bc, \u2016F n a\u2016 \u2264 bound a)\n (h_lim : \u2200\u1d50 a \u2202\u03bc, Tendsto (fun n => F n a) atTop (\ud835\udcdd (f a))) :\n Tendsto (fun n => \u222b\u207b a, ENNReal.ofReal \u2016F n a - f a\u2016 \u2202\u03bc) atTop (\ud835\udcdd 0)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 788, "declarations_count": 86, "diagnostics_count": 0, "duplicate_fingerprint": "148ca9e8a2e1f16b", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 284, "lean_code_chars": 356, "lean_code_ratio": 0.4518, "length_bucket": "tiny", "line_count": 12, "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.MeasureTheory.Function.L1Space.HasFiniteIntegral).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem tendsto_lintegral_norm_of_dominated_convergence\n (F_measurable : \u2200 n, AEStronglyMeasurable (F n) \u03bc)\n (bound_hasFiniteIntegral : HasFiniteIntegral bound \u03bc)\n (h_bound : \u2200 n, \u2200\u1d50 a \u2202\u03bc, \u2016F n a\u2016 \u2264 bound a)\n (h_lim : \u2200\u1d50 a \u2202\u03bc, Tendsto (fun n => F n a) atTop (\ud835\udcdd (f a))) :\n Tendsto (fun n => \u222b\u207b a, ENNReal.ofReal \u2016F n a - f a\u2016 \u2202\u03bc) atTop (\ud835\udcdd 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.MeasureTheory.Function.L1Space.HasFiniteIntegral).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem tendsto_lintegral_norm_of_dominated_convergence\n (F_measurable : \u2200 n, AEStronglyMeasurable (F n) \u03bc)\n (bound_hasFiniteIntegral : HasFiniteIntegral bound \u03bc)\n (h_bound : \u2200 n, \u2200\u1d50 a \u2202\u03bc, \u2016F n a\u2016 \u2264 bound a)\n (h_lim : \u2200\u1d50 a \u2202\u03bc, Tendsto (fun n => F n a) atTop (\ud835\udcdd (f a))) :\n Tendsto (fun n => \u222b\u207b a, ENNReal.ofReal \u2016F n a - f a\u2016 \u2202\u03bc) atTop (\ud835\udcdd 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.MeasureTheory.Function.L1Space.HasFiniteIntegral.tendsto_lintegral_norm_of_dominated_convergence", "source": {"declaration": "Mathlib.MeasureTheory.Function.L1Space.HasFiniteIntegral.tendsto_lintegral_norm_of_dominated_convergence", "file": "Mathlib/MeasureTheory/Function/L1Space/HasFiniteIntegral.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.MeasureTheory.Function.L1Space.HasFiniteIntegral", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Function/L1Space/HasFiniteIntegral.lean#L383", "span": "L383-L437"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "lemma epi_iff_surjective_on_stonean : Epi f \u2194\n \u2200 (S : Stonean), Function.Surjective (f.hom.app (op S.compHaus))\n:= by thisIsWrongLemmaNameXYZ\nrw [\u2190 (StoneanCompHaus.equivalence A).inverse.epi_map_iff_epi,\n \u2190 Presheaf.coherentExtensiveEquivalence.functor.epi_map_iff_epi,\n \u2190 isLocallySurjective_iff_epi']\n exact extensiveTopology.isLocallySurjective_iff (D := A) _\n\nend Condensed\n\nnamespace CondensedSet\n\nvariable {X Y : CondensedSet.{u}} (f : X \u27f6 Y)", "diagnostic": "[CompilationUnit(i_begin=0, i_end=126, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None), Message(data='Unknown identifier `f.hom.app`', pos=Position(line=2, column=42), pos_end=Position(line=2, column=51), severity=, kind='lean.unknownIdentifier._namedError'), Message(data=\"Function expected at\\n Epi\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n f\\n\\nHint: The identifier `Epi` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=1, column=38), pos_end=Position(line=1, column=43), severity=, kind=None), Message(data='unsolved goals\\nx\u271d : Sort u_1\\nEpi : x\u271d\\n\u22a2 sorry \u2194 \u2200 (S : Stonean), Function.Surjective sorry', pos=Position(line=3, column=3), pos_end=Position(line=3, column=29), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=126, i_end=400, messages=[Message(data='Invalid `end`: There is no current scope to end\\n\\nNote: Scopes are introduced using `namespace` and `section`', pos=Position(line=9, column=0), pos_end=Position(line=9, column=13), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=400, i_end=424, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=424, i_end=471, 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": 2859, "declarations_count": 327, "diagnostics_count": 1, "duplicate_fingerprint": "89ed57ba8be1c816", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 836, "lean_code_chars": 460, "lean_code_ratio": 0.1609, "length_bucket": "short", "line_count": 24, "natural_language_chars": 2399, "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.Epi).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma epi_iff_surjective_on_stonean : Epi f \u2194\n \u2200 (S : Stonean), Function.Surjective (f.hom.app (op S.compHaus))\n:= by thisIsWrongLemmaNameXYZ\nrw [\u2190 (StoneanCompHaus.equivalence A).inverse.epi_map_iff_epi,\n \u2190 Presheaf.coherentExtensiveEquivalence.functor.epi_map_iff_epi,\n \u2190 isLocallySurjective_iff_epi']\n exact extensiveTopology.isLocallySurjective_iff (D := A) _\n\nend Condensed\n\nnamespace CondensedSet\n\nvariable {X Y : CondensedSet.{u}} (f : X \u27f6 Y)\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=126, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None), Message(data='Unknown identifier `f.hom.app`', pos=Position(line=2, column=42), pos_end=Position(line=2, column=51), severity=, kind='lean.unknownIdentifier._namedError'), Message(data=\"Function expected at\\n Epi\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n f\\n\\nHint: The identifier `Epi` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=1, column=38), pos_end=Position(line=1, column=43), severity=, kind=None), Message(data='unsolved goals\\nx\u271d : Sort u_1\\nEpi : x\u271d\\n\u22a2 sorry \u2194 \u2200 (S : Stonean), Function.Surjective sorry', pos=Position(line=3, column=3), pos_end=Position(line=3, column=29), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=126, i_end=400, messages=[Message(data='Invalid `end`: There is no current scope to end\\n\\nNote: Scopes are introduced using `namespace` and `section`', pos=Position(line=9, column=0), pos_end=Position(line=9, column=13), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=400, i_end=424, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=424, i_end=471, 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.Condensed.Epi).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma epi_iff_surjective_on_stonean : Epi f \u2194\n \u2200 (S : Stonean), Function.Surjective (f.hom.app (op S.compHaus))\n:= by thisIsWrongLemmaNameXYZ\nrw [\u2190 (StoneanCompHaus.equivalence A).inverse.epi_map_iff_epi,\n \u2190 Presheaf.coherentExtensiveEquivalence.functor.epi_map_iff_epi,\n \u2190 isLocallySurjective_iff_epi']\n exact extensiveTopology.isLocallySurjective_iff (D := A) _\n\nend Condensed\n\nnamespace CondensedSet\n\nvariable {X Y : CondensedSet.{u}} (f : X \u27f6 Y)\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=126, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None), Message(data='Unknown identifier `f.hom.app`', pos=Position(line=2, column=42), pos_end=Position(line=2, column=51), severity=, kind='lean.unknownIdentifier._namedError'), Message(data=\"Function expected at\\n Epi\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n f\\n\\nHint: The identifier `Epi` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=1, column=38), pos_end=Position(line=1, column=43), severity=, kind=None), Message(data='unsolved goals\\nx\u271d : Sort u_1\\nEpi : x\u271d\\n\u22a2 sorry \u2194 \u2200 (S : Stonean), Function.Surjective sorry', pos=Position(line=3, column=3), pos_end=Position(line=3, column=29), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=126, i_end=400, messages=[Message(data='Invalid `end`: There is no current scope to end\\n\\nNote: Scopes are introduced using `namespace` and `section`', pos=Position(line=9, column=0), pos_end=Position(line=9, column=13), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=400, i_end=424, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=424, i_end=471, 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.Condensed.Epi.epi_iff_surjective_on_stonean", "source": {"declaration": "Mathlib.Condensed.Epi.epi_iff_surjective_on_stonean", "file": "Mathlib/Condensed/Epi.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Condensed.Epi", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Condensed/Epi.lean#L60", "span": "L60-L72"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "theorem inv_ae : (ae \u03bc)\u207b\u00b9 = ae \u03bc\n:= by thisIsWrongLemmaNameXYZ\nrefine le_antisymm (quasiMeasurePreserving_inv \u03bc).tendsto_ae ?_\n nth_rewrite 1 [\u2190 inv_inv (ae \u03bc)]\n exact Filter.map_mono (quasiMeasurePreserving_inv \u03bc).tendsto_ae", "diagnostic": "[CompilationUnit(i_begin=0, i_end=45, messages=[Message(data='unknown tactic', pos=Position(line=2, column=7), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n ae\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03bc\\n\\nHint: The identifier `ae` 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=22), severity=, kind=None), Message(data=\"Function expected at\\n ae\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03bc\\n\\nHint: The identifier `ae` 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=28), pos_end=Position(line=1, column=32), severity=, kind=None), Message(data='unsolved goals\\nx\u271d : Sort u_1\\nae : x\u271d\\n\u22a2 sorry\u207b\u00b9 = 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=45, i_end=237, 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": 2512, "declarations_count": 332, "diagnostics_count": 1, "duplicate_fingerprint": "e006f477a3729d29", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 705, "lean_code_chars": 228, "lean_code_ratio": 0.0908, "length_bucket": "short", "line_count": 16, "natural_language_chars": 2284, "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.MeasureTheory.Group.Prod).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem inv_ae : (ae \u03bc)\u207b\u00b9 = ae \u03bc\n:= by thisIsWrongLemmaNameXYZ\nrefine le_antisymm (quasiMeasurePreserving_inv \u03bc).tendsto_ae ?_\n nth_rewrite 1 [\u2190 inv_inv (ae \u03bc)]\n exact Filter.map_mono (quasiMeasurePreserving_inv \u03bc).tendsto_ae\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=45, messages=[Message(data='unknown tactic', pos=Position(line=2, column=7), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n ae\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03bc\\n\\nHint: The identifier `ae` 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=22), severity=, kind=None), Message(data=\"Function expected at\\n ae\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03bc\\n\\nHint: The identifier `ae` 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=28), pos_end=Position(line=1, column=32), severity=, kind=None), Message(data='unsolved goals\\nx\u271d : Sort u_1\\nae : x\u271d\\n\u22a2 sorry\u207b\u00b9 = 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=45, i_end=237, 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.MeasureTheory.Group.Prod).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem inv_ae : (ae \u03bc)\u207b\u00b9 = ae \u03bc\n:= by thisIsWrongLemmaNameXYZ\nrefine le_antisymm (quasiMeasurePreserving_inv \u03bc).tendsto_ae ?_\n nth_rewrite 1 [\u2190 inv_inv (ae \u03bc)]\n exact Filter.map_mono (quasiMeasurePreserving_inv \u03bc).tendsto_ae\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=45, messages=[Message(data='unknown tactic', pos=Position(line=2, column=7), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n ae\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03bc\\n\\nHint: The identifier `ae` 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=22), severity=, kind=None), Message(data=\"Function expected at\\n ae\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n \u03bc\\n\\nHint: The identifier `ae` 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=28), pos_end=Position(line=1, column=32), severity=, kind=None), Message(data='unsolved goals\\nx\u271d : Sort u_1\\nae : x\u271d\\n\u22a2 sorry\u207b\u00b9 = 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=45, i_end=237, 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.MeasureTheory.Group.Prod.inv_ae", "source": {"declaration": "Mathlib.MeasureTheory.Group.Prod.inv_ae", "file": "Mathlib/MeasureTheory/Group/Prod.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.MeasureTheory.Group.Prod", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Group/Prod.lean#L163", "span": "L163-L167"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "theorem integrableOn_Icc_iff_integrableOn_Ico (hb : \u2016f b\u2016\u2091 \u2260 \u221e\n:= by finiteness) : .someMissingNamespaceXYZ\nIntegrableOn f (Icc a b) \u03bc \u2194 IntegrableOn f (Ico a b) \u03bc :=\n integrableOn_Icc_iff_integrableOn_Ico' (by rw [measure_singleton]; exact ENNReal.zero_ne_top) hb", "diagnostic": "[CompilationUnit(i_begin=0, i_end=69, messages=[Message(data='expected token', pos=Position(line=1, column=61), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=69, i_end=279, messages=[], 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": 1137, "declarations_count": 117, "diagnostics_count": 1, "duplicate_fingerprint": "05c40df742018e03", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 349, "lean_code_chars": 266, "lean_code_ratio": 0.2339, "length_bucket": "tiny", "line_count": 15, "natural_language_chars": 871, "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.MeasureTheory.Integral.IntegrableOn).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem integrableOn_Icc_iff_integrableOn_Ico (hb : \u2016f b\u2016\u2091 \u2260 \u221e\n:= by finiteness) : .someMissingNamespaceXYZ\nIntegrableOn f (Icc a b) \u03bc \u2194 IntegrableOn f (Ico a b) \u03bc :=\n integrableOn_Icc_iff_integrableOn_Ico' (by rw [measure_singleton]; exact ENNReal.zero_ne_top) hb\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=69, messages=[Message(data='expected token', pos=Position(line=1, column=61), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=69, i_end=279, 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.MeasureTheory.Integral.IntegrableOn).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem integrableOn_Icc_iff_integrableOn_Ico (hb : \u2016f b\u2016\u2091 \u2260 \u221e\n:= by finiteness) : .someMissingNamespaceXYZ\nIntegrableOn f (Icc a b) \u03bc \u2194 IntegrableOn f (Ico a b) \u03bc :=\n integrableOn_Icc_iff_integrableOn_Ico' (by rw [measure_singleton]; exact ENNReal.zero_ne_top) hb\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=69, messages=[Message(data='expected token', pos=Position(line=1, column=61), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=69, i_end=279, 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.MeasureTheory.Integral.IntegrableOn.integrableOn_Icc_iff_integrableOn_Ico", "source": {"declaration": "Mathlib.MeasureTheory.Integral.IntegrableOn.integrableOn_Icc_iff_integrableOn_Ico", "file": "Mathlib/MeasureTheory/Integral/IntegrableOn.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.MeasureTheory.Integral.IntegrableOn", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Integral/IntegrableOn.lean#L880", "span": "L880-L883"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "theorem mem_cycles\u2082_iff (x : G \u00d7 G \u2192\u2080 A) :\n x \u2208 cycles\u2082 A \u2194 x.sum (fun g a => single g.2 (A.\u03c1 g.1\u207b\u00b9 a) + single g.1 a) =\n x.sum (fun g a => single (g.1 * g.2) a)\n:= by thisIsWrongLemmaNameXYZ\nchange x.sum (fun g a => _) = 0 \u2194 _\n simp [sub_add_eq_add_sub, sub_eq_zero]", "diagnostic": "[CompilationUnit(i_begin=0, i_end=194, messages=[Message(data='unknown tactic', pos=Position(line=4, column=7), pos_end=None, severity=, kind=None), Message(data='failed to synthesize instance of type class\\n Zero A\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=29), pos_end=Position(line=1, column=39), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"Function expected at\\n cycles\u2082\\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 `cycles\u2082` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=8), pos_end=Position(line=2, column=17), severity=, kind=None), Message(data='unsolved goals\\nG : Type u_1\\nA : Type u_2\\nx\u271d : Sort u_3\\ncycles\u2082 : x\u271d\\nx : sorry\\n\u22a2 x \u2208 sorry \u2194 sorry = sorry', pos=Position(line=4, column=3), pos_end=Position(line=4, column=29), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=194, i_end=295, 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": 2390, "declarations_count": 308, "diagnostics_count": 1, "duplicate_fingerprint": "db16c9941ae9fcb2", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 693, "lean_code_chars": 277, "lean_code_ratio": 0.1159, "length_bucket": "short", "line_count": 17, "natural_language_chars": 2113, "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.RepresentationTheory.Homological.GroupHomology.LowDegree).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem mem_cycles\u2082_iff (x : G \u00d7 G \u2192\u2080 A) :\n x \u2208 cycles\u2082 A \u2194 x.sum (fun g a => single g.2 (A.\u03c1 g.1\u207b\u00b9 a) + single g.1 a) =\n x.sum (fun g a => single (g.1 * g.2) a)\n:= by thisIsWrongLemmaNameXYZ\nchange x.sum (fun g a => _) = 0 \u2194 _\n simp [sub_add_eq_add_sub, sub_eq_zero]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=194, messages=[Message(data='unknown tactic', pos=Position(line=4, column=7), pos_end=None, severity=, kind=None), Message(data='failed to synthesize instance of type class\\n Zero A\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=29), pos_end=Position(line=1, column=39), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"Function expected at\\n cycles\u2082\\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 `cycles\u2082` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=8), pos_end=Position(line=2, column=17), severity=, kind=None), Message(data='unsolved goals\\nG : Type u_1\\nA : Type u_2\\nx\u271d : Sort u_3\\ncycles\u2082 : x\u271d\\nx : sorry\\n\u22a2 x \u2208 sorry \u2194 sorry = sorry', pos=Position(line=4, column=3), pos_end=Position(line=4, column=29), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=194, i_end=295, 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.RepresentationTheory.Homological.GroupHomology.LowDegree).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem mem_cycles\u2082_iff (x : G \u00d7 G \u2192\u2080 A) :\n x \u2208 cycles\u2082 A \u2194 x.sum (fun g a => single g.2 (A.\u03c1 g.1\u207b\u00b9 a) + single g.1 a) =\n x.sum (fun g a => single (g.1 * g.2) a)\n:= by thisIsWrongLemmaNameXYZ\nchange x.sum (fun g a => _) = 0 \u2194 _\n simp [sub_add_eq_add_sub, sub_eq_zero]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=194, messages=[Message(data='unknown tactic', pos=Position(line=4, column=7), pos_end=None, severity=, kind=None), Message(data='failed to synthesize instance of type class\\n Zero A\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=29), pos_end=Position(line=1, column=39), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"Function expected at\\n cycles\u2082\\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 `cycles\u2082` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=8), pos_end=Position(line=2, column=17), severity=, kind=None), Message(data='unsolved goals\\nG : Type u_1\\nA : Type u_2\\nx\u271d : Sort u_3\\ncycles\u2082 : x\u271d\\nx : sorry\\n\u22a2 x \u2208 sorry \u2194 sorry = sorry', pos=Position(line=4, column=3), pos_end=Position(line=4, column=29), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=194, i_end=295, 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.RepresentationTheory.Homological.GroupHomology.LowDegree.mem_cycles\u2082_iff", "source": {"declaration": "Mathlib.RepresentationTheory.Homological.GroupHomology.LowDegree.mem_cycles\u2082_iff", "file": "Mathlib/RepresentationTheory/Homological/GroupHomology/LowDegree.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.RepresentationTheory.Homological.GroupHomology.LowDegree", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RepresentationTheory/Homological/GroupHomology/LowDegree.lean#L371", "span": "L371-L376"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "lemma finite_iff_of_iso {Y : SSet.{u}} (e : X \u2245 Y) : X.Finite \u2194 Y.Finite\n:= .someMissingNamespaceXYZ\n\u27e8fun _ \u21a6 finite_of_iso e, fun _ \u21a6 finite_of_iso e.symm\u27e9\n\nvariable (X) in", "diagnostic": "[CompilationUnit(i_begin=0, i_end=170, messages=[Message(data='Unknown constant `Iff.someMissingNamespaceXYZ`\\n\\nNote: Inferred this name from the expected resulting type of `.someMissingNamespaceXYZ`:\\n X.Finite \u2194 Y.Finite', pos=Position(line=2, column=3), pos_end=Position(line=2, column=27), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=170, i_end=185, messages=[Message(data='unexpected end of input', pos=Position(line=5, column=15), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]", "mutation_kind": "missing_import_open_namespace", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 1378, "declarations_count": 148, "diagnostics_count": 1, "duplicate_fingerprint": "90bd8f73bba77e72", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 404, "lean_code_chars": 174, "lean_code_ratio": 0.1263, "length_bucket": "tiny", "line_count": 16, "natural_language_chars": 1204, "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.Finite).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma finite_iff_of_iso {Y : SSet.{u}} (e : X \u2245 Y) : X.Finite \u2194 Y.Finite\n:= .someMissingNamespaceXYZ\n\u27e8fun _ \u21a6 finite_of_iso e, fun _ \u21a6 finite_of_iso e.symm\u27e9\n\nvariable (X) in\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=170, messages=[Message(data='Unknown constant `Iff.someMissingNamespaceXYZ`\\n\\nNote: Inferred this name from the expected resulting type of `.someMissingNamespaceXYZ`:\\n X.Finite \u2194 Y.Finite', pos=Position(line=2, column=3), pos_end=Position(line=2, column=27), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=170, i_end=185, messages=[Message(data='unexpected end of input', pos=Position(line=5, column=15), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.", "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.Finite).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma finite_iff_of_iso {Y : SSet.{u}} (e : X \u2245 Y) : X.Finite \u2194 Y.Finite\n:= .someMissingNamespaceXYZ\n\u27e8fun _ \u21a6 finite_of_iso e, fun _ \u21a6 finite_of_iso e.symm\u27e9\n\nvariable (X) in\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=170, messages=[Message(data='Unknown constant `Iff.someMissingNamespaceXYZ`\\n\\nNote: Inferred this name from the expected resulting type of `.someMissingNamespaceXYZ`:\\n X.Finite \u2194 Y.Finite', pos=Position(line=2, column=3), pos_end=Position(line=2, column=27), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=170, i_end=185, messages=[Message(data='unexpected end of input', pos=Position(line=5, column=15), pos_end=None, severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "sample_id": "B-Mathlib.AlgebraicTopology.SimplicialSet.Finite.finite_iff_of_iso", "source": {"declaration": "Mathlib.AlgebraicTopology.SimplicialSet.Finite.finite_iff_of_iso", "file": "Mathlib/AlgebraicTopology/SimplicialSet/Finite.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicTopology.SimplicialSet.Finite", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicTopology/SimplicialSet/Finite.lean#L113", "span": "L113-L116"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "def NormNums.erase {m : Type \u2192 Type} [Monad m] [MonadError m] (d : NormNums) (declName : Name) :\n m NormNums\n:= do thisIsWrongLemmaNameXYZ\nunless d.tree.values.any (\u00b7.name == declName) && ! d.erased.contains declName\n do\n throwError \"'{declName}' does not have [norm_num] attribute\"\n return d.eraseCore declName\n\ninitialize registerBuiltinAttribute {\n name := `norm_num\n descr := \"adds a norm_num extension\"\n applicationTime := .afterCompilation\n add := fun declName stx kind \u21a6 match stx with\n | `(attr| norm_num $es,*) => do\n let env \u2190 getEnv\n ensureAttrDeclIsMeta `norm_num declName kind\n unless (env.getModuleIdxFor? declName).isNone do\n throwError \"invalid attribute 'norm_num', declaration is in an imported module\"\n if (IR.getSorryDep env declName).isSome then return -- ignore in progress definitions\n let ext \u2190 mkNormNumExt declName\n let keys \u2190 MetaM.run' <| es.getElems.mapM fun stx \u21a6 do\n let e \u2190 TermElabM.run' <| withSaveInfoContext <| withAutoBoundImplicit <|\n withReader ({ \u00b7 with ignoreTCFailures := true }) do\n let e \u2190 elabTerm stx none\n let (_, _, e) \u2190 lambdaMetaTelescope (\u2190 mkLambdaFVars (\u2190 getLCtx).getFVars e)\n return e\n DiscrTree.mkPath e\n normNumExt.add ((keys, declName), ext) kind\n -- TODO: track what `[norm_num]` decls are actually used at use sites\n recordExtraRevUseOfCurrentModule\n | _ => throwUnsupportedSyntax\n erase := fun declName => do\n let s := normNumExt.getState (\u2190 getEnv)\n let s \u2190 s.erase declName\n modifyEnv fun env => normNumExt.modifyState env fun _ => s\n}\n\n/-- A simp plugin which calls `NormNum.eval`. -/", "diagnostic": "[CompilationUnit(i_begin=0, i_end=144, messages=[Message(data='invalid binder annotation, type is not a class instance\\n ?m.2\\n\\nNote: Use the command `set_option checkBinderAnnotations false` to disable the check', pos=Position(line=1, column=48), pos_end=Position(line=1, column=60), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=144, i_end=1664, messages=[Message(data=\"unexpected token 'unless'; expected command\", pos=Position(line=4, column=0), pos_end=Position(line=4, column=6), severity=, kind=None), Message(data='Unknown identifier `registerBuiltinAttribute`', pos=Position(line=9, column=11), pos_end=Position(line=9, column=35), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=1664, i_end=1712, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=38, column=48), 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": 3360, "declarations_count": 355, "diagnostics_count": 1, "duplicate_fingerprint": "3faaa71355718e98", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 946, "lean_code_chars": 1685, "lean_code_ratio": 0.5015, "length_bucket": "short", "line_count": 49, "natural_language_chars": 1675, "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.Core).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ndef NormNums.erase {m : Type \u2192 Type} [Monad m] [MonadError m] (d : NormNums) (declName : Name) :\n m NormNums\n:= do thisIsWrongLemmaNameXYZ\nunless d.tree.values.any (\u00b7.name == declName) && ! d.erased.contains declName\n do\n throwError \"'{declName}' does not have [norm_num] attribute\"\n return d.eraseCore declName\n\ninitialize registerBuiltinAttribute {\n name := `norm_num\n descr := \"adds a norm_num extension\"\n applicationTime := .afterCompilation\n add := fun declName stx kind \u21a6 match stx with\n | `(attr| norm_num $es,*) => do\n let env \u2190 getEnv\n ensureAttrDeclIsMeta `norm_num declName kind\n unless (env.getModuleIdxFor? declName).isNone do\n throwError \"invalid attribute 'norm_num', declaration is in an imported module\"\n if (IR.getSorryDep env declName).isSome then return -- ignore in progress definitions\n let ext \u2190 mkNormNumExt declName\n let keys \u2190 MetaM.run' <| es.getElems.mapM fun stx \u21a6 do\n let e \u2190 TermElabM.run' <| withSaveInfoContext <| withAutoBoundImplicit <|\n withReader ({ \u00b7 with ignoreTCFailures := true }) do\n let e \u2190 elabTerm stx none\n let (_, _, e) \u2190 lambdaMetaTelescope (\u2190 mkLambdaFVars (\u2190 getLCtx).getFVars e)\n return e\n DiscrTree.mkPath e\n normNumExt.add ((keys, declName), ext) kind\n -- TODO: track what `[norm_num]` decls are actually used at use sites\n recordExtraRevUseOfCurrentModule\n | _ => throwUnsupportedSyntax\n erase := fun declName => do\n let s := normNumExt.getState (\u2190 getEnv)\n let s \u2190 s.erase declName\n modifyEnv fun env => normNumExt.modifyState env fun _ => s\n}\n\n/-- A simp plugin which calls `NormNum.eval`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=144, messages=[Message(data='invalid binder annotation, type is not a class instance\\n ?m.2\\n\\nNote: Use the command `set_option checkBinderAnnotations false` to disable the check', pos=Position(line=1, column=48), pos_end=Position(line=1, column=60), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=144, i_end=1664, messages=[Message(data=\"unexpected token 'unless'; expected command\", pos=Position(line=4, column=0), pos_end=Position(line=4, column=6), severity=, kind=None), Message(data='Unknown identifier `registerBuiltinAttribute`', pos=Position(line=9, column=11), pos_end=Position(line=9, column=35), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=1664, i_end=1712, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=38, column=48), 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.NormNum.Core).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ndef NormNums.erase {m : Type \u2192 Type} [Monad m] [MonadError m] (d : NormNums) (declName : Name) :\n m NormNums\n:= do thisIsWrongLemmaNameXYZ\nunless d.tree.values.any (\u00b7.name == declName) && ! d.erased.contains declName\n do\n throwError \"'{declName}' does not have [norm_num] attribute\"\n return d.eraseCore declName\n\ninitialize registerBuiltinAttribute {\n name := `norm_num\n descr := \"adds a norm_num extension\"\n applicationTime := .afterCompilation\n add := fun declName stx kind \u21a6 match stx with\n | `(attr| norm_num $es,*) => do\n let env \u2190 getEnv\n ensureAttrDeclIsMeta `norm_num declName kind\n unless (env.getModuleIdxFor? declName).isNone do\n throwError \"invalid attribute 'norm_num', declaration is in an imported module\"\n if (IR.getSorryDep env declName).isSome then return -- ignore in progress definitions\n let ext \u2190 mkNormNumExt declName\n let keys \u2190 MetaM.run' <| es.getElems.mapM fun stx \u21a6 do\n let e \u2190 TermElabM.run' <| withSaveInfoContext <| withAutoBoundImplicit <|\n withReader ({ \u00b7 with ignoreTCFailures := true }) do\n let e \u2190 elabTerm stx none\n let (_, _, e) \u2190 lambdaMetaTelescope (\u2190 mkLambdaFVars (\u2190 getLCtx).getFVars e)\n return e\n DiscrTree.mkPath e\n normNumExt.add ((keys, declName), ext) kind\n -- TODO: track what `[norm_num]` decls are actually used at use sites\n recordExtraRevUseOfCurrentModule\n | _ => throwUnsupportedSyntax\n erase := fun declName => do\n let s := normNumExt.getState (\u2190 getEnv)\n let s \u2190 s.erase declName\n modifyEnv fun env => normNumExt.modifyState env fun _ => s\n}\n\n/-- A simp plugin which calls `NormNum.eval`. -/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=144, messages=[Message(data='invalid binder annotation, type is not a class instance\\n ?m.2\\n\\nNote: Use the command `set_option checkBinderAnnotations false` to disable the check', pos=Position(line=1, column=48), pos_end=Position(line=1, column=60), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=144, i_end=1664, messages=[Message(data=\"unexpected token 'unless'; expected command\", pos=Position(line=4, column=0), pos_end=Position(line=4, column=6), severity=, kind=None), Message(data='Unknown identifier `registerBuiltinAttribute`', pos=Position(line=9, column=11), pos_end=Position(line=9, column=35), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=1664, i_end=1712, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=38, column=48), 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.NormNum.Core.NormNums", "source": {"declaration": "Mathlib.Tactic.NormNum.Core.NormNums", "file": "Mathlib/Tactic/NormNum/Core.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.NormNum.Core", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/NormNum/Core.lean#L175", "span": "L175-L211"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "lemma resIndAdjunction_homEquiv_apply (A : Rep.{u} k S)\n {B : Rep.{u} k G} (f : res S.subtype B \u27f6 A) :\n (resIndAdjunction k S).homEquiv _ _ f =\n resCoindHomEquiv S.subtype B A f \u226b (indCoindIso A).inv\n frobnicateTacticThatDoesNotExist := by\nrw [resIndAdjunction, Adjunction.homEquiv_ofNatIsoRight_apply]\n simp [resCoindHomEquiv]", "diagnostic": "[CompilationUnit(i_begin=0, i_end=191, messages=[Message(data='expected token', pos=Position(line=4, column=39), pos_end=None, severity=, kind=None), Message(data='failed to synthesize instance of type class\\n Semiring k\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=43), pos_end=Position(line=1, column=54), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Semiring k\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=2, column=9), pos_end=Position(line=2, column=20), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"Function expected at\\n res\\nbut this term has type\\n ?m.4\\n\\nNote: Expected a function because this term is being applied to the argument\\n S.subtype\\n\\nHint: The identifier `res` 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=27), pos_end=Position(line=2, column=42), severity=, kind=None), Message(data=\"Function expected at\\n resIndAdjunction\\nbut this term has type\\n ?m.5\\n\\nNote: Expected a function because this term is being applied to the argument\\n k\\n\\nHint: The identifier `resIndAdjunction` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=3, column=5), pos_end=Position(line=3, column=25), severity=, kind=None), Message(data=\"Function expected at\\n resCoindHomEquiv\\nbut this term has type\\n ?m.6\\n\\nNote: Expected a function because this term is being applied to the argument\\n S.subtype\\n\\nHint: The identifier `resCoindHomEquiv` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=4, column=6), pos_end=Position(line=4, column=38), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=191, i_end=344, 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": 3809, "declarations_count": 511, "diagnostics_count": 1, "duplicate_fingerprint": "a36204dfbc51e5d4", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1019, "lean_code_chars": 341, "lean_code_ratio": 0.0895, "length_bucket": "short", "line_count": 18, "natural_language_chars": 3468, "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.RepresentationTheory.FiniteIndex).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma resIndAdjunction_homEquiv_apply (A : Rep.{u} k S)\n {B : Rep.{u} k G} (f : res S.subtype B \u27f6 A) :\n (resIndAdjunction k S).homEquiv _ _ f =\n resCoindHomEquiv S.subtype B A f \u226b (indCoindIso A).inv\n frobnicateTacticThatDoesNotExist := by\nrw [resIndAdjunction, Adjunction.homEquiv_ofNatIsoRight_apply]\n simp [resCoindHomEquiv]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=191, messages=[Message(data='expected token', pos=Position(line=4, column=39), pos_end=None, severity=, kind=None), Message(data='failed to synthesize instance of type class\\n Semiring k\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=43), pos_end=Position(line=1, column=54), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Semiring k\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=2, column=9), pos_end=Position(line=2, column=20), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"Function expected at\\n res\\nbut this term has type\\n ?m.4\\n\\nNote: Expected a function because this term is being applied to the argument\\n S.subtype\\n\\nHint: The identifier `res` 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=27), pos_end=Position(line=2, column=42), severity=, kind=None), Message(data=\"Function expected at\\n resIndAdjunction\\nbut this term has type\\n ?m.5\\n\\nNote: Expected a function because this term is being applied to the argument\\n k\\n\\nHint: The identifier `resIndAdjunction` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=3, column=5), pos_end=Position(line=3, column=25), severity=, kind=None), Message(data=\"Function expected at\\n resCoindHomEquiv\\nbut this term has type\\n ?m.6\\n\\nNote: Expected a function because this term is being applied to the argument\\n S.subtype\\n\\nHint: The identifier `resCoindHomEquiv` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=4, column=6), pos_end=Position(line=4, column=38), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=191, i_end=344, 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.RepresentationTheory.FiniteIndex).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma resIndAdjunction_homEquiv_apply (A : Rep.{u} k S)\n {B : Rep.{u} k G} (f : res S.subtype B \u27f6 A) :\n (resIndAdjunction k S).homEquiv _ _ f =\n resCoindHomEquiv S.subtype B A f \u226b (indCoindIso A).inv\n frobnicateTacticThatDoesNotExist := by\nrw [resIndAdjunction, Adjunction.homEquiv_ofNatIsoRight_apply]\n simp [resCoindHomEquiv]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=191, messages=[Message(data='expected token', pos=Position(line=4, column=39), pos_end=None, severity=, kind=None), Message(data='failed to synthesize instance of type class\\n Semiring k\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=1, column=43), pos_end=Position(line=1, column=54), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data='failed to synthesize instance of type class\\n Semiring k\\n\\nHint: Type class instance resolution failures can be inspected with the `set_option trace.Meta.synthInstance true` command.', pos=Position(line=2, column=9), pos_end=Position(line=2, column=20), severity=, kind='lean.synthInstanceFailed._namedError'), Message(data=\"Function expected at\\n res\\nbut this term has type\\n ?m.4\\n\\nNote: Expected a function because this term is being applied to the argument\\n S.subtype\\n\\nHint: The identifier `res` 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=27), pos_end=Position(line=2, column=42), severity=, kind=None), Message(data=\"Function expected at\\n resIndAdjunction\\nbut this term has type\\n ?m.5\\n\\nNote: Expected a function because this term is being applied to the argument\\n k\\n\\nHint: The identifier `resIndAdjunction` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=3, column=5), pos_end=Position(line=3, column=25), severity=, kind=None), Message(data=\"Function expected at\\n resCoindHomEquiv\\nbut this term has type\\n ?m.6\\n\\nNote: Expected a function because this term is being applied to the argument\\n S.subtype\\n\\nHint: The identifier `resCoindHomEquiv` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=4, column=6), pos_end=Position(line=4, column=38), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=191, i_end=344, 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.RepresentationTheory.FiniteIndex.resIndAdjunction_homEquiv_apply", "source": {"declaration": "Mathlib.RepresentationTheory.FiniteIndex.resIndAdjunction_homEquiv_apply", "file": "Mathlib/RepresentationTheory/FiniteIndex.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.RepresentationTheory.FiniteIndex", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RepresentationTheory/FiniteIndex.lean#L216", "span": "L216-L222"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "theorem of_le_right [LE \u03b1] (h : (a : \u03b1) \u2264 b) (eq : b = b') : a \u2264 b'\n:= eq \u25b8 h thisIsWrongLemmaNameXYZ\n/--\nGiven a proof `pf`, attempts to parse it as an upper (`lb = false`) or lower (`lb = true`)\nbound on `n`. If successful, it returns `(bound, n, pf')` where `n` is a numeral and\n`pf'` proves `n \u2264 e` or `n \u2271 e` (as described by `bound`).\n-/", "diagnostic": "[CompilationUnit(i_begin=0, i_end=110, messages=[Message(data='Function expected at\\n h\\nbut this term has type\\n a \u2264 b\\n\\nNote: Expected a function because this term is being applied to the argument\\n thisIsWrongLemmaNameXYZ', pos=Position(line=2, column=8), pos_end=Position(line=2, column=33), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=110, i_end=355, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=7, column=2), 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": 1519, "declarations_count": 197, "diagnostics_count": 1, "duplicate_fingerprint": "7e03c35c3039eff6", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 442, "lean_code_chars": 344, "lean_code_ratio": 0.2265, "length_bucket": "tiny", "line_count": 18, "natural_language_chars": 1175, "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.IntervalCases).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem of_le_right [LE \u03b1] (h : (a : \u03b1) \u2264 b) (eq : b = b') : a \u2264 b'\n:= eq \u25b8 h thisIsWrongLemmaNameXYZ\n/--\nGiven a proof `pf`, attempts to parse it as an upper (`lb = false`) or lower (`lb = true`)\nbound on `n`. If successful, it returns `(bound, n, pf')` where `n` is a numeral and\n`pf'` proves `n \u2264 e` or `n \u2271 e` (as described by `bound`).\n-/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=110, messages=[Message(data='Function expected at\\n h\\nbut this term has type\\n a \u2264 b\\n\\nNote: Expected a function because this term is being applied to the argument\\n thisIsWrongLemmaNameXYZ', pos=Position(line=2, column=8), pos_end=Position(line=2, column=33), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=110, i_end=355, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=7, 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.Tactic.IntervalCases).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem of_le_right [LE \u03b1] (h : (a : \u03b1) \u2264 b) (eq : b = b') : a \u2264 b'\n:= eq \u25b8 h thisIsWrongLemmaNameXYZ\n/--\nGiven a proof `pf`, attempts to parse it as an upper (`lb = false`) or lower (`lb = true`)\nbound on `n`. If successful, it returns `(bound, n, pf')` where `n` is a numeral and\n`pf'` proves `n \u2264 e` or `n \u2271 e` (as described by `bound`).\n-/\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=110, messages=[Message(data='Function expected at\\n h\\nbut this term has type\\n a \u2264 b\\n\\nNote: Expected a function because this term is being applied to the argument\\n thisIsWrongLemmaNameXYZ', pos=Position(line=2, column=8), pos_end=Position(line=2, column=33), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=110, i_end=355, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=7, 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.Tactic.IntervalCases.of_le_right", "source": {"declaration": "Mathlib.Tactic.IntervalCases.of_le_right", "file": "Mathlib/Tactic/IntervalCases.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.IntervalCases", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/IntervalCases.lean#L135", "span": "L135-L141"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem contMDiffOn_zeroSection {t : Set B} :\n ContMDiffOn IB (IB.prod \ud835\udcd8(\ud835\udd5c, F)) n (zeroSection F E) t", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 525, "declarations_count": 60, "diagnostics_count": 0, "duplicate_fingerprint": "66782a1bc7439bbe", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 161, "lean_code_chars": 105, "lean_code_ratio": 0.2, "length_bucket": "tiny", "line_count": 8, "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.Geometry.Manifold.VectorBundle.Basic).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem contMDiffOn_zeroSection {t : Set B} :\n ContMDiffOn IB (IB.prod \ud835\udcd8(\ud835\udd5c, F)) n (zeroSection F E) t\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.Geometry.Manifold.VectorBundle.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem contMDiffOn_zeroSection {t : Set B} :\n ContMDiffOn IB (IB.prod \ud835\udcd8(\ud835\udd5c, F)) n (zeroSection F E) t\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Geometry.Manifold.VectorBundle.Basic.contMDiffOn_zeroSection", "source": {"declaration": "Mathlib.Geometry.Manifold.VectorBundle.Basic.contMDiffOn_zeroSection", "file": "Mathlib/Geometry/Manifold/VectorBundle/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Geometry.Manifold.VectorBundle.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Geometry/Manifold/VectorBundle/Basic.lean#L245", "span": "L245-L248"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "def dispatchLemma\n (twoH : Name \u00d7 Name \u00d7 (Name \u2295 Name) \u00d7 List Bool) (debug : Bool", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 489, "declarations_count": 57, "diagnostics_count": 0, "duplicate_fingerprint": "17357a733d7b8dec", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 138, "lean_code_chars": 85, "lean_code_ratio": 0.1738, "length_bucket": "tiny", "line_count": 8, "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.ComputeDegree).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ndef dispatchLemma\n (twoH : Name \u00d7 Name \u00d7 (Name \u2295 Name) \u00d7 List Bool) (debug : 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.ComputeDegree).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ndef dispatchLemma\n (twoH : Name \u00d7 Name \u00d7 (Name \u2295 Name) \u00d7 List Bool) (debug : 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.ComputeDegree.dispatchLemma", "source": {"declaration": "Mathlib.Tactic.ComputeDegree.dispatchLemma", "file": "Mathlib/Tactic/ComputeDegree.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.ComputeDegree", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/ComputeDegree.lean#L313", "span": "L313-L378"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "instance IsRightCancelMul.mulRightStrictMono_of_mulRightMono\n [Mul N] [IsRightCancelMul N] [PartialOrder N] [MulRightMono N] :\n MulRightStrictMono N where\n elim a _ _ bc", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 596, "declarations_count": 64, "diagnostics_count": 0, "duplicate_fingerprint": "a434e59c0582fe0b", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 178, "lean_code_chars": 177, "lean_code_ratio": 0.297, "length_bucket": "tiny", "line_count": 10, "natural_language_chars": 419, "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.Algebra.Order.Monoid.Unbundled.Defs).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ninstance IsRightCancelMul.mulRightStrictMono_of_mulRightMono\n [Mul N] [IsRightCancelMul N] [PartialOrder N] [MulRightMono N] :\n MulRightStrictMono N where\n elim a _ _ bc\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.Algebra.Order.Monoid.Unbundled.Defs).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ninstance IsRightCancelMul.mulRightStrictMono_of_mulRightMono\n [Mul N] [IsRightCancelMul N] [PartialOrder N] [MulRightMono N] :\n MulRightStrictMono N where\n elim a _ _ bc\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Algebra.Order.Monoid.Unbundled.Defs.IsRightCancelMul", "source": {"declaration": "Mathlib.Algebra.Order.Monoid.Unbundled.Defs.IsRightCancelMul", "file": "Mathlib/Algebra/Order/Monoid/Unbundled/Defs.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Algebra.Order.Monoid.Unbundled.Defs", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Order/Monoid/Unbundled/Defs.lean#L544", "span": "L544-L548"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem measurable_of_Ioi {f : \u03b4 \u2192 \u03b1} (hf : \u2200 x, MeasurableSet (f \u207b\u00b9' Ioi x)) : Measurable f", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 521, "declarations_count": 57, "diagnostics_count": 0, "duplicate_fingerprint": "4fa45d3cf3d9f0b7", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 157, "lean_code_chars": 93, "lean_code_ratio": 0.1785, "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.MeasureTheory.Constructions.BorelSpace.Order).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem measurable_of_Ioi {f : \u03b4 \u2192 \u03b1} (hf : \u2200 x, MeasurableSet (f \u207b\u00b9' Ioi x)) : Measurable 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.MeasureTheory.Constructions.BorelSpace.Order).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem measurable_of_Ioi {f : \u03b4 \u2192 \u03b1} (hf : \u2200 x, MeasurableSet (f \u207b\u00b9' Ioi x)) : Measurable 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.MeasureTheory.Constructions.BorelSpace.Order.measurable_of_Ioi", "source": {"declaration": "Mathlib.MeasureTheory.Constructions.BorelSpace.Order.measurable_of_Ioi", "file": "Mathlib/MeasureTheory/Constructions/BorelSpace/Order.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.MeasureTheory.Constructions.BorelSpace.Order", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Constructions/BorelSpace/Order.lean#L653", "span": "L653-L657"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem rightAdjointUniq_refl {F : C \u2964 D} {G : D \u2964 C} (adj1 : F \u22a3 G) :\n (rightAdjointUniq adj1 adj1).hom = \ud835\udfd9 _", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 530, "declarations_count": 62, "diagnostics_count": 0, "duplicate_fingerprint": "661607e6127224c8", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 170, "lean_code_chars": 114, "lean_code_ratio": 0.2151, "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": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.CategoryTheory.Adjunction.Unique).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem rightAdjointUniq_refl {F : C \u2964 D} {G : D \u2964 C} (adj1 : F \u22a3 G) :\n (rightAdjointUniq adj1 adj1).hom = \ud835\udfd9 _\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.CategoryTheory.Adjunction.Unique).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem rightAdjointUniq_refl {F : C \u2964 D} {G : D \u2964 C} (adj1 : F \u22a3 G) :\n (rightAdjointUniq adj1 adj1).hom = \ud835\udfd9 _\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.CategoryTheory.Adjunction.Unique.rightAdjointUniq_refl", "source": {"declaration": "Mathlib.CategoryTheory.Adjunction.Unique.rightAdjointUniq_refl", "file": "Mathlib/CategoryTheory/Adjunction/Unique.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.CategoryTheory.Adjunction.Unique", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Adjunction/Unique.lean#L162", "span": "L162-L169"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem Measure.isComplete_iff : \u03bc.IsComplete \u2194 \u2200 s, \u03bc s = 0 \u2192 MeasurableSet s", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 499, "declarations_count": 53, "diagnostics_count": 0, "duplicate_fingerprint": "67f5b90a4d620f89", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 144, "lean_code_chars": 79, "lean_code_ratio": 0.1583, "length_bucket": "tiny", "line_count": 7, "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.MeasureTheory.Measure.NullMeasurable).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem Measure.isComplete_iff : \u03bc.IsComplete \u2194 \u2200 s, \u03bc s = 0 \u2192 MeasurableSet s\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.MeasureTheory.Measure.NullMeasurable).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem Measure.isComplete_iff : \u03bc.IsComplete \u2194 \u2200 s, \u03bc s = 0 \u2192 MeasurableSet s\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.MeasureTheory.Measure.NullMeasurable.Measure", "source": {"declaration": "Mathlib.MeasureTheory.Measure.NullMeasurable.Measure", "file": "Mathlib/MeasureTheory/Measure/NullMeasurable.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.MeasureTheory.Measure.NullMeasurable", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Measure/NullMeasurable.lean#L418", "span": "L418-L420"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem parallelPair_functor_obj {F : WalkingParallelPair \u2964 C} (j : WalkingParallelPair) :\n (parallelPair (F.map left) (F.map right)).obj j = F.obj j", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 576, "declarations_count": 62, "diagnostics_count": 0, "duplicate_fingerprint": "2479f0634ad5bc11", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 161, "lean_code_chars": 153, "lean_code_ratio": 0.2656, "length_bucket": "tiny", "line_count": 8, "natural_language_chars": 423, "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.CategoryTheory.Limits.Shapes.Equalizers).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem parallelPair_functor_obj {F : WalkingParallelPair \u2964 C} (j : WalkingParallelPair) :\n (parallelPair (F.map left) (F.map right)).obj j = F.obj j\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.CategoryTheory.Limits.Shapes.Equalizers).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem parallelPair_functor_obj {F : WalkingParallelPair \u2964 C} (j : WalkingParallelPair) :\n (parallelPair (F.map left) (F.map right)).obj j = F.obj j\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.CategoryTheory.Limits.Shapes.Equalizers.parallelPair_functor_obj", "source": {"declaration": "Mathlib.CategoryTheory.Limits.Shapes.Equalizers.parallelPair_functor_obj", "file": "Mathlib/CategoryTheory/Limits/Shapes/Equalizers.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.CategoryTheory.Limits.Shapes.Equalizers", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Limits/Shapes/Equalizers.lean#L245", "span": "L245-L249"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "lemma Odd.pow_nonpos_iff (hn : Odd n) : a ^ n \u2264 0 \u2194 a \u2264 0", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 466, "declarations_count": 54, "diagnostics_count": 0, "duplicate_fingerprint": "c22c18e653a5999a", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 138, "lean_code_chars": 58, "lean_code_ratio": 0.1245, "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.Algebra.Order.Ring.Basic).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\nlemma Odd.pow_nonpos_iff (hn : Odd n) : a ^ n \u2264 0 \u2194 a \u2264 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.Algebra.Order.Ring.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma Odd.pow_nonpos_iff (hn : Odd n) : a ^ n \u2264 0 \u2194 a \u2264 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.Algebra.Order.Ring.Basic.Odd", "source": {"declaration": "Mathlib.Algebra.Order.Ring.Basic.Odd", "file": "Mathlib/Algebra/Order/Ring/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Algebra.Order.Ring.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Order/Ring/Basic.lean#L169", "span": "L169-L172"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "lemma descPochhammer_eval_eq_prod_range {R : Type*} [CommRing R] (n : \u2115) (r : R) :\n (descPochhammer R n).eval r = \u220f j \u2208 Finset.range n, (r - j)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 563, "declarations_count": 65, "diagnostics_count": 0, "duplicate_fingerprint": "527902fe25d4368d", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 174, "lean_code_chars": 147, "lean_code_ratio": 0.2611, "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": 0.1}, "messages": [{"content": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.RingTheory.Polynomial.Pochhammer).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\nlemma descPochhammer_eval_eq_prod_range {R : Type*} [CommRing R] (n : \u2115) (r : R) :\n (descPochhammer R n).eval r = \u220f j \u2208 Finset.range n, (r - j)\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.RingTheory.Polynomial.Pochhammer).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma descPochhammer_eval_eq_prod_range {R : Type*} [CommRing R] (n : \u2115) (r : R) :\n (descPochhammer R n).eval r = \u220f j \u2208 Finset.range n, (r - j)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.RingTheory.Polynomial.Pochhammer.descPochhammer_eval_eq_prod_range", "source": {"declaration": "Mathlib.RingTheory.Polynomial.Pochhammer.descPochhammer_eval_eq_prod_range", "file": "Mathlib/RingTheory/Polynomial/Pochhammer.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.RingTheory.Polynomial.Pochhammer", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Polynomial/Pochhammer.lean#L458", "span": "L458-L470"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem image_succ_Ico (i j : Fin n) : succ '' Ico i j = Ico i.succ j.succ", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 481, "declarations_count": 59, "diagnostics_count": 0, "duplicate_fingerprint": "a43e77ebbfa46cbb", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 144, "lean_code_chars": 75, "lean_code_ratio": 0.1559, "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.Order.Interval.Set.Fin).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem image_succ_Ico (i j : Fin n) : succ '' Ico i j = Ico i.succ j.succ\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.Order.Interval.Set.Fin).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem image_succ_Ico (i j : Fin n) : succ '' Ico i j = Ico i.succ j.succ\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Order.Interval.Set.Fin.image_succ_Ico", "source": {"declaration": "Mathlib.Order.Interval.Set.Fin.image_succ_Ico", "file": "Mathlib/Order/Interval/Set/Fin.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Order.Interval.Set.Fin", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Interval/Set/Fin.lean#L764", "span": "L764-L765"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "theorem finprod_mem_pair (h : a \u2260 b) : (\u220f\u1da0 i \u2208 ({a, b} : Set \u03b1), f i) = f a * f b", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 494, "declarations_count": 61, "diagnostics_count": 0, "duplicate_fingerprint": "fd39fb3a846655f1", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 154, "lean_code_chars": 82, "lean_code_ratio": 0.166, "length_bucket": "tiny", "line_count": 7, "natural_language_chars": 412, "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.Algebra.BigOperators.Finprod).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\ntheorem finprod_mem_pair (h : a \u2260 b) : (\u220f\u1da0 i \u2208 ({a, b} : Set \u03b1), f i) = f a * 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.Algebra.BigOperators.Finprod).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\ntheorem finprod_mem_pair (h : a \u2260 b) : (\u220f\u1da0 i \u2208 ({a, b} : Set \u03b1), f i) = f a * 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.Algebra.BigOperators.Finprod.finprod_mem_pair", "source": {"declaration": "Mathlib.Algebra.BigOperators.Finprod.finprod_mem_pair", "file": "Mathlib/Algebra/BigOperators/Finprod.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Algebra.BigOperators.Finprod", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/BigOperators/Finprod.lean#L886", "span": "L886-L892"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "lemma quasiIso_extendMap_iff [\u2200 j, K.HasHomology j] [\u2200 j, L.HasHomology j] :\n QuasiIso (extendMap \u03c6 e) \u2194 QuasiIso \u03c6", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 544, "declarations_count": 58, "diagnostics_count": 0, "duplicate_fingerprint": "4a4fe859e07dc59b", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 166, "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.Algebra.Homology.Embedding.ExtendHomology).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\nlemma quasiIso_extendMap_iff [\u2200 j, K.HasHomology j] [\u2200 j, L.HasHomology j] :\n QuasiIso (extendMap \u03c6 e) \u2194 QuasiIso \u03c6\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.Algebra.Homology.Embedding.ExtendHomology).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma quasiIso_extendMap_iff [\u2200 j, K.HasHomology j] [\u2200 j, L.HasHomology j] :\n QuasiIso (extendMap \u03c6 e) \u2194 QuasiIso \u03c6\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.Algebra.Homology.Embedding.ExtendHomology.quasiIso_extendMap_iff", "source": {"declaration": "Mathlib.Algebra.Homology.Embedding.ExtendHomology.quasiIso_extendMap_iff", "file": "Mathlib/Algebra/Homology/Embedding/ExtendHomology.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Algebra.Homology.Embedding.ExtendHomology", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/Homology/Embedding/ExtendHomology.lean#L426", "span": "L426-L438"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "lemma Integrable.prodLp_fst (h : Integrable f \u03bc) : Integrable (fun x \u21a6 (f x).fst) \u03bc", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 506, "declarations_count": 57, "diagnostics_count": 0, "duplicate_fingerprint": "cb1f39064148686b", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 157, "lean_code_chars": 84, "lean_code_ratio": 0.166, "length_bucket": "tiny", "line_count": 7, "natural_language_chars": 422, "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.MeasureTheory.SpecificCodomains.WithLp).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\nlemma Integrable.prodLp_fst (h : Integrable f \u03bc) : Integrable (fun x \u21a6 (f x).fst) \u03bc\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.MeasureTheory.SpecificCodomains.WithLp).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma Integrable.prodLp_fst (h : Integrable f \u03bc) : Integrable (fun x \u21a6 (f x).fst) \u03bc\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.[/INST]", "sample_id": "A-Mathlib.MeasureTheory.SpecificCodomains.WithLp.Integrable", "source": {"declaration": "Mathlib.MeasureTheory.SpecificCodomains.WithLp.Integrable", "file": "Mathlib/MeasureTheory/SpecificCodomains/WithLp.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.MeasureTheory.SpecificCodomains.WithLp", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/SpecificCodomains/WithLp.lean#L76", "span": "L76-L78"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"statement": "lemma rescale_to_shell (p : Seminorm \ud835\udd5c E) {c : \ud835\udd5c} (hc : 1 < \u2016c\u2016) {\u03b5 : \u211d} (\u03b5pos : 0 < \u03b5) {x : E}\n (hx : p x \u2260 0) :\n \u2203 d : \ud835\udd5c, d \u2260 0 \u2227 p (d \u2022 x) < \u03b5 \u2227 (\u03b5 / \u2016c\u2016 \u2264 p (d \u2022 x)) \u2227 (\u2016d\u2016\u207b\u00b9 \u2264 \u03b5\u207b\u00b9 * \u2016c\u2016 * p x)", "untouched_role": "primary"}, "environment": {}, "evaluation_stratum": "primary", "measurements": {"approximate_tokens": false, "chars": 605, "declarations_count": 73, "diagnostics_count": 0, "duplicate_fingerprint": "31d88c3cece8fb92", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 248, "lean_code_chars": 204, "lean_code_ratio": 0.3372, "length_bucket": "tiny", "line_count": 9, "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.Analysis.Seminorm).", "role": "system"}, {"content": "Complete the following proof.\n\n```lean\nlemma rescale_to_shell (p : Seminorm \ud835\udd5c E) {c : \ud835\udd5c} (hc : 1 < \u2016c\u2016) {\u03b5 : \u211d} (\u03b5pos : 0 < \u03b5) {x : E}\n (hx : p x \u2260 0) :\n \u2203 d : \ud835\udd5c, d \u2260 0 \u2227 p (d \u2022 x) < \u03b5 \u2227 (\u03b5 / \u2016c\u2016 \u2264 p (d \u2022 x)) \u2227 (\u2016d\u2016\u207b\u00b9 \u2264 \u03b5\u207b\u00b9 * \u2016c\u2016 * p 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.Analysis.Seminorm).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Complete the following proof.\n\n```lean\nlemma rescale_to_shell (p : Seminorm \ud835\udd5c E) {c : \ud835\udd5c} (hc : 1 < \u2016c\u2016) {\u03b5 : \u211d} (\u03b5pos : 0 < \u03b5) {x : E}\n (hx : p x \u2260 0) :\n \u2203 d : \ud835\udd5c, d \u2260 0 \u2227 p (d \u2022 x) < \u03b5 \u2227 (\u03b5 / \u2016c\u2016 \u2264 p (d \u2022 x)) \u2227 (\u2016d\u2016\u207b\u00b9 \u2264 \u03b5\u207b\u00b9 * \u2016c\u2016 * p 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.Analysis.Seminorm.rescale_to_shell", "source": {"declaration": "Mathlib.Analysis.Seminorm.rescale_to_shell", "file": "Mathlib/Analysis/Seminorm.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Analysis.Seminorm", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Seminorm.lean#L1246", "span": "L1246-L1253"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "theorem sumLift\u2082_nonempty :\n (sumLift\u2082 f g a b).Nonempty \u2194\n (\u2203 a\u2081 b\u2081, a = inl a\u2081 \u2227 b = inl b\u2081 \u2227 (f a\u2081 b\u2081).Nonempty) \u2228\n \u2203 a\u2082 b\u2082, a = inr a\u2082 \u2227 b = inr b\u2082 \u2227 (g a\u2082 b\u2082).Nonempty\n:= by .someMissingNamespaceXYZ\nsimp only [nonempty_iff_ne_empty, Ne, sumLift\u2082_eq_empty, not_and_or, not_forall, exists_prop]", "diagnostic": "[CompilationUnit(i_begin=0, i_end=240, messages=[Message(data='unknown tactic', pos=Position(line=5, column=8), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n sumLift\u2082\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n f\\n\\nHint: The identifier `sumLift\u2082` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=5), pos_end=Position(line=2, column=21), severity=, kind=None), Message(data=\"Function expected at\\n inl\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n a\u2081\\n\\nHint: The identifier `inl` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=3, column=20), pos_end=Position(line=3, column=26), severity=, kind=None), Message(data=\"Function expected at\\n inl\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n b\u2081\\n\\nHint: The identifier `inl` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=3, column=33), pos_end=Position(line=3, column=39), severity=, kind=None), Message(data=\"Function expected at\\n f\\nbut this term has type\\n ?m.5\\n\\nNote: Expected a function because this term is being applied to the argument\\n a\u2081\\n\\nHint: The identifier `f` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=3, column=43), pos_end=Position(line=3, column=50), severity=, kind=None), Message(data=\"Function expected at\\n inr\\nbut this term has type\\n ?m.6\\n\\nNote: Expected a function because this term is being applied to the argument\\n a\u2082\\n\\nHint: The identifier `inr` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=4, column=21), pos_end=Position(line=4, column=27), severity=, kind=None), Message(data=\"Function expected at\\n inr\\nbut this term has type\\n ?m.6\\n\\nNote: Expected a function because this term is being applied to the argument\\n b\u2082\\n\\nHint: The identifier `inr` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=4, column=34), pos_end=Position(line=4, column=40), severity=, kind=None), Message(data=\"Function expected at\\n g\\nbut this term has type\\n ?m.7\\n\\nNote: Expected a function because this term is being applied to the argument\\n a\u2082\\n\\nHint: The identifier `g` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=4, column=44), pos_end=Position(line=4, column=51), severity=, kind=None), Message(data='unsolved goals\\nx\u271d\u2074 : Sort u_1\\nsumLift\u2082 : x\u271d\u2074\\n\u03b1\u271d\u00b9 : Sort u_2\\na : \u03b1\u271d\u00b9\\nx\u271d\u00b3 : Sort u_3\\ninl : x\u271d\u00b3\\n\u03b1\u271d : Sort u_4\\nb : \u03b1\u271d\\nx\u271d\u00b2 : Sort u_5\\nf : x\u271d\u00b2\\nx\u271d\u00b9 : Sort u_6\\ninr : x\u271d\u00b9\\nx\u271d : Sort u_7\\ng : x\u271d\\n\u22a2 sorry \u2194 (\u2203 a\u2081 b\u2081, a = ?m.14 \u2227 b = ?m.18 \u2227 sorry) \u2228 \u2203 a\u2082 b\u2082, a = ?m.34 \u2227 b = ?m.38 \u2227 sorry', pos=Position(line=5, column=6), pos_end=Position(line=5, column=30), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=240, i_end=358, messages=[], 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": 5900, "declarations_count": 901, "diagnostics_count": 1, "duplicate_fingerprint": "3da9dfb498e4e9f0", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1724, "lean_code_chars": 313, "lean_code_ratio": 0.0531, "length_bucket": "short", "line_count": 17, "natural_language_chars": 5587, "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.Data.Sum.Interval).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem sumLift\u2082_nonempty :\n (sumLift\u2082 f g a b).Nonempty \u2194\n (\u2203 a\u2081 b\u2081, a = inl a\u2081 \u2227 b = inl b\u2081 \u2227 (f a\u2081 b\u2081).Nonempty) \u2228\n \u2203 a\u2082 b\u2082, a = inr a\u2082 \u2227 b = inr b\u2082 \u2227 (g a\u2082 b\u2082).Nonempty\n:= by .someMissingNamespaceXYZ\nsimp only [nonempty_iff_ne_empty, Ne, sumLift\u2082_eq_empty, not_and_or, not_forall, exists_prop]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=240, messages=[Message(data='unknown tactic', pos=Position(line=5, column=8), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n sumLift\u2082\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n f\\n\\nHint: The identifier `sumLift\u2082` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=5), pos_end=Position(line=2, column=21), severity=, kind=None), Message(data=\"Function expected at\\n inl\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n a\u2081\\n\\nHint: The identifier `inl` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=3, column=20), pos_end=Position(line=3, column=26), severity=, kind=None), Message(data=\"Function expected at\\n inl\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n b\u2081\\n\\nHint: The identifier `inl` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=3, column=33), pos_end=Position(line=3, column=39), severity=, kind=None), Message(data=\"Function expected at\\n f\\nbut this term has type\\n ?m.5\\n\\nNote: Expected a function because this term is being applied to the argument\\n a\u2081\\n\\nHint: The identifier `f` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=3, column=43), pos_end=Position(line=3, column=50), severity=, kind=None), Message(data=\"Function expected at\\n inr\\nbut this term has type\\n ?m.6\\n\\nNote: Expected a function because this term is being applied to the argument\\n a\u2082\\n\\nHint: The identifier `inr` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=4, column=21), pos_end=Position(line=4, column=27), severity=, kind=None), Message(data=\"Function expected at\\n inr\\nbut this term has type\\n ?m.6\\n\\nNote: Expected a function because this term is being applied to the argument\\n b\u2082\\n\\nHint: The identifier `inr` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=4, column=34), pos_end=Position(line=4, column=40), severity=, kind=None), Message(data=\"Function expected at\\n g\\nbut this term has type\\n ?m.7\\n\\nNote: Expected a function because this term is being applied to the argument\\n a\u2082\\n\\nHint: The identifier `g` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=4, column=44), pos_end=Position(line=4, column=51), severity=, kind=None), Message(data='unsolved goals\\nx\u271d\u2074 : Sort u_1\\nsumLift\u2082 : x\u271d\u2074\\n\u03b1\u271d\u00b9 : Sort u_2\\na : \u03b1\u271d\u00b9\\nx\u271d\u00b3 : Sort u_3\\ninl : x\u271d\u00b3\\n\u03b1\u271d : Sort u_4\\nb : \u03b1\u271d\\nx\u271d\u00b2 : Sort u_5\\nf : x\u271d\u00b2\\nx\u271d\u00b9 : Sort u_6\\ninr : x\u271d\u00b9\\nx\u271d : Sort u_7\\ng : x\u271d\\n\u22a2 sorry \u2194 (\u2203 a\u2081 b\u2081, a = ?m.14 \u2227 b = ?m.18 \u2227 sorry) \u2228 \u2203 a\u2082 b\u2082, a = ?m.34 \u2227 b = ?m.38 \u2227 sorry', pos=Position(line=5, column=6), pos_end=Position(line=5, column=30), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=240, i_end=358, 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.Data.Sum.Interval).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem sumLift\u2082_nonempty :\n (sumLift\u2082 f g a b).Nonempty \u2194\n (\u2203 a\u2081 b\u2081, a = inl a\u2081 \u2227 b = inl b\u2081 \u2227 (f a\u2081 b\u2081).Nonempty) \u2228\n \u2203 a\u2082 b\u2082, a = inr a\u2082 \u2227 b = inr b\u2082 \u2227 (g a\u2082 b\u2082).Nonempty\n:= by .someMissingNamespaceXYZ\nsimp only [nonempty_iff_ne_empty, Ne, sumLift\u2082_eq_empty, not_and_or, not_forall, exists_prop]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=240, messages=[Message(data='unknown tactic', pos=Position(line=5, column=8), pos_end=None, severity=, kind=None), Message(data=\"Function expected at\\n sumLift\u2082\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n f\\n\\nHint: The identifier `sumLift\u2082` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=5), pos_end=Position(line=2, column=21), severity=, kind=None), Message(data=\"Function expected at\\n inl\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n a\u2081\\n\\nHint: The identifier `inl` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=3, column=20), pos_end=Position(line=3, column=26), severity=, kind=None), Message(data=\"Function expected at\\n inl\\nbut this term has type\\n ?m.3\\n\\nNote: Expected a function because this term is being applied to the argument\\n b\u2081\\n\\nHint: The identifier `inl` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=3, column=33), pos_end=Position(line=3, column=39), severity=, kind=None), Message(data=\"Function expected at\\n f\\nbut this term has type\\n ?m.5\\n\\nNote: Expected a function because this term is being applied to the argument\\n a\u2081\\n\\nHint: The identifier `f` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=3, column=43), pos_end=Position(line=3, column=50), severity=, kind=None), Message(data=\"Function expected at\\n inr\\nbut this term has type\\n ?m.6\\n\\nNote: Expected a function because this term is being applied to the argument\\n a\u2082\\n\\nHint: The identifier `inr` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=4, column=21), pos_end=Position(line=4, column=27), severity=, kind=None), Message(data=\"Function expected at\\n inr\\nbut this term has type\\n ?m.6\\n\\nNote: Expected a function because this term is being applied to the argument\\n b\u2082\\n\\nHint: The identifier `inr` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=4, column=34), pos_end=Position(line=4, column=40), severity=, kind=None), Message(data=\"Function expected at\\n g\\nbut this term has type\\n ?m.7\\n\\nNote: Expected a function because this term is being applied to the argument\\n a\u2082\\n\\nHint: The identifier `g` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=4, column=44), pos_end=Position(line=4, column=51), severity=, kind=None), Message(data='unsolved goals\\nx\u271d\u2074 : Sort u_1\\nsumLift\u2082 : x\u271d\u2074\\n\u03b1\u271d\u00b9 : Sort u_2\\na : \u03b1\u271d\u00b9\\nx\u271d\u00b3 : Sort u_3\\ninl : x\u271d\u00b3\\n\u03b1\u271d : Sort u_4\\nb : \u03b1\u271d\\nx\u271d\u00b2 : Sort u_5\\nf : x\u271d\u00b2\\nx\u271d\u00b9 : Sort u_6\\ninr : x\u271d\u00b9\\nx\u271d : Sort u_7\\ng : x\u271d\\n\u22a2 sorry \u2194 (\u2203 a\u2081 b\u2081, a = ?m.14 \u2227 b = ?m.18 \u2227 sorry) \u2228 \u2203 a\u2082 b\u2082, a = ?m.34 \u2227 b = ?m.38 \u2227 sorry', pos=Position(line=5, column=6), pos_end=Position(line=5, column=30), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=240, i_end=358, 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.Data.Sum.Interval.sumLift\u2082_nonempty", "source": {"declaration": "Mathlib.Data.Sum.Interval.sumLift\u2082_nonempty", "file": "Mathlib/Data/Sum/Interval.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Data.Sum.Interval", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Data/Sum/Interval.lean#L88", "span": "L88-L93"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"source_grounded_context_enriched": false, "trace_states": [{"state": "theorem exists_fg_substructure_in_Sigma (S : L.Substructure (DirectLimit G f)) (S_fg : S.FG) :\n \u2203 i, \u2203 T : L.Substructure (G i), T.map (of L \u03b9 G f i).toHom = S", "tactic": "use i"}, {"state": "", "tactic": "use Substructure.closure L (range y)"}, {"state": "", "tactic": "rw [Substructure.map_closure]"}, {"state": "", "tactic": "simp only [Embedding.coe_toHom, of_apply]"}, {"state": "", "tactic": "rw [\u2190 image_univ, image_image, image_univ, \u2190 eq_y, Subtype.range_coe_subtype, Finset.setOf_mem, A_closure] variable {P : Type u\u2081} [L.Structure P] set_option backward.isDefEq.respectTransparency false in variable (L \u03b9 G f) in /-- The universal property of the direct limit: maps from the components to another module that respect the directed system structure (i.e. make some diagram commute) give rise to a unique map out of the direct limit. -/ noncomputable def lift (g : \u2200 i, G i \u21aa[L] P) (Hg : \u2200 i j hij x, g j (f i j hij x) = g i x) : DirectLimit G f \u21aa[L] P where toFun := Quotient.lift (fun x : \u03a3\u02e3 f => (g x.1) x.2) fun x y xy => by"}, {"state": "", "tactic": "simp only"}, {"state": "", "tactic": "obtain \u27e8i, hx, hy\u27e9 := directed_of (\u00b7 \u2264 \u00b7) x.1 y.1"}, {"state": "", "tactic": "rw [\u2190 Hg x.1 i hx, \u2190 Hg y.1 i hy]"}, {"state": "", "tactic": "exact congr_arg _ ((equiv_iff ..).1 xy) inj' x y xy := by"}, {"state": "", "tactic": "rw [\u2190 Quotient.out_eq x, \u2190 Quotient.out_eq y, Quotient.lift_mk, Quotient.lift_mk] at xy"}, {"state": "", "tactic": "obtain \u27e8i, hx, hy\u27e9 := directed_of (\u00b7 \u2264 \u00b7) x.out.1 y.out.1"}, {"state": "", "tactic": "rw [\u2190 Hg x.out.1 i hx, \u2190 Hg y.out.1 i hy] at xy"}, {"state": "", "tactic": "rw [\u2190 Quotient.out_eq x, \u2190 Quotient.out_eq y, Quotient.eq_iff_equiv, equiv_iff G f hx hy]"}, {"state": "", "tactic": "exact (g i).injective xy map_fun' F x := by"}, {"state": "", "tactic": "obtain \u27e8i, y, rfl\u27e9 := exists_quotient_mk'_sigma_mk'_eq G f x change _ = funMap F (Quotient.lift _ _ \u2218 Quotient.mk _ \u2218 Structure.Sigma.mk f i \u2218 y)"}, {"state": "", "tactic": "rw [funMap_quotient_mk'_sigma_mk', \u2190 Function.comp_assoc, Quotient.lift_comp_mk]"}, {"state": "", "tactic": "simp only [Quotient.lift_mk, Embedding.map_fun]"}, {"state": "", "tactic": "rfl map_rel' R x := by"}, {"state": "", "tactic": "obtain \u27e8i, y, rfl\u27e9 := exists_quotient_mk'_sigma_mk'_eq G f x change RelMap R (Quotient.lift _ _ \u2218 Quotient.mk _ \u2218 Structure.Sigma.mk f i \u2218 y) \u2194 _"}, {"state": "", "tactic": "rw [relMap_quotient_mk'_sigma_mk' G f, \u2190 (g i).map_rel R y, \u2190 Function.comp_assoc, Quotient.lift_comp_mk]"}, {"state": "", "tactic": "rfl variable (g : \u2200 i, G i \u21aa[L] P) (Hg : \u2200 i j hij x, g j (f i j hij x) = g i x)"}], "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 4286, "declarations_count": 574, "diagnostics_count": 0, "duplicate_fingerprint": "94426f6c3e9ce50d", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1656, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "short", "line_count": 50, "natural_language_chars": 4286, "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.ModelTheory.DirectLimit).", "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.ModelTheory.DirectLimit.exists_fg_substructure_in_Sigma`:\nState 0: \u22a2 theorem exists_fg_substructure_in_Sigma (S : L.Substructure (DirectLimit G f)) (S_fg : S.FG) :\n \u2203 i, \u2203 T : L.Substructure (G i), T.map (of L \u03b9 G f i).toHom = S\nTactic: use i\nState 1: \u22a2 \nTactic: use Substructure.closure L (range y)\nState 2: \u22a2 \nTactic: rw [Substructure.map_closure]\nState 3: \u22a2 \nTactic: simp only [Embedding.coe_toHom, of_apply]\nState 4: \u22a2 \nTactic: rw [\u2190 image_univ, image_image, image_univ, \u2190 eq_y, Subtype.range_coe_subtype, Finset.setOf_mem, A_closure] variable {P : Type u\u2081} [L.Structure P] set_option backward.isDefEq.respectTransparency false in variable (L \u03b9 G f) in /-- The universal property of the direct limit: maps from the components to another module that respect the directed system structure (i.e. make some diagram commute) give rise to a unique map out of the direct limit. -/ noncomputable def lift (g : \u2200 i, G i \u21aa[L] P) (Hg : \u2200 i j hij x, g j (f i j hij x) = g i x) : DirectLimit G f \u21aa[L] P where toFun := Quotient.lift (fun x : \u03a3\u02e3 f => (g x.1) x.2) fun x y xy => by\nState 5: \u22a2 \nTactic: simp only\nState 6: \u22a2 \nTactic: obtain \u27e8i, hx, hy\u27e9 := directed_of (\u00b7 \u2264 \u00b7) x.1 y.1\nState 7: \u22a2 \nTactic: rw [\u2190 Hg x.1 i hx, \u2190 Hg y.1 i hy]\nState 8: \u22a2 \nTactic: exact congr_arg _ ((equiv_iff ..).1 xy) inj' x y xy := by\nState 9: \u22a2 \nTactic: rw [\u2190 Quotient.out_eq x, \u2190 Quotient.out_eq y, Quotient.lift_mk, Quotient.lift_mk] at xy\nState 10: \u22a2 \nTactic: obtain \u27e8i, hx, hy\u27e9 := directed_of (\u00b7 \u2264 \u00b7) x.out.1 y.out.1\nState 11: \u22a2 \nTactic: rw [\u2190 Hg x.out.1 i hx, \u2190 Hg y.out.1 i hy] at xy\nState 12: \u22a2 \nTactic: rw [\u2190 Quotient.out_eq x, \u2190 Quotient.out_eq y, Quotient.eq_iff_equiv, equiv_iff G f hx hy]\nState 13: \u22a2 \nTactic: exact (g i).injective xy map_fun' F x := by\nState 14: \u22a2 \nTactic: obtain \u27e8i, y, rfl\u27e9 := exists_quotient_mk'_sigma_mk'_eq G f x change _ = funMap F (Quotient.lift _ _ \u2218 Quotient.mk _ \u2218 Structure.Sigma.mk f i \u2218 y)\nState 15: \u22a2 \nTactic: rw [funMap_quotient_mk'_sigma_mk', \u2190 Function.comp_assoc, Quotient.lift_comp_mk]\nState 16: \u22a2 \nTactic: simp only [Quotient.lift_mk, Embedding.map_fun]\nState 17: \u22a2 \nTactic: rfl map_rel' R x := by\nState 18: \u22a2 \nTactic: obtain \u27e8i, y, rfl\u27e9 := exists_quotient_mk'_sigma_mk'_eq G f x change RelMap R (Quotient.lift _ _ \u2218 Quotient.mk _ \u2218 Structure.Sigma.mk f i \u2218 y) \u2194 _\nState 19: \u22a2 \nTactic: rw [relMap_quotient_mk'_sigma_mk' G f, \u2190 (g i).map_rel R y, \u2190 Function.comp_assoc, Quotient.lift_comp_mk]\nState 20: \u22a2 \nTactic: rfl variable (g : \u2200 i, G i \u21aa[L] P) (Hg : \u2200 i j hij x, g j (f i j hij x) = g i x)\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.ModelTheory.DirectLimit).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.ModelTheory.DirectLimit.exists_fg_substructure_in_Sigma`:\nState 0: \u22a2 theorem exists_fg_substructure_in_Sigma (S : L.Substructure (DirectLimit G f)) (S_fg : S.FG) :\n \u2203 i, \u2203 T : L.Substructure (G i), T.map (of L \u03b9 G f i).toHom = S\nTactic: use i\nState 1: \u22a2 \nTactic: use Substructure.closure L (range y)\nState 2: \u22a2 \nTactic: rw [Substructure.map_closure]\nState 3: \u22a2 \nTactic: simp only [Embedding.coe_toHom, of_apply]\nState 4: \u22a2 \nTactic: rw [\u2190 image_univ, image_image, image_univ, \u2190 eq_y, Subtype.range_coe_subtype, Finset.setOf_mem, A_closure] variable {P : Type u\u2081} [L.Structure P] set_option backward.isDefEq.respectTransparency false in variable (L \u03b9 G f) in /-- The universal property of the direct limit: maps from the components to another module that respect the directed system structure (i.e. make some diagram commute) give rise to a unique map out of the direct limit. -/ noncomputable def lift (g : \u2200 i, G i \u21aa[L] P) (Hg : \u2200 i j hij x, g j (f i j hij x) = g i x) : DirectLimit G f \u21aa[L] P where toFun := Quotient.lift (fun x : \u03a3\u02e3 f => (g x.1) x.2) fun x y xy => by\nState 5: \u22a2 \nTactic: simp only\nState 6: \u22a2 \nTactic: obtain \u27e8i, hx, hy\u27e9 := directed_of (\u00b7 \u2264 \u00b7) x.1 y.1\nState 7: \u22a2 \nTactic: rw [\u2190 Hg x.1 i hx, \u2190 Hg y.1 i hy]\nState 8: \u22a2 \nTactic: exact congr_arg _ ((equiv_iff ..).1 xy) inj' x y xy := by\nState 9: \u22a2 \nTactic: rw [\u2190 Quotient.out_eq x, \u2190 Quotient.out_eq y, Quotient.lift_mk, Quotient.lift_mk] at xy\nState 10: \u22a2 \nTactic: obtain \u27e8i, hx, hy\u27e9 := directed_of (\u00b7 \u2264 \u00b7) x.out.1 y.out.1\nState 11: \u22a2 \nTactic: rw [\u2190 Hg x.out.1 i hx, \u2190 Hg y.out.1 i hy] at xy\nState 12: \u22a2 \nTactic: rw [\u2190 Quotient.out_eq x, \u2190 Quotient.out_eq y, Quotient.eq_iff_equiv, equiv_iff G f hx hy]\nState 13: \u22a2 \nTactic: exact (g i).injective xy map_fun' F x := by\nState 14: \u22a2 \nTactic: obtain \u27e8i, y, rfl\u27e9 := exists_quotient_mk'_sigma_mk'_eq G f x change _ = funMap F (Quotient.lift _ _ \u2218 Quotient.mk _ \u2218 Structure.Sigma.mk f i \u2218 y)\nState 15: \u22a2 \nTactic: rw [funMap_quotient_mk'_sigma_mk', \u2190 Function.comp_assoc, Quotient.lift_comp_mk]\nState 16: \u22a2 \nTactic: simp only [Quotient.lift_mk, Embedding.map_fun]\nState 17: \u22a2 \nTactic: rfl map_rel' R x := by\nState 18: \u22a2 \nTactic: obtain \u27e8i, y, rfl\u27e9 := exists_quotient_mk'_sigma_mk'_eq G f x change RelMap R (Quotient.lift _ _ \u2218 Quotient.mk _ \u2218 Structure.Sigma.mk f i \u2218 y) \u2194 _\nState 19: \u22a2 \nTactic: rw [relMap_quotient_mk'_sigma_mk' G f, \u2190 (g i).map_rel R y, \u2190 Function.comp_assoc, Quotient.lift_comp_mk]\nState 20: \u22a2 \nTactic: rfl variable (g : \u2200 i, G i \u21aa[L] P) (Hg : \u2200 i j hij x, g j (f i j hij x) = g i x)\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.ModelTheory.DirectLimit.exists_fg_substructure_in_Sigma", "source": {"declaration": "Mathlib.ModelTheory.DirectLimit.exists_fg_substructure_in_Sigma", "file": "Mathlib/ModelTheory/DirectLimit.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.ModelTheory.DirectLimit", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/ModelTheory/DirectLimit.lean#L315", "span": "L315-L361"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L33-L39)\nlemma LSeries.abscissaOfAbsConv_congr {f g : \u2115 \u2192 \u2102} (h : \u2200 {n}, n \u2260 0 \u2192 f n = g n) :\n abscissaOfAbsConv f = abscissaOfAbsConv g :=\ncongr_arg sInf <| congr_arg _ <| Set.ext fun x \u21a6 LSeriesSummable_congr x h\n\nopen Filter in\n/-- If `f` and `g` agree on large `n : \u2115`, then their `LSeries` have the same\nabscissa of absolute convergence. -/", "-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L40-L45)\nlemma LSeries.abscissaOfAbsConv_congr' {f g : \u2115 \u2192 \u2102} (h : f =\u1da0[atTop] g) :\n abscissaOfAbsConv f = abscissaOfAbsConv g :=\ncongr_arg sInf <| congr_arg _ <| Set.ext fun x \u21a6 LSeriesSummable_congr' x h\n\nopen LSeries", "-- Mathlib.NumberTheory.LSeries.Convergence.LSeriesSummable_of_abscissaOfAbsConv_lt_re (L46-L51)\nlemma LSeriesSummable_of_abscissaOfAbsConv_lt_re {f : \u2115 \u2192 \u2102} {s : \u2102}\n (hs : abscissaOfAbsConv f < s.re) : LSeriesSummable f s := by\nobtain \u27e8y, hy, hys\u27e9 : \u2203 a : \u211d, LSeriesSummable f a \u2227 a < s.re := by\n simpa [abscissaOfAbsConv, sInf_lt_iff] using hs\n exact hy.of_re_le_re <| ofReal_re y \u25b8 hys.le", "-- Mathlib.NumberTheory.LSeries.Convergence.LSeriesSummable_lt_re_of_abscissaOfAbsConv_lt_re (L52-L57)\nlemma LSeriesSummable_lt_re_of_abscissaOfAbsConv_lt_re {f : \u2115 \u2192 \u2102} {s : \u2102}\n (hs : abscissaOfAbsConv f < s.re) :\n \u2203 x : \u211d, x < s.re \u2227 LSeriesSummable f x := by\nobtain \u27e8x, hx\u2081, hx\u2082\u27e9 := EReal.exists_between_coe_real hs\n exact \u27e8x, by simpa using hx\u2082, LSeriesSummable_of_abscissaOfAbsConv_lt_re hx\u2081\u27e9", "-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L62-L71)\nlemma LSeries.abscissaOfAbsConv_le_of_forall_lt_LSeriesSummable {f : \u2115 \u2192 \u2102} {x : \u211d}\n (h : \u2200 y : \u211d, x < y \u2192 LSeriesSummable f y) :\n abscissaOfAbsConv f \u2264 x := by\nrefine sInf_le_iff.mpr fun y hy \u21a6 le_of_forall_gt_imp_ge_of_dense fun a \u21a6 ?_\n replace hy : \u2200 (a : \u211d), LSeriesSummable f a \u2192 y \u2264 a := by simpa [mem_lowerBounds] using hy\n cases a with\n | coe a\u2080 => exact_mod_cast fun ha \u21a6 hy a\u2080 (h a\u2080 ha)\n | bot => simp\n | top => simp", "-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L72-L86)\nlemma LSeries.abscissaOfAbsConv_le_of_forall_lt_LSeriesSummable' {f : \u2115 \u2192 \u2102} {x : EReal}\n (h : \u2200 y : \u211d, x < y \u2192 LSeriesSummable f y) :\n abscissaOfAbsConv f \u2264 x := by\ncases x with\n | coe => exact abscissaOfAbsConv_le_of_forall_lt_LSeriesSummable <| mod_cast h\n | top => exact le_top\n | bot =>\n refine le_of_eq <| sInf_eq_bot.mpr fun y hy \u21a6 ?_\n cases y with\n | bot => simp at hy\n | coe y => exact \u27e8_, \u27e8_, h _ <| EReal.bot_lt_coe _, rfl\u27e9, mod_cast sub_one_lt y\u27e9\n | top => exact \u27e8_, \u27e8_, h _ <| EReal.bot_lt_coe 0, rfl\u27e9, EReal.zero_lt_top\u27e9\n\n/-- If `\u2016f n\u2016` is bounded by a constant times `n^x`, then the abscissa of absolute convergence\nof `f` is bounded by `x + 1`. -/", "-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L87-L97)\nlemma LSeries.abscissaOfAbsConv_le_of_le_const_mul_rpow {f : \u2115 \u2192 \u2102} {x : \u211d}\n (h : \u2203 C, \u2200 n \u2260 0, \u2016f n\u2016 \u2264 C * n ^ x) : abscissaOfAbsConv f \u2264 x + 1 := by\nrw [show x = x + 1 - 1 by ring] at h\n by_contra! H\n obtain \u27e8y, hy\u2081, hy\u2082\u27e9 := EReal.exists_between_coe_real H\n exact (LSeriesSummable_of_le_const_mul_rpow (s := y) (EReal.coe_lt_coe_iff.mp hy\u2081) h\n |>.abscissaOfAbsConv_le.trans_lt hy\u2082).false\n\nopen Filter in\n/-- If `\u2016f n\u2016` is `O(n^x)`, then the abscissa of absolute convergence\nof `f` is bounded by `x + 1`. -/", "-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L98-L107)\nlemma LSeries.abscissaOfAbsConv_le_of_isBigO_rpow {f : \u2115 \u2192 \u2102} {x : \u211d}\n (h : f =O[atTop] fun n \u21a6 (n : \u211d) ^ x) :\n abscissaOfAbsConv f \u2264 x + 1 := by\nrw [show x = x + 1 - 1 by ring] at h\n by_contra! H\n obtain \u27e8y, hy\u2081, hy\u2082\u27e9 := EReal.exists_between_coe_real H\n exact (LSeriesSummable_of_isBigO_rpow (s := y) (EReal.coe_lt_coe_iff.mp hy\u2081) h\n |>.abscissaOfAbsConv_le.trans_lt hy\u2082).false\n\n/-- If `f` is bounded, then the abscissa of absolute convergence of `f` is bounded above by `1`. -/", "-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L108-L113)\nlemma LSeries.abscissaOfAbsConv_le_of_le_const {f : \u2115 \u2192 \u2102} (h : \u2203 C, \u2200 n \u2260 0, \u2016f n\u2016 \u2264 C) :\n abscissaOfAbsConv f \u2264 1 := by\nsimpa using abscissaOfAbsConv_le_of_le_const_mul_rpow (x := 0) (by simpa using h)\n\nopen Filter in\n/-- If `f` is `O(1)`, then the abscissa of absolute convergence of `f` is bounded above by `1`. -/", "-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L114-L119)\nlemma LSeries.abscissaOfAbsConv_le_one_of_isBigO_one {f : \u2115 \u2192 \u2102} (h : f =O[atTop] fun _ \u21a6 (1 : \u211d)) :\n abscissaOfAbsConv f \u2264 1 := by\nsimpa using abscissaOfAbsConv_le_of_isBigO_rpow (x := 0) (by simpa using h)\n\n/-- If `f` is real-valued and `x` is strictly greater than the abscissa of absolute convergence\nof `f`, then the real series `\u2211' n, f n / n ^ x` converges. -/", "-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L120-L135)\nlemma LSeries.summable_real_of_abscissaOfAbsConv_lt {f : \u2115 \u2192 \u211d} {x : \u211d}\n (h : abscissaOfAbsConv (f \u00b7) < x) :\n Summable fun n : \u2115 \u21a6 f n / (n : \u211d) ^ x := by\nhave aux : term (f \u00b7) x = fun n \u21a6 \u2191(if n = 0 then 0 else f n / (n : \u211d) ^ x) := by\n ext n\n simp [term_def, apply_ite ((\u2191) : \u211d \u2192 \u2102), ofReal_cpow n.cast_nonneg]\n have := LSeriesSummable_of_abscissaOfAbsConv_lt_re (ofReal_re x \u25b8 h)\n simp only [LSeriesSummable, aux, summable_ofReal] at this\n refine this.congr_cofinite ?_\n filter_upwards [(Set.finite_singleton 0).compl_mem_cofinite] with n hn\n using if_neg (by simpa using hn)\n\n/-- If `F` is a binary operation on `\u2115 \u2192 \u2102` with the property that the `LSeries` of `F f g`\nconverges whenever the `LSeries` of `f` and `g` do, then the abscissa of absolute convergence\nof `F f g` is at most the maximum of the abscissa of absolute convergence of `f`\nand that of `g`. -/", "-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L136-L144)\nlemma LSeries.abscissaOfAbsConv_binop_le {F : (\u2115 \u2192 \u2102) \u2192 (\u2115 \u2192 \u2102) \u2192 (\u2115 \u2192 \u2102)}\n (hF : \u2200 {f g s}, LSeriesSummable f s \u2192 LSeriesSummable g s \u2192 LSeriesSummable (F f g) s)\n (f g : \u2115 \u2192 \u2102) :\n abscissaOfAbsConv (F f g) \u2264 max (abscissaOfAbsConv f) (abscissaOfAbsConv g) := by\nrefine abscissaOfAbsConv_le_of_forall_lt_LSeriesSummable' fun x hx \u21a6 hF ?_ ?_\n \u00b7 exact LSeriesSummable_of_abscissaOfAbsConv_lt_re <|\n (ofReal_re x).symm \u25b8 (le_max_left ..).trans_lt hx\n \u00b7 exact LSeriesSummable_of_abscissaOfAbsConv_lt_re <|\n (ofReal_re x).symm \u25b8 (le_max_right ..).trans_lt hx", "-- Mathlib.NumberTheory.LSeries.Deriv.LSeries_hasDerivAt (L80-L85)\nlemma LSeries_hasDerivAt {f : \u2115 \u2192 \u2102} {s : \u2102} (h : abscissaOfAbsConv f < s.re) :\n HasDerivAt (LSeries f) (-LSeries (logMul f) s) s :=\n(LSeriesSummable_logMul_and_hasDerivAt h).2\n\n/-- If `re s` is greater than the abscissa of absolute convergence of `f`, then\nthe derivative of this L-series at `s` is the negative of the L-series of `log * f`. -/", "-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.toStrongFEPair (L307-L333)\ndef toStrongFEPair : StrongFEPair E where\n f := P.f_modif\ng := P.symm.f_modif\n k := P.k\n \u03b5 := P.\u03b5\n f\u2080 := 0\n g\u2080 := 0\n hf_int := P.hf_modif_int\n hg_int := P.symm.hf_modif_int\n h_feq := P.hf_modif_FE\n h\u03b5 := P.h\u03b5\n hk := P.hk\n hf\u2080 := rfl\n hg\u2080 := rfl\n hf_top r := by\n refine (P.hf_top r).congr' ?_ (by rfl)\n filter_upwards [eventually_gt_atTop 1] with x hx\n rw [f_modif, Pi.add_apply, indicator_of_mem (mem_Ioi.mpr hx),\n indicator_of_notMem (notMem_Ioo_of_ge hx.le), add_zero, sub_zero]\n hg_top r := by\n refine (P.hg_top r).congr' ?_ (by rfl)\n filter_upwards [eventually_gt_atTop 1] with x hx\n rw [f_modif, Pi.add_apply, indicator_of_mem (mem_Ioi.mpr hx),\n indicator_of_notMem (notMem_Ioo_of_ge hx.le), add_zero, sub_zero]\n rfl\n\n/- Alternative form for the difference between `f - f\u2080` and its modified term. -/", "-- Mathlib.NumberTheory.LSeries.Basic.term_congr (L106-L109)\nlemma term_congr {f g : \u2115 \u2192 \u2102} (h : \u2200 {n}, n \u2260 0 \u2192 f n = g n) (s : \u2102) (n : \u2115) :\n term f s n = term g s n := by\nrcases eq_or_ne n 0 with hn | hn <;> simp [hn, h]", "-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.StrongFEPair (L132-L145)\ndef StrongFEPair.symm (P : StrongFEPair E) : StrongFEPair E where\n toWeakFEPair := P.toWeakFEPair.symm\nhf\u2080 := P.hg\u2080\n hg\u2080 := P.hf\u2080\n\nend symmetry\n\nnamespace WeakFEPair\n\n/-!\n## Auxiliary results I: lemmas on asymptotics\n-/\n\n/-- As `x \u2192 0`, we have `f x = x ^ (-P.k) \u2022 constant` up to a rapidly decaying error. -/", "-- Mathlib.NumberTheory.LSeries.Basic.LSeriesSummable_of_bounded_of_one_lt_real (L394-L397)\ntheorem LSeriesSummable_of_bounded_of_one_lt_real {f : \u2115 \u2192 \u2102} {m : \u211d}\n (h : \u2200 n \u2260 0, \u2016f n\u2016 \u2264 m) {s : \u211d} (hs : 1 < s) :\n LSeriesSummable f s :=\nLSeriesSummable_of_bounded_of_one_lt_re h <| by simp [hs]", "-- Mathlib.NumberTheory.LSeries.Convolution.LSeries_convolution' (L148-L154)\nlemma LSeries_convolution' {f g : \u2115 \u2192 \u2102} {s : \u2102} (hf : LSeriesSummable f s)\n (hg : LSeriesSummable g s) :\n LSeries (f \u235f g) s = LSeries f s * LSeries g s :=\n(LSeriesHasSum.convolution hf.LSeriesHasSum hg.LSeriesHasSum).LSeries_eq\n\n/-- The L-series of the convolution product `f \u235f g` of two sequences `f` and `g`\nequals the product of their L-series in their common half-plane of absolute convergence. -/", "-- Mathlib.NumberTheory.LSeries.Convolution.LSeriesHasSum (L139-L147)\nlemma LSeriesHasSum.convolution {f g : \u2115 \u2192 \u2102} {s a b : \u2102} (hf : LSeriesHasSum f s a)\n (hg : LSeriesHasSum g s b) :\n LSeriesHasSum (f \u235f g) s (a * b) := by\nhave hsum := summable_mul_of_summable_norm hf.summable.norm hg.summable.norm\n -- NB: this `simpa` is quite slow if un-squeezed\n simpa only [LSeriesHasSum, term_convolution'] using (hf.mul hg hsum).tsum_fiberwise _\n\n/-- The L-series of the convolution product `f \u235f g` of two sequences `f` and `g`\nequals the product of their L-series, assuming both L-series converge. -/", "-- Mathlib.NumberTheory.LSeries.Convolution.LSeriesHasSum_mul (L182-L188)\nlemma LSeriesHasSum_mul {f g : ArithmeticFunction \u2102} {s a b : \u2102} (hf : LSeriesHasSum \u2197f s a)\n (hg : LSeriesHasSum \u2197g s b) :\n LSeriesHasSum \u2197(f * g) s (a * b) :=\ncoe_mul f g \u25b8 hf.convolution hg\n\n/-- The L-series of the (convolution) product of two `\u2102`-valued arithmetic functions `f` and `g`\nequals the product of their L-series, assuming both L-series converge. -/", "-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.hf_modif_int (L267-L285)\nlemma hf_modif_int :\n LocallyIntegrableOn P.f_modif (Ioi 0) := by\nhave : LocallyIntegrableOn (fun x : \u211d \u21a6 (P.\u03b5 * \u2191(x ^ (-P.k))) \u2022 P.g\u2080) (Ioi 0) := by\n refine ContinuousOn.locallyIntegrableOn ?_ measurableSet_Ioi\n refine continuousOn_of_forall_continuousAt (fun x (hx : 0 < x) \u21a6 ?_)\n have : x \u2260 0 \u2228 0 \u2264 -P.k := Or.inl hx.ne'\n fun_prop (discharger := assumption)\n refine LocallyIntegrableOn.add (fun x hx \u21a6 ?_) (fun x hx \u21a6 ?_)\n \u00b7 obtain \u27e8s, hs, hs'\u27e9 := P.hf_int.sub (locallyIntegrableOn_const _) x hx\n refine \u27e8s, hs, ?_\u27e9\n rw [IntegrableOn, integrable_indicator_iff measurableSet_Ioi, IntegrableOn,\n Measure.restrict_restrict measurableSet_Ioi, \u2190 IntegrableOn]\n exact hs'.mono_set Set.inter_subset_right\n \u00b7 obtain \u27e8s, hs, hs'\u27e9 := P.hf_int.sub this x hx\n refine \u27e8s, hs, ?_\u27e9\n rw [IntegrableOn, integrable_indicator_iff measurableSet_Ioo, IntegrableOn,\n Measure.restrict_restrict measurableSet_Ioo, \u2190 IntegrableOn]\n exact hs'.mono_set Set.inter_subset_right", "-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.WeakFEPair (L107-L115)\nlemma WeakFEPair.h_feq' (P : WeakFEPair E) (x : \u211d) (hx : 0 < x) :\n P.g (1 / x) = (P.\u03b5\u207b\u00b9 * \u2191(x ^ P.k)) \u2022 P.f x := by\nrw [(div_div_cancel\u2080 (one_ne_zero' \u211d) \u25b8 P.h_feq (1 / x) (one_div_pos.mpr hx) :), \u2190 mul_smul]\n convert (one_smul \u2102 (P.g (1 / x))).symm using 2\n rw [one_div, inv_rpow hx.le, ofReal_inv]\n field [P.h\u03b5, (rpow_pos_of_pos hx _).ne']\n\nset_option linter.style.whitespace false in -- manual alignment is not recognised\n/-- The hypotheses are symmetric in `f` and `g`, with the constant `\u03b5` replaced by `\u03b5\u207b\u00b9`. -/", "-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.f_modif_aux2 (L353-L394)\nlemma f_modif_aux2 [CompleteSpace E] {s : \u2102} (hs : P.k < re s) :\n mellin (fun x \u21a6 P.f_modif x - P.f x + P.f\u2080) s = (1 / s) \u2022 P.f\u2080 + (P.\u03b5 / (P.k - s)) \u2022 P.g\u2080 := by\nhave h_re1 : -1 < re (s - 1) := by simpa using P.hk.trans hs\n have h_re2 : -1 < re (s - P.k - 1) := by simpa using hs\n calc\n _ = \u222b (x : \u211d) in Ioi 0, (x : \u2102) ^ (s - 1) \u2022\n ((Ioo 0 1).indicator (fun t : \u211d \u21a6 P.f\u2080 - (P.\u03b5 * \u2191(t ^ (-P.k))) \u2022 P.g\u2080) x\n + ({1} : Set \u211d).indicator (fun _ \u21a6 P.f\u2080 - P.f 1) x) :=\n setIntegral_congr_fun measurableSet_Ioi (fun x hx \u21a6 by simp [f_modif_aux1 P hx])\n _ = \u222b (x : \u211d) in Ioi 0, (x : \u2102) ^ (s - 1) \u2022 ((Ioo 0 1).indicator\n (fun t : \u211d \u21a6 P.f\u2080 - (P.\u03b5 * \u2191(t ^ (-P.k))) \u2022 P.g\u2080) x) := by\n refine setIntegral_congr_ae measurableSet_Ioi (eventually_of_mem (U := {1}\u1d9c)\n (compl_mem_ae_iff.mpr (subsingleton_singleton.measure_zero _)) (fun x hx _ \u21a6 ?_))\n rw [indicator_of_notMem hx, add_zero]\n _ = \u222b (x : \u211d) in Ioc 0 1, (x : \u2102) ^ (s - 1) \u2022 (P.f\u2080 - (P.\u03b5 * \u2191(x ^ (-P.k))) \u2022 P.g\u2080) := by\n simp_rw [\u2190 indicator_smul, setIntegral_indicator measurableSet_Ioo,\n inter_eq_right.mpr Ioo_subset_Ioi_self, integral_Ioc_eq_integral_Ioo]\n _ = \u222b x : \u211d in Ioc 0 1, ((x : \u2102) ^ (s - 1) \u2022 P.f\u2080 - P.\u03b5 \u2022 (x : \u2102) ^ (s - P.k - 1) \u2022 P.g\u2080) := by\n refine setIntegral_congr_fun measurableSet_Ioc (fun x \u27e8hx, _\u27e9 \u21a6 ?_)\n rw [ofReal_cpow hx.le, ofReal_neg, smul_sub, \u2190 mul_smul, mul_comm, mul_assoc, mul_smul,\n mul_comm, \u2190 cpow_add _ _ (ofReal_ne_zero.mpr hx.ne'), \u2190 sub_eq_add_neg, sub_right_comm]\n _ = (\u222b (x : \u211d) in Ioc 0 1, (x : \u2102) ^ (s - 1)) \u2022 P.f\u2080\n - P.\u03b5 \u2022 (\u222b (x : \u211d) in Ioc 0 1, (x : \u2102) ^ (s - P.k - 1)) \u2022 P.g\u2080 := by\n rw [integral_sub, integral_smul, integral_smul_const, integral_smul_const]\n \u00b7 apply Integrable.smul_const\n rw [\u2190 IntegrableOn, \u2190 intervalIntegrable_iff_integrableOn_Ioc_of_le zero_le_one]\n exact intervalIntegral.intervalIntegrable_cpow' h_re1\n \u00b7 refine (Integrable.smul_const ?_ _).smul _\n rw [\u2190 IntegrableOn, \u2190 intervalIntegrable_iff_integrableOn_Ioc_of_le zero_le_one]\n exact intervalIntegral.intervalIntegrable_cpow' h_re2\n _ = _ := by simp_rw [\u2190 intervalIntegral.integral_of_le zero_le_one,\n integral_cpow (Or.inl h_re1), integral_cpow (Or.inl h_re2), ofReal_zero, ofReal_one,\n one_cpow, sub_add_cancel, zero_cpow fun h \u21a6 lt_irrefl _ (P.hk.le.trans_lt (zero_re \u25b8 h \u25b8 hs)),\n zero_cpow (sub_ne_zero.mpr (fun h \u21a6 lt_irrefl _ ((ofReal_re _) \u25b8 h \u25b8 hs)) : s - P.k \u2260 0),\n sub_zero, sub_eq_add_neg (_ \u2022 _), \u2190 mul_smul, \u2190 neg_smul, mul_one_div, \u2190 div_neg, neg_sub]\n\n/-!\n## Main theorems on weak FE-pairs\n-/\n\n/-- An entire function which differs from the Mellin transform of `f - f\u2080`, where defined, by a\ncorrection term of the form `A / s + B / (k - s)`. -/", "-- Mathlib.NumberTheory.LSeries.Basic.LSeries_delta (L305-L319)\nlemma LSeries_delta : LSeries \u03b4 = 1 := by\next\n simp [LSeries, LSeries.term_delta]\n\nend delta\n\n\n/-!\n### Criteria for and consequences of summability of L-series\n\nWe relate summability of L-series with bounds on the coefficients in terms of powers of `n`.\n-/\n\n/-- If the `LSeries` of `f` is summable at `s`, then `f n` is bounded in absolute value\nby a constant times `n^(re s)`. -/", "-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.hf_zero (L146-L167)\nlemma hf_zero (P : WeakFEPair E) (r : \u211d) :\n (fun x \u21a6 P.f x - (P.\u03b5 * \u2191(x ^ (-P.k))) \u2022 P.g\u2080) =O[\ud835\udcdd[>] 0] (\u00b7 ^ r) := by\nhave := (P.hg_top (-(r + P.k))).comp_tendsto tendsto_inv_nhdsGT_zero\n simp_rw [IsBigO, IsBigOWith, eventually_nhdsWithin_iff] at this \u22a2\n obtain \u27e8C, hC\u27e9 := this\n use \u2016P.\u03b5\u2016 * C\n filter_upwards [hC] with x hC' (hx : 0 < x)\n have h_nv2 : \u2191(x ^ P.k) \u2260 (0 : \u2102) := ofReal_ne_zero.mpr (rpow_pos_of_pos hx _).ne'\n have h_nv : P.\u03b5\u207b\u00b9 * \u2191(x ^ P.k) \u2260 0 := mul_ne_zero P.symm.h\u03b5 h_nv2\n specialize hC' hx\n simp_rw [Function.comp_apply, \u2190 one_div, P.h_feq' _ hx] at hC'\n rw [\u2190 ((mul_inv_cancel\u2080 h_nv).symm \u25b8 one_smul \u2102 P.g\u2080 :), mul_smul _ _ P.g\u2080, \u2190 smul_sub, norm_smul,\n \u2190 le_div_iff\u2080' (lt_of_le_of_ne (norm_nonneg _) (norm_ne_zero_iff.mpr h_nv).symm)] at hC'\n convert hC' using 1\n \u00b7 congr 3\n rw [rpow_neg hx.le]\n simp [field]\n \u00b7 simp_rw [norm_mul, norm_real, one_div, inv_rpow hx.le, rpow_neg hx.le, inv_inv, norm_inv,\n norm_of_nonneg (rpow_pos_of_pos hx _).le, rpow_add hx]\n field\n\n/-- Power asymptotic for `f - f\u2080` as `x \u2192 0`. -/", "-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.differentiable_\u039b\u2080 (L409-L410)\ntheorem differentiable_\u039b\u2080 : Differentiable \u2102 P.\u039b\u2080 := P.toStrongFEPair.differentiable_\u039b", "-- Mathlib.NumberTheory.LSeries.Convolution.term_convolution (L98-L113)\nlemma term_convolution (f g : \u2115 \u2192 \u2102) (s : \u2102) (n : \u2115) :\n term (f \u235f g) s n = \u2211 p \u2208 n.divisorsAntidiagonal, term f s p.1 * term g s p.2 := by\nrcases eq_or_ne n 0 with rfl | hn\n \u00b7 simp\n -- now `n \u2260 0`\n rw [term_of_ne_zero hn, convolution_def, Finset.sum_div]\n refine Finset.sum_congr rfl fun p hp \u21a6 ?_\n have \u27e8hp\u2081, hp\u2082\u27e9 := ne_zero_of_mem_divisorsAntidiagonal hp\n rw [term_of_ne_zero hp\u2081, term_of_ne_zero hp\u2082, mul_comm_div, div_div, \u2190 mul_div_assoc,\n \u2190 natCast_mul_natCast_cpow, \u2190 cast_mul, mul_comm p.2, (mem_divisorsAntidiagonal.mp hp).1]\n\nopen Set in\n/-- We give an expression of the `LSeries.term` of the convolution of two functions\nin terms of an a priori infinite sum over all pairs `(k, m)` with `k * m = n`\n(the set we sum over is infinite when `n = 0`). This is the version needed for the\nproof that `L (f \u235f g) = L f * L g`. -/", "-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.hasMellin (L203-L207)\ntheorem hasMellin (s : \u2102) : HasMellin P.f s (P.\u039b s) :=\nlet \u27e8_, ht\u27e9 := exists_gt s.re\n let \u27e8_, hu\u27e9 := exists_lt s.re\n \u27e8mellinConvergent_of_isBigO_rpow P.hf_int (P.hf_top' _) ht (P.hf_zero' _) hu, rfl\u27e9", "-- Mathlib.NumberTheory.LSeries.Basic.term_pos (L143-L163)\nlemma term_pos {a : \u2115 \u2192 \u2102} {n : \u2115} (hn : n \u2260 0) (h : 0 < a n) (x : \u211d) : 0 < term a x n := by\nsimpa only [term_of_ne_zero hn] using mul_pos h <| inv_natCast_cpow_ofReal_pos hn x\n\nend positivity\n\nend LSeries\n\n/-!\n### Definition of the L-series and related statements\n\nWe define `LSeries f s` of `f : \u2115 \u2192 \u2102` as the sum over `LSeries.term f s`.\nWe also provide predicates `LSeriesSummable f s` stating that `LSeries f s` is summable\nand `LSeriesHasSum f s a` stating that the L-series of `f` is summable at `s` and converges\nto `a : \u2102`.\n-/\n\nopen LSeries\n\n/-- The value of the L-series of the sequence `f` at the point `s`\nif it converges absolutely there, and `0` otherwise. -/\nnoncomputable", "-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.functional_equation (L222-L257)\ntheorem functional_equation (s : \u2102) :\n P.\u039b (P.k - s) = P.\u03b5 \u2022 P.symm.\u039b s := by\n-- unfold definition:\n rw [P.\u039b_eq, P.symm_\u039b_eq]\n -- substitute `t \u21a6 t\u207b\u00b9` in `mellin P.g s`\n have step1 := mellin_comp_rpow P.g (-s) (-1)\n simp_rw [abs_neg, abs_one, inv_one, one_smul, ofReal_neg, ofReal_one, div_neg, div_one, neg_neg,\n rpow_neg_one, \u2190 one_div] at step1\n -- introduce a power of `t` to match the hypothesis `P.h_feq`\n have step2 := mellin_cpow_smul (fun t \u21a6 P.g (1 / t)) (P.k - s) (-P.k)\n rw [\u2190 sub_eq_add_neg, sub_right_comm, sub_self, zero_sub, step1] at step2\n -- put in the constant `P.\u03b5`\n have step3 := mellin_const_smul (fun t \u21a6 (t : \u2102) ^ (-P.k : \u2102) \u2022 P.g (1 / t)) (P.k - s) P.\u03b5\n rw [step2] at step3\n rw [\u2190 step3]\n -- now the integrand matches `P.h_feq'` on `Ioi 0`, so we can apply `setIntegral_congr_fun`\n refine setIntegral_congr_fun measurableSet_Ioi (fun t ht \u21a6 ?_)\n simp_rw [P.h_feq' t ht, \u2190 mul_smul]\n -- some simple `cpow` arithmetic to finish\n rw [cpow_neg, ofReal_cpow (le_of_lt ht)]\n have : (t : \u2102) ^ (P.k : \u2102) \u2260 0 := by simpa [\u2190 ofReal_cpow ht.le] using (rpow_pos_of_pos ht _).ne'\n field_simp [P.h\u03b5]\n\nend StrongFEPair\n\nnamespace WeakFEPair\n\nvariable (P : WeakFEPair E)\n\n/-!\n## Auxiliary results II: building a strong FE-pair from a weak FE-pair\n-/\n\n/-- Piecewise modified version of `f` with optimal asymptotics. We deliberately choose intervals\nwhich don't quite join up, so the function is `0` at `x = 1`, in order to maintain symmetry;\nthere is no \"good\" choice of value at `1`. -/", "-- Mathlib.NumberTheory.LSeries.Basic.LSeries (L164-L167)\ndef LSeries (f : \u2115 \u2192 \u2102) (s : \u2102) : \u2102 :=\n\u2211' n, term f s n\n\n/-- Congruence for `LSeries` with the evaluation variable `s`. -/", "-- Mathlib.NumberTheory.LSeries.Convolution.LSeries_convolution (L155-L162)\nlemma LSeries_convolution {f g : \u2115 \u2192 \u2102} {s : \u2102}\n (hf : abscissaOfAbsConv f < s.re) (hg : abscissaOfAbsConv g < s.re) :\n LSeries (f \u235f g) s = LSeries f s * LSeries g s :=\nLSeries_convolution' (LSeriesSummable_of_abscissaOfAbsConv_lt_re hf)\n (LSeriesSummable_of_abscissaOfAbsConv_lt_re hg)\n\n/-- The L-series of the convolution product `f \u235f g` of two sequences `f` and `g`\nis summable when both L-series are summable. -/", "-- Mathlib.NumberTheory.LSeries.Basic.LSeriesHasSum_iff (L227-L230)\nlemma LSeriesHasSum_iff {f : \u2115 \u2192 \u2102} {s a : \u2102} :\n LSeriesHasSum f s a \u2194 LSeriesSummable f s \u2227 LSeries f s = a :=\n\u27e8fun H \u21a6 \u27e8H.LSeriesSummable, H.LSeries_eq\u27e9, fun \u27e8H\u2081, H\u2082\u27e9 \u21a6 H\u2082 \u25b8 H\u2081.LSeriesHasSum\u27e9", "-- Mathlib.NumberTheory.LSeries.Basic.norm_term_eq (L114-L119)\nlemma norm_term_eq (f : \u2115 \u2192 \u2102) (s : \u2102) (n : \u2115) :\n \u2016term f s n\u2016 = if n = 0 then 0 else \u2016f n\u2016 / n ^ s.re := by\nrcases eq_or_ne n 0 with rfl | hn\n \u00b7 simp\n \u00b7 simp [hn, norm_natCast_cpow_of_pos <| Nat.pos_of_ne_zero hn]", "-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.symm_\u039b\u2080_eq (L404-L408)\nlemma symm_\u039b\u2080_eq (s : \u2102) :\n P.symm.\u039b\u2080 s = P.symm.\u039b s + (1 / s) \u2022 P.g\u2080 + (P.\u03b5\u207b\u00b9 / (P.k - s)) \u2022 P.f\u2080 := by\nrw [P.symm.\u039b\u2080_eq]\n rfl", "-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.\u039b_residue_k (L449-L464)\ntheorem \u039b_residue_k :\n Tendsto (fun s : \u2102 \u21a6 (s - P.k) \u2022 P.\u039b s) (\ud835\udcdd[\u2260] P.k) (\ud835\udcdd (P.\u03b5 \u2022 P.g\u2080)) := by\nsimp_rw [\u039b, smul_sub, (by simp : \ud835\udcdd (P.\u03b5 \u2022 P.g\u2080) = \ud835\udcdd (0 - 0 - -P.\u03b5 \u2022 P.g\u2080))]\n refine ((Tendsto.sub ?_ ?_).mono_left nhdsWithin_le_nhds).sub ?_\n \u00b7 rw [(by rw [sub_self, zero_smul] : \ud835\udcdd 0 = \ud835\udcdd ((P.k - P.k : \u2102) \u2022 P.\u039b\u2080 P.k))]\n apply ((continuous_sub_right _).smul P.differentiable_\u039b\u2080.continuous).tendsto\n \u00b7 rw [(by rw [sub_self, zero_smul] : \ud835\udcdd 0 = \ud835\udcdd ((P.k - P.k : \u2102) \u2022 (1 / P.k : \u2102) \u2022 P.f\u2080))]\n refine (continuous_sub_right _).continuousAt.smul (ContinuousAt.smul ?_ continuousAt_const)\n have := ofReal_ne_zero.mpr P.hk.ne'\n fun_prop (discharger := assumption)\n \u00b7 refine (tendsto_const_nhds.mono_left nhdsWithin_le_nhds).congr' ?_\n refine eventually_nhdsWithin_of_forall (fun s (hs : s \u2260 P.k) \u21a6 ?_)\n match_scalars\n field [sub_ne_zero.mpr hs.symm]\n\n/-- The residue of `\u039b` at `s = 0` is equal to `-f\u2080`. -/", "-- Mathlib.NumberTheory.LSeries.Convolution.toArithmeticFunction (L40-L43)\ndef toArithmeticFunction {R : Type*} [Zero R] (f : \u2115 \u2192 R) : ArithmeticFunction R where\n toFun n := if n = 0 then 0 else f n\nmap_zero' := rfl", "-- Mathlib.NumberTheory.LSeries.Basic.LSeriesSummable_congr (L176-L182)\nlemma LSeriesSummable_congr {f g : \u2115 \u2192 \u2102} (s : \u2102) (h : \u2200 {n}, n \u2260 0 \u2192 f n = g n) :\n LSeriesSummable f s \u2194 LSeriesSummable g s :=\nsummable_congr <| term_congr h s\n\nopen Filter in\n/-- If `f` and `g` agree on large `n : \u2115` and the `LSeries` of `f` converges at `s`,\nthen so does that of `g`. -/", "-- Mathlib.NumberTheory.LSeries.Convolution.toArithmeticFunction_congr (L44-L51)\nlemma toArithmeticFunction_congr {R : Type*} [Zero R] {f f' : \u2115 \u2192 R}\n (h : \u2200 {n}, n \u2260 0 \u2192 f n = f' n) :\n toArithmeticFunction f = toArithmeticFunction f' := by\next\n simp_all [toArithmeticFunction]\n\n/-- If we consider an arithmetic function just as a function and turn it back into an\narithmetic function, it is the same as before. -/", "-- Mathlib.NumberTheory.LSeries.Convolution.ArithmeticFunction (L53-L64)\nlemma ArithmeticFunction.toArithmeticFunction_eq_self {R : Type*} [Zero R]\n (f : ArithmeticFunction R) :\n toArithmeticFunction f = f := by\next n\n simp +contextual [toArithmeticFunction]\n\n/-- Dirichlet convolution of two sequences.\n\nWe define this in terms of the already existing definition for arithmetic functions. -/\nnoncomputable def LSeries.convolution {R : Type*} [Semiring R] (f g : \u2115 \u2192 R) : \u2115 \u2192 R :=\n \u21d1(toArithmeticFunction f * toArithmeticFunction g)", "-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.\u039b\u2080 (L395-L397)\ndef \u039b\u2080 : \u2102 \u2192 E := mellin P.f_modif\n/-- A meromorphic function which agrees with the Mellin transform of `f - f\u2080` where defined -/", "-- Mathlib.NumberTheory.LSeries.Deriv.LSeries_deriv (L86-L91)\nlemma LSeries_deriv {f : \u2115 \u2192 \u2102} {s : \u2102} (h : abscissaOfAbsConv f < s.re) :\n deriv (LSeries f) s = -LSeries (logMul f) s :=\n(LSeries_hasDerivAt h).deriv\n\n/-- The derivative of the L-series of `f` agrees with the negative of the L-series of\n`log * f` on the right half-plane of absolute convergence. -/", "-- Mathlib.NumberTheory.LSeries.Basic.norm_term_le_of_re_le_re (L127-L137)\nlemma norm_term_le_of_re_le_re (f : \u2115 \u2192 \u2102) {s s' : \u2102} (h : s.re \u2264 s'.re) (n : \u2115) :\n \u2016term f s' n\u2016 \u2264 \u2016term f s n\u2016 := by\nsimp only [norm_term_eq]\n split\n \u00b7 next => rfl\n \u00b7 next hn => gcongr; exact Nat.one_le_cast.mpr <| Nat.one_le_iff_ne_zero.mpr hn\n\nsection positivity\n\nopen scoped ComplexOrder", "-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.hf_zero' (L168-L187)\nlemma hf_zero' (P : WeakFEPair E) :\n (fun x : \u211d \u21a6 P.f x - P.f\u2080) =O[\ud835\udcdd[>] 0] (\u00b7 ^ (-P.k)) := by\nsimp_rw [\u2190 fun x \u21a6 sub_add_sub_cancel (P.f x) ((P.\u03b5 * \u2191(x ^ (-P.k))) \u2022 P.g\u2080) P.f\u2080]\n refine (P.hf_zero _).add (IsBigO.sub ?_ ?_)\n \u00b7 rw [\u2190 isBigO_norm_norm]\n simp_rw [mul_smul, norm_smul, mul_comm _ \u2016P.g\u2080\u2016, \u2190 mul_assoc, norm_real]\n apply (isBigO_refl _ _).const_mul_left\n \u00b7 refine IsBigO.of_bound \u2016P.f\u2080\u2016 (eventually_nhdsWithin_iff.mpr ?_)\n filter_upwards [eventually_le_nhds zero_lt_one] with x hx' (hx : 0 < x)\n apply le_mul_of_one_le_right (norm_nonneg _)\n rw [norm_of_nonneg (rpow_pos_of_pos hx _).le, rpow_neg hx.le]\n exact (one_le_inv\u2080 (rpow_pos_of_pos hx _)).2 (rpow_le_one hx.le hx' P.hk.le)\n\nend WeakFEPair\n\nnamespace StrongFEPair\n\nvariable (P : StrongFEPair E)\n\n/-- As `x \u2192 \u221e`, `f x` decays faster than any power of `x`. -/", "-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.f_modif (L258-L262)\ndef f_modif : \u211d \u2192 E :=\n(Ioi 1).indicator (fun x \u21a6 P.f x - P.f\u2080) +\n (Ioo 0 1).indicator (fun x \u21a6 P.f x - (P.\u03b5 * \u2191(x ^ (-P.k))) \u2022 P.g\u2080)\n\n/-- Piecewise modified version of `g` with optimal asymptotics. -/", "-- Mathlib.NumberTheory.LSeries.Convolution.LSeriesSummable_mul (L203-L208)\nlemma LSeriesSummable_mul {f g : ArithmeticFunction \u2102} {s : \u2102} (hf : LSeriesSummable \u2197f s)\n (hg : LSeriesSummable \u2197g s) :\n LSeriesSummable \u2197(f * g) s :=\ncoe_mul f g \u25b8 hf.convolution hg\n\nend ArithmeticFunction", "-- Mathlib.NumberTheory.LSeries.Basic.term (L74-L76)\ndef term (f : \u2115 \u2192 \u2102) (s : \u2102) (n : \u2115) : \u2102 :=\nif n = 0 then 0 else f n / n ^ s", "-- Mathlib.NumberTheory.LSeries.Basic.term_def\u2080 (L82-L86)\nlemma term_def\u2080 {f : \u2115 \u2192 \u2102} (hf : f 0 = 0) (s : \u2102) (n : \u2115) :\n LSeries.term f s n = f n * (n : \u2102) ^ (-s) := by\nrw [LSeries.term]\n split_ifs with h <;> simp [h, hf, cpow_neg, div_eq_inv_mul, mul_comm]", "-- Mathlib.NumberTheory.LSeries.Basic.LSeriesSummable_of_le_const_mul_rpow (L341-L366)\nlemma LSeriesSummable_of_le_const_mul_rpow {f : \u2115 \u2192 \u2102} {x : \u211d} {s : \u2102} (hs : x < s.re)\n (h : \u2203 C, \u2200 n \u2260 0, \u2016f n\u2016 \u2264 C * n ^ (x - 1)) :\n LSeriesSummable f s := by\nobtain \u27e8C, hC\u27e9 := h\n have hC\u2080 : 0 \u2264 C := (norm_nonneg <| f 1).trans <| by simpa using hC 1 one_ne_zero\n have hsum : Summable fun n : \u2115 \u21a6 \u2016(C : \u2102) / n ^ (s + (1 - x))\u2016 := by\n simp_rw [div_eq_mul_inv, norm_mul, \u2190 cpow_neg]\n have hsx : -s.re + x - 1 < -1 := by linarith only [hs]\n refine Summable.mul_left _ <|\n Summable.of_norm_bounded_eventually_nat (g := fun n \u21a6 (n : \u211d) ^ (-s.re + x - 1)) ?_ ?_\n \u00b7 simpa\n \u00b7 simp only [norm_norm, Filter.eventually_atTop]\n refine \u27e81, fun n hn \u21a6 le_of_eq ?_\u27e9\n simp only [norm_natCast_cpow_of_pos hn, add_re, sub_re, neg_re, ofReal_re, one_re]\n ring_nf\n refine Summable.of_norm <| hsum.of_nonneg_of_le (fun _ \u21a6 norm_nonneg _) (fun n \u21a6 ?_)\n rcases n.eq_zero_or_pos with rfl | hn\n \u00b7 simpa only [term_zero, norm_zero] using norm_nonneg _\n have hn' : 0 < (n : \u211d) ^ s.re := Real.rpow_pos_of_pos (Nat.cast_pos.mpr hn) _\n simp_rw [term_of_ne_zero hn.ne', norm_div, norm_natCast_cpow_of_pos hn, div_le_iff\u2080 hn',\n norm_real, Real.norm_of_nonneg hC\u2080, div_eq_mul_inv, mul_assoc,\n \u2190 Real.rpow_neg <| Nat.cast_nonneg _, \u2190 Real.rpow_add <| Nat.cast_pos.mpr hn]\n simpa using hC n <| Nat.pos_iff_ne_zero.mp hn\n\nopen Filter Finset Real Nat in\n/-- If `f = O(n^(x-1))` and `re s > x`, then the `LSeries` of `f` is summable at `s`. -/", "-- Mathlib.NumberTheory.LSeries.Basic.LSeries_congr (L168-L172)\nlemma LSeries_congr {f g : \u2115 \u2192 \u2102} (h : \u2200 {n}, n \u2260 0 \u2192 f n = g n) (s : \u2102) :\n LSeries f s = LSeries g s :=\ntsum_congr <| term_congr h s\n\n/-- `LSeriesSummable f s` indicates that the L-series of `f` converges absolutely at `s`. -/", "-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.differentiable_\u039b (L213-L221)\ntheorem differentiable_\u039b : Differentiable \u2102 P.\u039b := fun s \u21a6\nlet \u27e8_, ht\u27e9 := exists_gt s.re\n let \u27e8_, hu\u27e9 := exists_lt s.re\n mellin_differentiableAt_of_isBigO_rpow P.hf_int (P.hf_top' _) ht (P.hf_zero' _) hu\n\n/-- Main theorem about strong FE pairs: if `(f, g)` are a strong FE pair, then the Mellin\ntransforms of `f` and `g` are related by `s \u21a6 k - s`.\n\nThis is proved by making a substitution `t \u21a6 t\u207b\u00b9` in the Mellin transform integral. -/", "-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.\u039b_residue_zero (L465-L478)\ntheorem \u039b_residue_zero :\n Tendsto (fun s : \u2102 \u21a6 s \u2022 P.\u039b s) (\ud835\udcdd[\u2260] 0) (\ud835\udcdd (-P.f\u2080)) := by\nsimp_rw [\u039b, smul_sub, (by simp : \ud835\udcdd (-P.f\u2080) = \ud835\udcdd (((0 : \u2102) \u2022 P.\u039b\u2080 0) - P.f\u2080 - 0))]\n refine ((Tendsto.mono_left ?_ nhdsWithin_le_nhds).sub ?_).sub ?_\n \u00b7 exact (continuous_id.smul P.differentiable_\u039b\u2080.continuous).tendsto _\n \u00b7 refine (tendsto_const_nhds.mono_left nhdsWithin_le_nhds).congr' ?_\n refine eventually_nhdsWithin_of_forall (fun s (hs : s \u2260 0) \u21a6 ?_)\n match_scalars\n field [sub_ne_zero.mpr hs.symm]\n \u00b7 rw [show \ud835\udcdd 0 = \ud835\udcdd ((0 : \u2102) \u2022 (P.\u03b5 / (P.k - 0 : \u2102)) \u2022 P.g\u2080) by rw [zero_smul]]\n exact (continuousAt_id.smul ((continuousAt_const.div ((continuous_sub_left _).continuousAt)\n (by simpa using P.hk.ne')).smul continuousAt_const)).mono_left nhdsWithin_le_nhds\n\nend WeakFEPair", "-- Mathlib.NumberTheory.LSeries.Deriv.LSeries (L45-L79)\nlemma LSeries.hasDerivAt_term (f : \u2115 \u2192 \u2102) (n : \u2115) (s : \u2102) :\n HasDerivAt (fun z \u21a6 term f z n) (-(term (logMul f) s n)) s := by\nrcases eq_or_ne n 0 with rfl | hn\n \u00b7 simp [hasDerivAt_const]\n simp_rw [term_of_ne_zero hn, \u2190 neg_div, \u2190 neg_mul, mul_comm, mul_div_assoc, div_eq_mul_inv,\n \u2190 cpow_neg]\n exact HasDerivAt.const_mul (f n) (by simpa only [mul_comm, \u2190 mul_neg_one (log n), \u2190 mul_assoc]\n using (hasDerivAt_neg' s).const_cpow (Or.inl <| Nat.cast_ne_zero.mpr hn))\n\n/- This lemma proves two things at once, since their proofs are intertwined; we give separate\nnon-private lemmas below that extract the two statements. -/\nprivate lemma LSeries.LSeriesSummable_logMul_and_hasDerivAt {f : \u2115 \u2192 \u2102} {s : \u2102}\n (h : abscissaOfAbsConv f < s.re) :\n LSeriesSummable (logMul f) s \u2227 HasDerivAt (LSeries f) (-LSeries (logMul f) s) s := by\n -- The L-series of `f` is summable at some real `x < re s`.\n obtain \u27e8x, hxs, hf\u27e9 := LSeriesSummable_lt_re_of_abscissaOfAbsConv_lt_re h\n obtain \u27e8y, hxy, hys\u27e9 := exists_between hxs\n -- We work in the right half-plane `y < re z`, for some `y` such that `x < y < re s`, on which\n -- we have a uniform summable bound on `\u2016term f z \u00b7\u2016`.\n let S : Set \u2102 := {z | y < z.re}\n have h\u2080 : Summable (fun n \u21a6 \u2016term f x n\u2016) := summable_norm_iff.mpr hf\n have h\u2081 (n) : DifferentiableOn \u2102 (term f \u00b7 n) S :=\n fun z _ \u21a6 (hasDerivAt_term f n _).differentiableAt.differentiableWithinAt\n have h\u2082 : IsOpen S := isOpen_lt continuous_const continuous_re\n have h\u2083 (n z) (hz : z \u2208 S) : \u2016term f z n\u2016 \u2264 \u2016term f x n\u2016 :=\n norm_term_le_of_re_le_re f (by simpa using (hxy.trans hz).le) n\n have H := hasSum_deriv_of_summable_norm h\u2080 h\u2081 h\u2082 h\u2083 hys\n simp_rw [(hasDerivAt_term f _ _).deriv] at H\n refine \u27e8summable_neg_iff.mp H.summable, ?_\u27e9\n simpa [\u2190 H.tsum_eq, tsum_neg] using ((differentiableOn_tsum_of_summable_norm\n h\u2080 h\u2081 h\u2082 h\u2083).differentiableAt <| h\u2082.mem_nhds hys).hasDerivAt\n\n/-- If `re s` is greater than the abscissa of absolute convergence of `f`, then the L-series\nof `f` is differentiable with derivative the negative of the L-series of the point-wise\nproduct of `log` with `f`. -/", "-- Mathlib.NumberTheory.LSeries.Basic.term_delta (L282-L287)\nlemma term_delta (s : \u2102) (n : \u2115) : term \u03b4 s n = if n = 1 then 1 else 0 := by\nrcases eq_or_ne n 0 with rfl | hn\n \u00b7 simp\n \u00b7 rcases eq_or_ne n 1 with hn' | hn' <;>\n simp [hn, hn', delta]", "-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.functional_equation\u2080 (L439-L442)\ntheorem functional_equation\u2080 (s : \u2102) : P.\u039b\u2080 (P.k - s) = P.\u03b5 \u2022 P.symm.\u039b\u2080 s :=\nP.toStrongFEPair.functional_equation s\n\n/-- Functional equation formulated for `\u039b`. -/", "-- Mathlib.NumberTheory.LSeries.Basic.term_nonneg (L138-L142)\nlemma term_nonneg {a : \u2115 \u2192 \u2102} {n : \u2115} (h : 0 \u2264 a n) (x : \u211d) : 0 \u2264 term a x n := by\nrw [term_def]\n split_ifs with hn\n exacts [le_rfl, mul_nonneg h (inv_natCast_cpow_ofReal_pos hn x).le]", "-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.\u039b_eq (L208-L209)\nlemma \u039b_eq : P.\u039b = mellin P.f := rfl", "-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.f_modif_aux1 (L334-L352)\nlemma f_modif_aux1 : EqOn (fun x \u21a6 P.f_modif x - P.f x + P.f\u2080)\n ((Ioo 0 1).indicator (fun x : \u211d \u21a6 P.f\u2080 - (P.\u03b5 * \u2191(x ^ (-P.k))) \u2022 P.g\u2080)\n + ({1} : Set \u211d).indicator (fun _ \u21a6 P.f\u2080 - P.f 1)) (Ioi 0) := by\nintro x (hx : 0 < x)\n simp_rw [f_modif, Pi.add_apply]\n rcases lt_trichotomy x 1 with hx' | rfl | hx'\n \u00b7 simp_rw [indicator_of_notMem (notMem_Ioi.mpr hx'.le),\n indicator_of_mem (mem_Ioo.mpr \u27e8hx, hx'\u27e9),\n indicator_of_notMem (mem_singleton_iff.not.mpr hx'.ne)]\n abel\n \u00b7 simp [add_comm, sub_eq_add_neg]\n \u00b7 simp_rw [indicator_of_mem (mem_Ioi.mpr hx'),\n indicator_of_notMem (notMem_Ioo_of_ge hx'.le),\n indicator_of_notMem (mem_singleton_iff.not.mpr hx'.ne')]\n abel\n\nset_option backward.isDefEq.respectTransparency false in\n/-- Compute the Mellin transform of the modifying term used to kill off the constants at\n`0` and `\u221e`. -/", "-- Mathlib.NumberTheory.LSeries.Basic.LSeriesSummable_iff_of_re_eq_re (L240-L244)\ntheorem LSeriesSummable_iff_of_re_eq_re {f : \u2115 \u2192 \u2102} {s s' : \u2102} (h : s.re = s'.re) :\n LSeriesSummable f s \u2194 LSeriesSummable f s' :=\n\u27e8fun H \u21a6 H.of_re_le_re h.le, fun H \u21a6 H.of_re_le_re h.symm.le\u27e9\n\n/-- The indicator function of `{1} \u2286 \u2115` with values in `\u2102`. -/", "-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.g_modif (L263-L266)\ndef g_modif : \u211d \u2192 E :=\n(Ioi 1).indicator (fun x \u21a6 P.g x - P.g\u2080) +\n (Ioo 0 1).indicator (fun x \u21a6 P.g x - (P.\u03b5\u207b\u00b9 * \u2191(x ^ (-P.k))) \u2022 P.f\u2080)", "-- Mathlib.NumberTheory.LSeries.Deriv.LSeriesSummable_logMul_of_lt_re (L98-L103)\nlemma LSeriesSummable_logMul_of_lt_re {f : \u2115 \u2192 \u2102} {s : \u2102} (h : abscissaOfAbsConv f < s.re) :\n LSeriesSummable (logMul f) s :=\n(LSeriesSummable_logMul_and_hasDerivAt h).1\n\n/-- The abscissa of absolute convergence of the point-wise product of `log` and `f`\nis the same as that of `f`. -/", "-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.\u039b\u2080_eq (L400-L403)\nlemma \u039b\u2080_eq (s : \u2102) : P.\u039b\u2080 s = P.\u039b s + (1 / s) \u2022 P.f\u2080 + (P.\u03b5 / (P.k - s)) \u2022 P.g\u2080 := by\nunfold \u039b \u039b\u2080\n abel", "-- Mathlib.NumberTheory.LSeries.Basic.term_of_ne_zero (L92-L99)\nlemma term_of_ne_zero {n : \u2115} (hn : n \u2260 0) (f : \u2115 \u2192 \u2102) (s : \u2102) :\n term f s n = f n / n ^ s :=\nif_neg hn\n\n/--\nIf `s \u2260 0`, then the `if .. then .. else` construction in `LSeries.term` isn't needed, since\n`0 ^ s = 0`.\n-/", "-- Mathlib.NumberTheory.LSeries.Deriv.LSeries_iteratedDeriv (L133-L151)\nlemma LSeries_iteratedDeriv {f : \u2115 \u2192 \u2102} (m : \u2115) {s : \u2102} (h : abscissaOfAbsConv f < s.re) :\n iteratedDeriv m (LSeries f) s = (-1) ^ m * LSeries (logMul^[m] f) s := by\ninduction m generalizing s with\n | zero => simp\n | succ m ih =>\n have ih' : {s | abscissaOfAbsConv f < re s}.EqOn (iteratedDeriv m (LSeries f))\n ((-1) ^ m * LSeries (logMul^[m] f)) := fun _ hs \u21a6 ih hs\n have := derivWithin_congr ih' (ih h)\n simp_rw [derivWithin_of_isOpen (isOpen_re_gt_EReal _) h] at this\n rw [iteratedDeriv_succ, this]\n simp [Pi.mul_def, pow_succ, Function.iterate_succ',\n LSeries_deriv <| absicssaOfAbsConv_logPowMul.symm \u25b8 h, -Function.iterate_succ]\n\n/-!\n### The L-series is holomorphic\n-/\n\n/-- The L-series of `f` is complex differentiable in its open half-plane of absolute\nconvergence. -/", "-- Mathlib.NumberTheory.LSeries.Basic.LSeries_zero (L270-L281)\nlemma LSeries_zero : LSeries 0 = 0 := by\next\n simp [LSeries, LSeries.term]\n\nsection delta\n\nopen scoped LSeries.notation\n\nnamespace LSeries\n\nopen Nat Complex", "-- Mathlib.NumberTheory.LSeries.Basic.mul_delta (L293-L295)\nlemma mul_delta {f : \u2115 \u2192 \u2102} (h : f 1 = 1) : f * \u03b4 = \u03b4 := by\nrw [mul_delta_eq_smul_delta, h, one_smul]", "-- Mathlib.NumberTheory.LSeries.Basic.norm_term_le (L120-L126)\nlemma norm_term_le {f g : \u2115 \u2192 \u2102} (s : \u2102) {n : \u2115} (h : \u2016f n\u2016 \u2264 \u2016g n\u2016) :\n \u2016term f s n\u2016 \u2264 \u2016term g s n\u2016 := by\nsimp only [norm_term_eq]\n split\n \u00b7 rfl\n \u00b7 gcongr", "-- Mathlib.NumberTheory.LSeries.Basic.LSeriesSummable_congr' (L198-L201)\nlemma LSeriesSummable_congr' {f g : \u2115 \u2192 \u2102} (s : \u2102) (h : f =\u1da0[atTop] g) :\n LSeriesSummable f s \u2194 LSeriesSummable g s :=\n\u27e8fun H \u21a6 H.congr' s h, fun H \u21a6 H.congr' s h.symm\u27e9", "-- Mathlib.NumberTheory.LSeries.Convolution.convolution_def (L81-L86)\nlemma convolution_def {R : Type*} [Semiring R] (f g : \u2115 \u2192 R) :\n f \u235f g = fun n \u21a6 \u2211 p \u2208 n.divisorsAntidiagonal, f p.1 * g p.2 := by\next n\n simpa [convolution, toArithmeticFunction] using\n Finset.sum_congr rfl fun p hp \u21a6 by simp [ne_zero_of_mem_divisorsAntidiagonal hp]", "-- Mathlib.NumberTheory.LSeries.Basic.delta_mul_eq_smul_delta (L296-L298)\nlemma delta_mul_eq_smul_delta {f : \u2115 \u2192 \u2102} : \u03b4 * f = f 1 \u2022 \u03b4 :=\nmul_comm \u03b4 f \u25b8 mul_delta_eq_smul_delta", "-- Mathlib.NumberTheory.LSeries.Convolution.convolution_map_zero (L88-L97)\nlemma convolution_map_zero {R : Type*} [Semiring R] (f g : \u2115 \u2192 R) : (f \u235f g) 0 = 0 := by\nsimp [convolution_def]\n\n\n/-!\n### Multiplication of L-series\n-/\n\n/-- We give an expression of the `LSeries.term` of the convolution of two functions\nin terms of a sum over `Nat.divisorsAntidiagonal`. -/", "-- Mathlib.NumberTheory.LSeries.Basic.pow_mul_term_eq (L110-L113)\nlemma pow_mul_term_eq (f : \u2115 \u2192 \u2102) (s : \u2102) (n : \u2115) :\n (n + 1) ^ s * term f s (n + 1) = f (n + 1) := by\nsimp [term, natCast_add_one_cpow_ne_zero n _, mul_div_assoc']", "-- Mathlib.NumberTheory.LSeries.Basic.LSeriesSummable_zero (L207-L211)\ntheorem LSeriesSummable_zero {s : \u2102} : LSeriesSummable 0 s := by\nsimp [LSeriesSummable, funext (term_def 0 s), summable_zero]\n\n/-- This states that the L-series of the sequence `f` converges absolutely at `s` and that\nthe value there is `a`. -/", "-- Mathlib.NumberTheory.LSeries.Convolution.LSeries_mul (L196-L202)\nlemma LSeries_mul {f g : ArithmeticFunction \u2102} {s : \u2102}\n (hf : abscissaOfAbsConv \u2197f < s.re) (hg : abscissaOfAbsConv \u2197g < s.re) :\n LSeries \u2197(f * g) s = LSeries \u2197f s * LSeries \u2197g s :=\ncoe_mul f g \u25b8 LSeries_convolution hf hg\n\n/-- The L-series of the (convolution) product of two `\u2102`-valued arithmetic functions `f` and `g`\nis summable when both L-series are summable. -/", "-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.hf_top' (L188-L191)\nlemma hf_top' (r : \u211d) : P.f =O[atTop] (\u00b7 ^ r) := by\nsimpa [P.hf\u2080] using P.hf_top r\n\n/-- As `x \u2192 0`, `f x` decays faster than any power of `x`. -/", "-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.symm_\u039b_eq (L210-L212)\nlemma symm_\u039b_eq : P.symm.\u039b = mellin P.g := rfl\n/-- If `(f, g)` are a strong FE pair, then the Mellin transform of `f` is entire. -/", "-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.\u039b (L200-L202)\ndef \u039b : \u2102 \u2192 E := mellin P.f\n/-- The Mellin transform of `f` is well-defined and equal to `P.\u039b s`, for all `s`. -/", "-- Mathlib.NumberTheory.LSeries.Deriv.LSeries_deriv_eqOn (L92-L97)\nlemma LSeries_deriv_eqOn {f : \u2115 \u2192 \u2102} :\n {s | abscissaOfAbsConv f < s.re}.EqOn (deriv (LSeries f)) (-LSeries (logMul f)) :=\nderiv_eqOn (isOpen_re_gt_EReal _) fun _ hs \u21a6 (LSeries_hasDerivAt hs).hasDerivWithinAt\n\n/-- If the L-series of `f` is summable at `s` and `re s < re s'`, then the L-series of the\npoint-wise product of `log` with `f` is summable at `s'`. -/", "-- Mathlib.NumberTheory.LSeries.Basic.LSeriesSummable_of_bounded_of_one_lt_re (L388-L393)\ntheorem LSeriesSummable_of_bounded_of_one_lt_re {f : \u2115 \u2192 \u2102} {m : \u211d}\n (h : \u2200 n \u2260 0, \u2016f n\u2016 \u2264 m) {s : \u2102} (hs : 1 < s.re) :\n LSeriesSummable f s :=\nLSeriesSummable_of_le_const_mul_rpow hs \u27e8m, fun n hn \u21a6 by simp [h n hn]\u27e9\n\n/-- If `f` is bounded, then its `LSeries` is summable at `s : \u211d` when `s > 1`. -/", "-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.hf_modif_FE (L286-L306)\nlemma hf_modif_FE (x : \u211d) (hx : 0 < x) :\n P.f_modif (1 / x) = (P.\u03b5 * \u2191(x ^ P.k)) \u2022 P.g_modif x := by\nrcases lt_trichotomy 1 x with hx' | rfl | hx'\n \u00b7 have : 1 / x < 1 := by rwa [one_div_lt hx one_pos, div_one]\n rw [f_modif, Pi.add_apply, indicator_of_notMem (notMem_Ioi.mpr this.le),\n zero_add, indicator_of_mem (mem_Ioo.mpr \u27e8div_pos one_pos hx, this\u27e9), g_modif, Pi.add_apply,\n indicator_of_mem (mem_Ioi.mpr hx'), indicator_of_notMem\n (notMem_Ioo_of_ge hx'.le), add_zero, P.h_feq _ hx, smul_sub]\n simp_rw [rpow_neg (one_div_pos.mpr hx).le, one_div, inv_rpow hx.le, inv_inv]\n \u00b7 simp [f_modif, g_modif]\n \u00b7 have : 1 < 1 / x := by rwa [lt_one_div one_pos hx, div_one]\n rw [f_modif, Pi.add_apply, indicator_of_mem (mem_Ioi.mpr this),\n indicator_of_notMem (notMem_Ioo_of_ge this.le), g_modif, Pi.add_apply,\n indicator_of_notMem (notMem_Ioi.mpr hx'.le),\n indicator_of_mem (mem_Ioo.mpr \u27e8hx, hx'\u27e9), P.h_feq _ hx]\n simp_rw [rpow_neg hx.le]\n match_scalars <;> field [(rpow_pos_of_pos hx P.k).ne', P.h\u03b5]\n\nset_option linter.style.whitespace false in -- manual alignment is not recognised\n/-- Given a weak FE-pair `(f, g)`, modify it into a strong FE-pair by subtracting suitable\ncorrection terms from `f` and `g`. -/", "-- Mathlib.NumberTheory.LSeries.Basic.LSeriesHasSum (L212-L214)\ndef LSeriesHasSum (f : \u2115 \u2192 \u2102) (s a : \u2102) : Prop :=\nHasSum (term f s) a", "-- Mathlib.NumberTheory.LSeries.Basic.term_def (L77-L81)\nlemma term_def (f : \u2115 \u2192 \u2102) (s : \u2102) (n : \u2115) :\n term f s n = if n = 0 then 0 else f n / n ^ s :=\nrfl\n\n/-- An alternate spelling of `term_def` for the case `f 0 = 0`. -/", "-- Mathlib.NumberTheory.LSeries.Convolution.term_convolution' (L114-L138)\nlemma term_convolution' (f g : \u2115 \u2192 \u2102) (s : \u2102) :\n term (f \u235f g) s = fun n \u21a6\n \u2211' (b : (fun p : \u2115 \u00d7 \u2115 \u21a6 p.1 * p.2) \u207b\u00b9' {n}), term f s b.val.1 * term g s b.val.2 := by\next n\n rcases eq_or_ne n 0 with rfl | hn\n \u00b7 -- show that both sides vanish when `n = 0`; this is the hardest part of the proof!\n refine (term_zero ..).trans ?_\n -- the right-hand sum is over the union below, but in each term, one factor is always zero\n have hS : (fun p \u21a6 p.1 * p.2) \u207b\u00b9' {0} = {0} \u00d7\u02e2 univ \u222a univ \u00d7\u02e2 {0} := by\n ext\n simp\n have : \u2200 p : (fun p : \u2115 \u00d7 \u2115 \u21a6 p.1 * p.2) \u207b\u00b9' {0}, term f s p.val.1 * term g s p.val.2 = 0 := by\n rintro \u27e8\u27e8_, _\u27e9, hp\u27e9\n rcases hS \u25b8 hp with \u27e8rfl, -\u27e9 | \u27e8-, rfl\u27e9 <;> simp\n simp [this]\n -- now `n \u2260 0`\n rw [show (fun p : \u2115 \u00d7 \u2115 \u21a6 p.1 * p.2) \u207b\u00b9' {n} = n.divisorsAntidiagonal by ext; simp [hn],\n Finset.tsum_subtype' n.divisorsAntidiagonal fun p \u21a6 term f s p.1 * term g s p.2,\n term_convolution f g s n]\n\nend LSeries\n\nopen Set in\n/-- The L-series of the convolution product `f \u235f g` of two sequences `f` and `g`\nequals the product of their L-series, assuming both L-series converge. -/", "-- Mathlib.NumberTheory.LSeries.Basic.mul_delta_eq_smul_delta (L288-L292)\nlemma mul_delta_eq_smul_delta {f : \u2115 \u2192 \u2102} : f * \u03b4 = f 1 \u2022 \u03b4 := by\next n\n by_cases hn : n = 1 <;>\n simp [hn, delta]", "-- Mathlib.NumberTheory.LSeries.Convolution.LSeries_mul' (L189-L195)\nlemma LSeries_mul' {f g : ArithmeticFunction \u2102} {s : \u2102} (hf : LSeriesSummable \u2197f s)\n (hg : LSeriesSummable \u2197g s) :\n LSeries \u2197(f * g) s = LSeries \u2197f s * LSeries \u2197g s :=\ncoe_mul f g \u25b8 LSeries_convolution' hf hg\n\n/-- The L-series of the (convolution) product of two `\u2102`-valued arithmetic functions `f` and `g`\nequals the product of their L-series in their common half-plane of absolute convergence. -/", "-- Mathlib.NumberTheory.LSeries.Convolution.LSeries (L68-L74)\nlemma LSeries.convolution_congr {R : Type*} [Semiring R] {f f' g g' : \u2115 \u2192 R}\n (hf : \u2200 {n}, n \u2260 0 \u2192 f n = f' n) (hg : \u2200 {n}, n \u2260 0 \u2192 g n = g' n) :\n f \u235f g = f' \u235f g' := by\nsimp [convolution, toArithmeticFunction_congr hf, toArithmeticFunction_congr hg]\n\n/-- The product of two arithmetic functions defines the same function as the Dirichlet convolution\nof the functions defined by them. -/", "-- Mathlib.NumberTheory.LSeries.Basic.LSeriesSummable_of_isBigO_rpow (L367-L387)\nlemma LSeriesSummable_of_isBigO_rpow {f : \u2115 \u2192 \u2102} {x : \u211d} {s : \u2102} (hs : x < s.re)\n (h : f =O[atTop] fun n \u21a6 (n : \u211d) ^ (x - 1)) :\n LSeriesSummable f s := by\nobtain \u27e8C, hC\u27e9 := Asymptotics.isBigO_iff.mp h\n obtain \u27e8m, hm\u27e9 := eventually_atTop.mp hC\n let C' := max C (max' (insert 0 (image (fun n : \u2115 \u21a6 \u2016f n\u2016 / (n : \u211d) ^ (x - 1)) (range m)))\n (insert_nonempty 0 _))\n have hC'\u2080 : 0 \u2264 C' := (le_max' _ _ (mem_insert.mpr (Or.inl rfl))).trans <| le_max_right ..\n have hCC' : C \u2264 C' := le_max_left ..\n refine LSeriesSummable_of_le_const_mul_rpow hs \u27e8C', fun n hn\u2080 \u21a6 ?_\u27e9\n rcases le_or_gt m n with hn | hn\n \u00b7 refine (hm n hn).trans ?_\n have hn\u2080 : (0 : \u211d) \u2264 n := cast_nonneg _\n gcongr\n rw [Real.norm_eq_abs, abs_rpow_of_nonneg hn\u2080, abs_of_nonneg hn\u2080]\n \u00b7 have hn' : 0 < n := Nat.pos_of_ne_zero hn\u2080\n refine (div_le_iff\u2080 <| rpow_pos_of_pos (cast_pos.mpr hn') _).mp ?_\n refine (le_max' _ _ <| mem_insert_of_mem ?_).trans <| le_max_right ..\n exact mem_image.mpr \u27e8n, mem_range.mpr hn, rfl\u27e9\n\n/-- If `f` is bounded, then its `LSeries` is summable at `s` when `re s > 1`. -/", "-- Mathlib.NumberTheory.LSeries.Basic.delta_mul (L299-L304)\nlemma delta_mul {f : \u2115 \u2192 \u2102} (h : f 1 = 1) : \u03b4 * f = \u03b4 :=\nmul_comm \u03b4 f \u25b8 mul_delta h\n\nend LSeries\n\n/-- The L-series of `\u03b4` is the constant function `1`. -/", "-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.differentiableAt_\u039b (L411-L423)\ntheorem differentiableAt_\u039b {s : \u2102} (hs : s \u2260 0 \u2228 P.f\u2080 = 0) (hs' : s \u2260 P.k \u2228 P.g\u2080 = 0) :\n DifferentiableAt \u2102 P.\u039b s := by\nrefine ((P.differentiable_\u039b\u2080 s).sub ?_).sub ?_\n \u00b7 rcases hs with hs | hs\n \u00b7 simpa using (differentiableAt_inv hs).smul_const _\n \u00b7 simp [hs]\n \u00b7 rcases hs' with hs' | hs'\n \u00b7 apply DifferentiableAt.smul_const\n apply (differentiableAt_const _).div ((differentiableAt_const _).sub (differentiable_id _))\n simpa [sub_eq_zero, eq_comm]\n \u00b7 simp [hs']\n\n/-- Relation between `\u039b s` and the Mellin transform of `f - f\u2080`, where the latter is defined. -/", "-- Mathlib.NumberTheory.LSeries.Basic.term_zero (L88-L90)\nlemma term_zero (f : \u2115 \u2192 \u2102) (s : \u2102) : term f s 0 = 0 := rfl\n-- We put `hn` first for convenience, so that we can write `rw [LSeries.term_of_ne_zero hn]` etc.", "-- Mathlib.NumberTheory.LSeries.Basic.LSeriesHasSum_congr (L231-L234)\nlemma LSeriesHasSum_congr {f g : \u2115 \u2192 \u2102} (s a : \u2102) (h : \u2200 {n}, n \u2260 0 \u2192 f n = g n) :\n LSeriesHasSum f s a \u2194 LSeriesHasSum g s a := by\nsimp [LSeriesHasSum_iff, LSeriesSummable_congr s h, LSeries_congr h s]", "-- Mathlib.NumberTheory.LSeries.Basic.term_of_ne_zero' (L100-L105)\nlemma term_of_ne_zero' {s : \u2102} (hs : s \u2260 0) (f : \u2115 \u2192 \u2102) (n : \u2115) :\n term f s n = f n / n ^ s := by\nrcases eq_or_ne n 0 with rfl | hn\n \u00b7 rw [term_zero, Nat.cast_zero, zero_cpow hs, div_zero]\n \u00b7 rw [term_of_ne_zero hn]"], "source_grounded_context_enriched": false, "statement": "lemma LSeriesSummable.abscissaOfAbsConv_le {f : \u2115 \u2192 \u2102} {s : \u2102} (h : LSeriesSummable f s) :\n abscissaOfAbsConv f \u2264 s.re", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 50046, "declarations_count": 5629, "diagnostics_count": 1, "duplicate_fingerprint": "c9b71097e0f16eca", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 19885, "lean_code_chars": 47133, "lean_code_ratio": 0.9418, "length_bucket": "long", "line_count": 1318, "natural_language_chars": 2913, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 92, "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.NumberTheory.LSeries.Convergence).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma LSeriesSummable.abscissaOfAbsConv_le {f : \u2115 \u2192 \u2102} {s : \u2102} (h : LSeriesSummable f s) :\n abscissaOfAbsConv f \u2264 s.re\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L33-L39)\nlemma LSeries.abscissaOfAbsConv_congr {f g : \u2115 \u2192 \u2102} (h : \u2200 {n}, n \u2260 0 \u2192 f n = g n) :\n abscissaOfAbsConv f = abscissaOfAbsConv g :=\ncongr_arg sInf <| congr_arg _ <| Set.ext fun x \u21a6 LSeriesSummable_congr x h\n\nopen Filter in\n/-- If `f` and `g` agree on large `n : \u2115`, then their `LSeries` have the same\nabscissa of absolute convergence. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L40-L45)\nlemma LSeries.abscissaOfAbsConv_congr' {f g : \u2115 \u2192 \u2102} (h : f =\u1da0[atTop] g) :\n abscissaOfAbsConv f = abscissaOfAbsConv g :=\ncongr_arg sInf <| congr_arg _ <| Set.ext fun x \u21a6 LSeriesSummable_congr' x h\n\nopen LSeries\n```\n\n-- snippet 3\n```lean\n-- Mathlib.NumberTheory.LSeries.Convergence.LSeriesSummable_of_abscissaOfAbsConv_lt_re (L46-L51)\nlemma LSeriesSummable_of_abscissaOfAbsConv_lt_re {f : \u2115 \u2192 \u2102} {s : \u2102}\n (hs : abscissaOfAbsConv f < s.re) : LSeriesSummable f s := by\nobtain \u27e8y, hy, hys\u27e9 : \u2203 a : \u211d, LSeriesSummable f a \u2227 a < s.re := by\n simpa [abscissaOfAbsConv, sInf_lt_iff] using hs\n exact hy.of_re_le_re <| ofReal_re y \u25b8 hys.le\n```\n\n-- snippet 4\n```lean\n-- Mathlib.NumberTheory.LSeries.Convergence.LSeriesSummable_lt_re_of_abscissaOfAbsConv_lt_re (L52-L57)\nlemma LSeriesSummable_lt_re_of_abscissaOfAbsConv_lt_re {f : \u2115 \u2192 \u2102} {s : \u2102}\n (hs : abscissaOfAbsConv f < s.re) :\n \u2203 x : \u211d, x < s.re \u2227 LSeriesSummable f x := by\nobtain \u27e8x, hx\u2081, hx\u2082\u27e9 := EReal.exists_between_coe_real hs\n exact \u27e8x, by simpa using hx\u2082, LSeriesSummable_of_abscissaOfAbsConv_lt_re hx\u2081\u27e9\n```\n\n-- snippet 5\n```lean\n-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L62-L71)\nlemma LSeries.abscissaOfAbsConv_le_of_forall_lt_LSeriesSummable {f : \u2115 \u2192 \u2102} {x : \u211d}\n (h : \u2200 y : \u211d, x < y \u2192 LSeriesSummable f y) :\n abscissaOfAbsConv f \u2264 x := by\nrefine sInf_le_iff.mpr fun y hy \u21a6 le_of_forall_gt_imp_ge_of_dense fun a \u21a6 ?_\n replace hy : \u2200 (a : \u211d), LSeriesSummable f a \u2192 y \u2264 a := by simpa [mem_lowerBounds] using hy\n cases a with\n | coe a\u2080 => exact_mod_cast fun ha \u21a6 hy a\u2080 (h a\u2080 ha)\n | bot => simp\n | top => simp\n```\n\n-- snippet 6\n```lean\n-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L72-L86)\nlemma LSeries.abscissaOfAbsConv_le_of_forall_lt_LSeriesSummable' {f : \u2115 \u2192 \u2102} {x : EReal}\n (h : \u2200 y : \u211d, x < y \u2192 LSeriesSummable f y) :\n abscissaOfAbsConv f \u2264 x := by\ncases x with\n | coe => exact abscissaOfAbsConv_le_of_forall_lt_LSeriesSummable <| mod_cast h\n | top => exact le_top\n | bot =>\n refine le_of_eq <| sInf_eq_bot.mpr fun y hy \u21a6 ?_\n cases y with\n | bot => simp at hy\n | coe y => exact \u27e8_, \u27e8_, h _ <| EReal.bot_lt_coe _, rfl\u27e9, mod_cast sub_one_lt y\u27e9\n | top => exact \u27e8_, \u27e8_, h _ <| EReal.bot_lt_coe 0, rfl\u27e9, EReal.zero_lt_top\u27e9\n\n/-- If `\u2016f n\u2016` is bounded by a constant times `n^x`, then the abscissa of absolute convergence\nof `f` is bounded by `x + 1`. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L87-L97)\nlemma LSeries.abscissaOfAbsConv_le_of_le_const_mul_rpow {f : \u2115 \u2192 \u2102} {x : \u211d}\n (h : \u2203 C, \u2200 n \u2260 0, \u2016f n\u2016 \u2264 C * n ^ x) : abscissaOfAbsConv f \u2264 x + 1 := by\nrw [show x = x + 1 - 1 by ring] at h\n by_contra! H\n obtain \u27e8y, hy\u2081, hy\u2082\u27e9 := EReal.exists_between_coe_real H\n exact (LSeriesSummable_of_le_const_mul_rpow (s := y) (EReal.coe_lt_coe_iff.mp hy\u2081) h\n |>.abscissaOfAbsConv_le.trans_lt hy\u2082).false\n\nopen Filter in\n/-- If `\u2016f n\u2016` is `O(n^x)`, then the abscissa of absolute convergence\nof `f` is bounded by `x + 1`. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L98-L107)\nlemma LSeries.abscissaOfAbsConv_le_of_isBigO_rpow {f : \u2115 \u2192 \u2102} {x : \u211d}\n (h : f =O[atTop] fun n \u21a6 (n : \u211d) ^ x) :\n abscissaOfAbsConv f \u2264 x + 1 := by\nrw [show x = x + 1 - 1 by ring] at h\n by_contra! H\n obtain \u27e8y, hy\u2081, hy\u2082\u27e9 := EReal.exists_between_coe_real H\n exact (LSeriesSummable_of_isBigO_rpow (s := y) (EReal.coe_lt_coe_iff.mp hy\u2081) h\n |>.abscissaOfAbsConv_le.trans_lt hy\u2082).false\n\n/-- If `f` is bounded, then the abscissa of absolute convergence of `f` is bounded above by `1`. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L108-L113)\nlemma LSeries.abscissaOfAbsConv_le_of_le_const {f : \u2115 \u2192 \u2102} (h : \u2203 C, \u2200 n \u2260 0, \u2016f n\u2016 \u2264 C) :\n abscissaOfAbsConv f \u2264 1 := by\nsimpa using abscissaOfAbsConv_le_of_le_const_mul_rpow (x := 0) (by simpa using h)\n\nopen Filter in\n/-- If `f` is `O(1)`, then the abscissa of absolute convergence of `f` is bounded above by `1`. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L114-L119)\nlemma LSeries.abscissaOfAbsConv_le_one_of_isBigO_one {f : \u2115 \u2192 \u2102} (h : f =O[atTop] fun _ \u21a6 (1 : \u211d)) :\n abscissaOfAbsConv f \u2264 1 := by\nsimpa using abscissaOfAbsConv_le_of_isBigO_rpow (x := 0) (by simpa using h)\n\n/-- If `f` is real-valued and `x` is strictly greater than the abscissa of absolute convergence\nof `f`, then the real series `\u2211' n, f n / n ^ x` converges. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L120-L135)\nlemma LSeries.summable_real_of_abscissaOfAbsConv_lt {f : \u2115 \u2192 \u211d} {x : \u211d}\n (h : abscissaOfAbsConv (f \u00b7) < x) :\n Summable fun n : \u2115 \u21a6 f n / (n : \u211d) ^ x := by\nhave aux : term (f \u00b7) x = fun n \u21a6 \u2191(if n = 0 then 0 else f n / (n : \u211d) ^ x) := by\n ext n\n simp [term_def, apply_ite ((\u2191) : \u211d \u2192 \u2102), ofReal_cpow n.cast_nonneg]\n have := LSeriesSummable_of_abscissaOfAbsConv_lt_re (ofReal_re x \u25b8 h)\n simp only [LSeriesSummable, aux, summable_ofReal] at this\n refine this.congr_cofinite ?_\n filter_upwards [(Set.finite_singleton 0).compl_mem_cofinite] with n hn\n using if_neg (by simpa using hn)\n\n/-- If `F` is a binary operation on `\u2115 \u2192 \u2102` with the property that the `LSeries` of `F f g`\nconverges whenever the `LSeries` of `f` and `g` do, then the abscissa of absolute convergence\nof `F f g` is at most the maximum of the abscissa of absolute convergence of `f`\nand that of `g`. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L136-L144)\nlemma LSeries.abscissaOfAbsConv_binop_le {F : (\u2115 \u2192 \u2102) \u2192 (\u2115 \u2192 \u2102) \u2192 (\u2115 \u2192 \u2102)}\n (hF : \u2200 {f g s}, LSeriesSummable f s \u2192 LSeriesSummable g s \u2192 LSeriesSummable (F f g) s)\n (f g : \u2115 \u2192 \u2102) :\n abscissaOfAbsConv (F f g) \u2264 max (abscissaOfAbsConv f) (abscissaOfAbsConv g) := by\nrefine abscissaOfAbsConv_le_of_forall_lt_LSeriesSummable' fun x hx \u21a6 hF ?_ ?_\n \u00b7 exact LSeriesSummable_of_abscissaOfAbsConv_lt_re <|\n (ofReal_re x).symm \u25b8 (le_max_left ..).trans_lt hx\n \u00b7 exact LSeriesSummable_of_abscissaOfAbsConv_lt_re <|\n (ofReal_re x).symm \u25b8 (le_max_right ..).trans_lt hx\n```\n\n-- snippet 13\n```lean\n-- Mathlib.NumberTheory.LSeries.Deriv.LSeries_hasDerivAt (L80-L85)\nlemma LSeries_hasDerivAt {f : \u2115 \u2192 \u2102} {s : \u2102} (h : abscissaOfAbsConv f < s.re) :\n HasDerivAt (LSeries f) (-LSeries (logMul f) s) s :=\n(LSeriesSummable_logMul_and_hasDerivAt h).2\n\n/-- If `re s` is greater than the abscissa of absolute convergence of `f`, then\nthe derivative of this L-series at `s` is the negative of the L-series of `log * f`. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.toStrongFEPair (L307-L333)\ndef toStrongFEPair : StrongFEPair E where\n f := P.f_modif\ng := P.symm.f_modif\n k := P.k\n \u03b5 := P.\u03b5\n f\u2080 := 0\n g\u2080 := 0\n hf_int := P.hf_modif_int\n hg_int := P.symm.hf_modif_int\n h_feq := P.hf_modif_FE\n h\u03b5 := P.h\u03b5\n hk := P.hk\n hf\u2080 := rfl\n hg\u2080 := rfl\n hf_top r := by\n refine (P.hf_top r).congr' ?_ (by rfl)\n filter_upwards [eventually_gt_atTop 1] with x hx\n rw [f_modif, Pi.add_apply, indicator_of_mem (mem_Ioi.mpr hx),\n indicator_of_notMem (notMem_Ioo_of_ge hx.le), add_zero, sub_zero]\n hg_top r := by\n refine (P.hg_top r).congr' ?_ (by rfl)\n filter_upwards [eventually_gt_atTop 1] with x hx\n rw [f_modif, Pi.add_apply, indicator_of_mem (mem_Ioi.mpr hx),\n indicator_of_notMem (notMem_Ioo_of_ge hx.le), add_zero, sub_zero]\n rfl\n\n/- Alternative form for the difference between `f - f\u2080` and its modified term. -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.term_congr (L106-L109)\nlemma term_congr {f g : \u2115 \u2192 \u2102} (h : \u2200 {n}, n \u2260 0 \u2192 f n = g n) (s : \u2102) (n : \u2115) :\n term f s n = term g s n := by\nrcases eq_or_ne n 0 with hn | hn <;> simp [hn, h]\n```\n\n-- snippet 16\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.StrongFEPair (L132-L145)\ndef StrongFEPair.symm (P : StrongFEPair E) : StrongFEPair E where\n toWeakFEPair := P.toWeakFEPair.symm\nhf\u2080 := P.hg\u2080\n hg\u2080 := P.hf\u2080\n\nend symmetry\n\nnamespace WeakFEPair\n\n/-!\n## Auxiliary results I: lemmas on asymptotics\n-/\n\n/-- As `x \u2192 0`, we have `f x = x ^ (-P.k) \u2022 constant` up to a rapidly decaying error. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeriesSummable_of_bounded_of_one_lt_real (L394-L397)\ntheorem LSeriesSummable_of_bounded_of_one_lt_real {f : \u2115 \u2192 \u2102} {m : \u211d}\n (h : \u2200 n \u2260 0, \u2016f n\u2016 \u2264 m) {s : \u211d} (hs : 1 < s) :\n LSeriesSummable f s :=\nLSeriesSummable_of_bounded_of_one_lt_re h <| by simp [hs]\n```\n\n-- snippet 18\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.LSeries_convolution' (L148-L154)\nlemma LSeries_convolution' {f g : \u2115 \u2192 \u2102} {s : \u2102} (hf : LSeriesSummable f s)\n (hg : LSeriesSummable g s) :\n LSeries (f \u235f g) s = LSeries f s * LSeries g s :=\n(LSeriesHasSum.convolution hf.LSeriesHasSum hg.LSeriesHasSum).LSeries_eq\n\n/-- The L-series of the convolution product `f \u235f g` of two sequences `f` and `g`\nequals the product of their L-series in their common half-plane of absolute convergence. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.LSeriesHasSum (L139-L147)\nlemma LSeriesHasSum.convolution {f g : \u2115 \u2192 \u2102} {s a b : \u2102} (hf : LSeriesHasSum f s a)\n (hg : LSeriesHasSum g s b) :\n LSeriesHasSum (f \u235f g) s (a * b) := by\nhave hsum := summable_mul_of_summable_norm hf.summable.norm hg.summable.norm\n -- NB: this `simpa` is quite slow if un-squeezed\n simpa only [LSeriesHasSum, term_convolution'] using (hf.mul hg hsum).tsum_fiberwise _\n\n/-- The L-series of the convolution product `f \u235f g` of two sequences `f` and `g`\nequals the product of their L-series, assuming both L-series converge. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.LSeriesHasSum_mul (L182-L188)\nlemma LSeriesHasSum_mul {f g : ArithmeticFunction \u2102} {s a b : \u2102} (hf : LSeriesHasSum \u2197f s a)\n (hg : LSeriesHasSum \u2197g s b) :\n LSeriesHasSum \u2197(f * g) s (a * b) :=\ncoe_mul f g \u25b8 hf.convolution hg\n\n/-- The L-series of the (convolution) product of two `\u2102`-valued arithmetic functions `f` and `g`\nequals the product of their L-series, assuming both L-series converge. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.hf_modif_int (L267-L285)\nlemma hf_modif_int :\n LocallyIntegrableOn P.f_modif (Ioi 0) := by\nhave : LocallyIntegrableOn (fun x : \u211d \u21a6 (P.\u03b5 * \u2191(x ^ (-P.k))) \u2022 P.g\u2080) (Ioi 0) := by\n refine ContinuousOn.locallyIntegrableOn ?_ measurableSet_Ioi\n refine continuousOn_of_forall_continuousAt (fun x (hx : 0 < x) \u21a6 ?_)\n have : x \u2260 0 \u2228 0 \u2264 -P.k := Or.inl hx.ne'\n fun_prop (discharger := assumption)\n refine LocallyIntegrableOn.add (fun x hx \u21a6 ?_) (fun x hx \u21a6 ?_)\n \u00b7 obtain \u27e8s, hs, hs'\u27e9 := P.hf_int.sub (locallyIntegrableOn_const _) x hx\n refine \u27e8s, hs, ?_\u27e9\n rw [IntegrableOn, integrable_indicator_iff measurableSet_Ioi, IntegrableOn,\n Measure.restrict_restrict measurableSet_Ioi, \u2190 IntegrableOn]\n exact hs'.mono_set Set.inter_subset_right\n \u00b7 obtain \u27e8s, hs, hs'\u27e9 := P.hf_int.sub this x hx\n refine \u27e8s, hs, ?_\u27e9\n rw [IntegrableOn, integrable_indicator_iff measurableSet_Ioo, IntegrableOn,\n Measure.restrict_restrict measurableSet_Ioo, \u2190 IntegrableOn]\n exact hs'.mono_set Set.inter_subset_right\n```\n\n-- snippet 22\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.WeakFEPair (L107-L115)\nlemma WeakFEPair.h_feq' (P : WeakFEPair E) (x : \u211d) (hx : 0 < x) :\n P.g (1 / x) = (P.\u03b5\u207b\u00b9 * \u2191(x ^ P.k)) \u2022 P.f x := by\nrw [(div_div_cancel\u2080 (one_ne_zero' \u211d) \u25b8 P.h_feq (1 / x) (one_div_pos.mpr hx) :), \u2190 mul_smul]\n convert (one_smul \u2102 (P.g (1 / x))).symm using 2\n rw [one_div, inv_rpow hx.le, ofReal_inv]\n field [P.h\u03b5, (rpow_pos_of_pos hx _).ne']\n\nset_option linter.style.whitespace false in -- manual alignment is not recognised\n/-- The hypotheses are symmetric in `f` and `g`, with the constant `\u03b5` replaced by `\u03b5\u207b\u00b9`. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.f_modif_aux2 (L353-L394)\nlemma f_modif_aux2 [CompleteSpace E] {s : \u2102} (hs : P.k < re s) :\n mellin (fun x \u21a6 P.f_modif x - P.f x + P.f\u2080) s = (1 / s) \u2022 P.f\u2080 + (P.\u03b5 / (P.k - s)) \u2022 P.g\u2080 := by\nhave h_re1 : -1 < re (s - 1) := by simpa using P.hk.trans hs\n have h_re2 : -1 < re (s - P.k - 1) := by simpa using hs\n calc\n _ = \u222b (x : \u211d) in Ioi 0, (x : \u2102) ^ (s - 1) \u2022\n ((Ioo 0 1).indicator (fun t : \u211d \u21a6 P.f\u2080 - (P.\u03b5 * \u2191(t ^ (-P.k))) \u2022 P.g\u2080) x\n + ({1} : Set \u211d).indicator (fun _ \u21a6 P.f\u2080 - P.f 1) x) :=\n setIntegral_congr_fun measurableSet_Ioi (fun x hx \u21a6 by simp [f_modif_aux1 P hx])\n _ = \u222b (x : \u211d) in Ioi 0, (x : \u2102) ^ (s - 1) \u2022 ((Ioo 0 1).indicator\n (fun t : \u211d \u21a6 P.f\u2080 - (P.\u03b5 * \u2191(t ^ (-P.k))) \u2022 P.g\u2080) x) := by\n refine setIntegral_congr_ae measurableSet_Ioi (eventually_of_mem (U := {1}\u1d9c)\n (compl_mem_ae_iff.mpr (subsingleton_singleton.measure_zero _)) (fun x hx _ \u21a6 ?_))\n rw [indicator_of_notMem hx, add_zero]\n _ = \u222b (x : \u211d) in Ioc 0 1, (x : \u2102) ^ (s - 1) \u2022 (P.f\u2080 - (P.\u03b5 * \u2191(x ^ (-P.k))) \u2022 P.g\u2080) := by\n simp_rw [\u2190 indicator_smul, setIntegral_indicator measurableSet_Ioo,\n inter_eq_right.mpr Ioo_subset_Ioi_self, integral_Ioc_eq_integral_Ioo]\n _ = \u222b x : \u211d in Ioc 0 1, ((x : \u2102) ^ (s - 1) \u2022 P.f\u2080 - P.\u03b5 \u2022 (x : \u2102) ^ (s - P.k - 1) \u2022 P.g\u2080) := by\n refine setIntegral_congr_fun measurableSet_Ioc (fun x \u27e8hx, _\u27e9 \u21a6 ?_)\n rw [ofReal_cpow hx.le, ofReal_neg, smul_sub, \u2190 mul_smul, mul_comm, mul_assoc, mul_smul,\n mul_comm, \u2190 cpow_add _ _ (ofReal_ne_zero.mpr hx.ne'), \u2190 sub_eq_add_neg, sub_right_comm]\n _ = (\u222b (x : \u211d) in Ioc 0 1, (x : \u2102) ^ (s - 1)) \u2022 P.f\u2080\n - P.\u03b5 \u2022 (\u222b (x : \u211d) in Ioc 0 1, (x : \u2102) ^ (s - P.k - 1)) \u2022 P.g\u2080 := by\n rw [integral_sub, integral_smul, integral_smul_const, integral_smul_const]\n \u00b7 apply Integrable.smul_const\n rw [\u2190 IntegrableOn, \u2190 intervalIntegrable_iff_integrableOn_Ioc_of_le zero_le_one]\n exact intervalIntegral.intervalIntegrable_cpow' h_re1\n \u00b7 refine (Integrable.smul_const ?_ _).smul _\n rw [\u2190 IntegrableOn, \u2190 intervalIntegrable_iff_integrableOn_Ioc_of_le zero_le_one]\n exact intervalIntegral.intervalIntegrable_cpow' h_re2\n _ = _ := by simp_rw [\u2190 intervalIntegral.integral_of_le zero_le_one,\n integral_cpow (Or.inl h_re1), integral_cpow (Or.inl h_re2), ofReal_zero, ofReal_one,\n one_cpow, sub_add_cancel, zero_cpow fun h \u21a6 lt_irrefl _ (P.hk.le.trans_lt (zero_re \u25b8 h \u25b8 hs)),\n zero_cpow (sub_ne_zero.mpr (fun h \u21a6 lt_irrefl _ ((ofReal_re _) \u25b8 h \u25b8 hs)) : s - P.k \u2260 0),\n sub_zero, sub_eq_add_neg (_ \u2022 _), \u2190 mul_smul, \u2190 neg_smul, mul_one_div, \u2190 div_neg, neg_sub]\n\n/-!\n## Main theorems on weak FE-pairs\n-/\n\n/-- An entire function which differs from the Mellin transform of `f - f\u2080`, where defined, by a\ncorrection term of the form `A / s + B / (k - s)`. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeries_delta (L305-L319)\nlemma LSeries_delta : LSeries \u03b4 = 1 := by\next\n simp [LSeries, LSeries.term_delta]\n\nend delta\n\n\n/-!\n### Criteria for and consequences of summability of L-series\n\nWe relate summability of L-series with bounds on the coefficients in terms of powers of `n`.\n-/\n\n/-- If the `LSeries` of `f` is summable at `s`, then `f n` is bounded in absolute value\nby a constant times `n^(re s)`. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.hf_zero (L146-L167)\nlemma hf_zero (P : WeakFEPair E) (r : \u211d) :\n (fun x \u21a6 P.f x - (P.\u03b5 * \u2191(x ^ (-P.k))) \u2022 P.g\u2080) =O[\ud835\udcdd[>] 0] (\u00b7 ^ r) := by\nhave := (P.hg_top (-(r + P.k))).comp_tendsto tendsto_inv_nhdsGT_zero\n simp_rw [IsBigO, IsBigOWith, eventually_nhdsWithin_iff] at this \u22a2\n obtain \u27e8C, hC\u27e9 := this\n use \u2016P.\u03b5\u2016 * C\n filter_upwards [hC] with x hC' (hx : 0 < x)\n have h_nv2 : \u2191(x ^ P.k) \u2260 (0 : \u2102) := ofReal_ne_zero.mpr (rpow_pos_of_pos hx _).ne'\n have h_nv : P.\u03b5\u207b\u00b9 * \u2191(x ^ P.k) \u2260 0 := mul_ne_zero P.symm.h\u03b5 h_nv2\n specialize hC' hx\n simp_rw [Function.comp_apply, \u2190 one_div, P.h_feq' _ hx] at hC'\n rw [\u2190 ((mul_inv_cancel\u2080 h_nv).symm \u25b8 one_smul \u2102 P.g\u2080 :), mul_smul _ _ P.g\u2080, \u2190 smul_sub, norm_smul,\n \u2190 le_div_iff\u2080' (lt_of_le_of_ne (norm_nonneg _) (norm_ne_zero_iff.mpr h_nv).symm)] at hC'\n convert hC' using 1\n \u00b7 congr 3\n rw [rpow_neg hx.le]\n simp [field]\n \u00b7 simp_rw [norm_mul, norm_real, one_div, inv_rpow hx.le, rpow_neg hx.le, inv_inv, norm_inv,\n norm_of_nonneg (rpow_pos_of_pos hx _).le, rpow_add hx]\n field\n\n/-- Power asymptotic for `f - f\u2080` as `x \u2192 0`. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.differentiable_\u039b\u2080 (L409-L410)\ntheorem differentiable_\u039b\u2080 : Differentiable \u2102 P.\u039b\u2080 := P.toStrongFEPair.differentiable_\u039b\n```\n\n-- snippet 27\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.term_convolution (L98-L113)\nlemma term_convolution (f g : \u2115 \u2192 \u2102) (s : \u2102) (n : \u2115) :\n term (f \u235f g) s n = \u2211 p \u2208 n.divisorsAntidiagonal, term f s p.1 * term g s p.2 := by\nrcases eq_or_ne n 0 with rfl | hn\n \u00b7 simp\n -- now `n \u2260 0`\n rw [term_of_ne_zero hn, convolution_def, Finset.sum_div]\n refine Finset.sum_congr rfl fun p hp \u21a6 ?_\n have \u27e8hp\u2081, hp\u2082\u27e9 := ne_zero_of_mem_divisorsAntidiagonal hp\n rw [term_of_ne_zero hp\u2081, term_of_ne_zero hp\u2082, mul_comm_div, div_div, \u2190 mul_div_assoc,\n \u2190 natCast_mul_natCast_cpow, \u2190 cast_mul, mul_comm p.2, (mem_divisorsAntidiagonal.mp hp).1]\n\nopen Set in\n/-- We give an expression of the `LSeries.term` of the convolution of two functions\nin terms of an a priori infinite sum over all pairs `(k, m)` with `k * m = n`\n(the set we sum over is infinite when `n = 0`). This is the version needed for the\nproof that `L (f \u235f g) = L f * L g`. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.hasMellin (L203-L207)\ntheorem hasMellin (s : \u2102) : HasMellin P.f s (P.\u039b s) :=\nlet \u27e8_, ht\u27e9 := exists_gt s.re\n let \u27e8_, hu\u27e9 := exists_lt s.re\n \u27e8mellinConvergent_of_isBigO_rpow P.hf_int (P.hf_top' _) ht (P.hf_zero' _) hu, rfl\u27e9\n```\n\n-- snippet 29\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.term_pos (L143-L163)\nlemma term_pos {a : \u2115 \u2192 \u2102} {n : \u2115} (hn : n \u2260 0) (h : 0 < a n) (x : \u211d) : 0 < term a x n := by\nsimpa only [term_of_ne_zero hn] using mul_pos h <| inv_natCast_cpow_ofReal_pos hn x\n\nend positivity\n\nend LSeries\n\n/-!\n### Definition of the L-series and related statements\n\nWe define `LSeries f s` of `f : \u2115 \u2192 \u2102` as the sum over `LSeries.term f s`.\nWe also provide predicates `LSeriesSummable f s` stating that `LSeries f s` is summable\nand `LSeriesHasSum f s a` stating that the L-series of `f` is summable at `s` and converges\nto `a : \u2102`.\n-/\n\nopen LSeries\n\n/-- The value of the L-series of the sequence `f` at the point `s`\nif it converges absolutely there, and `0` otherwise. -/\nnoncomputable\n```\n\n-- snippet 30\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.functional_equation (L222-L257)\ntheorem functional_equation (s : \u2102) :\n P.\u039b (P.k - s) = P.\u03b5 \u2022 P.symm.\u039b s := by\n-- unfold definition:\n rw [P.\u039b_eq, P.symm_\u039b_eq]\n -- substitute `t \u21a6 t\u207b\u00b9` in `mellin P.g s`\n have step1 := mellin_comp_rpow P.g (-s) (-1)\n simp_rw [abs_neg, abs_one, inv_one, one_smul, ofReal_neg, ofReal_one, div_neg, div_one, neg_neg,\n rpow_neg_one, \u2190 one_div] at step1\n -- introduce a power of `t` to match the hypothesis `P.h_feq`\n have step2 := mellin_cpow_smul (fun t \u21a6 P.g (1 / t)) (P.k - s) (-P.k)\n rw [\u2190 sub_eq_add_neg, sub_right_comm, sub_self, zero_sub, step1] at step2\n -- put in the constant `P.\u03b5`\n have step3 := mellin_const_smul (fun t \u21a6 (t : \u2102) ^ (-P.k : \u2102) \u2022 P.g (1 / t)) (P.k - s) P.\u03b5\n rw [step2] at step3\n rw [\u2190 step3]\n -- now the integrand matches `P.h_feq'` on `Ioi 0`, so we can apply `setIntegral_congr_fun`\n refine setIntegral_congr_fun measurableSet_Ioi (fun t ht \u21a6 ?_)\n simp_rw [P.h_feq' t ht, \u2190 mul_smul]\n -- some simple `cpow` arithmetic to finish\n rw [cpow_neg, ofReal_cpow (le_of_lt ht)]\n have : (t : \u2102) ^ (P.k : \u2102) \u2260 0 := by simpa [\u2190 ofReal_cpow ht.le] using (rpow_pos_of_pos ht _).ne'\n field_simp [P.h\u03b5]\n\nend StrongFEPair\n\nnamespace WeakFEPair\n\nvariable (P : WeakFEPair E)\n\n/-!\n## Auxiliary results II: building a strong FE-pair from a weak FE-pair\n-/\n\n/-- Piecewise modified version of `f` with optimal asymptotics. We deliberately choose intervals\nwhich don't quite join up, so the function is `0` at `x = 1`, in order to maintain symmetry;\nthere is no \"good\" choice of value at `1`. -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeries (L164-L167)\ndef LSeries (f : \u2115 \u2192 \u2102) (s : \u2102) : \u2102 :=\n\u2211' n, term f s n\n\n/-- Congruence for `LSeries` with the evaluation variable `s`. -/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.LSeries_convolution (L155-L162)\nlemma LSeries_convolution {f g : \u2115 \u2192 \u2102} {s : \u2102}\n (hf : abscissaOfAbsConv f < s.re) (hg : abscissaOfAbsConv g < s.re) :\n LSeries (f \u235f g) s = LSeries f s * LSeries g s :=\nLSeries_convolution' (LSeriesSummable_of_abscissaOfAbsConv_lt_re hf)\n (LSeriesSummable_of_abscissaOfAbsConv_lt_re hg)\n\n/-- The L-series of the convolution product `f \u235f g` of two sequences `f` and `g`\nis summable when both L-series are summable. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeriesHasSum_iff (L227-L230)\nlemma LSeriesHasSum_iff {f : \u2115 \u2192 \u2102} {s a : \u2102} :\n LSeriesHasSum f s a \u2194 LSeriesSummable f s \u2227 LSeries f s = a :=\n\u27e8fun H \u21a6 \u27e8H.LSeriesSummable, H.LSeries_eq\u27e9, fun \u27e8H\u2081, H\u2082\u27e9 \u21a6 H\u2082 \u25b8 H\u2081.LSeriesHasSum\u27e9\n```\n\n-- snippet 34\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.norm_term_eq (L114-L119)\nlemma norm_term_eq (f : \u2115 \u2192 \u2102) (s : \u2102) (n : \u2115) :\n \u2016term f s n\u2016 = if n = 0 then 0 else \u2016f n\u2016 / n ^ s.re := by\nrcases eq_or_ne n 0 with rfl | hn\n \u00b7 simp\n \u00b7 simp [hn, norm_natCast_cpow_of_pos <| Nat.pos_of_ne_zero hn]\n```\n\n-- snippet 35\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.symm_\u039b\u2080_eq (L404-L408)\nlemma symm_\u039b\u2080_eq (s : \u2102) :\n P.symm.\u039b\u2080 s = P.symm.\u039b s + (1 / s) \u2022 P.g\u2080 + (P.\u03b5\u207b\u00b9 / (P.k - s)) \u2022 P.f\u2080 := by\nrw [P.symm.\u039b\u2080_eq]\n rfl\n```\n\n-- snippet 36\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.\u039b_residue_k (L449-L464)\ntheorem \u039b_residue_k :\n Tendsto (fun s : \u2102 \u21a6 (s - P.k) \u2022 P.\u039b s) (\ud835\udcdd[\u2260] P.k) (\ud835\udcdd (P.\u03b5 \u2022 P.g\u2080)) := by\nsimp_rw [\u039b, smul_sub, (by simp : \ud835\udcdd (P.\u03b5 \u2022 P.g\u2080) = \ud835\udcdd (0 - 0 - -P.\u03b5 \u2022 P.g\u2080))]\n refine ((Tendsto.sub ?_ ?_).mono_left nhdsWithin_le_nhds).sub ?_\n \u00b7 rw [(by rw [sub_self, zero_smul] : \ud835\udcdd 0 = \ud835\udcdd ((P.k - P.k : \u2102) \u2022 P.\u039b\u2080 P.k))]\n apply ((continuous_sub_right _).smul P.differentiable_\u039b\u2080.continuous).tendsto\n \u00b7 rw [(by rw [sub_self, zero_smul] : \ud835\udcdd 0 = \ud835\udcdd ((P.k - P.k : \u2102) \u2022 (1 / P.k : \u2102) \u2022 P.f\u2080))]\n refine (continuous_sub_right _).continuousAt.smul (ContinuousAt.smul ?_ continuousAt_const)\n have := ofReal_ne_zero.mpr P.hk.ne'\n fun_prop (discharger := assumption)\n \u00b7 refine (tendsto_const_nhds.mono_left nhdsWithin_le_nhds).congr' ?_\n refine eventually_nhdsWithin_of_forall (fun s (hs : s \u2260 P.k) \u21a6 ?_)\n match_scalars\n field [sub_ne_zero.mpr hs.symm]\n\n/-- The residue of `\u039b` at `s = 0` is equal to `-f\u2080`. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.toArithmeticFunction (L40-L43)\ndef toArithmeticFunction {R : Type*} [Zero R] (f : \u2115 \u2192 R) : ArithmeticFunction R where\n toFun n := if n = 0 then 0 else f n\nmap_zero' := rfl\n```\n\n-- snippet 38\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeriesSummable_congr (L176-L182)\nlemma LSeriesSummable_congr {f g : \u2115 \u2192 \u2102} (s : \u2102) (h : \u2200 {n}, n \u2260 0 \u2192 f n = g n) :\n LSeriesSummable f s \u2194 LSeriesSummable g s :=\nsummable_congr <| term_congr h s\n\nopen Filter in\n/-- If `f` and `g` agree on large `n : \u2115` and the `LSeries` of `f` converges at `s`,\nthen so does that of `g`. -/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.toArithmeticFunction_congr (L44-L51)\nlemma toArithmeticFunction_congr {R : Type*} [Zero R] {f f' : \u2115 \u2192 R}\n (h : \u2200 {n}, n \u2260 0 \u2192 f n = f' n) :\n toArithmeticFunction f = toArithmeticFunction f' := by\next\n simp_all [toArithmeticFunction]\n\n/-- If we consider an arithmetic function just as a function and turn it back into an\narithmetic function, it is the same as before. -/\n```\n\n-- snippet 40\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.ArithmeticFunction (L53-L64)\nlemma ArithmeticFunction.toArithmeticFunction_eq_self {R : Type*} [Zero R]\n (f : ArithmeticFunction R) :\n toArithmeticFunction f = f := by\next n\n simp +contextual [toArithmeticFunction]\n\n/-- Dirichlet convolution of two sequences.\n\nWe define this in terms of the already existing definition for arithmetic functions. -/\nnoncomputable def LSeries.convolution {R : Type*} [Semiring R] (f g : \u2115 \u2192 R) : \u2115 \u2192 R :=\n \u21d1(toArithmeticFunction f * toArithmeticFunction g)\n```\n\n-- snippet 41\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.\u039b\u2080 (L395-L397)\ndef \u039b\u2080 : \u2102 \u2192 E := mellin P.f_modif\n/-- A meromorphic function which agrees with the Mellin transform of `f - f\u2080` where defined -/\n```\n\n-- snippet 42\n```lean\n-- Mathlib.NumberTheory.LSeries.Deriv.LSeries_deriv (L86-L91)\nlemma LSeries_deriv {f : \u2115 \u2192 \u2102} {s : \u2102} (h : abscissaOfAbsConv f < s.re) :\n deriv (LSeries f) s = -LSeries (logMul f) s :=\n(LSeries_hasDerivAt h).deriv\n\n/-- The derivative of the L-series of `f` agrees with the negative of the L-series of\n`log * f` on the right half-plane of absolute convergence. -/\n```\n\n-- snippet 43\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.norm_term_le_of_re_le_re (L127-L137)\nlemma norm_term_le_of_re_le_re (f : \u2115 \u2192 \u2102) {s s' : \u2102} (h : s.re \u2264 s'.re) (n : \u2115) :\n \u2016term f s' n\u2016 \u2264 \u2016term f s n\u2016 := by\nsimp only [norm_term_eq]\n split\n \u00b7 next => rfl\n \u00b7 next hn => gcongr; exact Nat.one_le_cast.mpr <| Nat.one_le_iff_ne_zero.mpr hn\n\nsection positivity\n\nopen scoped ComplexOrder\n```\n\n-- snippet 44\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.hf_zero' (L168-L187)\nlemma hf_zero' (P : WeakFEPair E) :\n (fun x : \u211d \u21a6 P.f x - P.f\u2080) =O[\ud835\udcdd[>] 0] (\u00b7 ^ (-P.k)) := by\nsimp_rw [\u2190 fun x \u21a6 sub_add_sub_cancel (P.f x) ((P.\u03b5 * \u2191(x ^ (-P.k))) \u2022 P.g\u2080) P.f\u2080]\n refine (P.hf_zero _).add (IsBigO.sub ?_ ?_)\n \u00b7 rw [\u2190 isBigO_norm_norm]\n simp_rw [mul_smul, norm_smul, mul_comm _ \u2016P.g\u2080\u2016, \u2190 mul_assoc, norm_real]\n apply (isBigO_refl _ _).const_mul_left\n \u00b7 refine IsBigO.of_bound \u2016P.f\u2080\u2016 (eventually_nhdsWithin_iff.mpr ?_)\n filter_upwards [eventually_le_nhds zero_lt_one] with x hx' (hx : 0 < x)\n apply le_mul_of_one_le_right (norm_nonneg _)\n rw [norm_of_nonneg (rpow_pos_of_pos hx _).le, rpow_neg hx.le]\n exact (one_le_inv\u2080 (rpow_pos_of_pos hx _)).2 (rpow_le_one hx.le hx' P.hk.le)\n\nend WeakFEPair\n\nnamespace StrongFEPair\n\nvariable (P : StrongFEPair E)\n\n/-- As `x \u2192 \u221e`, `f x` decays faster than any power of `x`. -/\n```\n\n-- snippet 45\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.f_modif (L258-L262)\ndef f_modif : \u211d \u2192 E :=\n(Ioi 1).indicator (fun x \u21a6 P.f x - P.f\u2080) +\n (Ioo 0 1).indicator (fun x \u21a6 P.f x - (P.\u03b5 * \u2191(x ^ (-P.k))) \u2022 P.g\u2080)\n\n/-- Piecewise modified version of `g` with optimal asymptotics. -/\n```\n\n-- snippet 46\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.LSeriesSummable_mul (L203-L208)\nlemma LSeriesSummable_mul {f g : ArithmeticFunction \u2102} {s : \u2102} (hf : LSeriesSummable \u2197f s)\n (hg : LSeriesSummable \u2197g s) :\n LSeriesSummable \u2197(f * g) s :=\ncoe_mul f g \u25b8 hf.convolution hg\n\nend ArithmeticFunction\n```\n\n-- snippet 47\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.term (L74-L76)\ndef term (f : \u2115 \u2192 \u2102) (s : \u2102) (n : \u2115) : \u2102 :=\nif n = 0 then 0 else f n / n ^ s\n```\n\n-- snippet 48\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.term_def\u2080 (L82-L86)\nlemma term_def\u2080 {f : \u2115 \u2192 \u2102} (hf : f 0 = 0) (s : \u2102) (n : \u2115) :\n LSeries.term f s n = f n * (n : \u2102) ^ (-s) := by\nrw [LSeries.term]\n split_ifs with h <;> simp [h, hf, cpow_neg, div_eq_inv_mul, mul_comm]\n```\n\n-- snippet 49\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeriesSummable_of_le_const_mul_rpow (L341-L366)\nlemma LSeriesSummable_of_le_const_mul_rpow {f : \u2115 \u2192 \u2102} {x : \u211d} {s : \u2102} (hs : x < s.re)\n (h : \u2203 C, \u2200 n \u2260 0, \u2016f n\u2016 \u2264 C * n ^ (x - 1)) :\n LSeriesSummable f s := by\nobtain \u27e8C, hC\u27e9 := h\n have hC\u2080 : 0 \u2264 C := (norm_nonneg <| f 1).trans <| by simpa using hC 1 one_ne_zero\n have hsum : Summable fun n : \u2115 \u21a6 \u2016(C : \u2102) / n ^ (s + (1 - x))\u2016 := by\n simp_rw [div_eq_mul_inv, norm_mul, \u2190 cpow_neg]\n have hsx : -s.re + x - 1 < -1 := by linarith only [hs]\n refine Summable.mul_left _ <|\n Summable.of_norm_bounded_eventually_nat (g := fun n \u21a6 (n : \u211d) ^ (-s.re + x - 1)) ?_ ?_\n \u00b7 simpa\n \u00b7 simp only [norm_norm, Filter.eventually_atTop]\n refine \u27e81, fun n hn \u21a6 le_of_eq ?_\u27e9\n simp only [norm_natCast_cpow_of_pos hn, add_re, sub_re, neg_re, ofReal_re, one_re]\n ring_nf\n refine Summable.of_norm <| hsum.of_nonneg_of_le (fun _ \u21a6 norm_nonneg _) (fun n \u21a6 ?_)\n rcases n.eq_zero_or_pos with rfl | hn\n \u00b7 simpa only [term_zero, norm_zero] using norm_nonneg _\n have hn' : 0 < (n : \u211d) ^ s.re := Real.rpow_pos_of_pos (Nat.cast_pos.mpr hn) _\n simp_rw [term_of_ne_zero hn.ne', norm_div, norm_natCast_cpow_of_pos hn, div_le_iff\u2080 hn',\n norm_real, Real.norm_of_nonneg hC\u2080, div_eq_mul_inv, mul_assoc,\n \u2190 Real.rpow_neg <| Nat.cast_nonneg _, \u2190 Real.rpow_add <| Nat.cast_pos.mpr hn]\n simpa using hC n <| Nat.pos_iff_ne_zero.mp hn\n\nopen Filter Finset Real Nat in\n/-- If `f = O(n^(x-1))` and `re s > x`, then the `LSeries` of `f` is summable at `s`. -/\n```\n\n-- snippet 50\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeries_congr (L168-L172)\nlemma LSeries_congr {f g : \u2115 \u2192 \u2102} (h : \u2200 {n}, n \u2260 0 \u2192 f n = g n) (s : \u2102) :\n LSeries f s = LSeries g s :=\ntsum_congr <| term_congr h s\n\n/-- `LSeriesSummable f s` indicates that the L-series of `f` converges absolutely at `s`. -/\n```\n\n-- snippet 51\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.differentiable_\u039b (L213-L221)\ntheorem differentiable_\u039b : Differentiable \u2102 P.\u039b := fun s \u21a6\nlet \u27e8_, ht\u27e9 := exists_gt s.re\n let \u27e8_, hu\u27e9 := exists_lt s.re\n mellin_differentiableAt_of_isBigO_rpow P.hf_int (P.hf_top' _) ht (P.hf_zero' _) hu\n\n/-- Main theorem about strong FE pairs: if `(f, g)` are a strong FE pair, then the Mellin\ntransforms of `f` and `g` are related by `s \u21a6 k - s`.\n\nThis is proved by making a substitution `t \u21a6 t\u207b\u00b9` in the Mellin transform integral. -/\n```\n\n-- snippet 52\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.\u039b_residue_zero (L465-L478)\ntheorem \u039b_residue_zero :\n Tendsto (fun s : \u2102 \u21a6 s \u2022 P.\u039b s) (\ud835\udcdd[\u2260] 0) (\ud835\udcdd (-P.f\u2080)) := by\nsimp_rw [\u039b, smul_sub, (by simp : \ud835\udcdd (-P.f\u2080) = \ud835\udcdd (((0 : \u2102) \u2022 P.\u039b\u2080 0) - P.f\u2080 - 0))]\n refine ((Tendsto.mono_left ?_ nhdsWithin_le_nhds).sub ?_).sub ?_\n \u00b7 exact (continuous_id.smul P.differentiable_\u039b\u2080.continuous).tendsto _\n \u00b7 refine (tendsto_const_nhds.mono_left nhdsWithin_le_nhds).congr' ?_\n refine eventually_nhdsWithin_of_forall (fun s (hs : s \u2260 0) \u21a6 ?_)\n match_scalars\n field [sub_ne_zero.mpr hs.symm]\n \u00b7 rw [show \ud835\udcdd 0 = \ud835\udcdd ((0 : \u2102) \u2022 (P.\u03b5 / (P.k - 0 : \u2102)) \u2022 P.g\u2080) by rw [zero_smul]]\n exact (continuousAt_id.smul ((continuousAt_const.div ((continuous_sub_left _).continuousAt)\n (by simpa using P.hk.ne')).smul continuousAt_const)).mono_left nhdsWithin_le_nhds\n\nend WeakFEPair\n```\n\n-- snippet 53\n```lean\n-- Mathlib.NumberTheory.LSeries.Deriv.LSeries (L45-L79)\nlemma LSeries.hasDerivAt_term (f : \u2115 \u2192 \u2102) (n : \u2115) (s : \u2102) :\n HasDerivAt (fun z \u21a6 term f z n) (-(term (logMul f) s n)) s := by\nrcases eq_or_ne n 0 with rfl | hn\n \u00b7 simp [hasDerivAt_const]\n simp_rw [term_of_ne_zero hn, \u2190 neg_div, \u2190 neg_mul, mul_comm, mul_div_assoc, div_eq_mul_inv,\n \u2190 cpow_neg]\n exact HasDerivAt.const_mul (f n) (by simpa only [mul_comm, \u2190 mul_neg_one (log n), \u2190 mul_assoc]\n using (hasDerivAt_neg' s).const_cpow (Or.inl <| Nat.cast_ne_zero.mpr hn))\n\n/- This lemma proves two things at once, since their proofs are intertwined; we give separate\nnon-private lemmas below that extract the two statements. -/\nprivate lemma LSeries.LSeriesSummable_logMul_and_hasDerivAt {f : \u2115 \u2192 \u2102} {s : \u2102}\n (h : abscissaOfAbsConv f < s.re) :\n LSeriesSummable (logMul f) s \u2227 HasDerivAt (LSeries f) (-LSeries (logMul f) s) s := by\n -- The L-series of `f` is summable at some real `x < re s`.\n obtain \u27e8x, hxs, hf\u27e9 := LSeriesSummable_lt_re_of_abscissaOfAbsConv_lt_re h\n obtain \u27e8y, hxy, hys\u27e9 := exists_between hxs\n -- We work in the right half-plane `y < re z`, for some `y` such that `x < y < re s`, on which\n -- we have a uniform summable bound on `\u2016term f z \u00b7\u2016`.\n let S : Set \u2102 := {z | y < z.re}\n have h\u2080 : Summable (fun n \u21a6 \u2016term f x n\u2016) := summable_norm_iff.mpr hf\n have h\u2081 (n) : DifferentiableOn \u2102 (term f \u00b7 n) S :=\n fun z _ \u21a6 (hasDerivAt_term f n _).differentiableAt.differentiableWithinAt\n have h\u2082 : IsOpen S := isOpen_lt continuous_const continuous_re\n have h\u2083 (n z) (hz : z \u2208 S) : \u2016term f z n\u2016 \u2264 \u2016term f x n\u2016 :=\n norm_term_le_of_re_le_re f (by simpa using (hxy.trans hz).le) n\n have H := hasSum_deriv_of_summable_norm h\u2080 h\u2081 h\u2082 h\u2083 hys\n simp_rw [(hasDerivAt_term f _ _).deriv] at H\n refine \u27e8summable_neg_iff.mp H.summable, ?_\u27e9\n simpa [\u2190 H.tsum_eq, tsum_neg] using ((differentiableOn_tsum_of_summable_norm\n h\u2080 h\u2081 h\u2082 h\u2083).differentiableAt <| h\u2082.mem_nhds hys).hasDerivAt\n\n/-- If `re s` is greater than the abscissa of absolute convergence of `f`, then the L-series\nof `f` is differentiable with derivative the negative of the L-series of the point-wise\nproduct of `log` with `f`. -/\n```\n\n-- snippet 54\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.term_delta (L282-L287)\nlemma term_delta (s : \u2102) (n : \u2115) : term \u03b4 s n = if n = 1 then 1 else 0 := by\nrcases eq_or_ne n 0 with rfl | hn\n \u00b7 simp\n \u00b7 rcases eq_or_ne n 1 with hn' | hn' <;>\n simp [hn, hn', delta]\n```\n\n-- snippet 55\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.functional_equation\u2080 (L439-L442)\ntheorem functional_equation\u2080 (s : \u2102) : P.\u039b\u2080 (P.k - s) = P.\u03b5 \u2022 P.symm.\u039b\u2080 s :=\nP.toStrongFEPair.functional_equation s\n\n/-- Functional equation formulated for `\u039b`. -/\n```\n\n-- snippet 56\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.term_nonneg (L138-L142)\nlemma term_nonneg {a : \u2115 \u2192 \u2102} {n : \u2115} (h : 0 \u2264 a n) (x : \u211d) : 0 \u2264 term a x n := by\nrw [term_def]\n split_ifs with hn\n exacts [le_rfl, mul_nonneg h (inv_natCast_cpow_ofReal_pos hn x).le]\n```\n\n-- snippet 57\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.\u039b_eq (L208-L209)\nlemma \u039b_eq : P.\u039b = mellin P.f := rfl\n```\n\n-- snippet 58\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.f_modif_aux1 (L334-L352)\nlemma f_modif_aux1 : EqOn (fun x \u21a6 P.f_modif x - P.f x + P.f\u2080)\n ((Ioo 0 1).indicator (fun x : \u211d \u21a6 P.f\u2080 - (P.\u03b5 * \u2191(x ^ (-P.k))) \u2022 P.g\u2080)\n + ({1} : Set \u211d).indicator (fun _ \u21a6 P.f\u2080 - P.f 1)) (Ioi 0) := by\nintro x (hx : 0 < x)\n simp_rw [f_modif, Pi.add_apply]\n rcases lt_trichotomy x 1 with hx' | rfl | hx'\n \u00b7 simp_rw [indicator_of_notMem (notMem_Ioi.mpr hx'.le),\n indicator_of_mem (mem_Ioo.mpr \u27e8hx, hx'\u27e9),\n indicator_of_notMem (mem_singleton_iff.not.mpr hx'.ne)]\n abel\n \u00b7 simp [add_comm, sub_eq_add_neg]\n \u00b7 simp_rw [indicator_of_mem (mem_Ioi.mpr hx'),\n indicator_of_notMem (notMem_Ioo_of_ge hx'.le),\n indicator_of_notMem (mem_singleton_iff.not.mpr hx'.ne')]\n abel\n\nset_option backward.isDefEq.respectTransparency false in\n/-- Compute the Mellin transform of the modifying term used to kill off the constants at\n`0` and `\u221e`. -/\n```\n\n-- snippet 59\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeriesSummable_iff_of_re_eq_re (L240-L244)\ntheorem LSeriesSummable_iff_of_re_eq_re {f : \u2115 \u2192 \u2102} {s s' : \u2102} (h : s.re = s'.re) :\n LSeriesSummable f s \u2194 LSeriesSummable f s' :=\n\u27e8fun H \u21a6 H.of_re_le_re h.le, fun H \u21a6 H.of_re_le_re h.symm.le\u27e9\n\n/-- The indicator function of `{1} \u2286 \u2115` with values in `\u2102`. -/\n```\n\n-- snippet 60\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.g_modif (L263-L266)\ndef g_modif : \u211d \u2192 E :=\n(Ioi 1).indicator (fun x \u21a6 P.g x - P.g\u2080) +\n (Ioo 0 1).indicator (fun x \u21a6 P.g x - (P.\u03b5\u207b\u00b9 * \u2191(x ^ (-P.k))) \u2022 P.f\u2080)\n```\n\n-- snippet 61\n```lean\n-- Mathlib.NumberTheory.LSeries.Deriv.LSeriesSummable_logMul_of_lt_re (L98-L103)\nlemma LSeriesSummable_logMul_of_lt_re {f : \u2115 \u2192 \u2102} {s : \u2102} (h : abscissaOfAbsConv f < s.re) :\n LSeriesSummable (logMul f) s :=\n(LSeriesSummable_logMul_and_hasDerivAt h).1\n\n/-- The abscissa of absolute convergence of the point-wise product of `log` and `f`\nis the same as that of `f`. -/\n```\n\n-- snippet 62\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.\u039b\u2080_eq (L400-L403)\nlemma \u039b\u2080_eq (s : \u2102) : P.\u039b\u2080 s = P.\u039b s + (1 / s) \u2022 P.f\u2080 + (P.\u03b5 / (P.k - s)) \u2022 P.g\u2080 := by\nunfold \u039b \u039b\u2080\n abel\n```\n\n-- snippet 63\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.term_of_ne_zero (L92-L99)\nlemma term_of_ne_zero {n : \u2115} (hn : n \u2260 0) (f : \u2115 \u2192 \u2102) (s : \u2102) :\n term f s n = f n / n ^ s :=\nif_neg hn\n\n/--\nIf `s \u2260 0`, then the `if .. then .. else` construction in `LSeries.term` isn't needed, since\n`0 ^ s = 0`.\n-/\n```\n\n-- snippet 64\n```lean\n-- Mathlib.NumberTheory.LSeries.Deriv.LSeries_iteratedDeriv (L133-L151)\nlemma LSeries_iteratedDeriv {f : \u2115 \u2192 \u2102} (m : \u2115) {s : \u2102} (h : abscissaOfAbsConv f < s.re) :\n iteratedDeriv m (LSeries f) s = (-1) ^ m * LSeries (logMul^[m] f) s := by\ninduction m generalizing s with\n | zero => simp\n | succ m ih =>\n have ih' : {s | abscissaOfAbsConv f < re s}.EqOn (iteratedDeriv m (LSeries f))\n ((-1) ^ m * LSeries (logMul^[m] f)) := fun _ hs \u21a6 ih hs\n have := derivWithin_congr ih' (ih h)\n simp_rw [derivWithin_of_isOpen (isOpen_re_gt_EReal _) h] at this\n rw [iteratedDeriv_succ, this]\n simp [Pi.mul_def, pow_succ, Function.iterate_succ',\n LSeries_deriv <| absicssaOfAbsConv_logPowMul.symm \u25b8 h, -Function.iterate_succ]\n\n/-!\n### The L-series is holomorphic\n-/\n\n/-- The L-series of `f` is complex differentiable in its open half-plane of absolute\nconvergence. -/\n```\n\n-- snippet 65\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeries_zero (L270-L281)\nlemma LSeries_zero : LSeries 0 = 0 := by\next\n simp [LSeries, LSeries.term]\n\nsection delta\n\nopen scoped LSeries.notation\n\nnamespace LSeries\n\nopen Nat Complex\n```\n\n-- snippet 66\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.mul_delta (L293-L295)\nlemma mul_delta {f : \u2115 \u2192 \u2102} (h : f 1 = 1) : f * \u03b4 = \u03b4 := by\nrw [mul_delta_eq_smul_delta, h, one_smul]\n```\n\n-- snippet 67\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.norm_term_le (L120-L126)\nlemma norm_term_le {f g : \u2115 \u2192 \u2102} (s : \u2102) {n : \u2115} (h : \u2016f n\u2016 \u2264 \u2016g n\u2016) :\n \u2016term f s n\u2016 \u2264 \u2016term g s n\u2016 := by\nsimp only [norm_term_eq]\n split\n \u00b7 rfl\n \u00b7 gcongr\n```\n\n-- snippet 68\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeriesSummable_congr' (L198-L201)\nlemma LSeriesSummable_congr' {f g : \u2115 \u2192 \u2102} (s : \u2102) (h : f =\u1da0[atTop] g) :\n LSeriesSummable f s \u2194 LSeriesSummable g s :=\n\u27e8fun H \u21a6 H.congr' s h, fun H \u21a6 H.congr' s h.symm\u27e9\n```\n\n-- snippet 69\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.convolution_def (L81-L86)\nlemma convolution_def {R : Type*} [Semiring R] (f g : \u2115 \u2192 R) :\n f \u235f g = fun n \u21a6 \u2211 p \u2208 n.divisorsAntidiagonal, f p.1 * g p.2 := by\next n\n simpa [convolution, toArithmeticFunction] using\n Finset.sum_congr rfl fun p hp \u21a6 by simp [ne_zero_of_mem_divisorsAntidiagonal hp]\n```\n\n-- snippet 70\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.delta_mul_eq_smul_delta (L296-L298)\nlemma delta_mul_eq_smul_delta {f : \u2115 \u2192 \u2102} : \u03b4 * f = f 1 \u2022 \u03b4 :=\nmul_comm \u03b4 f \u25b8 mul_delta_eq_smul_delta\n```\n\n-- snippet 71\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.convolution_map_zero (L88-L97)\nlemma convolution_map_zero {R : Type*} [Semiring R] (f g : \u2115 \u2192 R) : (f \u235f g) 0 = 0 := by\nsimp [convolution_def]\n\n\n/-!\n### Multiplication of L-series\n-/\n\n/-- We give an expression of the `LSeries.term` of the convolution of two functions\nin terms of a sum over `Nat.divisorsAntidiagonal`. -/\n```\n\n-- snippet 72\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.pow_mul_term_eq (L110-L113)\nlemma pow_mul_term_eq (f : \u2115 \u2192 \u2102) (s : \u2102) (n : \u2115) :\n (n + 1) ^ s * term f s (n + 1) = f (n + 1) := by\nsimp [term, natCast_add_one_cpow_ne_zero n _, mul_div_assoc']\n```\n\n-- snippet 73\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeriesSummable_zero (L207-L211)\ntheorem LSeriesSummable_zero {s : \u2102} : LSeriesSummable 0 s := by\nsimp [LSeriesSummable, funext (term_def 0 s), summable_zero]\n\n/-- This states that the L-series of the sequence `f` converges absolutely at `s` and that\nthe value there is `a`. -/\n```\n\n-- snippet 74\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.LSeries_mul (L196-L202)\nlemma LSeries_mul {f g : ArithmeticFunction \u2102} {s : \u2102}\n (hf : abscissaOfAbsConv \u2197f < s.re) (hg : abscissaOfAbsConv \u2197g < s.re) :\n LSeries \u2197(f * g) s = LSeries \u2197f s * LSeries \u2197g s :=\ncoe_mul f g \u25b8 LSeries_convolution hf hg\n\n/-- The L-series of the (convolution) product of two `\u2102`-valued arithmetic functions `f` and `g`\nis summable when both L-series are summable. -/\n```\n\n-- snippet 75\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.hf_top' (L188-L191)\nlemma hf_top' (r : \u211d) : P.f =O[atTop] (\u00b7 ^ r) := by\nsimpa [P.hf\u2080] using P.hf_top r\n\n/-- As `x \u2192 0`, `f x` decays faster than any power of `x`. -/\n```\n\n-- snippet 76\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.symm_\u039b_eq (L210-L212)\nlemma symm_\u039b_eq : P.symm.\u039b = mellin P.g := rfl\n/-- If `(f, g)` are a strong FE pair, then the Mellin transform of `f` is entire. -/\n```\n\n-- snippet 77\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.\u039b (L200-L202)\ndef \u039b : \u2102 \u2192 E := mellin P.f\n/-- The Mellin transform of `f` is well-defined and equal to `P.\u039b s`, for all `s`. -/\n```\n\n-- snippet 78\n```lean\n-- Mathlib.NumberTheory.LSeries.Deriv.LSeries_deriv_eqOn (L92-L97)\nlemma LSeries_deriv_eqOn {f : \u2115 \u2192 \u2102} :\n {s | abscissaOfAbsConv f < s.re}.EqOn (deriv (LSeries f)) (-LSeries (logMul f)) :=\nderiv_eqOn (isOpen_re_gt_EReal _) fun _ hs \u21a6 (LSeries_hasDerivAt hs).hasDerivWithinAt\n\n/-- If the L-series of `f` is summable at `s` and `re s < re s'`, then the L-series of the\npoint-wise product of `log` with `f` is summable at `s'`. -/\n```\n\n-- snippet 79\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeriesSummable_of_bounded_of_one_lt_re (L388-L393)\ntheorem LSeriesSummable_of_bounded_of_one_lt_re {f : \u2115 \u2192 \u2102} {m : \u211d}\n (h : \u2200 n \u2260 0, \u2016f n\u2016 \u2264 m) {s : \u2102} (hs : 1 < s.re) :\n LSeriesSummable f s :=\nLSeriesSummable_of_le_const_mul_rpow hs \u27e8m, fun n hn \u21a6 by simp [h n hn]\u27e9\n\n/-- If `f` is bounded, then its `LSeries` is summable at `s : \u211d` when `s > 1`. -/\n```\n\n-- snippet 80\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.hf_modif_FE (L286-L306)\nlemma hf_modif_FE (x : \u211d) (hx : 0 < x) :\n P.f_modif (1 / x) = (P.\u03b5 * \u2191(x ^ P.k)) \u2022 P.g_modif x := by\nrcases lt_trichotomy 1 x with hx' | rfl | hx'\n \u00b7 have : 1 / x < 1 := by rwa [one_div_lt hx one_pos, div_one]\n rw [f_modif, Pi.add_apply, indicator_of_notMem (notMem_Ioi.mpr this.le),\n zero_add, indicator_of_mem (mem_Ioo.mpr \u27e8div_pos one_pos hx, this\u27e9), g_modif, Pi.add_apply,\n indicator_of_mem (mem_Ioi.mpr hx'), indicator_of_notMem\n (notMem_Ioo_of_ge hx'.le), add_zero, P.h_feq _ hx, smul_sub]\n simp_rw [rpow_neg (one_div_pos.mpr hx).le, one_div, inv_rpow hx.le, inv_inv]\n \u00b7 simp [f_modif, g_modif]\n \u00b7 have : 1 < 1 / x := by rwa [lt_one_div one_pos hx, div_one]\n rw [f_modif, Pi.add_apply, indicator_of_mem (mem_Ioi.mpr this),\n indicator_of_notMem (notMem_Ioo_of_ge this.le), g_modif, Pi.add_apply,\n indicator_of_notMem (notMem_Ioi.mpr hx'.le),\n indicator_of_mem (mem_Ioo.mpr \u27e8hx, hx'\u27e9), P.h_feq _ hx]\n simp_rw [rpow_neg hx.le]\n match_scalars <;> field [(rpow_pos_of_pos hx P.k).ne', P.h\u03b5]\n\nset_option linter.style.whitespace false in -- manual alignment is not recognised\n/-- Given a weak FE-pair `(f, g)`, modify it into a strong FE-pair by subtracting suitable\ncorrection terms from `f` and `g`. -/\n```\n\n-- snippet 81\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeriesHasSum (L212-L214)\ndef LSeriesHasSum (f : \u2115 \u2192 \u2102) (s a : \u2102) : Prop :=\nHasSum (term f s) a\n```\n\n-- snippet 82\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.term_def (L77-L81)\nlemma term_def (f : \u2115 \u2192 \u2102) (s : \u2102) (n : \u2115) :\n term f s n = if n = 0 then 0 else f n / n ^ s :=\nrfl\n\n/-- An alternate spelling of `term_def` for the case `f 0 = 0`. -/\n```\n\n-- snippet 83\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.term_convolution' (L114-L138)\nlemma term_convolution' (f g : \u2115 \u2192 \u2102) (s : \u2102) :\n term (f \u235f g) s = fun n \u21a6\n \u2211' (b : (fun p : \u2115 \u00d7 \u2115 \u21a6 p.1 * p.2) \u207b\u00b9' {n}), term f s b.val.1 * term g s b.val.2 := by\next n\n rcases eq_or_ne n 0 with rfl | hn\n \u00b7 -- show that both sides vanish when `n = 0`; this is the hardest part of the proof!\n refine (term_zero ..).trans ?_\n -- the right-hand sum is over the union below, but in each term, one factor is always zero\n have hS : (fun p \u21a6 p.1 * p.2) \u207b\u00b9' {0} = {0} \u00d7\u02e2 univ \u222a univ \u00d7\u02e2 {0} := by\n ext\n simp\n have : \u2200 p : (fun p : \u2115 \u00d7 \u2115 \u21a6 p.1 * p.2) \u207b\u00b9' {0}, term f s p.val.1 * term g s p.val.2 = 0 := by\n rintro \u27e8\u27e8_, _\u27e9, hp\u27e9\n rcases hS \u25b8 hp with \u27e8rfl, -\u27e9 | \u27e8-, rfl\u27e9 <;> simp\n simp [this]\n -- now `n \u2260 0`\n rw [show (fun p : \u2115 \u00d7 \u2115 \u21a6 p.1 * p.2) \u207b\u00b9' {n} = n.divisorsAntidiagonal by ext; simp [hn],\n Finset.tsum_subtype' n.divisorsAntidiagonal fun p \u21a6 term f s p.1 * term g s p.2,\n term_convolution f g s n]\n\nend LSeries\n\nopen Set in\n/-- The L-series of the convolution product `f \u235f g` of two sequences `f` and `g`\nequals the product of their L-series, assuming both L-series converge. -/\n```\n\n-- snippet 84\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.mul_delta_eq_smul_delta (L288-L292)\nlemma mul_delta_eq_smul_delta {f : \u2115 \u2192 \u2102} : f * \u03b4 = f 1 \u2022 \u03b4 := by\next n\n by_cases hn : n = 1 <;>\n simp [hn, delta]\n```\n\n-- snippet 85\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.LSeries_mul' (L189-L195)\nlemma LSeries_mul' {f g : ArithmeticFunction \u2102} {s : \u2102} (hf : LSeriesSummable \u2197f s)\n (hg : LSeriesSummable \u2197g s) :\n LSeries \u2197(f * g) s = LSeries \u2197f s * LSeries \u2197g s :=\ncoe_mul f g \u25b8 LSeries_convolution' hf hg\n\n/-- The L-series of the (convolution) product of two `\u2102`-valued arithmetic functions `f` and `g`\nequals the product of their L-series in their common half-plane of absolute convergence. -/\n```\n\n-- snippet 86\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.LSeries (L68-L74)\nlemma LSeries.convolution_congr {R : Type*} [Semiring R] {f f' g g' : \u2115 \u2192 R}\n (hf : \u2200 {n}, n \u2260 0 \u2192 f n = f' n) (hg : \u2200 {n}, n \u2260 0 \u2192 g n = g' n) :\n f \u235f g = f' \u235f g' := by\nsimp [convolution, toArithmeticFunction_congr hf, toArithmeticFunction_congr hg]\n\n/-- The product of two arithmetic functions defines the same function as the Dirichlet convolution\nof the functions defined by them. -/\n```\n\n-- snippet 87\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeriesSummable_of_isBigO_rpow (L367-L387)\nlemma LSeriesSummable_of_isBigO_rpow {f : \u2115 \u2192 \u2102} {x : \u211d} {s : \u2102} (hs : x < s.re)\n (h : f =O[atTop] fun n \u21a6 (n : \u211d) ^ (x - 1)) :\n LSeriesSummable f s := by\nobtain \u27e8C, hC\u27e9 := Asymptotics.isBigO_iff.mp h\n obtain \u27e8m, hm\u27e9 := eventually_atTop.mp hC\n let C' := max C (max' (insert 0 (image (fun n : \u2115 \u21a6 \u2016f n\u2016 / (n : \u211d) ^ (x - 1)) (range m)))\n (insert_nonempty 0 _))\n have hC'\u2080 : 0 \u2264 C' := (le_max' _ _ (mem_insert.mpr (Or.inl rfl))).trans <| le_max_right ..\n have hCC' : C \u2264 C' := le_max_left ..\n refine LSeriesSummable_of_le_const_mul_rpow hs \u27e8C', fun n hn\u2080 \u21a6 ?_\u27e9\n rcases le_or_gt m n with hn | hn\n \u00b7 refine (hm n hn).trans ?_\n have hn\u2080 : (0 : \u211d) \u2264 n := cast_nonneg _\n gcongr\n rw [Real.norm_eq_abs, abs_rpow_of_nonneg hn\u2080, abs_of_nonneg hn\u2080]\n \u00b7 have hn' : 0 < n := Nat.pos_of_ne_zero hn\u2080\n refine (div_le_iff\u2080 <| rpow_pos_of_pos (cast_pos.mpr hn') _).mp ?_\n refine (le_max' _ _ <| mem_insert_of_mem ?_).trans <| le_max_right ..\n exact mem_image.mpr \u27e8n, mem_range.mpr hn, rfl\u27e9\n\n/-- If `f` is bounded, then its `LSeries` is summable at `s` when `re s > 1`. -/\n```\n\n-- snippet 88\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.delta_mul (L299-L304)\nlemma delta_mul {f : \u2115 \u2192 \u2102} (h : f 1 = 1) : \u03b4 * f = \u03b4 :=\nmul_comm \u03b4 f \u25b8 mul_delta h\n\nend LSeries\n\n/-- The L-series of `\u03b4` is the constant function `1`. -/\n```\n\n-- snippet 89\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.differentiableAt_\u039b (L411-L423)\ntheorem differentiableAt_\u039b {s : \u2102} (hs : s \u2260 0 \u2228 P.f\u2080 = 0) (hs' : s \u2260 P.k \u2228 P.g\u2080 = 0) :\n DifferentiableAt \u2102 P.\u039b s := by\nrefine ((P.differentiable_\u039b\u2080 s).sub ?_).sub ?_\n \u00b7 rcases hs with hs | hs\n \u00b7 simpa using (differentiableAt_inv hs).smul_const _\n \u00b7 simp [hs]\n \u00b7 rcases hs' with hs' | hs'\n \u00b7 apply DifferentiableAt.smul_const\n apply (differentiableAt_const _).div ((differentiableAt_const _).sub (differentiable_id _))\n simpa [sub_eq_zero, eq_comm]\n \u00b7 simp [hs']\n\n/-- Relation between `\u039b s` and the Mellin transform of `f - f\u2080`, where the latter is defined. -/\n```\n\n-- snippet 90\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.term_zero (L88-L90)\nlemma term_zero (f : \u2115 \u2192 \u2102) (s : \u2102) : term f s 0 = 0 := rfl\n-- We put `hn` first for convenience, so that we can write `rw [LSeries.term_of_ne_zero hn]` etc.\n```\n\n-- snippet 91\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeriesHasSum_congr (L231-L234)\nlemma LSeriesHasSum_congr {f g : \u2115 \u2192 \u2102} (s a : \u2102) (h : \u2200 {n}, n \u2260 0 \u2192 f n = g n) :\n LSeriesHasSum f s a \u2194 LSeriesHasSum g s a := by\nsimp [LSeriesHasSum_iff, LSeriesSummable_congr s h, LSeries_congr h s]\n```\n\n-- snippet 92\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.term_of_ne_zero' (L100-L105)\nlemma term_of_ne_zero' {s : \u2102} (hs : s \u2260 0) (f : \u2115 \u2192 \u2102) (n : \u2115) :\n term f s n = f n / n ^ s := by\nrcases eq_or_ne n 0 with rfl | hn\n \u00b7 rw [term_zero, Nat.cast_zero, zero_cpow hs, div_zero]\n \u00b7 rw [term_of_ne_zero hn]\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.NumberTheory.LSeries.Convergence).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma LSeriesSummable.abscissaOfAbsConv_le {f : \u2115 \u2192 \u2102} {s : \u2102} (h : LSeriesSummable f s) :\n abscissaOfAbsConv f \u2264 s.re\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L33-L39)\nlemma LSeries.abscissaOfAbsConv_congr {f g : \u2115 \u2192 \u2102} (h : \u2200 {n}, n \u2260 0 \u2192 f n = g n) :\n abscissaOfAbsConv f = abscissaOfAbsConv g :=\ncongr_arg sInf <| congr_arg _ <| Set.ext fun x \u21a6 LSeriesSummable_congr x h\n\nopen Filter in\n/-- If `f` and `g` agree on large `n : \u2115`, then their `LSeries` have the same\nabscissa of absolute convergence. -/\n```\n\n-- snippet 2\n```lean\n-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L40-L45)\nlemma LSeries.abscissaOfAbsConv_congr' {f g : \u2115 \u2192 \u2102} (h : f =\u1da0[atTop] g) :\n abscissaOfAbsConv f = abscissaOfAbsConv g :=\ncongr_arg sInf <| congr_arg _ <| Set.ext fun x \u21a6 LSeriesSummable_congr' x h\n\nopen LSeries\n```\n\n-- snippet 3\n```lean\n-- Mathlib.NumberTheory.LSeries.Convergence.LSeriesSummable_of_abscissaOfAbsConv_lt_re (L46-L51)\nlemma LSeriesSummable_of_abscissaOfAbsConv_lt_re {f : \u2115 \u2192 \u2102} {s : \u2102}\n (hs : abscissaOfAbsConv f < s.re) : LSeriesSummable f s := by\nobtain \u27e8y, hy, hys\u27e9 : \u2203 a : \u211d, LSeriesSummable f a \u2227 a < s.re := by\n simpa [abscissaOfAbsConv, sInf_lt_iff] using hs\n exact hy.of_re_le_re <| ofReal_re y \u25b8 hys.le\n```\n\n-- snippet 4\n```lean\n-- Mathlib.NumberTheory.LSeries.Convergence.LSeriesSummable_lt_re_of_abscissaOfAbsConv_lt_re (L52-L57)\nlemma LSeriesSummable_lt_re_of_abscissaOfAbsConv_lt_re {f : \u2115 \u2192 \u2102} {s : \u2102}\n (hs : abscissaOfAbsConv f < s.re) :\n \u2203 x : \u211d, x < s.re \u2227 LSeriesSummable f x := by\nobtain \u27e8x, hx\u2081, hx\u2082\u27e9 := EReal.exists_between_coe_real hs\n exact \u27e8x, by simpa using hx\u2082, LSeriesSummable_of_abscissaOfAbsConv_lt_re hx\u2081\u27e9\n```\n\n-- snippet 5\n```lean\n-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L62-L71)\nlemma LSeries.abscissaOfAbsConv_le_of_forall_lt_LSeriesSummable {f : \u2115 \u2192 \u2102} {x : \u211d}\n (h : \u2200 y : \u211d, x < y \u2192 LSeriesSummable f y) :\n abscissaOfAbsConv f \u2264 x := by\nrefine sInf_le_iff.mpr fun y hy \u21a6 le_of_forall_gt_imp_ge_of_dense fun a \u21a6 ?_\n replace hy : \u2200 (a : \u211d), LSeriesSummable f a \u2192 y \u2264 a := by simpa [mem_lowerBounds] using hy\n cases a with\n | coe a\u2080 => exact_mod_cast fun ha \u21a6 hy a\u2080 (h a\u2080 ha)\n | bot => simp\n | top => simp\n```\n\n-- snippet 6\n```lean\n-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L72-L86)\nlemma LSeries.abscissaOfAbsConv_le_of_forall_lt_LSeriesSummable' {f : \u2115 \u2192 \u2102} {x : EReal}\n (h : \u2200 y : \u211d, x < y \u2192 LSeriesSummable f y) :\n abscissaOfAbsConv f \u2264 x := by\ncases x with\n | coe => exact abscissaOfAbsConv_le_of_forall_lt_LSeriesSummable <| mod_cast h\n | top => exact le_top\n | bot =>\n refine le_of_eq <| sInf_eq_bot.mpr fun y hy \u21a6 ?_\n cases y with\n | bot => simp at hy\n | coe y => exact \u27e8_, \u27e8_, h _ <| EReal.bot_lt_coe _, rfl\u27e9, mod_cast sub_one_lt y\u27e9\n | top => exact \u27e8_, \u27e8_, h _ <| EReal.bot_lt_coe 0, rfl\u27e9, EReal.zero_lt_top\u27e9\n\n/-- If `\u2016f n\u2016` is bounded by a constant times `n^x`, then the abscissa of absolute convergence\nof `f` is bounded by `x + 1`. -/\n```\n\n-- snippet 7\n```lean\n-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L87-L97)\nlemma LSeries.abscissaOfAbsConv_le_of_le_const_mul_rpow {f : \u2115 \u2192 \u2102} {x : \u211d}\n (h : \u2203 C, \u2200 n \u2260 0, \u2016f n\u2016 \u2264 C * n ^ x) : abscissaOfAbsConv f \u2264 x + 1 := by\nrw [show x = x + 1 - 1 by ring] at h\n by_contra! H\n obtain \u27e8y, hy\u2081, hy\u2082\u27e9 := EReal.exists_between_coe_real H\n exact (LSeriesSummable_of_le_const_mul_rpow (s := y) (EReal.coe_lt_coe_iff.mp hy\u2081) h\n |>.abscissaOfAbsConv_le.trans_lt hy\u2082).false\n\nopen Filter in\n/-- If `\u2016f n\u2016` is `O(n^x)`, then the abscissa of absolute convergence\nof `f` is bounded by `x + 1`. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L98-L107)\nlemma LSeries.abscissaOfAbsConv_le_of_isBigO_rpow {f : \u2115 \u2192 \u2102} {x : \u211d}\n (h : f =O[atTop] fun n \u21a6 (n : \u211d) ^ x) :\n abscissaOfAbsConv f \u2264 x + 1 := by\nrw [show x = x + 1 - 1 by ring] at h\n by_contra! H\n obtain \u27e8y, hy\u2081, hy\u2082\u27e9 := EReal.exists_between_coe_real H\n exact (LSeriesSummable_of_isBigO_rpow (s := y) (EReal.coe_lt_coe_iff.mp hy\u2081) h\n |>.abscissaOfAbsConv_le.trans_lt hy\u2082).false\n\n/-- If `f` is bounded, then the abscissa of absolute convergence of `f` is bounded above by `1`. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L108-L113)\nlemma LSeries.abscissaOfAbsConv_le_of_le_const {f : \u2115 \u2192 \u2102} (h : \u2203 C, \u2200 n \u2260 0, \u2016f n\u2016 \u2264 C) :\n abscissaOfAbsConv f \u2264 1 := by\nsimpa using abscissaOfAbsConv_le_of_le_const_mul_rpow (x := 0) (by simpa using h)\n\nopen Filter in\n/-- If `f` is `O(1)`, then the abscissa of absolute convergence of `f` is bounded above by `1`. -/\n```\n\n-- snippet 10\n```lean\n-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L114-L119)\nlemma LSeries.abscissaOfAbsConv_le_one_of_isBigO_one {f : \u2115 \u2192 \u2102} (h : f =O[atTop] fun _ \u21a6 (1 : \u211d)) :\n abscissaOfAbsConv f \u2264 1 := by\nsimpa using abscissaOfAbsConv_le_of_isBigO_rpow (x := 0) (by simpa using h)\n\n/-- If `f` is real-valued and `x` is strictly greater than the abscissa of absolute convergence\nof `f`, then the real series `\u2211' n, f n / n ^ x` converges. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L120-L135)\nlemma LSeries.summable_real_of_abscissaOfAbsConv_lt {f : \u2115 \u2192 \u211d} {x : \u211d}\n (h : abscissaOfAbsConv (f \u00b7) < x) :\n Summable fun n : \u2115 \u21a6 f n / (n : \u211d) ^ x := by\nhave aux : term (f \u00b7) x = fun n \u21a6 \u2191(if n = 0 then 0 else f n / (n : \u211d) ^ x) := by\n ext n\n simp [term_def, apply_ite ((\u2191) : \u211d \u2192 \u2102), ofReal_cpow n.cast_nonneg]\n have := LSeriesSummable_of_abscissaOfAbsConv_lt_re (ofReal_re x \u25b8 h)\n simp only [LSeriesSummable, aux, summable_ofReal] at this\n refine this.congr_cofinite ?_\n filter_upwards [(Set.finite_singleton 0).compl_mem_cofinite] with n hn\n using if_neg (by simpa using hn)\n\n/-- If `F` is a binary operation on `\u2115 \u2192 \u2102` with the property that the `LSeries` of `F f g`\nconverges whenever the `LSeries` of `f` and `g` do, then the abscissa of absolute convergence\nof `F f g` is at most the maximum of the abscissa of absolute convergence of `f`\nand that of `g`. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.NumberTheory.LSeries.Convergence.LSeries (L136-L144)\nlemma LSeries.abscissaOfAbsConv_binop_le {F : (\u2115 \u2192 \u2102) \u2192 (\u2115 \u2192 \u2102) \u2192 (\u2115 \u2192 \u2102)}\n (hF : \u2200 {f g s}, LSeriesSummable f s \u2192 LSeriesSummable g s \u2192 LSeriesSummable (F f g) s)\n (f g : \u2115 \u2192 \u2102) :\n abscissaOfAbsConv (F f g) \u2264 max (abscissaOfAbsConv f) (abscissaOfAbsConv g) := by\nrefine abscissaOfAbsConv_le_of_forall_lt_LSeriesSummable' fun x hx \u21a6 hF ?_ ?_\n \u00b7 exact LSeriesSummable_of_abscissaOfAbsConv_lt_re <|\n (ofReal_re x).symm \u25b8 (le_max_left ..).trans_lt hx\n \u00b7 exact LSeriesSummable_of_abscissaOfAbsConv_lt_re <|\n (ofReal_re x).symm \u25b8 (le_max_right ..).trans_lt hx\n```\n\n-- snippet 13\n```lean\n-- Mathlib.NumberTheory.LSeries.Deriv.LSeries_hasDerivAt (L80-L85)\nlemma LSeries_hasDerivAt {f : \u2115 \u2192 \u2102} {s : \u2102} (h : abscissaOfAbsConv f < s.re) :\n HasDerivAt (LSeries f) (-LSeries (logMul f) s) s :=\n(LSeriesSummable_logMul_and_hasDerivAt h).2\n\n/-- If `re s` is greater than the abscissa of absolute convergence of `f`, then\nthe derivative of this L-series at `s` is the negative of the L-series of `log * f`. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.toStrongFEPair (L307-L333)\ndef toStrongFEPair : StrongFEPair E where\n f := P.f_modif\ng := P.symm.f_modif\n k := P.k\n \u03b5 := P.\u03b5\n f\u2080 := 0\n g\u2080 := 0\n hf_int := P.hf_modif_int\n hg_int := P.symm.hf_modif_int\n h_feq := P.hf_modif_FE\n h\u03b5 := P.h\u03b5\n hk := P.hk\n hf\u2080 := rfl\n hg\u2080 := rfl\n hf_top r := by\n refine (P.hf_top r).congr' ?_ (by rfl)\n filter_upwards [eventually_gt_atTop 1] with x hx\n rw [f_modif, Pi.add_apply, indicator_of_mem (mem_Ioi.mpr hx),\n indicator_of_notMem (notMem_Ioo_of_ge hx.le), add_zero, sub_zero]\n hg_top r := by\n refine (P.hg_top r).congr' ?_ (by rfl)\n filter_upwards [eventually_gt_atTop 1] with x hx\n rw [f_modif, Pi.add_apply, indicator_of_mem (mem_Ioi.mpr hx),\n indicator_of_notMem (notMem_Ioo_of_ge hx.le), add_zero, sub_zero]\n rfl\n\n/- Alternative form for the difference between `f - f\u2080` and its modified term. -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.term_congr (L106-L109)\nlemma term_congr {f g : \u2115 \u2192 \u2102} (h : \u2200 {n}, n \u2260 0 \u2192 f n = g n) (s : \u2102) (n : \u2115) :\n term f s n = term g s n := by\nrcases eq_or_ne n 0 with hn | hn <;> simp [hn, h]\n```\n\n-- snippet 16\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.StrongFEPair (L132-L145)\ndef StrongFEPair.symm (P : StrongFEPair E) : StrongFEPair E where\n toWeakFEPair := P.toWeakFEPair.symm\nhf\u2080 := P.hg\u2080\n hg\u2080 := P.hf\u2080\n\nend symmetry\n\nnamespace WeakFEPair\n\n/-!\n## Auxiliary results I: lemmas on asymptotics\n-/\n\n/-- As `x \u2192 0`, we have `f x = x ^ (-P.k) \u2022 constant` up to a rapidly decaying error. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeriesSummable_of_bounded_of_one_lt_real (L394-L397)\ntheorem LSeriesSummable_of_bounded_of_one_lt_real {f : \u2115 \u2192 \u2102} {m : \u211d}\n (h : \u2200 n \u2260 0, \u2016f n\u2016 \u2264 m) {s : \u211d} (hs : 1 < s) :\n LSeriesSummable f s :=\nLSeriesSummable_of_bounded_of_one_lt_re h <| by simp [hs]\n```\n\n-- snippet 18\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.LSeries_convolution' (L148-L154)\nlemma LSeries_convolution' {f g : \u2115 \u2192 \u2102} {s : \u2102} (hf : LSeriesSummable f s)\n (hg : LSeriesSummable g s) :\n LSeries (f \u235f g) s = LSeries f s * LSeries g s :=\n(LSeriesHasSum.convolution hf.LSeriesHasSum hg.LSeriesHasSum).LSeries_eq\n\n/-- The L-series of the convolution product `f \u235f g` of two sequences `f` and `g`\nequals the product of their L-series in their common half-plane of absolute convergence. -/\n```\n\n-- snippet 19\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.LSeriesHasSum (L139-L147)\nlemma LSeriesHasSum.convolution {f g : \u2115 \u2192 \u2102} {s a b : \u2102} (hf : LSeriesHasSum f s a)\n (hg : LSeriesHasSum g s b) :\n LSeriesHasSum (f \u235f g) s (a * b) := by\nhave hsum := summable_mul_of_summable_norm hf.summable.norm hg.summable.norm\n -- NB: this `simpa` is quite slow if un-squeezed\n simpa only [LSeriesHasSum, term_convolution'] using (hf.mul hg hsum).tsum_fiberwise _\n\n/-- The L-series of the convolution product `f \u235f g` of two sequences `f` and `g`\nequals the product of their L-series, assuming both L-series converge. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.LSeriesHasSum_mul (L182-L188)\nlemma LSeriesHasSum_mul {f g : ArithmeticFunction \u2102} {s a b : \u2102} (hf : LSeriesHasSum \u2197f s a)\n (hg : LSeriesHasSum \u2197g s b) :\n LSeriesHasSum \u2197(f * g) s (a * b) :=\ncoe_mul f g \u25b8 hf.convolution hg\n\n/-- The L-series of the (convolution) product of two `\u2102`-valued arithmetic functions `f` and `g`\nequals the product of their L-series, assuming both L-series converge. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.hf_modif_int (L267-L285)\nlemma hf_modif_int :\n LocallyIntegrableOn P.f_modif (Ioi 0) := by\nhave : LocallyIntegrableOn (fun x : \u211d \u21a6 (P.\u03b5 * \u2191(x ^ (-P.k))) \u2022 P.g\u2080) (Ioi 0) := by\n refine ContinuousOn.locallyIntegrableOn ?_ measurableSet_Ioi\n refine continuousOn_of_forall_continuousAt (fun x (hx : 0 < x) \u21a6 ?_)\n have : x \u2260 0 \u2228 0 \u2264 -P.k := Or.inl hx.ne'\n fun_prop (discharger := assumption)\n refine LocallyIntegrableOn.add (fun x hx \u21a6 ?_) (fun x hx \u21a6 ?_)\n \u00b7 obtain \u27e8s, hs, hs'\u27e9 := P.hf_int.sub (locallyIntegrableOn_const _) x hx\n refine \u27e8s, hs, ?_\u27e9\n rw [IntegrableOn, integrable_indicator_iff measurableSet_Ioi, IntegrableOn,\n Measure.restrict_restrict measurableSet_Ioi, \u2190 IntegrableOn]\n exact hs'.mono_set Set.inter_subset_right\n \u00b7 obtain \u27e8s, hs, hs'\u27e9 := P.hf_int.sub this x hx\n refine \u27e8s, hs, ?_\u27e9\n rw [IntegrableOn, integrable_indicator_iff measurableSet_Ioo, IntegrableOn,\n Measure.restrict_restrict measurableSet_Ioo, \u2190 IntegrableOn]\n exact hs'.mono_set Set.inter_subset_right\n```\n\n-- snippet 22\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.WeakFEPair (L107-L115)\nlemma WeakFEPair.h_feq' (P : WeakFEPair E) (x : \u211d) (hx : 0 < x) :\n P.g (1 / x) = (P.\u03b5\u207b\u00b9 * \u2191(x ^ P.k)) \u2022 P.f x := by\nrw [(div_div_cancel\u2080 (one_ne_zero' \u211d) \u25b8 P.h_feq (1 / x) (one_div_pos.mpr hx) :), \u2190 mul_smul]\n convert (one_smul \u2102 (P.g (1 / x))).symm using 2\n rw [one_div, inv_rpow hx.le, ofReal_inv]\n field [P.h\u03b5, (rpow_pos_of_pos hx _).ne']\n\nset_option linter.style.whitespace false in -- manual alignment is not recognised\n/-- The hypotheses are symmetric in `f` and `g`, with the constant `\u03b5` replaced by `\u03b5\u207b\u00b9`. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.f_modif_aux2 (L353-L394)\nlemma f_modif_aux2 [CompleteSpace E] {s : \u2102} (hs : P.k < re s) :\n mellin (fun x \u21a6 P.f_modif x - P.f x + P.f\u2080) s = (1 / s) \u2022 P.f\u2080 + (P.\u03b5 / (P.k - s)) \u2022 P.g\u2080 := by\nhave h_re1 : -1 < re (s - 1) := by simpa using P.hk.trans hs\n have h_re2 : -1 < re (s - P.k - 1) := by simpa using hs\n calc\n _ = \u222b (x : \u211d) in Ioi 0, (x : \u2102) ^ (s - 1) \u2022\n ((Ioo 0 1).indicator (fun t : \u211d \u21a6 P.f\u2080 - (P.\u03b5 * \u2191(t ^ (-P.k))) \u2022 P.g\u2080) x\n + ({1} : Set \u211d).indicator (fun _ \u21a6 P.f\u2080 - P.f 1) x) :=\n setIntegral_congr_fun measurableSet_Ioi (fun x hx \u21a6 by simp [f_modif_aux1 P hx])\n _ = \u222b (x : \u211d) in Ioi 0, (x : \u2102) ^ (s - 1) \u2022 ((Ioo 0 1).indicator\n (fun t : \u211d \u21a6 P.f\u2080 - (P.\u03b5 * \u2191(t ^ (-P.k))) \u2022 P.g\u2080) x) := by\n refine setIntegral_congr_ae measurableSet_Ioi (eventually_of_mem (U := {1}\u1d9c)\n (compl_mem_ae_iff.mpr (subsingleton_singleton.measure_zero _)) (fun x hx _ \u21a6 ?_))\n rw [indicator_of_notMem hx, add_zero]\n _ = \u222b (x : \u211d) in Ioc 0 1, (x : \u2102) ^ (s - 1) \u2022 (P.f\u2080 - (P.\u03b5 * \u2191(x ^ (-P.k))) \u2022 P.g\u2080) := by\n simp_rw [\u2190 indicator_smul, setIntegral_indicator measurableSet_Ioo,\n inter_eq_right.mpr Ioo_subset_Ioi_self, integral_Ioc_eq_integral_Ioo]\n _ = \u222b x : \u211d in Ioc 0 1, ((x : \u2102) ^ (s - 1) \u2022 P.f\u2080 - P.\u03b5 \u2022 (x : \u2102) ^ (s - P.k - 1) \u2022 P.g\u2080) := by\n refine setIntegral_congr_fun measurableSet_Ioc (fun x \u27e8hx, _\u27e9 \u21a6 ?_)\n rw [ofReal_cpow hx.le, ofReal_neg, smul_sub, \u2190 mul_smul, mul_comm, mul_assoc, mul_smul,\n mul_comm, \u2190 cpow_add _ _ (ofReal_ne_zero.mpr hx.ne'), \u2190 sub_eq_add_neg, sub_right_comm]\n _ = (\u222b (x : \u211d) in Ioc 0 1, (x : \u2102) ^ (s - 1)) \u2022 P.f\u2080\n - P.\u03b5 \u2022 (\u222b (x : \u211d) in Ioc 0 1, (x : \u2102) ^ (s - P.k - 1)) \u2022 P.g\u2080 := by\n rw [integral_sub, integral_smul, integral_smul_const, integral_smul_const]\n \u00b7 apply Integrable.smul_const\n rw [\u2190 IntegrableOn, \u2190 intervalIntegrable_iff_integrableOn_Ioc_of_le zero_le_one]\n exact intervalIntegral.intervalIntegrable_cpow' h_re1\n \u00b7 refine (Integrable.smul_const ?_ _).smul _\n rw [\u2190 IntegrableOn, \u2190 intervalIntegrable_iff_integrableOn_Ioc_of_le zero_le_one]\n exact intervalIntegral.intervalIntegrable_cpow' h_re2\n _ = _ := by simp_rw [\u2190 intervalIntegral.integral_of_le zero_le_one,\n integral_cpow (Or.inl h_re1), integral_cpow (Or.inl h_re2), ofReal_zero, ofReal_one,\n one_cpow, sub_add_cancel, zero_cpow fun h \u21a6 lt_irrefl _ (P.hk.le.trans_lt (zero_re \u25b8 h \u25b8 hs)),\n zero_cpow (sub_ne_zero.mpr (fun h \u21a6 lt_irrefl _ ((ofReal_re _) \u25b8 h \u25b8 hs)) : s - P.k \u2260 0),\n sub_zero, sub_eq_add_neg (_ \u2022 _), \u2190 mul_smul, \u2190 neg_smul, mul_one_div, \u2190 div_neg, neg_sub]\n\n/-!\n## Main theorems on weak FE-pairs\n-/\n\n/-- An entire function which differs from the Mellin transform of `f - f\u2080`, where defined, by a\ncorrection term of the form `A / s + B / (k - s)`. -/\n```\n\n-- snippet 24\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeries_delta (L305-L319)\nlemma LSeries_delta : LSeries \u03b4 = 1 := by\next\n simp [LSeries, LSeries.term_delta]\n\nend delta\n\n\n/-!\n### Criteria for and consequences of summability of L-series\n\nWe relate summability of L-series with bounds on the coefficients in terms of powers of `n`.\n-/\n\n/-- If the `LSeries` of `f` is summable at `s`, then `f n` is bounded in absolute value\nby a constant times `n^(re s)`. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.hf_zero (L146-L167)\nlemma hf_zero (P : WeakFEPair E) (r : \u211d) :\n (fun x \u21a6 P.f x - (P.\u03b5 * \u2191(x ^ (-P.k))) \u2022 P.g\u2080) =O[\ud835\udcdd[>] 0] (\u00b7 ^ r) := by\nhave := (P.hg_top (-(r + P.k))).comp_tendsto tendsto_inv_nhdsGT_zero\n simp_rw [IsBigO, IsBigOWith, eventually_nhdsWithin_iff] at this \u22a2\n obtain \u27e8C, hC\u27e9 := this\n use \u2016P.\u03b5\u2016 * C\n filter_upwards [hC] with x hC' (hx : 0 < x)\n have h_nv2 : \u2191(x ^ P.k) \u2260 (0 : \u2102) := ofReal_ne_zero.mpr (rpow_pos_of_pos hx _).ne'\n have h_nv : P.\u03b5\u207b\u00b9 * \u2191(x ^ P.k) \u2260 0 := mul_ne_zero P.symm.h\u03b5 h_nv2\n specialize hC' hx\n simp_rw [Function.comp_apply, \u2190 one_div, P.h_feq' _ hx] at hC'\n rw [\u2190 ((mul_inv_cancel\u2080 h_nv).symm \u25b8 one_smul \u2102 P.g\u2080 :), mul_smul _ _ P.g\u2080, \u2190 smul_sub, norm_smul,\n \u2190 le_div_iff\u2080' (lt_of_le_of_ne (norm_nonneg _) (norm_ne_zero_iff.mpr h_nv).symm)] at hC'\n convert hC' using 1\n \u00b7 congr 3\n rw [rpow_neg hx.le]\n simp [field]\n \u00b7 simp_rw [norm_mul, norm_real, one_div, inv_rpow hx.le, rpow_neg hx.le, inv_inv, norm_inv,\n norm_of_nonneg (rpow_pos_of_pos hx _).le, rpow_add hx]\n field\n\n/-- Power asymptotic for `f - f\u2080` as `x \u2192 0`. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.differentiable_\u039b\u2080 (L409-L410)\ntheorem differentiable_\u039b\u2080 : Differentiable \u2102 P.\u039b\u2080 := P.toStrongFEPair.differentiable_\u039b\n```\n\n-- snippet 27\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.term_convolution (L98-L113)\nlemma term_convolution (f g : \u2115 \u2192 \u2102) (s : \u2102) (n : \u2115) :\n term (f \u235f g) s n = \u2211 p \u2208 n.divisorsAntidiagonal, term f s p.1 * term g s p.2 := by\nrcases eq_or_ne n 0 with rfl | hn\n \u00b7 simp\n -- now `n \u2260 0`\n rw [term_of_ne_zero hn, convolution_def, Finset.sum_div]\n refine Finset.sum_congr rfl fun p hp \u21a6 ?_\n have \u27e8hp\u2081, hp\u2082\u27e9 := ne_zero_of_mem_divisorsAntidiagonal hp\n rw [term_of_ne_zero hp\u2081, term_of_ne_zero hp\u2082, mul_comm_div, div_div, \u2190 mul_div_assoc,\n \u2190 natCast_mul_natCast_cpow, \u2190 cast_mul, mul_comm p.2, (mem_divisorsAntidiagonal.mp hp).1]\n\nopen Set in\n/-- We give an expression of the `LSeries.term` of the convolution of two functions\nin terms of an a priori infinite sum over all pairs `(k, m)` with `k * m = n`\n(the set we sum over is infinite when `n = 0`). This is the version needed for the\nproof that `L (f \u235f g) = L f * L g`. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.hasMellin (L203-L207)\ntheorem hasMellin (s : \u2102) : HasMellin P.f s (P.\u039b s) :=\nlet \u27e8_, ht\u27e9 := exists_gt s.re\n let \u27e8_, hu\u27e9 := exists_lt s.re\n \u27e8mellinConvergent_of_isBigO_rpow P.hf_int (P.hf_top' _) ht (P.hf_zero' _) hu, rfl\u27e9\n```\n\n-- snippet 29\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.term_pos (L143-L163)\nlemma term_pos {a : \u2115 \u2192 \u2102} {n : \u2115} (hn : n \u2260 0) (h : 0 < a n) (x : \u211d) : 0 < term a x n := by\nsimpa only [term_of_ne_zero hn] using mul_pos h <| inv_natCast_cpow_ofReal_pos hn x\n\nend positivity\n\nend LSeries\n\n/-!\n### Definition of the L-series and related statements\n\nWe define `LSeries f s` of `f : \u2115 \u2192 \u2102` as the sum over `LSeries.term f s`.\nWe also provide predicates `LSeriesSummable f s` stating that `LSeries f s` is summable\nand `LSeriesHasSum f s a` stating that the L-series of `f` is summable at `s` and converges\nto `a : \u2102`.\n-/\n\nopen LSeries\n\n/-- The value of the L-series of the sequence `f` at the point `s`\nif it converges absolutely there, and `0` otherwise. -/\nnoncomputable\n```\n\n-- snippet 30\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.functional_equation (L222-L257)\ntheorem functional_equation (s : \u2102) :\n P.\u039b (P.k - s) = P.\u03b5 \u2022 P.symm.\u039b s := by\n-- unfold definition:\n rw [P.\u039b_eq, P.symm_\u039b_eq]\n -- substitute `t \u21a6 t\u207b\u00b9` in `mellin P.g s`\n have step1 := mellin_comp_rpow P.g (-s) (-1)\n simp_rw [abs_neg, abs_one, inv_one, one_smul, ofReal_neg, ofReal_one, div_neg, div_one, neg_neg,\n rpow_neg_one, \u2190 one_div] at step1\n -- introduce a power of `t` to match the hypothesis `P.h_feq`\n have step2 := mellin_cpow_smul (fun t \u21a6 P.g (1 / t)) (P.k - s) (-P.k)\n rw [\u2190 sub_eq_add_neg, sub_right_comm, sub_self, zero_sub, step1] at step2\n -- put in the constant `P.\u03b5`\n have step3 := mellin_const_smul (fun t \u21a6 (t : \u2102) ^ (-P.k : \u2102) \u2022 P.g (1 / t)) (P.k - s) P.\u03b5\n rw [step2] at step3\n rw [\u2190 step3]\n -- now the integrand matches `P.h_feq'` on `Ioi 0`, so we can apply `setIntegral_congr_fun`\n refine setIntegral_congr_fun measurableSet_Ioi (fun t ht \u21a6 ?_)\n simp_rw [P.h_feq' t ht, \u2190 mul_smul]\n -- some simple `cpow` arithmetic to finish\n rw [cpow_neg, ofReal_cpow (le_of_lt ht)]\n have : (t : \u2102) ^ (P.k : \u2102) \u2260 0 := by simpa [\u2190 ofReal_cpow ht.le] using (rpow_pos_of_pos ht _).ne'\n field_simp [P.h\u03b5]\n\nend StrongFEPair\n\nnamespace WeakFEPair\n\nvariable (P : WeakFEPair E)\n\n/-!\n## Auxiliary results II: building a strong FE-pair from a weak FE-pair\n-/\n\n/-- Piecewise modified version of `f` with optimal asymptotics. We deliberately choose intervals\nwhich don't quite join up, so the function is `0` at `x = 1`, in order to maintain symmetry;\nthere is no \"good\" choice of value at `1`. -/\n```\n\n-- snippet 31\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeries (L164-L167)\ndef LSeries (f : \u2115 \u2192 \u2102) (s : \u2102) : \u2102 :=\n\u2211' n, term f s n\n\n/-- Congruence for `LSeries` with the evaluation variable `s`. -/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.LSeries_convolution (L155-L162)\nlemma LSeries_convolution {f g : \u2115 \u2192 \u2102} {s : \u2102}\n (hf : abscissaOfAbsConv f < s.re) (hg : abscissaOfAbsConv g < s.re) :\n LSeries (f \u235f g) s = LSeries f s * LSeries g s :=\nLSeries_convolution' (LSeriesSummable_of_abscissaOfAbsConv_lt_re hf)\n (LSeriesSummable_of_abscissaOfAbsConv_lt_re hg)\n\n/-- The L-series of the convolution product `f \u235f g` of two sequences `f` and `g`\nis summable when both L-series are summable. -/\n```\n\n-- snippet 33\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeriesHasSum_iff (L227-L230)\nlemma LSeriesHasSum_iff {f : \u2115 \u2192 \u2102} {s a : \u2102} :\n LSeriesHasSum f s a \u2194 LSeriesSummable f s \u2227 LSeries f s = a :=\n\u27e8fun H \u21a6 \u27e8H.LSeriesSummable, H.LSeries_eq\u27e9, fun \u27e8H\u2081, H\u2082\u27e9 \u21a6 H\u2082 \u25b8 H\u2081.LSeriesHasSum\u27e9\n```\n\n-- snippet 34\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.norm_term_eq (L114-L119)\nlemma norm_term_eq (f : \u2115 \u2192 \u2102) (s : \u2102) (n : \u2115) :\n \u2016term f s n\u2016 = if n = 0 then 0 else \u2016f n\u2016 / n ^ s.re := by\nrcases eq_or_ne n 0 with rfl | hn\n \u00b7 simp\n \u00b7 simp [hn, norm_natCast_cpow_of_pos <| Nat.pos_of_ne_zero hn]\n```\n\n-- snippet 35\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.symm_\u039b\u2080_eq (L404-L408)\nlemma symm_\u039b\u2080_eq (s : \u2102) :\n P.symm.\u039b\u2080 s = P.symm.\u039b s + (1 / s) \u2022 P.g\u2080 + (P.\u03b5\u207b\u00b9 / (P.k - s)) \u2022 P.f\u2080 := by\nrw [P.symm.\u039b\u2080_eq]\n rfl\n```\n\n-- snippet 36\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.\u039b_residue_k (L449-L464)\ntheorem \u039b_residue_k :\n Tendsto (fun s : \u2102 \u21a6 (s - P.k) \u2022 P.\u039b s) (\ud835\udcdd[\u2260] P.k) (\ud835\udcdd (P.\u03b5 \u2022 P.g\u2080)) := by\nsimp_rw [\u039b, smul_sub, (by simp : \ud835\udcdd (P.\u03b5 \u2022 P.g\u2080) = \ud835\udcdd (0 - 0 - -P.\u03b5 \u2022 P.g\u2080))]\n refine ((Tendsto.sub ?_ ?_).mono_left nhdsWithin_le_nhds).sub ?_\n \u00b7 rw [(by rw [sub_self, zero_smul] : \ud835\udcdd 0 = \ud835\udcdd ((P.k - P.k : \u2102) \u2022 P.\u039b\u2080 P.k))]\n apply ((continuous_sub_right _).smul P.differentiable_\u039b\u2080.continuous).tendsto\n \u00b7 rw [(by rw [sub_self, zero_smul] : \ud835\udcdd 0 = \ud835\udcdd ((P.k - P.k : \u2102) \u2022 (1 / P.k : \u2102) \u2022 P.f\u2080))]\n refine (continuous_sub_right _).continuousAt.smul (ContinuousAt.smul ?_ continuousAt_const)\n have := ofReal_ne_zero.mpr P.hk.ne'\n fun_prop (discharger := assumption)\n \u00b7 refine (tendsto_const_nhds.mono_left nhdsWithin_le_nhds).congr' ?_\n refine eventually_nhdsWithin_of_forall (fun s (hs : s \u2260 P.k) \u21a6 ?_)\n match_scalars\n field [sub_ne_zero.mpr hs.symm]\n\n/-- The residue of `\u039b` at `s = 0` is equal to `-f\u2080`. -/\n```\n\n-- snippet 37\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.toArithmeticFunction (L40-L43)\ndef toArithmeticFunction {R : Type*} [Zero R] (f : \u2115 \u2192 R) : ArithmeticFunction R where\n toFun n := if n = 0 then 0 else f n\nmap_zero' := rfl\n```\n\n-- snippet 38\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeriesSummable_congr (L176-L182)\nlemma LSeriesSummable_congr {f g : \u2115 \u2192 \u2102} (s : \u2102) (h : \u2200 {n}, n \u2260 0 \u2192 f n = g n) :\n LSeriesSummable f s \u2194 LSeriesSummable g s :=\nsummable_congr <| term_congr h s\n\nopen Filter in\n/-- If `f` and `g` agree on large `n : \u2115` and the `LSeries` of `f` converges at `s`,\nthen so does that of `g`. -/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.toArithmeticFunction_congr (L44-L51)\nlemma toArithmeticFunction_congr {R : Type*} [Zero R] {f f' : \u2115 \u2192 R}\n (h : \u2200 {n}, n \u2260 0 \u2192 f n = f' n) :\n toArithmeticFunction f = toArithmeticFunction f' := by\next\n simp_all [toArithmeticFunction]\n\n/-- If we consider an arithmetic function just as a function and turn it back into an\narithmetic function, it is the same as before. -/\n```\n\n-- snippet 40\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.ArithmeticFunction (L53-L64)\nlemma ArithmeticFunction.toArithmeticFunction_eq_self {R : Type*} [Zero R]\n (f : ArithmeticFunction R) :\n toArithmeticFunction f = f := by\next n\n simp +contextual [toArithmeticFunction]\n\n/-- Dirichlet convolution of two sequences.\n\nWe define this in terms of the already existing definition for arithmetic functions. -/\nnoncomputable def LSeries.convolution {R : Type*} [Semiring R] (f g : \u2115 \u2192 R) : \u2115 \u2192 R :=\n \u21d1(toArithmeticFunction f * toArithmeticFunction g)\n```\n\n-- snippet 41\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.\u039b\u2080 (L395-L397)\ndef \u039b\u2080 : \u2102 \u2192 E := mellin P.f_modif\n/-- A meromorphic function which agrees with the Mellin transform of `f - f\u2080` where defined -/\n```\n\n-- snippet 42\n```lean\n-- Mathlib.NumberTheory.LSeries.Deriv.LSeries_deriv (L86-L91)\nlemma LSeries_deriv {f : \u2115 \u2192 \u2102} {s : \u2102} (h : abscissaOfAbsConv f < s.re) :\n deriv (LSeries f) s = -LSeries (logMul f) s :=\n(LSeries_hasDerivAt h).deriv\n\n/-- The derivative of the L-series of `f` agrees with the negative of the L-series of\n`log * f` on the right half-plane of absolute convergence. -/\n```\n\n-- snippet 43\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.norm_term_le_of_re_le_re (L127-L137)\nlemma norm_term_le_of_re_le_re (f : \u2115 \u2192 \u2102) {s s' : \u2102} (h : s.re \u2264 s'.re) (n : \u2115) :\n \u2016term f s' n\u2016 \u2264 \u2016term f s n\u2016 := by\nsimp only [norm_term_eq]\n split\n \u00b7 next => rfl\n \u00b7 next hn => gcongr; exact Nat.one_le_cast.mpr <| Nat.one_le_iff_ne_zero.mpr hn\n\nsection positivity\n\nopen scoped ComplexOrder\n```\n\n-- snippet 44\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.hf_zero' (L168-L187)\nlemma hf_zero' (P : WeakFEPair E) :\n (fun x : \u211d \u21a6 P.f x - P.f\u2080) =O[\ud835\udcdd[>] 0] (\u00b7 ^ (-P.k)) := by\nsimp_rw [\u2190 fun x \u21a6 sub_add_sub_cancel (P.f x) ((P.\u03b5 * \u2191(x ^ (-P.k))) \u2022 P.g\u2080) P.f\u2080]\n refine (P.hf_zero _).add (IsBigO.sub ?_ ?_)\n \u00b7 rw [\u2190 isBigO_norm_norm]\n simp_rw [mul_smul, norm_smul, mul_comm _ \u2016P.g\u2080\u2016, \u2190 mul_assoc, norm_real]\n apply (isBigO_refl _ _).const_mul_left\n \u00b7 refine IsBigO.of_bound \u2016P.f\u2080\u2016 (eventually_nhdsWithin_iff.mpr ?_)\n filter_upwards [eventually_le_nhds zero_lt_one] with x hx' (hx : 0 < x)\n apply le_mul_of_one_le_right (norm_nonneg _)\n rw [norm_of_nonneg (rpow_pos_of_pos hx _).le, rpow_neg hx.le]\n exact (one_le_inv\u2080 (rpow_pos_of_pos hx _)).2 (rpow_le_one hx.le hx' P.hk.le)\n\nend WeakFEPair\n\nnamespace StrongFEPair\n\nvariable (P : StrongFEPair E)\n\n/-- As `x \u2192 \u221e`, `f x` decays faster than any power of `x`. -/\n```\n\n-- snippet 45\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.f_modif (L258-L262)\ndef f_modif : \u211d \u2192 E :=\n(Ioi 1).indicator (fun x \u21a6 P.f x - P.f\u2080) +\n (Ioo 0 1).indicator (fun x \u21a6 P.f x - (P.\u03b5 * \u2191(x ^ (-P.k))) \u2022 P.g\u2080)\n\n/-- Piecewise modified version of `g` with optimal asymptotics. -/\n```\n\n-- snippet 46\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.LSeriesSummable_mul (L203-L208)\nlemma LSeriesSummable_mul {f g : ArithmeticFunction \u2102} {s : \u2102} (hf : LSeriesSummable \u2197f s)\n (hg : LSeriesSummable \u2197g s) :\n LSeriesSummable \u2197(f * g) s :=\ncoe_mul f g \u25b8 hf.convolution hg\n\nend ArithmeticFunction\n```\n\n-- snippet 47\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.term (L74-L76)\ndef term (f : \u2115 \u2192 \u2102) (s : \u2102) (n : \u2115) : \u2102 :=\nif n = 0 then 0 else f n / n ^ s\n```\n\n-- snippet 48\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.term_def\u2080 (L82-L86)\nlemma term_def\u2080 {f : \u2115 \u2192 \u2102} (hf : f 0 = 0) (s : \u2102) (n : \u2115) :\n LSeries.term f s n = f n * (n : \u2102) ^ (-s) := by\nrw [LSeries.term]\n split_ifs with h <;> simp [h, hf, cpow_neg, div_eq_inv_mul, mul_comm]\n```\n\n-- snippet 49\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeriesSummable_of_le_const_mul_rpow (L341-L366)\nlemma LSeriesSummable_of_le_const_mul_rpow {f : \u2115 \u2192 \u2102} {x : \u211d} {s : \u2102} (hs : x < s.re)\n (h : \u2203 C, \u2200 n \u2260 0, \u2016f n\u2016 \u2264 C * n ^ (x - 1)) :\n LSeriesSummable f s := by\nobtain \u27e8C, hC\u27e9 := h\n have hC\u2080 : 0 \u2264 C := (norm_nonneg <| f 1).trans <| by simpa using hC 1 one_ne_zero\n have hsum : Summable fun n : \u2115 \u21a6 \u2016(C : \u2102) / n ^ (s + (1 - x))\u2016 := by\n simp_rw [div_eq_mul_inv, norm_mul, \u2190 cpow_neg]\n have hsx : -s.re + x - 1 < -1 := by linarith only [hs]\n refine Summable.mul_left _ <|\n Summable.of_norm_bounded_eventually_nat (g := fun n \u21a6 (n : \u211d) ^ (-s.re + x - 1)) ?_ ?_\n \u00b7 simpa\n \u00b7 simp only [norm_norm, Filter.eventually_atTop]\n refine \u27e81, fun n hn \u21a6 le_of_eq ?_\u27e9\n simp only [norm_natCast_cpow_of_pos hn, add_re, sub_re, neg_re, ofReal_re, one_re]\n ring_nf\n refine Summable.of_norm <| hsum.of_nonneg_of_le (fun _ \u21a6 norm_nonneg _) (fun n \u21a6 ?_)\n rcases n.eq_zero_or_pos with rfl | hn\n \u00b7 simpa only [term_zero, norm_zero] using norm_nonneg _\n have hn' : 0 < (n : \u211d) ^ s.re := Real.rpow_pos_of_pos (Nat.cast_pos.mpr hn) _\n simp_rw [term_of_ne_zero hn.ne', norm_div, norm_natCast_cpow_of_pos hn, div_le_iff\u2080 hn',\n norm_real, Real.norm_of_nonneg hC\u2080, div_eq_mul_inv, mul_assoc,\n \u2190 Real.rpow_neg <| Nat.cast_nonneg _, \u2190 Real.rpow_add <| Nat.cast_pos.mpr hn]\n simpa using hC n <| Nat.pos_iff_ne_zero.mp hn\n\nopen Filter Finset Real Nat in\n/-- If `f = O(n^(x-1))` and `re s > x`, then the `LSeries` of `f` is summable at `s`. -/\n```\n\n-- snippet 50\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeries_congr (L168-L172)\nlemma LSeries_congr {f g : \u2115 \u2192 \u2102} (h : \u2200 {n}, n \u2260 0 \u2192 f n = g n) (s : \u2102) :\n LSeries f s = LSeries g s :=\ntsum_congr <| term_congr h s\n\n/-- `LSeriesSummable f s` indicates that the L-series of `f` converges absolutely at `s`. -/\n```\n\n-- snippet 51\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.differentiable_\u039b (L213-L221)\ntheorem differentiable_\u039b : Differentiable \u2102 P.\u039b := fun s \u21a6\nlet \u27e8_, ht\u27e9 := exists_gt s.re\n let \u27e8_, hu\u27e9 := exists_lt s.re\n mellin_differentiableAt_of_isBigO_rpow P.hf_int (P.hf_top' _) ht (P.hf_zero' _) hu\n\n/-- Main theorem about strong FE pairs: if `(f, g)` are a strong FE pair, then the Mellin\ntransforms of `f` and `g` are related by `s \u21a6 k - s`.\n\nThis is proved by making a substitution `t \u21a6 t\u207b\u00b9` in the Mellin transform integral. -/\n```\n\n-- snippet 52\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.\u039b_residue_zero (L465-L478)\ntheorem \u039b_residue_zero :\n Tendsto (fun s : \u2102 \u21a6 s \u2022 P.\u039b s) (\ud835\udcdd[\u2260] 0) (\ud835\udcdd (-P.f\u2080)) := by\nsimp_rw [\u039b, smul_sub, (by simp : \ud835\udcdd (-P.f\u2080) = \ud835\udcdd (((0 : \u2102) \u2022 P.\u039b\u2080 0) - P.f\u2080 - 0))]\n refine ((Tendsto.mono_left ?_ nhdsWithin_le_nhds).sub ?_).sub ?_\n \u00b7 exact (continuous_id.smul P.differentiable_\u039b\u2080.continuous).tendsto _\n \u00b7 refine (tendsto_const_nhds.mono_left nhdsWithin_le_nhds).congr' ?_\n refine eventually_nhdsWithin_of_forall (fun s (hs : s \u2260 0) \u21a6 ?_)\n match_scalars\n field [sub_ne_zero.mpr hs.symm]\n \u00b7 rw [show \ud835\udcdd 0 = \ud835\udcdd ((0 : \u2102) \u2022 (P.\u03b5 / (P.k - 0 : \u2102)) \u2022 P.g\u2080) by rw [zero_smul]]\n exact (continuousAt_id.smul ((continuousAt_const.div ((continuous_sub_left _).continuousAt)\n (by simpa using P.hk.ne')).smul continuousAt_const)).mono_left nhdsWithin_le_nhds\n\nend WeakFEPair\n```\n\n-- snippet 53\n```lean\n-- Mathlib.NumberTheory.LSeries.Deriv.LSeries (L45-L79)\nlemma LSeries.hasDerivAt_term (f : \u2115 \u2192 \u2102) (n : \u2115) (s : \u2102) :\n HasDerivAt (fun z \u21a6 term f z n) (-(term (logMul f) s n)) s := by\nrcases eq_or_ne n 0 with rfl | hn\n \u00b7 simp [hasDerivAt_const]\n simp_rw [term_of_ne_zero hn, \u2190 neg_div, \u2190 neg_mul, mul_comm, mul_div_assoc, div_eq_mul_inv,\n \u2190 cpow_neg]\n exact HasDerivAt.const_mul (f n) (by simpa only [mul_comm, \u2190 mul_neg_one (log n), \u2190 mul_assoc]\n using (hasDerivAt_neg' s).const_cpow (Or.inl <| Nat.cast_ne_zero.mpr hn))\n\n/- This lemma proves two things at once, since their proofs are intertwined; we give separate\nnon-private lemmas below that extract the two statements. -/\nprivate lemma LSeries.LSeriesSummable_logMul_and_hasDerivAt {f : \u2115 \u2192 \u2102} {s : \u2102}\n (h : abscissaOfAbsConv f < s.re) :\n LSeriesSummable (logMul f) s \u2227 HasDerivAt (LSeries f) (-LSeries (logMul f) s) s := by\n -- The L-series of `f` is summable at some real `x < re s`.\n obtain \u27e8x, hxs, hf\u27e9 := LSeriesSummable_lt_re_of_abscissaOfAbsConv_lt_re h\n obtain \u27e8y, hxy, hys\u27e9 := exists_between hxs\n -- We work in the right half-plane `y < re z`, for some `y` such that `x < y < re s`, on which\n -- we have a uniform summable bound on `\u2016term f z \u00b7\u2016`.\n let S : Set \u2102 := {z | y < z.re}\n have h\u2080 : Summable (fun n \u21a6 \u2016term f x n\u2016) := summable_norm_iff.mpr hf\n have h\u2081 (n) : DifferentiableOn \u2102 (term f \u00b7 n) S :=\n fun z _ \u21a6 (hasDerivAt_term f n _).differentiableAt.differentiableWithinAt\n have h\u2082 : IsOpen S := isOpen_lt continuous_const continuous_re\n have h\u2083 (n z) (hz : z \u2208 S) : \u2016term f z n\u2016 \u2264 \u2016term f x n\u2016 :=\n norm_term_le_of_re_le_re f (by simpa using (hxy.trans hz).le) n\n have H := hasSum_deriv_of_summable_norm h\u2080 h\u2081 h\u2082 h\u2083 hys\n simp_rw [(hasDerivAt_term f _ _).deriv] at H\n refine \u27e8summable_neg_iff.mp H.summable, ?_\u27e9\n simpa [\u2190 H.tsum_eq, tsum_neg] using ((differentiableOn_tsum_of_summable_norm\n h\u2080 h\u2081 h\u2082 h\u2083).differentiableAt <| h\u2082.mem_nhds hys).hasDerivAt\n\n/-- If `re s` is greater than the abscissa of absolute convergence of `f`, then the L-series\nof `f` is differentiable with derivative the negative of the L-series of the point-wise\nproduct of `log` with `f`. -/\n```\n\n-- snippet 54\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.term_delta (L282-L287)\nlemma term_delta (s : \u2102) (n : \u2115) : term \u03b4 s n = if n = 1 then 1 else 0 := by\nrcases eq_or_ne n 0 with rfl | hn\n \u00b7 simp\n \u00b7 rcases eq_or_ne n 1 with hn' | hn' <;>\n simp [hn, hn', delta]\n```\n\n-- snippet 55\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.functional_equation\u2080 (L439-L442)\ntheorem functional_equation\u2080 (s : \u2102) : P.\u039b\u2080 (P.k - s) = P.\u03b5 \u2022 P.symm.\u039b\u2080 s :=\nP.toStrongFEPair.functional_equation s\n\n/-- Functional equation formulated for `\u039b`. -/\n```\n\n-- snippet 56\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.term_nonneg (L138-L142)\nlemma term_nonneg {a : \u2115 \u2192 \u2102} {n : \u2115} (h : 0 \u2264 a n) (x : \u211d) : 0 \u2264 term a x n := by\nrw [term_def]\n split_ifs with hn\n exacts [le_rfl, mul_nonneg h (inv_natCast_cpow_ofReal_pos hn x).le]\n```\n\n-- snippet 57\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.\u039b_eq (L208-L209)\nlemma \u039b_eq : P.\u039b = mellin P.f := rfl\n```\n\n-- snippet 58\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.f_modif_aux1 (L334-L352)\nlemma f_modif_aux1 : EqOn (fun x \u21a6 P.f_modif x - P.f x + P.f\u2080)\n ((Ioo 0 1).indicator (fun x : \u211d \u21a6 P.f\u2080 - (P.\u03b5 * \u2191(x ^ (-P.k))) \u2022 P.g\u2080)\n + ({1} : Set \u211d).indicator (fun _ \u21a6 P.f\u2080 - P.f 1)) (Ioi 0) := by\nintro x (hx : 0 < x)\n simp_rw [f_modif, Pi.add_apply]\n rcases lt_trichotomy x 1 with hx' | rfl | hx'\n \u00b7 simp_rw [indicator_of_notMem (notMem_Ioi.mpr hx'.le),\n indicator_of_mem (mem_Ioo.mpr \u27e8hx, hx'\u27e9),\n indicator_of_notMem (mem_singleton_iff.not.mpr hx'.ne)]\n abel\n \u00b7 simp [add_comm, sub_eq_add_neg]\n \u00b7 simp_rw [indicator_of_mem (mem_Ioi.mpr hx'),\n indicator_of_notMem (notMem_Ioo_of_ge hx'.le),\n indicator_of_notMem (mem_singleton_iff.not.mpr hx'.ne')]\n abel\n\nset_option backward.isDefEq.respectTransparency false in\n/-- Compute the Mellin transform of the modifying term used to kill off the constants at\n`0` and `\u221e`. -/\n```\n\n-- snippet 59\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeriesSummable_iff_of_re_eq_re (L240-L244)\ntheorem LSeriesSummable_iff_of_re_eq_re {f : \u2115 \u2192 \u2102} {s s' : \u2102} (h : s.re = s'.re) :\n LSeriesSummable f s \u2194 LSeriesSummable f s' :=\n\u27e8fun H \u21a6 H.of_re_le_re h.le, fun H \u21a6 H.of_re_le_re h.symm.le\u27e9\n\n/-- The indicator function of `{1} \u2286 \u2115` with values in `\u2102`. -/\n```\n\n-- snippet 60\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.g_modif (L263-L266)\ndef g_modif : \u211d \u2192 E :=\n(Ioi 1).indicator (fun x \u21a6 P.g x - P.g\u2080) +\n (Ioo 0 1).indicator (fun x \u21a6 P.g x - (P.\u03b5\u207b\u00b9 * \u2191(x ^ (-P.k))) \u2022 P.f\u2080)\n```\n\n-- snippet 61\n```lean\n-- Mathlib.NumberTheory.LSeries.Deriv.LSeriesSummable_logMul_of_lt_re (L98-L103)\nlemma LSeriesSummable_logMul_of_lt_re {f : \u2115 \u2192 \u2102} {s : \u2102} (h : abscissaOfAbsConv f < s.re) :\n LSeriesSummable (logMul f) s :=\n(LSeriesSummable_logMul_and_hasDerivAt h).1\n\n/-- The abscissa of absolute convergence of the point-wise product of `log` and `f`\nis the same as that of `f`. -/\n```\n\n-- snippet 62\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.\u039b\u2080_eq (L400-L403)\nlemma \u039b\u2080_eq (s : \u2102) : P.\u039b\u2080 s = P.\u039b s + (1 / s) \u2022 P.f\u2080 + (P.\u03b5 / (P.k - s)) \u2022 P.g\u2080 := by\nunfold \u039b \u039b\u2080\n abel\n```\n\n-- snippet 63\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.term_of_ne_zero (L92-L99)\nlemma term_of_ne_zero {n : \u2115} (hn : n \u2260 0) (f : \u2115 \u2192 \u2102) (s : \u2102) :\n term f s n = f n / n ^ s :=\nif_neg hn\n\n/--\nIf `s \u2260 0`, then the `if .. then .. else` construction in `LSeries.term` isn't needed, since\n`0 ^ s = 0`.\n-/\n```\n\n-- snippet 64\n```lean\n-- Mathlib.NumberTheory.LSeries.Deriv.LSeries_iteratedDeriv (L133-L151)\nlemma LSeries_iteratedDeriv {f : \u2115 \u2192 \u2102} (m : \u2115) {s : \u2102} (h : abscissaOfAbsConv f < s.re) :\n iteratedDeriv m (LSeries f) s = (-1) ^ m * LSeries (logMul^[m] f) s := by\ninduction m generalizing s with\n | zero => simp\n | succ m ih =>\n have ih' : {s | abscissaOfAbsConv f < re s}.EqOn (iteratedDeriv m (LSeries f))\n ((-1) ^ m * LSeries (logMul^[m] f)) := fun _ hs \u21a6 ih hs\n have := derivWithin_congr ih' (ih h)\n simp_rw [derivWithin_of_isOpen (isOpen_re_gt_EReal _) h] at this\n rw [iteratedDeriv_succ, this]\n simp [Pi.mul_def, pow_succ, Function.iterate_succ',\n LSeries_deriv <| absicssaOfAbsConv_logPowMul.symm \u25b8 h, -Function.iterate_succ]\n\n/-!\n### The L-series is holomorphic\n-/\n\n/-- The L-series of `f` is complex differentiable in its open half-plane of absolute\nconvergence. -/\n```\n\n-- snippet 65\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeries_zero (L270-L281)\nlemma LSeries_zero : LSeries 0 = 0 := by\next\n simp [LSeries, LSeries.term]\n\nsection delta\n\nopen scoped LSeries.notation\n\nnamespace LSeries\n\nopen Nat Complex\n```\n\n-- snippet 66\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.mul_delta (L293-L295)\nlemma mul_delta {f : \u2115 \u2192 \u2102} (h : f 1 = 1) : f * \u03b4 = \u03b4 := by\nrw [mul_delta_eq_smul_delta, h, one_smul]\n```\n\n-- snippet 67\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.norm_term_le (L120-L126)\nlemma norm_term_le {f g : \u2115 \u2192 \u2102} (s : \u2102) {n : \u2115} (h : \u2016f n\u2016 \u2264 \u2016g n\u2016) :\n \u2016term f s n\u2016 \u2264 \u2016term g s n\u2016 := by\nsimp only [norm_term_eq]\n split\n \u00b7 rfl\n \u00b7 gcongr\n```\n\n-- snippet 68\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeriesSummable_congr' (L198-L201)\nlemma LSeriesSummable_congr' {f g : \u2115 \u2192 \u2102} (s : \u2102) (h : f =\u1da0[atTop] g) :\n LSeriesSummable f s \u2194 LSeriesSummable g s :=\n\u27e8fun H \u21a6 H.congr' s h, fun H \u21a6 H.congr' s h.symm\u27e9\n```\n\n-- snippet 69\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.convolution_def (L81-L86)\nlemma convolution_def {R : Type*} [Semiring R] (f g : \u2115 \u2192 R) :\n f \u235f g = fun n \u21a6 \u2211 p \u2208 n.divisorsAntidiagonal, f p.1 * g p.2 := by\next n\n simpa [convolution, toArithmeticFunction] using\n Finset.sum_congr rfl fun p hp \u21a6 by simp [ne_zero_of_mem_divisorsAntidiagonal hp]\n```\n\n-- snippet 70\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.delta_mul_eq_smul_delta (L296-L298)\nlemma delta_mul_eq_smul_delta {f : \u2115 \u2192 \u2102} : \u03b4 * f = f 1 \u2022 \u03b4 :=\nmul_comm \u03b4 f \u25b8 mul_delta_eq_smul_delta\n```\n\n-- snippet 71\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.convolution_map_zero (L88-L97)\nlemma convolution_map_zero {R : Type*} [Semiring R] (f g : \u2115 \u2192 R) : (f \u235f g) 0 = 0 := by\nsimp [convolution_def]\n\n\n/-!\n### Multiplication of L-series\n-/\n\n/-- We give an expression of the `LSeries.term` of the convolution of two functions\nin terms of a sum over `Nat.divisorsAntidiagonal`. -/\n```\n\n-- snippet 72\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.pow_mul_term_eq (L110-L113)\nlemma pow_mul_term_eq (f : \u2115 \u2192 \u2102) (s : \u2102) (n : \u2115) :\n (n + 1) ^ s * term f s (n + 1) = f (n + 1) := by\nsimp [term, natCast_add_one_cpow_ne_zero n _, mul_div_assoc']\n```\n\n-- snippet 73\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeriesSummable_zero (L207-L211)\ntheorem LSeriesSummable_zero {s : \u2102} : LSeriesSummable 0 s := by\nsimp [LSeriesSummable, funext (term_def 0 s), summable_zero]\n\n/-- This states that the L-series of the sequence `f` converges absolutely at `s` and that\nthe value there is `a`. -/\n```\n\n-- snippet 74\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.LSeries_mul (L196-L202)\nlemma LSeries_mul {f g : ArithmeticFunction \u2102} {s : \u2102}\n (hf : abscissaOfAbsConv \u2197f < s.re) (hg : abscissaOfAbsConv \u2197g < s.re) :\n LSeries \u2197(f * g) s = LSeries \u2197f s * LSeries \u2197g s :=\ncoe_mul f g \u25b8 LSeries_convolution hf hg\n\n/-- The L-series of the (convolution) product of two `\u2102`-valued arithmetic functions `f` and `g`\nis summable when both L-series are summable. -/\n```\n\n-- snippet 75\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.hf_top' (L188-L191)\nlemma hf_top' (r : \u211d) : P.f =O[atTop] (\u00b7 ^ r) := by\nsimpa [P.hf\u2080] using P.hf_top r\n\n/-- As `x \u2192 0`, `f x` decays faster than any power of `x`. -/\n```\n\n-- snippet 76\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.symm_\u039b_eq (L210-L212)\nlemma symm_\u039b_eq : P.symm.\u039b = mellin P.g := rfl\n/-- If `(f, g)` are a strong FE pair, then the Mellin transform of `f` is entire. -/\n```\n\n-- snippet 77\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.\u039b (L200-L202)\ndef \u039b : \u2102 \u2192 E := mellin P.f\n/-- The Mellin transform of `f` is well-defined and equal to `P.\u039b s`, for all `s`. -/\n```\n\n-- snippet 78\n```lean\n-- Mathlib.NumberTheory.LSeries.Deriv.LSeries_deriv_eqOn (L92-L97)\nlemma LSeries_deriv_eqOn {f : \u2115 \u2192 \u2102} :\n {s | abscissaOfAbsConv f < s.re}.EqOn (deriv (LSeries f)) (-LSeries (logMul f)) :=\nderiv_eqOn (isOpen_re_gt_EReal _) fun _ hs \u21a6 (LSeries_hasDerivAt hs).hasDerivWithinAt\n\n/-- If the L-series of `f` is summable at `s` and `re s < re s'`, then the L-series of the\npoint-wise product of `log` with `f` is summable at `s'`. -/\n```\n\n-- snippet 79\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeriesSummable_of_bounded_of_one_lt_re (L388-L393)\ntheorem LSeriesSummable_of_bounded_of_one_lt_re {f : \u2115 \u2192 \u2102} {m : \u211d}\n (h : \u2200 n \u2260 0, \u2016f n\u2016 \u2264 m) {s : \u2102} (hs : 1 < s.re) :\n LSeriesSummable f s :=\nLSeriesSummable_of_le_const_mul_rpow hs \u27e8m, fun n hn \u21a6 by simp [h n hn]\u27e9\n\n/-- If `f` is bounded, then its `LSeries` is summable at `s : \u211d` when `s > 1`. -/\n```\n\n-- snippet 80\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.hf_modif_FE (L286-L306)\nlemma hf_modif_FE (x : \u211d) (hx : 0 < x) :\n P.f_modif (1 / x) = (P.\u03b5 * \u2191(x ^ P.k)) \u2022 P.g_modif x := by\nrcases lt_trichotomy 1 x with hx' | rfl | hx'\n \u00b7 have : 1 / x < 1 := by rwa [one_div_lt hx one_pos, div_one]\n rw [f_modif, Pi.add_apply, indicator_of_notMem (notMem_Ioi.mpr this.le),\n zero_add, indicator_of_mem (mem_Ioo.mpr \u27e8div_pos one_pos hx, this\u27e9), g_modif, Pi.add_apply,\n indicator_of_mem (mem_Ioi.mpr hx'), indicator_of_notMem\n (notMem_Ioo_of_ge hx'.le), add_zero, P.h_feq _ hx, smul_sub]\n simp_rw [rpow_neg (one_div_pos.mpr hx).le, one_div, inv_rpow hx.le, inv_inv]\n \u00b7 simp [f_modif, g_modif]\n \u00b7 have : 1 < 1 / x := by rwa [lt_one_div one_pos hx, div_one]\n rw [f_modif, Pi.add_apply, indicator_of_mem (mem_Ioi.mpr this),\n indicator_of_notMem (notMem_Ioo_of_ge this.le), g_modif, Pi.add_apply,\n indicator_of_notMem (notMem_Ioi.mpr hx'.le),\n indicator_of_mem (mem_Ioo.mpr \u27e8hx, hx'\u27e9), P.h_feq _ hx]\n simp_rw [rpow_neg hx.le]\n match_scalars <;> field [(rpow_pos_of_pos hx P.k).ne', P.h\u03b5]\n\nset_option linter.style.whitespace false in -- manual alignment is not recognised\n/-- Given a weak FE-pair `(f, g)`, modify it into a strong FE-pair by subtracting suitable\ncorrection terms from `f` and `g`. -/\n```\n\n-- snippet 81\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeriesHasSum (L212-L214)\ndef LSeriesHasSum (f : \u2115 \u2192 \u2102) (s a : \u2102) : Prop :=\nHasSum (term f s) a\n```\n\n-- snippet 82\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.term_def (L77-L81)\nlemma term_def (f : \u2115 \u2192 \u2102) (s : \u2102) (n : \u2115) :\n term f s n = if n = 0 then 0 else f n / n ^ s :=\nrfl\n\n/-- An alternate spelling of `term_def` for the case `f 0 = 0`. -/\n```\n\n-- snippet 83\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.term_convolution' (L114-L138)\nlemma term_convolution' (f g : \u2115 \u2192 \u2102) (s : \u2102) :\n term (f \u235f g) s = fun n \u21a6\n \u2211' (b : (fun p : \u2115 \u00d7 \u2115 \u21a6 p.1 * p.2) \u207b\u00b9' {n}), term f s b.val.1 * term g s b.val.2 := by\next n\n rcases eq_or_ne n 0 with rfl | hn\n \u00b7 -- show that both sides vanish when `n = 0`; this is the hardest part of the proof!\n refine (term_zero ..).trans ?_\n -- the right-hand sum is over the union below, but in each term, one factor is always zero\n have hS : (fun p \u21a6 p.1 * p.2) \u207b\u00b9' {0} = {0} \u00d7\u02e2 univ \u222a univ \u00d7\u02e2 {0} := by\n ext\n simp\n have : \u2200 p : (fun p : \u2115 \u00d7 \u2115 \u21a6 p.1 * p.2) \u207b\u00b9' {0}, term f s p.val.1 * term g s p.val.2 = 0 := by\n rintro \u27e8\u27e8_, _\u27e9, hp\u27e9\n rcases hS \u25b8 hp with \u27e8rfl, -\u27e9 | \u27e8-, rfl\u27e9 <;> simp\n simp [this]\n -- now `n \u2260 0`\n rw [show (fun p : \u2115 \u00d7 \u2115 \u21a6 p.1 * p.2) \u207b\u00b9' {n} = n.divisorsAntidiagonal by ext; simp [hn],\n Finset.tsum_subtype' n.divisorsAntidiagonal fun p \u21a6 term f s p.1 * term g s p.2,\n term_convolution f g s n]\n\nend LSeries\n\nopen Set in\n/-- The L-series of the convolution product `f \u235f g` of two sequences `f` and `g`\nequals the product of their L-series, assuming both L-series converge. -/\n```\n\n-- snippet 84\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.mul_delta_eq_smul_delta (L288-L292)\nlemma mul_delta_eq_smul_delta {f : \u2115 \u2192 \u2102} : f * \u03b4 = f 1 \u2022 \u03b4 := by\next n\n by_cases hn : n = 1 <;>\n simp [hn, delta]\n```\n\n-- snippet 85\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.LSeries_mul' (L189-L195)\nlemma LSeries_mul' {f g : ArithmeticFunction \u2102} {s : \u2102} (hf : LSeriesSummable \u2197f s)\n (hg : LSeriesSummable \u2197g s) :\n LSeries \u2197(f * g) s = LSeries \u2197f s * LSeries \u2197g s :=\ncoe_mul f g \u25b8 LSeries_convolution' hf hg\n\n/-- The L-series of the (convolution) product of two `\u2102`-valued arithmetic functions `f` and `g`\nequals the product of their L-series in their common half-plane of absolute convergence. -/\n```\n\n-- snippet 86\n```lean\n-- Mathlib.NumberTheory.LSeries.Convolution.LSeries (L68-L74)\nlemma LSeries.convolution_congr {R : Type*} [Semiring R] {f f' g g' : \u2115 \u2192 R}\n (hf : \u2200 {n}, n \u2260 0 \u2192 f n = f' n) (hg : \u2200 {n}, n \u2260 0 \u2192 g n = g' n) :\n f \u235f g = f' \u235f g' := by\nsimp [convolution, toArithmeticFunction_congr hf, toArithmeticFunction_congr hg]\n\n/-- The product of two arithmetic functions defines the same function as the Dirichlet convolution\nof the functions defined by them. -/\n```\n\n-- snippet 87\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeriesSummable_of_isBigO_rpow (L367-L387)\nlemma LSeriesSummable_of_isBigO_rpow {f : \u2115 \u2192 \u2102} {x : \u211d} {s : \u2102} (hs : x < s.re)\n (h : f =O[atTop] fun n \u21a6 (n : \u211d) ^ (x - 1)) :\n LSeriesSummable f s := by\nobtain \u27e8C, hC\u27e9 := Asymptotics.isBigO_iff.mp h\n obtain \u27e8m, hm\u27e9 := eventually_atTop.mp hC\n let C' := max C (max' (insert 0 (image (fun n : \u2115 \u21a6 \u2016f n\u2016 / (n : \u211d) ^ (x - 1)) (range m)))\n (insert_nonempty 0 _))\n have hC'\u2080 : 0 \u2264 C' := (le_max' _ _ (mem_insert.mpr (Or.inl rfl))).trans <| le_max_right ..\n have hCC' : C \u2264 C' := le_max_left ..\n refine LSeriesSummable_of_le_const_mul_rpow hs \u27e8C', fun n hn\u2080 \u21a6 ?_\u27e9\n rcases le_or_gt m n with hn | hn\n \u00b7 refine (hm n hn).trans ?_\n have hn\u2080 : (0 : \u211d) \u2264 n := cast_nonneg _\n gcongr\n rw [Real.norm_eq_abs, abs_rpow_of_nonneg hn\u2080, abs_of_nonneg hn\u2080]\n \u00b7 have hn' : 0 < n := Nat.pos_of_ne_zero hn\u2080\n refine (div_le_iff\u2080 <| rpow_pos_of_pos (cast_pos.mpr hn') _).mp ?_\n refine (le_max' _ _ <| mem_insert_of_mem ?_).trans <| le_max_right ..\n exact mem_image.mpr \u27e8n, mem_range.mpr hn, rfl\u27e9\n\n/-- If `f` is bounded, then its `LSeries` is summable at `s` when `re s > 1`. -/\n```\n\n-- snippet 88\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.delta_mul (L299-L304)\nlemma delta_mul {f : \u2115 \u2192 \u2102} (h : f 1 = 1) : \u03b4 * f = \u03b4 :=\nmul_comm \u03b4 f \u25b8 mul_delta h\n\nend LSeries\n\n/-- The L-series of `\u03b4` is the constant function `1`. -/\n```\n\n-- snippet 89\n```lean\n-- Mathlib.NumberTheory.LSeries.AbstractFuncEq.differentiableAt_\u039b (L411-L423)\ntheorem differentiableAt_\u039b {s : \u2102} (hs : s \u2260 0 \u2228 P.f\u2080 = 0) (hs' : s \u2260 P.k \u2228 P.g\u2080 = 0) :\n DifferentiableAt \u2102 P.\u039b s := by\nrefine ((P.differentiable_\u039b\u2080 s).sub ?_).sub ?_\n \u00b7 rcases hs with hs | hs\n \u00b7 simpa using (differentiableAt_inv hs).smul_const _\n \u00b7 simp [hs]\n \u00b7 rcases hs' with hs' | hs'\n \u00b7 apply DifferentiableAt.smul_const\n apply (differentiableAt_const _).div ((differentiableAt_const _).sub (differentiable_id _))\n simpa [sub_eq_zero, eq_comm]\n \u00b7 simp [hs']\n\n/-- Relation between `\u039b s` and the Mellin transform of `f - f\u2080`, where the latter is defined. -/\n```\n\n-- snippet 90\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.term_zero (L88-L90)\nlemma term_zero (f : \u2115 \u2192 \u2102) (s : \u2102) : term f s 0 = 0 := rfl\n-- We put `hn` first for convenience, so that we can write `rw [LSeries.term_of_ne_zero hn]` etc.\n```\n\n-- snippet 91\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.LSeriesHasSum_congr (L231-L234)\nlemma LSeriesHasSum_congr {f g : \u2115 \u2192 \u2102} (s a : \u2102) (h : \u2200 {n}, n \u2260 0 \u2192 f n = g n) :\n LSeriesHasSum f s a \u2194 LSeriesHasSum g s a := by\nsimp [LSeriesHasSum_iff, LSeriesSummable_congr s h, LSeries_congr h s]\n```\n\n-- snippet 92\n```lean\n-- Mathlib.NumberTheory.LSeries.Basic.term_of_ne_zero' (L100-L105)\nlemma term_of_ne_zero' {s : \u2102} (hs : s \u2260 0) (f : \u2115 \u2192 \u2102) (n : \u2115) :\n term f s n = f n / n ^ s := by\nrcases eq_or_ne n 0 with rfl | hn\n \u00b7 rw [term_zero, Nat.cast_zero, zero_cpow hs, div_zero]\n \u00b7 rw [term_of_ne_zero hn]\n```\n[/INST]", "sample_id": "C-Mathlib.NumberTheory.LSeries.Convergence.LSeriesSummable", "source": {"declaration": "Mathlib.NumberTheory.LSeries.Convergence.LSeriesSummable", "file": "Mathlib/NumberTheory/LSeries/Convergence.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.NumberTheory.LSeries.Convergence", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/NumberTheory/LSeries/Convergence.lean#L58", "span": "L58-L61"}} {"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 trace_eq_zero_of_mapsTo_ne (h : IsInternal N) [IsNoetherian R M]\n (\u03c3 : \u03b9 \u2192 \u03b9) (h\u03c3 : \u2200 i, \u03c3 i \u2260 i) {f : Module.End R M}\n (hf : \u2200 i, MapsTo f (N i) (N <| \u03c3 i)) :\n trace R M f = 0", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 712, "declarations_count": 74, "diagnostics_count": 0, "duplicate_fingerprint": "3f29e23590bfcb9f", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 958, "lean_code_chars": 192, "lean_code_ratio": 0.2697, "length_bucket": "short", "line_count": 10, "natural_language_chars": 520, "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.Algebra.DirectSum.LinearMap).", "role": "system"}, {"content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\nOpen namespaces: DirectSum, Module, Set\n\n## Surrounding context in Mathlib/Algebra/DirectSum/LinearMap.lean\n```lean\n-- Mathlib.Algebra.DirectSum.LinearMap.toMatrix_directSum_collectedBasis_eq_blockDiagonal' (L35-L48)\nlemma toMatrix_directSum_collectedBasis_eq_blockDiagonal' {R M\u2081 M\u2082 : Type*} [CommSemiring R]\n [AddCommMonoid M\u2081] [Module R M\u2081] {N\u2081 : \u03b9 \u2192 Submodule R M\u2081} (h\u2081 : IsInternal N\u2081)\n [AddCommMonoid M\u2082] [Module R M\u2082] {N\u2082 : \u03b9 \u2192 Submodule R M\u2082} (h\u2082 : IsInternal N\u2082)\n {\u03ba\u2081 \u03ba\u2082 : \u03b9 \u2192 Type*} [\u2200 i, Fintype (\u03ba\u2081 i)] [\u2200 i, Finite (\u03ba\u2082 i)] [\u2200 i, DecidableEq (\u03ba\u2081 i)]\n [Fintype \u03b9] (b\u2081 : (i : \u03b9) \u2192 Basis (\u03ba\u2081 i) R (N\u2081 i)) (b\u2082 : (i : \u03b9) \u2192 Basis (\u03ba\u2082 i) R (N\u2082 i))\n {f : M\u2081 \u2192\u2097[R] M\u2082} (hf : \u2200 i, MapsTo f (N\u2081 i) (N\u2082 i)) :\n toMatrix (h\u2081.collectedBasis b\u2081) (h\u2082.collectedBasis b\u2082) f =\n Matrix.blockDiagonal' fun i \u21a6 toMatrix (b\u2081 i) (b\u2082 i) (f.restrict (hf i))\n\n-- Mathlib.Algebra.DirectSum.LinearMap.diag_toMatrix_directSum_collectedBasis_eq_zero_of_mapsTo_ne (L49-L68)\nlemma diag_toMatrix_directSum_collectedBasis_eq_zero_of_mapsTo_ne\n {\u03ba : \u03b9 \u2192 Type*} [\u2200 i, Fintype (\u03ba i)] [\u2200 i, DecidableEq (\u03ba i)]\n {s : Finset \u03b9} (h : IsInternal fun i : s \u21a6 N i)\n (b : (i : s) \u2192 Basis (\u03ba i) R (N i)) (\u03c3 : \u03b9 \u2192 \u03b9) (h\u03c3 : \u2200 i, \u03c3 i \u2260 i)\n {f : Module.End R M} (hf : \u2200 i, MapsTo f (N i) (N <| \u03c3 i)) (hN : \u2200 i, i \u2209 s \u2192 N i = \u22a5) :\n Matrix.diag (toMatrix (h.collectedBasis b) (h.collectedBasis b) f) = 0\n\n-- Mathlib.Algebra.DirectSum.LinearMap.trace_eq_sum_trace_restrict (L69-L76)\nlemma trace_eq_sum_trace_restrict (h : IsInternal N) [Fintype \u03b9]\n {f : M \u2192\u2097[R] M} (hf : \u2200 i, MapsTo f (N i) (N i)) :\n trace R M f = \u2211 i, trace R (N i) (f.restrict (hf i))\n```\n\nRelevant lemmas available in scope: `hN`\n\n```lean\nlemma trace_eq_zero_of_mapsTo_ne (h : IsInternal N) [IsNoetherian R M]\n (\u03c3 : \u03b9 \u2192 \u03b9) (h\u03c3 : \u2200 i, \u03c3 i \u2260 i) {f : Module.End R M}\n (hf : \u2200 i, MapsTo f (N i) (N <| \u03c3 i)) :\n trace R M f = 0\n```\n\nDeclaration: `Mathlib.Algebra.DirectSum.LinearMap.trace_eq_zero_of_mapsTo_ne` (module Mathlib.Algebra.DirectSum.LinearMap).", "role": "user"}], "rendered_text": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Algebra.DirectSum.LinearMap).\n\nExplain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\nOpen namespaces: DirectSum, Module, Set\n\n## Surrounding context in Mathlib/Algebra/DirectSum/LinearMap.lean\n```lean\n-- Mathlib.Algebra.DirectSum.LinearMap.toMatrix_directSum_collectedBasis_eq_blockDiagonal' (L35-L48)\nlemma toMatrix_directSum_collectedBasis_eq_blockDiagonal' {R M\u2081 M\u2082 : Type*} [CommSemiring R]\n [AddCommMonoid M\u2081] [Module R M\u2081] {N\u2081 : \u03b9 \u2192 Submodule R M\u2081} (h\u2081 : IsInternal N\u2081)\n [AddCommMonoid M\u2082] [Module R M\u2082] {N\u2082 : \u03b9 \u2192 Submodule R M\u2082} (h\u2082 : IsInternal N\u2082)\n {\u03ba\u2081 \u03ba\u2082 : \u03b9 \u2192 Type*} [\u2200 i, Fintype (\u03ba\u2081 i)] [\u2200 i, Finite (\u03ba\u2082 i)] [\u2200 i, DecidableEq (\u03ba\u2081 i)]\n [Fintype \u03b9] (b\u2081 : (i : \u03b9) \u2192 Basis (\u03ba\u2081 i) R (N\u2081 i)) (b\u2082 : (i : \u03b9) \u2192 Basis (\u03ba\u2082 i) R (N\u2082 i))\n {f : M\u2081 \u2192\u2097[R] M\u2082} (hf : \u2200 i, MapsTo f (N\u2081 i) (N\u2082 i)) :\n toMatrix (h\u2081.collectedBasis b\u2081) (h\u2082.collectedBasis b\u2082) f =\n Matrix.blockDiagonal' fun i \u21a6 toMatrix (b\u2081 i) (b\u2082 i) (f.restrict (hf i))\n\n-- Mathlib.Algebra.DirectSum.LinearMap.diag_toMatrix_directSum_collectedBasis_eq_zero_of_mapsTo_ne (L49-L68)\nlemma diag_toMatrix_directSum_collectedBasis_eq_zero_of_mapsTo_ne\n {\u03ba : \u03b9 \u2192 Type*} [\u2200 i, Fintype (\u03ba i)] [\u2200 i, DecidableEq (\u03ba i)]\n {s : Finset \u03b9} (h : IsInternal fun i : s \u21a6 N i)\n (b : (i : s) \u2192 Basis (\u03ba i) R (N i)) (\u03c3 : \u03b9 \u2192 \u03b9) (h\u03c3 : \u2200 i, \u03c3 i \u2260 i)\n {f : Module.End R M} (hf : \u2200 i, MapsTo f (N i) (N <| \u03c3 i)) (hN : \u2200 i, i \u2209 s \u2192 N i = \u22a5) :\n Matrix.diag (toMatrix (h.collectedBasis b) (h.collectedBasis b) f) = 0\n\n-- Mathlib.Algebra.DirectSum.LinearMap.trace_eq_sum_trace_restrict (L69-L76)\nlemma trace_eq_sum_trace_restrict (h : IsInternal N) [Fintype \u03b9]\n {f : M \u2192\u2097[R] M} (hf : \u2200 i, MapsTo f (N i) (N i)) :\n trace R M f = \u2211 i, trace R (N i) (f.restrict (hf i))\n```\n\nRelevant lemmas available in scope: `hN`\n\n```lean\nlemma trace_eq_zero_of_mapsTo_ne (h : IsInternal N) [IsNoetherian R M]\n (\u03c3 : \u03b9 \u2192 \u03b9) (h\u03c3 : \u2200 i, \u03c3 i \u2260 i) {f : Module.End R M}\n (hf : \u2200 i, MapsTo f (N i) (N <| \u03c3 i)) :\n trace R M f = 0\n```\n\nDeclaration: `Mathlib.Algebra.DirectSum.LinearMap.trace_eq_zero_of_mapsTo_ne` (module Mathlib.Algebra.DirectSum.LinearMap).", "sample_id": "F-Mathlib.Algebra.DirectSum.LinearMap.trace_eq_zero_of_mapsTo_ne", "source": {"declaration": "Mathlib.Algebra.DirectSum.LinearMap.trace_eq_zero_of_mapsTo_ne", "file": "Mathlib/Algebra/DirectSum/LinearMap.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Algebra.DirectSum.LinearMap", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/DirectSum/LinearMap.lean#L85", "span": "L85-L102"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"context_enriched": true, "excerpt": "```lean\ntheorem exists_lt_lowerSemicontinuous_integral_gt_nnreal [SigmaFinite \u03bc] (f : \u03b1 \u2192 \u211d\u22650)\n (fint : Integrable (fun x => (f x : \u211d)) \u03bc) {\u03b5 : \u211d} (\u03b5pos : 0 < \u03b5) :\n \u2203 g : \u03b1 \u2192 \u211d\u22650\u221e,\n (\u2200 x, (f x : \u211d\u22650\u221e) < g x) \u2227\n LowerSemicontinuous g \u2227\n (\u2200\u1d50 x \u2202\u03bc, g x < \u22a4) \u2227\n Integrable (fun x => (g x).toReal) \u03bc \u2227 (\u222b x, (g x).toReal \u2202\u03bc) < (\u222b x, \u2191(f x) \u2202\u03bc) + \u03b5 := by\nhave fmeas : AEMeasurable f \u03bc := by\n convert fint.aestronglyMeasurable.real_toNNReal.aemeasurable\n simp only [Real.toNNReal_coe]\n lift \u03b5 to \u211d\u22650 using \u03b5pos.le\n obtain \u27e8\u03b4, \u03b4pos, h\u03b4\u03b5\u27e9 : \u2203 \u03b4 : \u211d\u22650, 0 < \u03b4 \u2227 \u03b4 < \u03b5 := exists_between \u03b5pos\n have int_f_ne_top : (\u222b\u207b a : \u03b1, f a \u2202\u03bc) \u2260 \u221e :=\n (hasFiniteIntegral_iff_ofNNReal.1 fint.hasFiniteIntegral).ne\n rcases exists_lt_lowerSemicontinuous_lintegral_ge_of_aemeasurable \u03bc f fmeas\n (ENNReal.coe_ne_zero.2 \u03b4pos.ne') with\n \u27e8g, f_lt_g, gcont, gint\u27e9\n have gint_ne : (\u222b\u207b x : \u03b1, g x \u2202\u03bc) \u2260 \u221e := ne_top_of_le_ne_top (by simpa) gint\n have g_lt_top : \u2200\u1d50 x : \u03b1 \u2202\u03bc, g x < \u221e := ae_lt_top gcont.measurable gint_ne\n have Ig : (\u222b\u207b a : \u03b1, ENNReal.ofReal (g a).toReal \u2202\u03bc) = \u222b\u207b a : \u03b1, g a \u2202\u03bc := by\n apply lintegral_congr_ae\n filter_upwards [g_lt_top] with _ hx\n simp only [hx.ne, ENNReal.ofReal_toReal, Ne, not_false_iff]\n refine \u27e8g, f_lt_g, gcont, g_lt_top, ?_, ?_\u27e9\n \u00b7 refine \u27e8gcont.measurable.ennreal_toReal.aemeasurable.aestronglyMeasurable, ?_\u27e9\n simp only [hasFiniteIntegral_iff_norm, Real.norm_eq_abs, abs_of_nonneg ENNReal.toReal_nonneg]\n convert gint_ne.lt_top using 1\n \u00b7 rw [integral_eq_lintegral_of_nonneg_ae, integral_eq_lintegral_of_nonneg_ae]\n \u00b7 calc\n ENNReal.toReal (\u222b\u207b a : \u03b1, ENNReal.ofReal (g a).toReal \u2202\u03bc) =\n ENNReal.toReal (\u222b\u207b a : \u03b1, g a \u2202\u03bc) := by congr 1\n _ \u2264 ENNReal.toReal ((\u222b\u207b a : \u03b1, f a \u2202\u03bc) + \u03b4) := by\n apply ENNReal.toReal_mono _ gint\n simpa using int_f_ne_top\n _ = ENNReal.toReal (\u222b\u207b a : \u03b1, f a \u2202\u03bc) + \u03b4 := by\n rw [ENNReal.toReal_add int_f_ne_top ENNReal.coe_ne_top, ENNReal.coe_toReal]\n _ < ENNReal.toReal (\u222b\u207b a : \u03b1, f a \u2202\u03bc) + \u03b5 := by gcongr\n _ = (\u222b\u207b a : \u03b1, ENNReal.ofReal \u2191(f a) \u2202\u03bc).toReal + \u03b5 := by simp\n \u00b7 apply Filter.Eventually.of_forall fun x => _; simp\n \u00b7 exact fmeas.coe_nnreal_real.aestronglyMeasurable\n \u00b7 apply Filter.Eventually.of_forall fun x => _; simp\n \u00b7 apply gcont.measurable.ennreal_toReal.aemeasurable.aestronglyMeasurable\n\n/-! ### Upper semicontinuous lower bound for nonnegative functions -/\n\n\n/-- Given a simple function `f` with values in `\u211d\u22650`, there exists an upper semicontinuous\nfunction `g \u2264 f` with integral arbitrarily close to that of `f`. Formulation in terms of\n`lintegral`.\nAuxiliary lemma for Vitali-Carath\u00e9odory theorem `exists_lt_lower_semicontinuous_integral_lt`. -/\n```", "instruction": "Edit `exists_lt_lowerSemicontinuous_integral_gt_nnreal` so it still compiles and the proof is simplified where possible. Return the full updated `exists_lt_lowerSemicontinuous_integral_gt_nnreal` block.", "proof_is_oneliner": false, "source_grounded_context_enriched": true, "target_span": "L262-L311", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 3631, "declarations_count": 325, "diagnostics_count": 0, "duplicate_fingerprint": "47b8e7025414dc98", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 2053, "lean_code_chars": 2742, "lean_code_ratio": 0.7552, "length_bucket": "medium", "line_count": 59, "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.MeasureTheory.Integral.Bochner.VitaliCaratheodory).", "role": "system"}, {"content": "You are editing a file in `Mathlib/MeasureTheory/Integral/Bochner/VitaliCaratheodory.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.MeasureTheory.Integral.Bochner.VitaliCaratheodory.exists_lt_lowerSemicontinuous_integral_gt_nnreal`, L262-L311)\nOpen namespaces: scoped, ENNReal, NNReal, MeasureTheory, MeasureTheory.Measure, SimpleFunc, in\n\n## Surrounding context in Mathlib/MeasureTheory/Integral/Bochner/VitaliCaratheodory.lean\n```lean\n-- Mathlib.MeasureTheory.Integral.Bochner.VitaliCaratheodory.SimpleFunc (L95-L161)\ntheorem SimpleFunc.exists_le_lowerSemicontinuous_lintegral_ge (f : \u03b1 \u2192\u209b \u211d\u22650) {\u03b5 : \u211d\u22650\u221e}\n (\u03b50 : \u03b5 \u2260 0) :\n \u2203 g : \u03b1 \u2192 \u211d\u22650, (\u2200 x, f x \u2264 g x) \u2227 LowerSemicontinuous g \u2227\n (\u222b\u207b x, g x \u2202\u03bc) \u2264 (\u222b\u207b x, f x \u2202\u03bc) + \u03b5\n\n-- Mathlib.MeasureTheory.Integral.Bochner.VitaliCaratheodory.exists_le_lowerSemicontinuous_lintegral_ge (L162-L198)\ntheorem exists_le_lowerSemicontinuous_lintegral_ge (f : \u03b1 \u2192 \u211d\u22650\u221e) (hf : Measurable f) {\u03b5 : \u211d\u22650\u221e}\n (\u03b5pos : \u03b5 \u2260 0) :\n \u2203 g : \u03b1 \u2192 \u211d\u22650\u221e,\n (\u2200 x, f x \u2264 g x) \u2227 LowerSemicontinuous g \u2227 (\u222b\u207b x, g x \u2202\u03bc) \u2264 (\u222b\u207b x, f x \u2202\u03bc) + \u03b5\n\n-- Mathlib.MeasureTheory.Integral.Bochner.VitaliCaratheodory.exists_lt_lowerSemicontinuous_lintegral_ge (L199-L224)\ntheorem exists_lt_lowerSemicontinuous_lintegral_ge [SigmaFinite \u03bc] (f : \u03b1 \u2192 \u211d\u22650)\n (fmeas : Measurable f) {\u03b5 : \u211d\u22650\u221e} (\u03b50 : \u03b5 \u2260 0) :\n \u2203 g : \u03b1 \u2192 \u211d\u22650\u221e,\n (\u2200 x, (f x : \u211d\u22650\u221e) < g x) \u2227 LowerSemicontinuous g \u2227 (\u222b\u207b x, g x \u2202\u03bc) \u2264 (\u222b\u207b x, f x \u2202\u03bc) + \u03b5\n```\n\nRelevant lemmas available in scope: `fmeas`, `int_f_ne_top`, `gint_ne`, `g_lt_top`, `Ig`, `lintegral_congr_ae`, `ENNReal.toReal_mono`, `Filter.Eventually.of_forall`\n\n```lean\ntheorem exists_lt_lowerSemicontinuous_integral_gt_nnreal [SigmaFinite \u03bc] (f : \u03b1 \u2192 \u211d\u22650)\n (fint : Integrable (fun x => (f x : \u211d)) \u03bc) {\u03b5 : \u211d} (\u03b5pos : 0 < \u03b5) :\n \u2203 g : \u03b1 \u2192 \u211d\u22650\u221e,\n (\u2200 x, (f x : \u211d\u22650\u221e) < g x) \u2227\n LowerSemicontinuous g \u2227\n (\u2200\u1d50 x \u2202\u03bc, g x < \u22a4) \u2227\n Integrable (fun x => (g x).toReal) \u03bc \u2227 (\u222b x, (g x).toReal \u2202\u03bc) < (\u222b x, \u2191(f x) \u2202\u03bc) + \u03b5 := by\nhave fmeas : AEMeasurable f \u03bc := by\n convert fint.aestronglyMeasurable.real_toNNReal.aemeasurable\n simp only [Real.toNNReal_coe]\n lift \u03b5 to \u211d\u22650 using \u03b5pos.le\n obtain \u27e8\u03b4, \u03b4pos, h\u03b4\u03b5\u27e9 : \u2203 \u03b4 : \u211d\u22650, 0 < \u03b4 \u2227 \u03b4 < \u03b5 := exists_between \u03b5pos\n have int_f_ne_top : (\u222b\u207b a : \u03b1, f a \u2202\u03bc) \u2260 \u221e :=\n (hasFiniteIntegral_iff_ofNNReal.1 fint.hasFiniteIntegral).ne\n rcases exists_lt_lowerSemicontinuous_lintegral_ge_of_aemeasurable \u03bc f fmeas\n (ENNReal.coe_ne_zero.2 \u03b4pos.ne') with\n \u27e8g, f_lt_g, gcont, gint\u27e9\n have gint_ne : (\u222b\u207b x : \u03b1, g x \u2202\u03bc) \u2260 \u221e := ne_top_of_le_ne_top (by simpa) gint\n have g_lt_top : \u2200\u1d50 x : \u03b1 \u2202\u03bc, g x < \u221e := ae_lt_top gcont.measurable gint_ne\n have Ig : (\u222b\u207b a : \u03b1, ENNReal.ofReal (g a).toReal \u2202\u03bc) = \u222b\u207b a : \u03b1, g a \u2202\u03bc := by\n apply lintegral_congr_ae\n filter_upwards [g_lt_top] with _ hx\n simp only [hx.ne, ENNReal.ofReal_toReal, Ne, not_false_iff]\n refine \u27e8g, f_lt_g, gcont, g_lt_top, ?_, ?_\u27e9\n \u00b7 refine \u27e8gcont.measurable.ennreal_toReal.aemeasurable.aestronglyMeasurable, ?_\u27e9\n simp only [hasFiniteIntegral_iff_norm, Real.norm_eq_abs, abs_of_nonneg ENNReal.toReal_nonneg]\n convert gint_ne.lt_top using 1\n \u00b7 rw [integral_eq_lintegral_of_nonneg_ae, integral_eq_lintegral_of_nonneg_ae]\n \u00b7 calc\n ENNReal.toReal (\u222b\u207b a : \u03b1, ENNReal.ofReal (g a).toReal \u2202\u03bc) =\n ENNReal.toReal (\u222b\u207b a : \u03b1, g a \u2202\u03bc) := by congr 1\n _ \u2264 ENNReal.toReal ((\u222b\u207b a : \u03b1, f a \u2202\u03bc) + \u03b4) := by\n apply ENNReal.toReal_mono _ gint\n simpa using int_f_ne_top\n _ = ENNReal.toReal (\u222b\u207b a : \u03b1, f a \u2202\u03bc) + \u03b4 := by\n rw [ENNReal.toReal_add int_f_ne_top ENNReal.coe_ne_top, ENNReal.coe_toReal]\n _ < ENNReal.toReal (\u222b\u207b a : \u03b1, f a \u2202\u03bc) + \u03b5 := by gcongr\n _ = (\u222b\u207b a : \u03b1, ENNReal.ofReal \u2191(f a) \u2202\u03bc).toReal + \u03b5 := by simp\n \u00b7 apply Filter.Eventually.of_forall fun x => _; simp\n \u00b7 exact fmeas.coe_nnreal_real.aestronglyMeasurable\n \u00b7 apply Filter.Eventually.of_forall fun x => _; simp\n \u00b7 apply gcont.measurable.ennreal_toReal.aemeasurable.aestronglyMeasurable\n\n/-! ### Upper semicontinuous lower bound for nonnegative functions -/\n\n\n/-- Given a simple function `f` with values in `\u211d\u22650`, there exists an upper semicontinuous\nfunction `g \u2264 f` with integral arbitrarily close to that of `f`. Formulation in terms of\n`lintegral`.\nAuxiliary lemma for Vitali-Carath\u00e9odory theorem `exists_lt_lower_semicontinuous_integral_lt`. -/\n```\n\n## Edit instruction\nEdit `exists_lt_lowerSemicontinuous_integral_gt_nnreal` so it still compiles and the proof is simplified where possible. Return the full updated `exists_lt_lowerSemicontinuous_integral_gt_nnreal` 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.MeasureTheory.Integral.Bochner.VitaliCaratheodory).\n\nYou are editing a file in `Mathlib/MeasureTheory/Integral/Bochner/VitaliCaratheodory.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.MeasureTheory.Integral.Bochner.VitaliCaratheodory.exists_lt_lowerSemicontinuous_integral_gt_nnreal`, L262-L311)\nOpen namespaces: scoped, ENNReal, NNReal, MeasureTheory, MeasureTheory.Measure, SimpleFunc, in\n\n## Surrounding context in Mathlib/MeasureTheory/Integral/Bochner/VitaliCaratheodory.lean\n```lean\n-- Mathlib.MeasureTheory.Integral.Bochner.VitaliCaratheodory.SimpleFunc (L95-L161)\ntheorem SimpleFunc.exists_le_lowerSemicontinuous_lintegral_ge (f : \u03b1 \u2192\u209b \u211d\u22650) {\u03b5 : \u211d\u22650\u221e}\n (\u03b50 : \u03b5 \u2260 0) :\n \u2203 g : \u03b1 \u2192 \u211d\u22650, (\u2200 x, f x \u2264 g x) \u2227 LowerSemicontinuous g \u2227\n (\u222b\u207b x, g x \u2202\u03bc) \u2264 (\u222b\u207b x, f x \u2202\u03bc) + \u03b5\n\n-- Mathlib.MeasureTheory.Integral.Bochner.VitaliCaratheodory.exists_le_lowerSemicontinuous_lintegral_ge (L162-L198)\ntheorem exists_le_lowerSemicontinuous_lintegral_ge (f : \u03b1 \u2192 \u211d\u22650\u221e) (hf : Measurable f) {\u03b5 : \u211d\u22650\u221e}\n (\u03b5pos : \u03b5 \u2260 0) :\n \u2203 g : \u03b1 \u2192 \u211d\u22650\u221e,\n (\u2200 x, f x \u2264 g x) \u2227 LowerSemicontinuous g \u2227 (\u222b\u207b x, g x \u2202\u03bc) \u2264 (\u222b\u207b x, f x \u2202\u03bc) + \u03b5\n\n-- Mathlib.MeasureTheory.Integral.Bochner.VitaliCaratheodory.exists_lt_lowerSemicontinuous_lintegral_ge (L199-L224)\ntheorem exists_lt_lowerSemicontinuous_lintegral_ge [SigmaFinite \u03bc] (f : \u03b1 \u2192 \u211d\u22650)\n (fmeas : Measurable f) {\u03b5 : \u211d\u22650\u221e} (\u03b50 : \u03b5 \u2260 0) :\n \u2203 g : \u03b1 \u2192 \u211d\u22650\u221e,\n (\u2200 x, (f x : \u211d\u22650\u221e) < g x) \u2227 LowerSemicontinuous g \u2227 (\u222b\u207b x, g x \u2202\u03bc) \u2264 (\u222b\u207b x, f x \u2202\u03bc) + \u03b5\n```\n\nRelevant lemmas available in scope: `fmeas`, `int_f_ne_top`, `gint_ne`, `g_lt_top`, `Ig`, `lintegral_congr_ae`, `ENNReal.toReal_mono`, `Filter.Eventually.of_forall`\n\n```lean\ntheorem exists_lt_lowerSemicontinuous_integral_gt_nnreal [SigmaFinite \u03bc] (f : \u03b1 \u2192 \u211d\u22650)\n (fint : Integrable (fun x => (f x : \u211d)) \u03bc) {\u03b5 : \u211d} (\u03b5pos : 0 < \u03b5) :\n \u2203 g : \u03b1 \u2192 \u211d\u22650\u221e,\n (\u2200 x, (f x : \u211d\u22650\u221e) < g x) \u2227\n LowerSemicontinuous g \u2227\n (\u2200\u1d50 x \u2202\u03bc, g x < \u22a4) \u2227\n Integrable (fun x => (g x).toReal) \u03bc \u2227 (\u222b x, (g x).toReal \u2202\u03bc) < (\u222b x, \u2191(f x) \u2202\u03bc) + \u03b5 := by\nhave fmeas : AEMeasurable f \u03bc := by\n convert fint.aestronglyMeasurable.real_toNNReal.aemeasurable\n simp only [Real.toNNReal_coe]\n lift \u03b5 to \u211d\u22650 using \u03b5pos.le\n obtain \u27e8\u03b4, \u03b4pos, h\u03b4\u03b5\u27e9 : \u2203 \u03b4 : \u211d\u22650, 0 < \u03b4 \u2227 \u03b4 < \u03b5 := exists_between \u03b5pos\n have int_f_ne_top : (\u222b\u207b a : \u03b1, f a \u2202\u03bc) \u2260 \u221e :=\n (hasFiniteIntegral_iff_ofNNReal.1 fint.hasFiniteIntegral).ne\n rcases exists_lt_lowerSemicontinuous_lintegral_ge_of_aemeasurable \u03bc f fmeas\n (ENNReal.coe_ne_zero.2 \u03b4pos.ne') with\n \u27e8g, f_lt_g, gcont, gint\u27e9\n have gint_ne : (\u222b\u207b x : \u03b1, g x \u2202\u03bc) \u2260 \u221e := ne_top_of_le_ne_top (by simpa) gint\n have g_lt_top : \u2200\u1d50 x : \u03b1 \u2202\u03bc, g x < \u221e := ae_lt_top gcont.measurable gint_ne\n have Ig : (\u222b\u207b a : \u03b1, ENNReal.ofReal (g a).toReal \u2202\u03bc) = \u222b\u207b a : \u03b1, g a \u2202\u03bc := by\n apply lintegral_congr_ae\n filter_upwards [g_lt_top] with _ hx\n simp only [hx.ne, ENNReal.ofReal_toReal, Ne, not_false_iff]\n refine \u27e8g, f_lt_g, gcont, g_lt_top, ?_, ?_\u27e9\n \u00b7 refine \u27e8gcont.measurable.ennreal_toReal.aemeasurable.aestronglyMeasurable, ?_\u27e9\n simp only [hasFiniteIntegral_iff_norm, Real.norm_eq_abs, abs_of_nonneg ENNReal.toReal_nonneg]\n convert gint_ne.lt_top using 1\n \u00b7 rw [integral_eq_lintegral_of_nonneg_ae, integral_eq_lintegral_of_nonneg_ae]\n \u00b7 calc\n ENNReal.toReal (\u222b\u207b a : \u03b1, ENNReal.ofReal (g a).toReal \u2202\u03bc) =\n ENNReal.toReal (\u222b\u207b a : \u03b1, g a \u2202\u03bc) := by congr 1\n _ \u2264 ENNReal.toReal ((\u222b\u207b a : \u03b1, f a \u2202\u03bc) + \u03b4) := by\n apply ENNReal.toReal_mono _ gint\n simpa using int_f_ne_top\n _ = ENNReal.toReal (\u222b\u207b a : \u03b1, f a \u2202\u03bc) + \u03b4 := by\n rw [ENNReal.toReal_add int_f_ne_top ENNReal.coe_ne_top, ENNReal.coe_toReal]\n _ < ENNReal.toReal (\u222b\u207b a : \u03b1, f a \u2202\u03bc) + \u03b5 := by gcongr\n _ = (\u222b\u207b a : \u03b1, ENNReal.ofReal \u2191(f a) \u2202\u03bc).toReal + \u03b5 := by simp\n \u00b7 apply Filter.Eventually.of_forall fun x => _; simp\n \u00b7 exact fmeas.coe_nnreal_real.aestronglyMeasurable\n \u00b7 apply Filter.Eventually.of_forall fun x => _; simp\n \u00b7 apply gcont.measurable.ennreal_toReal.aemeasurable.aestronglyMeasurable\n\n/-! ### Upper semicontinuous lower bound for nonnegative functions -/\n\n\n/-- Given a simple function `f` with values in `\u211d\u22650`, there exists an upper semicontinuous\nfunction `g \u2264 f` with integral arbitrarily close to that of `f`. Formulation in terms of\n`lintegral`.\nAuxiliary lemma for Vitali-Carath\u00e9odory theorem `exists_lt_lower_semicontinuous_integral_lt`. -/\n```\n\n## Edit instruction\nEdit `exists_lt_lowerSemicontinuous_integral_gt_nnreal` so it still compiles and the proof is simplified where possible. Return the full updated `exists_lt_lowerSemicontinuous_integral_gt_nnreal` block.\n", "sample_id": "D-Mathlib.MeasureTheory.Integral.Bochner.VitaliCaratheodory.exists_lt_lowerSemicontinuous_integral_gt_nnreal", "source": {"declaration": "Mathlib.MeasureTheory.Integral.Bochner.VitaliCaratheodory.exists_lt_lowerSemicontinuous_integral_gt_nnreal", "file": "Mathlib/MeasureTheory/Integral/Bochner/VitaliCaratheodory.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.MeasureTheory.Integral.Bochner.VitaliCaratheodory", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Integral/Bochner/VitaliCaratheodory.lean#L262", "span": "L262-L311"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"context_enriched": true, "source_grounded_context_enriched": true, "statement": "theorem map (hf : f.IsWeaklyEisensteinAt \ud835\udcdf) {A : Type v} [CommSemiring A] (\u03c6 : R \u2192+* A) :\n (f.map \u03c6).IsWeaklyEisensteinAt (\ud835\udcdf.map \u03c6)", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 557, "declarations_count": 60, "diagnostics_count": 0, "duplicate_fingerprint": "74c2bdb743216937", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 621, "lean_code_chars": 135, "lean_code_ratio": 0.2424, "length_bucket": "short", "line_count": 8, "natural_language_chars": 422, "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.RingTheory.Polynomial.Eisenstein.Basic).", "role": "system"}, {"content": "Complete the following proof.\n\nOpen namespaces: Ideal, Algebra, Finset, Polynomial\n\n## Surrounding context in Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean\n```lean\n-- Mathlib.RingTheory.Polynomial.Eisenstein.Basic.mul (L72-L97)\ntheorem mul (hf : f.IsWeaklyEisensteinAt \ud835\udcdf) (hf' : f'.IsWeaklyEisensteinAt \ud835\udcdf) :\n (f * f').IsWeaklyEisensteinAt \ud835\udcdf\n\n-- Mathlib.RingTheory.Polynomial.Eisenstein.Basic.exists_mem_adjoin_mul_eq_pow_natDegree (L98-L123)\ntheorem exists_mem_adjoin_mul_eq_pow_natDegree {x : S} (hx : aeval x f = 0) (hmo : f.Monic)\n (hf : f.IsWeaklyEisensteinAt (Submodule.span R {p})) : \u2203 y \u2208 adjoin R ({x} : Set S),\n (algebraMap R S) p * y = x ^ (f.map (algebraMap R S)).natDegree\n\n-- Mathlib.RingTheory.Polynomial.Eisenstein.Basic.exists_mem_adjoin_mul_eq_pow_natDegree_le (L124-L137)\ntheorem exists_mem_adjoin_mul_eq_pow_natDegree_le {x : S} (hx : aeval x f = 0) (hmo : f.Monic)\n (hf : f.IsWeaklyEisensteinAt (Submodule.span R {p})) :\n \u2200 i, (f.map (algebraMap R S)).natDegree \u2264 i \u2192\n \u2203 y \u2208 adjoin R ({x} : Set S), (algebraMap R S) p * y = x ^ i\n```\n\nRelevant lemmas available in scope: `mem_map_of_mem`\n\n```lean\ntheorem map (hf : f.IsWeaklyEisensteinAt \ud835\udcdf) {A : Type v} [CommSemiring A] (\u03c6 : R \u2192+* A) :\n (f.map \u03c6).IsWeaklyEisensteinAt (\ud835\udcdf.map \u03c6)\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.RingTheory.Polynomial.Eisenstein.Basic).\n\nComplete the following proof.\n\nOpen namespaces: Ideal, Algebra, Finset, Polynomial\n\n## Surrounding context in Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean\n```lean\n-- Mathlib.RingTheory.Polynomial.Eisenstein.Basic.mul (L72-L97)\ntheorem mul (hf : f.IsWeaklyEisensteinAt \ud835\udcdf) (hf' : f'.IsWeaklyEisensteinAt \ud835\udcdf) :\n (f * f').IsWeaklyEisensteinAt \ud835\udcdf\n\n-- Mathlib.RingTheory.Polynomial.Eisenstein.Basic.exists_mem_adjoin_mul_eq_pow_natDegree (L98-L123)\ntheorem exists_mem_adjoin_mul_eq_pow_natDegree {x : S} (hx : aeval x f = 0) (hmo : f.Monic)\n (hf : f.IsWeaklyEisensteinAt (Submodule.span R {p})) : \u2203 y \u2208 adjoin R ({x} : Set S),\n (algebraMap R S) p * y = x ^ (f.map (algebraMap R S)).natDegree\n\n-- Mathlib.RingTheory.Polynomial.Eisenstein.Basic.exists_mem_adjoin_mul_eq_pow_natDegree_le (L124-L137)\ntheorem exists_mem_adjoin_mul_eq_pow_natDegree_le {x : S} (hx : aeval x f = 0) (hmo : f.Monic)\n (hf : f.IsWeaklyEisensteinAt (Submodule.span R {p})) :\n \u2200 i, (f.map (algebraMap R S)).natDegree \u2264 i \u2192\n \u2203 y \u2208 adjoin R ({x} : Set S), (algebraMap R S) p * y = x ^ i\n```\n\nRelevant lemmas available in scope: `mem_map_of_mem`\n\n```lean\ntheorem map (hf : f.IsWeaklyEisensteinAt \ud835\udcdf) {A : Type v} [CommSemiring A] (\u03c6 : R \u2192+* A) :\n (f.map \u03c6).IsWeaklyEisensteinAt (\ud835\udcdf.map \u03c6)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "sample_id": "A-Mathlib.RingTheory.Polynomial.Eisenstein.Basic.map", "source": {"declaration": "Mathlib.RingTheory.Polynomial.Eisenstein.Basic.map", "file": "Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.RingTheory.Polynomial.Eisenstein.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean#L66", "span": "L66-L71"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.Analysis.SpecificLimits.Basic.NNRat (L35-L37)\ntheorem NNRat.tendsto_inv_atTop_nhds_zero_nat : Tendsto (fun n : \u2115 \u21a6 (n : \u211a\u22650)\u207b\u00b9) atTop (\ud835\udcdd 0) :=\ntendsto_inv_atTop_zero.comp tendsto_natCast_atTop_atTop", "-- Mathlib.Analysis.SpecificLimits.Basic.NNRat (L38-L44)\ntheorem NNRat.tendsto_algebraMap_inv_atTop_nhds_zero_nat (\ud835\udd5c : Type*) [Semiring \ud835\udd5c]\n [Algebra \u211a\u22650 \ud835\udd5c] [TopologicalSpace \ud835\udd5c] [ContinuousSMul \u211a\u22650 \ud835\udd5c] :\n Tendsto (algebraMap \u211a\u22650 \ud835\udd5c \u2218 fun n : \u2115 \u21a6 (n : \u211a\u22650)\u207b\u00b9) atTop (\ud835\udcdd 0) := by\nconvert (continuous_algebraMap \u211a\u22650 \ud835\udd5c).continuousAt.tendsto.comp\n tendsto_inv_atTop_nhds_zero_nat\n rw [map_zero]", "-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_inv_atTop_nhds_zero_nat (L45-L50)\ntheorem tendsto_inv_atTop_nhds_zero_nat {\ud835\udd5c : Type*} [DivisionSemiring \ud835\udd5c] [CharZero \ud835\udd5c]\n [TopologicalSpace \ud835\udd5c] [ContinuousSMul \u211a\u22650 \ud835\udd5c] :\n Tendsto (fun n : \u2115 \u21a6 (n : \ud835\udd5c)\u207b\u00b9) atTop (\ud835\udcdd 0) := by\nconvert NNRat.tendsto_algebraMap_inv_atTop_nhds_zero_nat \ud835\udd5c\n simp", "-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_const_div_atTop_nhds_zero_nat (L51-L56)\ntheorem tendsto_const_div_atTop_nhds_zero_nat {\ud835\udd5c : Type*} [DivisionSemiring \ud835\udd5c] [CharZero \ud835\udd5c]\n [TopologicalSpace \ud835\udd5c] [ContinuousSMul \u211a\u22650 \ud835\udd5c] [ContinuousMul \ud835\udd5c] (C : \ud835\udd5c) :\n Tendsto (fun n : \u2115 \u21a6 C / n) atTop (\ud835\udcdd 0) := by\nsimpa only [mul_zero, div_eq_mul_inv] using\n (tendsto_const_nhds (x := C)).mul tendsto_inv_atTop_nhds_zero_nat", "-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_one_div_atTop_nhds_zero_nat (L57-L61)\ntheorem tendsto_one_div_atTop_nhds_zero_nat {\ud835\udd5c : Type*} [DivisionSemiring \ud835\udd5c] [CharZero \ud835\udd5c]\n [TopologicalSpace \ud835\udd5c] [ContinuousSMul \u211a\u22650 \ud835\udd5c] :\n Tendsto (fun n : \u2115 \u21a6 1 / (n : \ud835\udd5c)) atTop (\ud835\udcdd 0) := by\nsimp [tendsto_inv_atTop_nhds_zero_nat]", "-- Mathlib.Analysis.SpecificLimits.Basic.EReal (L62-L69)\ntheorem EReal.tendsto_const_div_atTop_nhds_zero_nat {C : EReal} (h : C \u2260 \u22a5) (h' : C \u2260 \u22a4) :\n Tendsto (fun n : \u2115 \u21a6 C / n) atTop (\ud835\udcdd 0) := by\nhave : (fun n : \u2115 \u21a6 C / n) = fun n : \u2115 \u21a6 ((C.toReal / n : \u211d) : EReal) := by\n ext n\n nth_rw 1 [\u2190 coe_toReal h' h, \u2190 coe_coe_eq_natCast n, \u2190 coe_div C.toReal n]\n rw [this, \u2190 coe_zero, tendsto_coe]\n exact _root_.tendsto_const_div_atTop_nhds_zero_nat C.toReal", "-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_one_div_add_atTop_nhds_zero_nat (L70-L75)\ntheorem tendsto_one_div_add_atTop_nhds_zero_nat {\ud835\udd5c : Type*} [DivisionSemiring \ud835\udd5c] [CharZero \ud835\udd5c]\n [TopologicalSpace \ud835\udd5c] [ContinuousSMul \u211a\u22650 \ud835\udd5c] :\n Tendsto (fun n : \u2115 \u21a6 1 / ((n : \ud835\udd5c) + 1)) atTop (\ud835\udcdd 0) :=\nsuffices Tendsto (fun n : \u2115 \u21a6 1 / (\u2191(n + 1) : \ud835\udd5c)) atTop (\ud835\udcdd 0) by simpa\n (tendsto_add_atTop_iff_nat 1).2 tendsto_one_div_atTop_nhds_zero_nat", "-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_algebraMap_inv_atTop_nhds_zero_nat (L76-L84)\ntheorem tendsto_algebraMap_inv_atTop_nhds_zero_nat {\ud835\udd5c : Type*} (A : Type*)\n [Semifield \ud835\udd5c] [CharZero \ud835\udd5c] [TopologicalSpace \ud835\udd5c] [ContinuousSMul \u211a\u22650 \ud835\udd5c]\n [Semiring A] [Algebra \ud835\udd5c A] [TopologicalSpace A] [ContinuousSMul \ud835\udd5c A] :\n Tendsto (algebraMap \ud835\udd5c A \u2218 fun n : \u2115 \u21a6 (n : \ud835\udd5c)\u207b\u00b9) atTop (\ud835\udcdd 0) := by\nconvert (continuous_algebraMap \ud835\udd5c A).continuousAt.tendsto.comp tendsto_inv_atTop_nhds_zero_nat\n rw [map_zero]\n\n/-- The limit of `n / (n + x)` is 1, for any constant `x` (valid in `\u211d` or any topological division\nalgebra over `\u211a\u22650`, e.g., `\u2102`). -/", "-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_natCast_div_add_atTop (L85-L97)\ntheorem tendsto_natCast_div_add_atTop {\ud835\udd5c : Type*} [DivisionSemiring \ud835\udd5c] [TopologicalSpace \ud835\udd5c]\n [CharZero \ud835\udd5c] [ContinuousSMul \u211a\u22650 \ud835\udd5c] [IsTopologicalSemiring \ud835\udd5c] [ContinuousInv\u2080 \ud835\udd5c] (x : \ud835\udd5c) :\n Tendsto (fun n : \u2115 \u21a6 (n : \ud835\udd5c) / (n + x)) atTop (\ud835\udcdd 1) := by\nconvert Tendsto.congr' ((eventually_ne_atTop 0).mp (Eventually.of_forall fun n hn \u21a6 _)) _\n \u00b7 exact fun n : \u2115 \u21a6 1 / (1 + x / n)\n \u00b7 simp [Nat.cast_ne_zero.mpr hn, add_div']\n \u00b7 have : \ud835\udcdd (1 : \ud835\udd5c) = \ud835\udcdd (1 / (1 + x * (0 : \ud835\udd5c))) := by\n rw [mul_zero, add_zero, div_one]\n rw [this]\n refine tendsto_const_nhds.div (tendsto_const_nhds.add ?_) (by simp)\n simp_rw [div_eq_mul_inv]\n exact tendsto_const_nhds.mul tendsto_inv_atTop_nhds_zero_nat", "-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_add_mul_div_add_mul_atTop_nhds (L98-L114)\ntheorem tendsto_add_mul_div_add_mul_atTop_nhds {\ud835\udd5c : Type*} [Semifield \ud835\udd5c] [CharZero \ud835\udd5c]\n [TopologicalSpace \ud835\udd5c] [ContinuousSMul \u211a\u22650 \ud835\udd5c] [IsTopologicalSemiring \ud835\udd5c] [ContinuousInv\u2080 \ud835\udd5c]\n (a b c : \ud835\udd5c) {d : \ud835\udd5c} (hd : d \u2260 0) :\n Tendsto (fun k : \u2115 \u21a6 (a + c * k) / (b + d * k)) atTop (\ud835\udcdd (c / d)) := by\napply Filter.Tendsto.congr'\n case f\u2081 => exact fun k \u21a6 (a * (\u2191k)\u207b\u00b9 + c) / (b * (\u2191k)\u207b\u00b9 + d)\n \u00b7 refine (eventually_ne_atTop 0).mp (Eventually.of_forall ?_)\n intro h hx\n dsimp\n field (discharger := norm_cast)\n \u00b7 apply Filter.Tendsto.div _ _ hd\n all_goals\n apply zero_add (_ : \ud835\udd5c) \u25b8 Filter.Tendsto.add_const _ _\n apply mul_zero (_ : \ud835\udd5c) \u25b8 Filter.Tendsto.const_mul _ _\n exact tendsto_inv_atTop_nhds_zero_nat\n\n/-- For any positive `m : \u2115`, `((n % m : \u2115) : \u211d) / (n : \u211d)` tends to `0` as `n` tends to `\u221e`. -/", "-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_mod_div_atTop_nhds_zero_nat (L115-L121)\ntheorem tendsto_mod_div_atTop_nhds_zero_nat {m : \u2115} (hm : 0 < m) :\n Tendsto (fun n : \u2115 => ((n % m : \u2115) : \u211d) / (n : \u211d)) atTop (\ud835\udcdd 0) := by\nhave h0 : \u2200\u1da0 n : \u2115 in atTop, 0 \u2264 (fun n : \u2115 => ((n % m : \u2115) : \u211d)) n := by aesop\n exact tendsto_bdd_div_atTop_nhds_zero h0\n (.of_forall (fun n \u21a6 cast_le.mpr (mod_lt n hm).le)) tendsto_natCast_atTop_atTop\n\n/-- If `a \u2260 0`, `(a * x + c)\u207b\u00b9` tends to `0` as `x` tends to `\u221e`. -/", "-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_mul_add_inv_atTop_nhds_zero (L122-L129)\ntheorem tendsto_mul_add_inv_atTop_nhds_zero (a c : \u211d) (ha : a \u2260 0) :\n Tendsto (fun x => (a * x + c)\u207b\u00b9) atTop (\ud835\udcdd 0) := by\nobtain ha' | ha' := lt_or_gt_of_ne ha\n \u00b7 exact tendsto_inv_atBot_zero.comp\n (tendsto_atBot_add_const_right _ c (tendsto_id.const_mul_atTop_of_neg ha'))\n \u00b7 exact tendsto_inv_atTop_zero.comp\n (tendsto_atTop_add_const_right _ c (tendsto_id.const_mul_atTop ha'))", "-- Mathlib.Analysis.SpecificLimits.Basic.Filter (L130-L135)\ntheorem Filter.EventuallyEq.div_mul_cancel {\u03b1 G : Type*} [GroupWithZero G] {f g : \u03b1 \u2192 G}\n {l : Filter \u03b1} (hg : Tendsto g l (\ud835\udcdf {0}\u1d9c)) : (fun x \u21a6 f x / g x * g x) =\u1da0[l] fun x \u21a6 f x := by\nfilter_upwards [hg.le_comap <| preimage_mem_comap (m := g) (mem_principal_self {0}\u1d9c)] with x hx\n simp_all\n\n/-- If `g` tends to `\u221e`, then eventually for all `x` we have `(f x / g x) * g x = f x`. -/", "-- Mathlib.Analysis.SpecificLimits.Basic.Filter (L136-L144)\ntheorem Filter.EventuallyEq.div_mul_cancel_atTop {\u03b1 K : Type*}\n [DivisionSemiring K] [LinearOrder K] [IsStrictOrderedRing K]\n {f g : \u03b1 \u2192 K} {l : Filter \u03b1} (hg : Tendsto g l atTop) :\n (fun x \u21a6 f x / g x * g x) =\u1da0[l] fun x \u21a6 f x :=\ndiv_mul_cancel <| hg.mono_right <| le_principal_iff.mpr <|\n mem_of_superset (Ioi_mem_atTop 0) <| by simp\n\n/-- If when `x` tends to `\u221e`, `g` tends to `\u221e` and `f x / g x` tends to a positive\n constant, then `f` tends to `\u221e`. -/", "-- Mathlib.Analysis.SpecificLimits.Basic.Filter (L145-L153)\ntheorem Filter.Tendsto.num {\u03b1 K : Type*} [Field K] [LinearOrder K] [IsStrictOrderedRing K]\n [TopologicalSpace K] [OrderTopology K]\n {f g : \u03b1 \u2192 K} {l : Filter \u03b1} (hg : Tendsto g l atTop) {a : K} (ha : 0 < a)\n (hlim : Tendsto (fun x => f x / g x) l (\ud835\udcdd a)) :\n Tendsto f l atTop :=\n(hlim.pos_mul_atTop ha hg).congr' (EventuallyEq.div_mul_cancel_atTop hg)\n\n/-- If when `x` tends to `\u221e`, `g` tends to `\u221e` and `f x / g x` tends to a positive\n constant, then `f` tends to `\u221e`. -/", "-- Mathlib.Analysis.SpecificLimits.Basic.Filter (L154-L165)\ntheorem Filter.Tendsto.den {\u03b1 K : Type*} [Field K] [LinearOrder K] [IsStrictOrderedRing K]\n [TopologicalSpace K] [OrderTopology K]\n [ContinuousInv K] {f g : \u03b1 \u2192 K} {l : Filter \u03b1} (hf : Tendsto f l atTop) {a : K} (ha : 0 < a)\n (hlim : Tendsto (fun x => f x / g x) l (\ud835\udcdd a)) :\n Tendsto g l atTop :=\nhave hlim' : Tendsto (fun x => g x / f x) l (\ud835\udcdd a\u207b\u00b9) := by\n simp_rw [\u2190 inv_div (f _)]\n exact Filter.Tendsto.inv (f := fun x => f x / g x) hlim\n (hlim'.pos_mul_atTop (inv_pos_of_pos ha) hf).congr' (.div_mul_cancel_atTop hf)\n\n/-- If when `x` tends to `\u221e`, `f x / g x` tends to a positive constant, then `f` tends to `\u221e` if\n and only if `g` tends to `\u221e`. -/", "-- Mathlib.Analysis.SpecificLimits.Basic.Filter (L166-L175)\ntheorem Filter.Tendsto.num_atTop_iff_den_atTop {\u03b1 K : Type*}\n [Field K] [LinearOrder K] [IsStrictOrderedRing K] [TopologicalSpace K]\n [OrderTopology K] [ContinuousInv K] {f g : \u03b1 \u2192 K} {l : Filter \u03b1} {a : K} (ha : 0 < a)\n (hlim : Tendsto (fun x => f x / g x) l (\ud835\udcdd a)) :\n Tendsto f l atTop \u2194 Tendsto g l atTop :=\n\u27e8fun hf \u21a6 hf.den ha hlim, fun hg \u21a6 hg.num ha hlim\u27e9\n\n/-! ### Powers -/", "-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_add_one_pow_atTop_atTop_of_pos (L176-L181)\ntheorem tendsto_add_one_pow_atTop_atTop_of_pos\n [Semiring \u03b1] [LinearOrder \u03b1] [IsStrictOrderedRing \u03b1] [Archimedean \u03b1] {r : \u03b1}\n (h : 0 < r) : Tendsto (fun n : \u2115 \u21a6 (r + 1) ^ n) atTop atTop :=\ntendsto_atTop_atTop_of_monotone' (pow_right_mono\u2080 <| le_add_of_nonneg_left h.le) <|\n not_bddAbove_iff.2 fun _ \u21a6 Set.exists_range_iff.2 <| add_one_pow_unbounded_of_pos _ h", "-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_pow_atTop_atTop_of_one_lt (L182-L188)\ntheorem tendsto_pow_atTop_atTop_of_one_lt\n [Semiring \u03b1] [LinearOrder \u03b1] [IsStrictOrderedRing \u03b1] [ExistsAddOfLE \u03b1] [Archimedean \u03b1] {r : \u03b1}\n (h : 1 < r) : Tendsto (fun n : \u2115 \u21a6 r ^ n) atTop atTop := by\nobtain \u27e8r, r0, rfl\u27e9 := exists_pos_add_of_lt' h\n rw [add_comm]\n exact tendsto_add_one_pow_atTop_atTop_of_pos r0", "-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_pow_atTop_nhds_zero_of_lt_one (L189-L199)\ntheorem tendsto_pow_atTop_nhds_zero_of_lt_one {\ud835\udd5c : Type*}\n [Semifield \ud835\udd5c] [LinearOrder \ud835\udd5c] [IsStrictOrderedRing \ud835\udd5c] [ExistsAddOfLE \ud835\udd5c] [Archimedean \ud835\udd5c]\n [TopologicalSpace \ud835\udd5c] [OrderTopology \ud835\udd5c] {r : \ud835\udd5c} (h\u2081 : 0 \u2264 r) (h\u2082 : r < 1) :\n Tendsto (fun n : \u2115 \u21a6 r ^ n) atTop (\ud835\udcdd 0) :=\nh\u2081.eq_or_lt.elim\n (fun hr \u21a6 (tendsto_add_atTop_iff_nat 1).mp <| by\n simp [_root_.pow_succ, \u2190 hr])\n (fun hr \u21a6\n have := (one_lt_inv\u2080 hr).2 h\u2082 |> tendsto_pow_atTop_atTop_of_one_lt\n (tendsto_inv_atTop_zero.comp this).congr fun n \u21a6 by simp)", "-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_pow_atTop_nhdsWithin_zero_of_lt_one (L218-L225)\ntheorem tendsto_pow_atTop_nhdsWithin_zero_of_lt_one {\ud835\udd5c : Type*}\n [Semifield \ud835\udd5c] [LinearOrder \ud835\udd5c] [IsStrictOrderedRing \ud835\udd5c] [ExistsAddOfLE \ud835\udd5c]\n [Archimedean \ud835\udd5c] [TopologicalSpace \ud835\udd5c] [OrderTopology \ud835\udd5c] {r : \ud835\udd5c} (h\u2081 : 0 < r) (h\u2082 : r < 1) :\n Tendsto (fun n : \u2115 \u21a6 r ^ n) atTop (\ud835\udcdd[>] 0) :=\ntendsto_inf.2\n \u27e8tendsto_pow_atTop_nhds_zero_of_lt_one h\u2081.le h\u2082,\n tendsto_principal.2 <| Eventually.of_forall fun _ \u21a6 pow_pos h\u2081 _\u27e9", "-- Mathlib.Analysis.SpecificLimits.Basic.uniformity_basis_dist_pow_of_lt_one (L226-L231)\ntheorem uniformity_basis_dist_pow_of_lt_one {\u03b1 : Type*} [PseudoMetricSpace \u03b1] {r : \u211d} (h\u2080 : 0 < r)\n (h\u2081 : r < 1) :\n (uniformity \u03b1).HasBasis (fun _ : \u2115 \u21a6 True) fun k \u21a6 { p : \u03b1 \u00d7 \u03b1 | dist p.1 p.2 < r ^ k } :=\nMetric.mk_uniformity_basis (fun _ _ \u21a6 pow_pos h\u2080 _) fun _ \u03b50 \u21a6\n (exists_pow_lt_of_lt_one \u03b50 h\u2081).imp fun _ hk \u21a6 \u27e8trivial, hk.le\u27e9", "-- Mathlib.Analysis.SpecificLimits.Basic.geom_lt (L232-L237)\ntheorem geom_lt {u : \u2115 \u2192 \u211d} {c : \u211d} (hc : 0 \u2264 c) {n : \u2115} (hn : 0 < n)\n (h : \u2200 k < n, c * u k < u (k + 1)) : c ^ n * u 0 < u n := by\napply (monotone_mul_left_of_nonneg hc).seq_pos_lt_seq_of_le_of_lt hn _ _ h\n \u00b7 simp\n \u00b7 simp [_root_.pow_succ', mul_assoc]", "-- Mathlib.Analysis.SpecificLimits.Basic.geom_le (L238-L242)\ntheorem geom_le {u : \u2115 \u2192 \u211d} {c : \u211d} (hc : 0 \u2264 c) (n : \u2115) (h : \u2200 k < n, c * u k \u2264 u (k + 1)) :\n c ^ n * u 0 \u2264 u n := by\napply (monotone_mul_left_of_nonneg hc).seq_le_seq n _ _ h <;>\n simp [_root_.pow_succ', mul_assoc]", "-- Mathlib.Analysis.SpecificLimits.Basic.le_geom (L249-L255)\ntheorem le_geom {u : \u2115 \u2192 \u211d} {c : \u211d} (hc : 0 \u2264 c) (n : \u2115) (h : \u2200 k < n, u (k + 1) \u2264 c * u k) :\n u n \u2264 c ^ n * u 0 := by\napply (monotone_mul_left_of_nonneg hc).seq_le_seq n _ h _ <;>\n simp [_root_.pow_succ', mul_assoc]\n\n/-- If a sequence `v` of real numbers satisfies `k * v n \u2264 v (n+1)` with `1 < k`,\nthen it goes to +\u221e. -/", "-- Mathlib.Analysis.SpecificLimits.Normed.summable_pow_mul_geometric_of_norm_lt_one (L486-L514)\ntheorem summable_pow_mul_geometric_of_norm_lt_one (k : \u2115) {r : R} (hr : \u2016r\u2016 < 1) :\n Summable (fun n \u21a6 (n : R) ^ k * r ^ n : \u2115 \u2192 R) := by\nrefine Nat.strong_induction_on k fun k hk => ?_\n obtain \u27e8a, ha\u27e9 : \u2203 (a : \u2115 \u2192 \u2115), \u2200 n, (n + k).descFactorial k\n = n ^ k + \u2211 i \u2208 range k, a i * n ^ i := by\n let P : Polynomial \u2115 := (ascPochhammer \u2115 k).comp (Polynomial.X + C 1)\n refine \u27e8fun i \u21a6 P.coeff i, fun n \u21a6 ?_\u27e9\n have mP : Monic P := Monic.comp_X_add_C (monic_ascPochhammer \u2115 k) _\n have dP : P.natDegree = k := by\n simp only [P, natDegree_comp, ascPochhammer_natDegree, mul_one, natDegree_X_add_C]\n have A : (n + k).descFactorial k = P.eval n := by\n have : n + 1 + k - 1 = n + k := by lia\n simp [P, ascPochhammer_nat_eq_descFactorial, this]\n conv_lhs => rw [A, mP.as_sum, dP]\n simp [eval_finset_sum]\n have : Summable (fun n \u21a6 (n + k).descFactorial k * r ^ n\n - \u2211 i \u2208 range k, a i * n ^ (i : \u2115) * r ^ n) := by\n apply (summable_descFactorial_mul_geometric_of_norm_lt_one k hr).sub\n apply summable_sum (fun i hi \u21a6 ?_)\n simp_rw [mul_assoc]\n simp only [Finset.mem_range] at hi\n exact (hk _ hi).mul_left _\n convert this using 1\n ext n\n simp [ha n, add_mul, sum_mul]\n\n/-- If `\u2016r\u2016 < 1`, then `\u2211' n : \u2115, n * r ^ n = r / (1 - r) ^ 2`, `HasSum` version in a general ring\nwith summable geometric series. For a version in a field, using division instead of `Ring.inverse`,\nsee `hasSum_coe_mul_geometric_of_norm_lt_one`. -/", "-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_same_eq_mul_div' (L83-L87)\nlemma arithGeom_same_eq_mul_div' (ha : a \u2260 1) (n : \u2115) :\n arithGeom a b b n = b * (1 - a ^ (n + 1)) / (1 - a) := by\nrw [arithGeom_eq ha n]\n field [sub_ne_zero.mpr ha.symm]", "-- Mathlib.Analysis.SpecificLimits.Normed.AbsoluteValue (L248-L259)\ntheorem AbsoluteValue.tendsto_div_one_add_pow_nhds_one {v : AbsoluteValue R S} {a : R}\n (ha : v a < 1) : atTop.Tendsto (fun (n : \u2115) \u21a6 v (1 / (1 + a ^ n))) (\ud835\udcdd 1) := by\nsimp_rw [map_div\u2080 v, v.map_one]\n apply one_div_one (G := S) \u25b8 Tendsto.div tendsto_const_nhds _ one_ne_zero\n have h_add := (tendsto_pow_atTop_nhds_zero_of_lt_one (v.nonneg _) ha).const_add 1\n have h_sub := (tendsto_pow_atTop_nhds_zero_of_lt_one (v.nonneg _) ha).const_sub 1\n exact tendsto_of_tendsto_of_tendsto_of_le_of_le (by simpa using h_sub) (by simpa using h_add)\n (fun n \u21a6 le_trans (by simp) (v.le_add _ _))\n (fun n \u21a6 le_trans (v.add_le _ _) (by simp))\n\n/-- `v (1 / (1 + a ^n))` tends to `0` whenever `v : AbsoluteValue R S` for fields `R` and `S`,\nprovided `1 < v a`. -/", "-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_natCast_atTop_cobounded (L38-L44)\ntheorem tendsto_natCast_atTop_cobounded\n [NormedRing \u03b1] [NormSMulClass \u2124 \u03b1] [Nontrivial \u03b1] :\n Tendsto Nat.cast atTop (Bornology.cobounded \u03b1) := by\nrw [\u2190 tendsto_norm_atTop_iff_cobounded]\n simpa [norm_natCast_eq_mul_norm_one] using tendsto_natCast_atTop_atTop\n |>.atTop_mul_const (norm_pos_iff.mpr one_ne_zero)", "-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.tendsto_arithGeom_nhds_of_lt_one (L129-L136)\nlemma tendsto_arithGeom_nhds_of_lt_one [Archimedean R] [TopologicalSpace R] [OrderTopology R]\n (ha_pos : 0 \u2264 a) (ha : a < 1) :\n Tendsto (arithGeom a b u\u2080) atTop (\ud835\udcdd (b / (1 - a))) := by\nrw [arithGeom_eq' ha.ne]\n conv_rhs => rw [\u2190 zero_add (b / (1 - a))]\n refine Tendsto.add ?_ tendsto_const_nhds\n conv_rhs => rw [\u2190 zero_mul (u\u2080 - (b / (1 - a)))]\n exact (tendsto_pow_atTop_nhds_zero_of_lt_one ha_pos ha).mul_const _", "-- Mathlib.Analysis.SpecificLimits.Normed.geom_series_succ (L318-L321)\ntheorem geom_series_succ (x : R) (h : \u2016x\u2016 < 1) : \u2211' i : \u2115, x ^ (i + 1) = \u2211' i : \u2115, x ^ i - 1 := by\nrw [eq_sub_iff_add_eq, (summable_geometric_of_norm_lt_one h).tsum_eq_zero_add,\n pow_zero, add_comm]", "-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_same_eq_mul_div (L88-L92)\nlemma arithGeom_same_eq_mul_div (ha : a \u2260 1) (n : \u2115) :\n arithGeom a b b n = b * (a ^ (n + 1) - 1) / (a - 1) := by\nrw [arithGeom_same_eq_mul_div' ha n, \u2190 neg_sub _ a, div_neg,\n \u2190 neg_sub _ (a ^ (n + 1)), mul_neg, neg_div, neg_neg]", "-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_pow_const_mul_const_pow_of_abs_lt_one (L187-L196)\ntheorem tendsto_pow_const_mul_const_pow_of_abs_lt_one (k : \u2115) {r : \u211d} (hr : |r| < 1) :\n Tendsto (fun n \u21a6 (n : \u211d) ^ k * r ^ n : \u2115 \u2192 \u211d) atTop (\ud835\udcdd 0) := by\nby_cases h0 : r = 0\n \u00b7 exact tendsto_const_nhds.congr'\n (mem_atTop_sets.2 \u27e81, fun n hn \u21a6 by simp [zero_lt_one.trans_le hn |>.ne', h0]\u27e9)\n have hr' : 1 < |r|\u207b\u00b9 := (one_lt_inv\u2080 (abs_pos.2 h0)).2 hr\n rw [tendsto_zero_iff_norm_tendsto_zero]\n simpa [div_eq_mul_inv] using tendsto_pow_const_div_const_pow_of_one_lt k hr'\n\n/-- For `k \u2260 0` and a constant `r` the function `r / n ^ k` tends to zero. -/", "-- Mathlib.Analysis.SpecificLimits.Normed.dist_partial_sum_le_of_le_geometric (L559-L565)\ntheorem dist_partial_sum_le_of_le_geometric (hf : \u2200 n, \u2016f n\u2016 \u2264 C * r ^ n) (n : \u2115) :\n dist (\u2211 i \u2208 range n, f i) (\u2211 i \u2208 range (n + 1), f i) \u2264 C * r ^ n := by\nrw [sum_range_succ, dist_eq_norm, \u2190 norm_neg, neg_sub, add_sub_cancel_left]\n exact hf n\n\n/-- If `\u2016f n\u2016 \u2264 C * r ^ n` for all `n : \u2115` and some `r < 1`, then the partial sums of `f` form a\nCauchy sequence. This lemma does not assume `0 \u2264 r` or `0 \u2264 C`. -/", "-- Mathlib.Analysis.SpecificLimits.FloorPow.mul_pow_le_nat_floor_pow (L259-L271)\ntheorem mul_pow_le_nat_floor_pow {c : \u211d} (hc : 1 < c) (i : \u2115) : (1 - c\u207b\u00b9) * c ^ i \u2264 \u230ac ^ i\u230b\u208a := by\nhave cpos : 0 < c := zero_lt_one.trans hc\n rcases eq_or_ne i 0 with (rfl | hi)\n \u00b7 simp only [pow_zero, Nat.floor_one, Nat.cast_one, mul_one, sub_le_self_iff, inv_nonneg, cpos.le]\n calc\n (1 - c\u207b\u00b9) * c ^ i = c ^ i - c ^ i * c\u207b\u00b9 := by ring\n _ \u2264 c ^ i - 1 := by\n gcongr\n simpa only [\u2190 div_eq_mul_inv, one_le_div cpos, pow_one] using le_self_pow\u2080 hc.le hi\n _ \u2264 \u230ac ^ i\u230b\u208a := (Nat.sub_one_lt_floor _).le\n\n/-- The sum of `1/\u230ac^i\u230b\u208a^2` above a threshold `j` is comparable to `1/j^2`, up to a multiplicative\nconstant. -/", "-- Mathlib.Analysis.SpecificLimits.Normed.NormedAddCommGroup (L594-L597)\ntheorem NormedAddCommGroup.cauchy_series_of_le_geometric' {C : \u211d} {u : \u2115 \u2192 \u03b1} {r : \u211d} (hr : r < 1)\n (h : \u2200 n, \u2016u n\u2016 \u2264 C * r ^ n) : CauchySeq fun n \u21a6 \u2211 k \u2208 range (n + 1), u k :=\n(cauchy_series_of_le_geometric hr h).comp_tendsto <| tendsto_add_atTop_nat 1", "-- Mathlib.Analysis.SpecificLimits.Normed.summable_geometric_of_norm_lt_one (L275-L278)\nlemma summable_geometric_of_norm_lt_one {K : Type*} [NormedRing K] [HasSummableGeomSeries K]\n {x : K} (h : \u2016x\u2016 < 1) : Summable (fun n \u21a6 x ^ n) :=\nHasSummableGeomSeries.summable_geometric_of_norm_lt_one x h", "-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_self_mul_const_pow_of_abs_lt_one (L210-L215)\ntheorem tendsto_self_mul_const_pow_of_abs_lt_one {r : \u211d} (hr : |r| < 1) :\n Tendsto (fun n \u21a6 n * r ^ n : \u2115 \u2192 \u211d) atTop (\ud835\udcdd 0) := by\nsimpa only [pow_one] using tendsto_pow_const_mul_const_pow_of_abs_lt_one 1 hr\n\n/-- If `0 \u2264 r < 1`, then `n * r ^ n` tends to zero. This is a specialized version of\n`tendsto_self_mul_const_pow_of_abs_lt_one`, singled out for ease of application. -/", "-- Mathlib.Analysis.SpecificLimits.Normed.tsum_choose_mul_geometric_of_norm_lt_one (L475-L478)\nlemma tsum_choose_mul_geometric_of_norm_lt_one (k : \u2115) {r : \ud835\udd5c} (hr : \u2016r\u2016 < 1) :\n \u2211' n, (n + k).choose k * r ^ n = 1 / (1 - r) ^ (k + 1) :=\n(hasSum_choose_mul_geometric_of_norm_lt_one k hr).tsum_eq", "-- Mathlib.Analysis.SpecificLimits.FloorPow.tendsto_div_of_monotone_of_exists_subseq_tendsto_div (L31-L181)\ntheorem tendsto_div_of_monotone_of_exists_subseq_tendsto_div (u : \u2115 \u2192 \u211d) (l : \u211d)\n (hmono : Monotone u)\n (hlim : \u2200 a : \u211d, 1 < a \u2192 \u2203 c : \u2115 \u2192 \u2115, (\u2200\u1da0 n in atTop, (c (n + 1) : \u211d) \u2264 a * c n) \u2227\n Tendsto c atTop atTop \u2227 Tendsto (fun n => u (c n) / c n) atTop (\ud835\udcdd l)) :\n Tendsto (fun n => u n / n) atTop (\ud835\udcdd l) := by\n/- To check the result up to some `\u03b5 > 0`, we use a sequence `c` for which the ratio\n `c (N+1) / c N` is bounded by `1 + \u03b5`. Sandwiching a given `n` between two consecutive values of\n `c`, say `c N` and `c (N+1)`, one can then bound `u n / n` from above by `u (c N) / c (N - 1)`\n and from below by `u (c (N - 1)) / c N` (using that `u` is monotone), which are both comparable\n to the limit `l` up to `1 + \u03b5`.\n We give a version of this proof by clearing out denominators first, to avoid discussing the sign\n of different quantities. -/\n have lnonneg : 0 \u2264 l := by\n rcases hlim 2 one_lt_two with \u27e8c, _, ctop, clim\u27e9\n have : Tendsto (fun n => u 0 / c n) atTop (\ud835\udcdd 0) :=\n tendsto_const_nhds.div_atTop (tendsto_natCast_atTop_iff.2 ctop)\n apply le_of_tendsto_of_tendsto' this clim fun n => ?_\n gcongr\n exact hmono (zero_le _)\n have A : \u2200 \u03b5 : \u211d, 0 < \u03b5 \u2192 \u2200\u1da0 n in atTop, u n - n * l \u2264 \u03b5 * (1 + \u03b5 + l) * n := by\n intro \u03b5 \u03b5pos\n rcases hlim (1 + \u03b5) ((lt_add_iff_pos_right _).2 \u03b5pos) with \u27e8c, cgrowth, ctop, clim\u27e9\n have L : \u2200\u1da0 n in atTop, u (c n) - c n * l \u2264 \u03b5 * c n := by\n rw [\u2190 tendsto_sub_nhds_zero_iff, \u2190 Asymptotics.isLittleO_one_iff \u211d,\n Asymptotics.isLittleO_iff] at clim\n filter_upwards [clim \u03b5pos, ctop (Ioi_mem_atTop 0)] with n hn cnpos'\n have cnpos : 0 < c n := cnpos'\n calc\n u (c n) - c n * l = (u (c n) / c n - l) * c n := by field\n _ \u2264 \u03b5 * c n := by\n gcongr\n refine (le_abs_self _).trans ?_\n simpa using hn\n obtain \u27e8a, ha\u27e9 :\n \u2203 a : \u2115, \u2200 b : \u2115, a \u2264 b \u2192 (c (b + 1) : \u211d) \u2264 (1 + \u03b5) * c b \u2227 u (c b) - c b * l \u2264 \u03b5 * c b :=\n eventually_atTop.1 (cgrowth.and L)\n let M := ((Finset.range (a + 1)).image fun i => c i).max' (by simp)\n filter_upwards [Ici_mem_atTop M] with n hn\n have exN : \u2203 N, n < c N := by\n rcases (tendsto_atTop.1 ctop (n + 1)).exists with \u27e8N, hN\u27e9\n exact \u27e8N, by lia\u27e9\n let N := Nat.find exN\n have ncN : n < c N := Nat.find_spec exN\n have aN : a + 1 \u2264 N := by\n by_contra! h\n have cNM : c N \u2264 M := by\n apply le_max'\n apply mem_image_of_mem\n exact mem_range.2 h\n exact lt_irrefl _ ((cNM.trans hn).trans_lt ncN)\n have Npos : 0 < N := lt_of_lt_of_le Nat.succ_pos' aN\n have cNn : c (N - 1) \u2264 n := by\n have : N - 1 < N := Nat.pred_lt Npos.ne'\n simpa only [not_lt] using Nat.find_min exN this\n have IcN : (c N : \u211d) \u2264 (1 + \u03b5) * c (N - 1) := by\n have A : a \u2264 N - 1 := (Nat.le_sub_one_iff_lt Npos).mpr aN\n have B : N - 1 + 1 = N := Nat.succ_pred_eq_of_pos Npos\n have := (ha _ A).1\n rwa [B] at this\n calc\n u n - n * l \u2264 u (c N) - c (N - 1) * l := by gcongr; exact hmono ncN.le\n _ = u (c N) - c N * l + (c N - c (N - 1)) * l := by ring\n _ \u2264 \u03b5 * c N + \u03b5 * c (N - 1) * l := by\n gcongr\n \u00b7 exact (ha N (a.le_succ.trans aN)).2\n \u00b7 linarith only [IcN]\n _ \u2264 \u03b5 * ((1 + \u03b5) * c (N - 1)) + \u03b5 * c (N - 1) * l := by gcongr\n _ = \u03b5 * (1 + \u03b5 + l) * c (N - 1) := by ring\n _ \u2264 \u03b5 * (1 + \u03b5 + l) * n := by gcongr\n have B : \u2200 \u03b5 : \u211d, 0 < \u03b5 \u2192 \u2200\u1da0 n : \u2115 in atTop, (n : \u211d) * l - u n \u2264 \u03b5 * (1 + l) * n := by\n intro \u03b5 \u03b5pos\n rcases hlim (1 + \u03b5) ((lt_add_iff_pos_right _).2 \u03b5pos) with \u27e8c, cgrowth, ctop, clim\u27e9\n have L : \u2200\u1da0 n : \u2115 in atTop, (c n : \u211d) * l - u (c n) \u2264 \u03b5 * c n := by\n rw [\u2190 tendsto_sub_nhds_zero_iff, \u2190 Asymptotics.isLittleO_one_iff \u211d,\n Asymptotics.isLittleO_iff] at clim\n filter_upwards [clim \u03b5pos, ctop (Ioi_mem_atTop 0)] with n hn cnpos'\n have cnpos : 0 < c n := cnpos'\n calc\n (c n : \u211d) * l - u (c n) = -(u (c n) / c n - l) * c n := by field\n _ \u2264 \u03b5 * c n := by\n gcongr\n refine le_trans (neg_le_abs _) ?_\n simpa using hn\n obtain \u27e8a, ha\u27e9 :\n \u2203 a : \u2115,\n \u2200 b : \u2115, a \u2264 b \u2192 (c (b + 1) : \u211d) \u2264 (1 + \u03b5) * c b \u2227 (c b : \u211d) * l - u (c b) \u2264 \u03b5 * c b :=\n eventually_atTop.1 (cgrowth.and L)\n let M := ((Finset.range (a + 1)).image fun i => c i).max' (by simp)\n filter_upwards [Ici_mem_atTop M] with n hn\n have exN : \u2203 N, n < c N := by\n rcases (tendsto_atTop.1 ctop (n + 1)).exists with \u27e8N, hN\u27e9\n exact \u27e8N, by lia\u27e9\n let N := Nat.find exN\n have ncN : n < c N := Nat.find_spec exN\n have aN : a + 1 \u2264 N := by\n by_contra! h\n have cNM : c N \u2264 M := by\n apply le_max'\n apply mem_image_of_mem\n exact mem_range.2 h\n exact lt_irrefl _ ((cNM.trans hn).trans_lt ncN)\n have Npos : 0 < N := lt_of_lt_of_le Nat.succ_pos' aN\n have aN' : a \u2264 N - 1 := (Nat.le_sub_one_iff_lt Npos).mpr aN\n have cNn : c (N - 1) \u2264 n := by\n have : N - 1 < N := Nat.pred_lt Npos.ne'\n simpa only [not_lt] using Nat.find_min exN this\n calc\n (n : \u211d) * l - u n \u2264 c N * l - u (c (N - 1)) := by\n gcongr\n exact hmono cNn\n _ \u2264 (1 + \u03b5) * c (N - 1) * l - u (c (N - 1)) := by\n gcongr\n have B : N - 1 + 1 = N := Nat.succ_pred_eq_of_pos Npos\n simpa [B] using (ha _ aN').1\n _ = c (N - 1) * l - u (c (N - 1)) + \u03b5 * c (N - 1) * l := by ring\n _ \u2264 \u03b5 * c (N - 1) + \u03b5 * c (N - 1) * l := add_le_add (ha _ aN').2 le_rfl\n _ = \u03b5 * (1 + l) * c (N - 1) := by ring\n _ \u2264 \u03b5 * (1 + l) * n := by gcongr\n refine tendsto_order.2 \u27e8fun d hd => ?_, fun d hd => ?_\u27e9\n \u00b7 obtain \u27e8\u03b5, h\u03b5, \u03b5pos\u27e9 : \u2203 \u03b5 : \u211d, d + \u03b5 * (1 + l) < l \u2227 0 < \u03b5 := by\n have L : Tendsto (fun \u03b5 => d + \u03b5 * (1 + l)) (\ud835\udcdd[>] 0) (\ud835\udcdd (d + 0 * (1 + l))) := by\n apply Tendsto.mono_left _ nhdsWithin_le_nhds\n exact tendsto_const_nhds.add (tendsto_id.mul tendsto_const_nhds)\n simp only [zero_mul, add_zero] at L\n exact (((tendsto_order.1 L).2 l hd).and self_mem_nhdsWithin).exists\n filter_upwards [B \u03b5 \u03b5pos, Ioi_mem_atTop 0] with n hn npos\n simp_rw [div_eq_inv_mul]\n calc\n d < (n : \u211d)\u207b\u00b9 * n * (l - \u03b5 * (1 + l)) := by\n rw [inv_mul_cancel\u2080, one_mul]\n \u00b7 linarith only [h\u03b5]\n \u00b7 exact Nat.cast_ne_zero.2 (ne_of_gt npos)\n _ = (n : \u211d)\u207b\u00b9 * (n * l - \u03b5 * (1 + l) * n) := by ring\n _ \u2264 (n : \u211d)\u207b\u00b9 * u n := by gcongr; linarith only [hn]\n \u00b7 obtain \u27e8\u03b5, h\u03b5, \u03b5pos\u27e9 : \u2203 \u03b5 : \u211d, l + \u03b5 * (1 + \u03b5 + l) < d \u2227 0 < \u03b5 := by\n have L : Tendsto (fun \u03b5 => l + \u03b5 * (1 + \u03b5 + l)) (\ud835\udcdd[>] 0) (\ud835\udcdd (l + 0 * (1 + 0 + l))) := by\n apply Tendsto.mono_left _ nhdsWithin_le_nhds\n exact\n tendsto_const_nhds.add\n (tendsto_id.mul ((tendsto_const_nhds.add tendsto_id).add tendsto_const_nhds))\n simp only [zero_mul, add_zero] at L\n exact (((tendsto_order.1 L).2 d hd).and self_mem_nhdsWithin).exists\n filter_upwards [A \u03b5 \u03b5pos, Ioi_mem_atTop 0] with n hn (npos : 0 < n)\n calc\n u n / n \u2264 (n * l + \u03b5 * (1 + \u03b5 + l) * n) / n := by gcongr; linarith only [hn]\n _ = (l + \u03b5 * (1 + \u03b5 + l)) := by field\n _ < d := h\u03b5\n\n/-- If a monotone sequence `u` is such that `u \u230ac^n\u230b\u208a / \u230ac^n\u230b\u208a` converges to a limit `l` for all\n`c > 1`, then `u n / n` tends to `l`. It is even enough to have the assumption for a sequence of\n`c`s converging to `1`. -/", "-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_pow_const_mul_const_pow_of_lt_one (L205-L209)\ntheorem tendsto_pow_const_mul_const_pow_of_lt_one (k : \u2115) {r : \u211d} (hr : 0 \u2264 r) (h'r : r < 1) :\n Tendsto (fun n \u21a6 (n : \u211d) ^ k * r ^ n : \u2115 \u2192 \u211d) atTop (\ud835\udcdd 0) :=\ntendsto_pow_const_mul_const_pow_of_abs_lt_one k (abs_lt.2 \u27e8neg_one_lt_zero.trans_le hr, h'r\u27e9)\n\n/-- If `|r| < 1`, then `n * r ^ n` tends to zero. -/", "-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_const_div_pow (L197-L204)\nlemma tendsto_const_div_pow (r : \u211d) (k : \u2115) (hk : k \u2260 0) :\n Tendsto (fun n : \u2115 => r / n ^ k) atTop (\ud835\udcdd 0) := by\nsimpa using Filter.Tendsto.const_div_atTop (tendsto_natCast_atTop_atTop (R := \u211d).comp\n (tendsto_pow_atTop hk)) r\n\n/-- If `0 \u2264 r < 1`, then `n ^ k r ^ n` tends to zero for any natural `k`.\nThis is a specialized version of `tendsto_pow_const_mul_const_pow_of_abs_lt_one`, singled out\nfor ease of application. -/", "-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_eq' (L78-L82)\nlemma arithGeom_eq' (ha : a \u2260 1) :\n arithGeom a b u\u2080 = fun n \u21a6 a ^ n * (u\u2080 - (b / (1 - a))) + b / (1 - a) := by\next\n exact arithGeom_eq ha _", "-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_zero_eq_sum (L66-L71)\nlemma arithGeom_zero_eq_sum [CommSemiring R] (n : \u2115) :\n arithGeom a b 0 n = b * \u2211 k \u2208 Finset.range n, a ^ k := by\nsimp [arithGeom_eq_add_sum]\n\nvariable [Field R]", "-- Mathlib.Analysis.SpecificLimits.Normed.geom_series_mul_shift (L322-L325)\ntheorem geom_series_mul_shift (x : R) (h : \u2016x\u2016 < 1) :\n x * \u2211' i : \u2115, x ^ i = \u2211' i : \u2115, x ^ (i + 1) := by\nsimp_rw [\u2190 (summable_geometric_of_norm_lt_one h).tsum_mul_left, \u2190 _root_.pow_succ']", "-- Mathlib.Analysis.SpecificLimits.Normed.summable_descFactorial_mul_geometric_of_norm_lt_one (L479-L485)\nlemma summable_descFactorial_mul_geometric_of_norm_lt_one (k : \u2115) {r : R} (hr : \u2016r\u2016 < 1) :\n Summable (fun n \u21a6 (n + k).descFactorial k * r ^ n) := by\nconvert (summable_choose_mul_geometric_of_norm_lt_one k hr).mul_left (k.factorial : R)\n using 2 with n\n simp [\u2190 mul_assoc, descFactorial_eq_factorial_mul_choose (n + k) k]\n\nopen Polynomial in", "-- Mathlib.Analysis.SpecificLimits.Normed.summable_norm_pow_mul_geometric_of_norm_lt_one (L423-L428)\ntheorem summable_norm_pow_mul_geometric_of_norm_lt_one (k : \u2115) {r : R}\n (hr : \u2016r\u2016 < 1) : Summable fun n : \u2115 \u21a6 \u2016((n : R) ^ k * r ^ n : R)\u2016 := by\nsimp only [\u2190 cast_pow]\n exact summable_norm_mul_geometric_of_norm_lt_one (k := k) (u := fun n \u21a6 n ^ k) hr\n (isBigO_refl _ _)", "-- Mathlib.Analysis.SpecificLimits.Normed.isLittleO_pow_const_mul_const_pow_const_pow_of_norm_lt (L169-L181)\ntheorem isLittleO_pow_const_mul_const_pow_const_pow_of_norm_lt {R : Type*} [NormedRing R] (k : \u2115)\n {r\u2081 : R} {r\u2082 : \u211d} (h : \u2016r\u2081\u2016 < r\u2082) :\n (fun n \u21a6 (n : R) ^ k * r\u2081 ^ n : \u2115 \u2192 R) =o[atTop] fun n \u21a6 r\u2082 ^ n := by\nby_cases h0 : r\u2081 = 0\n \u00b7 refine (isLittleO_zero _ _).congr' (mem_atTop_sets.2 <| \u27e81, fun n hn \u21a6 ?_\u27e9) EventuallyEq.rfl\n simp [zero_pow (one_le_iff_ne_zero.1 hn), h0]\n rw [\u2190 Ne, \u2190 norm_pos_iff] at h0\n have A : (fun n \u21a6 (n : R) ^ k : \u2115 \u2192 R) =o[atTop] fun n \u21a6 (r\u2082 / \u2016r\u2081\u2016) ^ n :=\n isLittleO_pow_const_const_pow_of_one_lt k ((one_lt_div h0).2 h)\n suffices (fun n \u21a6 r\u2081 ^ n) =O[atTop] fun n \u21a6 \u2016r\u2081\u2016 ^ n by\n simpa [div_mul_cancel\u2080 _ (pow_pos h0 _).ne', div_pow] using A.mul_isBigO this\n exact .of_norm_eventuallyLE <| eventually_norm_pow_le r\u2081", "-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_zero_eq_mul_div' (L93-L97)\nlemma arithGeom_zero_eq_mul_div' (ha : a \u2260 1) (n : \u2115) :\n arithGeom a b 0 n = b * (1 - a ^ n) / (1 - a) := by\nrw [arithGeom_eq ha n]\n ring", "-- Mathlib.Analysis.SpecificLimits.FloorPow.sum_div_pow_sq_le_div_sq (L214-L258)\ntheorem sum_div_pow_sq_le_div_sq (N : \u2115) {j : \u211d} (hj : 0 < j) {c : \u211d} (hc : 1 < c) :\n (\u2211 i \u2208 range N with j < c ^ i, (1 : \u211d) / (c ^ i) ^ 2) \u2264 c ^ 3 * (c - 1)\u207b\u00b9 / j ^ 2 := by\nhave cpos : 0 < c := zero_lt_one.trans hc\n have A : (0 : \u211d) < c\u207b\u00b9 ^ 2 := sq_pos_of_pos (inv_pos.2 cpos)\n have B : c ^ 2 * ((1 : \u211d) - c\u207b\u00b9 ^ 2)\u207b\u00b9 \u2264 c ^ 3 * (c - 1)\u207b\u00b9 := by\n rw [\u2190 div_eq_mul_inv, \u2190 div_eq_mul_inv, div_le_div_iff\u2080 _ (sub_pos.2 hc)]\n swap\n \u00b7 exact sub_pos.2 (pow_lt_one\u2080 (inv_nonneg.2 cpos.le) (inv_lt_one_of_one_lt\u2080 hc) two_ne_zero)\n have : c ^ 3 = c ^ 2 * c := by ring\n simp only [mul_sub, this, mul_one, inv_pow, sub_le_sub_iff_left]\n rw [mul_assoc, mul_comm c, \u2190 mul_assoc, mul_inv_cancel\u2080 (sq_pos_of_pos cpos).ne', one_mul]\n simpa using pow_right_mono\u2080 hc.le one_le_two\n have C : c\u207b\u00b9 ^ 2 < 1 := pow_lt_one\u2080 (inv_nonneg.2 cpos.le) (inv_lt_one_of_one_lt\u2080 hc) two_ne_zero\n calc\n (\u2211 i \u2208 range N with j < c ^ i, (1 : \u211d) / (c ^ i) ^ 2) \u2264\n \u2211 i \u2208 Ico \u230aReal.log j / Real.log c\u230b\u208a N, (1 : \u211d) / (c ^ i) ^ 2 := by\n gcongr\n intro i hi\n simp only [mem_filter, mem_range] at hi\n simp only [hi.1, mem_Ico, and_true]\n apply Nat.floor_le_of_le\n apply le_of_lt\n rw [div_lt_iff\u2080 (Real.log_pos hc), \u2190 Real.log_pow]\n exact Real.log_lt_log hj hi.2\n _ = \u2211 i \u2208 Ico \u230aReal.log j / Real.log c\u230b\u208a N, (c\u207b\u00b9 ^ 2) ^ i := by\n simp [\u2190 pow_mul, mul_comm]\n _ \u2264 (c\u207b\u00b9 ^ 2) ^ \u230aReal.log j / Real.log c\u230b\u208a / ((1 : \u211d) - c\u207b\u00b9 ^ 2) :=\n geom_sum_Ico_le_of_lt_one (sq_nonneg _) C\n _ \u2264 (c\u207b\u00b9 ^ 2) ^ (Real.log j / Real.log c - 1) / ((1 : \u211d) - c\u207b\u00b9 ^ 2) := by\n gcongr\n \u00b7 exact sub_nonneg.2 C.le\n \u00b7 rw [\u2190 Real.rpow_natCast]\n exact Real.rpow_le_rpow_of_exponent_ge A C.le (Nat.sub_one_lt_floor _).le\n _ = c ^ 2 * ((1 : \u211d) - c\u207b\u00b9 ^ 2)\u207b\u00b9 / j ^ 2 := by\n have I : (c\u207b\u00b9 ^ 2) ^ (Real.log j / Real.log c) = (1 : \u211d) / j ^ 2 := by\n apply Real.log_injOn_pos (Real.rpow_pos_of_pos A _)\n \u00b7 rw [Set.mem_Ioi]; positivity\n rw [Real.log_rpow A]\n simp only [one_div, Real.log_inv, Real.log_pow, mul_neg, neg_inj]\n field [(Real.log_pos hc).ne']\n rw [Real.rpow_sub A, I]\n simp\n ring\n _ \u2264 c ^ 3 * (c - 1)\u207b\u00b9 / j ^ 2 := by gcongr", "-- Mathlib.Analysis.SpecificLimits.Normed.cauchySeq_finset_of_geometric_bound (L566-L573)\ntheorem cauchySeq_finset_of_geometric_bound (hr : r < 1) (hf : \u2200 n, \u2016f n\u2016 \u2264 C * r ^ n) :\n CauchySeq fun s : Finset \u2115 \u21a6 \u2211 x \u2208 s, f x :=\ncauchySeq_finset_of_norm_bounded\n (aux_hasSum_of_le_geometric hr (dist_partial_sum_le_of_le_geometric hf)).summable hf\n\n/-- If `\u2016f n\u2016 \u2264 C * r ^ n` for all `n : \u2115` and some `r < 1`, then the partial sums of `f` are within\ndistance `C * r ^ n / (1 - r)` of the sum of the series. This lemma does not assume `0 \u2264 r` or\n`0 \u2264 C`. -/", "-- Mathlib.Analysis.SpecificLimits.Normed.summable_geometric_of_abs_lt_one (L379-L381)\ntheorem summable_geometric_of_abs_lt_one {r : \u211d} (h : |r| < 1) : Summable fun n : \u2115 \u21a6 r ^ n :=\nsummable_geometric_of_norm_lt_one h", "-- Mathlib.Analysis.SpecificLimits.Normed.isLittleO_pow_pow_of_abs_lt_left (L76-L95)\ntheorem isLittleO_pow_pow_of_abs_lt_left {r\u2081 r\u2082 : \u211d} (h : |r\u2081| < |r\u2082|) :\n (fun n : \u2115 \u21a6 r\u2081 ^ n) =o[atTop] fun n \u21a6 r\u2082 ^ n := by\nrefine (IsLittleO.of_norm_left ?_).of_norm_right\n exact (isLittleO_pow_pow_of_lt_left (abs_nonneg r\u2081) h).congr (pow_abs r\u2081) (pow_abs r\u2082)\n\nopen List in\n/-- Various statements equivalent to the fact that `f n` grows exponentially slower than `R ^ n`.\n\n* 0: $f n = o(a ^ n)$ for some $-R < a < R$;\n* 1: $f n = o(a ^ n)$ for some $0 < a < R$;\n* 2: $f n = O(a ^ n)$ for some $-R < a < R$;\n* 3: $f n = O(a ^ n)$ for some $0 < a < R$;\n* 4: there exist `a < R` and `C` such that one of `C` and `R` is positive and $|f n| \u2264 Ca^n$\n for all `n`;\n* 5: there exists `0 < a < R` and a positive `C` such that $|f n| \u2264 Ca^n$ for all `n`;\n* 6: there exists `a < R` such that $|f n| \u2264 a ^ n$ for sufficiently large `n`;\n* 7: there exists `0 < a < R` such that $|f n| \u2264 a ^ n$ for sufficiently large `n`.\n\nNB: For backwards compatibility, if you add more items to the list, please append them at the end of\nthe list. -/", "-- Mathlib.Analysis.SpecificLimits.Normed.tsum_geometric_le_of_norm_lt_one (L293-L311)\ntheorem tsum_geometric_le_of_norm_lt_one (x : R) (h : \u2016x\u2016 < 1) :\n \u2016\u2211' n : \u2115, x ^ n\u2016 \u2264 \u2016(1 : R)\u2016 - 1 + (1 - \u2016x\u2016)\u207b\u00b9 := by\nby_cases hx : Summable (fun n \u21a6 x ^ n)\n \u00b7 rw [hx.tsum_eq_zero_add]\n simp only [_root_.pow_zero]\n refine le_trans (norm_add_le _ _) ?_\n have : \u2016\u2211' b : \u2115, (fun n \u21a6 x ^ (n + 1)) b\u2016 \u2264 (1 - \u2016x\u2016)\u207b\u00b9 - 1 := by\n refine tsum_of_norm_bounded ?_ fun b \u21a6 norm_pow_le' _ (Nat.succ_pos b)\n convert (hasSum_nat_add_iff' 1).mpr (hasSum_geometric_of_lt_one (norm_nonneg x) h)\n simp\n linarith\n \u00b7 simp only [tsum_eq_zero_of_not_summable hx, norm_zero]\n nontriviality R\n have : 1 \u2264 \u2016(1 : R)\u2016 := one_le_norm_one R\n have : 0 \u2264 (1 - \u2016x\u2016)\u207b\u00b9 := inv_nonneg.2 (by linarith)\n linarith\n\nvariable [HasSummableGeomSeries R]", "-- Mathlib.Analysis.SpecificLimits.Normed.isUnit_one_sub_of_norm_lt_one (L350-L358)\nlemma isUnit_one_sub_of_norm_lt_one {x : R} (h : \u2016x\u2016 < 1) : IsUnit (1 - x) :=\n\u27e8Units.oneSub x h, rfl\u27e9\n\nend HasSummableGeometricSeries\n\nsection Geometric\n\nvariable {K : Type*} [NormedDivisionRing K] {\u03be : K}", "-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_succ (L47-L49)\nlemma arithGeom_succ [Mul R] [Add R] (n : \u2115) :\n arithGeom a b u\u2080 (n + 1) = a * arithGeom a b u\u2080 n + b := rfl", "-- Mathlib.Analysis.SpecificLimits.Normed.geom_series_mul_neg (L312-L314)\ntheorem geom_series_mul_neg (x : R) (h : \u2016x\u2016 < 1) : (\u2211' i : \u2115, x ^ i) * (1 - x) = 1 :=\n(summable_geometric_of_norm_lt_one h).tsum_pow_mul_one_sub", "-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_strictMono (L114-L121)\nlemma arithGeom_strictMono (ha : 1 < a) (h0 : b / (1 - a) < u\u2080) :\n StrictMono (arithGeom a b u\u2080) := by\nrefine strictMono_nat_of_lt_succ fun n \u21a6 ?_\n have h_lt : b / (1 - a) < arithGeom a b u\u2080 n := div_lt_arithGeom (by positivity) ha.ne' h0 n\n rw [div_lt_iff_of_neg (sub_neg.mpr ha)] at h_lt\n rw [arithGeom_succ]\n linarith", "-- Mathlib.Analysis.SpecificLimits.Normed.cauchy_series_of_le_geometric (L590-L593)\ntheorem cauchy_series_of_le_geometric {C : \u211d} {u : \u2115 \u2192 \u03b1} {r : \u211d} (hr : r < 1)\n (h : \u2200 n, \u2016u n\u2016 \u2264 C * r ^ n) : CauchySeq fun n \u21a6 \u2211 k \u2208 range n, u k :=\ncauchySeq_of_le_geometric r C hr (by simp [h])", "-- Mathlib.Analysis.SpecificLimits.Normed.Units (L333-L338)\ndef Units.oneSub (t : R) (h : \u2016t\u2016 < 1) : R\u02e3 where\n val := 1 - t\ninv := \u2211' n : \u2115, t ^ n\n val_inv := mul_neg_geom_series t h\n inv_val := geom_series_mul_neg t h", "-- Mathlib.Analysis.SpecificLimits.Normed.hasSum_geom_series_inverse (L345-L349)\ntheorem hasSum_geom_series_inverse (x : R) (h : \u2016x\u2016 < 1) :\n HasSum (fun i \u21a6 x ^ i) (1 - x)\u207b\u00b9\u02b3 := by\nconvert (summable_geometric_of_norm_lt_one h).hasSum\n exact (geom_series_eq_inverse x h).symm", "-- Mathlib.Analysis.SpecificLimits.Normed.geom_series_mul_one_add (L326-L331)\ntheorem geom_series_mul_one_add (x : R) (h : \u2016x\u2016 < 1) :\n (1 + x) * \u2211' i : \u2115, x ^ i = 2 * \u2211' i : \u2115, x ^ i - 1 := by\nrw [add_mul, one_mul, geom_series_mul_shift x h, geom_series_succ x h, two_mul, add_sub_assoc]\n\n/-- In a normed ring with summable geometric series, a perturbation of `1` by an element `t`\nof distance less than `1` from `1` is a unit. Here we construct its `Units` structure. -/", "-- Mathlib.Analysis.SpecificLimits.Normed.norm_sub_le_of_geometric_bound_of_hasSum (L574-L579)\ntheorem norm_sub_le_of_geometric_bound_of_hasSum (hr : r < 1) (hf : \u2200 n, \u2016f n\u2016 \u2264 C * r ^ n) {a : \u03b1}\n (ha : HasSum f a) (n : \u2115) : \u2016(\u2211 x \u2208 Finset.range n, f x) - a\u2016 \u2264 C * r ^ n / (1 - r) := by\nrw [\u2190 dist_eq_norm]\n apply dist_le_of_le_geometric_of_tendsto r C hr (dist_partial_sum_le_of_le_geometric hf)\n exact ha.tendsto_sum_nat", "-- Mathlib.Analysis.SpecificLimits.Normed.hasSum_coe_mul_geometric_of_norm_lt_one (L539-L544)\ntheorem hasSum_coe_mul_geometric_of_norm_lt_one {r : \ud835\udd5c} (hr : \u2016r\u2016 < 1) :\n HasSum (fun n \u21a6 n * r ^ n : \u2115 \u2192 \ud835\udd5c) (r / (1 - r) ^ 2) := by\nconvert hasSum_coe_mul_geometric_of_norm_lt_one' hr using 1\n simp [div_eq_mul_inv]\n\n/-- If `\u2016r\u2016 < 1`, then `\u2211' n : \u2115, n * r ^ n = r / (1 - r) ^ 2`. -/", "-- Mathlib.Analysis.SpecificLimits.Normed.summable_norm_geometric_of_norm_lt_one (L429-L434)\ntheorem summable_norm_geometric_of_norm_lt_one {r : R}\n (hr : \u2016r\u2016 < 1) : Summable fun n : \u2115 \u21a6 \u2016(r ^ n : R)\u2016 := by\nsimpa using summable_norm_pow_mul_geometric_of_norm_lt_one 0 hr\n\nvariable [HasSummableGeomSeries R]", "-- Mathlib.Analysis.SpecificLimits.Normed.dist_partial_sum' (L586-L589)\ntheorem dist_partial_sum' (u : \u2115 \u2192 \u03b1) (n : \u2115) :\n dist (\u2211 k \u2208 range n, u k) (\u2211 k \u2208 range (n + 1), u k) = \u2016u n\u2016 := by\nsimp [dist_eq_norm', sum_range_succ]", "-- Mathlib.Analysis.SpecificLimits.Normed.tsum_choose_mul_geometric_of_norm_lt_one' (L465-L468)\nlemma tsum_choose_mul_geometric_of_norm_lt_one' (k : \u2115) {r : R} (hr : \u2016r\u2016 < 1) :\n \u2211' n, (n + k).choose k * r ^ n = ((1 - r)\u207b\u00b9\u02b3) ^ (k + 1) :=\n(hasSum_choose_mul_geometric_of_norm_lt_one' k hr).tsum_eq", "-- Mathlib.Analysis.SpecificLimits.Normed.dist_partial_sum (L581-L584)\ntheorem dist_partial_sum (u : \u2115 \u2192 \u03b1) (n : \u2115) :\n dist (\u2211 k \u2208 range (n + 1), u k) (\u2211 k \u2208 range n, u k) = \u2016u n\u2016 := by\nsimp [dist_eq_norm, sum_range_succ]", "-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.div_lt_arithGeom (L105-L113)\nlemma div_lt_arithGeom (ha_pos : 0 < a) (ha_ne : a \u2260 1) (h0 : b / (1 - a) < u\u2080) (n : \u2115) :\n b / (1 - a) < arithGeom a b u\u2080 n := by\ninduction n with\n | zero => exact h0\n | succ n hn =>\n calc b / (1 - a)\n _ = a * (b / (1 - a)) + b := by grind\n _ < a * arithGeom a b u\u2080 n + b := by gcongr", "-- Mathlib.Analysis.SpecificLimits.Normed.mul_neg_geom_series (L315-L317)\ntheorem mul_neg_geom_series (x : R) (h : \u2016x\u2016 < 1) : (1 - x) * \u2211' i : \u2115, x ^ i = 1 :=\n(summable_geometric_of_norm_lt_one h).one_sub_mul_tsum_pow", "-- Mathlib.Analysis.SpecificLimits.Normed.tsum_coe_mul_geometric_of_norm_lt_one (L545-L558)\ntheorem tsum_coe_mul_geometric_of_norm_lt_one {r : \ud835\udd5c} (hr : \u2016r\u2016 < 1) :\n (\u2211' n : \u2115, n * r ^ n : \ud835\udd5c) = r / (1 - r) ^ 2 :=\n(hasSum_coe_mul_geometric_of_norm_lt_one hr).tsum_eq\n\nend MulGeometric\n\nsection SummableLeGeometric\n\nvariable [SeminormedAddCommGroup \u03b1] {r C : \u211d} {f : \u2115 \u2192 \u03b1}\n\nnonrec theorem SeminormedAddCommGroup.cauchySeq_of_le_geometric {C : \u211d} {r : \u211d} (hr : r < 1)\n {u : \u2115 \u2192 \u03b1} (h : \u2200 n, \u2016u n - u (n + 1)\u2016 \u2264 C * r ^ n) : CauchySeq u :=\n cauchySeq_of_le_geometric r C hr (by simpa [dist_eq_norm] using h)", "-- Mathlib.Analysis.SpecificLimits.Normed.geom_series_eq_inverse (L339-L344)\ntheorem geom_series_eq_inverse (x : R) (h : \u2016x\u2016 < 1) :\n \u2211' i, x ^ i = (1 - x)\u207b\u00b9\u02b3 := by\nchange (Units.oneSub x h)\u207b\u00b9 = (1 - x)\u207b\u00b9\u02b3\n rw [\u2190 Ring.inverse_unit]\n rfl", "-- Mathlib.Analysis.SpecificLimits.Normed.isLittleO_coe_const_pow_of_one_lt (L164-L168)\ntheorem isLittleO_coe_const_pow_of_one_lt {R : Type*} [NormedRing R] {r : \u211d} (hr : 1 < r) :\n ((\u2191) : \u2115 \u2192 R) =o[atTop] fun n \u21a6 r ^ n := by\nsimpa only [pow_one] using @isLittleO_pow_const_const_pow_of_one_lt R _ 1 _ hr\n\n/-- If `\u2016r\u2081\u2016 < r\u2082`, then for any natural `k` we have `n ^ k r\u2081 ^ n = o (r\u2082 ^ n)` as `n \u2192 \u221e`. -/", "-- Mathlib.Analysis.SpecificLimits.FloorPow.sum_div_nat_floor_pow_sq_le_div_sq (L272-L298)\ntheorem sum_div_nat_floor_pow_sq_le_div_sq (N : \u2115) {j : \u211d} (hj : 0 < j) {c : \u211d} (hc : 1 < c) :\n (\u2211 i \u2208 range N with j < \u230ac ^ i\u230b\u208a, (1 : \u211d) / (\u230ac ^ i\u230b\u208a : \u211d) ^ 2) \u2264\n c ^ 5 * (c - 1)\u207b\u00b9 ^ 3 / j ^ 2 := by\nhave cpos : 0 < c := zero_lt_one.trans hc\n have A : 0 < 1 - c\u207b\u00b9 := sub_pos.2 (inv_lt_one_of_one_lt\u2080 hc)\n calc\n (\u2211 i \u2208 range N with j < \u230ac ^ i\u230b\u208a, (1 : \u211d) / (\u230ac ^ i\u230b\u208a : \u211d) ^ 2) \u2264\n \u2211 i \u2208 range N with j < c ^ i, (1 : \u211d) / (\u230ac ^ i\u230b\u208a : \u211d) ^ 2 := by\n gcongr with k hk; exact Nat.floor_le (by positivity)\n _ \u2264 \u2211 i \u2208 range N with j < c ^ i, (1 - c\u207b\u00b9)\u207b\u00b9 ^ 2 * ((1 : \u211d) / (c ^ i) ^ 2) := by\n gcongr with i\n rw [mul_div_assoc', mul_one, div_le_div_iff\u2080]; rotate_left\n \u00b7 apply sq_pos_of_pos\n refine zero_lt_one.trans_le ?_\n simp only [Nat.le_floor, one_le_pow\u2080, hc.le, Nat.one_le_cast, Nat.cast_one]\n \u00b7 exact sq_pos_of_pos (pow_pos cpos _)\n rw [one_mul, \u2190 mul_pow]\n gcongr\n rw [\u2190 div_eq_inv_mul, le_div_iff\u2080 A, mul_comm]\n exact mul_pow_le_nat_floor_pow hc i\n _ \u2264 (1 - c\u207b\u00b9)\u207b\u00b9 ^ 2 * (c ^ 3 * (c - 1)\u207b\u00b9) / j ^ 2 := by\n rw [\u2190 mul_sum, \u2190 mul_div_assoc']\n gcongr\n exact sum_div_pow_sq_le_div_sq N hj hc\n _ = c ^ 5 * (c - 1)\u207b\u00b9 ^ 3 / j ^ 2 := by\n congr 1\n field", "-- Mathlib.Analysis.SpecificLimits.FloorPow.tendsto_div_of_monotone_of_tendsto_div_floor_pow (L182-L213)\ntheorem tendsto_div_of_monotone_of_tendsto_div_floor_pow (u : \u2115 \u2192 \u211d) (l : \u211d) (hmono : Monotone u)\n (c : \u2115 \u2192 \u211d) (cone : \u2200 k, 1 < c k) (clim : Tendsto c atTop (\ud835\udcdd 1))\n (hc : \u2200 k, Tendsto (fun n : \u2115 => u \u230ac k ^ n\u230b\u208a / \u230ac k ^ n\u230b\u208a) atTop (\ud835\udcdd l)) :\n Tendsto (fun n => u n / n) atTop (\ud835\udcdd l) := by\napply tendsto_div_of_monotone_of_exists_subseq_tendsto_div u l hmono\n intro a ha\n obtain \u27e8k, hk\u27e9 : \u2203 k, c k < a := ((tendsto_order.1 clim).2 a ha).exists\n refine\n \u27e8fun n => \u230ac k ^ n\u230b\u208a, ?_,\n (tendsto_nat_floor_atTop (\u03b1 := \u211d)).comp (tendsto_pow_atTop_atTop_of_one_lt (cone k)), hc k\u27e9\n have H : \u2200 n : \u2115, (0 : \u211d) < \u230ac k ^ n\u230b\u208a := by\n intro n\n refine zero_lt_one.trans_le ?_\n simp only [Nat.one_le_cast, Nat.one_le_floor_iff, one_le_pow\u2080 (cone k).le]\n have A :\n Tendsto (fun n : \u2115 => (\u230ac k ^ (n + 1)\u230b\u208a : \u211d) / c k ^ (n + 1) * c k / (\u230ac k ^ n\u230b\u208a / c k ^ n))\n atTop (\ud835\udcdd (1 * c k / 1)) := by\n refine Tendsto.div (Tendsto.mul ?_ tendsto_const_nhds) ?_ one_ne_zero\n \u00b7 refine tendsto_nat_floor_div_atTop.comp ?_\n exact (tendsto_pow_atTop_atTop_of_one_lt (cone k)).comp (tendsto_add_atTop_nat 1)\n \u00b7 refine tendsto_nat_floor_div_atTop.comp ?_\n exact tendsto_pow_atTop_atTop_of_one_lt (cone k)\n have B : Tendsto (fun n : \u2115 => (\u230ac k ^ (n + 1)\u230b\u208a : \u211d) / \u230ac k ^ n\u230b\u208a) atTop (\ud835\udcdd (c k)) := by\n simp only [one_mul, div_one] at A\n convert A using 1\n ext1 n\n field [(zero_lt_one.trans (cone k)).ne']\n filter_upwards [(tendsto_order.1 B).2 a hk] with n hn\n exact (div_le_iff\u2080 (H n)).1 hn.le\n\n/-- The sum of `1/(c^i)^2` above a threshold `j` is comparable to `1/j^2`, up to a multiplicative\nconstant. -/", "-- Mathlib.Analysis.SpecificLimits.Fibonacci.tendsto_fib_succ_div_fib_atTop (L23-L35)\ntheorem tendsto_fib_succ_div_fib_atTop :\n Tendsto (fun n \u21a6 (fib (n + 1) / fib n : \u211d)) atTop (\ud835\udcdd \u03c6) := by\nhave h\u2081 n : (fib (n + 1) / fib n : \u211d) = (\u03c6 - \u03c8 * (\u03c8 / \u03c6) ^ n) / (1 - (\u03c8 / \u03c6) ^ n) := by\n simp only [coe_fib_eq, pow_succ, div_pow]\n field\n have h\u2082 := tendsto_pow_atTop_nhds_zero_of_abs_lt_one (r := \u03c8 / \u03c6) <| by\n rw [abs_div, div_lt_one <| by positivity, abs_of_pos goldenRatio_pos, abs_lt]\n ring_nf\n bound\n rw [show \u03c6 = (\u03c6 - \u03c8 * 0) / (1 - 0) by ring, funext h\u2081]\n exact const_sub _ (const_mul _ h\u2082) |>.div (const_sub _ h\u2082) <| by simp\n\n/-- The limit of `fib n / fib (n + 1)` as `n \u2192 \u221e` is the negative conjugate of the golden ratio. -/", "-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_eq_add_sum (L50-L61)\nlemma arithGeom_eq_add_sum [CommSemiring R] (n : \u2115) :\n arithGeom a b u\u2080 n = a ^ n * u\u2080 + b * \u2211 k \u2208 Finset.range n, a ^ k := by\ninduction n with\n | zero => simp\n | succ n hn =>\n rw [arithGeom_succ, hn, mul_add, \u2190 mul_assoc, add_comm n, pow_add, pow_one, add_assoc]\n congr\n rw [add_comm _ n, Finset.sum_range_succ', Finset.mul_sum, pow_zero, mul_add, mul_one,\n Finset.mul_sum, Finset.mul_sum]\n congr with k\n ring", "-- Mathlib.Analysis.SpecificLimits.Normed.tsum_geometric_of_abs_lt_one (L382-L386)\ntheorem tsum_geometric_of_abs_lt_one {r : \u211d} (h : |r| < 1) : \u2211' n : \u2115, r ^ n = (1 - r)\u207b\u00b9 :=\ntsum_geometric_of_norm_lt_one h\n\n/-- A geometric series in a normed field is summable iff the norm of the common ratio is less than\none. -/", "-- Mathlib.Analysis.SpecificLimits.Normed.isLittleO_pow_pow_of_lt_left (L65-L71)\ntheorem isLittleO_pow_pow_of_lt_left {r\u2081 r\u2082 : \u211d} (h\u2081 : 0 \u2264 r\u2081) (h\u2082 : r\u2081 < r\u2082) :\n (fun n : \u2115 \u21a6 r\u2081 ^ n) =o[atTop] fun n \u21a6 r\u2082 ^ n :=\nhave H : 0 < r\u2082 := h\u2081.trans_lt h\u2082\n (isLittleO_of_tendsto fun _ hn \u21a6 False.elim <| H.ne' <| eq_zero_of_pow_eq_zero hn) <|\n (tendsto_pow_atTop_nhds_zero_of_lt_one\n (div_nonneg h\u2081 (h\u2081.trans h\u2082.le)) ((div_lt_one H).2 h\u2082)).congr fun _ \u21a6 div_pow _ _ _", "-- Mathlib.Analysis.SpecificLimits.Normed.summable_choose_mul_geometric_of_norm_lt_one (L461-L464)\nlemma summable_choose_mul_geometric_of_norm_lt_one (k : \u2115) {r : R} (hr : \u2016r\u2016 < 1) :\n Summable (fun n \u21a6 (n + k).choose k * r ^ n) :=\n(hasSum_choose_mul_geometric_of_norm_lt_one' k hr).summable", "-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_pow_atTop_nhds_zero_iff_norm_lt_one (L231-L247)\nlemma tendsto_pow_atTop_nhds_zero_iff_norm_lt_one {R : Type*} [SeminormedRing R] [NormMulClass R]\n {x : R} : Tendsto (fun n : \u2115 \u21a6 x ^ n) atTop (\ud835\udcdd 0) \u2194 \u2016x\u2016 < 1 := by\n-- this proof is slightly fiddly since `\u2016x ^ n\u2016 = \u2016x\u2016 ^ n` might not hold for `n = 0`\n refine \u27e8?_, tendsto_pow_atTop_nhds_zero_of_norm_lt_one\u27e9\n rw [\u2190 abs_of_nonneg (norm_nonneg _), \u2190 tendsto_pow_atTop_nhds_zero_iff,\n tendsto_zero_iff_norm_tendsto_zero]\n apply Tendsto.congr'\n filter_upwards [eventually_ge_atTop 1] with n hn\n induction n, hn using Nat.le_induction with\n | base => simp\n | succ n hn IH => simp [pow_succ, IH]\n\nvariable {R S : Type*} [Field R] [Field S] [LinearOrder S] {v w : AbsoluteValue R S}\n [TopologicalSpace S] [IsStrictOrderedRing S] [Archimedean S] [_i : OrderTopology S]\n\n/-- `v (1 / (1 + a ^n))` tends to `1` for all `v : AbsoluteValue R S` for fields `R` and `S`,\nprovided `v a < 1`. -/", "-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.tendsto_arithGeom_atTop_of_one_lt (L122-L128)\nlemma tendsto_arithGeom_atTop_of_one_lt [Archimedean R] (ha : 1 < a) (h0 : b / (1 - a) < u\u2080) :\n Tendsto (arithGeom a b u\u2080) atTop atTop := by\nrw [arithGeom_eq' ha.ne']\n refine tendsto_atTop_add_const_right _ _ ?_\n refine Tendsto.atTop_mul_const (sub_pos.mpr h0) ?_\n exact tendsto_pow_atTop_atTop_of_one_lt ha", "-- Mathlib.Analysis.SpecificLimits.Normed.isBigO_pow_pow_of_le_left (L72-L75)\ntheorem isBigO_pow_pow_of_le_left {r\u2081 r\u2082 : \u211d} (h\u2081 : 0 \u2264 r\u2081) (h\u2082 : r\u2081 \u2264 r\u2082) :\n (fun n : \u2115 \u21a6 r\u2081 ^ n) =O[atTop] fun n \u21a6 r\u2082 ^ n :=\nh\u2082.eq_or_lt.elim (fun h \u21a6 h \u25b8 isBigO_refl _ _) fun h \u21a6 (isLittleO_pow_pow_of_lt_left h\u2081 h).isBigO", "-- Mathlib.Analysis.SpecificLimits.Fibonacci.tendsto_fib_div_fib_succ_atTop (L36-L40)\ntheorem tendsto_fib_div_fib_succ_atTop :\n Tendsto (fun n \u21a6 (fib n / fib (n + 1) : \u211d)) atTop (\ud835\udcdd (-\u03c8)) := by\nconvert tendsto_fib_succ_div_fib_atTop.inv\u2080 (by positivity) using 2\n \u00b7 rw [inv_div]\n \u00b7 rw [inv_goldenRatio]", "-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_intCast_atBot_sup_atTop_cobounded (L45-L52)\ntheorem tendsto_intCast_atBot_sup_atTop_cobounded\n [NormedRing \u03b1] [NormSMulClass \u2124 \u03b1] [Nontrivial \u03b1] :\n Tendsto Int.cast (atBot \u2294 atTop) (Bornology.cobounded \u03b1) := by\nrw [\u2190 tendsto_norm_atTop_iff_cobounded]\n simpa [norm_intCast_eq_abs_mul_norm_one] using tendsto_intCast_atTop_atTop\n |>.comp (tendsto_abs_atBot_atTop.sup tendsto_abs_atTop_atTop)\n |>.atTop_mul_const (norm_pos_iff.mpr one_ne_zero)", "-- Mathlib.Analysis.SpecificLimits.Normed.hasSum_choose_mul_geometric_of_norm_lt_one' (L435-L460)\nlemma hasSum_choose_mul_geometric_of_norm_lt_one'\n (k : \u2115) {r : R} (hr : \u2016r\u2016 < 1) :\n HasSum (fun n \u21a6 (n + k).choose k * r ^ n) ((1 - r)\u207b\u00b9\u02b3 ^ (k + 1)) := by\ninduction k with\n | zero => simpa using hasSum_geom_series_inverse r hr\n | succ k ih =>\n have I1 : Summable (fun (n : \u2115) \u21a6 \u2016(n + k).choose k * r ^ n\u2016) := by\n apply summable_norm_mul_geometric_of_norm_lt_one (k := k) hr\n apply isBigO_iff.2 \u27e82 ^ k, ?_\u27e9\n filter_upwards [Ioi_mem_atTop k] with n (hn : k < n)\n simp only [Real.norm_eq_abs, abs_cast, cast_pow, norm_pow]\n norm_cast\n calc (n + k).choose k\n _ \u2264 (2 * n).choose k := choose_le_choose k (by lia)\n _ \u2264 (2 * n) ^ k := Nat.choose_le_pow _ _\n _ = 2 ^ k * n ^ k := Nat.mul_pow 2 n k\n convert hasSum_sum_range_mul_of_summable_norm' I1 ih.summable\n (summable_norm_geometric_of_norm_lt_one hr) (summable_geometric_of_norm_lt_one hr) with n\n \u00b7 have : \u2211 i \u2208 Finset.range (n + 1), \u2191((i + k).choose k) * r ^ i * r ^ (n - i) =\n \u2211 i \u2208 Finset.range (n + 1), \u2191((i + k).choose k) * r ^ n := by\n apply Finset.sum_congr rfl (fun i hi \u21a6 ?_)\n simp only [Finset.mem_range] at hi\n rw [mul_assoc, \u2190 pow_add, show i + (n - i) = n by lia]\n simp [this, \u2190 sum_mul, \u2190 Nat.cast_sum, sum_range_add_choose n k, add_assoc]\n \u00b7 rw [ih.tsum_eq, (hasSum_geom_series_inverse r hr).tsum_eq, pow_succ]", "-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_eq (L72-L77)\nlemma arithGeom_eq (ha : a \u2260 1) (n : \u2115) :\n arithGeom a b u\u2080 n = a ^ n * (u\u2080 - (b / (1 - a))) + b / (1 - a) := by\ninduction n with\n | zero => simp\n | succ n hn => unfold arithGeom; grind", "-- Mathlib.Analysis.SpecificLimits.Normed.tsum_coe_mul_geometric_of_norm_lt_one' (L534-L538)\ntheorem tsum_coe_mul_geometric_of_norm_lt_one'\n {r : \ud835\udd5c} (hr : \u2016r\u2016 < 1) : (\u2211' n : \u2115, n * r ^ n : \ud835\udd5c) = r * (1 - r)\u207b\u00b9\u02b3 ^ 2 :=\n(hasSum_coe_mul_geometric_of_norm_lt_one' hr).tsum_eq\n\n/-- If `\u2016r\u2016 < 1`, then `\u2211' n : \u2115, n * r ^ n = r / (1 - r) ^ 2`, `HasSum` version. -/", "-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_zero_eq_mul_div (L98-L104)\nlemma arithGeom_zero_eq_mul_div (ha : a \u2260 1) (n : \u2115) :\n arithGeom a b 0 n = b * (a ^ n - 1) / (a - 1) := by\nrw [arithGeom_zero_eq_mul_div' ha n, \u2190 neg_sub _ a, div_neg, \u2190 neg_sub _ (a ^ n), mul_neg,\n neg_div, neg_neg]\n\nvariable [LinearOrder R] [IsStrictOrderedRing R]", "-- Mathlib.Analysis.SpecificLimits.Normed.hasSum_geometric_of_norm_lt_one (L359-L368)\ntheorem hasSum_geometric_of_norm_lt_one (h : \u2016\u03be\u2016 < 1) : HasSum (fun n : \u2115 \u21a6 \u03be ^ n) (1 - \u03be)\u207b\u00b9 := by\nhave xi_ne_one : \u03be \u2260 1 := by\n contrapose! h\n simp [h]\n have A : Tendsto (fun n \u21a6 (\u03be ^ n - 1) * (\u03be - 1)\u207b\u00b9) atTop (\ud835\udcdd ((0 - 1) * (\u03be - 1)\u207b\u00b9)) :=\n ((tendsto_pow_atTop_nhds_zero_of_norm_lt_one h).sub tendsto_const_nhds).mul tendsto_const_nhds\n rw [hasSum_iff_tendsto_nat_of_summable_norm]\n \u00b7 simpa [geom_sum_eq, xi_ne_one, neg_inv, div_eq_mul_inv] using A\n \u00b7 simp [norm_pow, summable_geometric_of_lt_one (norm_nonneg _) h]", "-- Mathlib.Analysis.SpecificLimits.Normed.isLittleO_pow_const_const_pow_of_one_lt (L146-L163)\ntheorem isLittleO_pow_const_const_pow_of_one_lt {R : Type*} [NormedRing R] (k : \u2115) {r : \u211d}\n (hr : 1 < r) : (fun n \u21a6 (n : R) ^ k : \u2115 \u2192 R) =o[atTop] fun n \u21a6 r ^ n := by\nhave : Tendsto (fun x : \u211d \u21a6 x ^ k) (\ud835\udcdd[>] 1) (\ud835\udcdd 1) :=\n ((continuous_id.pow k).tendsto' (1 : \u211d) 1 (one_pow _)).mono_left inf_le_left\n obtain \u27e8r' : \u211d, hr' : r' ^ k < r, h1 : 1 < r'\u27e9 :=\n ((this.eventually (gt_mem_nhds hr)).and self_mem_nhdsWithin).exists\n have h0 : 0 \u2264 r' := zero_le_one.trans h1.le\n suffices (fun n \u21a6 (n : R) ^ k : \u2115 \u2192 R) =O[atTop] fun n : \u2115 \u21a6 (r' ^ k) ^ n from\n this.trans_isLittleO (isLittleO_pow_pow_of_lt_left (pow_nonneg h0 _) hr')\n conv in (r' ^ _) ^ _ => rw [\u2190 pow_mul, mul_comm, pow_mul]\n suffices \u2200 n : \u2115, \u2016(n : R)\u2016 \u2264 (r' - 1)\u207b\u00b9 * \u2016(1 : R)\u2016 * \u2016r' ^ n\u2016 from\n (isBigO_of_le' _ this).pow _\n intro n\n rw [mul_right_comm]\n refine n.norm_cast_le.trans (mul_le_mul_of_nonneg_right ?_ (norm_nonneg _))\n simpa [_root_.div_eq_inv_mul, Real.norm_eq_abs, abs_of_nonneg h0] using n.cast_le_pow_div_sub h1\n\n/-- For a real `r > 1` we have `n = o(r ^ n)` as `n \u2192 \u221e`. -/", "-- Mathlib.Analysis.SpecificLimits.Normed.summable_norm_mul_geometric_of_norm_lt_one (L402-L422)\ntheorem summable_norm_mul_geometric_of_norm_lt_one {k : \u2115} {r : R}\n (hr : \u2016r\u2016 < 1) {u : \u2115 \u2192 \u2115} (hu : (fun n \u21a6 (u n : \u211d)) =O[atTop] (fun n \u21a6 (\u2191(n ^ k) : \u211d))) :\n Summable fun n : \u2115 \u21a6 \u2016(u n * r ^ n : R)\u2016 := by\nrcases exists_between hr with \u27e8r', hrr', h\u27e9\n rw [\u2190 norm_norm] at hrr'\n apply summable_of_isBigO_nat (summable_geometric_of_lt_one ((norm_nonneg _).trans hrr'.le) h)\n calc\n fun n \u21a6 \u2016\u2191(u n) * r ^ n\u2016\n _ =O[atTop] fun n \u21a6 u n * \u2016r\u2016 ^ n := by\n apply (IsBigOWith.of_bound (c := \u2016(1 : R)\u2016) ?_).isBigO\n filter_upwards [eventually_norm_pow_le r] with n hn\n simp only [norm_mul, Real.norm_eq_abs, abs_cast, norm_pow, abs_norm]\n apply (norm_mul_le _ _).trans\n have : \u2016(u n : R)\u2016 * \u2016r ^ n\u2016 \u2264 (u n * \u2016(1 : R)\u2016) * \u2016r\u2016 ^ n := by\n gcongr; exact norm_cast_le (u n)\n exact this.trans (le_of_eq (by ring))\n _ =O[atTop] fun n \u21a6 \u2191(n ^ k) * \u2016r\u2016 ^ n := hu.mul (isBigO_refl _ _)\n _ =O[atTop] fun n \u21a6 r' ^ n := by\n simp only [cast_pow]\n exact (isLittleO_pow_const_mul_const_pow_const_pow_of_norm_lt k hrr').isBigO", "-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_self_mul_const_pow_of_lt_one (L216-L220)\ntheorem tendsto_self_mul_const_pow_of_lt_one {r : \u211d} (hr : 0 \u2264 r) (h'r : r < 1) :\n Tendsto (fun n \u21a6 n * r ^ n : \u2115 \u2192 \u211d) atTop (\ud835\udcdd 0) := by\nsimpa only [pow_one] using tendsto_pow_const_mul_const_pow_of_lt_one 1 hr h'r\n\n/-- In a normed ring, the powers of an element x with `\u2016x\u2016 < 1` tend to zero. -/", "-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_pow_atTop_nhds_zero_of_abs_lt_one (L227-L230)\ntheorem tendsto_pow_atTop_nhds_zero_of_abs_lt_one {r : \u211d} (h : |r| < 1) :\n Tendsto (fun n : \u2115 \u21a6 r ^ n) atTop (\ud835\udcdd 0) :=\ntendsto_pow_atTop_nhds_zero_of_norm_lt_one h", "-- Mathlib.Analysis.SpecificLimits.Normed.tsum_geometric_of_norm_lt_one (L372-L374)\ntheorem tsum_geometric_of_norm_lt_one (h : \u2016\u03be\u2016 < 1) : \u2211' n : \u2115, \u03be ^ n = (1 - \u03be)\u207b\u00b9 :=\n(hasSum_geometric_of_norm_lt_one h).tsum_eq", "-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_same_eq_sum (L62-L65)\nlemma arithGeom_same_eq_sum [CommSemiring R] (n : \u2115) :\n arithGeom a b b n = b * \u2211 k \u2208 Finset.range (n + 1), a ^ k := by\nrw [arithGeom_eq_add_sum, Finset.sum_range_succ, mul_add, add_comm, mul_comm _ b]", "-- Mathlib.Analysis.SpecificLimits.Normed.hasSum_choose_mul_geometric_of_norm_lt_one (L469-L474)\nlemma hasSum_choose_mul_geometric_of_norm_lt_one\n (k : \u2115) {r : \ud835\udd5c} (hr : \u2016r\u2016 < 1) :\n HasSum (fun n \u21a6 (n + k).choose k * r ^ n) (1 / (1 - r) ^ (k + 1)) := by\nconvert hasSum_choose_mul_geometric_of_norm_lt_one' k hr\n simp", "-- Mathlib.Analysis.SpecificLimits.Normed.summable_geometric_iff_norm_lt_one (L388-L401)\ntheorem summable_geometric_iff_norm_lt_one : (Summable fun n : \u2115 \u21a6 \u03be ^ n) \u2194 \u2016\u03be\u2016 < 1 := by\nrefine \u27e8fun h \u21a6 ?_, summable_geometric_of_norm_lt_one\u27e9\n obtain \u27e8k : \u2115, hk : dist (\u03be ^ k) 0 < 1\u27e9 :=\n (h.tendsto_cofinite_zero.eventually (ball_mem_nhds _ zero_lt_one)).exists\n simp only [norm_pow, dist_zero_right] at hk\n rw [\u2190 one_pow k] at hk\n exact lt_of_pow_lt_pow_left\u2080 _ zero_le_one hk\n\nend Geometric\n\nsection MulGeometric\n\nvariable {R : Type*} [NormedRing R] {\ud835\udd5c : Type*} [NormedDivisionRing \ud835\udd5c]", "-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_pow_const_div_const_pow_of_one_lt (L182-L186)\ntheorem tendsto_pow_const_div_const_pow_of_one_lt (k : \u2115) {r : \u211d} (hr : 1 < r) :\n Tendsto (fun n \u21a6 (n : \u211d) ^ k / r ^ n : \u2115 \u2192 \u211d) atTop (\ud835\udcdd 0) :=\n(isLittleO_pow_const_const_pow_of_one_lt k hr).tendsto_div_nhds_zero\n\n/-- If `|r| < 1`, then `n ^ k r ^ n` tends to zero for any natural `k`. -/", "-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_pow_atTop_nhds_zero_of_norm_lt_one (L221-L226)\ntheorem tendsto_pow_atTop_nhds_zero_of_norm_lt_one {R : Type*} [SeminormedRing R] {x : R}\n (h : \u2016x\u2016 < 1) :\n Tendsto (fun n : \u2115 \u21a6 x ^ n) atTop (\ud835\udcdd 0) := by\napply squeeze_zero_norm' (eventually_norm_pow_le x)\n exact tendsto_pow_atTop_nhds_zero_of_lt_one (norm_nonneg _) h", "-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_intCast_atBot_cobounded (L53-L57)\ntheorem tendsto_intCast_atBot_cobounded\n [NormedRing \u03b1] [NormSMulClass \u2124 \u03b1] [Nontrivial \u03b1] :\n Tendsto Int.cast atBot (Bornology.cobounded \u03b1) :=\ntendsto_intCast_atBot_sup_atTop_cobounded.mono_left le_sup_left", "-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_intCast_atTop_cobounded (L58-L64)\ntheorem tendsto_intCast_atTop_cobounded\n [NormedRing \u03b1] [NormSMulClass \u2124 \u03b1] [Nontrivial \u03b1] :\n Tendsto Int.cast atTop (Bornology.cobounded \u03b1) :=\ntendsto_intCast_atBot_sup_atTop_cobounded.mono_left le_sup_right\n\n/-! ### Powers -/", "-- Mathlib.Analysis.SpecificLimits.Normed.hasSum_geometric_of_abs_lt_one (L375-L378)\ntheorem hasSum_geometric_of_abs_lt_one {r : \u211d} (h : |r| < 1) :\n HasSum (fun n : \u2115 \u21a6 r ^ n) (1 - r)\u207b\u00b9 :=\nhasSum_geometric_of_norm_lt_one h", "-- Mathlib.Analysis.SpecificLimits.Normed.TFAE_exists_lt_isLittleO_pow (L96-L145)\ntheorem TFAE_exists_lt_isLittleO_pow (f : \u2115 \u2192 \u211d) (R : \u211d) :\n TFAE\n [\u2203 a \u2208 Ioo (-R) R, f =o[atTop] (a ^ \u00b7), \u2203 a \u2208 Ioo 0 R, f =o[atTop] (a ^ \u00b7),\n \u2203 a \u2208 Ioo (-R) R, f =O[atTop] (a ^ \u00b7), \u2203 a \u2208 Ioo 0 R, f =O[atTop] (a ^ \u00b7),\n \u2203 a < R, \u2203 C : \u211d, (0 < C \u2228 0 < R) \u2227 \u2200 n, |f n| \u2264 C * a ^ n,\n \u2203 a \u2208 Ioo 0 R, \u2203 C > 0, \u2200 n, |f n| \u2264 C * a ^ n, \u2203 a < R, \u2200\u1da0 n in atTop, |f n| \u2264 a ^ n,\n \u2203 a \u2208 Ioo 0 R, \u2200\u1da0 n in atTop, |f n| \u2264 a ^ n] := by\nhave A : Ico 0 R \u2286 Ioo (-R) R :=\n fun x hx \u21a6 \u27e8(neg_lt_zero.2 (hx.1.trans_lt hx.2)).trans_le hx.1, hx.2\u27e9\n have B : Ioo 0 R \u2286 Ioo (-R) R := Subset.trans Ioo_subset_Ico_self A\n -- First we prove that 1-4 are equivalent using 2 \u2192 3 \u2192 4, 1 \u2192 3, and 2 \u2192 1\n tfae_have 1 \u2192 3 := fun \u27e8a, ha, H\u27e9 \u21a6 \u27e8a, ha, H.isBigO\u27e9\n tfae_have 2 \u2192 1 := fun \u27e8a, ha, H\u27e9 \u21a6 \u27e8a, B ha, H\u27e9\n tfae_have 3 \u2192 2\n | \u27e8a, ha, H\u27e9 => by\n rcases exists_between (abs_lt.2 ha) with \u27e8b, hab, hbR\u27e9\n exact \u27e8b, \u27e8(abs_nonneg a).trans_lt hab, hbR\u27e9,\n H.trans_isLittleO (isLittleO_pow_pow_of_abs_lt_left (hab.trans_le (le_abs_self b)))\u27e9\n tfae_have 2 \u2192 4 := fun \u27e8a, ha, H\u27e9 \u21a6 \u27e8a, ha, H.isBigO\u27e9\n tfae_have 4 \u2192 3 := fun \u27e8a, ha, H\u27e9 \u21a6 \u27e8a, B ha, H\u27e9\n -- Add 5 and 6 using 4 \u2192 6 \u2192 5 \u2192 3\n tfae_have 4 \u2192 6\n | \u27e8a, ha, H\u27e9 => by\n rcases bound_of_isBigO_nat_atTop H with \u27e8C, hC\u2080, hC\u27e9\n refine \u27e8a, ha, C, hC\u2080, fun n \u21a6 ?_\u27e9\n simpa only [Real.norm_eq_abs, abs_pow, abs_of_nonneg ha.1.le] using hC (pow_ne_zero n ha.1.ne')\n tfae_have 6 \u2192 5 := fun \u27e8a, ha, C, H\u2080, H\u27e9 \u21a6 \u27e8a, ha.2, C, Or.inl H\u2080, H\u27e9\n tfae_have 5 \u2192 3\n | \u27e8a, ha, C, h\u2080, H\u27e9 => by\n rcases sign_cases_of_C_mul_pow_nonneg fun n \u21a6 (abs_nonneg _).trans (H n) with (rfl | \u27e8hC\u2080, ha\u2080\u27e9)\n \u00b7 obtain rfl : f = 0 := by\n ext n\n simpa using H n\n simp only [lt_irrefl, false_or] at h\u2080\n exact \u27e80, \u27e8neg_lt_zero.2 h\u2080, h\u2080\u27e9, isBigO_zero _ _\u27e9\n exact \u27e8a, A \u27e8ha\u2080, ha\u27e9,\n isBigO_of_le' _ fun n \u21a6 (H n).trans <| mul_le_mul_of_nonneg_left (le_abs_self _) hC\u2080.le\u27e9\n -- Add 7 and 8 using 2 \u2192 8 \u2192 7 \u2192 3\n tfae_have 2 \u2192 8\n | \u27e8a, ha, H\u27e9 => by\n refine \u27e8a, ha, (H.def zero_lt_one).mono fun n hn \u21a6 ?_\u27e9\n rwa [Real.norm_eq_abs, Real.norm_eq_abs, one_mul, abs_pow, abs_of_pos ha.1] at hn\n tfae_have 8 \u2192 7 := fun \u27e8a, ha, H\u27e9 \u21a6 \u27e8a, ha.2, H\u27e9\n tfae_have 7 \u2192 3\n | \u27e8a, ha, H\u27e9 => by\n refine \u27e8a, A \u27e8?_, ha\u27e9, .of_norm_eventuallyLE H\u27e9\n exact nonneg_of_eventually_pow_nonneg (H.mono fun n \u21a6 (abs_nonneg _).trans)\n tfae_finish\n\n/-- For any natural `k` and a real `r > 1` we have `n ^ k = o(r ^ n)` as `n \u2192 \u221e`. -/", "-- Mathlib.Analysis.SpecificLimits.Normed.hasSum_coe_mul_geometric_of_norm_lt_one' (L515-L533)\ntheorem hasSum_coe_mul_geometric_of_norm_lt_one'\n {x : R} (h : \u2016x\u2016 < 1) :\n HasSum (fun n \u21a6 n * x ^ n : \u2115 \u2192 R) (x * ((1 - x)\u207b\u00b9\u02b3) ^ 2) := by\nhave A : HasSum (fun (n : \u2115) \u21a6 (n + 1) * x ^ n) ((1 - x)\u207b\u00b9\u02b3 ^ 2) := by\n convert hasSum_choose_mul_geometric_of_norm_lt_one' 1 h with n\n simp\n have B : HasSum (fun (n : \u2115) \u21a6 x ^ n) ((1 - x)\u207b\u00b9\u02b3) := hasSum_geom_series_inverse x h\n convert A.sub B using 1\n \u00b7 ext n\n simp [add_mul]\n \u00b7 symm\n calc (1 - x)\u207b\u00b9\u02b3 ^ 2 - (1 - x)\u207b\u00b9\u02b3\n _ = (1 - x)\u207b\u00b9\u02b3 ^ 2 - ((1 - x) * (1 - x)\u207b\u00b9\u02b3) * (1 - x)\u207b\u00b9\u02b3 := by\n simp [Ring.mul_inverse_cancel (1 - x) (isUnit_one_sub_of_norm_lt_one h)]\n _ = x * (1 - x)\u207b\u00b9\u02b3 ^ 2 := by noncomm_ring\n\n/-- If `\u2016r\u2016 < 1`, then `\u2211' n : \u2115, n * r ^ n = r / (1 - r) ^ 2`, version in a general ring with\nsummable geometric series. For a version in a field, using division instead of `Ring.inverse`,\nsee `tsum_coe_mul_geometric_of_norm_lt_one`. -/"], "source_grounded_context_enriched": false, "statement": "theorem lt_geom {u : \u2115 \u2192 \u211d} {c : \u211d} (hc : 0 \u2264 c) {n : \u2115} (hn : 0 < n)\n (h : \u2200 k < n, u (k + 1) < c * u k) : u n < c ^ n * u 0", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 65677, "declarations_count": 6854, "diagnostics_count": 0, "duplicate_fingerprint": "1a577073cb79d050", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 28399, "lean_code_chars": 62410, "lean_code_ratio": 0.9503, "length_bucket": "long", "line_count": 1560, "natural_language_chars": 3267, "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.Analysis.SpecificLimits.Basic).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem lt_geom {u : \u2115 \u2192 \u211d} {c : \u211d} (hc : 0 \u2264 c) {n : \u2115} (hn : 0 < n)\n (h : \u2200 k < n, u (k + 1) < c * u k) : u n < c ^ n * u 0\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.NNRat (L35-L37)\ntheorem NNRat.tendsto_inv_atTop_nhds_zero_nat : Tendsto (fun n : \u2115 \u21a6 (n : \u211a\u22650)\u207b\u00b9) atTop (\ud835\udcdd 0) :=\ntendsto_inv_atTop_zero.comp tendsto_natCast_atTop_atTop\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.NNRat (L38-L44)\ntheorem NNRat.tendsto_algebraMap_inv_atTop_nhds_zero_nat (\ud835\udd5c : Type*) [Semiring \ud835\udd5c]\n [Algebra \u211a\u22650 \ud835\udd5c] [TopologicalSpace \ud835\udd5c] [ContinuousSMul \u211a\u22650 \ud835\udd5c] :\n Tendsto (algebraMap \u211a\u22650 \ud835\udd5c \u2218 fun n : \u2115 \u21a6 (n : \u211a\u22650)\u207b\u00b9) atTop (\ud835\udcdd 0) := by\nconvert (continuous_algebraMap \u211a\u22650 \ud835\udd5c).continuousAt.tendsto.comp\n tendsto_inv_atTop_nhds_zero_nat\n rw [map_zero]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_inv_atTop_nhds_zero_nat (L45-L50)\ntheorem tendsto_inv_atTop_nhds_zero_nat {\ud835\udd5c : Type*} [DivisionSemiring \ud835\udd5c] [CharZero \ud835\udd5c]\n [TopologicalSpace \ud835\udd5c] [ContinuousSMul \u211a\u22650 \ud835\udd5c] :\n Tendsto (fun n : \u2115 \u21a6 (n : \ud835\udd5c)\u207b\u00b9) atTop (\ud835\udcdd 0) := by\nconvert NNRat.tendsto_algebraMap_inv_atTop_nhds_zero_nat \ud835\udd5c\n simp\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_const_div_atTop_nhds_zero_nat (L51-L56)\ntheorem tendsto_const_div_atTop_nhds_zero_nat {\ud835\udd5c : Type*} [DivisionSemiring \ud835\udd5c] [CharZero \ud835\udd5c]\n [TopologicalSpace \ud835\udd5c] [ContinuousSMul \u211a\u22650 \ud835\udd5c] [ContinuousMul \ud835\udd5c] (C : \ud835\udd5c) :\n Tendsto (fun n : \u2115 \u21a6 C / n) atTop (\ud835\udcdd 0) := by\nsimpa only [mul_zero, div_eq_mul_inv] using\n (tendsto_const_nhds (x := C)).mul tendsto_inv_atTop_nhds_zero_nat\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_one_div_atTop_nhds_zero_nat (L57-L61)\ntheorem tendsto_one_div_atTop_nhds_zero_nat {\ud835\udd5c : Type*} [DivisionSemiring \ud835\udd5c] [CharZero \ud835\udd5c]\n [TopologicalSpace \ud835\udd5c] [ContinuousSMul \u211a\u22650 \ud835\udd5c] :\n Tendsto (fun n : \u2115 \u21a6 1 / (n : \ud835\udd5c)) atTop (\ud835\udcdd 0) := by\nsimp [tendsto_inv_atTop_nhds_zero_nat]\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.EReal (L62-L69)\ntheorem EReal.tendsto_const_div_atTop_nhds_zero_nat {C : EReal} (h : C \u2260 \u22a5) (h' : C \u2260 \u22a4) :\n Tendsto (fun n : \u2115 \u21a6 C / n) atTop (\ud835\udcdd 0) := by\nhave : (fun n : \u2115 \u21a6 C / n) = fun n : \u2115 \u21a6 ((C.toReal / n : \u211d) : EReal) := by\n ext n\n nth_rw 1 [\u2190 coe_toReal h' h, \u2190 coe_coe_eq_natCast n, \u2190 coe_div C.toReal n]\n rw [this, \u2190 coe_zero, tendsto_coe]\n exact _root_.tendsto_const_div_atTop_nhds_zero_nat C.toReal\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_one_div_add_atTop_nhds_zero_nat (L70-L75)\ntheorem tendsto_one_div_add_atTop_nhds_zero_nat {\ud835\udd5c : Type*} [DivisionSemiring \ud835\udd5c] [CharZero \ud835\udd5c]\n [TopologicalSpace \ud835\udd5c] [ContinuousSMul \u211a\u22650 \ud835\udd5c] :\n Tendsto (fun n : \u2115 \u21a6 1 / ((n : \ud835\udd5c) + 1)) atTop (\ud835\udcdd 0) :=\nsuffices Tendsto (fun n : \u2115 \u21a6 1 / (\u2191(n + 1) : \ud835\udd5c)) atTop (\ud835\udcdd 0) by simpa\n (tendsto_add_atTop_iff_nat 1).2 tendsto_one_div_atTop_nhds_zero_nat\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_algebraMap_inv_atTop_nhds_zero_nat (L76-L84)\ntheorem tendsto_algebraMap_inv_atTop_nhds_zero_nat {\ud835\udd5c : Type*} (A : Type*)\n [Semifield \ud835\udd5c] [CharZero \ud835\udd5c] [TopologicalSpace \ud835\udd5c] [ContinuousSMul \u211a\u22650 \ud835\udd5c]\n [Semiring A] [Algebra \ud835\udd5c A] [TopologicalSpace A] [ContinuousSMul \ud835\udd5c A] :\n Tendsto (algebraMap \ud835\udd5c A \u2218 fun n : \u2115 \u21a6 (n : \ud835\udd5c)\u207b\u00b9) atTop (\ud835\udcdd 0) := by\nconvert (continuous_algebraMap \ud835\udd5c A).continuousAt.tendsto.comp tendsto_inv_atTop_nhds_zero_nat\n rw [map_zero]\n\n/-- The limit of `n / (n + x)` is 1, for any constant `x` (valid in `\u211d` or any topological division\nalgebra over `\u211a\u22650`, e.g., `\u2102`). -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_natCast_div_add_atTop (L85-L97)\ntheorem tendsto_natCast_div_add_atTop {\ud835\udd5c : Type*} [DivisionSemiring \ud835\udd5c] [TopologicalSpace \ud835\udd5c]\n [CharZero \ud835\udd5c] [ContinuousSMul \u211a\u22650 \ud835\udd5c] [IsTopologicalSemiring \ud835\udd5c] [ContinuousInv\u2080 \ud835\udd5c] (x : \ud835\udd5c) :\n Tendsto (fun n : \u2115 \u21a6 (n : \ud835\udd5c) / (n + x)) atTop (\ud835\udcdd 1) := by\nconvert Tendsto.congr' ((eventually_ne_atTop 0).mp (Eventually.of_forall fun n hn \u21a6 _)) _\n \u00b7 exact fun n : \u2115 \u21a6 1 / (1 + x / n)\n \u00b7 simp [Nat.cast_ne_zero.mpr hn, add_div']\n \u00b7 have : \ud835\udcdd (1 : \ud835\udd5c) = \ud835\udcdd (1 / (1 + x * (0 : \ud835\udd5c))) := by\n rw [mul_zero, add_zero, div_one]\n rw [this]\n refine tendsto_const_nhds.div (tendsto_const_nhds.add ?_) (by simp)\n simp_rw [div_eq_mul_inv]\n exact tendsto_const_nhds.mul tendsto_inv_atTop_nhds_zero_nat\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_add_mul_div_add_mul_atTop_nhds (L98-L114)\ntheorem tendsto_add_mul_div_add_mul_atTop_nhds {\ud835\udd5c : Type*} [Semifield \ud835\udd5c] [CharZero \ud835\udd5c]\n [TopologicalSpace \ud835\udd5c] [ContinuousSMul \u211a\u22650 \ud835\udd5c] [IsTopologicalSemiring \ud835\udd5c] [ContinuousInv\u2080 \ud835\udd5c]\n (a b c : \ud835\udd5c) {d : \ud835\udd5c} (hd : d \u2260 0) :\n Tendsto (fun k : \u2115 \u21a6 (a + c * k) / (b + d * k)) atTop (\ud835\udcdd (c / d)) := by\napply Filter.Tendsto.congr'\n case f\u2081 => exact fun k \u21a6 (a * (\u2191k)\u207b\u00b9 + c) / (b * (\u2191k)\u207b\u00b9 + d)\n \u00b7 refine (eventually_ne_atTop 0).mp (Eventually.of_forall ?_)\n intro h hx\n dsimp\n field (discharger := norm_cast)\n \u00b7 apply Filter.Tendsto.div _ _ hd\n all_goals\n apply zero_add (_ : \ud835\udd5c) \u25b8 Filter.Tendsto.add_const _ _\n apply mul_zero (_ : \ud835\udd5c) \u25b8 Filter.Tendsto.const_mul _ _\n exact tendsto_inv_atTop_nhds_zero_nat\n\n/-- For any positive `m : \u2115`, `((n % m : \u2115) : \u211d) / (n : \u211d)` tends to `0` as `n` tends to `\u221e`. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_mod_div_atTop_nhds_zero_nat (L115-L121)\ntheorem tendsto_mod_div_atTop_nhds_zero_nat {m : \u2115} (hm : 0 < m) :\n Tendsto (fun n : \u2115 => ((n % m : \u2115) : \u211d) / (n : \u211d)) atTop (\ud835\udcdd 0) := by\nhave h0 : \u2200\u1da0 n : \u2115 in atTop, 0 \u2264 (fun n : \u2115 => ((n % m : \u2115) : \u211d)) n := by aesop\n exact tendsto_bdd_div_atTop_nhds_zero h0\n (.of_forall (fun n \u21a6 cast_le.mpr (mod_lt n hm).le)) tendsto_natCast_atTop_atTop\n\n/-- If `a \u2260 0`, `(a * x + c)\u207b\u00b9` tends to `0` as `x` tends to `\u221e`. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_mul_add_inv_atTop_nhds_zero (L122-L129)\ntheorem tendsto_mul_add_inv_atTop_nhds_zero (a c : \u211d) (ha : a \u2260 0) :\n Tendsto (fun x => (a * x + c)\u207b\u00b9) atTop (\ud835\udcdd 0) := by\nobtain ha' | ha' := lt_or_gt_of_ne ha\n \u00b7 exact tendsto_inv_atBot_zero.comp\n (tendsto_atBot_add_const_right _ c (tendsto_id.const_mul_atTop_of_neg ha'))\n \u00b7 exact tendsto_inv_atTop_zero.comp\n (tendsto_atTop_add_const_right _ c (tendsto_id.const_mul_atTop ha'))\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.Filter (L130-L135)\ntheorem Filter.EventuallyEq.div_mul_cancel {\u03b1 G : Type*} [GroupWithZero G] {f g : \u03b1 \u2192 G}\n {l : Filter \u03b1} (hg : Tendsto g l (\ud835\udcdf {0}\u1d9c)) : (fun x \u21a6 f x / g x * g x) =\u1da0[l] fun x \u21a6 f x := by\nfilter_upwards [hg.le_comap <| preimage_mem_comap (m := g) (mem_principal_self {0}\u1d9c)] with x hx\n simp_all\n\n/-- If `g` tends to `\u221e`, then eventually for all `x` we have `(f x / g x) * g x = f x`. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.Filter (L136-L144)\ntheorem Filter.EventuallyEq.div_mul_cancel_atTop {\u03b1 K : Type*}\n [DivisionSemiring K] [LinearOrder K] [IsStrictOrderedRing K]\n {f g : \u03b1 \u2192 K} {l : Filter \u03b1} (hg : Tendsto g l atTop) :\n (fun x \u21a6 f x / g x * g x) =\u1da0[l] fun x \u21a6 f x :=\ndiv_mul_cancel <| hg.mono_right <| le_principal_iff.mpr <|\n mem_of_superset (Ioi_mem_atTop 0) <| by simp\n\n/-- If when `x` tends to `\u221e`, `g` tends to `\u221e` and `f x / g x` tends to a positive\n constant, then `f` tends to `\u221e`. -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.Filter (L145-L153)\ntheorem Filter.Tendsto.num {\u03b1 K : Type*} [Field K] [LinearOrder K] [IsStrictOrderedRing K]\n [TopologicalSpace K] [OrderTopology K]\n {f g : \u03b1 \u2192 K} {l : Filter \u03b1} (hg : Tendsto g l atTop) {a : K} (ha : 0 < a)\n (hlim : Tendsto (fun x => f x / g x) l (\ud835\udcdd a)) :\n Tendsto f l atTop :=\n(hlim.pos_mul_atTop ha hg).congr' (EventuallyEq.div_mul_cancel_atTop hg)\n\n/-- If when `x` tends to `\u221e`, `g` tends to `\u221e` and `f x / g x` tends to a positive\n constant, then `f` tends to `\u221e`. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.Filter (L154-L165)\ntheorem Filter.Tendsto.den {\u03b1 K : Type*} [Field K] [LinearOrder K] [IsStrictOrderedRing K]\n [TopologicalSpace K] [OrderTopology K]\n [ContinuousInv K] {f g : \u03b1 \u2192 K} {l : Filter \u03b1} (hf : Tendsto f l atTop) {a : K} (ha : 0 < a)\n (hlim : Tendsto (fun x => f x / g x) l (\ud835\udcdd a)) :\n Tendsto g l atTop :=\nhave hlim' : Tendsto (fun x => g x / f x) l (\ud835\udcdd a\u207b\u00b9) := by\n simp_rw [\u2190 inv_div (f _)]\n exact Filter.Tendsto.inv (f := fun x => f x / g x) hlim\n (hlim'.pos_mul_atTop (inv_pos_of_pos ha) hf).congr' (.div_mul_cancel_atTop hf)\n\n/-- If when `x` tends to `\u221e`, `f x / g x` tends to a positive constant, then `f` tends to `\u221e` if\n and only if `g` tends to `\u221e`. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.Filter (L166-L175)\ntheorem Filter.Tendsto.num_atTop_iff_den_atTop {\u03b1 K : Type*}\n [Field K] [LinearOrder K] [IsStrictOrderedRing K] [TopologicalSpace K]\n [OrderTopology K] [ContinuousInv K] {f g : \u03b1 \u2192 K} {l : Filter \u03b1} {a : K} (ha : 0 < a)\n (hlim : Tendsto (fun x => f x / g x) l (\ud835\udcdd a)) :\n Tendsto f l atTop \u2194 Tendsto g l atTop :=\n\u27e8fun hf \u21a6 hf.den ha hlim, fun hg \u21a6 hg.num ha hlim\u27e9\n\n/-! ### Powers -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_add_one_pow_atTop_atTop_of_pos (L176-L181)\ntheorem tendsto_add_one_pow_atTop_atTop_of_pos\n [Semiring \u03b1] [LinearOrder \u03b1] [IsStrictOrderedRing \u03b1] [Archimedean \u03b1] {r : \u03b1}\n (h : 0 < r) : Tendsto (fun n : \u2115 \u21a6 (r + 1) ^ n) atTop atTop :=\ntendsto_atTop_atTop_of_monotone' (pow_right_mono\u2080 <| le_add_of_nonneg_left h.le) <|\n not_bddAbove_iff.2 fun _ \u21a6 Set.exists_range_iff.2 <| add_one_pow_unbounded_of_pos _ h\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_pow_atTop_atTop_of_one_lt (L182-L188)\ntheorem tendsto_pow_atTop_atTop_of_one_lt\n [Semiring \u03b1] [LinearOrder \u03b1] [IsStrictOrderedRing \u03b1] [ExistsAddOfLE \u03b1] [Archimedean \u03b1] {r : \u03b1}\n (h : 1 < r) : Tendsto (fun n : \u2115 \u21a6 r ^ n) atTop atTop := by\nobtain \u27e8r, r0, rfl\u27e9 := exists_pos_add_of_lt' h\n rw [add_comm]\n exact tendsto_add_one_pow_atTop_atTop_of_pos r0\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_pow_atTop_nhds_zero_of_lt_one (L189-L199)\ntheorem tendsto_pow_atTop_nhds_zero_of_lt_one {\ud835\udd5c : Type*}\n [Semifield \ud835\udd5c] [LinearOrder \ud835\udd5c] [IsStrictOrderedRing \ud835\udd5c] [ExistsAddOfLE \ud835\udd5c] [Archimedean \ud835\udd5c]\n [TopologicalSpace \ud835\udd5c] [OrderTopology \ud835\udd5c] {r : \ud835\udd5c} (h\u2081 : 0 \u2264 r) (h\u2082 : r < 1) :\n Tendsto (fun n : \u2115 \u21a6 r ^ n) atTop (\ud835\udcdd 0) :=\nh\u2081.eq_or_lt.elim\n (fun hr \u21a6 (tendsto_add_atTop_iff_nat 1).mp <| by\n simp [_root_.pow_succ, \u2190 hr])\n (fun hr \u21a6\n have := (one_lt_inv\u2080 hr).2 h\u2082 |> tendsto_pow_atTop_atTop_of_one_lt\n (tendsto_inv_atTop_zero.comp this).congr fun n \u21a6 by simp)\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_pow_atTop_nhdsWithin_zero_of_lt_one (L218-L225)\ntheorem tendsto_pow_atTop_nhdsWithin_zero_of_lt_one {\ud835\udd5c : Type*}\n [Semifield \ud835\udd5c] [LinearOrder \ud835\udd5c] [IsStrictOrderedRing \ud835\udd5c] [ExistsAddOfLE \ud835\udd5c]\n [Archimedean \ud835\udd5c] [TopologicalSpace \ud835\udd5c] [OrderTopology \ud835\udd5c] {r : \ud835\udd5c} (h\u2081 : 0 < r) (h\u2082 : r < 1) :\n Tendsto (fun n : \u2115 \u21a6 r ^ n) atTop (\ud835\udcdd[>] 0) :=\ntendsto_inf.2\n \u27e8tendsto_pow_atTop_nhds_zero_of_lt_one h\u2081.le h\u2082,\n tendsto_principal.2 <| Eventually.of_forall fun _ \u21a6 pow_pos h\u2081 _\u27e9\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.uniformity_basis_dist_pow_of_lt_one (L226-L231)\ntheorem uniformity_basis_dist_pow_of_lt_one {\u03b1 : Type*} [PseudoMetricSpace \u03b1] {r : \u211d} (h\u2080 : 0 < r)\n (h\u2081 : r < 1) :\n (uniformity \u03b1).HasBasis (fun _ : \u2115 \u21a6 True) fun k \u21a6 { p : \u03b1 \u00d7 \u03b1 | dist p.1 p.2 < r ^ k } :=\nMetric.mk_uniformity_basis (fun _ _ \u21a6 pow_pos h\u2080 _) fun _ \u03b50 \u21a6\n (exists_pow_lt_of_lt_one \u03b50 h\u2081).imp fun _ hk \u21a6 \u27e8trivial, hk.le\u27e9\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.geom_lt (L232-L237)\ntheorem geom_lt {u : \u2115 \u2192 \u211d} {c : \u211d} (hc : 0 \u2264 c) {n : \u2115} (hn : 0 < n)\n (h : \u2200 k < n, c * u k < u (k + 1)) : c ^ n * u 0 < u n := by\napply (monotone_mul_left_of_nonneg hc).seq_pos_lt_seq_of_le_of_lt hn _ _ h\n \u00b7 simp\n \u00b7 simp [_root_.pow_succ', mul_assoc]\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.geom_le (L238-L242)\ntheorem geom_le {u : \u2115 \u2192 \u211d} {c : \u211d} (hc : 0 \u2264 c) (n : \u2115) (h : \u2200 k < n, c * u k \u2264 u (k + 1)) :\n c ^ n * u 0 \u2264 u n := by\napply (monotone_mul_left_of_nonneg hc).seq_le_seq n _ _ h <;>\n simp [_root_.pow_succ', mul_assoc]\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.le_geom (L249-L255)\ntheorem le_geom {u : \u2115 \u2192 \u211d} {c : \u211d} (hc : 0 \u2264 c) (n : \u2115) (h : \u2200 k < n, u (k + 1) \u2264 c * u k) :\n u n \u2264 c ^ n * u 0 := by\napply (monotone_mul_left_of_nonneg hc).seq_le_seq n _ h _ <;>\n simp [_root_.pow_succ', mul_assoc]\n\n/-- If a sequence `v` of real numbers satisfies `k * v n \u2264 v (n+1)` with `1 < k`,\nthen it goes to +\u221e. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.summable_pow_mul_geometric_of_norm_lt_one (L486-L514)\ntheorem summable_pow_mul_geometric_of_norm_lt_one (k : \u2115) {r : R} (hr : \u2016r\u2016 < 1) :\n Summable (fun n \u21a6 (n : R) ^ k * r ^ n : \u2115 \u2192 R) := by\nrefine Nat.strong_induction_on k fun k hk => ?_\n obtain \u27e8a, ha\u27e9 : \u2203 (a : \u2115 \u2192 \u2115), \u2200 n, (n + k).descFactorial k\n = n ^ k + \u2211 i \u2208 range k, a i * n ^ i := by\n let P : Polynomial \u2115 := (ascPochhammer \u2115 k).comp (Polynomial.X + C 1)\n refine \u27e8fun i \u21a6 P.coeff i, fun n \u21a6 ?_\u27e9\n have mP : Monic P := Monic.comp_X_add_C (monic_ascPochhammer \u2115 k) _\n have dP : P.natDegree = k := by\n simp only [P, natDegree_comp, ascPochhammer_natDegree, mul_one, natDegree_X_add_C]\n have A : (n + k).descFactorial k = P.eval n := by\n have : n + 1 + k - 1 = n + k := by lia\n simp [P, ascPochhammer_nat_eq_descFactorial, this]\n conv_lhs => rw [A, mP.as_sum, dP]\n simp [eval_finset_sum]\n have : Summable (fun n \u21a6 (n + k).descFactorial k * r ^ n\n - \u2211 i \u2208 range k, a i * n ^ (i : \u2115) * r ^ n) := by\n apply (summable_descFactorial_mul_geometric_of_norm_lt_one k hr).sub\n apply summable_sum (fun i hi \u21a6 ?_)\n simp_rw [mul_assoc]\n simp only [Finset.mem_range] at hi\n exact (hk _ hi).mul_left _\n convert this using 1\n ext n\n simp [ha n, add_mul, sum_mul]\n\n/-- If `\u2016r\u2016 < 1`, then `\u2211' n : \u2115, n * r ^ n = r / (1 - r) ^ 2`, `HasSum` version in a general ring\nwith summable geometric series. For a version in a field, using division instead of `Ring.inverse`,\nsee `hasSum_coe_mul_geometric_of_norm_lt_one`. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_same_eq_mul_div' (L83-L87)\nlemma arithGeom_same_eq_mul_div' (ha : a \u2260 1) (n : \u2115) :\n arithGeom a b b n = b * (1 - a ^ (n + 1)) / (1 - a) := by\nrw [arithGeom_eq ha n]\n field [sub_ne_zero.mpr ha.symm]\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.AbsoluteValue (L248-L259)\ntheorem AbsoluteValue.tendsto_div_one_add_pow_nhds_one {v : AbsoluteValue R S} {a : R}\n (ha : v a < 1) : atTop.Tendsto (fun (n : \u2115) \u21a6 v (1 / (1 + a ^ n))) (\ud835\udcdd 1) := by\nsimp_rw [map_div\u2080 v, v.map_one]\n apply one_div_one (G := S) \u25b8 Tendsto.div tendsto_const_nhds _ one_ne_zero\n have h_add := (tendsto_pow_atTop_nhds_zero_of_lt_one (v.nonneg _) ha).const_add 1\n have h_sub := (tendsto_pow_atTop_nhds_zero_of_lt_one (v.nonneg _) ha).const_sub 1\n exact tendsto_of_tendsto_of_tendsto_of_le_of_le (by simpa using h_sub) (by simpa using h_add)\n (fun n \u21a6 le_trans (by simp) (v.le_add _ _))\n (fun n \u21a6 le_trans (v.add_le _ _) (by simp))\n\n/-- `v (1 / (1 + a ^n))` tends to `0` whenever `v : AbsoluteValue R S` for fields `R` and `S`,\nprovided `1 < v a`. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_natCast_atTop_cobounded (L38-L44)\ntheorem tendsto_natCast_atTop_cobounded\n [NormedRing \u03b1] [NormSMulClass \u2124 \u03b1] [Nontrivial \u03b1] :\n Tendsto Nat.cast atTop (Bornology.cobounded \u03b1) := by\nrw [\u2190 tendsto_norm_atTop_iff_cobounded]\n simpa [norm_natCast_eq_mul_norm_one] using tendsto_natCast_atTop_atTop\n |>.atTop_mul_const (norm_pos_iff.mpr one_ne_zero)\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.tendsto_arithGeom_nhds_of_lt_one (L129-L136)\nlemma tendsto_arithGeom_nhds_of_lt_one [Archimedean R] [TopologicalSpace R] [OrderTopology R]\n (ha_pos : 0 \u2264 a) (ha : a < 1) :\n Tendsto (arithGeom a b u\u2080) atTop (\ud835\udcdd (b / (1 - a))) := by\nrw [arithGeom_eq' ha.ne]\n conv_rhs => rw [\u2190 zero_add (b / (1 - a))]\n refine Tendsto.add ?_ tendsto_const_nhds\n conv_rhs => rw [\u2190 zero_mul (u\u2080 - (b / (1 - a)))]\n exact (tendsto_pow_atTop_nhds_zero_of_lt_one ha_pos ha).mul_const _\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.geom_series_succ (L318-L321)\ntheorem geom_series_succ (x : R) (h : \u2016x\u2016 < 1) : \u2211' i : \u2115, x ^ (i + 1) = \u2211' i : \u2115, x ^ i - 1 := by\nrw [eq_sub_iff_add_eq, (summable_geometric_of_norm_lt_one h).tsum_eq_zero_add,\n pow_zero, add_comm]\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_same_eq_mul_div (L88-L92)\nlemma arithGeom_same_eq_mul_div (ha : a \u2260 1) (n : \u2115) :\n arithGeom a b b n = b * (a ^ (n + 1) - 1) / (a - 1) := by\nrw [arithGeom_same_eq_mul_div' ha n, \u2190 neg_sub _ a, div_neg,\n \u2190 neg_sub _ (a ^ (n + 1)), mul_neg, neg_div, neg_neg]\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_pow_const_mul_const_pow_of_abs_lt_one (L187-L196)\ntheorem tendsto_pow_const_mul_const_pow_of_abs_lt_one (k : \u2115) {r : \u211d} (hr : |r| < 1) :\n Tendsto (fun n \u21a6 (n : \u211d) ^ k * r ^ n : \u2115 \u2192 \u211d) atTop (\ud835\udcdd 0) := by\nby_cases h0 : r = 0\n \u00b7 exact tendsto_const_nhds.congr'\n (mem_atTop_sets.2 \u27e81, fun n hn \u21a6 by simp [zero_lt_one.trans_le hn |>.ne', h0]\u27e9)\n have hr' : 1 < |r|\u207b\u00b9 := (one_lt_inv\u2080 (abs_pos.2 h0)).2 hr\n rw [tendsto_zero_iff_norm_tendsto_zero]\n simpa [div_eq_mul_inv] using tendsto_pow_const_div_const_pow_of_one_lt k hr'\n\n/-- For `k \u2260 0` and a constant `r` the function `r / n ^ k` tends to zero. -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.dist_partial_sum_le_of_le_geometric (L559-L565)\ntheorem dist_partial_sum_le_of_le_geometric (hf : \u2200 n, \u2016f n\u2016 \u2264 C * r ^ n) (n : \u2115) :\n dist (\u2211 i \u2208 range n, f i) (\u2211 i \u2208 range (n + 1), f i) \u2264 C * r ^ n := by\nrw [sum_range_succ, dist_eq_norm, \u2190 norm_neg, neg_sub, add_sub_cancel_left]\n exact hf n\n\n/-- If `\u2016f n\u2016 \u2264 C * r ^ n` for all `n : \u2115` and some `r < 1`, then the partial sums of `f` form a\nCauchy sequence. This lemma does not assume `0 \u2264 r` or `0 \u2264 C`. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Analysis.SpecificLimits.FloorPow.mul_pow_le_nat_floor_pow (L259-L271)\ntheorem mul_pow_le_nat_floor_pow {c : \u211d} (hc : 1 < c) (i : \u2115) : (1 - c\u207b\u00b9) * c ^ i \u2264 \u230ac ^ i\u230b\u208a := by\nhave cpos : 0 < c := zero_lt_one.trans hc\n rcases eq_or_ne i 0 with (rfl | hi)\n \u00b7 simp only [pow_zero, Nat.floor_one, Nat.cast_one, mul_one, sub_le_self_iff, inv_nonneg, cpos.le]\n calc\n (1 - c\u207b\u00b9) * c ^ i = c ^ i - c ^ i * c\u207b\u00b9 := by ring\n _ \u2264 c ^ i - 1 := by\n gcongr\n simpa only [\u2190 div_eq_mul_inv, one_le_div cpos, pow_one] using le_self_pow\u2080 hc.le hi\n _ \u2264 \u230ac ^ i\u230b\u208a := (Nat.sub_one_lt_floor _).le\n\n/-- The sum of `1/\u230ac^i\u230b\u208a^2` above a threshold `j` is comparable to `1/j^2`, up to a multiplicative\nconstant. -/\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.NormedAddCommGroup (L594-L597)\ntheorem NormedAddCommGroup.cauchy_series_of_le_geometric' {C : \u211d} {u : \u2115 \u2192 \u03b1} {r : \u211d} (hr : r < 1)\n (h : \u2200 n, \u2016u n\u2016 \u2264 C * r ^ n) : CauchySeq fun n \u21a6 \u2211 k \u2208 range (n + 1), u k :=\n(cauchy_series_of_le_geometric hr h).comp_tendsto <| tendsto_add_atTop_nat 1\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.summable_geometric_of_norm_lt_one (L275-L278)\nlemma summable_geometric_of_norm_lt_one {K : Type*} [NormedRing K] [HasSummableGeomSeries K]\n {x : K} (h : \u2016x\u2016 < 1) : Summable (fun n \u21a6 x ^ n) :=\nHasSummableGeomSeries.summable_geometric_of_norm_lt_one x h\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_self_mul_const_pow_of_abs_lt_one (L210-L215)\ntheorem tendsto_self_mul_const_pow_of_abs_lt_one {r : \u211d} (hr : |r| < 1) :\n Tendsto (fun n \u21a6 n * r ^ n : \u2115 \u2192 \u211d) atTop (\ud835\udcdd 0) := by\nsimpa only [pow_one] using tendsto_pow_const_mul_const_pow_of_abs_lt_one 1 hr\n\n/-- If `0 \u2264 r < 1`, then `n * r ^ n` tends to zero. This is a specialized version of\n`tendsto_self_mul_const_pow_of_abs_lt_one`, singled out for ease of application. -/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tsum_choose_mul_geometric_of_norm_lt_one (L475-L478)\nlemma tsum_choose_mul_geometric_of_norm_lt_one (k : \u2115) {r : \ud835\udd5c} (hr : \u2016r\u2016 < 1) :\n \u2211' n, (n + k).choose k * r ^ n = 1 / (1 - r) ^ (k + 1) :=\n(hasSum_choose_mul_geometric_of_norm_lt_one k hr).tsum_eq\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Analysis.SpecificLimits.FloorPow.tendsto_div_of_monotone_of_exists_subseq_tendsto_div (L31-L181)\ntheorem tendsto_div_of_monotone_of_exists_subseq_tendsto_div (u : \u2115 \u2192 \u211d) (l : \u211d)\n (hmono : Monotone u)\n (hlim : \u2200 a : \u211d, 1 < a \u2192 \u2203 c : \u2115 \u2192 \u2115, (\u2200\u1da0 n in atTop, (c (n + 1) : \u211d) \u2264 a * c n) \u2227\n Tendsto c atTop atTop \u2227 Tendsto (fun n => u (c n) / c n) atTop (\ud835\udcdd l)) :\n Tendsto (fun n => u n / n) atTop (\ud835\udcdd l) := by\n/- To check the result up to some `\u03b5 > 0`, we use a sequence `c` for which the ratio\n `c (N+1) / c N` is bounded by `1 + \u03b5`. Sandwiching a given `n` between two consecutive values of\n `c`, say `c N` and `c (N+1)`, one can then bound `u n / n` from above by `u (c N) / c (N - 1)`\n and from below by `u (c (N - 1)) / c N` (using that `u` is monotone), which are both comparable\n to the limit `l` up to `1 + \u03b5`.\n We give a version of this proof by clearing out denominators first, to avoid discussing the sign\n of different quantities. -/\n have lnonneg : 0 \u2264 l := by\n rcases hlim 2 one_lt_two with \u27e8c, _, ctop, clim\u27e9\n have : Tendsto (fun n => u 0 / c n) atTop (\ud835\udcdd 0) :=\n tendsto_const_nhds.div_atTop (tendsto_natCast_atTop_iff.2 ctop)\n apply le_of_tendsto_of_tendsto' this clim fun n => ?_\n gcongr\n exact hmono (zero_le _)\n have A : \u2200 \u03b5 : \u211d, 0 < \u03b5 \u2192 \u2200\u1da0 n in atTop, u n - n * l \u2264 \u03b5 * (1 + \u03b5 + l) * n := by\n intro \u03b5 \u03b5pos\n rcases hlim (1 + \u03b5) ((lt_add_iff_pos_right _).2 \u03b5pos) with \u27e8c, cgrowth, ctop, clim\u27e9\n have L : \u2200\u1da0 n in atTop, u (c n) - c n * l \u2264 \u03b5 * c n := by\n rw [\u2190 tendsto_sub_nhds_zero_iff, \u2190 Asymptotics.isLittleO_one_iff \u211d,\n Asymptotics.isLittleO_iff] at clim\n filter_upwards [clim \u03b5pos, ctop (Ioi_mem_atTop 0)] with n hn cnpos'\n have cnpos : 0 < c n := cnpos'\n calc\n u (c n) - c n * l = (u (c n) / c n - l) * c n := by field\n _ \u2264 \u03b5 * c n := by\n gcongr\n refine (le_abs_self _).trans ?_\n simpa using hn\n obtain \u27e8a, ha\u27e9 :\n \u2203 a : \u2115, \u2200 b : \u2115, a \u2264 b \u2192 (c (b + 1) : \u211d) \u2264 (1 + \u03b5) * c b \u2227 u (c b) - c b * l \u2264 \u03b5 * c b :=\n eventually_atTop.1 (cgrowth.and L)\n let M := ((Finset.range (a + 1)).image fun i => c i).max' (by simp)\n filter_upwards [Ici_mem_atTop M] with n hn\n have exN : \u2203 N, n < c N := by\n rcases (tendsto_atTop.1 ctop (n + 1)).exists with \u27e8N, hN\u27e9\n exact \u27e8N, by lia\u27e9\n let N := Nat.find exN\n have ncN : n < c N := Nat.find_spec exN\n have aN : a + 1 \u2264 N := by\n by_contra! h\n have cNM : c N \u2264 M := by\n apply le_max'\n apply mem_image_of_mem\n exact mem_range.2 h\n exact lt_irrefl _ ((cNM.trans hn).trans_lt ncN)\n have Npos : 0 < N := lt_of_lt_of_le Nat.succ_pos' aN\n have cNn : c (N - 1) \u2264 n := by\n have : N - 1 < N := Nat.pred_lt Npos.ne'\n simpa only [not_lt] using Nat.find_min exN this\n have IcN : (c N : \u211d) \u2264 (1 + \u03b5) * c (N - 1) := by\n have A : a \u2264 N - 1 := (Nat.le_sub_one_iff_lt Npos).mpr aN\n have B : N - 1 + 1 = N := Nat.succ_pred_eq_of_pos Npos\n have := (ha _ A).1\n rwa [B] at this\n calc\n u n - n * l \u2264 u (c N) - c (N - 1) * l := by gcongr; exact hmono ncN.le\n _ = u (c N) - c N * l + (c N - c (N - 1)) * l := by ring\n _ \u2264 \u03b5 * c N + \u03b5 * c (N - 1) * l := by\n gcongr\n \u00b7 exact (ha N (a.le_succ.trans aN)).2\n \u00b7 linarith only [IcN]\n _ \u2264 \u03b5 * ((1 + \u03b5) * c (N - 1)) + \u03b5 * c (N - 1) * l := by gcongr\n _ = \u03b5 * (1 + \u03b5 + l) * c (N - 1) := by ring\n _ \u2264 \u03b5 * (1 + \u03b5 + l) * n := by gcongr\n have B : \u2200 \u03b5 : \u211d, 0 < \u03b5 \u2192 \u2200\u1da0 n : \u2115 in atTop, (n : \u211d) * l - u n \u2264 \u03b5 * (1 + l) * n := by\n intro \u03b5 \u03b5pos\n rcases hlim (1 + \u03b5) ((lt_add_iff_pos_right _).2 \u03b5pos) with \u27e8c, cgrowth, ctop, clim\u27e9\n have L : \u2200\u1da0 n : \u2115 in atTop, (c n : \u211d) * l - u (c n) \u2264 \u03b5 * c n := by\n rw [\u2190 tendsto_sub_nhds_zero_iff, \u2190 Asymptotics.isLittleO_one_iff \u211d,\n Asymptotics.isLittleO_iff] at clim\n filter_upwards [clim \u03b5pos, ctop (Ioi_mem_atTop 0)] with n hn cnpos'\n have cnpos : 0 < c n := cnpos'\n calc\n (c n : \u211d) * l - u (c n) = -(u (c n) / c n - l) * c n := by field\n _ \u2264 \u03b5 * c n := by\n gcongr\n refine le_trans (neg_le_abs _) ?_\n simpa using hn\n obtain \u27e8a, ha\u27e9 :\n \u2203 a : \u2115,\n \u2200 b : \u2115, a \u2264 b \u2192 (c (b + 1) : \u211d) \u2264 (1 + \u03b5) * c b \u2227 (c b : \u211d) * l - u (c b) \u2264 \u03b5 * c b :=\n eventually_atTop.1 (cgrowth.and L)\n let M := ((Finset.range (a + 1)).image fun i => c i).max' (by simp)\n filter_upwards [Ici_mem_atTop M] with n hn\n have exN : \u2203 N, n < c N := by\n rcases (tendsto_atTop.1 ctop (n + 1)).exists with \u27e8N, hN\u27e9\n exact \u27e8N, by lia\u27e9\n let N := Nat.find exN\n have ncN : n < c N := Nat.find_spec exN\n have aN : a + 1 \u2264 N := by\n by_contra! h\n have cNM : c N \u2264 M := by\n apply le_max'\n apply mem_image_of_mem\n exact mem_range.2 h\n exact lt_irrefl _ ((cNM.trans hn).trans_lt ncN)\n have Npos : 0 < N := lt_of_lt_of_le Nat.succ_pos' aN\n have aN' : a \u2264 N - 1 := (Nat.le_sub_one_iff_lt Npos).mpr aN\n have cNn : c (N - 1) \u2264 n := by\n have : N - 1 < N := Nat.pred_lt Npos.ne'\n simpa only [not_lt] using Nat.find_min exN this\n calc\n (n : \u211d) * l - u n \u2264 c N * l - u (c (N - 1)) := by\n gcongr\n exact hmono cNn\n _ \u2264 (1 + \u03b5) * c (N - 1) * l - u (c (N - 1)) := by\n gcongr\n have B : N - 1 + 1 = N := Nat.succ_pred_eq_of_pos Npos\n simpa [B] using (ha _ aN').1\n _ = c (N - 1) * l - u (c (N - 1)) + \u03b5 * c (N - 1) * l := by ring\n _ \u2264 \u03b5 * c (N - 1) + \u03b5 * c (N - 1) * l := add_le_add (ha _ aN').2 le_rfl\n _ = \u03b5 * (1 + l) * c (N - 1) := by ring\n _ \u2264 \u03b5 * (1 + l) * n := by gcongr\n refine tendsto_order.2 \u27e8fun d hd => ?_, fun d hd => ?_\u27e9\n \u00b7 obtain \u27e8\u03b5, h\u03b5, \u03b5pos\u27e9 : \u2203 \u03b5 : \u211d, d + \u03b5 * (1 + l) < l \u2227 0 < \u03b5 := by\n have L : Tendsto (fun \u03b5 => d + \u03b5 * (1 + l)) (\ud835\udcdd[>] 0) (\ud835\udcdd (d + 0 * (1 + l))) := by\n apply Tendsto.mono_left _ nhdsWithin_le_nhds\n exact tendsto_const_nhds.add (tendsto_id.mul tendsto_const_nhds)\n simp only [zero_mul, add_zero] at L\n exact (((tendsto_order.1 L).2 l hd).and self_mem_nhdsWithin).exists\n filter_upwards [B \u03b5 \u03b5pos, Ioi_mem_atTop 0] with n hn npos\n simp_rw [div_eq_inv_mul]\n calc\n d < (n : \u211d)\u207b\u00b9 * n * (l - \u03b5 * (1 + l)) := by\n rw [inv_mul_cancel\u2080, one_mul]\n \u00b7 linarith only [h\u03b5]\n \u00b7 exact Nat.cast_ne_zero.2 (ne_of_gt npos)\n _ = (n : \u211d)\u207b\u00b9 * (n * l - \u03b5 * (1 + l) * n) := by ring\n _ \u2264 (n : \u211d)\u207b\u00b9 * u n := by gcongr; linarith only [hn]\n \u00b7 obtain \u27e8\u03b5, h\u03b5, \u03b5pos\u27e9 : \u2203 \u03b5 : \u211d, l + \u03b5 * (1 + \u03b5 + l) < d \u2227 0 < \u03b5 := by\n have L : Tendsto (fun \u03b5 => l + \u03b5 * (1 + \u03b5 + l)) (\ud835\udcdd[>] 0) (\ud835\udcdd (l + 0 * (1 + 0 + l))) := by\n apply Tendsto.mono_left _ nhdsWithin_le_nhds\n exact\n tendsto_const_nhds.add\n (tendsto_id.mul ((tendsto_const_nhds.add tendsto_id).add tendsto_const_nhds))\n simp only [zero_mul, add_zero] at L\n exact (((tendsto_order.1 L).2 d hd).and self_mem_nhdsWithin).exists\n filter_upwards [A \u03b5 \u03b5pos, Ioi_mem_atTop 0] with n hn (npos : 0 < n)\n calc\n u n / n \u2264 (n * l + \u03b5 * (1 + \u03b5 + l) * n) / n := by gcongr; linarith only [hn]\n _ = (l + \u03b5 * (1 + \u03b5 + l)) := by field\n _ < d := h\u03b5\n\n/-- If a monotone sequence `u` is such that `u \u230ac^n\u230b\u208a / \u230ac^n\u230b\u208a` converges to a limit `l` for all\n`c > 1`, then `u n / n` tends to `l`. It is even enough to have the assumption for a sequence of\n`c`s converging to `1`. -/\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_pow_const_mul_const_pow_of_lt_one (L205-L209)\ntheorem tendsto_pow_const_mul_const_pow_of_lt_one (k : \u2115) {r : \u211d} (hr : 0 \u2264 r) (h'r : r < 1) :\n Tendsto (fun n \u21a6 (n : \u211d) ^ k * r ^ n : \u2115 \u2192 \u211d) atTop (\ud835\udcdd 0) :=\ntendsto_pow_const_mul_const_pow_of_abs_lt_one k (abs_lt.2 \u27e8neg_one_lt_zero.trans_le hr, h'r\u27e9)\n\n/-- If `|r| < 1`, then `n * r ^ n` tends to zero. -/\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_const_div_pow (L197-L204)\nlemma tendsto_const_div_pow (r : \u211d) (k : \u2115) (hk : k \u2260 0) :\n Tendsto (fun n : \u2115 => r / n ^ k) atTop (\ud835\udcdd 0) := by\nsimpa using Filter.Tendsto.const_div_atTop (tendsto_natCast_atTop_atTop (R := \u211d).comp\n (tendsto_pow_atTop hk)) r\n\n/-- If `0 \u2264 r < 1`, then `n ^ k r ^ n` tends to zero for any natural `k`.\nThis is a specialized version of `tendsto_pow_const_mul_const_pow_of_abs_lt_one`, singled out\nfor ease of application. -/\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_eq' (L78-L82)\nlemma arithGeom_eq' (ha : a \u2260 1) :\n arithGeom a b u\u2080 = fun n \u21a6 a ^ n * (u\u2080 - (b / (1 - a))) + b / (1 - a) := by\next\n exact arithGeom_eq ha _\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_zero_eq_sum (L66-L71)\nlemma arithGeom_zero_eq_sum [CommSemiring R] (n : \u2115) :\n arithGeom a b 0 n = b * \u2211 k \u2208 Finset.range n, a ^ k := by\nsimp [arithGeom_eq_add_sum]\n\nvariable [Field R]\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.geom_series_mul_shift (L322-L325)\ntheorem geom_series_mul_shift (x : R) (h : \u2016x\u2016 < 1) :\n x * \u2211' i : \u2115, x ^ i = \u2211' i : \u2115, x ^ (i + 1) := by\nsimp_rw [\u2190 (summable_geometric_of_norm_lt_one h).tsum_mul_left, \u2190 _root_.pow_succ']\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.summable_descFactorial_mul_geometric_of_norm_lt_one (L479-L485)\nlemma summable_descFactorial_mul_geometric_of_norm_lt_one (k : \u2115) {r : R} (hr : \u2016r\u2016 < 1) :\n Summable (fun n \u21a6 (n + k).descFactorial k * r ^ n) := by\nconvert (summable_choose_mul_geometric_of_norm_lt_one k hr).mul_left (k.factorial : R)\n using 2 with n\n simp [\u2190 mul_assoc, descFactorial_eq_factorial_mul_choose (n + k) k]\n\nopen Polynomial in\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.summable_norm_pow_mul_geometric_of_norm_lt_one (L423-L428)\ntheorem summable_norm_pow_mul_geometric_of_norm_lt_one (k : \u2115) {r : R}\n (hr : \u2016r\u2016 < 1) : Summable fun n : \u2115 \u21a6 \u2016((n : R) ^ k * r ^ n : R)\u2016 := by\nsimp only [\u2190 cast_pow]\n exact summable_norm_mul_geometric_of_norm_lt_one (k := k) (u := fun n \u21a6 n ^ k) hr\n (isBigO_refl _ _)\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.isLittleO_pow_const_mul_const_pow_const_pow_of_norm_lt (L169-L181)\ntheorem isLittleO_pow_const_mul_const_pow_const_pow_of_norm_lt {R : Type*} [NormedRing R] (k : \u2115)\n {r\u2081 : R} {r\u2082 : \u211d} (h : \u2016r\u2081\u2016 < r\u2082) :\n (fun n \u21a6 (n : R) ^ k * r\u2081 ^ n : \u2115 \u2192 R) =o[atTop] fun n \u21a6 r\u2082 ^ n := by\nby_cases h0 : r\u2081 = 0\n \u00b7 refine (isLittleO_zero _ _).congr' (mem_atTop_sets.2 <| \u27e81, fun n hn \u21a6 ?_\u27e9) EventuallyEq.rfl\n simp [zero_pow (one_le_iff_ne_zero.1 hn), h0]\n rw [\u2190 Ne, \u2190 norm_pos_iff] at h0\n have A : (fun n \u21a6 (n : R) ^ k : \u2115 \u2192 R) =o[atTop] fun n \u21a6 (r\u2082 / \u2016r\u2081\u2016) ^ n :=\n isLittleO_pow_const_const_pow_of_one_lt k ((one_lt_div h0).2 h)\n suffices (fun n \u21a6 r\u2081 ^ n) =O[atTop] fun n \u21a6 \u2016r\u2081\u2016 ^ n by\n simpa [div_mul_cancel\u2080 _ (pow_pos h0 _).ne', div_pow] using A.mul_isBigO this\n exact .of_norm_eventuallyLE <| eventually_norm_pow_le r\u2081\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_zero_eq_mul_div' (L93-L97)\nlemma arithGeom_zero_eq_mul_div' (ha : a \u2260 1) (n : \u2115) :\n arithGeom a b 0 n = b * (1 - a ^ n) / (1 - a) := by\nrw [arithGeom_eq ha n]\n ring\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Analysis.SpecificLimits.FloorPow.sum_div_pow_sq_le_div_sq (L214-L258)\ntheorem sum_div_pow_sq_le_div_sq (N : \u2115) {j : \u211d} (hj : 0 < j) {c : \u211d} (hc : 1 < c) :\n (\u2211 i \u2208 range N with j < c ^ i, (1 : \u211d) / (c ^ i) ^ 2) \u2264 c ^ 3 * (c - 1)\u207b\u00b9 / j ^ 2 := by\nhave cpos : 0 < c := zero_lt_one.trans hc\n have A : (0 : \u211d) < c\u207b\u00b9 ^ 2 := sq_pos_of_pos (inv_pos.2 cpos)\n have B : c ^ 2 * ((1 : \u211d) - c\u207b\u00b9 ^ 2)\u207b\u00b9 \u2264 c ^ 3 * (c - 1)\u207b\u00b9 := by\n rw [\u2190 div_eq_mul_inv, \u2190 div_eq_mul_inv, div_le_div_iff\u2080 _ (sub_pos.2 hc)]\n swap\n \u00b7 exact sub_pos.2 (pow_lt_one\u2080 (inv_nonneg.2 cpos.le) (inv_lt_one_of_one_lt\u2080 hc) two_ne_zero)\n have : c ^ 3 = c ^ 2 * c := by ring\n simp only [mul_sub, this, mul_one, inv_pow, sub_le_sub_iff_left]\n rw [mul_assoc, mul_comm c, \u2190 mul_assoc, mul_inv_cancel\u2080 (sq_pos_of_pos cpos).ne', one_mul]\n simpa using pow_right_mono\u2080 hc.le one_le_two\n have C : c\u207b\u00b9 ^ 2 < 1 := pow_lt_one\u2080 (inv_nonneg.2 cpos.le) (inv_lt_one_of_one_lt\u2080 hc) two_ne_zero\n calc\n (\u2211 i \u2208 range N with j < c ^ i, (1 : \u211d) / (c ^ i) ^ 2) \u2264\n \u2211 i \u2208 Ico \u230aReal.log j / Real.log c\u230b\u208a N, (1 : \u211d) / (c ^ i) ^ 2 := by\n gcongr\n intro i hi\n simp only [mem_filter, mem_range] at hi\n simp only [hi.1, mem_Ico, and_true]\n apply Nat.floor_le_of_le\n apply le_of_lt\n rw [div_lt_iff\u2080 (Real.log_pos hc), \u2190 Real.log_pow]\n exact Real.log_lt_log hj hi.2\n _ = \u2211 i \u2208 Ico \u230aReal.log j / Real.log c\u230b\u208a N, (c\u207b\u00b9 ^ 2) ^ i := by\n simp [\u2190 pow_mul, mul_comm]\n _ \u2264 (c\u207b\u00b9 ^ 2) ^ \u230aReal.log j / Real.log c\u230b\u208a / ((1 : \u211d) - c\u207b\u00b9 ^ 2) :=\n geom_sum_Ico_le_of_lt_one (sq_nonneg _) C\n _ \u2264 (c\u207b\u00b9 ^ 2) ^ (Real.log j / Real.log c - 1) / ((1 : \u211d) - c\u207b\u00b9 ^ 2) := by\n gcongr\n \u00b7 exact sub_nonneg.2 C.le\n \u00b7 rw [\u2190 Real.rpow_natCast]\n exact Real.rpow_le_rpow_of_exponent_ge A C.le (Nat.sub_one_lt_floor _).le\n _ = c ^ 2 * ((1 : \u211d) - c\u207b\u00b9 ^ 2)\u207b\u00b9 / j ^ 2 := by\n have I : (c\u207b\u00b9 ^ 2) ^ (Real.log j / Real.log c) = (1 : \u211d) / j ^ 2 := by\n apply Real.log_injOn_pos (Real.rpow_pos_of_pos A _)\n \u00b7 rw [Set.mem_Ioi]; positivity\n rw [Real.log_rpow A]\n simp only [one_div, Real.log_inv, Real.log_pow, mul_neg, neg_inj]\n field [(Real.log_pos hc).ne']\n rw [Real.rpow_sub A, I]\n simp\n ring\n _ \u2264 c ^ 3 * (c - 1)\u207b\u00b9 / j ^ 2 := by gcongr\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.cauchySeq_finset_of_geometric_bound (L566-L573)\ntheorem cauchySeq_finset_of_geometric_bound (hr : r < 1) (hf : \u2200 n, \u2016f n\u2016 \u2264 C * r ^ n) :\n CauchySeq fun s : Finset \u2115 \u21a6 \u2211 x \u2208 s, f x :=\ncauchySeq_finset_of_norm_bounded\n (aux_hasSum_of_le_geometric hr (dist_partial_sum_le_of_le_geometric hf)).summable hf\n\n/-- If `\u2016f n\u2016 \u2264 C * r ^ n` for all `n : \u2115` and some `r < 1`, then the partial sums of `f` are within\ndistance `C * r ^ n / (1 - r)` of the sum of the series. This lemma does not assume `0 \u2264 r` or\n`0 \u2264 C`. -/\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.summable_geometric_of_abs_lt_one (L379-L381)\ntheorem summable_geometric_of_abs_lt_one {r : \u211d} (h : |r| < 1) : Summable fun n : \u2115 \u21a6 r ^ n :=\nsummable_geometric_of_norm_lt_one h\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.isLittleO_pow_pow_of_abs_lt_left (L76-L95)\ntheorem isLittleO_pow_pow_of_abs_lt_left {r\u2081 r\u2082 : \u211d} (h : |r\u2081| < |r\u2082|) :\n (fun n : \u2115 \u21a6 r\u2081 ^ n) =o[atTop] fun n \u21a6 r\u2082 ^ n := by\nrefine (IsLittleO.of_norm_left ?_).of_norm_right\n exact (isLittleO_pow_pow_of_lt_left (abs_nonneg r\u2081) h).congr (pow_abs r\u2081) (pow_abs r\u2082)\n\nopen List in\n/-- Various statements equivalent to the fact that `f n` grows exponentially slower than `R ^ n`.\n\n* 0: $f n = o(a ^ n)$ for some $-R < a < R$;\n* 1: $f n = o(a ^ n)$ for some $0 < a < R$;\n* 2: $f n = O(a ^ n)$ for some $-R < a < R$;\n* 3: $f n = O(a ^ n)$ for some $0 < a < R$;\n* 4: there exist `a < R` and `C` such that one of `C` and `R` is positive and $|f n| \u2264 Ca^n$\n for all `n`;\n* 5: there exists `0 < a < R` and a positive `C` such that $|f n| \u2264 Ca^n$ for all `n`;\n* 6: there exists `a < R` such that $|f n| \u2264 a ^ n$ for sufficiently large `n`;\n* 7: there exists `0 < a < R` such that $|f n| \u2264 a ^ n$ for sufficiently large `n`.\n\nNB: For backwards compatibility, if you add more items to the list, please append them at the end of\nthe list. -/\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tsum_geometric_le_of_norm_lt_one (L293-L311)\ntheorem tsum_geometric_le_of_norm_lt_one (x : R) (h : \u2016x\u2016 < 1) :\n \u2016\u2211' n : \u2115, x ^ n\u2016 \u2264 \u2016(1 : R)\u2016 - 1 + (1 - \u2016x\u2016)\u207b\u00b9 := by\nby_cases hx : Summable (fun n \u21a6 x ^ n)\n \u00b7 rw [hx.tsum_eq_zero_add]\n simp only [_root_.pow_zero]\n refine le_trans (norm_add_le _ _) ?_\n have : \u2016\u2211' b : \u2115, (fun n \u21a6 x ^ (n + 1)) b\u2016 \u2264 (1 - \u2016x\u2016)\u207b\u00b9 - 1 := by\n refine tsum_of_norm_bounded ?_ fun b \u21a6 norm_pow_le' _ (Nat.succ_pos b)\n convert (hasSum_nat_add_iff' 1).mpr (hasSum_geometric_of_lt_one (norm_nonneg x) h)\n simp\n linarith\n \u00b7 simp only [tsum_eq_zero_of_not_summable hx, norm_zero]\n nontriviality R\n have : 1 \u2264 \u2016(1 : R)\u2016 := one_le_norm_one R\n have : 0 \u2264 (1 - \u2016x\u2016)\u207b\u00b9 := inv_nonneg.2 (by linarith)\n linarith\n\nvariable [HasSummableGeomSeries R]\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.isUnit_one_sub_of_norm_lt_one (L350-L358)\nlemma isUnit_one_sub_of_norm_lt_one {x : R} (h : \u2016x\u2016 < 1) : IsUnit (1 - x) :=\n\u27e8Units.oneSub x h, rfl\u27e9\n\nend HasSummableGeometricSeries\n\nsection Geometric\n\nvariable {K : Type*} [NormedDivisionRing K] {\u03be : K}\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_succ (L47-L49)\nlemma arithGeom_succ [Mul R] [Add R] (n : \u2115) :\n arithGeom a b u\u2080 (n + 1) = a * arithGeom a b u\u2080 n + b := rfl\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.geom_series_mul_neg (L312-L314)\ntheorem geom_series_mul_neg (x : R) (h : \u2016x\u2016 < 1) : (\u2211' i : \u2115, x ^ i) * (1 - x) = 1 :=\n(summable_geometric_of_norm_lt_one h).tsum_pow_mul_one_sub\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_strictMono (L114-L121)\nlemma arithGeom_strictMono (ha : 1 < a) (h0 : b / (1 - a) < u\u2080) :\n StrictMono (arithGeom a b u\u2080) := by\nrefine strictMono_nat_of_lt_succ fun n \u21a6 ?_\n have h_lt : b / (1 - a) < arithGeom a b u\u2080 n := div_lt_arithGeom (by positivity) ha.ne' h0 n\n rw [div_lt_iff_of_neg (sub_neg.mpr ha)] at h_lt\n rw [arithGeom_succ]\n linarith\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.cauchy_series_of_le_geometric (L590-L593)\ntheorem cauchy_series_of_le_geometric {C : \u211d} {u : \u2115 \u2192 \u03b1} {r : \u211d} (hr : r < 1)\n (h : \u2200 n, \u2016u n\u2016 \u2264 C * r ^ n) : CauchySeq fun n \u21a6 \u2211 k \u2208 range n, u k :=\ncauchySeq_of_le_geometric r C hr (by simp [h])\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.Units (L333-L338)\ndef Units.oneSub (t : R) (h : \u2016t\u2016 < 1) : R\u02e3 where\n val := 1 - t\ninv := \u2211' n : \u2115, t ^ n\n val_inv := mul_neg_geom_series t h\n inv_val := geom_series_mul_neg t h\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.hasSum_geom_series_inverse (L345-L349)\ntheorem hasSum_geom_series_inverse (x : R) (h : \u2016x\u2016 < 1) :\n HasSum (fun i \u21a6 x ^ i) (1 - x)\u207b\u00b9\u02b3 := by\nconvert (summable_geometric_of_norm_lt_one h).hasSum\n exact (geom_series_eq_inverse x h).symm\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.geom_series_mul_one_add (L326-L331)\ntheorem geom_series_mul_one_add (x : R) (h : \u2016x\u2016 < 1) :\n (1 + x) * \u2211' i : \u2115, x ^ i = 2 * \u2211' i : \u2115, x ^ i - 1 := by\nrw [add_mul, one_mul, geom_series_mul_shift x h, geom_series_succ x h, two_mul, add_sub_assoc]\n\n/-- In a normed ring with summable geometric series, a perturbation of `1` by an element `t`\nof distance less than `1` from `1` is a unit. Here we construct its `Units` structure. -/\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.norm_sub_le_of_geometric_bound_of_hasSum (L574-L579)\ntheorem norm_sub_le_of_geometric_bound_of_hasSum (hr : r < 1) (hf : \u2200 n, \u2016f n\u2016 \u2264 C * r ^ n) {a : \u03b1}\n (ha : HasSum f a) (n : \u2115) : \u2016(\u2211 x \u2208 Finset.range n, f x) - a\u2016 \u2264 C * r ^ n / (1 - r) := by\nrw [\u2190 dist_eq_norm]\n apply dist_le_of_le_geometric_of_tendsto r C hr (dist_partial_sum_le_of_le_geometric hf)\n exact ha.tendsto_sum_nat\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.hasSum_coe_mul_geometric_of_norm_lt_one (L539-L544)\ntheorem hasSum_coe_mul_geometric_of_norm_lt_one {r : \ud835\udd5c} (hr : \u2016r\u2016 < 1) :\n HasSum (fun n \u21a6 n * r ^ n : \u2115 \u2192 \ud835\udd5c) (r / (1 - r) ^ 2) := by\nconvert hasSum_coe_mul_geometric_of_norm_lt_one' hr using 1\n simp [div_eq_mul_inv]\n\n/-- If `\u2016r\u2016 < 1`, then `\u2211' n : \u2115, n * r ^ n = r / (1 - r) ^ 2`. -/\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.summable_norm_geometric_of_norm_lt_one (L429-L434)\ntheorem summable_norm_geometric_of_norm_lt_one {r : R}\n (hr : \u2016r\u2016 < 1) : Summable fun n : \u2115 \u21a6 \u2016(r ^ n : R)\u2016 := by\nsimpa using summable_norm_pow_mul_geometric_of_norm_lt_one 0 hr\n\nvariable [HasSummableGeomSeries R]\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.dist_partial_sum' (L586-L589)\ntheorem dist_partial_sum' (u : \u2115 \u2192 \u03b1) (n : \u2115) :\n dist (\u2211 k \u2208 range n, u k) (\u2211 k \u2208 range (n + 1), u k) = \u2016u n\u2016 := by\nsimp [dist_eq_norm', sum_range_succ]\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tsum_choose_mul_geometric_of_norm_lt_one' (L465-L468)\nlemma tsum_choose_mul_geometric_of_norm_lt_one' (k : \u2115) {r : R} (hr : \u2016r\u2016 < 1) :\n \u2211' n, (n + k).choose k * r ^ n = ((1 - r)\u207b\u00b9\u02b3) ^ (k + 1) :=\n(hasSum_choose_mul_geometric_of_norm_lt_one' k hr).tsum_eq\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.dist_partial_sum (L581-L584)\ntheorem dist_partial_sum (u : \u2115 \u2192 \u03b1) (n : \u2115) :\n dist (\u2211 k \u2208 range (n + 1), u k) (\u2211 k \u2208 range n, u k) = \u2016u n\u2016 := by\nsimp [dist_eq_norm, sum_range_succ]\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.div_lt_arithGeom (L105-L113)\nlemma div_lt_arithGeom (ha_pos : 0 < a) (ha_ne : a \u2260 1) (h0 : b / (1 - a) < u\u2080) (n : \u2115) :\n b / (1 - a) < arithGeom a b u\u2080 n := by\ninduction n with\n | zero => exact h0\n | succ n hn =>\n calc b / (1 - a)\n _ = a * (b / (1 - a)) + b := by grind\n _ < a * arithGeom a b u\u2080 n + b := by gcongr\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.mul_neg_geom_series (L315-L317)\ntheorem mul_neg_geom_series (x : R) (h : \u2016x\u2016 < 1) : (1 - x) * \u2211' i : \u2115, x ^ i = 1 :=\n(summable_geometric_of_norm_lt_one h).one_sub_mul_tsum_pow\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tsum_coe_mul_geometric_of_norm_lt_one (L545-L558)\ntheorem tsum_coe_mul_geometric_of_norm_lt_one {r : \ud835\udd5c} (hr : \u2016r\u2016 < 1) :\n (\u2211' n : \u2115, n * r ^ n : \ud835\udd5c) = r / (1 - r) ^ 2 :=\n(hasSum_coe_mul_geometric_of_norm_lt_one hr).tsum_eq\n\nend MulGeometric\n\nsection SummableLeGeometric\n\nvariable [SeminormedAddCommGroup \u03b1] {r C : \u211d} {f : \u2115 \u2192 \u03b1}\n\nnonrec theorem SeminormedAddCommGroup.cauchySeq_of_le_geometric {C : \u211d} {r : \u211d} (hr : r < 1)\n {u : \u2115 \u2192 \u03b1} (h : \u2200 n, \u2016u n - u (n + 1)\u2016 \u2264 C * r ^ n) : CauchySeq u :=\n cauchySeq_of_le_geometric r C hr (by simpa [dist_eq_norm] using h)\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.geom_series_eq_inverse (L339-L344)\ntheorem geom_series_eq_inverse (x : R) (h : \u2016x\u2016 < 1) :\n \u2211' i, x ^ i = (1 - x)\u207b\u00b9\u02b3 := by\nchange (Units.oneSub x h)\u207b\u00b9 = (1 - x)\u207b\u00b9\u02b3\n rw [\u2190 Ring.inverse_unit]\n rfl\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.isLittleO_coe_const_pow_of_one_lt (L164-L168)\ntheorem isLittleO_coe_const_pow_of_one_lt {R : Type*} [NormedRing R] {r : \u211d} (hr : 1 < r) :\n ((\u2191) : \u2115 \u2192 R) =o[atTop] fun n \u21a6 r ^ n := by\nsimpa only [pow_one] using @isLittleO_pow_const_const_pow_of_one_lt R _ 1 _ hr\n\n/-- If `\u2016r\u2081\u2016 < r\u2082`, then for any natural `k` we have `n ^ k r\u2081 ^ n = o (r\u2082 ^ n)` as `n \u2192 \u221e`. -/\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Analysis.SpecificLimits.FloorPow.sum_div_nat_floor_pow_sq_le_div_sq (L272-L298)\ntheorem sum_div_nat_floor_pow_sq_le_div_sq (N : \u2115) {j : \u211d} (hj : 0 < j) {c : \u211d} (hc : 1 < c) :\n (\u2211 i \u2208 range N with j < \u230ac ^ i\u230b\u208a, (1 : \u211d) / (\u230ac ^ i\u230b\u208a : \u211d) ^ 2) \u2264\n c ^ 5 * (c - 1)\u207b\u00b9 ^ 3 / j ^ 2 := by\nhave cpos : 0 < c := zero_lt_one.trans hc\n have A : 0 < 1 - c\u207b\u00b9 := sub_pos.2 (inv_lt_one_of_one_lt\u2080 hc)\n calc\n (\u2211 i \u2208 range N with j < \u230ac ^ i\u230b\u208a, (1 : \u211d) / (\u230ac ^ i\u230b\u208a : \u211d) ^ 2) \u2264\n \u2211 i \u2208 range N with j < c ^ i, (1 : \u211d) / (\u230ac ^ i\u230b\u208a : \u211d) ^ 2 := by\n gcongr with k hk; exact Nat.floor_le (by positivity)\n _ \u2264 \u2211 i \u2208 range N with j < c ^ i, (1 - c\u207b\u00b9)\u207b\u00b9 ^ 2 * ((1 : \u211d) / (c ^ i) ^ 2) := by\n gcongr with i\n rw [mul_div_assoc', mul_one, div_le_div_iff\u2080]; rotate_left\n \u00b7 apply sq_pos_of_pos\n refine zero_lt_one.trans_le ?_\n simp only [Nat.le_floor, one_le_pow\u2080, hc.le, Nat.one_le_cast, Nat.cast_one]\n \u00b7 exact sq_pos_of_pos (pow_pos cpos _)\n rw [one_mul, \u2190 mul_pow]\n gcongr\n rw [\u2190 div_eq_inv_mul, le_div_iff\u2080 A, mul_comm]\n exact mul_pow_le_nat_floor_pow hc i\n _ \u2264 (1 - c\u207b\u00b9)\u207b\u00b9 ^ 2 * (c ^ 3 * (c - 1)\u207b\u00b9) / j ^ 2 := by\n rw [\u2190 mul_sum, \u2190 mul_div_assoc']\n gcongr\n exact sum_div_pow_sq_le_div_sq N hj hc\n _ = c ^ 5 * (c - 1)\u207b\u00b9 ^ 3 / j ^ 2 := by\n congr 1\n field\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Analysis.SpecificLimits.FloorPow.tendsto_div_of_monotone_of_tendsto_div_floor_pow (L182-L213)\ntheorem tendsto_div_of_monotone_of_tendsto_div_floor_pow (u : \u2115 \u2192 \u211d) (l : \u211d) (hmono : Monotone u)\n (c : \u2115 \u2192 \u211d) (cone : \u2200 k, 1 < c k) (clim : Tendsto c atTop (\ud835\udcdd 1))\n (hc : \u2200 k, Tendsto (fun n : \u2115 => u \u230ac k ^ n\u230b\u208a / \u230ac k ^ n\u230b\u208a) atTop (\ud835\udcdd l)) :\n Tendsto (fun n => u n / n) atTop (\ud835\udcdd l) := by\napply tendsto_div_of_monotone_of_exists_subseq_tendsto_div u l hmono\n intro a ha\n obtain \u27e8k, hk\u27e9 : \u2203 k, c k < a := ((tendsto_order.1 clim).2 a ha).exists\n refine\n \u27e8fun n => \u230ac k ^ n\u230b\u208a, ?_,\n (tendsto_nat_floor_atTop (\u03b1 := \u211d)).comp (tendsto_pow_atTop_atTop_of_one_lt (cone k)), hc k\u27e9\n have H : \u2200 n : \u2115, (0 : \u211d) < \u230ac k ^ n\u230b\u208a := by\n intro n\n refine zero_lt_one.trans_le ?_\n simp only [Nat.one_le_cast, Nat.one_le_floor_iff, one_le_pow\u2080 (cone k).le]\n have A :\n Tendsto (fun n : \u2115 => (\u230ac k ^ (n + 1)\u230b\u208a : \u211d) / c k ^ (n + 1) * c k / (\u230ac k ^ n\u230b\u208a / c k ^ n))\n atTop (\ud835\udcdd (1 * c k / 1)) := by\n refine Tendsto.div (Tendsto.mul ?_ tendsto_const_nhds) ?_ one_ne_zero\n \u00b7 refine tendsto_nat_floor_div_atTop.comp ?_\n exact (tendsto_pow_atTop_atTop_of_one_lt (cone k)).comp (tendsto_add_atTop_nat 1)\n \u00b7 refine tendsto_nat_floor_div_atTop.comp ?_\n exact tendsto_pow_atTop_atTop_of_one_lt (cone k)\n have B : Tendsto (fun n : \u2115 => (\u230ac k ^ (n + 1)\u230b\u208a : \u211d) / \u230ac k ^ n\u230b\u208a) atTop (\ud835\udcdd (c k)) := by\n simp only [one_mul, div_one] at A\n convert A using 1\n ext1 n\n field [(zero_lt_one.trans (cone k)).ne']\n filter_upwards [(tendsto_order.1 B).2 a hk] with n hn\n exact (div_le_iff\u2080 (H n)).1 hn.le\n\n/-- The sum of `1/(c^i)^2` above a threshold `j` is comparable to `1/j^2`, up to a multiplicative\nconstant. -/\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Analysis.SpecificLimits.Fibonacci.tendsto_fib_succ_div_fib_atTop (L23-L35)\ntheorem tendsto_fib_succ_div_fib_atTop :\n Tendsto (fun n \u21a6 (fib (n + 1) / fib n : \u211d)) atTop (\ud835\udcdd \u03c6) := by\nhave h\u2081 n : (fib (n + 1) / fib n : \u211d) = (\u03c6 - \u03c8 * (\u03c8 / \u03c6) ^ n) / (1 - (\u03c8 / \u03c6) ^ n) := by\n simp only [coe_fib_eq, pow_succ, div_pow]\n field\n have h\u2082 := tendsto_pow_atTop_nhds_zero_of_abs_lt_one (r := \u03c8 / \u03c6) <| by\n rw [abs_div, div_lt_one <| by positivity, abs_of_pos goldenRatio_pos, abs_lt]\n ring_nf\n bound\n rw [show \u03c6 = (\u03c6 - \u03c8 * 0) / (1 - 0) by ring, funext h\u2081]\n exact const_sub _ (const_mul _ h\u2082) |>.div (const_sub _ h\u2082) <| by simp\n\n/-- The limit of `fib n / fib (n + 1)` as `n \u2192 \u221e` is the negative conjugate of the golden ratio. -/\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_eq_add_sum (L50-L61)\nlemma arithGeom_eq_add_sum [CommSemiring R] (n : \u2115) :\n arithGeom a b u\u2080 n = a ^ n * u\u2080 + b * \u2211 k \u2208 Finset.range n, a ^ k := by\ninduction n with\n | zero => simp\n | succ n hn =>\n rw [arithGeom_succ, hn, mul_add, \u2190 mul_assoc, add_comm n, pow_add, pow_one, add_assoc]\n congr\n rw [add_comm _ n, Finset.sum_range_succ', Finset.mul_sum, pow_zero, mul_add, mul_one,\n Finset.mul_sum, Finset.mul_sum]\n congr with k\n ring\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tsum_geometric_of_abs_lt_one (L382-L386)\ntheorem tsum_geometric_of_abs_lt_one {r : \u211d} (h : |r| < 1) : \u2211' n : \u2115, r ^ n = (1 - r)\u207b\u00b9 :=\ntsum_geometric_of_norm_lt_one h\n\n/-- A geometric series in a normed field is summable iff the norm of the common ratio is less than\none. -/\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.isLittleO_pow_pow_of_lt_left (L65-L71)\ntheorem isLittleO_pow_pow_of_lt_left {r\u2081 r\u2082 : \u211d} (h\u2081 : 0 \u2264 r\u2081) (h\u2082 : r\u2081 < r\u2082) :\n (fun n : \u2115 \u21a6 r\u2081 ^ n) =o[atTop] fun n \u21a6 r\u2082 ^ n :=\nhave H : 0 < r\u2082 := h\u2081.trans_lt h\u2082\n (isLittleO_of_tendsto fun _ hn \u21a6 False.elim <| H.ne' <| eq_zero_of_pow_eq_zero hn) <|\n (tendsto_pow_atTop_nhds_zero_of_lt_one\n (div_nonneg h\u2081 (h\u2081.trans h\u2082.le)) ((div_lt_one H).2 h\u2082)).congr fun _ \u21a6 div_pow _ _ _\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.summable_choose_mul_geometric_of_norm_lt_one (L461-L464)\nlemma summable_choose_mul_geometric_of_norm_lt_one (k : \u2115) {r : R} (hr : \u2016r\u2016 < 1) :\n Summable (fun n \u21a6 (n + k).choose k * r ^ n) :=\n(hasSum_choose_mul_geometric_of_norm_lt_one' k hr).summable\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_pow_atTop_nhds_zero_iff_norm_lt_one (L231-L247)\nlemma tendsto_pow_atTop_nhds_zero_iff_norm_lt_one {R : Type*} [SeminormedRing R] [NormMulClass R]\n {x : R} : Tendsto (fun n : \u2115 \u21a6 x ^ n) atTop (\ud835\udcdd 0) \u2194 \u2016x\u2016 < 1 := by\n-- this proof is slightly fiddly since `\u2016x ^ n\u2016 = \u2016x\u2016 ^ n` might not hold for `n = 0`\n refine \u27e8?_, tendsto_pow_atTop_nhds_zero_of_norm_lt_one\u27e9\n rw [\u2190 abs_of_nonneg (norm_nonneg _), \u2190 tendsto_pow_atTop_nhds_zero_iff,\n tendsto_zero_iff_norm_tendsto_zero]\n apply Tendsto.congr'\n filter_upwards [eventually_ge_atTop 1] with n hn\n induction n, hn using Nat.le_induction with\n | base => simp\n | succ n hn IH => simp [pow_succ, IH]\n\nvariable {R S : Type*} [Field R] [Field S] [LinearOrder S] {v w : AbsoluteValue R S}\n [TopologicalSpace S] [IsStrictOrderedRing S] [Archimedean S] [_i : OrderTopology S]\n\n/-- `v (1 / (1 + a ^n))` tends to `1` for all `v : AbsoluteValue R S` for fields `R` and `S`,\nprovided `v a < 1`. -/\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.tendsto_arithGeom_atTop_of_one_lt (L122-L128)\nlemma tendsto_arithGeom_atTop_of_one_lt [Archimedean R] (ha : 1 < a) (h0 : b / (1 - a) < u\u2080) :\n Tendsto (arithGeom a b u\u2080) atTop atTop := by\nrw [arithGeom_eq' ha.ne']\n refine tendsto_atTop_add_const_right _ _ ?_\n refine Tendsto.atTop_mul_const (sub_pos.mpr h0) ?_\n exact tendsto_pow_atTop_atTop_of_one_lt ha\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.isBigO_pow_pow_of_le_left (L72-L75)\ntheorem isBigO_pow_pow_of_le_left {r\u2081 r\u2082 : \u211d} (h\u2081 : 0 \u2264 r\u2081) (h\u2082 : r\u2081 \u2264 r\u2082) :\n (fun n : \u2115 \u21a6 r\u2081 ^ n) =O[atTop] fun n \u21a6 r\u2082 ^ n :=\nh\u2082.eq_or_lt.elim (fun h \u21a6 h \u25b8 isBigO_refl _ _) fun h \u21a6 (isLittleO_pow_pow_of_lt_left h\u2081 h).isBigO\n```\n\n-- snippet 84\n```lean\n-- Mathlib.Analysis.SpecificLimits.Fibonacci.tendsto_fib_div_fib_succ_atTop (L36-L40)\ntheorem tendsto_fib_div_fib_succ_atTop :\n Tendsto (fun n \u21a6 (fib n / fib (n + 1) : \u211d)) atTop (\ud835\udcdd (-\u03c8)) := by\nconvert tendsto_fib_succ_div_fib_atTop.inv\u2080 (by positivity) using 2\n \u00b7 rw [inv_div]\n \u00b7 rw [inv_goldenRatio]\n```\n\n-- snippet 85\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_intCast_atBot_sup_atTop_cobounded (L45-L52)\ntheorem tendsto_intCast_atBot_sup_atTop_cobounded\n [NormedRing \u03b1] [NormSMulClass \u2124 \u03b1] [Nontrivial \u03b1] :\n Tendsto Int.cast (atBot \u2294 atTop) (Bornology.cobounded \u03b1) := by\nrw [\u2190 tendsto_norm_atTop_iff_cobounded]\n simpa [norm_intCast_eq_abs_mul_norm_one] using tendsto_intCast_atTop_atTop\n |>.comp (tendsto_abs_atBot_atTop.sup tendsto_abs_atTop_atTop)\n |>.atTop_mul_const (norm_pos_iff.mpr one_ne_zero)\n```\n\n-- snippet 86\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.hasSum_choose_mul_geometric_of_norm_lt_one' (L435-L460)\nlemma hasSum_choose_mul_geometric_of_norm_lt_one'\n (k : \u2115) {r : R} (hr : \u2016r\u2016 < 1) :\n HasSum (fun n \u21a6 (n + k).choose k * r ^ n) ((1 - r)\u207b\u00b9\u02b3 ^ (k + 1)) := by\ninduction k with\n | zero => simpa using hasSum_geom_series_inverse r hr\n | succ k ih =>\n have I1 : Summable (fun (n : \u2115) \u21a6 \u2016(n + k).choose k * r ^ n\u2016) := by\n apply summable_norm_mul_geometric_of_norm_lt_one (k := k) hr\n apply isBigO_iff.2 \u27e82 ^ k, ?_\u27e9\n filter_upwards [Ioi_mem_atTop k] with n (hn : k < n)\n simp only [Real.norm_eq_abs, abs_cast, cast_pow, norm_pow]\n norm_cast\n calc (n + k).choose k\n _ \u2264 (2 * n).choose k := choose_le_choose k (by lia)\n _ \u2264 (2 * n) ^ k := Nat.choose_le_pow _ _\n _ = 2 ^ k * n ^ k := Nat.mul_pow 2 n k\n convert hasSum_sum_range_mul_of_summable_norm' I1 ih.summable\n (summable_norm_geometric_of_norm_lt_one hr) (summable_geometric_of_norm_lt_one hr) with n\n \u00b7 have : \u2211 i \u2208 Finset.range (n + 1), \u2191((i + k).choose k) * r ^ i * r ^ (n - i) =\n \u2211 i \u2208 Finset.range (n + 1), \u2191((i + k).choose k) * r ^ n := by\n apply Finset.sum_congr rfl (fun i hi \u21a6 ?_)\n simp only [Finset.mem_range] at hi\n rw [mul_assoc, \u2190 pow_add, show i + (n - i) = n by lia]\n simp [this, \u2190 sum_mul, \u2190 Nat.cast_sum, sum_range_add_choose n k, add_assoc]\n \u00b7 rw [ih.tsum_eq, (hasSum_geom_series_inverse r hr).tsum_eq, pow_succ]\n```\n\n-- snippet 87\n```lean\n-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_eq (L72-L77)\nlemma arithGeom_eq (ha : a \u2260 1) (n : \u2115) :\n arithGeom a b u\u2080 n = a ^ n * (u\u2080 - (b / (1 - a))) + b / (1 - a) := by\ninduction n with\n | zero => simp\n | succ n hn => unfold arithGeom; grind\n```\n\n-- snippet 88\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tsum_coe_mul_geometric_of_norm_lt_one' (L534-L538)\ntheorem tsum_coe_mul_geometric_of_norm_lt_one'\n {r : \ud835\udd5c} (hr : \u2016r\u2016 < 1) : (\u2211' n : \u2115, n * r ^ n : \ud835\udd5c) = r * (1 - r)\u207b\u00b9\u02b3 ^ 2 :=\n(hasSum_coe_mul_geometric_of_norm_lt_one' hr).tsum_eq\n\n/-- If `\u2016r\u2016 < 1`, then `\u2211' n : \u2115, n * r ^ n = r / (1 - r) ^ 2`, `HasSum` version. -/\n```\n\n-- snippet 89\n```lean\n-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_zero_eq_mul_div (L98-L104)\nlemma arithGeom_zero_eq_mul_div (ha : a \u2260 1) (n : \u2115) :\n arithGeom a b 0 n = b * (a ^ n - 1) / (a - 1) := by\nrw [arithGeom_zero_eq_mul_div' ha n, \u2190 neg_sub _ a, div_neg, \u2190 neg_sub _ (a ^ n), mul_neg,\n neg_div, neg_neg]\n\nvariable [LinearOrder R] [IsStrictOrderedRing R]\n```\n\n-- snippet 90\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.hasSum_geometric_of_norm_lt_one (L359-L368)\ntheorem hasSum_geometric_of_norm_lt_one (h : \u2016\u03be\u2016 < 1) : HasSum (fun n : \u2115 \u21a6 \u03be ^ n) (1 - \u03be)\u207b\u00b9 := by\nhave xi_ne_one : \u03be \u2260 1 := by\n contrapose! h\n simp [h]\n have A : Tendsto (fun n \u21a6 (\u03be ^ n - 1) * (\u03be - 1)\u207b\u00b9) atTop (\ud835\udcdd ((0 - 1) * (\u03be - 1)\u207b\u00b9)) :=\n ((tendsto_pow_atTop_nhds_zero_of_norm_lt_one h).sub tendsto_const_nhds).mul tendsto_const_nhds\n rw [hasSum_iff_tendsto_nat_of_summable_norm]\n \u00b7 simpa [geom_sum_eq, xi_ne_one, neg_inv, div_eq_mul_inv] using A\n \u00b7 simp [norm_pow, summable_geometric_of_lt_one (norm_nonneg _) h]\n```\n\n-- snippet 91\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.isLittleO_pow_const_const_pow_of_one_lt (L146-L163)\ntheorem isLittleO_pow_const_const_pow_of_one_lt {R : Type*} [NormedRing R] (k : \u2115) {r : \u211d}\n (hr : 1 < r) : (fun n \u21a6 (n : R) ^ k : \u2115 \u2192 R) =o[atTop] fun n \u21a6 r ^ n := by\nhave : Tendsto (fun x : \u211d \u21a6 x ^ k) (\ud835\udcdd[>] 1) (\ud835\udcdd 1) :=\n ((continuous_id.pow k).tendsto' (1 : \u211d) 1 (one_pow _)).mono_left inf_le_left\n obtain \u27e8r' : \u211d, hr' : r' ^ k < r, h1 : 1 < r'\u27e9 :=\n ((this.eventually (gt_mem_nhds hr)).and self_mem_nhdsWithin).exists\n have h0 : 0 \u2264 r' := zero_le_one.trans h1.le\n suffices (fun n \u21a6 (n : R) ^ k : \u2115 \u2192 R) =O[atTop] fun n : \u2115 \u21a6 (r' ^ k) ^ n from\n this.trans_isLittleO (isLittleO_pow_pow_of_lt_left (pow_nonneg h0 _) hr')\n conv in (r' ^ _) ^ _ => rw [\u2190 pow_mul, mul_comm, pow_mul]\n suffices \u2200 n : \u2115, \u2016(n : R)\u2016 \u2264 (r' - 1)\u207b\u00b9 * \u2016(1 : R)\u2016 * \u2016r' ^ n\u2016 from\n (isBigO_of_le' _ this).pow _\n intro n\n rw [mul_right_comm]\n refine n.norm_cast_le.trans (mul_le_mul_of_nonneg_right ?_ (norm_nonneg _))\n simpa [_root_.div_eq_inv_mul, Real.norm_eq_abs, abs_of_nonneg h0] using n.cast_le_pow_div_sub h1\n\n/-- For a real `r > 1` we have `n = o(r ^ n)` as `n \u2192 \u221e`. -/\n```\n\n-- snippet 92\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.summable_norm_mul_geometric_of_norm_lt_one (L402-L422)\ntheorem summable_norm_mul_geometric_of_norm_lt_one {k : \u2115} {r : R}\n (hr : \u2016r\u2016 < 1) {u : \u2115 \u2192 \u2115} (hu : (fun n \u21a6 (u n : \u211d)) =O[atTop] (fun n \u21a6 (\u2191(n ^ k) : \u211d))) :\n Summable fun n : \u2115 \u21a6 \u2016(u n * r ^ n : R)\u2016 := by\nrcases exists_between hr with \u27e8r', hrr', h\u27e9\n rw [\u2190 norm_norm] at hrr'\n apply summable_of_isBigO_nat (summable_geometric_of_lt_one ((norm_nonneg _).trans hrr'.le) h)\n calc\n fun n \u21a6 \u2016\u2191(u n) * r ^ n\u2016\n _ =O[atTop] fun n \u21a6 u n * \u2016r\u2016 ^ n := by\n apply (IsBigOWith.of_bound (c := \u2016(1 : R)\u2016) ?_).isBigO\n filter_upwards [eventually_norm_pow_le r] with n hn\n simp only [norm_mul, Real.norm_eq_abs, abs_cast, norm_pow, abs_norm]\n apply (norm_mul_le _ _).trans\n have : \u2016(u n : R)\u2016 * \u2016r ^ n\u2016 \u2264 (u n * \u2016(1 : R)\u2016) * \u2016r\u2016 ^ n := by\n gcongr; exact norm_cast_le (u n)\n exact this.trans (le_of_eq (by ring))\n _ =O[atTop] fun n \u21a6 \u2191(n ^ k) * \u2016r\u2016 ^ n := hu.mul (isBigO_refl _ _)\n _ =O[atTop] fun n \u21a6 r' ^ n := by\n simp only [cast_pow]\n exact (isLittleO_pow_const_mul_const_pow_const_pow_of_norm_lt k hrr').isBigO\n```\n\n-- snippet 93\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_self_mul_const_pow_of_lt_one (L216-L220)\ntheorem tendsto_self_mul_const_pow_of_lt_one {r : \u211d} (hr : 0 \u2264 r) (h'r : r < 1) :\n Tendsto (fun n \u21a6 n * r ^ n : \u2115 \u2192 \u211d) atTop (\ud835\udcdd 0) := by\nsimpa only [pow_one] using tendsto_pow_const_mul_const_pow_of_lt_one 1 hr h'r\n\n/-- In a normed ring, the powers of an element x with `\u2016x\u2016 < 1` tend to zero. -/\n```\n\n-- snippet 94\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_pow_atTop_nhds_zero_of_abs_lt_one (L227-L230)\ntheorem tendsto_pow_atTop_nhds_zero_of_abs_lt_one {r : \u211d} (h : |r| < 1) :\n Tendsto (fun n : \u2115 \u21a6 r ^ n) atTop (\ud835\udcdd 0) :=\ntendsto_pow_atTop_nhds_zero_of_norm_lt_one h\n```\n\n-- snippet 95\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tsum_geometric_of_norm_lt_one (L372-L374)\ntheorem tsum_geometric_of_norm_lt_one (h : \u2016\u03be\u2016 < 1) : \u2211' n : \u2115, \u03be ^ n = (1 - \u03be)\u207b\u00b9 :=\n(hasSum_geometric_of_norm_lt_one h).tsum_eq\n```\n\n-- snippet 96\n```lean\n-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_same_eq_sum (L62-L65)\nlemma arithGeom_same_eq_sum [CommSemiring R] (n : \u2115) :\n arithGeom a b b n = b * \u2211 k \u2208 Finset.range (n + 1), a ^ k := by\nrw [arithGeom_eq_add_sum, Finset.sum_range_succ, mul_add, add_comm, mul_comm _ b]\n```\n\n-- snippet 97\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.hasSum_choose_mul_geometric_of_norm_lt_one (L469-L474)\nlemma hasSum_choose_mul_geometric_of_norm_lt_one\n (k : \u2115) {r : \ud835\udd5c} (hr : \u2016r\u2016 < 1) :\n HasSum (fun n \u21a6 (n + k).choose k * r ^ n) (1 / (1 - r) ^ (k + 1)) := by\nconvert hasSum_choose_mul_geometric_of_norm_lt_one' k hr\n simp\n```\n\n-- snippet 98\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.summable_geometric_iff_norm_lt_one (L388-L401)\ntheorem summable_geometric_iff_norm_lt_one : (Summable fun n : \u2115 \u21a6 \u03be ^ n) \u2194 \u2016\u03be\u2016 < 1 := by\nrefine \u27e8fun h \u21a6 ?_, summable_geometric_of_norm_lt_one\u27e9\n obtain \u27e8k : \u2115, hk : dist (\u03be ^ k) 0 < 1\u27e9 :=\n (h.tendsto_cofinite_zero.eventually (ball_mem_nhds _ zero_lt_one)).exists\n simp only [norm_pow, dist_zero_right] at hk\n rw [\u2190 one_pow k] at hk\n exact lt_of_pow_lt_pow_left\u2080 _ zero_le_one hk\n\nend Geometric\n\nsection MulGeometric\n\nvariable {R : Type*} [NormedRing R] {\ud835\udd5c : Type*} [NormedDivisionRing \ud835\udd5c]\n```\n\n-- snippet 99\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_pow_const_div_const_pow_of_one_lt (L182-L186)\ntheorem tendsto_pow_const_div_const_pow_of_one_lt (k : \u2115) {r : \u211d} (hr : 1 < r) :\n Tendsto (fun n \u21a6 (n : \u211d) ^ k / r ^ n : \u2115 \u2192 \u211d) atTop (\ud835\udcdd 0) :=\n(isLittleO_pow_const_const_pow_of_one_lt k hr).tendsto_div_nhds_zero\n\n/-- If `|r| < 1`, then `n ^ k r ^ n` tends to zero for any natural `k`. -/\n```\n\n-- snippet 100\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_pow_atTop_nhds_zero_of_norm_lt_one (L221-L226)\ntheorem tendsto_pow_atTop_nhds_zero_of_norm_lt_one {R : Type*} [SeminormedRing R] {x : R}\n (h : \u2016x\u2016 < 1) :\n Tendsto (fun n : \u2115 \u21a6 x ^ n) atTop (\ud835\udcdd 0) := by\napply squeeze_zero_norm' (eventually_norm_pow_le x)\n exact tendsto_pow_atTop_nhds_zero_of_lt_one (norm_nonneg _) h\n```\n\n-- snippet 101\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_intCast_atBot_cobounded (L53-L57)\ntheorem tendsto_intCast_atBot_cobounded\n [NormedRing \u03b1] [NormSMulClass \u2124 \u03b1] [Nontrivial \u03b1] :\n Tendsto Int.cast atBot (Bornology.cobounded \u03b1) :=\ntendsto_intCast_atBot_sup_atTop_cobounded.mono_left le_sup_left\n```\n\n-- snippet 102\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_intCast_atTop_cobounded (L58-L64)\ntheorem tendsto_intCast_atTop_cobounded\n [NormedRing \u03b1] [NormSMulClass \u2124 \u03b1] [Nontrivial \u03b1] :\n Tendsto Int.cast atTop (Bornology.cobounded \u03b1) :=\ntendsto_intCast_atBot_sup_atTop_cobounded.mono_left le_sup_right\n\n/-! ### Powers -/\n```\n\n-- snippet 103\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.hasSum_geometric_of_abs_lt_one (L375-L378)\ntheorem hasSum_geometric_of_abs_lt_one {r : \u211d} (h : |r| < 1) :\n HasSum (fun n : \u2115 \u21a6 r ^ n) (1 - r)\u207b\u00b9 :=\nhasSum_geometric_of_norm_lt_one h\n```\n\n-- snippet 104\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.TFAE_exists_lt_isLittleO_pow (L96-L145)\ntheorem TFAE_exists_lt_isLittleO_pow (f : \u2115 \u2192 \u211d) (R : \u211d) :\n TFAE\n [\u2203 a \u2208 Ioo (-R) R, f =o[atTop] (a ^ \u00b7), \u2203 a \u2208 Ioo 0 R, f =o[atTop] (a ^ \u00b7),\n \u2203 a \u2208 Ioo (-R) R, f =O[atTop] (a ^ \u00b7), \u2203 a \u2208 Ioo 0 R, f =O[atTop] (a ^ \u00b7),\n \u2203 a < R, \u2203 C : \u211d, (0 < C \u2228 0 < R) \u2227 \u2200 n, |f n| \u2264 C * a ^ n,\n \u2203 a \u2208 Ioo 0 R, \u2203 C > 0, \u2200 n, |f n| \u2264 C * a ^ n, \u2203 a < R, \u2200\u1da0 n in atTop, |f n| \u2264 a ^ n,\n \u2203 a \u2208 Ioo 0 R, \u2200\u1da0 n in atTop, |f n| \u2264 a ^ n] := by\nhave A : Ico 0 R \u2286 Ioo (-R) R :=\n fun x hx \u21a6 \u27e8(neg_lt_zero.2 (hx.1.trans_lt hx.2)).trans_le hx.1, hx.2\u27e9\n have B : Ioo 0 R \u2286 Ioo (-R) R := Subset.trans Ioo_subset_Ico_self A\n -- First we prove that 1-4 are equivalent using 2 \u2192 3 \u2192 4, 1 \u2192 3, and 2 \u2192 1\n tfae_have 1 \u2192 3 := fun \u27e8a, ha, H\u27e9 \u21a6 \u27e8a, ha, H.isBigO\u27e9\n tfae_have 2 \u2192 1 := fun \u27e8a, ha, H\u27e9 \u21a6 \u27e8a, B ha, H\u27e9\n tfae_have 3 \u2192 2\n | \u27e8a, ha, H\u27e9 => by\n rcases exists_between (abs_lt.2 ha) with \u27e8b, hab, hbR\u27e9\n exact \u27e8b, \u27e8(abs_nonneg a).trans_lt hab, hbR\u27e9,\n H.trans_isLittleO (isLittleO_pow_pow_of_abs_lt_left (hab.trans_le (le_abs_self b)))\u27e9\n tfae_have 2 \u2192 4 := fun \u27e8a, ha, H\u27e9 \u21a6 \u27e8a, ha, H.isBigO\u27e9\n tfae_have 4 \u2192 3 := fun \u27e8a, ha, H\u27e9 \u21a6 \u27e8a, B ha, H\u27e9\n -- Add 5 and 6 using 4 \u2192 6 \u2192 5 \u2192 3\n tfae_have 4 \u2192 6\n | \u27e8a, ha, H\u27e9 => by\n rcases bound_of_isBigO_nat_atTop H with \u27e8C, hC\u2080, hC\u27e9\n refine \u27e8a, ha, C, hC\u2080, fun n \u21a6 ?_\u27e9\n simpa only [Real.norm_eq_abs, abs_pow, abs_of_nonneg ha.1.le] using hC (pow_ne_zero n ha.1.ne')\n tfae_have 6 \u2192 5 := fun \u27e8a, ha, C, H\u2080, H\u27e9 \u21a6 \u27e8a, ha.2, C, Or.inl H\u2080, H\u27e9\n tfae_have 5 \u2192 3\n | \u27e8a, ha, C, h\u2080, H\u27e9 => by\n rcases sign_cases_of_C_mul_pow_nonneg fun n \u21a6 (abs_nonneg _).trans (H n) with (rfl | \u27e8hC\u2080, ha\u2080\u27e9)\n \u00b7 obtain rfl : f = 0 := by\n ext n\n simpa using H n\n simp only [lt_irrefl, false_or] at h\u2080\n exact \u27e80, \u27e8neg_lt_zero.2 h\u2080, h\u2080\u27e9, isBigO_zero _ _\u27e9\n exact \u27e8a, A \u27e8ha\u2080, ha\u27e9,\n isBigO_of_le' _ fun n \u21a6 (H n).trans <| mul_le_mul_of_nonneg_left (le_abs_self _) hC\u2080.le\u27e9\n -- Add 7 and 8 using 2 \u2192 8 \u2192 7 \u2192 3\n tfae_have 2 \u2192 8\n | \u27e8a, ha, H\u27e9 => by\n refine \u27e8a, ha, (H.def zero_lt_one).mono fun n hn \u21a6 ?_\u27e9\n rwa [Real.norm_eq_abs, Real.norm_eq_abs, one_mul, abs_pow, abs_of_pos ha.1] at hn\n tfae_have 8 \u2192 7 := fun \u27e8a, ha, H\u27e9 \u21a6 \u27e8a, ha.2, H\u27e9\n tfae_have 7 \u2192 3\n | \u27e8a, ha, H\u27e9 => by\n refine \u27e8a, A \u27e8?_, ha\u27e9, .of_norm_eventuallyLE H\u27e9\n exact nonneg_of_eventually_pow_nonneg (H.mono fun n \u21a6 (abs_nonneg _).trans)\n tfae_finish\n\n/-- For any natural `k` and a real `r > 1` we have `n ^ k = o(r ^ n)` as `n \u2192 \u221e`. -/\n```\n\n-- snippet 105\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.hasSum_coe_mul_geometric_of_norm_lt_one' (L515-L533)\ntheorem hasSum_coe_mul_geometric_of_norm_lt_one'\n {x : R} (h : \u2016x\u2016 < 1) :\n HasSum (fun n \u21a6 n * x ^ n : \u2115 \u2192 R) (x * ((1 - x)\u207b\u00b9\u02b3) ^ 2) := by\nhave A : HasSum (fun (n : \u2115) \u21a6 (n + 1) * x ^ n) ((1 - x)\u207b\u00b9\u02b3 ^ 2) := by\n convert hasSum_choose_mul_geometric_of_norm_lt_one' 1 h with n\n simp\n have B : HasSum (fun (n : \u2115) \u21a6 x ^ n) ((1 - x)\u207b\u00b9\u02b3) := hasSum_geom_series_inverse x h\n convert A.sub B using 1\n \u00b7 ext n\n simp [add_mul]\n \u00b7 symm\n calc (1 - x)\u207b\u00b9\u02b3 ^ 2 - (1 - x)\u207b\u00b9\u02b3\n _ = (1 - x)\u207b\u00b9\u02b3 ^ 2 - ((1 - x) * (1 - x)\u207b\u00b9\u02b3) * (1 - x)\u207b\u00b9\u02b3 := by\n simp [Ring.mul_inverse_cancel (1 - x) (isUnit_one_sub_of_norm_lt_one h)]\n _ = x * (1 - x)\u207b\u00b9\u02b3 ^ 2 := by noncomm_ring\n\n/-- If `\u2016r\u2016 < 1`, then `\u2211' n : \u2115, n * r ^ n = r / (1 - r) ^ 2`, version in a general ring with\nsummable geometric series. For a version in a field, using division instead of `Ring.inverse`,\nsee `tsum_coe_mul_geometric_of_norm_lt_one`. -/\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.Analysis.SpecificLimits.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 lt_geom {u : \u2115 \u2192 \u211d} {c : \u211d} (hc : 0 \u2264 c) {n : \u2115} (hn : 0 < n)\n (h : \u2200 k < n, u (k + 1) < c * u k) : u n < c ^ n * u 0\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.NNRat (L35-L37)\ntheorem NNRat.tendsto_inv_atTop_nhds_zero_nat : Tendsto (fun n : \u2115 \u21a6 (n : \u211a\u22650)\u207b\u00b9) atTop (\ud835\udcdd 0) :=\ntendsto_inv_atTop_zero.comp tendsto_natCast_atTop_atTop\n```\n\n-- snippet 2\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.NNRat (L38-L44)\ntheorem NNRat.tendsto_algebraMap_inv_atTop_nhds_zero_nat (\ud835\udd5c : Type*) [Semiring \ud835\udd5c]\n [Algebra \u211a\u22650 \ud835\udd5c] [TopologicalSpace \ud835\udd5c] [ContinuousSMul \u211a\u22650 \ud835\udd5c] :\n Tendsto (algebraMap \u211a\u22650 \ud835\udd5c \u2218 fun n : \u2115 \u21a6 (n : \u211a\u22650)\u207b\u00b9) atTop (\ud835\udcdd 0) := by\nconvert (continuous_algebraMap \u211a\u22650 \ud835\udd5c).continuousAt.tendsto.comp\n tendsto_inv_atTop_nhds_zero_nat\n rw [map_zero]\n```\n\n-- snippet 3\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_inv_atTop_nhds_zero_nat (L45-L50)\ntheorem tendsto_inv_atTop_nhds_zero_nat {\ud835\udd5c : Type*} [DivisionSemiring \ud835\udd5c] [CharZero \ud835\udd5c]\n [TopologicalSpace \ud835\udd5c] [ContinuousSMul \u211a\u22650 \ud835\udd5c] :\n Tendsto (fun n : \u2115 \u21a6 (n : \ud835\udd5c)\u207b\u00b9) atTop (\ud835\udcdd 0) := by\nconvert NNRat.tendsto_algebraMap_inv_atTop_nhds_zero_nat \ud835\udd5c\n simp\n```\n\n-- snippet 4\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_const_div_atTop_nhds_zero_nat (L51-L56)\ntheorem tendsto_const_div_atTop_nhds_zero_nat {\ud835\udd5c : Type*} [DivisionSemiring \ud835\udd5c] [CharZero \ud835\udd5c]\n [TopologicalSpace \ud835\udd5c] [ContinuousSMul \u211a\u22650 \ud835\udd5c] [ContinuousMul \ud835\udd5c] (C : \ud835\udd5c) :\n Tendsto (fun n : \u2115 \u21a6 C / n) atTop (\ud835\udcdd 0) := by\nsimpa only [mul_zero, div_eq_mul_inv] using\n (tendsto_const_nhds (x := C)).mul tendsto_inv_atTop_nhds_zero_nat\n```\n\n-- snippet 5\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_one_div_atTop_nhds_zero_nat (L57-L61)\ntheorem tendsto_one_div_atTop_nhds_zero_nat {\ud835\udd5c : Type*} [DivisionSemiring \ud835\udd5c] [CharZero \ud835\udd5c]\n [TopologicalSpace \ud835\udd5c] [ContinuousSMul \u211a\u22650 \ud835\udd5c] :\n Tendsto (fun n : \u2115 \u21a6 1 / (n : \ud835\udd5c)) atTop (\ud835\udcdd 0) := by\nsimp [tendsto_inv_atTop_nhds_zero_nat]\n```\n\n-- snippet 6\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.EReal (L62-L69)\ntheorem EReal.tendsto_const_div_atTop_nhds_zero_nat {C : EReal} (h : C \u2260 \u22a5) (h' : C \u2260 \u22a4) :\n Tendsto (fun n : \u2115 \u21a6 C / n) atTop (\ud835\udcdd 0) := by\nhave : (fun n : \u2115 \u21a6 C / n) = fun n : \u2115 \u21a6 ((C.toReal / n : \u211d) : EReal) := by\n ext n\n nth_rw 1 [\u2190 coe_toReal h' h, \u2190 coe_coe_eq_natCast n, \u2190 coe_div C.toReal n]\n rw [this, \u2190 coe_zero, tendsto_coe]\n exact _root_.tendsto_const_div_atTop_nhds_zero_nat C.toReal\n```\n\n-- snippet 7\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_one_div_add_atTop_nhds_zero_nat (L70-L75)\ntheorem tendsto_one_div_add_atTop_nhds_zero_nat {\ud835\udd5c : Type*} [DivisionSemiring \ud835\udd5c] [CharZero \ud835\udd5c]\n [TopologicalSpace \ud835\udd5c] [ContinuousSMul \u211a\u22650 \ud835\udd5c] :\n Tendsto (fun n : \u2115 \u21a6 1 / ((n : \ud835\udd5c) + 1)) atTop (\ud835\udcdd 0) :=\nsuffices Tendsto (fun n : \u2115 \u21a6 1 / (\u2191(n + 1) : \ud835\udd5c)) atTop (\ud835\udcdd 0) by simpa\n (tendsto_add_atTop_iff_nat 1).2 tendsto_one_div_atTop_nhds_zero_nat\n```\n\n-- snippet 8\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_algebraMap_inv_atTop_nhds_zero_nat (L76-L84)\ntheorem tendsto_algebraMap_inv_atTop_nhds_zero_nat {\ud835\udd5c : Type*} (A : Type*)\n [Semifield \ud835\udd5c] [CharZero \ud835\udd5c] [TopologicalSpace \ud835\udd5c] [ContinuousSMul \u211a\u22650 \ud835\udd5c]\n [Semiring A] [Algebra \ud835\udd5c A] [TopologicalSpace A] [ContinuousSMul \ud835\udd5c A] :\n Tendsto (algebraMap \ud835\udd5c A \u2218 fun n : \u2115 \u21a6 (n : \ud835\udd5c)\u207b\u00b9) atTop (\ud835\udcdd 0) := by\nconvert (continuous_algebraMap \ud835\udd5c A).continuousAt.tendsto.comp tendsto_inv_atTop_nhds_zero_nat\n rw [map_zero]\n\n/-- The limit of `n / (n + x)` is 1, for any constant `x` (valid in `\u211d` or any topological division\nalgebra over `\u211a\u22650`, e.g., `\u2102`). -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_natCast_div_add_atTop (L85-L97)\ntheorem tendsto_natCast_div_add_atTop {\ud835\udd5c : Type*} [DivisionSemiring \ud835\udd5c] [TopologicalSpace \ud835\udd5c]\n [CharZero \ud835\udd5c] [ContinuousSMul \u211a\u22650 \ud835\udd5c] [IsTopologicalSemiring \ud835\udd5c] [ContinuousInv\u2080 \ud835\udd5c] (x : \ud835\udd5c) :\n Tendsto (fun n : \u2115 \u21a6 (n : \ud835\udd5c) / (n + x)) atTop (\ud835\udcdd 1) := by\nconvert Tendsto.congr' ((eventually_ne_atTop 0).mp (Eventually.of_forall fun n hn \u21a6 _)) _\n \u00b7 exact fun n : \u2115 \u21a6 1 / (1 + x / n)\n \u00b7 simp [Nat.cast_ne_zero.mpr hn, add_div']\n \u00b7 have : \ud835\udcdd (1 : \ud835\udd5c) = \ud835\udcdd (1 / (1 + x * (0 : \ud835\udd5c))) := by\n rw [mul_zero, add_zero, div_one]\n rw [this]\n refine tendsto_const_nhds.div (tendsto_const_nhds.add ?_) (by simp)\n simp_rw [div_eq_mul_inv]\n exact tendsto_const_nhds.mul tendsto_inv_atTop_nhds_zero_nat\n```\n\n-- snippet 10\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_add_mul_div_add_mul_atTop_nhds (L98-L114)\ntheorem tendsto_add_mul_div_add_mul_atTop_nhds {\ud835\udd5c : Type*} [Semifield \ud835\udd5c] [CharZero \ud835\udd5c]\n [TopologicalSpace \ud835\udd5c] [ContinuousSMul \u211a\u22650 \ud835\udd5c] [IsTopologicalSemiring \ud835\udd5c] [ContinuousInv\u2080 \ud835\udd5c]\n (a b c : \ud835\udd5c) {d : \ud835\udd5c} (hd : d \u2260 0) :\n Tendsto (fun k : \u2115 \u21a6 (a + c * k) / (b + d * k)) atTop (\ud835\udcdd (c / d)) := by\napply Filter.Tendsto.congr'\n case f\u2081 => exact fun k \u21a6 (a * (\u2191k)\u207b\u00b9 + c) / (b * (\u2191k)\u207b\u00b9 + d)\n \u00b7 refine (eventually_ne_atTop 0).mp (Eventually.of_forall ?_)\n intro h hx\n dsimp\n field (discharger := norm_cast)\n \u00b7 apply Filter.Tendsto.div _ _ hd\n all_goals\n apply zero_add (_ : \ud835\udd5c) \u25b8 Filter.Tendsto.add_const _ _\n apply mul_zero (_ : \ud835\udd5c) \u25b8 Filter.Tendsto.const_mul _ _\n exact tendsto_inv_atTop_nhds_zero_nat\n\n/-- For any positive `m : \u2115`, `((n % m : \u2115) : \u211d) / (n : \u211d)` tends to `0` as `n` tends to `\u221e`. -/\n```\n\n-- snippet 11\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_mod_div_atTop_nhds_zero_nat (L115-L121)\ntheorem tendsto_mod_div_atTop_nhds_zero_nat {m : \u2115} (hm : 0 < m) :\n Tendsto (fun n : \u2115 => ((n % m : \u2115) : \u211d) / (n : \u211d)) atTop (\ud835\udcdd 0) := by\nhave h0 : \u2200\u1da0 n : \u2115 in atTop, 0 \u2264 (fun n : \u2115 => ((n % m : \u2115) : \u211d)) n := by aesop\n exact tendsto_bdd_div_atTop_nhds_zero h0\n (.of_forall (fun n \u21a6 cast_le.mpr (mod_lt n hm).le)) tendsto_natCast_atTop_atTop\n\n/-- If `a \u2260 0`, `(a * x + c)\u207b\u00b9` tends to `0` as `x` tends to `\u221e`. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_mul_add_inv_atTop_nhds_zero (L122-L129)\ntheorem tendsto_mul_add_inv_atTop_nhds_zero (a c : \u211d) (ha : a \u2260 0) :\n Tendsto (fun x => (a * x + c)\u207b\u00b9) atTop (\ud835\udcdd 0) := by\nobtain ha' | ha' := lt_or_gt_of_ne ha\n \u00b7 exact tendsto_inv_atBot_zero.comp\n (tendsto_atBot_add_const_right _ c (tendsto_id.const_mul_atTop_of_neg ha'))\n \u00b7 exact tendsto_inv_atTop_zero.comp\n (tendsto_atTop_add_const_right _ c (tendsto_id.const_mul_atTop ha'))\n```\n\n-- snippet 13\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.Filter (L130-L135)\ntheorem Filter.EventuallyEq.div_mul_cancel {\u03b1 G : Type*} [GroupWithZero G] {f g : \u03b1 \u2192 G}\n {l : Filter \u03b1} (hg : Tendsto g l (\ud835\udcdf {0}\u1d9c)) : (fun x \u21a6 f x / g x * g x) =\u1da0[l] fun x \u21a6 f x := by\nfilter_upwards [hg.le_comap <| preimage_mem_comap (m := g) (mem_principal_self {0}\u1d9c)] with x hx\n simp_all\n\n/-- If `g` tends to `\u221e`, then eventually for all `x` we have `(f x / g x) * g x = f x`. -/\n```\n\n-- snippet 14\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.Filter (L136-L144)\ntheorem Filter.EventuallyEq.div_mul_cancel_atTop {\u03b1 K : Type*}\n [DivisionSemiring K] [LinearOrder K] [IsStrictOrderedRing K]\n {f g : \u03b1 \u2192 K} {l : Filter \u03b1} (hg : Tendsto g l atTop) :\n (fun x \u21a6 f x / g x * g x) =\u1da0[l] fun x \u21a6 f x :=\ndiv_mul_cancel <| hg.mono_right <| le_principal_iff.mpr <|\n mem_of_superset (Ioi_mem_atTop 0) <| by simp\n\n/-- If when `x` tends to `\u221e`, `g` tends to `\u221e` and `f x / g x` tends to a positive\n constant, then `f` tends to `\u221e`. -/\n```\n\n-- snippet 15\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.Filter (L145-L153)\ntheorem Filter.Tendsto.num {\u03b1 K : Type*} [Field K] [LinearOrder K] [IsStrictOrderedRing K]\n [TopologicalSpace K] [OrderTopology K]\n {f g : \u03b1 \u2192 K} {l : Filter \u03b1} (hg : Tendsto g l atTop) {a : K} (ha : 0 < a)\n (hlim : Tendsto (fun x => f x / g x) l (\ud835\udcdd a)) :\n Tendsto f l atTop :=\n(hlim.pos_mul_atTop ha hg).congr' (EventuallyEq.div_mul_cancel_atTop hg)\n\n/-- If when `x` tends to `\u221e`, `g` tends to `\u221e` and `f x / g x` tends to a positive\n constant, then `f` tends to `\u221e`. -/\n```\n\n-- snippet 16\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.Filter (L154-L165)\ntheorem Filter.Tendsto.den {\u03b1 K : Type*} [Field K] [LinearOrder K] [IsStrictOrderedRing K]\n [TopologicalSpace K] [OrderTopology K]\n [ContinuousInv K] {f g : \u03b1 \u2192 K} {l : Filter \u03b1} (hf : Tendsto f l atTop) {a : K} (ha : 0 < a)\n (hlim : Tendsto (fun x => f x / g x) l (\ud835\udcdd a)) :\n Tendsto g l atTop :=\nhave hlim' : Tendsto (fun x => g x / f x) l (\ud835\udcdd a\u207b\u00b9) := by\n simp_rw [\u2190 inv_div (f _)]\n exact Filter.Tendsto.inv (f := fun x => f x / g x) hlim\n (hlim'.pos_mul_atTop (inv_pos_of_pos ha) hf).congr' (.div_mul_cancel_atTop hf)\n\n/-- If when `x` tends to `\u221e`, `f x / g x` tends to a positive constant, then `f` tends to `\u221e` if\n and only if `g` tends to `\u221e`. -/\n```\n\n-- snippet 17\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.Filter (L166-L175)\ntheorem Filter.Tendsto.num_atTop_iff_den_atTop {\u03b1 K : Type*}\n [Field K] [LinearOrder K] [IsStrictOrderedRing K] [TopologicalSpace K]\n [OrderTopology K] [ContinuousInv K] {f g : \u03b1 \u2192 K} {l : Filter \u03b1} {a : K} (ha : 0 < a)\n (hlim : Tendsto (fun x => f x / g x) l (\ud835\udcdd a)) :\n Tendsto f l atTop \u2194 Tendsto g l atTop :=\n\u27e8fun hf \u21a6 hf.den ha hlim, fun hg \u21a6 hg.num ha hlim\u27e9\n\n/-! ### Powers -/\n```\n\n-- snippet 18\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_add_one_pow_atTop_atTop_of_pos (L176-L181)\ntheorem tendsto_add_one_pow_atTop_atTop_of_pos\n [Semiring \u03b1] [LinearOrder \u03b1] [IsStrictOrderedRing \u03b1] [Archimedean \u03b1] {r : \u03b1}\n (h : 0 < r) : Tendsto (fun n : \u2115 \u21a6 (r + 1) ^ n) atTop atTop :=\ntendsto_atTop_atTop_of_monotone' (pow_right_mono\u2080 <| le_add_of_nonneg_left h.le) <|\n not_bddAbove_iff.2 fun _ \u21a6 Set.exists_range_iff.2 <| add_one_pow_unbounded_of_pos _ h\n```\n\n-- snippet 19\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_pow_atTop_atTop_of_one_lt (L182-L188)\ntheorem tendsto_pow_atTop_atTop_of_one_lt\n [Semiring \u03b1] [LinearOrder \u03b1] [IsStrictOrderedRing \u03b1] [ExistsAddOfLE \u03b1] [Archimedean \u03b1] {r : \u03b1}\n (h : 1 < r) : Tendsto (fun n : \u2115 \u21a6 r ^ n) atTop atTop := by\nobtain \u27e8r, r0, rfl\u27e9 := exists_pos_add_of_lt' h\n rw [add_comm]\n exact tendsto_add_one_pow_atTop_atTop_of_pos r0\n```\n\n-- snippet 20\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_pow_atTop_nhds_zero_of_lt_one (L189-L199)\ntheorem tendsto_pow_atTop_nhds_zero_of_lt_one {\ud835\udd5c : Type*}\n [Semifield \ud835\udd5c] [LinearOrder \ud835\udd5c] [IsStrictOrderedRing \ud835\udd5c] [ExistsAddOfLE \ud835\udd5c] [Archimedean \ud835\udd5c]\n [TopologicalSpace \ud835\udd5c] [OrderTopology \ud835\udd5c] {r : \ud835\udd5c} (h\u2081 : 0 \u2264 r) (h\u2082 : r < 1) :\n Tendsto (fun n : \u2115 \u21a6 r ^ n) atTop (\ud835\udcdd 0) :=\nh\u2081.eq_or_lt.elim\n (fun hr \u21a6 (tendsto_add_atTop_iff_nat 1).mp <| by\n simp [_root_.pow_succ, \u2190 hr])\n (fun hr \u21a6\n have := (one_lt_inv\u2080 hr).2 h\u2082 |> tendsto_pow_atTop_atTop_of_one_lt\n (tendsto_inv_atTop_zero.comp this).congr fun n \u21a6 by simp)\n```\n\n-- snippet 21\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.tendsto_pow_atTop_nhdsWithin_zero_of_lt_one (L218-L225)\ntheorem tendsto_pow_atTop_nhdsWithin_zero_of_lt_one {\ud835\udd5c : Type*}\n [Semifield \ud835\udd5c] [LinearOrder \ud835\udd5c] [IsStrictOrderedRing \ud835\udd5c] [ExistsAddOfLE \ud835\udd5c]\n [Archimedean \ud835\udd5c] [TopologicalSpace \ud835\udd5c] [OrderTopology \ud835\udd5c] {r : \ud835\udd5c} (h\u2081 : 0 < r) (h\u2082 : r < 1) :\n Tendsto (fun n : \u2115 \u21a6 r ^ n) atTop (\ud835\udcdd[>] 0) :=\ntendsto_inf.2\n \u27e8tendsto_pow_atTop_nhds_zero_of_lt_one h\u2081.le h\u2082,\n tendsto_principal.2 <| Eventually.of_forall fun _ \u21a6 pow_pos h\u2081 _\u27e9\n```\n\n-- snippet 22\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.uniformity_basis_dist_pow_of_lt_one (L226-L231)\ntheorem uniformity_basis_dist_pow_of_lt_one {\u03b1 : Type*} [PseudoMetricSpace \u03b1] {r : \u211d} (h\u2080 : 0 < r)\n (h\u2081 : r < 1) :\n (uniformity \u03b1).HasBasis (fun _ : \u2115 \u21a6 True) fun k \u21a6 { p : \u03b1 \u00d7 \u03b1 | dist p.1 p.2 < r ^ k } :=\nMetric.mk_uniformity_basis (fun _ _ \u21a6 pow_pos h\u2080 _) fun _ \u03b50 \u21a6\n (exists_pow_lt_of_lt_one \u03b50 h\u2081).imp fun _ hk \u21a6 \u27e8trivial, hk.le\u27e9\n```\n\n-- snippet 23\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.geom_lt (L232-L237)\ntheorem geom_lt {u : \u2115 \u2192 \u211d} {c : \u211d} (hc : 0 \u2264 c) {n : \u2115} (hn : 0 < n)\n (h : \u2200 k < n, c * u k < u (k + 1)) : c ^ n * u 0 < u n := by\napply (monotone_mul_left_of_nonneg hc).seq_pos_lt_seq_of_le_of_lt hn _ _ h\n \u00b7 simp\n \u00b7 simp [_root_.pow_succ', mul_assoc]\n```\n\n-- snippet 24\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.geom_le (L238-L242)\ntheorem geom_le {u : \u2115 \u2192 \u211d} {c : \u211d} (hc : 0 \u2264 c) (n : \u2115) (h : \u2200 k < n, c * u k \u2264 u (k + 1)) :\n c ^ n * u 0 \u2264 u n := by\napply (monotone_mul_left_of_nonneg hc).seq_le_seq n _ _ h <;>\n simp [_root_.pow_succ', mul_assoc]\n```\n\n-- snippet 25\n```lean\n-- Mathlib.Analysis.SpecificLimits.Basic.le_geom (L249-L255)\ntheorem le_geom {u : \u2115 \u2192 \u211d} {c : \u211d} (hc : 0 \u2264 c) (n : \u2115) (h : \u2200 k < n, u (k + 1) \u2264 c * u k) :\n u n \u2264 c ^ n * u 0 := by\napply (monotone_mul_left_of_nonneg hc).seq_le_seq n _ h _ <;>\n simp [_root_.pow_succ', mul_assoc]\n\n/-- If a sequence `v` of real numbers satisfies `k * v n \u2264 v (n+1)` with `1 < k`,\nthen it goes to +\u221e. -/\n```\n\n-- snippet 26\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.summable_pow_mul_geometric_of_norm_lt_one (L486-L514)\ntheorem summable_pow_mul_geometric_of_norm_lt_one (k : \u2115) {r : R} (hr : \u2016r\u2016 < 1) :\n Summable (fun n \u21a6 (n : R) ^ k * r ^ n : \u2115 \u2192 R) := by\nrefine Nat.strong_induction_on k fun k hk => ?_\n obtain \u27e8a, ha\u27e9 : \u2203 (a : \u2115 \u2192 \u2115), \u2200 n, (n + k).descFactorial k\n = n ^ k + \u2211 i \u2208 range k, a i * n ^ i := by\n let P : Polynomial \u2115 := (ascPochhammer \u2115 k).comp (Polynomial.X + C 1)\n refine \u27e8fun i \u21a6 P.coeff i, fun n \u21a6 ?_\u27e9\n have mP : Monic P := Monic.comp_X_add_C (monic_ascPochhammer \u2115 k) _\n have dP : P.natDegree = k := by\n simp only [P, natDegree_comp, ascPochhammer_natDegree, mul_one, natDegree_X_add_C]\n have A : (n + k).descFactorial k = P.eval n := by\n have : n + 1 + k - 1 = n + k := by lia\n simp [P, ascPochhammer_nat_eq_descFactorial, this]\n conv_lhs => rw [A, mP.as_sum, dP]\n simp [eval_finset_sum]\n have : Summable (fun n \u21a6 (n + k).descFactorial k * r ^ n\n - \u2211 i \u2208 range k, a i * n ^ (i : \u2115) * r ^ n) := by\n apply (summable_descFactorial_mul_geometric_of_norm_lt_one k hr).sub\n apply summable_sum (fun i hi \u21a6 ?_)\n simp_rw [mul_assoc]\n simp only [Finset.mem_range] at hi\n exact (hk _ hi).mul_left _\n convert this using 1\n ext n\n simp [ha n, add_mul, sum_mul]\n\n/-- If `\u2016r\u2016 < 1`, then `\u2211' n : \u2115, n * r ^ n = r / (1 - r) ^ 2`, `HasSum` version in a general ring\nwith summable geometric series. For a version in a field, using division instead of `Ring.inverse`,\nsee `hasSum_coe_mul_geometric_of_norm_lt_one`. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_same_eq_mul_div' (L83-L87)\nlemma arithGeom_same_eq_mul_div' (ha : a \u2260 1) (n : \u2115) :\n arithGeom a b b n = b * (1 - a ^ (n + 1)) / (1 - a) := by\nrw [arithGeom_eq ha n]\n field [sub_ne_zero.mpr ha.symm]\n```\n\n-- snippet 28\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.AbsoluteValue (L248-L259)\ntheorem AbsoluteValue.tendsto_div_one_add_pow_nhds_one {v : AbsoluteValue R S} {a : R}\n (ha : v a < 1) : atTop.Tendsto (fun (n : \u2115) \u21a6 v (1 / (1 + a ^ n))) (\ud835\udcdd 1) := by\nsimp_rw [map_div\u2080 v, v.map_one]\n apply one_div_one (G := S) \u25b8 Tendsto.div tendsto_const_nhds _ one_ne_zero\n have h_add := (tendsto_pow_atTop_nhds_zero_of_lt_one (v.nonneg _) ha).const_add 1\n have h_sub := (tendsto_pow_atTop_nhds_zero_of_lt_one (v.nonneg _) ha).const_sub 1\n exact tendsto_of_tendsto_of_tendsto_of_le_of_le (by simpa using h_sub) (by simpa using h_add)\n (fun n \u21a6 le_trans (by simp) (v.le_add _ _))\n (fun n \u21a6 le_trans (v.add_le _ _) (by simp))\n\n/-- `v (1 / (1 + a ^n))` tends to `0` whenever `v : AbsoluteValue R S` for fields `R` and `S`,\nprovided `1 < v a`. -/\n```\n\n-- snippet 29\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_natCast_atTop_cobounded (L38-L44)\ntheorem tendsto_natCast_atTop_cobounded\n [NormedRing \u03b1] [NormSMulClass \u2124 \u03b1] [Nontrivial \u03b1] :\n Tendsto Nat.cast atTop (Bornology.cobounded \u03b1) := by\nrw [\u2190 tendsto_norm_atTop_iff_cobounded]\n simpa [norm_natCast_eq_mul_norm_one] using tendsto_natCast_atTop_atTop\n |>.atTop_mul_const (norm_pos_iff.mpr one_ne_zero)\n```\n\n-- snippet 30\n```lean\n-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.tendsto_arithGeom_nhds_of_lt_one (L129-L136)\nlemma tendsto_arithGeom_nhds_of_lt_one [Archimedean R] [TopologicalSpace R] [OrderTopology R]\n (ha_pos : 0 \u2264 a) (ha : a < 1) :\n Tendsto (arithGeom a b u\u2080) atTop (\ud835\udcdd (b / (1 - a))) := by\nrw [arithGeom_eq' ha.ne]\n conv_rhs => rw [\u2190 zero_add (b / (1 - a))]\n refine Tendsto.add ?_ tendsto_const_nhds\n conv_rhs => rw [\u2190 zero_mul (u\u2080 - (b / (1 - a)))]\n exact (tendsto_pow_atTop_nhds_zero_of_lt_one ha_pos ha).mul_const _\n```\n\n-- snippet 31\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.geom_series_succ (L318-L321)\ntheorem geom_series_succ (x : R) (h : \u2016x\u2016 < 1) : \u2211' i : \u2115, x ^ (i + 1) = \u2211' i : \u2115, x ^ i - 1 := by\nrw [eq_sub_iff_add_eq, (summable_geometric_of_norm_lt_one h).tsum_eq_zero_add,\n pow_zero, add_comm]\n```\n\n-- snippet 32\n```lean\n-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_same_eq_mul_div (L88-L92)\nlemma arithGeom_same_eq_mul_div (ha : a \u2260 1) (n : \u2115) :\n arithGeom a b b n = b * (a ^ (n + 1) - 1) / (a - 1) := by\nrw [arithGeom_same_eq_mul_div' ha n, \u2190 neg_sub _ a, div_neg,\n \u2190 neg_sub _ (a ^ (n + 1)), mul_neg, neg_div, neg_neg]\n```\n\n-- snippet 33\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_pow_const_mul_const_pow_of_abs_lt_one (L187-L196)\ntheorem tendsto_pow_const_mul_const_pow_of_abs_lt_one (k : \u2115) {r : \u211d} (hr : |r| < 1) :\n Tendsto (fun n \u21a6 (n : \u211d) ^ k * r ^ n : \u2115 \u2192 \u211d) atTop (\ud835\udcdd 0) := by\nby_cases h0 : r = 0\n \u00b7 exact tendsto_const_nhds.congr'\n (mem_atTop_sets.2 \u27e81, fun n hn \u21a6 by simp [zero_lt_one.trans_le hn |>.ne', h0]\u27e9)\n have hr' : 1 < |r|\u207b\u00b9 := (one_lt_inv\u2080 (abs_pos.2 h0)).2 hr\n rw [tendsto_zero_iff_norm_tendsto_zero]\n simpa [div_eq_mul_inv] using tendsto_pow_const_div_const_pow_of_one_lt k hr'\n\n/-- For `k \u2260 0` and a constant `r` the function `r / n ^ k` tends to zero. -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.dist_partial_sum_le_of_le_geometric (L559-L565)\ntheorem dist_partial_sum_le_of_le_geometric (hf : \u2200 n, \u2016f n\u2016 \u2264 C * r ^ n) (n : \u2115) :\n dist (\u2211 i \u2208 range n, f i) (\u2211 i \u2208 range (n + 1), f i) \u2264 C * r ^ n := by\nrw [sum_range_succ, dist_eq_norm, \u2190 norm_neg, neg_sub, add_sub_cancel_left]\n exact hf n\n\n/-- If `\u2016f n\u2016 \u2264 C * r ^ n` for all `n : \u2115` and some `r < 1`, then the partial sums of `f` form a\nCauchy sequence. This lemma does not assume `0 \u2264 r` or `0 \u2264 C`. -/\n```\n\n-- snippet 35\n```lean\n-- Mathlib.Analysis.SpecificLimits.FloorPow.mul_pow_le_nat_floor_pow (L259-L271)\ntheorem mul_pow_le_nat_floor_pow {c : \u211d} (hc : 1 < c) (i : \u2115) : (1 - c\u207b\u00b9) * c ^ i \u2264 \u230ac ^ i\u230b\u208a := by\nhave cpos : 0 < c := zero_lt_one.trans hc\n rcases eq_or_ne i 0 with (rfl | hi)\n \u00b7 simp only [pow_zero, Nat.floor_one, Nat.cast_one, mul_one, sub_le_self_iff, inv_nonneg, cpos.le]\n calc\n (1 - c\u207b\u00b9) * c ^ i = c ^ i - c ^ i * c\u207b\u00b9 := by ring\n _ \u2264 c ^ i - 1 := by\n gcongr\n simpa only [\u2190 div_eq_mul_inv, one_le_div cpos, pow_one] using le_self_pow\u2080 hc.le hi\n _ \u2264 \u230ac ^ i\u230b\u208a := (Nat.sub_one_lt_floor _).le\n\n/-- The sum of `1/\u230ac^i\u230b\u208a^2` above a threshold `j` is comparable to `1/j^2`, up to a multiplicative\nconstant. -/\n```\n\n-- snippet 36\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.NormedAddCommGroup (L594-L597)\ntheorem NormedAddCommGroup.cauchy_series_of_le_geometric' {C : \u211d} {u : \u2115 \u2192 \u03b1} {r : \u211d} (hr : r < 1)\n (h : \u2200 n, \u2016u n\u2016 \u2264 C * r ^ n) : CauchySeq fun n \u21a6 \u2211 k \u2208 range (n + 1), u k :=\n(cauchy_series_of_le_geometric hr h).comp_tendsto <| tendsto_add_atTop_nat 1\n```\n\n-- snippet 37\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.summable_geometric_of_norm_lt_one (L275-L278)\nlemma summable_geometric_of_norm_lt_one {K : Type*} [NormedRing K] [HasSummableGeomSeries K]\n {x : K} (h : \u2016x\u2016 < 1) : Summable (fun n \u21a6 x ^ n) :=\nHasSummableGeomSeries.summable_geometric_of_norm_lt_one x h\n```\n\n-- snippet 38\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_self_mul_const_pow_of_abs_lt_one (L210-L215)\ntheorem tendsto_self_mul_const_pow_of_abs_lt_one {r : \u211d} (hr : |r| < 1) :\n Tendsto (fun n \u21a6 n * r ^ n : \u2115 \u2192 \u211d) atTop (\ud835\udcdd 0) := by\nsimpa only [pow_one] using tendsto_pow_const_mul_const_pow_of_abs_lt_one 1 hr\n\n/-- If `0 \u2264 r < 1`, then `n * r ^ n` tends to zero. This is a specialized version of\n`tendsto_self_mul_const_pow_of_abs_lt_one`, singled out for ease of application. -/\n```\n\n-- snippet 39\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tsum_choose_mul_geometric_of_norm_lt_one (L475-L478)\nlemma tsum_choose_mul_geometric_of_norm_lt_one (k : \u2115) {r : \ud835\udd5c} (hr : \u2016r\u2016 < 1) :\n \u2211' n, (n + k).choose k * r ^ n = 1 / (1 - r) ^ (k + 1) :=\n(hasSum_choose_mul_geometric_of_norm_lt_one k hr).tsum_eq\n```\n\n-- snippet 40\n```lean\n-- Mathlib.Analysis.SpecificLimits.FloorPow.tendsto_div_of_monotone_of_exists_subseq_tendsto_div (L31-L181)\ntheorem tendsto_div_of_monotone_of_exists_subseq_tendsto_div (u : \u2115 \u2192 \u211d) (l : \u211d)\n (hmono : Monotone u)\n (hlim : \u2200 a : \u211d, 1 < a \u2192 \u2203 c : \u2115 \u2192 \u2115, (\u2200\u1da0 n in atTop, (c (n + 1) : \u211d) \u2264 a * c n) \u2227\n Tendsto c atTop atTop \u2227 Tendsto (fun n => u (c n) / c n) atTop (\ud835\udcdd l)) :\n Tendsto (fun n => u n / n) atTop (\ud835\udcdd l) := by\n/- To check the result up to some `\u03b5 > 0`, we use a sequence `c` for which the ratio\n `c (N+1) / c N` is bounded by `1 + \u03b5`. Sandwiching a given `n` between two consecutive values of\n `c`, say `c N` and `c (N+1)`, one can then bound `u n / n` from above by `u (c N) / c (N - 1)`\n and from below by `u (c (N - 1)) / c N` (using that `u` is monotone), which are both comparable\n to the limit `l` up to `1 + \u03b5`.\n We give a version of this proof by clearing out denominators first, to avoid discussing the sign\n of different quantities. -/\n have lnonneg : 0 \u2264 l := by\n rcases hlim 2 one_lt_two with \u27e8c, _, ctop, clim\u27e9\n have : Tendsto (fun n => u 0 / c n) atTop (\ud835\udcdd 0) :=\n tendsto_const_nhds.div_atTop (tendsto_natCast_atTop_iff.2 ctop)\n apply le_of_tendsto_of_tendsto' this clim fun n => ?_\n gcongr\n exact hmono (zero_le _)\n have A : \u2200 \u03b5 : \u211d, 0 < \u03b5 \u2192 \u2200\u1da0 n in atTop, u n - n * l \u2264 \u03b5 * (1 + \u03b5 + l) * n := by\n intro \u03b5 \u03b5pos\n rcases hlim (1 + \u03b5) ((lt_add_iff_pos_right _).2 \u03b5pos) with \u27e8c, cgrowth, ctop, clim\u27e9\n have L : \u2200\u1da0 n in atTop, u (c n) - c n * l \u2264 \u03b5 * c n := by\n rw [\u2190 tendsto_sub_nhds_zero_iff, \u2190 Asymptotics.isLittleO_one_iff \u211d,\n Asymptotics.isLittleO_iff] at clim\n filter_upwards [clim \u03b5pos, ctop (Ioi_mem_atTop 0)] with n hn cnpos'\n have cnpos : 0 < c n := cnpos'\n calc\n u (c n) - c n * l = (u (c n) / c n - l) * c n := by field\n _ \u2264 \u03b5 * c n := by\n gcongr\n refine (le_abs_self _).trans ?_\n simpa using hn\n obtain \u27e8a, ha\u27e9 :\n \u2203 a : \u2115, \u2200 b : \u2115, a \u2264 b \u2192 (c (b + 1) : \u211d) \u2264 (1 + \u03b5) * c b \u2227 u (c b) - c b * l \u2264 \u03b5 * c b :=\n eventually_atTop.1 (cgrowth.and L)\n let M := ((Finset.range (a + 1)).image fun i => c i).max' (by simp)\n filter_upwards [Ici_mem_atTop M] with n hn\n have exN : \u2203 N, n < c N := by\n rcases (tendsto_atTop.1 ctop (n + 1)).exists with \u27e8N, hN\u27e9\n exact \u27e8N, by lia\u27e9\n let N := Nat.find exN\n have ncN : n < c N := Nat.find_spec exN\n have aN : a + 1 \u2264 N := by\n by_contra! h\n have cNM : c N \u2264 M := by\n apply le_max'\n apply mem_image_of_mem\n exact mem_range.2 h\n exact lt_irrefl _ ((cNM.trans hn).trans_lt ncN)\n have Npos : 0 < N := lt_of_lt_of_le Nat.succ_pos' aN\n have cNn : c (N - 1) \u2264 n := by\n have : N - 1 < N := Nat.pred_lt Npos.ne'\n simpa only [not_lt] using Nat.find_min exN this\n have IcN : (c N : \u211d) \u2264 (1 + \u03b5) * c (N - 1) := by\n have A : a \u2264 N - 1 := (Nat.le_sub_one_iff_lt Npos).mpr aN\n have B : N - 1 + 1 = N := Nat.succ_pred_eq_of_pos Npos\n have := (ha _ A).1\n rwa [B] at this\n calc\n u n - n * l \u2264 u (c N) - c (N - 1) * l := by gcongr; exact hmono ncN.le\n _ = u (c N) - c N * l + (c N - c (N - 1)) * l := by ring\n _ \u2264 \u03b5 * c N + \u03b5 * c (N - 1) * l := by\n gcongr\n \u00b7 exact (ha N (a.le_succ.trans aN)).2\n \u00b7 linarith only [IcN]\n _ \u2264 \u03b5 * ((1 + \u03b5) * c (N - 1)) + \u03b5 * c (N - 1) * l := by gcongr\n _ = \u03b5 * (1 + \u03b5 + l) * c (N - 1) := by ring\n _ \u2264 \u03b5 * (1 + \u03b5 + l) * n := by gcongr\n have B : \u2200 \u03b5 : \u211d, 0 < \u03b5 \u2192 \u2200\u1da0 n : \u2115 in atTop, (n : \u211d) * l - u n \u2264 \u03b5 * (1 + l) * n := by\n intro \u03b5 \u03b5pos\n rcases hlim (1 + \u03b5) ((lt_add_iff_pos_right _).2 \u03b5pos) with \u27e8c, cgrowth, ctop, clim\u27e9\n have L : \u2200\u1da0 n : \u2115 in atTop, (c n : \u211d) * l - u (c n) \u2264 \u03b5 * c n := by\n rw [\u2190 tendsto_sub_nhds_zero_iff, \u2190 Asymptotics.isLittleO_one_iff \u211d,\n Asymptotics.isLittleO_iff] at clim\n filter_upwards [clim \u03b5pos, ctop (Ioi_mem_atTop 0)] with n hn cnpos'\n have cnpos : 0 < c n := cnpos'\n calc\n (c n : \u211d) * l - u (c n) = -(u (c n) / c n - l) * c n := by field\n _ \u2264 \u03b5 * c n := by\n gcongr\n refine le_trans (neg_le_abs _) ?_\n simpa using hn\n obtain \u27e8a, ha\u27e9 :\n \u2203 a : \u2115,\n \u2200 b : \u2115, a \u2264 b \u2192 (c (b + 1) : \u211d) \u2264 (1 + \u03b5) * c b \u2227 (c b : \u211d) * l - u (c b) \u2264 \u03b5 * c b :=\n eventually_atTop.1 (cgrowth.and L)\n let M := ((Finset.range (a + 1)).image fun i => c i).max' (by simp)\n filter_upwards [Ici_mem_atTop M] with n hn\n have exN : \u2203 N, n < c N := by\n rcases (tendsto_atTop.1 ctop (n + 1)).exists with \u27e8N, hN\u27e9\n exact \u27e8N, by lia\u27e9\n let N := Nat.find exN\n have ncN : n < c N := Nat.find_spec exN\n have aN : a + 1 \u2264 N := by\n by_contra! h\n have cNM : c N \u2264 M := by\n apply le_max'\n apply mem_image_of_mem\n exact mem_range.2 h\n exact lt_irrefl _ ((cNM.trans hn).trans_lt ncN)\n have Npos : 0 < N := lt_of_lt_of_le Nat.succ_pos' aN\n have aN' : a \u2264 N - 1 := (Nat.le_sub_one_iff_lt Npos).mpr aN\n have cNn : c (N - 1) \u2264 n := by\n have : N - 1 < N := Nat.pred_lt Npos.ne'\n simpa only [not_lt] using Nat.find_min exN this\n calc\n (n : \u211d) * l - u n \u2264 c N * l - u (c (N - 1)) := by\n gcongr\n exact hmono cNn\n _ \u2264 (1 + \u03b5) * c (N - 1) * l - u (c (N - 1)) := by\n gcongr\n have B : N - 1 + 1 = N := Nat.succ_pred_eq_of_pos Npos\n simpa [B] using (ha _ aN').1\n _ = c (N - 1) * l - u (c (N - 1)) + \u03b5 * c (N - 1) * l := by ring\n _ \u2264 \u03b5 * c (N - 1) + \u03b5 * c (N - 1) * l := add_le_add (ha _ aN').2 le_rfl\n _ = \u03b5 * (1 + l) * c (N - 1) := by ring\n _ \u2264 \u03b5 * (1 + l) * n := by gcongr\n refine tendsto_order.2 \u27e8fun d hd => ?_, fun d hd => ?_\u27e9\n \u00b7 obtain \u27e8\u03b5, h\u03b5, \u03b5pos\u27e9 : \u2203 \u03b5 : \u211d, d + \u03b5 * (1 + l) < l \u2227 0 < \u03b5 := by\n have L : Tendsto (fun \u03b5 => d + \u03b5 * (1 + l)) (\ud835\udcdd[>] 0) (\ud835\udcdd (d + 0 * (1 + l))) := by\n apply Tendsto.mono_left _ nhdsWithin_le_nhds\n exact tendsto_const_nhds.add (tendsto_id.mul tendsto_const_nhds)\n simp only [zero_mul, add_zero] at L\n exact (((tendsto_order.1 L).2 l hd).and self_mem_nhdsWithin).exists\n filter_upwards [B \u03b5 \u03b5pos, Ioi_mem_atTop 0] with n hn npos\n simp_rw [div_eq_inv_mul]\n calc\n d < (n : \u211d)\u207b\u00b9 * n * (l - \u03b5 * (1 + l)) := by\n rw [inv_mul_cancel\u2080, one_mul]\n \u00b7 linarith only [h\u03b5]\n \u00b7 exact Nat.cast_ne_zero.2 (ne_of_gt npos)\n _ = (n : \u211d)\u207b\u00b9 * (n * l - \u03b5 * (1 + l) * n) := by ring\n _ \u2264 (n : \u211d)\u207b\u00b9 * u n := by gcongr; linarith only [hn]\n \u00b7 obtain \u27e8\u03b5, h\u03b5, \u03b5pos\u27e9 : \u2203 \u03b5 : \u211d, l + \u03b5 * (1 + \u03b5 + l) < d \u2227 0 < \u03b5 := by\n have L : Tendsto (fun \u03b5 => l + \u03b5 * (1 + \u03b5 + l)) (\ud835\udcdd[>] 0) (\ud835\udcdd (l + 0 * (1 + 0 + l))) := by\n apply Tendsto.mono_left _ nhdsWithin_le_nhds\n exact\n tendsto_const_nhds.add\n (tendsto_id.mul ((tendsto_const_nhds.add tendsto_id).add tendsto_const_nhds))\n simp only [zero_mul, add_zero] at L\n exact (((tendsto_order.1 L).2 d hd).and self_mem_nhdsWithin).exists\n filter_upwards [A \u03b5 \u03b5pos, Ioi_mem_atTop 0] with n hn (npos : 0 < n)\n calc\n u n / n \u2264 (n * l + \u03b5 * (1 + \u03b5 + l) * n) / n := by gcongr; linarith only [hn]\n _ = (l + \u03b5 * (1 + \u03b5 + l)) := by field\n _ < d := h\u03b5\n\n/-- If a monotone sequence `u` is such that `u \u230ac^n\u230b\u208a / \u230ac^n\u230b\u208a` converges to a limit `l` for all\n`c > 1`, then `u n / n` tends to `l`. It is even enough to have the assumption for a sequence of\n`c`s converging to `1`. -/\n```\n\n-- snippet 41\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_pow_const_mul_const_pow_of_lt_one (L205-L209)\ntheorem tendsto_pow_const_mul_const_pow_of_lt_one (k : \u2115) {r : \u211d} (hr : 0 \u2264 r) (h'r : r < 1) :\n Tendsto (fun n \u21a6 (n : \u211d) ^ k * r ^ n : \u2115 \u2192 \u211d) atTop (\ud835\udcdd 0) :=\ntendsto_pow_const_mul_const_pow_of_abs_lt_one k (abs_lt.2 \u27e8neg_one_lt_zero.trans_le hr, h'r\u27e9)\n\n/-- If `|r| < 1`, then `n * r ^ n` tends to zero. -/\n```\n\n-- snippet 42\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_const_div_pow (L197-L204)\nlemma tendsto_const_div_pow (r : \u211d) (k : \u2115) (hk : k \u2260 0) :\n Tendsto (fun n : \u2115 => r / n ^ k) atTop (\ud835\udcdd 0) := by\nsimpa using Filter.Tendsto.const_div_atTop (tendsto_natCast_atTop_atTop (R := \u211d).comp\n (tendsto_pow_atTop hk)) r\n\n/-- If `0 \u2264 r < 1`, then `n ^ k r ^ n` tends to zero for any natural `k`.\nThis is a specialized version of `tendsto_pow_const_mul_const_pow_of_abs_lt_one`, singled out\nfor ease of application. -/\n```\n\n-- snippet 43\n```lean\n-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_eq' (L78-L82)\nlemma arithGeom_eq' (ha : a \u2260 1) :\n arithGeom a b u\u2080 = fun n \u21a6 a ^ n * (u\u2080 - (b / (1 - a))) + b / (1 - a) := by\next\n exact arithGeom_eq ha _\n```\n\n-- snippet 44\n```lean\n-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_zero_eq_sum (L66-L71)\nlemma arithGeom_zero_eq_sum [CommSemiring R] (n : \u2115) :\n arithGeom a b 0 n = b * \u2211 k \u2208 Finset.range n, a ^ k := by\nsimp [arithGeom_eq_add_sum]\n\nvariable [Field R]\n```\n\n-- snippet 45\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.geom_series_mul_shift (L322-L325)\ntheorem geom_series_mul_shift (x : R) (h : \u2016x\u2016 < 1) :\n x * \u2211' i : \u2115, x ^ i = \u2211' i : \u2115, x ^ (i + 1) := by\nsimp_rw [\u2190 (summable_geometric_of_norm_lt_one h).tsum_mul_left, \u2190 _root_.pow_succ']\n```\n\n-- snippet 46\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.summable_descFactorial_mul_geometric_of_norm_lt_one (L479-L485)\nlemma summable_descFactorial_mul_geometric_of_norm_lt_one (k : \u2115) {r : R} (hr : \u2016r\u2016 < 1) :\n Summable (fun n \u21a6 (n + k).descFactorial k * r ^ n) := by\nconvert (summable_choose_mul_geometric_of_norm_lt_one k hr).mul_left (k.factorial : R)\n using 2 with n\n simp [\u2190 mul_assoc, descFactorial_eq_factorial_mul_choose (n + k) k]\n\nopen Polynomial in\n```\n\n-- snippet 47\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.summable_norm_pow_mul_geometric_of_norm_lt_one (L423-L428)\ntheorem summable_norm_pow_mul_geometric_of_norm_lt_one (k : \u2115) {r : R}\n (hr : \u2016r\u2016 < 1) : Summable fun n : \u2115 \u21a6 \u2016((n : R) ^ k * r ^ n : R)\u2016 := by\nsimp only [\u2190 cast_pow]\n exact summable_norm_mul_geometric_of_norm_lt_one (k := k) (u := fun n \u21a6 n ^ k) hr\n (isBigO_refl _ _)\n```\n\n-- snippet 48\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.isLittleO_pow_const_mul_const_pow_const_pow_of_norm_lt (L169-L181)\ntheorem isLittleO_pow_const_mul_const_pow_const_pow_of_norm_lt {R : Type*} [NormedRing R] (k : \u2115)\n {r\u2081 : R} {r\u2082 : \u211d} (h : \u2016r\u2081\u2016 < r\u2082) :\n (fun n \u21a6 (n : R) ^ k * r\u2081 ^ n : \u2115 \u2192 R) =o[atTop] fun n \u21a6 r\u2082 ^ n := by\nby_cases h0 : r\u2081 = 0\n \u00b7 refine (isLittleO_zero _ _).congr' (mem_atTop_sets.2 <| \u27e81, fun n hn \u21a6 ?_\u27e9) EventuallyEq.rfl\n simp [zero_pow (one_le_iff_ne_zero.1 hn), h0]\n rw [\u2190 Ne, \u2190 norm_pos_iff] at h0\n have A : (fun n \u21a6 (n : R) ^ k : \u2115 \u2192 R) =o[atTop] fun n \u21a6 (r\u2082 / \u2016r\u2081\u2016) ^ n :=\n isLittleO_pow_const_const_pow_of_one_lt k ((one_lt_div h0).2 h)\n suffices (fun n \u21a6 r\u2081 ^ n) =O[atTop] fun n \u21a6 \u2016r\u2081\u2016 ^ n by\n simpa [div_mul_cancel\u2080 _ (pow_pos h0 _).ne', div_pow] using A.mul_isBigO this\n exact .of_norm_eventuallyLE <| eventually_norm_pow_le r\u2081\n```\n\n-- snippet 49\n```lean\n-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_zero_eq_mul_div' (L93-L97)\nlemma arithGeom_zero_eq_mul_div' (ha : a \u2260 1) (n : \u2115) :\n arithGeom a b 0 n = b * (1 - a ^ n) / (1 - a) := by\nrw [arithGeom_eq ha n]\n ring\n```\n\n-- snippet 50\n```lean\n-- Mathlib.Analysis.SpecificLimits.FloorPow.sum_div_pow_sq_le_div_sq (L214-L258)\ntheorem sum_div_pow_sq_le_div_sq (N : \u2115) {j : \u211d} (hj : 0 < j) {c : \u211d} (hc : 1 < c) :\n (\u2211 i \u2208 range N with j < c ^ i, (1 : \u211d) / (c ^ i) ^ 2) \u2264 c ^ 3 * (c - 1)\u207b\u00b9 / j ^ 2 := by\nhave cpos : 0 < c := zero_lt_one.trans hc\n have A : (0 : \u211d) < c\u207b\u00b9 ^ 2 := sq_pos_of_pos (inv_pos.2 cpos)\n have B : c ^ 2 * ((1 : \u211d) - c\u207b\u00b9 ^ 2)\u207b\u00b9 \u2264 c ^ 3 * (c - 1)\u207b\u00b9 := by\n rw [\u2190 div_eq_mul_inv, \u2190 div_eq_mul_inv, div_le_div_iff\u2080 _ (sub_pos.2 hc)]\n swap\n \u00b7 exact sub_pos.2 (pow_lt_one\u2080 (inv_nonneg.2 cpos.le) (inv_lt_one_of_one_lt\u2080 hc) two_ne_zero)\n have : c ^ 3 = c ^ 2 * c := by ring\n simp only [mul_sub, this, mul_one, inv_pow, sub_le_sub_iff_left]\n rw [mul_assoc, mul_comm c, \u2190 mul_assoc, mul_inv_cancel\u2080 (sq_pos_of_pos cpos).ne', one_mul]\n simpa using pow_right_mono\u2080 hc.le one_le_two\n have C : c\u207b\u00b9 ^ 2 < 1 := pow_lt_one\u2080 (inv_nonneg.2 cpos.le) (inv_lt_one_of_one_lt\u2080 hc) two_ne_zero\n calc\n (\u2211 i \u2208 range N with j < c ^ i, (1 : \u211d) / (c ^ i) ^ 2) \u2264\n \u2211 i \u2208 Ico \u230aReal.log j / Real.log c\u230b\u208a N, (1 : \u211d) / (c ^ i) ^ 2 := by\n gcongr\n intro i hi\n simp only [mem_filter, mem_range] at hi\n simp only [hi.1, mem_Ico, and_true]\n apply Nat.floor_le_of_le\n apply le_of_lt\n rw [div_lt_iff\u2080 (Real.log_pos hc), \u2190 Real.log_pow]\n exact Real.log_lt_log hj hi.2\n _ = \u2211 i \u2208 Ico \u230aReal.log j / Real.log c\u230b\u208a N, (c\u207b\u00b9 ^ 2) ^ i := by\n simp [\u2190 pow_mul, mul_comm]\n _ \u2264 (c\u207b\u00b9 ^ 2) ^ \u230aReal.log j / Real.log c\u230b\u208a / ((1 : \u211d) - c\u207b\u00b9 ^ 2) :=\n geom_sum_Ico_le_of_lt_one (sq_nonneg _) C\n _ \u2264 (c\u207b\u00b9 ^ 2) ^ (Real.log j / Real.log c - 1) / ((1 : \u211d) - c\u207b\u00b9 ^ 2) := by\n gcongr\n \u00b7 exact sub_nonneg.2 C.le\n \u00b7 rw [\u2190 Real.rpow_natCast]\n exact Real.rpow_le_rpow_of_exponent_ge A C.le (Nat.sub_one_lt_floor _).le\n _ = c ^ 2 * ((1 : \u211d) - c\u207b\u00b9 ^ 2)\u207b\u00b9 / j ^ 2 := by\n have I : (c\u207b\u00b9 ^ 2) ^ (Real.log j / Real.log c) = (1 : \u211d) / j ^ 2 := by\n apply Real.log_injOn_pos (Real.rpow_pos_of_pos A _)\n \u00b7 rw [Set.mem_Ioi]; positivity\n rw [Real.log_rpow A]\n simp only [one_div, Real.log_inv, Real.log_pow, mul_neg, neg_inj]\n field [(Real.log_pos hc).ne']\n rw [Real.rpow_sub A, I]\n simp\n ring\n _ \u2264 c ^ 3 * (c - 1)\u207b\u00b9 / j ^ 2 := by gcongr\n```\n\n-- snippet 51\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.cauchySeq_finset_of_geometric_bound (L566-L573)\ntheorem cauchySeq_finset_of_geometric_bound (hr : r < 1) (hf : \u2200 n, \u2016f n\u2016 \u2264 C * r ^ n) :\n CauchySeq fun s : Finset \u2115 \u21a6 \u2211 x \u2208 s, f x :=\ncauchySeq_finset_of_norm_bounded\n (aux_hasSum_of_le_geometric hr (dist_partial_sum_le_of_le_geometric hf)).summable hf\n\n/-- If `\u2016f n\u2016 \u2264 C * r ^ n` for all `n : \u2115` and some `r < 1`, then the partial sums of `f` are within\ndistance `C * r ^ n / (1 - r)` of the sum of the series. This lemma does not assume `0 \u2264 r` or\n`0 \u2264 C`. -/\n```\n\n-- snippet 52\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.summable_geometric_of_abs_lt_one (L379-L381)\ntheorem summable_geometric_of_abs_lt_one {r : \u211d} (h : |r| < 1) : Summable fun n : \u2115 \u21a6 r ^ n :=\nsummable_geometric_of_norm_lt_one h\n```\n\n-- snippet 53\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.isLittleO_pow_pow_of_abs_lt_left (L76-L95)\ntheorem isLittleO_pow_pow_of_abs_lt_left {r\u2081 r\u2082 : \u211d} (h : |r\u2081| < |r\u2082|) :\n (fun n : \u2115 \u21a6 r\u2081 ^ n) =o[atTop] fun n \u21a6 r\u2082 ^ n := by\nrefine (IsLittleO.of_norm_left ?_).of_norm_right\n exact (isLittleO_pow_pow_of_lt_left (abs_nonneg r\u2081) h).congr (pow_abs r\u2081) (pow_abs r\u2082)\n\nopen List in\n/-- Various statements equivalent to the fact that `f n` grows exponentially slower than `R ^ n`.\n\n* 0: $f n = o(a ^ n)$ for some $-R < a < R$;\n* 1: $f n = o(a ^ n)$ for some $0 < a < R$;\n* 2: $f n = O(a ^ n)$ for some $-R < a < R$;\n* 3: $f n = O(a ^ n)$ for some $0 < a < R$;\n* 4: there exist `a < R` and `C` such that one of `C` and `R` is positive and $|f n| \u2264 Ca^n$\n for all `n`;\n* 5: there exists `0 < a < R` and a positive `C` such that $|f n| \u2264 Ca^n$ for all `n`;\n* 6: there exists `a < R` such that $|f n| \u2264 a ^ n$ for sufficiently large `n`;\n* 7: there exists `0 < a < R` such that $|f n| \u2264 a ^ n$ for sufficiently large `n`.\n\nNB: For backwards compatibility, if you add more items to the list, please append them at the end of\nthe list. -/\n```\n\n-- snippet 54\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tsum_geometric_le_of_norm_lt_one (L293-L311)\ntheorem tsum_geometric_le_of_norm_lt_one (x : R) (h : \u2016x\u2016 < 1) :\n \u2016\u2211' n : \u2115, x ^ n\u2016 \u2264 \u2016(1 : R)\u2016 - 1 + (1 - \u2016x\u2016)\u207b\u00b9 := by\nby_cases hx : Summable (fun n \u21a6 x ^ n)\n \u00b7 rw [hx.tsum_eq_zero_add]\n simp only [_root_.pow_zero]\n refine le_trans (norm_add_le _ _) ?_\n have : \u2016\u2211' b : \u2115, (fun n \u21a6 x ^ (n + 1)) b\u2016 \u2264 (1 - \u2016x\u2016)\u207b\u00b9 - 1 := by\n refine tsum_of_norm_bounded ?_ fun b \u21a6 norm_pow_le' _ (Nat.succ_pos b)\n convert (hasSum_nat_add_iff' 1).mpr (hasSum_geometric_of_lt_one (norm_nonneg x) h)\n simp\n linarith\n \u00b7 simp only [tsum_eq_zero_of_not_summable hx, norm_zero]\n nontriviality R\n have : 1 \u2264 \u2016(1 : R)\u2016 := one_le_norm_one R\n have : 0 \u2264 (1 - \u2016x\u2016)\u207b\u00b9 := inv_nonneg.2 (by linarith)\n linarith\n\nvariable [HasSummableGeomSeries R]\n```\n\n-- snippet 55\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.isUnit_one_sub_of_norm_lt_one (L350-L358)\nlemma isUnit_one_sub_of_norm_lt_one {x : R} (h : \u2016x\u2016 < 1) : IsUnit (1 - x) :=\n\u27e8Units.oneSub x h, rfl\u27e9\n\nend HasSummableGeometricSeries\n\nsection Geometric\n\nvariable {K : Type*} [NormedDivisionRing K] {\u03be : K}\n```\n\n-- snippet 56\n```lean\n-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_succ (L47-L49)\nlemma arithGeom_succ [Mul R] [Add R] (n : \u2115) :\n arithGeom a b u\u2080 (n + 1) = a * arithGeom a b u\u2080 n + b := rfl\n```\n\n-- snippet 57\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.geom_series_mul_neg (L312-L314)\ntheorem geom_series_mul_neg (x : R) (h : \u2016x\u2016 < 1) : (\u2211' i : \u2115, x ^ i) * (1 - x) = 1 :=\n(summable_geometric_of_norm_lt_one h).tsum_pow_mul_one_sub\n```\n\n-- snippet 58\n```lean\n-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_strictMono (L114-L121)\nlemma arithGeom_strictMono (ha : 1 < a) (h0 : b / (1 - a) < u\u2080) :\n StrictMono (arithGeom a b u\u2080) := by\nrefine strictMono_nat_of_lt_succ fun n \u21a6 ?_\n have h_lt : b / (1 - a) < arithGeom a b u\u2080 n := div_lt_arithGeom (by positivity) ha.ne' h0 n\n rw [div_lt_iff_of_neg (sub_neg.mpr ha)] at h_lt\n rw [arithGeom_succ]\n linarith\n```\n\n-- snippet 59\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.cauchy_series_of_le_geometric (L590-L593)\ntheorem cauchy_series_of_le_geometric {C : \u211d} {u : \u2115 \u2192 \u03b1} {r : \u211d} (hr : r < 1)\n (h : \u2200 n, \u2016u n\u2016 \u2264 C * r ^ n) : CauchySeq fun n \u21a6 \u2211 k \u2208 range n, u k :=\ncauchySeq_of_le_geometric r C hr (by simp [h])\n```\n\n-- snippet 60\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.Units (L333-L338)\ndef Units.oneSub (t : R) (h : \u2016t\u2016 < 1) : R\u02e3 where\n val := 1 - t\ninv := \u2211' n : \u2115, t ^ n\n val_inv := mul_neg_geom_series t h\n inv_val := geom_series_mul_neg t h\n```\n\n-- snippet 61\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.hasSum_geom_series_inverse (L345-L349)\ntheorem hasSum_geom_series_inverse (x : R) (h : \u2016x\u2016 < 1) :\n HasSum (fun i \u21a6 x ^ i) (1 - x)\u207b\u00b9\u02b3 := by\nconvert (summable_geometric_of_norm_lt_one h).hasSum\n exact (geom_series_eq_inverse x h).symm\n```\n\n-- snippet 62\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.geom_series_mul_one_add (L326-L331)\ntheorem geom_series_mul_one_add (x : R) (h : \u2016x\u2016 < 1) :\n (1 + x) * \u2211' i : \u2115, x ^ i = 2 * \u2211' i : \u2115, x ^ i - 1 := by\nrw [add_mul, one_mul, geom_series_mul_shift x h, geom_series_succ x h, two_mul, add_sub_assoc]\n\n/-- In a normed ring with summable geometric series, a perturbation of `1` by an element `t`\nof distance less than `1` from `1` is a unit. Here we construct its `Units` structure. -/\n```\n\n-- snippet 63\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.norm_sub_le_of_geometric_bound_of_hasSum (L574-L579)\ntheorem norm_sub_le_of_geometric_bound_of_hasSum (hr : r < 1) (hf : \u2200 n, \u2016f n\u2016 \u2264 C * r ^ n) {a : \u03b1}\n (ha : HasSum f a) (n : \u2115) : \u2016(\u2211 x \u2208 Finset.range n, f x) - a\u2016 \u2264 C * r ^ n / (1 - r) := by\nrw [\u2190 dist_eq_norm]\n apply dist_le_of_le_geometric_of_tendsto r C hr (dist_partial_sum_le_of_le_geometric hf)\n exact ha.tendsto_sum_nat\n```\n\n-- snippet 64\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.hasSum_coe_mul_geometric_of_norm_lt_one (L539-L544)\ntheorem hasSum_coe_mul_geometric_of_norm_lt_one {r : \ud835\udd5c} (hr : \u2016r\u2016 < 1) :\n HasSum (fun n \u21a6 n * r ^ n : \u2115 \u2192 \ud835\udd5c) (r / (1 - r) ^ 2) := by\nconvert hasSum_coe_mul_geometric_of_norm_lt_one' hr using 1\n simp [div_eq_mul_inv]\n\n/-- If `\u2016r\u2016 < 1`, then `\u2211' n : \u2115, n * r ^ n = r / (1 - r) ^ 2`. -/\n```\n\n-- snippet 65\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.summable_norm_geometric_of_norm_lt_one (L429-L434)\ntheorem summable_norm_geometric_of_norm_lt_one {r : R}\n (hr : \u2016r\u2016 < 1) : Summable fun n : \u2115 \u21a6 \u2016(r ^ n : R)\u2016 := by\nsimpa using summable_norm_pow_mul_geometric_of_norm_lt_one 0 hr\n\nvariable [HasSummableGeomSeries R]\n```\n\n-- snippet 66\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.dist_partial_sum' (L586-L589)\ntheorem dist_partial_sum' (u : \u2115 \u2192 \u03b1) (n : \u2115) :\n dist (\u2211 k \u2208 range n, u k) (\u2211 k \u2208 range (n + 1), u k) = \u2016u n\u2016 := by\nsimp [dist_eq_norm', sum_range_succ]\n```\n\n-- snippet 67\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tsum_choose_mul_geometric_of_norm_lt_one' (L465-L468)\nlemma tsum_choose_mul_geometric_of_norm_lt_one' (k : \u2115) {r : R} (hr : \u2016r\u2016 < 1) :\n \u2211' n, (n + k).choose k * r ^ n = ((1 - r)\u207b\u00b9\u02b3) ^ (k + 1) :=\n(hasSum_choose_mul_geometric_of_norm_lt_one' k hr).tsum_eq\n```\n\n-- snippet 68\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.dist_partial_sum (L581-L584)\ntheorem dist_partial_sum (u : \u2115 \u2192 \u03b1) (n : \u2115) :\n dist (\u2211 k \u2208 range (n + 1), u k) (\u2211 k \u2208 range n, u k) = \u2016u n\u2016 := by\nsimp [dist_eq_norm, sum_range_succ]\n```\n\n-- snippet 69\n```lean\n-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.div_lt_arithGeom (L105-L113)\nlemma div_lt_arithGeom (ha_pos : 0 < a) (ha_ne : a \u2260 1) (h0 : b / (1 - a) < u\u2080) (n : \u2115) :\n b / (1 - a) < arithGeom a b u\u2080 n := by\ninduction n with\n | zero => exact h0\n | succ n hn =>\n calc b / (1 - a)\n _ = a * (b / (1 - a)) + b := by grind\n _ < a * arithGeom a b u\u2080 n + b := by gcongr\n```\n\n-- snippet 70\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.mul_neg_geom_series (L315-L317)\ntheorem mul_neg_geom_series (x : R) (h : \u2016x\u2016 < 1) : (1 - x) * \u2211' i : \u2115, x ^ i = 1 :=\n(summable_geometric_of_norm_lt_one h).one_sub_mul_tsum_pow\n```\n\n-- snippet 71\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tsum_coe_mul_geometric_of_norm_lt_one (L545-L558)\ntheorem tsum_coe_mul_geometric_of_norm_lt_one {r : \ud835\udd5c} (hr : \u2016r\u2016 < 1) :\n (\u2211' n : \u2115, n * r ^ n : \ud835\udd5c) = r / (1 - r) ^ 2 :=\n(hasSum_coe_mul_geometric_of_norm_lt_one hr).tsum_eq\n\nend MulGeometric\n\nsection SummableLeGeometric\n\nvariable [SeminormedAddCommGroup \u03b1] {r C : \u211d} {f : \u2115 \u2192 \u03b1}\n\nnonrec theorem SeminormedAddCommGroup.cauchySeq_of_le_geometric {C : \u211d} {r : \u211d} (hr : r < 1)\n {u : \u2115 \u2192 \u03b1} (h : \u2200 n, \u2016u n - u (n + 1)\u2016 \u2264 C * r ^ n) : CauchySeq u :=\n cauchySeq_of_le_geometric r C hr (by simpa [dist_eq_norm] using h)\n```\n\n-- snippet 72\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.geom_series_eq_inverse (L339-L344)\ntheorem geom_series_eq_inverse (x : R) (h : \u2016x\u2016 < 1) :\n \u2211' i, x ^ i = (1 - x)\u207b\u00b9\u02b3 := by\nchange (Units.oneSub x h)\u207b\u00b9 = (1 - x)\u207b\u00b9\u02b3\n rw [\u2190 Ring.inverse_unit]\n rfl\n```\n\n-- snippet 73\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.isLittleO_coe_const_pow_of_one_lt (L164-L168)\ntheorem isLittleO_coe_const_pow_of_one_lt {R : Type*} [NormedRing R] {r : \u211d} (hr : 1 < r) :\n ((\u2191) : \u2115 \u2192 R) =o[atTop] fun n \u21a6 r ^ n := by\nsimpa only [pow_one] using @isLittleO_pow_const_const_pow_of_one_lt R _ 1 _ hr\n\n/-- If `\u2016r\u2081\u2016 < r\u2082`, then for any natural `k` we have `n ^ k r\u2081 ^ n = o (r\u2082 ^ n)` as `n \u2192 \u221e`. -/\n```\n\n-- snippet 74\n```lean\n-- Mathlib.Analysis.SpecificLimits.FloorPow.sum_div_nat_floor_pow_sq_le_div_sq (L272-L298)\ntheorem sum_div_nat_floor_pow_sq_le_div_sq (N : \u2115) {j : \u211d} (hj : 0 < j) {c : \u211d} (hc : 1 < c) :\n (\u2211 i \u2208 range N with j < \u230ac ^ i\u230b\u208a, (1 : \u211d) / (\u230ac ^ i\u230b\u208a : \u211d) ^ 2) \u2264\n c ^ 5 * (c - 1)\u207b\u00b9 ^ 3 / j ^ 2 := by\nhave cpos : 0 < c := zero_lt_one.trans hc\n have A : 0 < 1 - c\u207b\u00b9 := sub_pos.2 (inv_lt_one_of_one_lt\u2080 hc)\n calc\n (\u2211 i \u2208 range N with j < \u230ac ^ i\u230b\u208a, (1 : \u211d) / (\u230ac ^ i\u230b\u208a : \u211d) ^ 2) \u2264\n \u2211 i \u2208 range N with j < c ^ i, (1 : \u211d) / (\u230ac ^ i\u230b\u208a : \u211d) ^ 2 := by\n gcongr with k hk; exact Nat.floor_le (by positivity)\n _ \u2264 \u2211 i \u2208 range N with j < c ^ i, (1 - c\u207b\u00b9)\u207b\u00b9 ^ 2 * ((1 : \u211d) / (c ^ i) ^ 2) := by\n gcongr with i\n rw [mul_div_assoc', mul_one, div_le_div_iff\u2080]; rotate_left\n \u00b7 apply sq_pos_of_pos\n refine zero_lt_one.trans_le ?_\n simp only [Nat.le_floor, one_le_pow\u2080, hc.le, Nat.one_le_cast, Nat.cast_one]\n \u00b7 exact sq_pos_of_pos (pow_pos cpos _)\n rw [one_mul, \u2190 mul_pow]\n gcongr\n rw [\u2190 div_eq_inv_mul, le_div_iff\u2080 A, mul_comm]\n exact mul_pow_le_nat_floor_pow hc i\n _ \u2264 (1 - c\u207b\u00b9)\u207b\u00b9 ^ 2 * (c ^ 3 * (c - 1)\u207b\u00b9) / j ^ 2 := by\n rw [\u2190 mul_sum, \u2190 mul_div_assoc']\n gcongr\n exact sum_div_pow_sq_le_div_sq N hj hc\n _ = c ^ 5 * (c - 1)\u207b\u00b9 ^ 3 / j ^ 2 := by\n congr 1\n field\n```\n\n-- snippet 75\n```lean\n-- Mathlib.Analysis.SpecificLimits.FloorPow.tendsto_div_of_monotone_of_tendsto_div_floor_pow (L182-L213)\ntheorem tendsto_div_of_monotone_of_tendsto_div_floor_pow (u : \u2115 \u2192 \u211d) (l : \u211d) (hmono : Monotone u)\n (c : \u2115 \u2192 \u211d) (cone : \u2200 k, 1 < c k) (clim : Tendsto c atTop (\ud835\udcdd 1))\n (hc : \u2200 k, Tendsto (fun n : \u2115 => u \u230ac k ^ n\u230b\u208a / \u230ac k ^ n\u230b\u208a) atTop (\ud835\udcdd l)) :\n Tendsto (fun n => u n / n) atTop (\ud835\udcdd l) := by\napply tendsto_div_of_monotone_of_exists_subseq_tendsto_div u l hmono\n intro a ha\n obtain \u27e8k, hk\u27e9 : \u2203 k, c k < a := ((tendsto_order.1 clim).2 a ha).exists\n refine\n \u27e8fun n => \u230ac k ^ n\u230b\u208a, ?_,\n (tendsto_nat_floor_atTop (\u03b1 := \u211d)).comp (tendsto_pow_atTop_atTop_of_one_lt (cone k)), hc k\u27e9\n have H : \u2200 n : \u2115, (0 : \u211d) < \u230ac k ^ n\u230b\u208a := by\n intro n\n refine zero_lt_one.trans_le ?_\n simp only [Nat.one_le_cast, Nat.one_le_floor_iff, one_le_pow\u2080 (cone k).le]\n have A :\n Tendsto (fun n : \u2115 => (\u230ac k ^ (n + 1)\u230b\u208a : \u211d) / c k ^ (n + 1) * c k / (\u230ac k ^ n\u230b\u208a / c k ^ n))\n atTop (\ud835\udcdd (1 * c k / 1)) := by\n refine Tendsto.div (Tendsto.mul ?_ tendsto_const_nhds) ?_ one_ne_zero\n \u00b7 refine tendsto_nat_floor_div_atTop.comp ?_\n exact (tendsto_pow_atTop_atTop_of_one_lt (cone k)).comp (tendsto_add_atTop_nat 1)\n \u00b7 refine tendsto_nat_floor_div_atTop.comp ?_\n exact tendsto_pow_atTop_atTop_of_one_lt (cone k)\n have B : Tendsto (fun n : \u2115 => (\u230ac k ^ (n + 1)\u230b\u208a : \u211d) / \u230ac k ^ n\u230b\u208a) atTop (\ud835\udcdd (c k)) := by\n simp only [one_mul, div_one] at A\n convert A using 1\n ext1 n\n field [(zero_lt_one.trans (cone k)).ne']\n filter_upwards [(tendsto_order.1 B).2 a hk] with n hn\n exact (div_le_iff\u2080 (H n)).1 hn.le\n\n/-- The sum of `1/(c^i)^2` above a threshold `j` is comparable to `1/j^2`, up to a multiplicative\nconstant. -/\n```\n\n-- snippet 76\n```lean\n-- Mathlib.Analysis.SpecificLimits.Fibonacci.tendsto_fib_succ_div_fib_atTop (L23-L35)\ntheorem tendsto_fib_succ_div_fib_atTop :\n Tendsto (fun n \u21a6 (fib (n + 1) / fib n : \u211d)) atTop (\ud835\udcdd \u03c6) := by\nhave h\u2081 n : (fib (n + 1) / fib n : \u211d) = (\u03c6 - \u03c8 * (\u03c8 / \u03c6) ^ n) / (1 - (\u03c8 / \u03c6) ^ n) := by\n simp only [coe_fib_eq, pow_succ, div_pow]\n field\n have h\u2082 := tendsto_pow_atTop_nhds_zero_of_abs_lt_one (r := \u03c8 / \u03c6) <| by\n rw [abs_div, div_lt_one <| by positivity, abs_of_pos goldenRatio_pos, abs_lt]\n ring_nf\n bound\n rw [show \u03c6 = (\u03c6 - \u03c8 * 0) / (1 - 0) by ring, funext h\u2081]\n exact const_sub _ (const_mul _ h\u2082) |>.div (const_sub _ h\u2082) <| by simp\n\n/-- The limit of `fib n / fib (n + 1)` as `n \u2192 \u221e` is the negative conjugate of the golden ratio. -/\n```\n\n-- snippet 77\n```lean\n-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_eq_add_sum (L50-L61)\nlemma arithGeom_eq_add_sum [CommSemiring R] (n : \u2115) :\n arithGeom a b u\u2080 n = a ^ n * u\u2080 + b * \u2211 k \u2208 Finset.range n, a ^ k := by\ninduction n with\n | zero => simp\n | succ n hn =>\n rw [arithGeom_succ, hn, mul_add, \u2190 mul_assoc, add_comm n, pow_add, pow_one, add_assoc]\n congr\n rw [add_comm _ n, Finset.sum_range_succ', Finset.mul_sum, pow_zero, mul_add, mul_one,\n Finset.mul_sum, Finset.mul_sum]\n congr with k\n ring\n```\n\n-- snippet 78\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tsum_geometric_of_abs_lt_one (L382-L386)\ntheorem tsum_geometric_of_abs_lt_one {r : \u211d} (h : |r| < 1) : \u2211' n : \u2115, r ^ n = (1 - r)\u207b\u00b9 :=\ntsum_geometric_of_norm_lt_one h\n\n/-- A geometric series in a normed field is summable iff the norm of the common ratio is less than\none. -/\n```\n\n-- snippet 79\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.isLittleO_pow_pow_of_lt_left (L65-L71)\ntheorem isLittleO_pow_pow_of_lt_left {r\u2081 r\u2082 : \u211d} (h\u2081 : 0 \u2264 r\u2081) (h\u2082 : r\u2081 < r\u2082) :\n (fun n : \u2115 \u21a6 r\u2081 ^ n) =o[atTop] fun n \u21a6 r\u2082 ^ n :=\nhave H : 0 < r\u2082 := h\u2081.trans_lt h\u2082\n (isLittleO_of_tendsto fun _ hn \u21a6 False.elim <| H.ne' <| eq_zero_of_pow_eq_zero hn) <|\n (tendsto_pow_atTop_nhds_zero_of_lt_one\n (div_nonneg h\u2081 (h\u2081.trans h\u2082.le)) ((div_lt_one H).2 h\u2082)).congr fun _ \u21a6 div_pow _ _ _\n```\n\n-- snippet 80\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.summable_choose_mul_geometric_of_norm_lt_one (L461-L464)\nlemma summable_choose_mul_geometric_of_norm_lt_one (k : \u2115) {r : R} (hr : \u2016r\u2016 < 1) :\n Summable (fun n \u21a6 (n + k).choose k * r ^ n) :=\n(hasSum_choose_mul_geometric_of_norm_lt_one' k hr).summable\n```\n\n-- snippet 81\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_pow_atTop_nhds_zero_iff_norm_lt_one (L231-L247)\nlemma tendsto_pow_atTop_nhds_zero_iff_norm_lt_one {R : Type*} [SeminormedRing R] [NormMulClass R]\n {x : R} : Tendsto (fun n : \u2115 \u21a6 x ^ n) atTop (\ud835\udcdd 0) \u2194 \u2016x\u2016 < 1 := by\n-- this proof is slightly fiddly since `\u2016x ^ n\u2016 = \u2016x\u2016 ^ n` might not hold for `n = 0`\n refine \u27e8?_, tendsto_pow_atTop_nhds_zero_of_norm_lt_one\u27e9\n rw [\u2190 abs_of_nonneg (norm_nonneg _), \u2190 tendsto_pow_atTop_nhds_zero_iff,\n tendsto_zero_iff_norm_tendsto_zero]\n apply Tendsto.congr'\n filter_upwards [eventually_ge_atTop 1] with n hn\n induction n, hn using Nat.le_induction with\n | base => simp\n | succ n hn IH => simp [pow_succ, IH]\n\nvariable {R S : Type*} [Field R] [Field S] [LinearOrder S] {v w : AbsoluteValue R S}\n [TopologicalSpace S] [IsStrictOrderedRing S] [Archimedean S] [_i : OrderTopology S]\n\n/-- `v (1 / (1 + a ^n))` tends to `1` for all `v : AbsoluteValue R S` for fields `R` and `S`,\nprovided `v a < 1`. -/\n```\n\n-- snippet 82\n```lean\n-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.tendsto_arithGeom_atTop_of_one_lt (L122-L128)\nlemma tendsto_arithGeom_atTop_of_one_lt [Archimedean R] (ha : 1 < a) (h0 : b / (1 - a) < u\u2080) :\n Tendsto (arithGeom a b u\u2080) atTop atTop := by\nrw [arithGeom_eq' ha.ne']\n refine tendsto_atTop_add_const_right _ _ ?_\n refine Tendsto.atTop_mul_const (sub_pos.mpr h0) ?_\n exact tendsto_pow_atTop_atTop_of_one_lt ha\n```\n\n-- snippet 83\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.isBigO_pow_pow_of_le_left (L72-L75)\ntheorem isBigO_pow_pow_of_le_left {r\u2081 r\u2082 : \u211d} (h\u2081 : 0 \u2264 r\u2081) (h\u2082 : r\u2081 \u2264 r\u2082) :\n (fun n : \u2115 \u21a6 r\u2081 ^ n) =O[atTop] fun n \u21a6 r\u2082 ^ n :=\nh\u2082.eq_or_lt.elim (fun h \u21a6 h \u25b8 isBigO_refl _ _) fun h \u21a6 (isLittleO_pow_pow_of_lt_left h\u2081 h).isBigO\n```\n\n-- snippet 84\n```lean\n-- Mathlib.Analysis.SpecificLimits.Fibonacci.tendsto_fib_div_fib_succ_atTop (L36-L40)\ntheorem tendsto_fib_div_fib_succ_atTop :\n Tendsto (fun n \u21a6 (fib n / fib (n + 1) : \u211d)) atTop (\ud835\udcdd (-\u03c8)) := by\nconvert tendsto_fib_succ_div_fib_atTop.inv\u2080 (by positivity) using 2\n \u00b7 rw [inv_div]\n \u00b7 rw [inv_goldenRatio]\n```\n\n-- snippet 85\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_intCast_atBot_sup_atTop_cobounded (L45-L52)\ntheorem tendsto_intCast_atBot_sup_atTop_cobounded\n [NormedRing \u03b1] [NormSMulClass \u2124 \u03b1] [Nontrivial \u03b1] :\n Tendsto Int.cast (atBot \u2294 atTop) (Bornology.cobounded \u03b1) := by\nrw [\u2190 tendsto_norm_atTop_iff_cobounded]\n simpa [norm_intCast_eq_abs_mul_norm_one] using tendsto_intCast_atTop_atTop\n |>.comp (tendsto_abs_atBot_atTop.sup tendsto_abs_atTop_atTop)\n |>.atTop_mul_const (norm_pos_iff.mpr one_ne_zero)\n```\n\n-- snippet 86\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.hasSum_choose_mul_geometric_of_norm_lt_one' (L435-L460)\nlemma hasSum_choose_mul_geometric_of_norm_lt_one'\n (k : \u2115) {r : R} (hr : \u2016r\u2016 < 1) :\n HasSum (fun n \u21a6 (n + k).choose k * r ^ n) ((1 - r)\u207b\u00b9\u02b3 ^ (k + 1)) := by\ninduction k with\n | zero => simpa using hasSum_geom_series_inverse r hr\n | succ k ih =>\n have I1 : Summable (fun (n : \u2115) \u21a6 \u2016(n + k).choose k * r ^ n\u2016) := by\n apply summable_norm_mul_geometric_of_norm_lt_one (k := k) hr\n apply isBigO_iff.2 \u27e82 ^ k, ?_\u27e9\n filter_upwards [Ioi_mem_atTop k] with n (hn : k < n)\n simp only [Real.norm_eq_abs, abs_cast, cast_pow, norm_pow]\n norm_cast\n calc (n + k).choose k\n _ \u2264 (2 * n).choose k := choose_le_choose k (by lia)\n _ \u2264 (2 * n) ^ k := Nat.choose_le_pow _ _\n _ = 2 ^ k * n ^ k := Nat.mul_pow 2 n k\n convert hasSum_sum_range_mul_of_summable_norm' I1 ih.summable\n (summable_norm_geometric_of_norm_lt_one hr) (summable_geometric_of_norm_lt_one hr) with n\n \u00b7 have : \u2211 i \u2208 Finset.range (n + 1), \u2191((i + k).choose k) * r ^ i * r ^ (n - i) =\n \u2211 i \u2208 Finset.range (n + 1), \u2191((i + k).choose k) * r ^ n := by\n apply Finset.sum_congr rfl (fun i hi \u21a6 ?_)\n simp only [Finset.mem_range] at hi\n rw [mul_assoc, \u2190 pow_add, show i + (n - i) = n by lia]\n simp [this, \u2190 sum_mul, \u2190 Nat.cast_sum, sum_range_add_choose n k, add_assoc]\n \u00b7 rw [ih.tsum_eq, (hasSum_geom_series_inverse r hr).tsum_eq, pow_succ]\n```\n\n-- snippet 87\n```lean\n-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_eq (L72-L77)\nlemma arithGeom_eq (ha : a \u2260 1) (n : \u2115) :\n arithGeom a b u\u2080 n = a ^ n * (u\u2080 - (b / (1 - a))) + b / (1 - a) := by\ninduction n with\n | zero => simp\n | succ n hn => unfold arithGeom; grind\n```\n\n-- snippet 88\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tsum_coe_mul_geometric_of_norm_lt_one' (L534-L538)\ntheorem tsum_coe_mul_geometric_of_norm_lt_one'\n {r : \ud835\udd5c} (hr : \u2016r\u2016 < 1) : (\u2211' n : \u2115, n * r ^ n : \ud835\udd5c) = r * (1 - r)\u207b\u00b9\u02b3 ^ 2 :=\n(hasSum_coe_mul_geometric_of_norm_lt_one' hr).tsum_eq\n\n/-- If `\u2016r\u2016 < 1`, then `\u2211' n : \u2115, n * r ^ n = r / (1 - r) ^ 2`, `HasSum` version. -/\n```\n\n-- snippet 89\n```lean\n-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_zero_eq_mul_div (L98-L104)\nlemma arithGeom_zero_eq_mul_div (ha : a \u2260 1) (n : \u2115) :\n arithGeom a b 0 n = b * (a ^ n - 1) / (a - 1) := by\nrw [arithGeom_zero_eq_mul_div' ha n, \u2190 neg_sub _ a, div_neg, \u2190 neg_sub _ (a ^ n), mul_neg,\n neg_div, neg_neg]\n\nvariable [LinearOrder R] [IsStrictOrderedRing R]\n```\n\n-- snippet 90\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.hasSum_geometric_of_norm_lt_one (L359-L368)\ntheorem hasSum_geometric_of_norm_lt_one (h : \u2016\u03be\u2016 < 1) : HasSum (fun n : \u2115 \u21a6 \u03be ^ n) (1 - \u03be)\u207b\u00b9 := by\nhave xi_ne_one : \u03be \u2260 1 := by\n contrapose! h\n simp [h]\n have A : Tendsto (fun n \u21a6 (\u03be ^ n - 1) * (\u03be - 1)\u207b\u00b9) atTop (\ud835\udcdd ((0 - 1) * (\u03be - 1)\u207b\u00b9)) :=\n ((tendsto_pow_atTop_nhds_zero_of_norm_lt_one h).sub tendsto_const_nhds).mul tendsto_const_nhds\n rw [hasSum_iff_tendsto_nat_of_summable_norm]\n \u00b7 simpa [geom_sum_eq, xi_ne_one, neg_inv, div_eq_mul_inv] using A\n \u00b7 simp [norm_pow, summable_geometric_of_lt_one (norm_nonneg _) h]\n```\n\n-- snippet 91\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.isLittleO_pow_const_const_pow_of_one_lt (L146-L163)\ntheorem isLittleO_pow_const_const_pow_of_one_lt {R : Type*} [NormedRing R] (k : \u2115) {r : \u211d}\n (hr : 1 < r) : (fun n \u21a6 (n : R) ^ k : \u2115 \u2192 R) =o[atTop] fun n \u21a6 r ^ n := by\nhave : Tendsto (fun x : \u211d \u21a6 x ^ k) (\ud835\udcdd[>] 1) (\ud835\udcdd 1) :=\n ((continuous_id.pow k).tendsto' (1 : \u211d) 1 (one_pow _)).mono_left inf_le_left\n obtain \u27e8r' : \u211d, hr' : r' ^ k < r, h1 : 1 < r'\u27e9 :=\n ((this.eventually (gt_mem_nhds hr)).and self_mem_nhdsWithin).exists\n have h0 : 0 \u2264 r' := zero_le_one.trans h1.le\n suffices (fun n \u21a6 (n : R) ^ k : \u2115 \u2192 R) =O[atTop] fun n : \u2115 \u21a6 (r' ^ k) ^ n from\n this.trans_isLittleO (isLittleO_pow_pow_of_lt_left (pow_nonneg h0 _) hr')\n conv in (r' ^ _) ^ _ => rw [\u2190 pow_mul, mul_comm, pow_mul]\n suffices \u2200 n : \u2115, \u2016(n : R)\u2016 \u2264 (r' - 1)\u207b\u00b9 * \u2016(1 : R)\u2016 * \u2016r' ^ n\u2016 from\n (isBigO_of_le' _ this).pow _\n intro n\n rw [mul_right_comm]\n refine n.norm_cast_le.trans (mul_le_mul_of_nonneg_right ?_ (norm_nonneg _))\n simpa [_root_.div_eq_inv_mul, Real.norm_eq_abs, abs_of_nonneg h0] using n.cast_le_pow_div_sub h1\n\n/-- For a real `r > 1` we have `n = o(r ^ n)` as `n \u2192 \u221e`. -/\n```\n\n-- snippet 92\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.summable_norm_mul_geometric_of_norm_lt_one (L402-L422)\ntheorem summable_norm_mul_geometric_of_norm_lt_one {k : \u2115} {r : R}\n (hr : \u2016r\u2016 < 1) {u : \u2115 \u2192 \u2115} (hu : (fun n \u21a6 (u n : \u211d)) =O[atTop] (fun n \u21a6 (\u2191(n ^ k) : \u211d))) :\n Summable fun n : \u2115 \u21a6 \u2016(u n * r ^ n : R)\u2016 := by\nrcases exists_between hr with \u27e8r', hrr', h\u27e9\n rw [\u2190 norm_norm] at hrr'\n apply summable_of_isBigO_nat (summable_geometric_of_lt_one ((norm_nonneg _).trans hrr'.le) h)\n calc\n fun n \u21a6 \u2016\u2191(u n) * r ^ n\u2016\n _ =O[atTop] fun n \u21a6 u n * \u2016r\u2016 ^ n := by\n apply (IsBigOWith.of_bound (c := \u2016(1 : R)\u2016) ?_).isBigO\n filter_upwards [eventually_norm_pow_le r] with n hn\n simp only [norm_mul, Real.norm_eq_abs, abs_cast, norm_pow, abs_norm]\n apply (norm_mul_le _ _).trans\n have : \u2016(u n : R)\u2016 * \u2016r ^ n\u2016 \u2264 (u n * \u2016(1 : R)\u2016) * \u2016r\u2016 ^ n := by\n gcongr; exact norm_cast_le (u n)\n exact this.trans (le_of_eq (by ring))\n _ =O[atTop] fun n \u21a6 \u2191(n ^ k) * \u2016r\u2016 ^ n := hu.mul (isBigO_refl _ _)\n _ =O[atTop] fun n \u21a6 r' ^ n := by\n simp only [cast_pow]\n exact (isLittleO_pow_const_mul_const_pow_const_pow_of_norm_lt k hrr').isBigO\n```\n\n-- snippet 93\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_self_mul_const_pow_of_lt_one (L216-L220)\ntheorem tendsto_self_mul_const_pow_of_lt_one {r : \u211d} (hr : 0 \u2264 r) (h'r : r < 1) :\n Tendsto (fun n \u21a6 n * r ^ n : \u2115 \u2192 \u211d) atTop (\ud835\udcdd 0) := by\nsimpa only [pow_one] using tendsto_pow_const_mul_const_pow_of_lt_one 1 hr h'r\n\n/-- In a normed ring, the powers of an element x with `\u2016x\u2016 < 1` tend to zero. -/\n```\n\n-- snippet 94\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_pow_atTop_nhds_zero_of_abs_lt_one (L227-L230)\ntheorem tendsto_pow_atTop_nhds_zero_of_abs_lt_one {r : \u211d} (h : |r| < 1) :\n Tendsto (fun n : \u2115 \u21a6 r ^ n) atTop (\ud835\udcdd 0) :=\ntendsto_pow_atTop_nhds_zero_of_norm_lt_one h\n```\n\n-- snippet 95\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tsum_geometric_of_norm_lt_one (L372-L374)\ntheorem tsum_geometric_of_norm_lt_one (h : \u2016\u03be\u2016 < 1) : \u2211' n : \u2115, \u03be ^ n = (1 - \u03be)\u207b\u00b9 :=\n(hasSum_geometric_of_norm_lt_one h).tsum_eq\n```\n\n-- snippet 96\n```lean\n-- Mathlib.Analysis.SpecificLimits.ArithmeticGeometric.arithGeom_same_eq_sum (L62-L65)\nlemma arithGeom_same_eq_sum [CommSemiring R] (n : \u2115) :\n arithGeom a b b n = b * \u2211 k \u2208 Finset.range (n + 1), a ^ k := by\nrw [arithGeom_eq_add_sum, Finset.sum_range_succ, mul_add, add_comm, mul_comm _ b]\n```\n\n-- snippet 97\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.hasSum_choose_mul_geometric_of_norm_lt_one (L469-L474)\nlemma hasSum_choose_mul_geometric_of_norm_lt_one\n (k : \u2115) {r : \ud835\udd5c} (hr : \u2016r\u2016 < 1) :\n HasSum (fun n \u21a6 (n + k).choose k * r ^ n) (1 / (1 - r) ^ (k + 1)) := by\nconvert hasSum_choose_mul_geometric_of_norm_lt_one' k hr\n simp\n```\n\n-- snippet 98\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.summable_geometric_iff_norm_lt_one (L388-L401)\ntheorem summable_geometric_iff_norm_lt_one : (Summable fun n : \u2115 \u21a6 \u03be ^ n) \u2194 \u2016\u03be\u2016 < 1 := by\nrefine \u27e8fun h \u21a6 ?_, summable_geometric_of_norm_lt_one\u27e9\n obtain \u27e8k : \u2115, hk : dist (\u03be ^ k) 0 < 1\u27e9 :=\n (h.tendsto_cofinite_zero.eventually (ball_mem_nhds _ zero_lt_one)).exists\n simp only [norm_pow, dist_zero_right] at hk\n rw [\u2190 one_pow k] at hk\n exact lt_of_pow_lt_pow_left\u2080 _ zero_le_one hk\n\nend Geometric\n\nsection MulGeometric\n\nvariable {R : Type*} [NormedRing R] {\ud835\udd5c : Type*} [NormedDivisionRing \ud835\udd5c]\n```\n\n-- snippet 99\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_pow_const_div_const_pow_of_one_lt (L182-L186)\ntheorem tendsto_pow_const_div_const_pow_of_one_lt (k : \u2115) {r : \u211d} (hr : 1 < r) :\n Tendsto (fun n \u21a6 (n : \u211d) ^ k / r ^ n : \u2115 \u2192 \u211d) atTop (\ud835\udcdd 0) :=\n(isLittleO_pow_const_const_pow_of_one_lt k hr).tendsto_div_nhds_zero\n\n/-- If `|r| < 1`, then `n ^ k r ^ n` tends to zero for any natural `k`. -/\n```\n\n-- snippet 100\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_pow_atTop_nhds_zero_of_norm_lt_one (L221-L226)\ntheorem tendsto_pow_atTop_nhds_zero_of_norm_lt_one {R : Type*} [SeminormedRing R] {x : R}\n (h : \u2016x\u2016 < 1) :\n Tendsto (fun n : \u2115 \u21a6 x ^ n) atTop (\ud835\udcdd 0) := by\napply squeeze_zero_norm' (eventually_norm_pow_le x)\n exact tendsto_pow_atTop_nhds_zero_of_lt_one (norm_nonneg _) h\n```\n\n-- snippet 101\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_intCast_atBot_cobounded (L53-L57)\ntheorem tendsto_intCast_atBot_cobounded\n [NormedRing \u03b1] [NormSMulClass \u2124 \u03b1] [Nontrivial \u03b1] :\n Tendsto Int.cast atBot (Bornology.cobounded \u03b1) :=\ntendsto_intCast_atBot_sup_atTop_cobounded.mono_left le_sup_left\n```\n\n-- snippet 102\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.tendsto_intCast_atTop_cobounded (L58-L64)\ntheorem tendsto_intCast_atTop_cobounded\n [NormedRing \u03b1] [NormSMulClass \u2124 \u03b1] [Nontrivial \u03b1] :\n Tendsto Int.cast atTop (Bornology.cobounded \u03b1) :=\ntendsto_intCast_atBot_sup_atTop_cobounded.mono_left le_sup_right\n\n/-! ### Powers -/\n```\n\n-- snippet 103\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.hasSum_geometric_of_abs_lt_one (L375-L378)\ntheorem hasSum_geometric_of_abs_lt_one {r : \u211d} (h : |r| < 1) :\n HasSum (fun n : \u2115 \u21a6 r ^ n) (1 - r)\u207b\u00b9 :=\nhasSum_geometric_of_norm_lt_one h\n```\n\n-- snippet 104\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.TFAE_exists_lt_isLittleO_pow (L96-L145)\ntheorem TFAE_exists_lt_isLittleO_pow (f : \u2115 \u2192 \u211d) (R : \u211d) :\n TFAE\n [\u2203 a \u2208 Ioo (-R) R, f =o[atTop] (a ^ \u00b7), \u2203 a \u2208 Ioo 0 R, f =o[atTop] (a ^ \u00b7),\n \u2203 a \u2208 Ioo (-R) R, f =O[atTop] (a ^ \u00b7), \u2203 a \u2208 Ioo 0 R, f =O[atTop] (a ^ \u00b7),\n \u2203 a < R, \u2203 C : \u211d, (0 < C \u2228 0 < R) \u2227 \u2200 n, |f n| \u2264 C * a ^ n,\n \u2203 a \u2208 Ioo 0 R, \u2203 C > 0, \u2200 n, |f n| \u2264 C * a ^ n, \u2203 a < R, \u2200\u1da0 n in atTop, |f n| \u2264 a ^ n,\n \u2203 a \u2208 Ioo 0 R, \u2200\u1da0 n in atTop, |f n| \u2264 a ^ n] := by\nhave A : Ico 0 R \u2286 Ioo (-R) R :=\n fun x hx \u21a6 \u27e8(neg_lt_zero.2 (hx.1.trans_lt hx.2)).trans_le hx.1, hx.2\u27e9\n have B : Ioo 0 R \u2286 Ioo (-R) R := Subset.trans Ioo_subset_Ico_self A\n -- First we prove that 1-4 are equivalent using 2 \u2192 3 \u2192 4, 1 \u2192 3, and 2 \u2192 1\n tfae_have 1 \u2192 3 := fun \u27e8a, ha, H\u27e9 \u21a6 \u27e8a, ha, H.isBigO\u27e9\n tfae_have 2 \u2192 1 := fun \u27e8a, ha, H\u27e9 \u21a6 \u27e8a, B ha, H\u27e9\n tfae_have 3 \u2192 2\n | \u27e8a, ha, H\u27e9 => by\n rcases exists_between (abs_lt.2 ha) with \u27e8b, hab, hbR\u27e9\n exact \u27e8b, \u27e8(abs_nonneg a).trans_lt hab, hbR\u27e9,\n H.trans_isLittleO (isLittleO_pow_pow_of_abs_lt_left (hab.trans_le (le_abs_self b)))\u27e9\n tfae_have 2 \u2192 4 := fun \u27e8a, ha, H\u27e9 \u21a6 \u27e8a, ha, H.isBigO\u27e9\n tfae_have 4 \u2192 3 := fun \u27e8a, ha, H\u27e9 \u21a6 \u27e8a, B ha, H\u27e9\n -- Add 5 and 6 using 4 \u2192 6 \u2192 5 \u2192 3\n tfae_have 4 \u2192 6\n | \u27e8a, ha, H\u27e9 => by\n rcases bound_of_isBigO_nat_atTop H with \u27e8C, hC\u2080, hC\u27e9\n refine \u27e8a, ha, C, hC\u2080, fun n \u21a6 ?_\u27e9\n simpa only [Real.norm_eq_abs, abs_pow, abs_of_nonneg ha.1.le] using hC (pow_ne_zero n ha.1.ne')\n tfae_have 6 \u2192 5 := fun \u27e8a, ha, C, H\u2080, H\u27e9 \u21a6 \u27e8a, ha.2, C, Or.inl H\u2080, H\u27e9\n tfae_have 5 \u2192 3\n | \u27e8a, ha, C, h\u2080, H\u27e9 => by\n rcases sign_cases_of_C_mul_pow_nonneg fun n \u21a6 (abs_nonneg _).trans (H n) with (rfl | \u27e8hC\u2080, ha\u2080\u27e9)\n \u00b7 obtain rfl : f = 0 := by\n ext n\n simpa using H n\n simp only [lt_irrefl, false_or] at h\u2080\n exact \u27e80, \u27e8neg_lt_zero.2 h\u2080, h\u2080\u27e9, isBigO_zero _ _\u27e9\n exact \u27e8a, A \u27e8ha\u2080, ha\u27e9,\n isBigO_of_le' _ fun n \u21a6 (H n).trans <| mul_le_mul_of_nonneg_left (le_abs_self _) hC\u2080.le\u27e9\n -- Add 7 and 8 using 2 \u2192 8 \u2192 7 \u2192 3\n tfae_have 2 \u2192 8\n | \u27e8a, ha, H\u27e9 => by\n refine \u27e8a, ha, (H.def zero_lt_one).mono fun n hn \u21a6 ?_\u27e9\n rwa [Real.norm_eq_abs, Real.norm_eq_abs, one_mul, abs_pow, abs_of_pos ha.1] at hn\n tfae_have 8 \u2192 7 := fun \u27e8a, ha, H\u27e9 \u21a6 \u27e8a, ha.2, H\u27e9\n tfae_have 7 \u2192 3\n | \u27e8a, ha, H\u27e9 => by\n refine \u27e8a, A \u27e8?_, ha\u27e9, .of_norm_eventuallyLE H\u27e9\n exact nonneg_of_eventually_pow_nonneg (H.mono fun n \u21a6 (abs_nonneg _).trans)\n tfae_finish\n\n/-- For any natural `k` and a real `r > 1` we have `n ^ k = o(r ^ n)` as `n \u2192 \u221e`. -/\n```\n\n-- snippet 105\n```lean\n-- Mathlib.Analysis.SpecificLimits.Normed.hasSum_coe_mul_geometric_of_norm_lt_one' (L515-L533)\ntheorem hasSum_coe_mul_geometric_of_norm_lt_one'\n {x : R} (h : \u2016x\u2016 < 1) :\n HasSum (fun n \u21a6 n * x ^ n : \u2115 \u2192 R) (x * ((1 - x)\u207b\u00b9\u02b3) ^ 2) := by\nhave A : HasSum (fun (n : \u2115) \u21a6 (n + 1) * x ^ n) ((1 - x)\u207b\u00b9\u02b3 ^ 2) := by\n convert hasSum_choose_mul_geometric_of_norm_lt_one' 1 h with n\n simp\n have B : HasSum (fun (n : \u2115) \u21a6 x ^ n) ((1 - x)\u207b\u00b9\u02b3) := hasSum_geom_series_inverse x h\n convert A.sub B using 1\n \u00b7 ext n\n simp [add_mul]\n \u00b7 symm\n calc (1 - x)\u207b\u00b9\u02b3 ^ 2 - (1 - x)\u207b\u00b9\u02b3\n _ = (1 - x)\u207b\u00b9\u02b3 ^ 2 - ((1 - x) * (1 - x)\u207b\u00b9\u02b3) * (1 - x)\u207b\u00b9\u02b3 := by\n simp [Ring.mul_inverse_cancel (1 - x) (isUnit_one_sub_of_norm_lt_one h)]\n _ = x * (1 - x)\u207b\u00b9\u02b3 ^ 2 := by noncomm_ring\n\n/-- If `\u2016r\u2016 < 1`, then `\u2211' n : \u2115, n * r ^ n = r / (1 - r) ^ 2`, version in a general ring with\nsummable geometric series. For a version in a field, using division instead of `Ring.inverse`,\nsee `tsum_coe_mul_geometric_of_norm_lt_one`. -/\n```\n[/INST]", "sample_id": "C-Mathlib.Analysis.SpecificLimits.Basic.lt_geom", "source": {"declaration": "Mathlib.Analysis.SpecificLimits.Basic.lt_geom", "file": "Mathlib/Analysis/SpecificLimits/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Analysis.SpecificLimits.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/SpecificLimits/Basic.lean#L243", "span": "L243-L248"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"source_grounded_context_enriched": false, "trace_states": [{"state": "lemma GrowsPolynomially.of_isTheta {f g : \u211d \u2192 \u211d} (hg : GrowsPolynomially g) (hf : f =\u0398[atTop] g)\n (hf' : \u2200\u1da0 x in atTop, 0 \u2264 f x) : GrowsPolynomially f", "tactic": "intro b hb"}, {"state": "", "tactic": "have hb_pos := hb.1"}, {"state": "", "tactic": "have hf_lb := isBigO_iff''.mp hf.isBigO_symm"}, {"state": "", "tactic": "have hf_ub := isBigO_iff'.mp hf.isBigO"}, {"state": "", "tactic": "obtain \u27e8c\u2081, hc\u2081_pos : 0 < c\u2081, hf_lb\u27e9 := hf_lb"}, {"state": "", "tactic": "obtain \u27e8c\u2082, hc\u2082_pos : 0 < c\u2082, hf_ub\u27e9 := hf_ub"}, {"state": "", "tactic": "have hg := hg.norm b hb"}, {"state": "", "tactic": "obtain \u27e8c\u2083, hc\u2083_pos : 0 < c\u2083, hg\u27e9 := hg"}, {"state": "", "tactic": "obtain \u27e8c\u2084, hc\u2084_pos : 0 < c\u2084, hg\u27e9 := hg"}, {"state": "", "tactic": "have h_lb_pos : 0 < c\u2081 * c\u2082\u207b\u00b9 * c\u2083 := by positivity"}, {"state": "", "tactic": "have h_ub_pos : 0 < c\u2082 * c\u2084 * c\u2081\u207b\u00b9 := by positivity"}, {"state": "", "tactic": "refine \u27e8c\u2081 * c\u2082\u207b\u00b9 * c\u2083, h_lb_pos, ?_\u27e9"}, {"state": "", "tactic": "refine \u27e8c\u2082 * c\u2084 * c\u2081\u207b\u00b9, h_ub_pos, ?_\u27e9"}, {"state": "", "tactic": "have c\u2082_cancel : c\u2082\u207b\u00b9 * c\u2082 = 1 := inv_mul_cancel\u2080 (by positivity)"}, {"state": "", "tactic": "have c\u2081_cancel : c\u2081\u207b\u00b9 * c\u2081 = 1 := inv_mul_cancel\u2080 (by positivity) filter_upwards [(tendsto_id.const_mul_atTop hb_pos).eventually_forall_ge_atTop hf', (tendsto_id.const_mul_atTop hb_pos).eventually_forall_ge_atTop hf_lb, (tendsto_id.const_mul_atTop hb_pos).eventually_forall_ge_atTop hf_ub, (tendsto_id.const_mul_atTop hb_pos).eventually_forall_ge_atTop hg, eventually_ge_atTop 0] with x hf_pos h_lb h_ub hg_bound hx_pos"}, {"state": "", "tactic": "intro u hu"}, {"state": "", "tactic": "have hbx : b * x \u2264 x :="}, {"state": "", "tactic": "calc b * x \u2264 1 * x := by gcongr; exact le_of_lt hb.2 _ = x := by rw [one_mul]"}, {"state": "", "tactic": "have hg_bound := hg_bound x hbx"}, {"state": "", "tactic": "refine \u27e8?lb, ?ub\u27e9 case lb => calc c\u2081 * c\u2082\u207b\u00b9 * c\u2083 * f x \u2264 c\u2081 * c\u2082\u207b\u00b9 * c\u2083 * (c\u2082 * \u2016g x\u2016) := by"}, {"state": "", "tactic": "rw [\u2190 Real.norm_of_nonneg (hf_pos x hbx)]; gcongr; exact h_ub x hbx _ = (c\u2082\u207b\u00b9 * c\u2082) * c\u2081 * (c\u2083 * \u2016g x\u2016) := by ring _ = c\u2081 * (c\u2083 * \u2016g x\u2016) := by simp [c\u2082_cancel] _ \u2264 c\u2081 * \u2016g u\u2016 := by gcongr; exact (hg_bound u hu).1 _ \u2264 f u := by"}, {"state": "", "tactic": "rw [\u2190 Real.norm_of_nonneg (hf_pos u hu.1)]"}, {"state": "", "tactic": "exact h_lb u hu.1 case ub => calc f u \u2264 c\u2082 * \u2016g u\u2016 := by rw [\u2190 Real.norm_of_nonneg (hf_pos u hu.1)]; exact h_ub u hu.1 _ \u2264 c\u2082 * (c\u2084 * \u2016g x\u2016) := by gcongr; exact (hg_bound u hu).2 _ = c\u2082 * c\u2084 * (c\u2081\u207b\u00b9 * c\u2081) * \u2016g x\u2016 := by simp [c\u2081_cancel]; ring _ = c\u2082 * c\u2084 * c\u2081\u207b\u00b9 * (c\u2081 * \u2016g x\u2016) := by ring _ \u2264 c\u2082 * c\u2084 * c\u2081\u207b\u00b9 * f x := by"}, {"state": "", "tactic": "gcongr"}, {"state": "", "tactic": "rw [\u2190 Real.norm_of_nonneg (hf_pos x hbx)]"}, {"state": "", "tactic": "exact h_lb x hbx"}], "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 4462, "declarations_count": 609, "diagnostics_count": 0, "duplicate_fingerprint": "d76c37e33be890ea", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 2078, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "medium", "line_count": 60, "natural_language_chars": 4462, "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.GrowsPolynomially).", "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.AkraBazzi.GrowsPolynomially.GrowsPolynomially`:\nState 0: \u22a2 lemma GrowsPolynomially.of_isTheta {f g : \u211d \u2192 \u211d} (hg : GrowsPolynomially g) (hf : f =\u0398[atTop] g)\n (hf' : \u2200\u1da0 x in atTop, 0 \u2264 f x) : GrowsPolynomially f\nTactic: intro b hb\nState 1: \u22a2 \nTactic: have hb_pos := hb.1\nState 2: \u22a2 \nTactic: have hf_lb := isBigO_iff''.mp hf.isBigO_symm\nState 3: \u22a2 \nTactic: have hf_ub := isBigO_iff'.mp hf.isBigO\nState 4: \u22a2 \nTactic: obtain \u27e8c\u2081, hc\u2081_pos : 0 < c\u2081, hf_lb\u27e9 := hf_lb\nState 5: \u22a2 \nTactic: obtain \u27e8c\u2082, hc\u2082_pos : 0 < c\u2082, hf_ub\u27e9 := hf_ub\nState 6: \u22a2 \nTactic: have hg := hg.norm b hb\nState 7: \u22a2 \nTactic: obtain \u27e8c\u2083, hc\u2083_pos : 0 < c\u2083, hg\u27e9 := hg\nState 8: \u22a2 \nTactic: obtain \u27e8c\u2084, hc\u2084_pos : 0 < c\u2084, hg\u27e9 := hg\nState 9: \u22a2 \nTactic: have h_lb_pos : 0 < c\u2081 * c\u2082\u207b\u00b9 * c\u2083 := by positivity\nState 10: \u22a2 \nTactic: have h_ub_pos : 0 < c\u2082 * c\u2084 * c\u2081\u207b\u00b9 := by positivity\nState 11: \u22a2 \nTactic: refine \u27e8c\u2081 * c\u2082\u207b\u00b9 * c\u2083, h_lb_pos, ?_\u27e9\nState 12: \u22a2 \nTactic: refine \u27e8c\u2082 * c\u2084 * c\u2081\u207b\u00b9, h_ub_pos, ?_\u27e9\nState 13: \u22a2 \nTactic: have c\u2082_cancel : c\u2082\u207b\u00b9 * c\u2082 = 1 := inv_mul_cancel\u2080 (by positivity)\nState 14: \u22a2 \nTactic: have c\u2081_cancel : c\u2081\u207b\u00b9 * c\u2081 = 1 := inv_mul_cancel\u2080 (by positivity) filter_upwards [(tendsto_id.const_mul_atTop hb_pos).eventually_forall_ge_atTop hf', (tendsto_id.const_mul_atTop hb_pos).eventually_forall_ge_atTop hf_lb, (tendsto_id.const_mul_atTop hb_pos).eventually_forall_ge_atTop hf_ub, (tendsto_id.const_mul_atTop hb_pos).eventually_forall_ge_atTop hg, eventually_ge_atTop 0] with x hf_pos h_lb h_ub hg_bound hx_pos\nState 15: \u22a2 \nTactic: intro u hu\nState 16: \u22a2 \nTactic: have hbx : b * x \u2264 x :=\nState 17: \u22a2 \nTactic: calc b * x \u2264 1 * x := by gcongr; exact le_of_lt hb.2 _ = x := by rw [one_mul]\nState 18: \u22a2 \nTactic: have hg_bound := hg_bound x hbx\nState 19: \u22a2 \nTactic: refine \u27e8?lb, ?ub\u27e9 case lb => calc c\u2081 * c\u2082\u207b\u00b9 * c\u2083 * f x \u2264 c\u2081 * c\u2082\u207b\u00b9 * c\u2083 * (c\u2082 * \u2016g x\u2016) := by\nState 20: \u22a2 \nTactic: rw [\u2190 Real.norm_of_nonneg (hf_pos x hbx)]; gcongr; exact h_ub x hbx _ = (c\u2082\u207b\u00b9 * c\u2082) * c\u2081 * (c\u2083 * \u2016g x\u2016) := by ring _ = c\u2081 * (c\u2083 * \u2016g x\u2016) := by simp [c\u2082_cancel] _ \u2264 c\u2081 * \u2016g u\u2016 := by gcongr; exact (hg_bound u hu).1 _ \u2264 f u := by\nState 21: \u22a2 \nTactic: rw [\u2190 Real.norm_of_nonneg (hf_pos u hu.1)]\nState 22: \u22a2 \nTactic: exact h_lb u hu.1 case ub => calc f u \u2264 c\u2082 * \u2016g u\u2016 := by rw [\u2190 Real.norm_of_nonneg (hf_pos u hu.1)]; exact h_ub u hu.1 _ \u2264 c\u2082 * (c\u2084 * \u2016g x\u2016) := by gcongr; exact (hg_bound u hu).2 _ = c\u2082 * c\u2084 * (c\u2081\u207b\u00b9 * c\u2081) * \u2016g x\u2016 := by simp [c\u2081_cancel]; ring _ = c\u2082 * c\u2084 * c\u2081\u207b\u00b9 * (c\u2081 * \u2016g x\u2016) := by ring _ \u2264 c\u2082 * c\u2084 * c\u2081\u207b\u00b9 * f x := by\nState 23: \u22a2 \nTactic: gcongr\nState 24: \u22a2 \nTactic: rw [\u2190 Real.norm_of_nonneg (hf_pos x hbx)]\nState 25: \u22a2 \nTactic: exact h_lb x hbx\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.AkraBazzi.GrowsPolynomially).[/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.AkraBazzi.GrowsPolynomially.GrowsPolynomially`:\nState 0: \u22a2 lemma GrowsPolynomially.of_isTheta {f g : \u211d \u2192 \u211d} (hg : GrowsPolynomially g) (hf : f =\u0398[atTop] g)\n (hf' : \u2200\u1da0 x in atTop, 0 \u2264 f x) : GrowsPolynomially f\nTactic: intro b hb\nState 1: \u22a2 \nTactic: have hb_pos := hb.1\nState 2: \u22a2 \nTactic: have hf_lb := isBigO_iff''.mp hf.isBigO_symm\nState 3: \u22a2 \nTactic: have hf_ub := isBigO_iff'.mp hf.isBigO\nState 4: \u22a2 \nTactic: obtain \u27e8c\u2081, hc\u2081_pos : 0 < c\u2081, hf_lb\u27e9 := hf_lb\nState 5: \u22a2 \nTactic: obtain \u27e8c\u2082, hc\u2082_pos : 0 < c\u2082, hf_ub\u27e9 := hf_ub\nState 6: \u22a2 \nTactic: have hg := hg.norm b hb\nState 7: \u22a2 \nTactic: obtain \u27e8c\u2083, hc\u2083_pos : 0 < c\u2083, hg\u27e9 := hg\nState 8: \u22a2 \nTactic: obtain \u27e8c\u2084, hc\u2084_pos : 0 < c\u2084, hg\u27e9 := hg\nState 9: \u22a2 \nTactic: have h_lb_pos : 0 < c\u2081 * c\u2082\u207b\u00b9 * c\u2083 := by positivity\nState 10: \u22a2 \nTactic: have h_ub_pos : 0 < c\u2082 * c\u2084 * c\u2081\u207b\u00b9 := by positivity\nState 11: \u22a2 \nTactic: refine \u27e8c\u2081 * c\u2082\u207b\u00b9 * c\u2083, h_lb_pos, ?_\u27e9\nState 12: \u22a2 \nTactic: refine \u27e8c\u2082 * c\u2084 * c\u2081\u207b\u00b9, h_ub_pos, ?_\u27e9\nState 13: \u22a2 \nTactic: have c\u2082_cancel : c\u2082\u207b\u00b9 * c\u2082 = 1 := inv_mul_cancel\u2080 (by positivity)\nState 14: \u22a2 \nTactic: have c\u2081_cancel : c\u2081\u207b\u00b9 * c\u2081 = 1 := inv_mul_cancel\u2080 (by positivity) filter_upwards [(tendsto_id.const_mul_atTop hb_pos).eventually_forall_ge_atTop hf', (tendsto_id.const_mul_atTop hb_pos).eventually_forall_ge_atTop hf_lb, (tendsto_id.const_mul_atTop hb_pos).eventually_forall_ge_atTop hf_ub, (tendsto_id.const_mul_atTop hb_pos).eventually_forall_ge_atTop hg, eventually_ge_atTop 0] with x hf_pos h_lb h_ub hg_bound hx_pos\nState 15: \u22a2 \nTactic: intro u hu\nState 16: \u22a2 \nTactic: have hbx : b * x \u2264 x :=\nState 17: \u22a2 \nTactic: calc b * x \u2264 1 * x := by gcongr; exact le_of_lt hb.2 _ = x := by rw [one_mul]\nState 18: \u22a2 \nTactic: have hg_bound := hg_bound x hbx\nState 19: \u22a2 \nTactic: refine \u27e8?lb, ?ub\u27e9 case lb => calc c\u2081 * c\u2082\u207b\u00b9 * c\u2083 * f x \u2264 c\u2081 * c\u2082\u207b\u00b9 * c\u2083 * (c\u2082 * \u2016g x\u2016) := by\nState 20: \u22a2 \nTactic: rw [\u2190 Real.norm_of_nonneg (hf_pos x hbx)]; gcongr; exact h_ub x hbx _ = (c\u2082\u207b\u00b9 * c\u2082) * c\u2081 * (c\u2083 * \u2016g x\u2016) := by ring _ = c\u2081 * (c\u2083 * \u2016g x\u2016) := by simp [c\u2082_cancel] _ \u2264 c\u2081 * \u2016g u\u2016 := by gcongr; exact (hg_bound u hu).1 _ \u2264 f u := by\nState 21: \u22a2 \nTactic: rw [\u2190 Real.norm_of_nonneg (hf_pos u hu.1)]\nState 22: \u22a2 \nTactic: exact h_lb u hu.1 case ub => calc f u \u2264 c\u2082 * \u2016g u\u2016 := by rw [\u2190 Real.norm_of_nonneg (hf_pos u hu.1)]; exact h_ub u hu.1 _ \u2264 c\u2082 * (c\u2084 * \u2016g x\u2016) := by gcongr; exact (hg_bound u hu).2 _ = c\u2082 * c\u2084 * (c\u2081\u207b\u00b9 * c\u2081) * \u2016g x\u2016 := by simp [c\u2081_cancel]; ring _ = c\u2082 * c\u2084 * c\u2081\u207b\u00b9 * (c\u2081 * \u2016g x\u2016) := by ring _ \u2264 c\u2082 * c\u2084 * c\u2081\u207b\u00b9 * f x := by\nState 23: \u22a2 \nTactic: gcongr\nState 24: \u22a2 \nTactic: rw [\u2190 Real.norm_of_nonneg (hf_pos x hbx)]\nState 25: \u22a2 \nTactic: exact h_lb x hbx\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.Computability.AkraBazzi.GrowsPolynomially.GrowsPolynomially", "source": {"declaration": "Mathlib.Computability.AkraBazzi.GrowsPolynomially.GrowsPolynomially", "file": "Mathlib/Computability/AkraBazzi/GrowsPolynomially.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Computability.AkraBazzi.GrowsPolynomially", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Computability/AkraBazzi/GrowsPolynomially.lean#L627", "span": "L627-L674"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.RingTheory.Ideal.KrullsHeightTheorem.IsLocalRing (L48-L58)\nlemma IsLocalRing.quotient_artinian_of_mem_minimalPrimes_of_isLocalRing\n [IsLocalRing R] (I : Ideal R) (hp : IsLocalRing.maximalIdeal R \u2208 I.minimalPrimes) :\n IsArtinianRing (R \u29f8 I) :=\nhave : Ring.KrullDimLE 0 (R \u29f8 I) := Ring.krullDimLE_zero_iff.mpr fun J prime \u21a6\n Ideal.isMaximal_of_isIntegral_of_isMaximal_comap _ <| by\n convert IsLocalRing.maximalIdeal.isMaximal R\n rw [Ideal.minimalPrimes, Set.mem_setOf] at hp\n have := prime.comap (Ideal.Quotient.mk I)\n exact hp.eq_of_le \u27e8this, .trans (by simp) (Ideal.ker_le_comap _)\u27e9 (le_maximalIdeal this.1)\n IsNoetherianRing.isArtinianRing_of_krullDimLE_zero", "-- Mathlib.RingTheory.Ideal.KrullsHeightTheorem.height_le_ringKrullDim_quotient_add_spanFinrank (L343-L351)\nlemma height_le_ringKrullDim_quotient_add_spanFinrank {p I : Ideal R} [p.IsPrime] (h : I \u2264 p) :\n p.height \u2264 ringKrullDim (R \u29f8 I) + I.spanFinrank := by\ntrans (p.map (Ideal.Quotient.mk I)).height + I.spanFinrank\n \u00b7 norm_cast; exact Ideal.height_le_height_add_spanFinrank_of_le h\n \u00b7 gcongr\n have : (Ideal.map (Ideal.Quotient.mk I) p).IsPrime :=\n Ideal.isPrime_map_quotientMk_of_isPrime h\n exact Ideal.height_le_ringKrullDim_of_ne_top Ideal.IsPrime.ne_top'", "-- Mathlib.RingTheory.Ideal.KrullsHeightTheorem.ringKrullDim_le_ringKrullDim_quotient_add_spanFinrank (L352-L362)\nlemma ringKrullDim_le_ringKrullDim_quotient_add_spanFinrank (I : Ideal R)\n (h : I \u2264 Ring.jacobson R) :\n ringKrullDim R \u2264 ringKrullDim (R \u29f8 I) + I.spanFinrank := by\nnontriviality R\n rw [ringKrullDim_le_iff_isMaximal_height_le]\n intro m hm\n exact height_le_ringKrullDim_quotient_add_spanFinrank <|\n le_trans h <| Ring.jacobson_le_of_isMaximal m\n\n/-- If `p` is a prime ideal containing `s`, the height of `p` is bounded\nby the sum of the height of the image of `p` in `R \u29f8 (s)` and the cardinality of `s`. -/", "-- Mathlib.RingTheory.Ideal.KrullsHeightTheorem.ringKrullDim_le_ringKrullDim_quotient_add_encard (L386-L391)\nlemma ringKrullDim_le_ringKrullDim_quotient_add_encard (s : Set R) (hs : s \u2286 Ring.jacobson R) :\n ringKrullDim R \u2264 ringKrullDim (R \u29f8 Ideal.span s) + s.encard := by\nrefine le_trans (ringKrullDim_le_ringKrullDim_quotient_add_spanFinrank (Ideal.span s) ?_) ?_\n \u00b7 simpa [Ideal.span_le]\n \u00b7 gcongr; norm_cast; exact Submodule.spanFinrank_span_le_encard _", "-- Mathlib.RingTheory.Ideal.KrullsHeightTheorem.ringKrullDim_le_ringKrullDim_quotient_add_card (L392-L407)\nlemma ringKrullDim_le_ringKrullDim_quotient_add_card (s : Finset R)\n (hs : (s : Set R) \u2286 Ring.jacobson R) :\n ringKrullDim R \u2264 ringKrullDim (R \u29f8 Ideal.span (s : Set R)) + s.card := by\nconvert ringKrullDim_le_ringKrullDim_quotient_add_encard s hs\n norm_cast\n\nsection Algebra\n\nvariable {S : Type*} [CommRing S] [Algebra R S]\n\n/--\nIf `P` lies over `p`, the height of `P` is bounded by the height of `p` plus\nthe height of the image of `P` in `S \u29f8 p S`.\nEquality holds if `S` satisfies going-down as an `R`-algebra\n(see `Ideal.height_eq_height_add_of_liesOver_of_hasGoingDown`).\n-/", "-- Mathlib.RingTheory.Ideal.KrullsHeightTheorem.ringKrullDim_le_spanFinrank_maximalIdeal (L474-L480)\nlemma ringKrullDim_le_spanFinrank_maximalIdeal [IsLocalRing R] :\n ringKrullDim R \u2264 (IsLocalRing.maximalIdeal R).spanFinrank :=\nle_of_eq_of_le IsLocalRing.maximalIdeal_height_eq_ringKrullDim.symm\n (WithBot.coe_le_coe.mpr (Ideal.height_le_spanFinrank (IsLocalRing.maximalIdeal R)\n Ideal.IsPrime.ne_top'))\n\nend Algebra", "-- Mathlib.RingTheory.Ideal.Basic.single_mem_pi (L67-L72)\ntheorem single_mem_pi [DecidableEq \u03b9] {i : \u03b9} {r : R i} (hr : r \u2208 I i) : Pi.single i r \u2208 pi I := by\nintro j\n obtain rfl | ne := eq_or_ne i j\n \u00b7 simpa\n \u00b7 simp [ne]", "-- Mathlib.RingTheory.Ideal.Colon.bot_colon' (L138-L140)\ntheorem bot_colon' : (\u22a5 : Submodule R M).colon S = (span R S).annihilator := by\naesop (add simp [mem_colon, mem_annihilator_span])", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.AssociatedPrimes (L108-L109)\ntheorem AssociatedPrimes.mem_iff : I \u2208 associatedPrimes R M \u2194 IsAssociatedPrime I M := Iff.rfl", "-- Mathlib.RingTheory.Ideal.Basic.isField_iff_maximal_bot (L259-L264)\ntheorem isField_iff_maximal_bot [Nontrivial R] : IsField R \u2194 (\u22a5 : Ideal R).IsMaximal := by\nrefine \u27e8fun h \u21a6 let := h.toSemifield; bot_isMaximal, fun hmax \u21a6 ?_\u27e9\n by_contra hf\n obtain \u27e8x, hx0, hxu\u27e9 := exists_not_isUnit_of_not_isField hf\n exact hx0 <| span_singleton_eq_bot.mp (hmax.eq_of_le (span_singleton_ne_top hxu) bot_le).symm", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.subset_union_of_exact (L171-L204)\ntheorem subset_union_of_exact (hf : Function.Injective f) (hfg : Function.Exact f g) :\n associatedPrimes R M' \u2286 associatedPrimes R M \u222a associatedPrimes R M'' := by\nrintro p \u27e8_, x, hx\u27e9\n by_cases! h : \u2203 a \u2208 p.primeCompl, \u2203 y : M, \u2203 k, f y = a ^ k \u2022 x\n \u00b7 obtain \u27e8a, ha, y, k, h\u27e9 := h\n left\n refine \u27e8\u2039_\u203a, y, le_antisymm (fun b hb \u21a6 ?_) (fun b \u27e8n, hb\u27e9 \u21a6 ?_)\u27e9\n \u00b7 rw [hx] at hb\n obtain \u27e8n, hb\u27e9 := hb\n use n\n rw [mem_colon_singleton, mem_bot] at hb \u22a2\n apply_fun _ using hf\n rw [map_smul, h, smul_comm, hb, smul_zero, map_zero]\n \u00b7 rw [mem_colon_singleton, mem_bot] at hb\n apply_fun f at hb\n rw [map_smul, map_zero, h, \u2190 mul_smul, \u2190 mem_bot R, \u2190 mem_colon_singleton] at hb\n replace hb := hx.ge (Ideal.le_radical hb)\n contrapose hb\n exact p.primeCompl.mul_mem (p.primeCompl.pow_mem hb n) (p.primeCompl.pow_mem ha k)\n \u00b7 right\n refine \u27e8\u2039_\u203a, g x, le_antisymm (fun b hb \u21a6 ?_) (fun b \u27e8n, hb\u27e9 \u21a6 ?_)\u27e9\n \u00b7 rw [hx] at hb\n refine Ideal.radical_mono (fun b hb \u21a6 ?_) hb\n rw [mem_colon_singleton, mem_bot] at hb \u22a2\n rw [\u2190 map_smul, hb, map_zero]\n \u00b7 rw [mem_colon_singleton, mem_bot, \u2190 map_smul, \u2190 LinearMap.mem_ker,\n hfg.linearMap_ker_eq] at hb\n obtain \u27e8y, hy\u27e9 := hb\n by_contra H\n exact h b H y n hy\n\nvariable (R M M') in\n/-- The set of associated primes of the product of two modules is equal to\nthe union of those of the two modules. -/", "-- Mathlib.RingTheory.Ideal.Colon.colon_empty (L114-L116)\nlemma colon_empty : N.colon (\u2205 : Set M) = \u22a4 := by\naesop (add simp mem_colon)", "-- Mathlib.RingTheory.Ideal.Cotangent.map_toCotangent_ker (L54-L57)\ntheorem map_toCotangent_ker : (LinearMap.ker I.toCotangent).map I.subtype = I ^ 2 := by\nrw [Ideal.toCotangent, Submodule.ker_mkQ, pow_two, Submodule.map_smul'' I \u22a4 (Submodule.subtype I),\n smul_eq_mul, Submodule.map_subtype_top]", "-- Mathlib.RingTheory.Ideal.Basic.exists_maximal_of_not_isField (L265-L270)\ntheorem exists_maximal_of_not_isField [Nontrivial R] (h : \u00ac IsField R) :\n \u2203 p : Ideal R, p \u2260 \u22a5 \u2227 p.IsMaximal := by\ncontrapose! h\n simp only [\u2190 bot_lt_iff_ne_bot] at h\n refine isField_iff_maximal_bot.mpr \u27e8\u27e8bot_ne_top, Ideal.maximal_of_no_maximal h\u27e9\u27e9", "-- Mathlib.RingTheory.Ideal.Colon.colon_span (L142-L149)\ntheorem colon_span : N.colon (span R S) = N.colon S := by\nrefine (colon_mono le_rfl subset_span).antisymm fun r h \u21a6 mem_colon.mpr fun s hs \u21a6 ?_\n induction hs using Submodule.span_induction with\n | mem => aesop (add simp mem_colon)\n | zero => simp\n | add => aesop\n | smul => simp_all [smul_mem, smul_comm r]", "-- Mathlib.RingTheory.Ideal.Basic.add_pow_add_pred_mem_of_pow_mem_of_commute (L97-L117)\ntheorem add_pow_add_pred_mem_of_pow_mem_of_commute {m n : \u2115}\n (ha : a ^ m \u2208 I) (hb : b ^ n \u2208 I) (hab : Commute a b) :\n (a + b) ^ (m + n - 1) \u2208 I :=\nI.add_pow_mem_of_pow_mem_of_le_of_commute ha hb (by rw [\u2190 Nat.sub_le_iff_le_add]) hab\n\nend Commute\n\nend Ideal\n\nend Semiring\n\nsection CommSemiring\n\nvariable {a b : \u03b1}\n\n-- A separate namespace definition is needed because the variables were historically in a different\n-- order.\nnamespace Ideal\n\nvariable [CommSemiring \u03b1] (I : Ideal \u03b1)", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.biUnion_associatedPrimes_eq_zero_divisors (L229-L239)\ntheorem biUnion_associatedPrimes_eq_zero_divisors [IsNoetherianRing R] :\n \u22c3 p \u2208 associatedPrimes R M, p = { r : R | \u2203 x : M, x \u2260 0 \u2227 r \u2022 x = 0 } := by\nsimp only [AssociatedPrimes.mem_iff, isAssociatedPrime_iff]\n refine subset_antisymm (Set.iUnion\u2082_subset ?_) ?_\n \u00b7 rintro _ \u27e8h, x, \u27e8\u27e9\u27e9 r h'\n exact \u27e8x, by simpa using h.ne_top, by simpa using h'\u27e9\n \u00b7 intro r \u27e8x, h, h'\u27e9\n obtain \u27e8P, hP, hx\u27e9 := exists_le_isAssociatedPrime_of_isNoetherianRing R x h\n rw [isAssociatedPrime_iff] at hP\n exact Set.mem_iUnion\u2082_of_mem hP (hx (by rwa [mem_colon_singleton]))", "-- Mathlib.RingTheory.Ideal.Colon.annihilator_map_mkQ_eq_colon (L169-L174)\nlemma annihilator_map_mkQ_eq_colon : annihilator (P.map N.mkQ) = N.colon (P : Set M) := by\next\n rw [mem_annihilator, mem_colon]\n exact \u27e8fun H p hp \u21a6 (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),\n fun H _ \u27e8p, hp, hpm\u27e9 \u21a6 hpm \u25b8 ((Quotient.mk_eq_zero N).2 <| H p hp)\u27e9", "-- Mathlib.RingTheory.Ideal.Colon.colon (L35-L44)\ndef colon (N : Submodule R M) (S : Set M) : Ideal R where\n carrier := {r : R | (r \u2022 S : Set M) \u2286 N}\nadd_mem' ha hb :=\n (Set.add_smul_subset _ _ _).trans ((Set.add_subset_add ha hb).trans_eq (by simp))\n zero_mem' := (Set.zero_smul_set_subset S).trans (by simp)\n smul_mem' r := by\n simp only [Set.mem_setOf_eq, smul_eq_mul, mul_smul, Set.smul_set_subset_iff]\n intro x hx y hy\n exact N.smul_mem _ (hx hy)", "-- Mathlib.RingTheory.Ideal.Basis.Basis (L55-L61)\ntheorem Basis.mem_ideal_iff {\u03b9 R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]\n {I : Ideal S} (b : Basis \u03b9 R I) {x : S} :\n x \u2208 I \u2194 \u2203 c : \u03b9 \u2192\u2080 R, x = Finsupp.sum c fun i x => x \u2022 (b i : S) :=\n(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff\n\n/-- If `I : Ideal S` has a finite basis over `R`,\n`x \u2208 I` iff it is a linear combination of basis vectors. -/", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.comap_mem_associatedPrimes_of_mem_associatedPrimes_of_isLocalizedModule_of_fg (L84-L120)\nlemma comap_mem_associatedPrimes_of_mem_associatedPrimes_of_isLocalizedModule_of_fg (p : Ideal R')\n (ass : p \u2208 associatedPrimes R' M') (fg : (p.comap (algebraMap R R')).FG) :\n p.comap (algebraMap R R') \u2208 associatedPrimes R M := by\nrcases ass with \u27e8hp, x, hx\u27e9\n rcases fg with \u27e8T, hT\u27e9\n rcases IsLocalizedModule.mk'_surjective S f x with \u27e8\u27e8m, s\u27e9, rfl\u27e9\n simp only [Function.uncurry_apply_pair] at hx\n have mem (a : T) : algebraMap R R' a \u2208 p := by\n simpa [\u2190 Ideal.mem_comap, \u2190 hT] using Ideal.subset_span a.2\n simp only [hx, Ideal.mem_radical_iff, mem_bot, mem_colon_singleton, \u2190 map_pow, algebraMap_smul,\n \u2190 IsLocalizedModule.mk'_smul, IsLocalizedModule.mk'_eq_zero' f] at mem\n choose e g hg using mem\n refine \u27e8.under R p, (\u220f a, g a).1 \u2022 m, le_antisymm ?_ fun r hr \u21a6 ?_\u27e9\n \u00b7 rw [\u2190 hT, Ideal.span_le]\n intro a ha\n simp only [SetLike.mem_coe, Ideal.mem_radical_iff, mem_bot, mem_colon_singleton]\n obtain \u27e8u, hu\u27e9 : g \u27e8a, ha\u27e9 \u2223 (\u220f a, g a) := by\n apply Finset.dvd_prod_of_mem g (Finset.mem_univ \u27e8a, ha\u27e9)\n use e \u27e8a, ha\u27e9\n rw [hu, Submonoid.coe_mul, smul_smul, \u2190 mul_assoc, mul_comm, \u2190 smul_smul, mul_comm, \u2190 smul_smul]\n exact smul_eq_zero_of_right u.1 (hg \u27e8a, ha\u27e9)\n \u00b7 simp only [Ideal.mem_radical_iff, mem_bot, mem_colon_singleton, smul_smul] at hr\n obtain \u27e8k, hk\u27e9 := hr\n have mem : r ^ k * (\u220f a, g a).1 \u2208 Ideal.comap (algebraMap R R') p := by\n rw [hx]\n use 1\n simp_rw [pow_one, mem_colon_singleton, algebraMap_smul, \u2190 IsLocalizedModule.mk'_smul,\n hk, IsLocalizedModule.mk'_zero, mem_bot]\n apply hp.mem_of_pow_mem k\n rw [\u2190 map_pow]\n exact ((hp.under R).mul_mem_iff_mem_or_mem.mp mem).resolve_right\n (Set.disjoint_left.mp ((IsLocalization.disjoint_comap_iff S R' p).mpr hp.1) (\u220f a, g a).2)\n\nvariable (R')\n\ninclude S f in\nopen Set in", "-- Mathlib.RingTheory.Ideal.Colon.colon_univ (L57-L60)\ntheorem colon_univ {I : Ideal R} [I.IsTwoSided] : I.colon Set.univ = I := by\nsimp_rw [SetLike.ext_iff, mem_colon, smul_eq_mul]\n exact fun x \u21a6 \u27e8fun h \u21a6 mul_one x \u25b8 h 1 trivial, fun h _ _ \u21a6 I.mul_mem_right _ h\u27e9", "-- Mathlib.RingTheory.Ideal.Colon.colon_inf_eq_left_of_subset (L81-L83)\nlemma colon_inf_eq_left_of_subset (h : S \u2286 (N\u2082 : Set M)) : (N\u2081 \u2293 N\u2082).colon S = N\u2081.colon S := by\naesop (add simp mem_colon)", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.exists_le_isAssociatedPrime_of_isNoetherianRing (L139-L163)\ntheorem exists_le_isAssociatedPrime_of_isNoetherianRing [H : IsNoetherianRing R] (x : M)\n (hx : x \u2260 0) : \u2203 P : Ideal R, IsAssociatedPrime P M \u2227 (\u22a5 : Submodule R M).colon {x} \u2264 P := by\nsimp only [isAssociatedPrime_iff]\n obtain \u27e8P, \u27e8l, h\u2081, y, rfl\u27e9, h\u2083\u27e9 :=\n set_has_maximal_iff_noetherian.mpr H\n { P | (\u22a5 : Submodule R M).colon {x} \u2264 P \u2227 P \u2260 \u22a4 \u2227 \u2203 y : M, P = (\u22a5 : Submodule R M).colon {y} }\n \u27e8_, rfl.le, by simpa, x, rfl\u27e9\n refine \u27e8_, \u27e8\u27e8h\u2081, ?_\u27e9, y, rfl\u27e9, l\u27e9\n intro a b hab\n rw [or_iff_not_imp_left]\n intro ha\n rw [mem_colon_singleton] at ha hab\n have H\u2081 : (\u22a5 : Submodule R M).colon {y} \u2264 (\u22a5 : Submodule R M).colon {a \u2022 y} := by\n intro c hc\n rw [mem_colon_singleton, mem_bot] at hc \u22a2\n rw [smul_comm, hc, smul_zero]\n rwa [H\u2081.eq_of_not_lt (h\u2083 _ \u27e8l.trans H\u2081, by simpa, _, rfl\u27e9),\n mem_colon_singleton, smul_comm, smul_smul]\n\nnamespace associatedPrimes\n\nvariable {f} {M'' : Type*} [AddCommMonoid M''] [Module R M''] {g : M' \u2192\u2097[R] M''}\n\n/-- If `M \u2192 M'` is injective, then the set of associated primes of `M` is\ncontained in that of `M'`. -/", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.mem_associatedPrimes_atPrime_of_mem_associatedPrimes (L70-L77)\nlemma mem_associatedPrimes_atPrime_of_mem_associatedPrimes\n {p : Ideal R} [p.IsPrime] (ass : p \u2208 associatedPrimes R M) :\n maximalIdeal (Localization.AtPrime p) \u2208\n associatedPrimes (Localization.AtPrime p) (LocalizedModule.AtPrime p M) := by\napply mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule\n p.primeCompl (LocalizedModule.mkLinearMap p.primeCompl M)\n simpa [Localization.AtPrime.comap_maximalIdeal] using ass", "-- Mathlib.RingTheory.Ideal.Basic.sum_pow_mem_span_pow (L155-L160)\ntheorem sum_pow_mem_span_pow {\u03b9} (s : Finset \u03b9) (f : \u03b9 \u2192 \u03b1) (n : \u2115) :\n (\u2211 i \u2208 s, f i) ^ (s.card * n + 1) \u2208 span ((fun i => f i ^ (n + 1)) '' s) := by\nclassical\n simpa only [Multiset.card_map, Multiset.map_map, comp_apply, Multiset.toFinset_map,\n Finset.coe_image, Finset.val_toFinset] using pow_multiset_sum_mem_span_pow (s.1.map f) n", "-- Mathlib.RingTheory.Ideal.Basic.not_isField_iff_exists_prime (L282-L291)\ntheorem not_isField_iff_exists_prime [Nontrivial R] :\n \u00acIsField R \u2194 \u2203 p : Ideal R, p \u2260 \u22a5 \u2227 p.IsPrime := by\nrefine \u27e8fun h \u21a6 ?_, fun \u27e8I, h_bot, h_top\u27e9 \u21a6 not_isField_of_ne_of_ne h_bot h_top.ne_top\u27e9\n obtain \u27e8I, hI, hIm\u27e9 := exists_maximal_of_not_isField h\n exact \u27e8I, hI, hIm.isPrime\u27e9\n\n/-- Also see `Ideal.isSimpleOrder` for the forward direction as an instance when `R` is a\ndivision (semi)ring.\n\nThis result actually holds for all division semirings, but we lack the predicate to state it. -/", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.isAssociatedPrime_iff_exists_injective_linearMap (L257-L267)\ntheorem isAssociatedPrime_iff_exists_injective_linearMap [IsNoetherianRing R] :\n IsAssociatedPrime I M \u2194 I.IsPrime \u2227 \u2203 (f : R \u29f8 I \u2192\u2097[R] M), Function.Injective f := by\nrw [isAssociatedPrime_iff, and_congr_right_iff]\n refine fun _ \u21a6 \u27e8fun \u27e8x, h\u27e9 \u21a6 ?_, fun \u27e8f, h\u27e9 \u21a6 \u27e8(f \u2218\u2097 mkQ I) 1, ?_\u27e9\u27e9\n \u00b7 replace h : I = ker (toSpanSingleton R M x) := by simp [h, SetLike.ext_iff]\n exact \u27e8liftQ _ _ h.le, ker_eq_bot.mp (ker_liftQ_eq_bot' _ _ h)\u27e9\n \u00b7 conv_lhs => rw [\u2190 I.ker_mkQ, \u2190 ker_comp_of_ker_eq_bot (mkQ I) (ker_eq_bot_of_injective h)]\n simp [SetLike.ext_iff, \u2190 Ideal.Quotient.algebraMap_eq, Algebra.algebraMap_eq_smul_one]\n\nvariable {I J M}", "-- Mathlib.RingTheory.Ideal.Basis.basisSpanSingleton_apply (L39-L44)\ntheorem basisSpanSingleton_apply (b : Basis \u03b9 R S) {x : S} (hx : x \u2260 0) (i : \u03b9) :\n (basisSpanSingleton b hx i : S) = x * b i := by\nsimp only [basisSpanSingleton, Basis.map_apply, LinearEquiv.trans_apply,\n Submodule.restrictScalarsEquiv_apply, LinearEquiv.ofInjective_apply, LinearEquiv.coe_ofEq_apply,\n LinearEquiv.restrictScalars_apply, LinearMap.mulLeft_apply]", "-- Mathlib.RingTheory.Ideal.Basic.pi (L50-L55)\ndef pi : Ideal (\u03a0 i, R i) where\n carrier := { r | \u2200 i, r i \u2208 I i }\nzero_mem' i := (I i).zero_mem\n add_mem' ha hb i := (I i).add_mem (ha i) (hb i)\n smul_mem' a _b hb i := (I i).mul_mem_left (a i) (hb i)", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.subset_of_injective (L165-L169)\ntheorem subset_of_injective (hf : Function.Injective f) :\n associatedPrimes R M \u2286 associatedPrimes R M' := fun _I h => h.map_of_injective f hf\n/-- If `0 \u2192 M \u2192 M' \u2192 M''` is an exact sequence, then the set of associated primes of `M'` is\ncontained in the union of those of `M` and `M''`. -/", "-- Mathlib.RingTheory.Ideal.Cotangent.mem_toCotangent_ker (L58-L61)\ntheorem mem_toCotangent_ker {x : I} : x \u2208 LinearMap.ker I.toCotangent \u2194 (x : R) \u2208 I ^ 2 := by\nrw [\u2190 I.map_toCotangent_ker]\n simp", "-- Mathlib.RingTheory.Ideal.Colon.mem_colon_iff_le (L134-L137)\ntheorem mem_colon_iff_le {r} : r \u2208 N.colon N' \u2194 r \u2022 N' \u2264 N := by\naesop (add simp SetLike.coe_subset_coe)\n\n/-- A variant for arbitrary sets in commutative semirings -/", "-- Mathlib.RingTheory.Ideal.Cotangent.toCotangent_surjective (L68-L69)\ntheorem toCotangent_surjective : Function.Surjective I.toCotangent := Submodule.mkQ_surjective _", "-- Mathlib.RingTheory.Ideal.Basic.not_isField_iff_exists_ideal_bot_lt_and_lt_top (L276-L281)\ntheorem not_isField_iff_exists_ideal_bot_lt_and_lt_top [Nontrivial R] :\n \u00acIsField R \u2194 \u2203 I : Ideal R, \u22a5 < I \u2227 I < \u22a4 := by\nrefine \u27e8fun h \u21a6 ?_, fun \u27e8I, h_bot, h_top\u27e9 \u21a6 not_isField_of_ne_of_ne h_bot.ne' h_top.ne\u27e9\n obtain \u27e8I, hI, hIm\u27e9 := exists_maximal_of_not_isField h\n exact \u27e8I, bot_lt_iff_ne_bot.mpr hI, lt_top_iff_ne_top.mpr hIm.ne_top\u27e9", "-- Mathlib.RingTheory.Ideal.Colon.colon_bot (L120-L129)\nlemma colon_bot : N.colon ((\u22a5 : Submodule R M) : Set M) = \u22a4 := by\nsimp\n\nend Semiring\n\nsection CommSemiring\n\nvariable [CommSemiring R] [AddCommMonoid M] [Module R M]\nvariable {N N' : Submodule R M} {S : Set M}", "-- Mathlib.RingTheory.Ideal.Colon.colon_finsetInf (L97-L100)\nlemma colon_finsetInf {\u03b9 : Type*} (s : Finset \u03b9) (f : \u03b9 \u2192 Submodule R M) :\n (s.inf f).colon S = s.inf (fun i \u21a6 (f i).colon S) := by\naesop (add simp mem_colon)", "-- Mathlib.RingTheory.Ideal.BigOperators.sum_mem (L29-L33)\ntheorem sum_mem (I : Ideal \u03b1) {\u03b9 : Type*} {t : Finset \u03b9} {f : \u03b9 \u2192 \u03b1} :\n (\u2200 c \u2208 t, f c \u2208 I) \u2192 (\u2211 i \u2208 t, f i) \u2208 I :=\nSubmodule.sum_mem I\n\nend Ideal", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.preimage_comap_associatedPrimes_eq_associatedPrimes_of_isLocalizedModule (L122-L130)\nlemma preimage_comap_associatedPrimes_eq_associatedPrimes_of_isLocalizedModule\n [IsNoetherianRing R] :\n (Ideal.comap (algebraMap R R')) \u207b\u00b9' (associatedPrimes R M) = associatedPrimes R' M' := by\next p\n exact \u27e8mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule S f p,\n fun h \u21a6 comap_mem_associatedPrimes_of_mem_associatedPrimes_of_isLocalizedModule_of_fg S f p h\n ((isNoetherianRing_iff_ideal_fg R).mp \u2039_\u203a _)\u27e9\n\nvariable (R M) in", "-- Mathlib.RingTheory.Ideal.Basic.span_range_pow_eq_top (L186-L195)\ntheorem span_range_pow_eq_top (s : Set \u03b1) (hs : span s = \u22a4) (n : s \u2192 \u2115) :\n span (Set.range fun x \u21a6 x.1 ^ n x) = \u22a4 := by\nhave \u27e8t, hts, mem\u27e9 := Submodule.mem_span_finite_of_mem_span ((eq_top_iff_one _).mp hs)\n refine top_unique ((span_pow_eq_top _ ((eq_top_iff_one _).mpr mem) <|\n t.attach.sup fun x \u21a6 n \u27e8x, hts x.2\u27e9).ge.trans <| span_le.mpr ?_)\n rintro _ \u27e8x, hxt, rfl\u27e9\n rw [\u2190 Nat.sub_add_cancel (Finset.le_sup <| t.mem_attach \u27e8x, hxt\u27e9)]\n simp_rw [pow_add]\n exact mul_mem_left _ _ (subset_span \u27e8_, rfl\u27e9)", "-- Mathlib.RingTheory.Ideal.Basic.pow_multiset_sum_mem_span_pow (L128-L154)\ntheorem pow_multiset_sum_mem_span_pow [DecidableEq \u03b1] (s : Multiset \u03b1) (n : \u2115) :\n s.sum ^ (Multiset.card s * n + 1) \u2208\n span ((s.map fun (x : \u03b1) \u21a6 x ^ (n + 1)).toFinset : Set \u03b1) := by\ninduction s using Multiset.induction_on with\n | empty => simp\n | cons a s hs => ?_\n simp only [Finset.coe_insert, Multiset.map_cons, Multiset.toFinset_cons, Multiset.sum_cons,\n Multiset.card_cons, add_pow]\n refine Submodule.sum_mem _ ?_\n intro c _hc\n rw [mem_span_insert]\n by_cases! h : n + 1 \u2264 c\n \u00b7 refine \u27e8a ^ (c - (n + 1)) * s.sum ^ ((Multiset.card s + 1) * n + 1 - c) *\n ((Multiset.card s + 1) * n + 1).choose c, 0, Submodule.zero_mem _, ?_\u27e9\n rw [mul_comm _ (a ^ (n + 1))]\n simp_rw [\u2190 mul_assoc]\n rw [\u2190 pow_add, add_zero, add_tsub_cancel_of_le h]\n \u00b7 use 0\n simp_rw [zero_mul, zero_add]\n refine \u27e8_, ?_, rfl\u27e9\n replace h : c \u2264 n := Nat.lt_succ_iff.mp h\n have : (Multiset.card s + 1) * n + 1 - c = Multiset.card s * n + 1 + (n - c) := by\n rw [add_mul, one_mul, add_assoc, add_comm n 1, \u2190 add_assoc, add_tsub_assoc_of_le h]\n rw [this, pow_add]\n simp_rw [mul_assoc, mul_comm (s.sum ^ (Multiset.card s * n + 1)), \u2190 mul_assoc]\n exact mul_mem_left _ _ hs", "-- Mathlib.RingTheory.Ideal.Colon.colon_eq_top_iff_subset (L85-L87)\nlemma colon_eq_top_iff_subset (S : Set M) : N.colon S = \u22a4 \u2194 S \u2286 N := by\naesop (add simp [mem_colon, Ideal.eq_top_iff_one])", "-- Mathlib.RingTheory.Ideal.Basic.span_single_eq_top (L203-L232)\nlemma span_single_eq_top {\u03b9 : Type*} [DecidableEq \u03b9] [Finite \u03b9] (R : \u03b9 \u2192 Type*)\n [\u2200 i, Semiring (R i)] : Ideal.span (Set.range fun i \u21a6 (Pi.single i 1 : \u03a0 i, R i)) = \u22a4 := by\nrw [_root_.eq_top_iff]\n rintro x -\n induction x using Pi.single_induction with\n | zero => simp\n | add f g hf hg => exact Ideal.add_mem _ hf hg\n | single i r =>\n rw [show Pi.single i r = Pi.single i r * Pi.single i 1 by simp [\u2190 Pi.single_mul_left]]\n exact Ideal.mul_mem_left _ _ (Ideal.subset_span \u27e8i, rfl\u27e9)\n\nend Ideal\n\nend CommSemiring\n\nsection DivisionSemiring\n\nvariable {K : Type*} [DivisionSemiring K] (I : Ideal K)\n\nnamespace Ideal\n\nvariable (K) in\n/-- A bijection between (left) ideals of a division ring and `{0, 1}`, sending `\u22a5` to `0`\nand `\u22a4` to `1`. -/\nnoncomputable def equivFinTwo : Ideal K \u2243 Fin 2 where\n toFun := fun I \u21a6 if I = \u22a5 then 0 else 1\n invFun := ![\u22a5, \u22a4]\n left_inv := fun I \u21a6 by rcases eq_bot_or_top I with rfl | rfl <;> simp\n right_inv := fun i \u21a6 by fin_cases i <;> simp", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.IsAssociatedPrime (L98-L102)\ndef IsAssociatedPrime : Prop :=\n(\u22a5 : Submodule R M).IsAssociatedPrime I\n\nvariable (R) in\n/-- The set of associated primes of a module. -/", "-- Mathlib.RingTheory.Ideal.Colon.bot_colon (L64-L67)\ntheorem bot_colon : colon (\u22a5 : Submodule R M) (N : Set M) = N.annihilator := by\next x\n simp [mem_colon, mem_annihilator]", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.biUnion_associatedPrimes_eq_compl_nonZeroDivisors (L240-L246)\ntheorem biUnion_associatedPrimes_eq_compl_nonZeroDivisors [IsNoetherianRing R] :\n \u22c3 p \u2208 associatedPrimes R R, p = (nonZeroDivisors R : Set R)\u1d9c :=\n(biUnion_associatedPrimes_eq_zero_divisors R R).trans <| by\n ext; simp [\u2190 nonZeroDivisorsLeft_eq_nonZeroDivisors, and_comm]\n\nvariable {R M}", "-- Mathlib.RingTheory.Ideal.Colon.top_colon (L102-L104)\nlemma top_colon : (\u22a4 : Submodule R M).colon S = \u22a4 := by\naesop (add simp mem_colon)", "-- Mathlib.RingTheory.Ideal.Colon.iInf_colon (L93-L95)\nlemma iInf_colon {\u03b9 : Sort*} (f : \u03b9 \u2192 Submodule R M) : (\u2a05 i, f i).colon S = \u2a05 i, (f i).colon S := by\naesop (add simp mem_colon)", "-- Mathlib.RingTheory.Ideal.Colon.inf_colon (L89-L91)\nlemma inf_colon : (N\u2081 \u2293 N\u2082).colon S = N\u2081.colon S \u2293 N\u2082.colon S := by\naesop (add simp mem_colon)", "-- Mathlib.RingTheory.Ideal.Basic.prod_mem (L196-L202)\ntheorem prod_mem {\u03b9 : Type*} {f : \u03b9 \u2192 \u03b1} {s : Finset \u03b9}\n (I : Ideal \u03b1) {i : \u03b9} (hi : i \u2208 s) (hfi : f i \u2208 I) :\n \u220f i \u2208 s, f i \u2208 I := by\nclassical\n rw [Finset.prod_eq_prod_diff_singleton_mul hi]\n exact Ideal.mul_mem_left _ _ hfi", "-- Mathlib.RingTheory.Ideal.Cotangent.toCotangent_eq_zero (L66-L67)\ntheorem toCotangent_eq_zero (x : I) : I.toCotangent x = 0 \u2194 (x : R) \u2208 I ^ 2 := I.mem_toCotangent_ker", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.LinearEquiv (L128-L132)\ntheorem LinearEquiv.isAssociatedPrime_iff (l : M \u2243\u2097[R] M') :\n IsAssociatedPrime I M \u2194 IsAssociatedPrime I M' :=\n\u27e8fun h => h.map_of_injective l l.injective,\n fun h => h.map_of_injective l.symm l.symm.injective\u27e9", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.associatedPrimes (L158-L169)\ntheorem associatedPrimes.finite : (associatedPrimes A M).Finite := by\ninduction \u2039Module.Finite A M\u203a using\n IsNoetherianRing.induction_on_isQuotientEquivQuotientPrime A with\n | subsingleton N => simp [associatedPrimes.eq_empty_of_subsingleton]\n | quotient N p f =>\n have := associatedPrimes.eq_singleton_of_isPrimary p.2.isPrimary\n simp [LinearEquiv.AssociatedPrimes.eq f, this]\n | exact N\u2081 N\u2082 N\u2083 f g hf _ hfg h\u2081 h\u2083 =>\n exact (h\u2081.union h\u2083).subset (associatedPrimes.subset_union_of_exact hf hfg)\n\n/-- Every maximal ideal of a commutative Noetherian total ring of fractions `A` is\nan associated prime of the `A`-module `A`. -/", "-- Mathlib.RingTheory.Ideal.Basic.add_pow_add_pred_mem_of_pow_mem (L123-L127)\ntheorem add_pow_add_pred_mem_of_pow_mem {m n : \u2115}\n (ha : a ^ m \u2208 I) (hb : b ^ n \u2208 I) :\n (a + b) ^ (m + n - 1) \u2208 I :=\nI.add_pow_add_pred_mem_of_pow_mem_of_commute ha hb (Commute.all ..)", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule (L40-L69)\nlemma mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule\n (p : Ideal R') (ass : p.comap (algebraMap R R') \u2208 associatedPrimes R M) :\n p \u2208 associatedPrimes R' M' := by\nrcases ass with \u27e8hp, x, hx\u27e9\n constructor\n \u00b7 refine (IsLocalization.isPrime_iff_isPrime_disjoint S _ _).mpr\n \u27e8hp, (IsLocalization.disjoint_comap_iff S R' p).mpr ?_\u27e9\n by_contra eqtop\n simp [eqtop, Ideal.comap_top, Ideal.isPrime_iff] at hp\n \u00b7 use f x\n ext t\n rcases IsLocalization.exists_mk'_eq S t with \u27e8r, s, hrs\u27e9\n simp_rw [\u2190 hrs, Ideal.mem_radical_iff, mem_colon_singleton, \u2190 IsLocalizedModule.mk'_one S f,\n \u2190 IsLocalization.mk'_pow, IsLocalizedModule.mk'_smul_mk', mul_one, mem_bot,\n IsLocalizedModule.mk'_eq_zero']\n refine \u27e8fun h \u21a6 exists_comm.mp \u27e81, ?_\u27e9, fun \u27e8n, t, ht\u27e9 \u21a6 ?_\u27e9\n \u00b7 simp only [\u2190 mem_colon_singleton, one_smul, \u2190 mem_bot R, \u2190 hx, \u2190 Ideal.mem_radical_iff]\n exact hSR'.mk'_mem_iff.mp h\n \u00b7 have : hSR'.mk' R' r s = hSR'.mk' R' (t.1 * r) 1 * hSR'.mk' R' 1 (t * s) := by\n rw [\u2190 hSR'.mk'_mul, mul_one, one_mul, \u2190 sub_eq_zero, \u2190 hSR'.mk'_sub, Submonoid.coe_mul]\n simp [\u2190 mul_assoc, mul_comm r t.1, IsLocalization.mk'_zero]\n rw [this]\n apply Ideal.IsTwoSided.mul_mem_of_left\n rw [IsLocalization.mk'_one, \u2190 Ideal.mem_comap, hx]\n rcases eq_zero_or_pos n with rfl | hn\n \u00b7 exact Ideal.IsTwoSided.mul_mem_of_left _ \u27e81, by simpa using ht\u27e9\n \u00b7 use n\n rw [mem_colon_singleton, mul_pow, mul_smul, \u2190 mem_colon_singleton]\n exact Ideal.pow_mem_of_mem _ (by simpa using ht) n hn", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.isAssociatedPrime_iff (L117-L120)\ntheorem isAssociatedPrime_iff [IsNoetherianRing R] :\n IsAssociatedPrime I M \u2194 I.IsPrime \u2227 \u2203 x : M, I = colon \u22a5 {x} :=\n(\u22a5 : Submodule R M).isAssociatedPrime_iff", "-- Mathlib.RingTheory.Ideal.Basic.add_pow_mem_of_pow_mem_of_le_of_commute (L83-L96)\ntheorem add_pow_mem_of_pow_mem_of_le_of_commute {m n k : \u2115}\n (ha : a ^ m \u2208 I) (hb : b ^ n \u2208 I) (hk : m + n \u2264 k + 1)\n (hab : Commute a b) :\n (a + b) ^ k \u2208 I := by\nsimp_rw [hab.add_pow, \u2190 Nat.cast_comm]\n apply I.sum_mem\n intro c _\n apply mul_mem_left\n by_cases h : m \u2264 c\n \u00b7 rw [hab.pow_pow]\n exact I.mul_mem_left _ (I.pow_mem_of_pow_mem ha h)\n \u00b7 refine I.mul_mem_left _ (I.pow_mem_of_pow_mem hb ?_)\n lia", "-- Mathlib.RingTheory.Ideal.Basic.add_pow_mem_of_pow_mem_of_le (L118-L122)\ntheorem add_pow_mem_of_pow_mem_of_le {m n k : \u2115}\n (ha : a ^ m \u2208 I) (hb : b ^ n \u2208 I) (hk : m + n \u2264 k + 1) :\n (a + b) ^ k \u2208 I :=\nI.add_pow_mem_of_pow_mem_of_le_of_commute ha hb hk (Commute.all ..)", "-- Mathlib.RingTheory.Ideal.Colon.colon_singleton_zero (L117-L119)\nlemma colon_singleton_zero : N.colon {0} = \u22a4 := by\nsimp", "-- Mathlib.RingTheory.Ideal.Cotangent.toCotangent (L51-L53)\ndef toCotangent : I \u2192\u2097[R] I.Cotangent := Submodule.mkQ _\nset_option backward.isDefEq.respectTransparency false in", "-- Mathlib.RingTheory.Ideal.Colon.colon_union (L106-L108)\nlemma colon_union : N.colon (S\u2081 \u222a S\u2082) = N.colon S\u2081 \u2293 N.colon S\u2082 := by\naesop (add simp mem_colon)", "-- Mathlib.RingTheory.Ideal.Colon.mem_colon_singleton (L48-L50)\ntheorem mem_colon_singleton {x : M} {r : R} : r \u2208 N.colon {x} \u2194 r \u2022 x \u2208 N := by\nsimp [mem_colon, forall_eq]", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.associatedPrimes (L103-L107)\ndef associatedPrimes : Set (Ideal R) :=\n{ I | IsAssociatedPrime I M }\n\nvariable {I J M} {M' : Type*} [AddCommMonoid M'] [Module R M'] (f : M \u2192\u2097[R] M')", "-- Mathlib.RingTheory.Ideal.Basic.span_pow_eq_top (L161-L185)\ntheorem span_pow_eq_top (s : Set \u03b1) (hs : span s = \u22a4) (n : \u2115) :\n span ((fun (x : \u03b1) => x ^ n) '' s) = \u22a4 := by\nrw [eq_top_iff_one]\n rcases n with - | n\n \u00b7 obtain rfl | \u27e8x, hx\u27e9 := eq_empty_or_nonempty s\n \u00b7 rw [Set.image_empty, hs]\n trivial\n \u00b7 exact subset_span \u27e8_, hx, pow_zero _\u27e9\n rw [eq_top_iff_one, span, Finsupp.mem_span_iff_linearCombination] at hs\n rcases hs with \u27e8f, hf\u27e9\n simp only [Finsupp.linearCombination, Finsupp.coe_lsum, Finsupp.sum, LinearMap.coe_smulRight,\n LinearMap.id_coe, id_eq, smul_eq_mul] at hf\n have := sum_pow_mem_span_pow f.support (fun a => f a * a) n\n rw [hf, one_pow] at this\n refine span_le.mpr ?_ this\n rintro _ hx\n simp_rw [Set.mem_image] at hx\n rcases hx with \u27e8x, _, rfl\u27e9\n have : span ({(x : \u03b1) ^ (n + 1)} : Set \u03b1) \u2264 span ((fun x : \u03b1 => x ^ (n + 1)) '' s) := by\n rw [span_le, Set.singleton_subset_iff]\n exact subset_span \u27e8x, x.prop, rfl\u27e9\n refine this ?_\n rw [mul_pow, mem_span_singleton]\n exact \u27e8f x ^ (n + 1), mul_comm _ _\u27e9", "-- Mathlib.RingTheory.Ideal.Colon.colon_iUnion (L110-L112)\nlemma colon_iUnion {\u03b9 : Sort*} (f : \u03b9 \u2192 Set M) : N.colon (\u22c3 i, f i) = \u2a05 i, N.colon (f i) := by\naesop (add simp mem_colon)", "-- Mathlib.RingTheory.Ideal.Basic.isField_iff_isSimpleOrder_ideal (L292-L302)\ntheorem isField_iff_isSimpleOrder_ideal : IsField R \u2194 IsSimpleOrder (Ideal R) := by\ncases subsingleton_or_nontrivial R\n \u00b7 exact\n \u27e8fun h => (not_isField_of_subsingleton _ h).elim, fun h =>\n (false_of_nontrivial_of_subsingleton <| Ideal R).elim\u27e9\n rw [\u2190 not_iff_not, Ring.not_isField_iff_exists_ideal_bot_lt_and_lt_top]\n contrapose! +distrib\n simp_rw [not_lt_top_iff, not_bot_lt_iff]\n exact \u27e8fun h => \u27e8h\u27e9, fun h => h.2\u27e9\n\n/-- When a ring is not a field, the maximal ideals are nontrivial. -/", "-- Mathlib.RingTheory.Ideal.Basic.isSimpleOrder (L237-L249)\ninstance isSimpleOrder : IsSimpleOrder (Ideal K) :=\n\u27e8eq_bot_or_top\u27e9\n\nend Ideal\n\nend DivisionSemiring\n\n-- TODO: consider moving the lemmas below out of the `Ring` namespace since they are\n-- about `CommSemiring`s.\nnamespace Ring\n\nvariable {R : Type*} [CommSemiring R]", "-- Mathlib.RingTheory.Ideal.Colon.mem_colon (L45-L46)\ntheorem mem_colon {r} : r \u2208 N.colon S \u2194 \u2200 s \u2208 S, r \u2022 s \u2208 N := Set.smul_set_subset_iff", "-- Mathlib.RingTheory.Ideal.Basic.ne_bot_of_isMaximal_of_not_isField (L303-L314)\ntheorem ne_bot_of_isMaximal_of_not_isField [Nontrivial R] {M : Ideal R} (max : M.IsMaximal)\n (not_field : \u00acIsField R) : M \u2260 \u22a5 := by\nrintro rfl\n obtain \u27e8I, hIbot, hItop\u27e9 := not_isField_iff_exists_ideal_bot_lt_and_lt_top.mp not_field\n exact hIbot.ne (max.eq_of_le hItop.ne bot_le)\n\nend Ring\n\nnamespace Ideal\n\nvariable {R : Type*} [CommSemiring R] [Nontrivial R]", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.not_isAssociatedPrime_of_subsingleton (L133-L138)\ntheorem not_isAssociatedPrime_of_subsingleton [Subsingleton M] : \u00acIsAssociatedPrime I M := by\nrintro \u27e8hI, x, hx\u27e9\n apply hI.ne_top\n simp [hx, Subsingleton.elim x 0]\n\nvariable (R) in", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.prod (L206-L211)\ntheorem prod : associatedPrimes R (M \u00d7 M') = associatedPrimes R M \u222a associatedPrimes R M' :=\n(subset_union_of_exact LinearMap.inl_injective .inl_snd).antisymm (Set.union_subset_iff.2\n \u27e8subset_of_injective LinearMap.inl_injective, subset_of_injective LinearMap.inr_injective\u27e9)\n\nend associatedPrimes", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.Submodule (L51-L55)\ndef Submodule.IsQuotientEquivQuotientPrime (N\u2081 N\u2082 : Submodule A M) :=\nN\u2081 \u2264 N\u2082 \u2227 \u2203 (p : PrimeSpectrum A), Nonempty ((\u21a5N\u2082 \u29f8 N\u2081.submoduleOf N\u2082) \u2243\u2097[A] A \u29f8 p.1)\n\nset_option backward.isDefEq.respectTransparency false in\nopen LinearMap in", "-- Mathlib.RingTheory.Ideal.Cotangent.Cotangent (L41-L49)\ndef Cotangent : Type _ := I \u29f8 (I \u2022 \u22a4 : Submodule R I)\nderiving Inhabited, AddCommGroup, Module (R \u29f8 I)\n\nderiving instance Module S, IsScalarTower S S' for Cotangent I\n\nvariable [IsNoetherian R I] in\nderiving instance IsNoetherian R for Cotangent I\n\n/-- The quotient map from `I` to `I \u29f8 I ^ 2`. -/", "-- Mathlib.RingTheory.Ideal.Colon.annihilator_quotient (L175-L181)\ntheorem annihilator_quotient : Module.annihilator R (M \u29f8 N) = N.colon Set.univ := by\next r\n have htop : (\u22a4 : Submodule R (M \u29f8 N)) = (\u22a4 : Submodule R M).map N.mkQ := by\n simpa [map_top] using (LinearMap.range_eq_top.mpr (mkQ_surjective N)).symm\n rw [\u2190 annihilator_top (R := R) (M := M \u29f8 N), htop,\n annihilator_map_mkQ_eq_colon (N := N) (P := \u22a4), Submodule.top_coe]", "-- Mathlib.RingTheory.Ideal.Colon.colon_mono (L68-L70)\ntheorem colon_mono (hn : N\u2081 \u2264 N\u2082) (hs : S\u2081 \u2286 S\u2082) : N\u2081.colon S\u2082 \u2264 N\u2082.colon S\u2081 :=\nfun _ hrns \u21a6 mem_colon.mpr fun s\u2081 hs\u2081 \u21a6 hn <| mem_colon.mp hrns s\u2081 <| hs hs\u2081", "-- Mathlib.RingTheory.Ideal.Basis.constr_basisSpanSingleton (L46-L54)\ntheorem constr_basisSpanSingleton {N : Type*} [Semiring N] [Module N S] [SMulCommClass R N S]\n (b : Basis \u03b9 R S) {x : S} (hx : x \u2260 0) :\n (b.constr N).toFun (((\u2191) : _ \u2192 S) \u2218 (basisSpanSingleton b hx)) = Algebra.lmul R S x :=\nb.ext fun i => by simp\n\nend Ideal\n\n/-- If `I : Ideal S` has a basis over `R`,\n`x \u2208 I` iff it is a linear combination of basis vectors. -/", "-- Mathlib.RingTheory.Ideal.Basic.exists_not_isUnit_of_not_isField (L250-L258)\ntheorem exists_not_isUnit_of_not_isField [Nontrivial R] (hf : \u00acIsField R) :\n \u2203 (x : R) (_hx : x \u2260 (0 : R)), \u00acIsUnit x := by\nhave : \u00ac_ := fun h => hf \u27e8exists_pair_ne R, mul_comm, h\u27e9\n simp_rw [isUnit_iff_exists_inv]\n push Not at this \u22a2\n obtain \u27e8x, hx, not_unit\u27e9 := this\n exact \u27e8x, hx, not_unit\u27e9\n\nopen Ideal in", "-- Mathlib.RingTheory.Ideal.Basic.bot_lt_of_maximal (L315-L318)\ntheorem bot_lt_of_maximal (M : Ideal R) [hm : M.IsMaximal] (non_field : \u00acIsField R) : \u22a5 < M :=\n(Ring.ne_bot_of_isMaximal_of_not_isField hm non_field).bot_lt\n\nend Ideal", "-- Mathlib.RingTheory.Ideal.Colon.mem_colon' (L131-L133)\ntheorem mem_colon' {r} : r \u2208 N.colon S \u2194 S \u2264 comap (r \u2022 (LinearMap.id : M \u2192\u2097[R] M)) N :=\nmem_colon", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.minimalPrimes_annihilator_subset_associatedPrimes (L131-L150)\nlemma minimalPrimes_annihilator_subset_associatedPrimes [IsNoetherianRing R] [Module.Finite R M] :\n (Module.annihilator R M).minimalPrimes \u2286 associatedPrimes R M := by\nintro p hp\n have prime := hp.1.1\n let R\u209a := Localization.AtPrime p\n have : Nontrivial (LocalizedModule p.primeCompl M) := by\n simpa [\u2190 Module.mem_support_iff (p := \u27e8p, prime\u27e9), Module.support_eq_zeroLocus] using hp.1.2\n rcases associatedPrimes.nonempty R\u209a (LocalizedModule p.primeCompl M) with \u27e8q, hq\u27e9\n have q_prime : q.IsPrime := IsAssociatedPrime.isPrime hq\n simp only [\u2190 preimage_comap_associatedPrimes_eq_associatedPrimes_of_isLocalizedModule p.primeCompl\n R\u209a (LocalizedModule.mkLinearMap p.primeCompl M), Set.mem_preimage] at hq\n have ann_le : Module.annihilator R M \u2264 Ideal.comap (algebraMap R R\u209a) q :=\n le_of_eq_of_le Submodule.annihilator_top.symm (IsAssociatedPrime.annihilator_le hq)\n have le : Ideal.comap (algebraMap R R\u209a) q \u2264 p := by\n have := (IsLocalization.disjoint_comap_iff p.primeCompl R\u209a q).mpr q_prime.ne_top\n simpa only [Ideal.primeCompl, Submonoid.coe_set_mk, Subsemigroup.coe_set_mk,\n Set.disjoint_compl_left_iff_subset] using this\n simpa [Minimal.eq_of_le hp.out \u27e8IsAssociatedPrime.isPrime hq, ann_le\u27e9 le] using hq\n\nend Module.associatedPrimes", "-- Mathlib.RingTheory.Ideal.Colon.mem_colon_span_singleton (L154-L156)\ntheorem mem_colon_span_singleton {x : M} {r : R} : r \u2208 N.colon (span R {x}) \u2194 r \u2022 x \u2208 N := by\nsimp", "-- Mathlib.RingTheory.Ideal.Basic.mem_pi (L56-L58)\ntheorem mem_pi (r : \u03a0 i, R i) : r \u2208 pi I \u2194 \u2200 i, r i \u2208 I i :=\nIff.rfl", "-- Mathlib.RingTheory.Ideal.Colon.iInf_colon_iUnion (L74-L77)\ntheorem iInf_colon_iUnion (\u03b9\u2081 : Sort*) (f : \u03b9\u2081 \u2192 Submodule R M) (\u03b9\u2082 : Sort*) (g : \u03b9\u2082 \u2192 Set M) :\n (\u2a05 i, f i).colon (\u22c3 j, g j) = \u2a05 (i) (j), (f i).colon (g j) := by\naesop (add simp mem_colon)", "-- Mathlib.RingTheory.Ideal.Cotangent.toCotangent_eq (L62-L65)\ntheorem toCotangent_eq {x y : I} : I.toCotangent x = I.toCotangent y \u2194 (x - y : R) \u2208 I ^ 2 := by\nrw [\u2190 sub_eq_zero]\n exact I.mem_toCotangent_ker", "-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.IsNoetherianRing (L92-L117)\ntheorem IsNoetherianRing.exists_relSeries_isQuotientEquivQuotientPrime :\n \u2203 s : RelSeries {(N\u2081, N\u2082) | Submodule.IsQuotientEquivQuotientPrime (A := A) (M := M) N\u2081 N\u2082},\ns.head = \u22a5 \u2227 s.last = \u22a4 := by\n refine WellFoundedGT.induction_top \u27e8\u22a5, .singleton _ \u22a5, rfl, rfl\u27e9 ?_\n rintro N hN \u27e8s, hs\u2081, hs\u2082\u27e9\n have := Submodule.Quotient.nontrivial_iff.mpr hN\n obtain \u27e8p, hp\u27e9 := associatedPrimes.nonempty A (M \u29f8 N)\n rw [AssociatedPrimes.mem_iff, isAssociatedPrime_iff] at hp\n obtain \u27e8hp, x, rfl\u27e9 := hp\n obtain \u27e8x, rfl\u27e9 := Submodule.mkQ_surjective _ x\n have hxN : x \u2209 N := fun h \u21a6 hp.ne_top (by rw [show N.mkQ x = 0 by simpa]; simp)\n have := Submodule.isQuotientEquivQuotientPrime_iff.mpr \u27e8x, hp, rfl\u27e9\n refine \u27e8_, by simpa [hs\u2082], s.snoc _ (hs\u2082 \u25b8 this), by simpa, rfl\u27e9\n\n/-- If a property on finitely generated modules over a Noetherian ring satisfies that:\n\n- it holds for zero module (it's formalized as it holds for any module which is subsingleton),\n- it holds for `A \u29f8 p` for every prime ideal `p` of `A` (to avoid universe problem,\n it's formalized as it holds for any module isomorphic to `A \u29f8 p`),\n- it is stable by short exact sequences,\n\nthen the property holds for every finitely generated modules.\n\nNOTE: This should be the induction principle for `M`, but due to the bug\nhttps://github.com/leanprover/lean4/issues/4246\ncurrently it is induction for `Module.Finite A M`. -/", "-- Mathlib.RingTheory.Ideal.Basic.not_isField_of_ne_of_ne (L271-L275)\ntheorem not_isField_of_ne_of_ne [Nontrivial R] {I : Ideal R} (h_bot : I \u2260 \u22a5) (h_top : I \u2260 \u22a4) :\n \u00ac IsField R := by\ncontrapose! h_bot\n exact ((isField_iff_maximal_bot.mp h_bot).eq_of_le h_top bot_le).symm"], "source_grounded_context_enriched": false, "statement": "lemma Ideal.height_le_ringKrullDim_quotient_add_one {r : R} {p : Ideal R} [p.IsPrime]\n (hrp : r \u2208 p) : p.height \u2264 ringKrullDim (R \u29f8 span {r}) + 1", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 41328, "declarations_count": 4291, "diagnostics_count": 0, "duplicate_fingerprint": "99f43078d555e7c2", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 16024, "lean_code_chars": 38573, "lean_code_ratio": 0.9333, "length_bucket": "long", "line_count": 1114, "natural_language_chars": 2755, "near_duplicate_cluster_id": "", "provenance_complete": true, "retrieval_snippets_count": 86, "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.RingTheory.Ideal.KrullsHeightTheorem).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma Ideal.height_le_ringKrullDim_quotient_add_one {r : R} {p : Ideal R} [p.IsPrime]\n (hrp : r \u2208 p) : p.height \u2264 ringKrullDim (R \u29f8 span {r}) + 1\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.RingTheory.Ideal.KrullsHeightTheorem.IsLocalRing (L48-L58)\nlemma IsLocalRing.quotient_artinian_of_mem_minimalPrimes_of_isLocalRing\n [IsLocalRing R] (I : Ideal R) (hp : IsLocalRing.maximalIdeal R \u2208 I.minimalPrimes) :\n IsArtinianRing (R \u29f8 I) :=\nhave : Ring.KrullDimLE 0 (R \u29f8 I) := Ring.krullDimLE_zero_iff.mpr fun J prime \u21a6\n Ideal.isMaximal_of_isIntegral_of_isMaximal_comap _ <| by\n convert IsLocalRing.maximalIdeal.isMaximal R\n rw [Ideal.minimalPrimes, Set.mem_setOf] at hp\n have := prime.comap (Ideal.Quotient.mk I)\n exact hp.eq_of_le \u27e8this, .trans (by simp) (Ideal.ker_le_comap _)\u27e9 (le_maximalIdeal this.1)\n IsNoetherianRing.isArtinianRing_of_krullDimLE_zero\n```\n\n-- snippet 2\n```lean\n-- Mathlib.RingTheory.Ideal.KrullsHeightTheorem.height_le_ringKrullDim_quotient_add_spanFinrank (L343-L351)\nlemma height_le_ringKrullDim_quotient_add_spanFinrank {p I : Ideal R} [p.IsPrime] (h : I \u2264 p) :\n p.height \u2264 ringKrullDim (R \u29f8 I) + I.spanFinrank := by\ntrans (p.map (Ideal.Quotient.mk I)).height + I.spanFinrank\n \u00b7 norm_cast; exact Ideal.height_le_height_add_spanFinrank_of_le h\n \u00b7 gcongr\n have : (Ideal.map (Ideal.Quotient.mk I) p).IsPrime :=\n Ideal.isPrime_map_quotientMk_of_isPrime h\n exact Ideal.height_le_ringKrullDim_of_ne_top Ideal.IsPrime.ne_top'\n```\n\n-- snippet 3\n```lean\n-- Mathlib.RingTheory.Ideal.KrullsHeightTheorem.ringKrullDim_le_ringKrullDim_quotient_add_spanFinrank (L352-L362)\nlemma ringKrullDim_le_ringKrullDim_quotient_add_spanFinrank (I : Ideal R)\n (h : I \u2264 Ring.jacobson R) :\n ringKrullDim R \u2264 ringKrullDim (R \u29f8 I) + I.spanFinrank := by\nnontriviality R\n rw [ringKrullDim_le_iff_isMaximal_height_le]\n intro m hm\n exact height_le_ringKrullDim_quotient_add_spanFinrank <|\n le_trans h <| Ring.jacobson_le_of_isMaximal m\n\n/-- If `p` is a prime ideal containing `s`, the height of `p` is bounded\nby the sum of the height of the image of `p` in `R \u29f8 (s)` and the cardinality of `s`. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.RingTheory.Ideal.KrullsHeightTheorem.ringKrullDim_le_ringKrullDim_quotient_add_encard (L386-L391)\nlemma ringKrullDim_le_ringKrullDim_quotient_add_encard (s : Set R) (hs : s \u2286 Ring.jacobson R) :\n ringKrullDim R \u2264 ringKrullDim (R \u29f8 Ideal.span s) + s.encard := by\nrefine le_trans (ringKrullDim_le_ringKrullDim_quotient_add_spanFinrank (Ideal.span s) ?_) ?_\n \u00b7 simpa [Ideal.span_le]\n \u00b7 gcongr; norm_cast; exact Submodule.spanFinrank_span_le_encard _\n```\n\n-- snippet 5\n```lean\n-- Mathlib.RingTheory.Ideal.KrullsHeightTheorem.ringKrullDim_le_ringKrullDim_quotient_add_card (L392-L407)\nlemma ringKrullDim_le_ringKrullDim_quotient_add_card (s : Finset R)\n (hs : (s : Set R) \u2286 Ring.jacobson R) :\n ringKrullDim R \u2264 ringKrullDim (R \u29f8 Ideal.span (s : Set R)) + s.card := by\nconvert ringKrullDim_le_ringKrullDim_quotient_add_encard s hs\n norm_cast\n\nsection Algebra\n\nvariable {S : Type*} [CommRing S] [Algebra R S]\n\n/--\nIf `P` lies over `p`, the height of `P` is bounded by the height of `p` plus\nthe height of the image of `P` in `S \u29f8 p S`.\nEquality holds if `S` satisfies going-down as an `R`-algebra\n(see `Ideal.height_eq_height_add_of_liesOver_of_hasGoingDown`).\n-/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.RingTheory.Ideal.KrullsHeightTheorem.ringKrullDim_le_spanFinrank_maximalIdeal (L474-L480)\nlemma ringKrullDim_le_spanFinrank_maximalIdeal [IsLocalRing R] :\n ringKrullDim R \u2264 (IsLocalRing.maximalIdeal R).spanFinrank :=\nle_of_eq_of_le IsLocalRing.maximalIdeal_height_eq_ringKrullDim.symm\n (WithBot.coe_le_coe.mpr (Ideal.height_le_spanFinrank (IsLocalRing.maximalIdeal R)\n Ideal.IsPrime.ne_top'))\n\nend Algebra\n```\n\n-- snippet 7\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.single_mem_pi (L67-L72)\ntheorem single_mem_pi [DecidableEq \u03b9] {i : \u03b9} {r : R i} (hr : r \u2208 I i) : Pi.single i r \u2208 pi I := by\nintro j\n obtain rfl | ne := eq_or_ne i j\n \u00b7 simpa\n \u00b7 simp [ne]\n```\n\n-- snippet 8\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.bot_colon' (L138-L140)\ntheorem bot_colon' : (\u22a5 : Submodule R M).colon S = (span R S).annihilator := by\naesop (add simp [mem_colon, mem_annihilator_span])\n```\n\n-- snippet 9\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.AssociatedPrimes (L108-L109)\ntheorem AssociatedPrimes.mem_iff : I \u2208 associatedPrimes R M \u2194 IsAssociatedPrime I M := Iff.rfl\n```\n\n-- snippet 10\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.isField_iff_maximal_bot (L259-L264)\ntheorem isField_iff_maximal_bot [Nontrivial R] : IsField R \u2194 (\u22a5 : Ideal R).IsMaximal := by\nrefine \u27e8fun h \u21a6 let := h.toSemifield; bot_isMaximal, fun hmax \u21a6 ?_\u27e9\n by_contra hf\n obtain \u27e8x, hx0, hxu\u27e9 := exists_not_isUnit_of_not_isField hf\n exact hx0 <| span_singleton_eq_bot.mp (hmax.eq_of_le (span_singleton_ne_top hxu) bot_le).symm\n```\n\n-- snippet 11\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.subset_union_of_exact (L171-L204)\ntheorem subset_union_of_exact (hf : Function.Injective f) (hfg : Function.Exact f g) :\n associatedPrimes R M' \u2286 associatedPrimes R M \u222a associatedPrimes R M'' := by\nrintro p \u27e8_, x, hx\u27e9\n by_cases! h : \u2203 a \u2208 p.primeCompl, \u2203 y : M, \u2203 k, f y = a ^ k \u2022 x\n \u00b7 obtain \u27e8a, ha, y, k, h\u27e9 := h\n left\n refine \u27e8\u2039_\u203a, y, le_antisymm (fun b hb \u21a6 ?_) (fun b \u27e8n, hb\u27e9 \u21a6 ?_)\u27e9\n \u00b7 rw [hx] at hb\n obtain \u27e8n, hb\u27e9 := hb\n use n\n rw [mem_colon_singleton, mem_bot] at hb \u22a2\n apply_fun _ using hf\n rw [map_smul, h, smul_comm, hb, smul_zero, map_zero]\n \u00b7 rw [mem_colon_singleton, mem_bot] at hb\n apply_fun f at hb\n rw [map_smul, map_zero, h, \u2190 mul_smul, \u2190 mem_bot R, \u2190 mem_colon_singleton] at hb\n replace hb := hx.ge (Ideal.le_radical hb)\n contrapose hb\n exact p.primeCompl.mul_mem (p.primeCompl.pow_mem hb n) (p.primeCompl.pow_mem ha k)\n \u00b7 right\n refine \u27e8\u2039_\u203a, g x, le_antisymm (fun b hb \u21a6 ?_) (fun b \u27e8n, hb\u27e9 \u21a6 ?_)\u27e9\n \u00b7 rw [hx] at hb\n refine Ideal.radical_mono (fun b hb \u21a6 ?_) hb\n rw [mem_colon_singleton, mem_bot] at hb \u22a2\n rw [\u2190 map_smul, hb, map_zero]\n \u00b7 rw [mem_colon_singleton, mem_bot, \u2190 map_smul, \u2190 LinearMap.mem_ker,\n hfg.linearMap_ker_eq] at hb\n obtain \u27e8y, hy\u27e9 := hb\n by_contra H\n exact h b H y n hy\n\nvariable (R M M') in\n/-- The set of associated primes of the product of two modules is equal to\nthe union of those of the two modules. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_empty (L114-L116)\nlemma colon_empty : N.colon (\u2205 : Set M) = \u22a4 := by\naesop (add simp mem_colon)\n```\n\n-- snippet 13\n```lean\n-- Mathlib.RingTheory.Ideal.Cotangent.map_toCotangent_ker (L54-L57)\ntheorem map_toCotangent_ker : (LinearMap.ker I.toCotangent).map I.subtype = I ^ 2 := by\nrw [Ideal.toCotangent, Submodule.ker_mkQ, pow_two, Submodule.map_smul'' I \u22a4 (Submodule.subtype I),\n smul_eq_mul, Submodule.map_subtype_top]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.exists_maximal_of_not_isField (L265-L270)\ntheorem exists_maximal_of_not_isField [Nontrivial R] (h : \u00ac IsField R) :\n \u2203 p : Ideal R, p \u2260 \u22a5 \u2227 p.IsMaximal := by\ncontrapose! h\n simp only [\u2190 bot_lt_iff_ne_bot] at h\n refine isField_iff_maximal_bot.mpr \u27e8\u27e8bot_ne_top, Ideal.maximal_of_no_maximal h\u27e9\u27e9\n```\n\n-- snippet 15\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_span (L142-L149)\ntheorem colon_span : N.colon (span R S) = N.colon S := by\nrefine (colon_mono le_rfl subset_span).antisymm fun r h \u21a6 mem_colon.mpr fun s hs \u21a6 ?_\n induction hs using Submodule.span_induction with\n | mem => aesop (add simp mem_colon)\n | zero => simp\n | add => aesop\n | smul => simp_all [smul_mem, smul_comm r]\n```\n\n-- snippet 16\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.add_pow_add_pred_mem_of_pow_mem_of_commute (L97-L117)\ntheorem add_pow_add_pred_mem_of_pow_mem_of_commute {m n : \u2115}\n (ha : a ^ m \u2208 I) (hb : b ^ n \u2208 I) (hab : Commute a b) :\n (a + b) ^ (m + n - 1) \u2208 I :=\nI.add_pow_mem_of_pow_mem_of_le_of_commute ha hb (by rw [\u2190 Nat.sub_le_iff_le_add]) hab\n\nend Commute\n\nend Ideal\n\nend Semiring\n\nsection CommSemiring\n\nvariable {a b : \u03b1}\n\n-- A separate namespace definition is needed because the variables were historically in a different\n-- order.\nnamespace Ideal\n\nvariable [CommSemiring \u03b1] (I : Ideal \u03b1)\n```\n\n-- snippet 17\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.biUnion_associatedPrimes_eq_zero_divisors (L229-L239)\ntheorem biUnion_associatedPrimes_eq_zero_divisors [IsNoetherianRing R] :\n \u22c3 p \u2208 associatedPrimes R M, p = { r : R | \u2203 x : M, x \u2260 0 \u2227 r \u2022 x = 0 } := by\nsimp only [AssociatedPrimes.mem_iff, isAssociatedPrime_iff]\n refine subset_antisymm (Set.iUnion\u2082_subset ?_) ?_\n \u00b7 rintro _ \u27e8h, x, \u27e8\u27e9\u27e9 r h'\n exact \u27e8x, by simpa using h.ne_top, by simpa using h'\u27e9\n \u00b7 intro r \u27e8x, h, h'\u27e9\n obtain \u27e8P, hP, hx\u27e9 := exists_le_isAssociatedPrime_of_isNoetherianRing R x h\n rw [isAssociatedPrime_iff] at hP\n exact Set.mem_iUnion\u2082_of_mem hP (hx (by rwa [mem_colon_singleton]))\n```\n\n-- snippet 18\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.annihilator_map_mkQ_eq_colon (L169-L174)\nlemma annihilator_map_mkQ_eq_colon : annihilator (P.map N.mkQ) = N.colon (P : Set M) := by\next\n rw [mem_annihilator, mem_colon]\n exact \u27e8fun H p hp \u21a6 (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),\n fun H _ \u27e8p, hp, hpm\u27e9 \u21a6 hpm \u25b8 ((Quotient.mk_eq_zero N).2 <| H p hp)\u27e9\n```\n\n-- snippet 19\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon (L35-L44)\ndef colon (N : Submodule R M) (S : Set M) : Ideal R where\n carrier := {r : R | (r \u2022 S : Set M) \u2286 N}\nadd_mem' ha hb :=\n (Set.add_smul_subset _ _ _).trans ((Set.add_subset_add ha hb).trans_eq (by simp))\n zero_mem' := (Set.zero_smul_set_subset S).trans (by simp)\n smul_mem' r := by\n simp only [Set.mem_setOf_eq, smul_eq_mul, mul_smul, Set.smul_set_subset_iff]\n intro x hx y hy\n exact N.smul_mem _ (hx hy)\n```\n\n-- snippet 20\n```lean\n-- Mathlib.RingTheory.Ideal.Basis.Basis (L55-L61)\ntheorem Basis.mem_ideal_iff {\u03b9 R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]\n {I : Ideal S} (b : Basis \u03b9 R I) {x : S} :\n x \u2208 I \u2194 \u2203 c : \u03b9 \u2192\u2080 R, x = Finsupp.sum c fun i x => x \u2022 (b i : S) :=\n(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff\n\n/-- If `I : Ideal S` has a finite basis over `R`,\n`x \u2208 I` iff it is a linear combination of basis vectors. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.comap_mem_associatedPrimes_of_mem_associatedPrimes_of_isLocalizedModule_of_fg (L84-L120)\nlemma comap_mem_associatedPrimes_of_mem_associatedPrimes_of_isLocalizedModule_of_fg (p : Ideal R')\n (ass : p \u2208 associatedPrimes R' M') (fg : (p.comap (algebraMap R R')).FG) :\n p.comap (algebraMap R R') \u2208 associatedPrimes R M := by\nrcases ass with \u27e8hp, x, hx\u27e9\n rcases fg with \u27e8T, hT\u27e9\n rcases IsLocalizedModule.mk'_surjective S f x with \u27e8\u27e8m, s\u27e9, rfl\u27e9\n simp only [Function.uncurry_apply_pair] at hx\n have mem (a : T) : algebraMap R R' a \u2208 p := by\n simpa [\u2190 Ideal.mem_comap, \u2190 hT] using Ideal.subset_span a.2\n simp only [hx, Ideal.mem_radical_iff, mem_bot, mem_colon_singleton, \u2190 map_pow, algebraMap_smul,\n \u2190 IsLocalizedModule.mk'_smul, IsLocalizedModule.mk'_eq_zero' f] at mem\n choose e g hg using mem\n refine \u27e8.under R p, (\u220f a, g a).1 \u2022 m, le_antisymm ?_ fun r hr \u21a6 ?_\u27e9\n \u00b7 rw [\u2190 hT, Ideal.span_le]\n intro a ha\n simp only [SetLike.mem_coe, Ideal.mem_radical_iff, mem_bot, mem_colon_singleton]\n obtain \u27e8u, hu\u27e9 : g \u27e8a, ha\u27e9 \u2223 (\u220f a, g a) := by\n apply Finset.dvd_prod_of_mem g (Finset.mem_univ \u27e8a, ha\u27e9)\n use e \u27e8a, ha\u27e9\n rw [hu, Submonoid.coe_mul, smul_smul, \u2190 mul_assoc, mul_comm, \u2190 smul_smul, mul_comm, \u2190 smul_smul]\n exact smul_eq_zero_of_right u.1 (hg \u27e8a, ha\u27e9)\n \u00b7 simp only [Ideal.mem_radical_iff, mem_bot, mem_colon_singleton, smul_smul] at hr\n obtain \u27e8k, hk\u27e9 := hr\n have mem : r ^ k * (\u220f a, g a).1 \u2208 Ideal.comap (algebraMap R R') p := by\n rw [hx]\n use 1\n simp_rw [pow_one, mem_colon_singleton, algebraMap_smul, \u2190 IsLocalizedModule.mk'_smul,\n hk, IsLocalizedModule.mk'_zero, mem_bot]\n apply hp.mem_of_pow_mem k\n rw [\u2190 map_pow]\n exact ((hp.under R).mul_mem_iff_mem_or_mem.mp mem).resolve_right\n (Set.disjoint_left.mp ((IsLocalization.disjoint_comap_iff S R' p).mpr hp.1) (\u220f a, g a).2)\n\nvariable (R')\n\ninclude S f in\nopen Set in\n```\n\n-- snippet 22\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_univ (L57-L60)\ntheorem colon_univ {I : Ideal R} [I.IsTwoSided] : I.colon Set.univ = I := by\nsimp_rw [SetLike.ext_iff, mem_colon, smul_eq_mul]\n exact fun x \u21a6 \u27e8fun h \u21a6 mul_one x \u25b8 h 1 trivial, fun h _ _ \u21a6 I.mul_mem_right _ h\u27e9\n```\n\n-- snippet 23\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_inf_eq_left_of_subset (L81-L83)\nlemma colon_inf_eq_left_of_subset (h : S \u2286 (N\u2082 : Set M)) : (N\u2081 \u2293 N\u2082).colon S = N\u2081.colon S := by\naesop (add simp mem_colon)\n```\n\n-- snippet 24\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.exists_le_isAssociatedPrime_of_isNoetherianRing (L139-L163)\ntheorem exists_le_isAssociatedPrime_of_isNoetherianRing [H : IsNoetherianRing R] (x : M)\n (hx : x \u2260 0) : \u2203 P : Ideal R, IsAssociatedPrime P M \u2227 (\u22a5 : Submodule R M).colon {x} \u2264 P := by\nsimp only [isAssociatedPrime_iff]\n obtain \u27e8P, \u27e8l, h\u2081, y, rfl\u27e9, h\u2083\u27e9 :=\n set_has_maximal_iff_noetherian.mpr H\n { P | (\u22a5 : Submodule R M).colon {x} \u2264 P \u2227 P \u2260 \u22a4 \u2227 \u2203 y : M, P = (\u22a5 : Submodule R M).colon {y} }\n \u27e8_, rfl.le, by simpa, x, rfl\u27e9\n refine \u27e8_, \u27e8\u27e8h\u2081, ?_\u27e9, y, rfl\u27e9, l\u27e9\n intro a b hab\n rw [or_iff_not_imp_left]\n intro ha\n rw [mem_colon_singleton] at ha hab\n have H\u2081 : (\u22a5 : Submodule R M).colon {y} \u2264 (\u22a5 : Submodule R M).colon {a \u2022 y} := by\n intro c hc\n rw [mem_colon_singleton, mem_bot] at hc \u22a2\n rw [smul_comm, hc, smul_zero]\n rwa [H\u2081.eq_of_not_lt (h\u2083 _ \u27e8l.trans H\u2081, by simpa, _, rfl\u27e9),\n mem_colon_singleton, smul_comm, smul_smul]\n\nnamespace associatedPrimes\n\nvariable {f} {M'' : Type*} [AddCommMonoid M''] [Module R M''] {g : M' \u2192\u2097[R] M''}\n\n/-- If `M \u2192 M'` is injective, then the set of associated primes of `M` is\ncontained in that of `M'`. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.mem_associatedPrimes_atPrime_of_mem_associatedPrimes (L70-L77)\nlemma mem_associatedPrimes_atPrime_of_mem_associatedPrimes\n {p : Ideal R} [p.IsPrime] (ass : p \u2208 associatedPrimes R M) :\n maximalIdeal (Localization.AtPrime p) \u2208\n associatedPrimes (Localization.AtPrime p) (LocalizedModule.AtPrime p M) := by\napply mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule\n p.primeCompl (LocalizedModule.mkLinearMap p.primeCompl M)\n simpa [Localization.AtPrime.comap_maximalIdeal] using ass\n```\n\n-- snippet 26\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.sum_pow_mem_span_pow (L155-L160)\ntheorem sum_pow_mem_span_pow {\u03b9} (s : Finset \u03b9) (f : \u03b9 \u2192 \u03b1) (n : \u2115) :\n (\u2211 i \u2208 s, f i) ^ (s.card * n + 1) \u2208 span ((fun i => f i ^ (n + 1)) '' s) := by\nclassical\n simpa only [Multiset.card_map, Multiset.map_map, comp_apply, Multiset.toFinset_map,\n Finset.coe_image, Finset.val_toFinset] using pow_multiset_sum_mem_span_pow (s.1.map f) n\n```\n\n-- snippet 27\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.not_isField_iff_exists_prime (L282-L291)\ntheorem not_isField_iff_exists_prime [Nontrivial R] :\n \u00acIsField R \u2194 \u2203 p : Ideal R, p \u2260 \u22a5 \u2227 p.IsPrime := by\nrefine \u27e8fun h \u21a6 ?_, fun \u27e8I, h_bot, h_top\u27e9 \u21a6 not_isField_of_ne_of_ne h_bot h_top.ne_top\u27e9\n obtain \u27e8I, hI, hIm\u27e9 := exists_maximal_of_not_isField h\n exact \u27e8I, hI, hIm.isPrime\u27e9\n\n/-- Also see `Ideal.isSimpleOrder` for the forward direction as an instance when `R` is a\ndivision (semi)ring.\n\nThis result actually holds for all division semirings, but we lack the predicate to state it. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.isAssociatedPrime_iff_exists_injective_linearMap (L257-L267)\ntheorem isAssociatedPrime_iff_exists_injective_linearMap [IsNoetherianRing R] :\n IsAssociatedPrime I M \u2194 I.IsPrime \u2227 \u2203 (f : R \u29f8 I \u2192\u2097[R] M), Function.Injective f := by\nrw [isAssociatedPrime_iff, and_congr_right_iff]\n refine fun _ \u21a6 \u27e8fun \u27e8x, h\u27e9 \u21a6 ?_, fun \u27e8f, h\u27e9 \u21a6 \u27e8(f \u2218\u2097 mkQ I) 1, ?_\u27e9\u27e9\n \u00b7 replace h : I = ker (toSpanSingleton R M x) := by simp [h, SetLike.ext_iff]\n exact \u27e8liftQ _ _ h.le, ker_eq_bot.mp (ker_liftQ_eq_bot' _ _ h)\u27e9\n \u00b7 conv_lhs => rw [\u2190 I.ker_mkQ, \u2190 ker_comp_of_ker_eq_bot (mkQ I) (ker_eq_bot_of_injective h)]\n simp [SetLike.ext_iff, \u2190 Ideal.Quotient.algebraMap_eq, Algebra.algebraMap_eq_smul_one]\n\nvariable {I J M}\n```\n\n-- snippet 29\n```lean\n-- Mathlib.RingTheory.Ideal.Basis.basisSpanSingleton_apply (L39-L44)\ntheorem basisSpanSingleton_apply (b : Basis \u03b9 R S) {x : S} (hx : x \u2260 0) (i : \u03b9) :\n (basisSpanSingleton b hx i : S) = x * b i := by\nsimp only [basisSpanSingleton, Basis.map_apply, LinearEquiv.trans_apply,\n Submodule.restrictScalarsEquiv_apply, LinearEquiv.ofInjective_apply, LinearEquiv.coe_ofEq_apply,\n LinearEquiv.restrictScalars_apply, LinearMap.mulLeft_apply]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.pi (L50-L55)\ndef pi : Ideal (\u03a0 i, R i) where\n carrier := { r | \u2200 i, r i \u2208 I i }\nzero_mem' i := (I i).zero_mem\n add_mem' ha hb i := (I i).add_mem (ha i) (hb i)\n smul_mem' a _b hb i := (I i).mul_mem_left (a i) (hb i)\n```\n\n-- snippet 31\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.subset_of_injective (L165-L169)\ntheorem subset_of_injective (hf : Function.Injective f) :\n associatedPrimes R M \u2286 associatedPrimes R M' := fun _I h => h.map_of_injective f hf\n/-- If `0 \u2192 M \u2192 M' \u2192 M''` is an exact sequence, then the set of associated primes of `M'` is\ncontained in the union of those of `M` and `M''`. -/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.RingTheory.Ideal.Cotangent.mem_toCotangent_ker (L58-L61)\ntheorem mem_toCotangent_ker {x : I} : x \u2208 LinearMap.ker I.toCotangent \u2194 (x : R) \u2208 I ^ 2 := by\nrw [\u2190 I.map_toCotangent_ker]\n simp\n```\n\n-- snippet 33\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.mem_colon_iff_le (L134-L137)\ntheorem mem_colon_iff_le {r} : r \u2208 N.colon N' \u2194 r \u2022 N' \u2264 N := by\naesop (add simp SetLike.coe_subset_coe)\n\n/-- A variant for arbitrary sets in commutative semirings -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.RingTheory.Ideal.Cotangent.toCotangent_surjective (L68-L69)\ntheorem toCotangent_surjective : Function.Surjective I.toCotangent := Submodule.mkQ_surjective _\n```\n\n-- snippet 35\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.not_isField_iff_exists_ideal_bot_lt_and_lt_top (L276-L281)\ntheorem not_isField_iff_exists_ideal_bot_lt_and_lt_top [Nontrivial R] :\n \u00acIsField R \u2194 \u2203 I : Ideal R, \u22a5 < I \u2227 I < \u22a4 := by\nrefine \u27e8fun h \u21a6 ?_, fun \u27e8I, h_bot, h_top\u27e9 \u21a6 not_isField_of_ne_of_ne h_bot.ne' h_top.ne\u27e9\n obtain \u27e8I, hI, hIm\u27e9 := exists_maximal_of_not_isField h\n exact \u27e8I, bot_lt_iff_ne_bot.mpr hI, lt_top_iff_ne_top.mpr hIm.ne_top\u27e9\n```\n\n-- snippet 36\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_bot (L120-L129)\nlemma colon_bot : N.colon ((\u22a5 : Submodule R M) : Set M) = \u22a4 := by\nsimp\n\nend Semiring\n\nsection CommSemiring\n\nvariable [CommSemiring R] [AddCommMonoid M] [Module R M]\nvariable {N N' : Submodule R M} {S : Set M}\n```\n\n-- snippet 37\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_finsetInf (L97-L100)\nlemma colon_finsetInf {\u03b9 : Type*} (s : Finset \u03b9) (f : \u03b9 \u2192 Submodule R M) :\n (s.inf f).colon S = s.inf (fun i \u21a6 (f i).colon S) := by\naesop (add simp mem_colon)\n```\n\n-- snippet 38\n```lean\n-- Mathlib.RingTheory.Ideal.BigOperators.sum_mem (L29-L33)\ntheorem sum_mem (I : Ideal \u03b1) {\u03b9 : Type*} {t : Finset \u03b9} {f : \u03b9 \u2192 \u03b1} :\n (\u2200 c \u2208 t, f c \u2208 I) \u2192 (\u2211 i \u2208 t, f i) \u2208 I :=\nSubmodule.sum_mem I\n\nend Ideal\n```\n\n-- snippet 39\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.preimage_comap_associatedPrimes_eq_associatedPrimes_of_isLocalizedModule (L122-L130)\nlemma preimage_comap_associatedPrimes_eq_associatedPrimes_of_isLocalizedModule\n [IsNoetherianRing R] :\n (Ideal.comap (algebraMap R R')) \u207b\u00b9' (associatedPrimes R M) = associatedPrimes R' M' := by\next p\n exact \u27e8mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule S f p,\n fun h \u21a6 comap_mem_associatedPrimes_of_mem_associatedPrimes_of_isLocalizedModule_of_fg S f p h\n ((isNoetherianRing_iff_ideal_fg R).mp \u2039_\u203a _)\u27e9\n\nvariable (R M) in\n```\n\n-- snippet 40\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.span_range_pow_eq_top (L186-L195)\ntheorem span_range_pow_eq_top (s : Set \u03b1) (hs : span s = \u22a4) (n : s \u2192 \u2115) :\n span (Set.range fun x \u21a6 x.1 ^ n x) = \u22a4 := by\nhave \u27e8t, hts, mem\u27e9 := Submodule.mem_span_finite_of_mem_span ((eq_top_iff_one _).mp hs)\n refine top_unique ((span_pow_eq_top _ ((eq_top_iff_one _).mpr mem) <|\n t.attach.sup fun x \u21a6 n \u27e8x, hts x.2\u27e9).ge.trans <| span_le.mpr ?_)\n rintro _ \u27e8x, hxt, rfl\u27e9\n rw [\u2190 Nat.sub_add_cancel (Finset.le_sup <| t.mem_attach \u27e8x, hxt\u27e9)]\n simp_rw [pow_add]\n exact mul_mem_left _ _ (subset_span \u27e8_, rfl\u27e9)\n```\n\n-- snippet 41\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.pow_multiset_sum_mem_span_pow (L128-L154)\ntheorem pow_multiset_sum_mem_span_pow [DecidableEq \u03b1] (s : Multiset \u03b1) (n : \u2115) :\n s.sum ^ (Multiset.card s * n + 1) \u2208\n span ((s.map fun (x : \u03b1) \u21a6 x ^ (n + 1)).toFinset : Set \u03b1) := by\ninduction s using Multiset.induction_on with\n | empty => simp\n | cons a s hs => ?_\n simp only [Finset.coe_insert, Multiset.map_cons, Multiset.toFinset_cons, Multiset.sum_cons,\n Multiset.card_cons, add_pow]\n refine Submodule.sum_mem _ ?_\n intro c _hc\n rw [mem_span_insert]\n by_cases! h : n + 1 \u2264 c\n \u00b7 refine \u27e8a ^ (c - (n + 1)) * s.sum ^ ((Multiset.card s + 1) * n + 1 - c) *\n ((Multiset.card s + 1) * n + 1).choose c, 0, Submodule.zero_mem _, ?_\u27e9\n rw [mul_comm _ (a ^ (n + 1))]\n simp_rw [\u2190 mul_assoc]\n rw [\u2190 pow_add, add_zero, add_tsub_cancel_of_le h]\n \u00b7 use 0\n simp_rw [zero_mul, zero_add]\n refine \u27e8_, ?_, rfl\u27e9\n replace h : c \u2264 n := Nat.lt_succ_iff.mp h\n have : (Multiset.card s + 1) * n + 1 - c = Multiset.card s * n + 1 + (n - c) := by\n rw [add_mul, one_mul, add_assoc, add_comm n 1, \u2190 add_assoc, add_tsub_assoc_of_le h]\n rw [this, pow_add]\n simp_rw [mul_assoc, mul_comm (s.sum ^ (Multiset.card s * n + 1)), \u2190 mul_assoc]\n exact mul_mem_left _ _ hs\n```\n\n-- snippet 42\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_eq_top_iff_subset (L85-L87)\nlemma colon_eq_top_iff_subset (S : Set M) : N.colon S = \u22a4 \u2194 S \u2286 N := by\naesop (add simp [mem_colon, Ideal.eq_top_iff_one])\n```\n\n-- snippet 43\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.span_single_eq_top (L203-L232)\nlemma span_single_eq_top {\u03b9 : Type*} [DecidableEq \u03b9] [Finite \u03b9] (R : \u03b9 \u2192 Type*)\n [\u2200 i, Semiring (R i)] : Ideal.span (Set.range fun i \u21a6 (Pi.single i 1 : \u03a0 i, R i)) = \u22a4 := by\nrw [_root_.eq_top_iff]\n rintro x -\n induction x using Pi.single_induction with\n | zero => simp\n | add f g hf hg => exact Ideal.add_mem _ hf hg\n | single i r =>\n rw [show Pi.single i r = Pi.single i r * Pi.single i 1 by simp [\u2190 Pi.single_mul_left]]\n exact Ideal.mul_mem_left _ _ (Ideal.subset_span \u27e8i, rfl\u27e9)\n\nend Ideal\n\nend CommSemiring\n\nsection DivisionSemiring\n\nvariable {K : Type*} [DivisionSemiring K] (I : Ideal K)\n\nnamespace Ideal\n\nvariable (K) in\n/-- A bijection between (left) ideals of a division ring and `{0, 1}`, sending `\u22a5` to `0`\nand `\u22a4` to `1`. -/\nnoncomputable def equivFinTwo : Ideal K \u2243 Fin 2 where\n toFun := fun I \u21a6 if I = \u22a5 then 0 else 1\n invFun := ![\u22a5, \u22a4]\n left_inv := fun I \u21a6 by rcases eq_bot_or_top I with rfl | rfl <;> simp\n right_inv := fun i \u21a6 by fin_cases i <;> simp\n```\n\n-- snippet 44\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.IsAssociatedPrime (L98-L102)\ndef IsAssociatedPrime : Prop :=\n(\u22a5 : Submodule R M).IsAssociatedPrime I\n\nvariable (R) in\n/-- The set of associated primes of a module. -/\n```\n\n-- snippet 45\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.bot_colon (L64-L67)\ntheorem bot_colon : colon (\u22a5 : Submodule R M) (N : Set M) = N.annihilator := by\next x\n simp [mem_colon, mem_annihilator]\n```\n\n-- snippet 46\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.biUnion_associatedPrimes_eq_compl_nonZeroDivisors (L240-L246)\ntheorem biUnion_associatedPrimes_eq_compl_nonZeroDivisors [IsNoetherianRing R] :\n \u22c3 p \u2208 associatedPrimes R R, p = (nonZeroDivisors R : Set R)\u1d9c :=\n(biUnion_associatedPrimes_eq_zero_divisors R R).trans <| by\n ext; simp [\u2190 nonZeroDivisorsLeft_eq_nonZeroDivisors, and_comm]\n\nvariable {R M}\n```\n\n-- snippet 47\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.top_colon (L102-L104)\nlemma top_colon : (\u22a4 : Submodule R M).colon S = \u22a4 := by\naesop (add simp mem_colon)\n```\n\n-- snippet 48\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.iInf_colon (L93-L95)\nlemma iInf_colon {\u03b9 : Sort*} (f : \u03b9 \u2192 Submodule R M) : (\u2a05 i, f i).colon S = \u2a05 i, (f i).colon S := by\naesop (add simp mem_colon)\n```\n\n-- snippet 49\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.inf_colon (L89-L91)\nlemma inf_colon : (N\u2081 \u2293 N\u2082).colon S = N\u2081.colon S \u2293 N\u2082.colon S := by\naesop (add simp mem_colon)\n```\n\n-- snippet 50\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.prod_mem (L196-L202)\ntheorem prod_mem {\u03b9 : Type*} {f : \u03b9 \u2192 \u03b1} {s : Finset \u03b9}\n (I : Ideal \u03b1) {i : \u03b9} (hi : i \u2208 s) (hfi : f i \u2208 I) :\n \u220f i \u2208 s, f i \u2208 I := by\nclassical\n rw [Finset.prod_eq_prod_diff_singleton_mul hi]\n exact Ideal.mul_mem_left _ _ hfi\n```\n\n-- snippet 51\n```lean\n-- Mathlib.RingTheory.Ideal.Cotangent.toCotangent_eq_zero (L66-L67)\ntheorem toCotangent_eq_zero (x : I) : I.toCotangent x = 0 \u2194 (x : R) \u2208 I ^ 2 := I.mem_toCotangent_ker\n```\n\n-- snippet 52\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.LinearEquiv (L128-L132)\ntheorem LinearEquiv.isAssociatedPrime_iff (l : M \u2243\u2097[R] M') :\n IsAssociatedPrime I M \u2194 IsAssociatedPrime I M' :=\n\u27e8fun h => h.map_of_injective l l.injective,\n fun h => h.map_of_injective l.symm l.symm.injective\u27e9\n```\n\n-- snippet 53\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.associatedPrimes (L158-L169)\ntheorem associatedPrimes.finite : (associatedPrimes A M).Finite := by\ninduction \u2039Module.Finite A M\u203a using\n IsNoetherianRing.induction_on_isQuotientEquivQuotientPrime A with\n | subsingleton N => simp [associatedPrimes.eq_empty_of_subsingleton]\n | quotient N p f =>\n have := associatedPrimes.eq_singleton_of_isPrimary p.2.isPrimary\n simp [LinearEquiv.AssociatedPrimes.eq f, this]\n | exact N\u2081 N\u2082 N\u2083 f g hf _ hfg h\u2081 h\u2083 =>\n exact (h\u2081.union h\u2083).subset (associatedPrimes.subset_union_of_exact hf hfg)\n\n/-- Every maximal ideal of a commutative Noetherian total ring of fractions `A` is\nan associated prime of the `A`-module `A`. -/\n```\n\n-- snippet 54\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.add_pow_add_pred_mem_of_pow_mem (L123-L127)\ntheorem add_pow_add_pred_mem_of_pow_mem {m n : \u2115}\n (ha : a ^ m \u2208 I) (hb : b ^ n \u2208 I) :\n (a + b) ^ (m + n - 1) \u2208 I :=\nI.add_pow_add_pred_mem_of_pow_mem_of_commute ha hb (Commute.all ..)\n```\n\n-- snippet 55\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule (L40-L69)\nlemma mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule\n (p : Ideal R') (ass : p.comap (algebraMap R R') \u2208 associatedPrimes R M) :\n p \u2208 associatedPrimes R' M' := by\nrcases ass with \u27e8hp, x, hx\u27e9\n constructor\n \u00b7 refine (IsLocalization.isPrime_iff_isPrime_disjoint S _ _).mpr\n \u27e8hp, (IsLocalization.disjoint_comap_iff S R' p).mpr ?_\u27e9\n by_contra eqtop\n simp [eqtop, Ideal.comap_top, Ideal.isPrime_iff] at hp\n \u00b7 use f x\n ext t\n rcases IsLocalization.exists_mk'_eq S t with \u27e8r, s, hrs\u27e9\n simp_rw [\u2190 hrs, Ideal.mem_radical_iff, mem_colon_singleton, \u2190 IsLocalizedModule.mk'_one S f,\n \u2190 IsLocalization.mk'_pow, IsLocalizedModule.mk'_smul_mk', mul_one, mem_bot,\n IsLocalizedModule.mk'_eq_zero']\n refine \u27e8fun h \u21a6 exists_comm.mp \u27e81, ?_\u27e9, fun \u27e8n, t, ht\u27e9 \u21a6 ?_\u27e9\n \u00b7 simp only [\u2190 mem_colon_singleton, one_smul, \u2190 mem_bot R, \u2190 hx, \u2190 Ideal.mem_radical_iff]\n exact hSR'.mk'_mem_iff.mp h\n \u00b7 have : hSR'.mk' R' r s = hSR'.mk' R' (t.1 * r) 1 * hSR'.mk' R' 1 (t * s) := by\n rw [\u2190 hSR'.mk'_mul, mul_one, one_mul, \u2190 sub_eq_zero, \u2190 hSR'.mk'_sub, Submonoid.coe_mul]\n simp [\u2190 mul_assoc, mul_comm r t.1, IsLocalization.mk'_zero]\n rw [this]\n apply Ideal.IsTwoSided.mul_mem_of_left\n rw [IsLocalization.mk'_one, \u2190 Ideal.mem_comap, hx]\n rcases eq_zero_or_pos n with rfl | hn\n \u00b7 exact Ideal.IsTwoSided.mul_mem_of_left _ \u27e81, by simpa using ht\u27e9\n \u00b7 use n\n rw [mem_colon_singleton, mul_pow, mul_smul, \u2190 mem_colon_singleton]\n exact Ideal.pow_mem_of_mem _ (by simpa using ht) n hn\n```\n\n-- snippet 56\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.isAssociatedPrime_iff (L117-L120)\ntheorem isAssociatedPrime_iff [IsNoetherianRing R] :\n IsAssociatedPrime I M \u2194 I.IsPrime \u2227 \u2203 x : M, I = colon \u22a5 {x} :=\n(\u22a5 : Submodule R M).isAssociatedPrime_iff\n```\n\n-- snippet 57\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.add_pow_mem_of_pow_mem_of_le_of_commute (L83-L96)\ntheorem add_pow_mem_of_pow_mem_of_le_of_commute {m n k : \u2115}\n (ha : a ^ m \u2208 I) (hb : b ^ n \u2208 I) (hk : m + n \u2264 k + 1)\n (hab : Commute a b) :\n (a + b) ^ k \u2208 I := by\nsimp_rw [hab.add_pow, \u2190 Nat.cast_comm]\n apply I.sum_mem\n intro c _\n apply mul_mem_left\n by_cases h : m \u2264 c\n \u00b7 rw [hab.pow_pow]\n exact I.mul_mem_left _ (I.pow_mem_of_pow_mem ha h)\n \u00b7 refine I.mul_mem_left _ (I.pow_mem_of_pow_mem hb ?_)\n lia\n```\n\n-- snippet 58\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.add_pow_mem_of_pow_mem_of_le (L118-L122)\ntheorem add_pow_mem_of_pow_mem_of_le {m n k : \u2115}\n (ha : a ^ m \u2208 I) (hb : b ^ n \u2208 I) (hk : m + n \u2264 k + 1) :\n (a + b) ^ k \u2208 I :=\nI.add_pow_mem_of_pow_mem_of_le_of_commute ha hb hk (Commute.all ..)\n```\n\n-- snippet 59\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_singleton_zero (L117-L119)\nlemma colon_singleton_zero : N.colon {0} = \u22a4 := by\nsimp\n```\n\n-- snippet 60\n```lean\n-- Mathlib.RingTheory.Ideal.Cotangent.toCotangent (L51-L53)\ndef toCotangent : I \u2192\u2097[R] I.Cotangent := Submodule.mkQ _\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 61\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_union (L106-L108)\nlemma colon_union : N.colon (S\u2081 \u222a S\u2082) = N.colon S\u2081 \u2293 N.colon S\u2082 := by\naesop (add simp mem_colon)\n```\n\n-- snippet 62\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.mem_colon_singleton (L48-L50)\ntheorem mem_colon_singleton {x : M} {r : R} : r \u2208 N.colon {x} \u2194 r \u2022 x \u2208 N := by\nsimp [mem_colon, forall_eq]\n```\n\n-- snippet 63\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.associatedPrimes (L103-L107)\ndef associatedPrimes : Set (Ideal R) :=\n{ I | IsAssociatedPrime I M }\n\nvariable {I J M} {M' : Type*} [AddCommMonoid M'] [Module R M'] (f : M \u2192\u2097[R] M')\n```\n\n-- snippet 64\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.span_pow_eq_top (L161-L185)\ntheorem span_pow_eq_top (s : Set \u03b1) (hs : span s = \u22a4) (n : \u2115) :\n span ((fun (x : \u03b1) => x ^ n) '' s) = \u22a4 := by\nrw [eq_top_iff_one]\n rcases n with - | n\n \u00b7 obtain rfl | \u27e8x, hx\u27e9 := eq_empty_or_nonempty s\n \u00b7 rw [Set.image_empty, hs]\n trivial\n \u00b7 exact subset_span \u27e8_, hx, pow_zero _\u27e9\n rw [eq_top_iff_one, span, Finsupp.mem_span_iff_linearCombination] at hs\n rcases hs with \u27e8f, hf\u27e9\n simp only [Finsupp.linearCombination, Finsupp.coe_lsum, Finsupp.sum, LinearMap.coe_smulRight,\n LinearMap.id_coe, id_eq, smul_eq_mul] at hf\n have := sum_pow_mem_span_pow f.support (fun a => f a * a) n\n rw [hf, one_pow] at this\n refine span_le.mpr ?_ this\n rintro _ hx\n simp_rw [Set.mem_image] at hx\n rcases hx with \u27e8x, _, rfl\u27e9\n have : span ({(x : \u03b1) ^ (n + 1)} : Set \u03b1) \u2264 span ((fun x : \u03b1 => x ^ (n + 1)) '' s) := by\n rw [span_le, Set.singleton_subset_iff]\n exact subset_span \u27e8x, x.prop, rfl\u27e9\n refine this ?_\n rw [mul_pow, mem_span_singleton]\n exact \u27e8f x ^ (n + 1), mul_comm _ _\u27e9\n```\n\n-- snippet 65\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_iUnion (L110-L112)\nlemma colon_iUnion {\u03b9 : Sort*} (f : \u03b9 \u2192 Set M) : N.colon (\u22c3 i, f i) = \u2a05 i, N.colon (f i) := by\naesop (add simp mem_colon)\n```\n\n-- snippet 66\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.isField_iff_isSimpleOrder_ideal (L292-L302)\ntheorem isField_iff_isSimpleOrder_ideal : IsField R \u2194 IsSimpleOrder (Ideal R) := by\ncases subsingleton_or_nontrivial R\n \u00b7 exact\n \u27e8fun h => (not_isField_of_subsingleton _ h).elim, fun h =>\n (false_of_nontrivial_of_subsingleton <| Ideal R).elim\u27e9\n rw [\u2190 not_iff_not, Ring.not_isField_iff_exists_ideal_bot_lt_and_lt_top]\n contrapose! +distrib\n simp_rw [not_lt_top_iff, not_bot_lt_iff]\n exact \u27e8fun h => \u27e8h\u27e9, fun h => h.2\u27e9\n\n/-- When a ring is not a field, the maximal ideals are nontrivial. -/\n```\n\n-- snippet 67\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.isSimpleOrder (L237-L249)\ninstance isSimpleOrder : IsSimpleOrder (Ideal K) :=\n\u27e8eq_bot_or_top\u27e9\n\nend Ideal\n\nend DivisionSemiring\n\n-- TODO: consider moving the lemmas below out of the `Ring` namespace since they are\n-- about `CommSemiring`s.\nnamespace Ring\n\nvariable {R : Type*} [CommSemiring R]\n```\n\n-- snippet 68\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.mem_colon (L45-L46)\ntheorem mem_colon {r} : r \u2208 N.colon S \u2194 \u2200 s \u2208 S, r \u2022 s \u2208 N := Set.smul_set_subset_iff\n```\n\n-- snippet 69\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.ne_bot_of_isMaximal_of_not_isField (L303-L314)\ntheorem ne_bot_of_isMaximal_of_not_isField [Nontrivial R] {M : Ideal R} (max : M.IsMaximal)\n (not_field : \u00acIsField R) : M \u2260 \u22a5 := by\nrintro rfl\n obtain \u27e8I, hIbot, hItop\u27e9 := not_isField_iff_exists_ideal_bot_lt_and_lt_top.mp not_field\n exact hIbot.ne (max.eq_of_le hItop.ne bot_le)\n\nend Ring\n\nnamespace Ideal\n\nvariable {R : Type*} [CommSemiring R] [Nontrivial R]\n```\n\n-- snippet 70\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.not_isAssociatedPrime_of_subsingleton (L133-L138)\ntheorem not_isAssociatedPrime_of_subsingleton [Subsingleton M] : \u00acIsAssociatedPrime I M := by\nrintro \u27e8hI, x, hx\u27e9\n apply hI.ne_top\n simp [hx, Subsingleton.elim x 0]\n\nvariable (R) in\n```\n\n-- snippet 71\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.prod (L206-L211)\ntheorem prod : associatedPrimes R (M \u00d7 M') = associatedPrimes R M \u222a associatedPrimes R M' :=\n(subset_union_of_exact LinearMap.inl_injective .inl_snd).antisymm (Set.union_subset_iff.2\n \u27e8subset_of_injective LinearMap.inl_injective, subset_of_injective LinearMap.inr_injective\u27e9)\n\nend associatedPrimes\n```\n\n-- snippet 72\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.Submodule (L51-L55)\ndef Submodule.IsQuotientEquivQuotientPrime (N\u2081 N\u2082 : Submodule A M) :=\nN\u2081 \u2264 N\u2082 \u2227 \u2203 (p : PrimeSpectrum A), Nonempty ((\u21a5N\u2082 \u29f8 N\u2081.submoduleOf N\u2082) \u2243\u2097[A] A \u29f8 p.1)\n\nset_option backward.isDefEq.respectTransparency false in\nopen LinearMap in\n```\n\n-- snippet 73\n```lean\n-- Mathlib.RingTheory.Ideal.Cotangent.Cotangent (L41-L49)\ndef Cotangent : Type _ := I \u29f8 (I \u2022 \u22a4 : Submodule R I)\nderiving Inhabited, AddCommGroup, Module (R \u29f8 I)\n\nderiving instance Module S, IsScalarTower S S' for Cotangent I\n\nvariable [IsNoetherian R I] in\nderiving instance IsNoetherian R for Cotangent I\n\n/-- The quotient map from `I` to `I \u29f8 I ^ 2`. -/\n```\n\n-- snippet 74\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.annihilator_quotient (L175-L181)\ntheorem annihilator_quotient : Module.annihilator R (M \u29f8 N) = N.colon Set.univ := by\next r\n have htop : (\u22a4 : Submodule R (M \u29f8 N)) = (\u22a4 : Submodule R M).map N.mkQ := by\n simpa [map_top] using (LinearMap.range_eq_top.mpr (mkQ_surjective N)).symm\n rw [\u2190 annihilator_top (R := R) (M := M \u29f8 N), htop,\n annihilator_map_mkQ_eq_colon (N := N) (P := \u22a4), Submodule.top_coe]\n```\n\n-- snippet 75\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_mono (L68-L70)\ntheorem colon_mono (hn : N\u2081 \u2264 N\u2082) (hs : S\u2081 \u2286 S\u2082) : N\u2081.colon S\u2082 \u2264 N\u2082.colon S\u2081 :=\nfun _ hrns \u21a6 mem_colon.mpr fun s\u2081 hs\u2081 \u21a6 hn <| mem_colon.mp hrns s\u2081 <| hs hs\u2081\n```\n\n-- snippet 76\n```lean\n-- Mathlib.RingTheory.Ideal.Basis.constr_basisSpanSingleton (L46-L54)\ntheorem constr_basisSpanSingleton {N : Type*} [Semiring N] [Module N S] [SMulCommClass R N S]\n (b : Basis \u03b9 R S) {x : S} (hx : x \u2260 0) :\n (b.constr N).toFun (((\u2191) : _ \u2192 S) \u2218 (basisSpanSingleton b hx)) = Algebra.lmul R S x :=\nb.ext fun i => by simp\n\nend Ideal\n\n/-- If `I : Ideal S` has a basis over `R`,\n`x \u2208 I` iff it is a linear combination of basis vectors. -/\n```\n\n-- snippet 77\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.exists_not_isUnit_of_not_isField (L250-L258)\ntheorem exists_not_isUnit_of_not_isField [Nontrivial R] (hf : \u00acIsField R) :\n \u2203 (x : R) (_hx : x \u2260 (0 : R)), \u00acIsUnit x := by\nhave : \u00ac_ := fun h => hf \u27e8exists_pair_ne R, mul_comm, h\u27e9\n simp_rw [isUnit_iff_exists_inv]\n push Not at this \u22a2\n obtain \u27e8x, hx, not_unit\u27e9 := this\n exact \u27e8x, hx, not_unit\u27e9\n\nopen Ideal in\n```\n\n-- snippet 78\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.bot_lt_of_maximal (L315-L318)\ntheorem bot_lt_of_maximal (M : Ideal R) [hm : M.IsMaximal] (non_field : \u00acIsField R) : \u22a5 < M :=\n(Ring.ne_bot_of_isMaximal_of_not_isField hm non_field).bot_lt\n\nend Ideal\n```\n\n-- snippet 79\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.mem_colon' (L131-L133)\ntheorem mem_colon' {r} : r \u2208 N.colon S \u2194 S \u2264 comap (r \u2022 (LinearMap.id : M \u2192\u2097[R] M)) N :=\nmem_colon\n```\n\n-- snippet 80\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.minimalPrimes_annihilator_subset_associatedPrimes (L131-L150)\nlemma minimalPrimes_annihilator_subset_associatedPrimes [IsNoetherianRing R] [Module.Finite R M] :\n (Module.annihilator R M).minimalPrimes \u2286 associatedPrimes R M := by\nintro p hp\n have prime := hp.1.1\n let R\u209a := Localization.AtPrime p\n have : Nontrivial (LocalizedModule p.primeCompl M) := by\n simpa [\u2190 Module.mem_support_iff (p := \u27e8p, prime\u27e9), Module.support_eq_zeroLocus] using hp.1.2\n rcases associatedPrimes.nonempty R\u209a (LocalizedModule p.primeCompl M) with \u27e8q, hq\u27e9\n have q_prime : q.IsPrime := IsAssociatedPrime.isPrime hq\n simp only [\u2190 preimage_comap_associatedPrimes_eq_associatedPrimes_of_isLocalizedModule p.primeCompl\n R\u209a (LocalizedModule.mkLinearMap p.primeCompl M), Set.mem_preimage] at hq\n have ann_le : Module.annihilator R M \u2264 Ideal.comap (algebraMap R R\u209a) q :=\n le_of_eq_of_le Submodule.annihilator_top.symm (IsAssociatedPrime.annihilator_le hq)\n have le : Ideal.comap (algebraMap R R\u209a) q \u2264 p := by\n have := (IsLocalization.disjoint_comap_iff p.primeCompl R\u209a q).mpr q_prime.ne_top\n simpa only [Ideal.primeCompl, Submonoid.coe_set_mk, Subsemigroup.coe_set_mk,\n Set.disjoint_compl_left_iff_subset] using this\n simpa [Minimal.eq_of_le hp.out \u27e8IsAssociatedPrime.isPrime hq, ann_le\u27e9 le] using hq\n\nend Module.associatedPrimes\n```\n\n-- snippet 81\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.mem_colon_span_singleton (L154-L156)\ntheorem mem_colon_span_singleton {x : M} {r : R} : r \u2208 N.colon (span R {x}) \u2194 r \u2022 x \u2208 N := by\nsimp\n```\n\n-- snippet 82\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.mem_pi (L56-L58)\ntheorem mem_pi (r : \u03a0 i, R i) : r \u2208 pi I \u2194 \u2200 i, r i \u2208 I i :=\nIff.rfl\n```\n\n-- snippet 83\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.iInf_colon_iUnion (L74-L77)\ntheorem iInf_colon_iUnion (\u03b9\u2081 : Sort*) (f : \u03b9\u2081 \u2192 Submodule R M) (\u03b9\u2082 : Sort*) (g : \u03b9\u2082 \u2192 Set M) :\n (\u2a05 i, f i).colon (\u22c3 j, g j) = \u2a05 (i) (j), (f i).colon (g j) := by\naesop (add simp mem_colon)\n```\n\n-- snippet 84\n```lean\n-- Mathlib.RingTheory.Ideal.Cotangent.toCotangent_eq (L62-L65)\ntheorem toCotangent_eq {x y : I} : I.toCotangent x = I.toCotangent y \u2194 (x - y : R) \u2208 I ^ 2 := by\nrw [\u2190 sub_eq_zero]\n exact I.mem_toCotangent_ker\n```\n\n-- snippet 85\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.IsNoetherianRing (L92-L117)\ntheorem IsNoetherianRing.exists_relSeries_isQuotientEquivQuotientPrime :\n \u2203 s : RelSeries {(N\u2081, N\u2082) | Submodule.IsQuotientEquivQuotientPrime (A := A) (M := M) N\u2081 N\u2082},\ns.head = \u22a5 \u2227 s.last = \u22a4 := by\n refine WellFoundedGT.induction_top \u27e8\u22a5, .singleton _ \u22a5, rfl, rfl\u27e9 ?_\n rintro N hN \u27e8s, hs\u2081, hs\u2082\u27e9\n have := Submodule.Quotient.nontrivial_iff.mpr hN\n obtain \u27e8p, hp\u27e9 := associatedPrimes.nonempty A (M \u29f8 N)\n rw [AssociatedPrimes.mem_iff, isAssociatedPrime_iff] at hp\n obtain \u27e8hp, x, rfl\u27e9 := hp\n obtain \u27e8x, rfl\u27e9 := Submodule.mkQ_surjective _ x\n have hxN : x \u2209 N := fun h \u21a6 hp.ne_top (by rw [show N.mkQ x = 0 by simpa]; simp)\n have := Submodule.isQuotientEquivQuotientPrime_iff.mpr \u27e8x, hp, rfl\u27e9\n refine \u27e8_, by simpa [hs\u2082], s.snoc _ (hs\u2082 \u25b8 this), by simpa, rfl\u27e9\n\n/-- If a property on finitely generated modules over a Noetherian ring satisfies that:\n\n- it holds for zero module (it's formalized as it holds for any module which is subsingleton),\n- it holds for `A \u29f8 p` for every prime ideal `p` of `A` (to avoid universe problem,\n it's formalized as it holds for any module isomorphic to `A \u29f8 p`),\n- it is stable by short exact sequences,\n\nthen the property holds for every finitely generated modules.\n\nNOTE: This should be the induction principle for `M`, but due to the bug\nhttps://github.com/leanprover/lean4/issues/4246\ncurrently it is induction for `Module.Finite A M`. -/\n```\n\n-- snippet 86\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.not_isField_of_ne_of_ne (L271-L275)\ntheorem not_isField_of_ne_of_ne [Nontrivial R] {I : Ideal R} (h_bot : I \u2260 \u22a5) (h_top : I \u2260 \u22a4) :\n \u00ac IsField R := by\ncontrapose! h_bot\n exact ((isField_iff_maximal_bot.mp h_bot).eq_of_le h_top bot_le).symm\n```\n", "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.RingTheory.Ideal.KrullsHeightTheorem).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\nlemma Ideal.height_le_ringKrullDim_quotient_add_one {r : R} {p : Ideal R} [p.IsPrime]\n (hrp : r \u2208 p) : p.height \u2264 ringKrullDim (R \u29f8 span {r}) + 1\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.RingTheory.Ideal.KrullsHeightTheorem.IsLocalRing (L48-L58)\nlemma IsLocalRing.quotient_artinian_of_mem_minimalPrimes_of_isLocalRing\n [IsLocalRing R] (I : Ideal R) (hp : IsLocalRing.maximalIdeal R \u2208 I.minimalPrimes) :\n IsArtinianRing (R \u29f8 I) :=\nhave : Ring.KrullDimLE 0 (R \u29f8 I) := Ring.krullDimLE_zero_iff.mpr fun J prime \u21a6\n Ideal.isMaximal_of_isIntegral_of_isMaximal_comap _ <| by\n convert IsLocalRing.maximalIdeal.isMaximal R\n rw [Ideal.minimalPrimes, Set.mem_setOf] at hp\n have := prime.comap (Ideal.Quotient.mk I)\n exact hp.eq_of_le \u27e8this, .trans (by simp) (Ideal.ker_le_comap _)\u27e9 (le_maximalIdeal this.1)\n IsNoetherianRing.isArtinianRing_of_krullDimLE_zero\n```\n\n-- snippet 2\n```lean\n-- Mathlib.RingTheory.Ideal.KrullsHeightTheorem.height_le_ringKrullDim_quotient_add_spanFinrank (L343-L351)\nlemma height_le_ringKrullDim_quotient_add_spanFinrank {p I : Ideal R} [p.IsPrime] (h : I \u2264 p) :\n p.height \u2264 ringKrullDim (R \u29f8 I) + I.spanFinrank := by\ntrans (p.map (Ideal.Quotient.mk I)).height + I.spanFinrank\n \u00b7 norm_cast; exact Ideal.height_le_height_add_spanFinrank_of_le h\n \u00b7 gcongr\n have : (Ideal.map (Ideal.Quotient.mk I) p).IsPrime :=\n Ideal.isPrime_map_quotientMk_of_isPrime h\n exact Ideal.height_le_ringKrullDim_of_ne_top Ideal.IsPrime.ne_top'\n```\n\n-- snippet 3\n```lean\n-- Mathlib.RingTheory.Ideal.KrullsHeightTheorem.ringKrullDim_le_ringKrullDim_quotient_add_spanFinrank (L352-L362)\nlemma ringKrullDim_le_ringKrullDim_quotient_add_spanFinrank (I : Ideal R)\n (h : I \u2264 Ring.jacobson R) :\n ringKrullDim R \u2264 ringKrullDim (R \u29f8 I) + I.spanFinrank := by\nnontriviality R\n rw [ringKrullDim_le_iff_isMaximal_height_le]\n intro m hm\n exact height_le_ringKrullDim_quotient_add_spanFinrank <|\n le_trans h <| Ring.jacobson_le_of_isMaximal m\n\n/-- If `p` is a prime ideal containing `s`, the height of `p` is bounded\nby the sum of the height of the image of `p` in `R \u29f8 (s)` and the cardinality of `s`. -/\n```\n\n-- snippet 4\n```lean\n-- Mathlib.RingTheory.Ideal.KrullsHeightTheorem.ringKrullDim_le_ringKrullDim_quotient_add_encard (L386-L391)\nlemma ringKrullDim_le_ringKrullDim_quotient_add_encard (s : Set R) (hs : s \u2286 Ring.jacobson R) :\n ringKrullDim R \u2264 ringKrullDim (R \u29f8 Ideal.span s) + s.encard := by\nrefine le_trans (ringKrullDim_le_ringKrullDim_quotient_add_spanFinrank (Ideal.span s) ?_) ?_\n \u00b7 simpa [Ideal.span_le]\n \u00b7 gcongr; norm_cast; exact Submodule.spanFinrank_span_le_encard _\n```\n\n-- snippet 5\n```lean\n-- Mathlib.RingTheory.Ideal.KrullsHeightTheorem.ringKrullDim_le_ringKrullDim_quotient_add_card (L392-L407)\nlemma ringKrullDim_le_ringKrullDim_quotient_add_card (s : Finset R)\n (hs : (s : Set R) \u2286 Ring.jacobson R) :\n ringKrullDim R \u2264 ringKrullDim (R \u29f8 Ideal.span (s : Set R)) + s.card := by\nconvert ringKrullDim_le_ringKrullDim_quotient_add_encard s hs\n norm_cast\n\nsection Algebra\n\nvariable {S : Type*} [CommRing S] [Algebra R S]\n\n/--\nIf `P` lies over `p`, the height of `P` is bounded by the height of `p` plus\nthe height of the image of `P` in `S \u29f8 p S`.\nEquality holds if `S` satisfies going-down as an `R`-algebra\n(see `Ideal.height_eq_height_add_of_liesOver_of_hasGoingDown`).\n-/\n```\n\n-- snippet 6\n```lean\n-- Mathlib.RingTheory.Ideal.KrullsHeightTheorem.ringKrullDim_le_spanFinrank_maximalIdeal (L474-L480)\nlemma ringKrullDim_le_spanFinrank_maximalIdeal [IsLocalRing R] :\n ringKrullDim R \u2264 (IsLocalRing.maximalIdeal R).spanFinrank :=\nle_of_eq_of_le IsLocalRing.maximalIdeal_height_eq_ringKrullDim.symm\n (WithBot.coe_le_coe.mpr (Ideal.height_le_spanFinrank (IsLocalRing.maximalIdeal R)\n Ideal.IsPrime.ne_top'))\n\nend Algebra\n```\n\n-- snippet 7\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.single_mem_pi (L67-L72)\ntheorem single_mem_pi [DecidableEq \u03b9] {i : \u03b9} {r : R i} (hr : r \u2208 I i) : Pi.single i r \u2208 pi I := by\nintro j\n obtain rfl | ne := eq_or_ne i j\n \u00b7 simpa\n \u00b7 simp [ne]\n```\n\n-- snippet 8\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.bot_colon' (L138-L140)\ntheorem bot_colon' : (\u22a5 : Submodule R M).colon S = (span R S).annihilator := by\naesop (add simp [mem_colon, mem_annihilator_span])\n```\n\n-- snippet 9\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.AssociatedPrimes (L108-L109)\ntheorem AssociatedPrimes.mem_iff : I \u2208 associatedPrimes R M \u2194 IsAssociatedPrime I M := Iff.rfl\n```\n\n-- snippet 10\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.isField_iff_maximal_bot (L259-L264)\ntheorem isField_iff_maximal_bot [Nontrivial R] : IsField R \u2194 (\u22a5 : Ideal R).IsMaximal := by\nrefine \u27e8fun h \u21a6 let := h.toSemifield; bot_isMaximal, fun hmax \u21a6 ?_\u27e9\n by_contra hf\n obtain \u27e8x, hx0, hxu\u27e9 := exists_not_isUnit_of_not_isField hf\n exact hx0 <| span_singleton_eq_bot.mp (hmax.eq_of_le (span_singleton_ne_top hxu) bot_le).symm\n```\n\n-- snippet 11\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.subset_union_of_exact (L171-L204)\ntheorem subset_union_of_exact (hf : Function.Injective f) (hfg : Function.Exact f g) :\n associatedPrimes R M' \u2286 associatedPrimes R M \u222a associatedPrimes R M'' := by\nrintro p \u27e8_, x, hx\u27e9\n by_cases! h : \u2203 a \u2208 p.primeCompl, \u2203 y : M, \u2203 k, f y = a ^ k \u2022 x\n \u00b7 obtain \u27e8a, ha, y, k, h\u27e9 := h\n left\n refine \u27e8\u2039_\u203a, y, le_antisymm (fun b hb \u21a6 ?_) (fun b \u27e8n, hb\u27e9 \u21a6 ?_)\u27e9\n \u00b7 rw [hx] at hb\n obtain \u27e8n, hb\u27e9 := hb\n use n\n rw [mem_colon_singleton, mem_bot] at hb \u22a2\n apply_fun _ using hf\n rw [map_smul, h, smul_comm, hb, smul_zero, map_zero]\n \u00b7 rw [mem_colon_singleton, mem_bot] at hb\n apply_fun f at hb\n rw [map_smul, map_zero, h, \u2190 mul_smul, \u2190 mem_bot R, \u2190 mem_colon_singleton] at hb\n replace hb := hx.ge (Ideal.le_radical hb)\n contrapose hb\n exact p.primeCompl.mul_mem (p.primeCompl.pow_mem hb n) (p.primeCompl.pow_mem ha k)\n \u00b7 right\n refine \u27e8\u2039_\u203a, g x, le_antisymm (fun b hb \u21a6 ?_) (fun b \u27e8n, hb\u27e9 \u21a6 ?_)\u27e9\n \u00b7 rw [hx] at hb\n refine Ideal.radical_mono (fun b hb \u21a6 ?_) hb\n rw [mem_colon_singleton, mem_bot] at hb \u22a2\n rw [\u2190 map_smul, hb, map_zero]\n \u00b7 rw [mem_colon_singleton, mem_bot, \u2190 map_smul, \u2190 LinearMap.mem_ker,\n hfg.linearMap_ker_eq] at hb\n obtain \u27e8y, hy\u27e9 := hb\n by_contra H\n exact h b H y n hy\n\nvariable (R M M') in\n/-- The set of associated primes of the product of two modules is equal to\nthe union of those of the two modules. -/\n```\n\n-- snippet 12\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_empty (L114-L116)\nlemma colon_empty : N.colon (\u2205 : Set M) = \u22a4 := by\naesop (add simp mem_colon)\n```\n\n-- snippet 13\n```lean\n-- Mathlib.RingTheory.Ideal.Cotangent.map_toCotangent_ker (L54-L57)\ntheorem map_toCotangent_ker : (LinearMap.ker I.toCotangent).map I.subtype = I ^ 2 := by\nrw [Ideal.toCotangent, Submodule.ker_mkQ, pow_two, Submodule.map_smul'' I \u22a4 (Submodule.subtype I),\n smul_eq_mul, Submodule.map_subtype_top]\n```\n\n-- snippet 14\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.exists_maximal_of_not_isField (L265-L270)\ntheorem exists_maximal_of_not_isField [Nontrivial R] (h : \u00ac IsField R) :\n \u2203 p : Ideal R, p \u2260 \u22a5 \u2227 p.IsMaximal := by\ncontrapose! h\n simp only [\u2190 bot_lt_iff_ne_bot] at h\n refine isField_iff_maximal_bot.mpr \u27e8\u27e8bot_ne_top, Ideal.maximal_of_no_maximal h\u27e9\u27e9\n```\n\n-- snippet 15\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_span (L142-L149)\ntheorem colon_span : N.colon (span R S) = N.colon S := by\nrefine (colon_mono le_rfl subset_span).antisymm fun r h \u21a6 mem_colon.mpr fun s hs \u21a6 ?_\n induction hs using Submodule.span_induction with\n | mem => aesop (add simp mem_colon)\n | zero => simp\n | add => aesop\n | smul => simp_all [smul_mem, smul_comm r]\n```\n\n-- snippet 16\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.add_pow_add_pred_mem_of_pow_mem_of_commute (L97-L117)\ntheorem add_pow_add_pred_mem_of_pow_mem_of_commute {m n : \u2115}\n (ha : a ^ m \u2208 I) (hb : b ^ n \u2208 I) (hab : Commute a b) :\n (a + b) ^ (m + n - 1) \u2208 I :=\nI.add_pow_mem_of_pow_mem_of_le_of_commute ha hb (by rw [\u2190 Nat.sub_le_iff_le_add]) hab\n\nend Commute\n\nend Ideal\n\nend Semiring\n\nsection CommSemiring\n\nvariable {a b : \u03b1}\n\n-- A separate namespace definition is needed because the variables were historically in a different\n-- order.\nnamespace Ideal\n\nvariable [CommSemiring \u03b1] (I : Ideal \u03b1)\n```\n\n-- snippet 17\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.biUnion_associatedPrimes_eq_zero_divisors (L229-L239)\ntheorem biUnion_associatedPrimes_eq_zero_divisors [IsNoetherianRing R] :\n \u22c3 p \u2208 associatedPrimes R M, p = { r : R | \u2203 x : M, x \u2260 0 \u2227 r \u2022 x = 0 } := by\nsimp only [AssociatedPrimes.mem_iff, isAssociatedPrime_iff]\n refine subset_antisymm (Set.iUnion\u2082_subset ?_) ?_\n \u00b7 rintro _ \u27e8h, x, \u27e8\u27e9\u27e9 r h'\n exact \u27e8x, by simpa using h.ne_top, by simpa using h'\u27e9\n \u00b7 intro r \u27e8x, h, h'\u27e9\n obtain \u27e8P, hP, hx\u27e9 := exists_le_isAssociatedPrime_of_isNoetherianRing R x h\n rw [isAssociatedPrime_iff] at hP\n exact Set.mem_iUnion\u2082_of_mem hP (hx (by rwa [mem_colon_singleton]))\n```\n\n-- snippet 18\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.annihilator_map_mkQ_eq_colon (L169-L174)\nlemma annihilator_map_mkQ_eq_colon : annihilator (P.map N.mkQ) = N.colon (P : Set M) := by\next\n rw [mem_annihilator, mem_colon]\n exact \u27e8fun H p hp \u21a6 (Quotient.mk_eq_zero N).1 (H (Quotient.mk p) (mem_map_of_mem hp)),\n fun H _ \u27e8p, hp, hpm\u27e9 \u21a6 hpm \u25b8 ((Quotient.mk_eq_zero N).2 <| H p hp)\u27e9\n```\n\n-- snippet 19\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon (L35-L44)\ndef colon (N : Submodule R M) (S : Set M) : Ideal R where\n carrier := {r : R | (r \u2022 S : Set M) \u2286 N}\nadd_mem' ha hb :=\n (Set.add_smul_subset _ _ _).trans ((Set.add_subset_add ha hb).trans_eq (by simp))\n zero_mem' := (Set.zero_smul_set_subset S).trans (by simp)\n smul_mem' r := by\n simp only [Set.mem_setOf_eq, smul_eq_mul, mul_smul, Set.smul_set_subset_iff]\n intro x hx y hy\n exact N.smul_mem _ (hx hy)\n```\n\n-- snippet 20\n```lean\n-- Mathlib.RingTheory.Ideal.Basis.Basis (L55-L61)\ntheorem Basis.mem_ideal_iff {\u03b9 R S : Type*} [CommSemiring R] [Semiring S] [Algebra R S]\n {I : Ideal S} (b : Basis \u03b9 R I) {x : S} :\n x \u2208 I \u2194 \u2203 c : \u03b9 \u2192\u2080 R, x = Finsupp.sum c fun i x => x \u2022 (b i : S) :=\n(b.map ((I.restrictScalarsEquiv R _ _).restrictScalars R).symm).mem_submodule_iff\n\n/-- If `I : Ideal S` has a finite basis over `R`,\n`x \u2208 I` iff it is a linear combination of basis vectors. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.comap_mem_associatedPrimes_of_mem_associatedPrimes_of_isLocalizedModule_of_fg (L84-L120)\nlemma comap_mem_associatedPrimes_of_mem_associatedPrimes_of_isLocalizedModule_of_fg (p : Ideal R')\n (ass : p \u2208 associatedPrimes R' M') (fg : (p.comap (algebraMap R R')).FG) :\n p.comap (algebraMap R R') \u2208 associatedPrimes R M := by\nrcases ass with \u27e8hp, x, hx\u27e9\n rcases fg with \u27e8T, hT\u27e9\n rcases IsLocalizedModule.mk'_surjective S f x with \u27e8\u27e8m, s\u27e9, rfl\u27e9\n simp only [Function.uncurry_apply_pair] at hx\n have mem (a : T) : algebraMap R R' a \u2208 p := by\n simpa [\u2190 Ideal.mem_comap, \u2190 hT] using Ideal.subset_span a.2\n simp only [hx, Ideal.mem_radical_iff, mem_bot, mem_colon_singleton, \u2190 map_pow, algebraMap_smul,\n \u2190 IsLocalizedModule.mk'_smul, IsLocalizedModule.mk'_eq_zero' f] at mem\n choose e g hg using mem\n refine \u27e8.under R p, (\u220f a, g a).1 \u2022 m, le_antisymm ?_ fun r hr \u21a6 ?_\u27e9\n \u00b7 rw [\u2190 hT, Ideal.span_le]\n intro a ha\n simp only [SetLike.mem_coe, Ideal.mem_radical_iff, mem_bot, mem_colon_singleton]\n obtain \u27e8u, hu\u27e9 : g \u27e8a, ha\u27e9 \u2223 (\u220f a, g a) := by\n apply Finset.dvd_prod_of_mem g (Finset.mem_univ \u27e8a, ha\u27e9)\n use e \u27e8a, ha\u27e9\n rw [hu, Submonoid.coe_mul, smul_smul, \u2190 mul_assoc, mul_comm, \u2190 smul_smul, mul_comm, \u2190 smul_smul]\n exact smul_eq_zero_of_right u.1 (hg \u27e8a, ha\u27e9)\n \u00b7 simp only [Ideal.mem_radical_iff, mem_bot, mem_colon_singleton, smul_smul] at hr\n obtain \u27e8k, hk\u27e9 := hr\n have mem : r ^ k * (\u220f a, g a).1 \u2208 Ideal.comap (algebraMap R R') p := by\n rw [hx]\n use 1\n simp_rw [pow_one, mem_colon_singleton, algebraMap_smul, \u2190 IsLocalizedModule.mk'_smul,\n hk, IsLocalizedModule.mk'_zero, mem_bot]\n apply hp.mem_of_pow_mem k\n rw [\u2190 map_pow]\n exact ((hp.under R).mul_mem_iff_mem_or_mem.mp mem).resolve_right\n (Set.disjoint_left.mp ((IsLocalization.disjoint_comap_iff S R' p).mpr hp.1) (\u220f a, g a).2)\n\nvariable (R')\n\ninclude S f in\nopen Set in\n```\n\n-- snippet 22\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_univ (L57-L60)\ntheorem colon_univ {I : Ideal R} [I.IsTwoSided] : I.colon Set.univ = I := by\nsimp_rw [SetLike.ext_iff, mem_colon, smul_eq_mul]\n exact fun x \u21a6 \u27e8fun h \u21a6 mul_one x \u25b8 h 1 trivial, fun h _ _ \u21a6 I.mul_mem_right _ h\u27e9\n```\n\n-- snippet 23\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_inf_eq_left_of_subset (L81-L83)\nlemma colon_inf_eq_left_of_subset (h : S \u2286 (N\u2082 : Set M)) : (N\u2081 \u2293 N\u2082).colon S = N\u2081.colon S := by\naesop (add simp mem_colon)\n```\n\n-- snippet 24\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.exists_le_isAssociatedPrime_of_isNoetherianRing (L139-L163)\ntheorem exists_le_isAssociatedPrime_of_isNoetherianRing [H : IsNoetherianRing R] (x : M)\n (hx : x \u2260 0) : \u2203 P : Ideal R, IsAssociatedPrime P M \u2227 (\u22a5 : Submodule R M).colon {x} \u2264 P := by\nsimp only [isAssociatedPrime_iff]\n obtain \u27e8P, \u27e8l, h\u2081, y, rfl\u27e9, h\u2083\u27e9 :=\n set_has_maximal_iff_noetherian.mpr H\n { P | (\u22a5 : Submodule R M).colon {x} \u2264 P \u2227 P \u2260 \u22a4 \u2227 \u2203 y : M, P = (\u22a5 : Submodule R M).colon {y} }\n \u27e8_, rfl.le, by simpa, x, rfl\u27e9\n refine \u27e8_, \u27e8\u27e8h\u2081, ?_\u27e9, y, rfl\u27e9, l\u27e9\n intro a b hab\n rw [or_iff_not_imp_left]\n intro ha\n rw [mem_colon_singleton] at ha hab\n have H\u2081 : (\u22a5 : Submodule R M).colon {y} \u2264 (\u22a5 : Submodule R M).colon {a \u2022 y} := by\n intro c hc\n rw [mem_colon_singleton, mem_bot] at hc \u22a2\n rw [smul_comm, hc, smul_zero]\n rwa [H\u2081.eq_of_not_lt (h\u2083 _ \u27e8l.trans H\u2081, by simpa, _, rfl\u27e9),\n mem_colon_singleton, smul_comm, smul_smul]\n\nnamespace associatedPrimes\n\nvariable {f} {M'' : Type*} [AddCommMonoid M''] [Module R M''] {g : M' \u2192\u2097[R] M''}\n\n/-- If `M \u2192 M'` is injective, then the set of associated primes of `M` is\ncontained in that of `M'`. -/\n```\n\n-- snippet 25\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.mem_associatedPrimes_atPrime_of_mem_associatedPrimes (L70-L77)\nlemma mem_associatedPrimes_atPrime_of_mem_associatedPrimes\n {p : Ideal R} [p.IsPrime] (ass : p \u2208 associatedPrimes R M) :\n maximalIdeal (Localization.AtPrime p) \u2208\n associatedPrimes (Localization.AtPrime p) (LocalizedModule.AtPrime p M) := by\napply mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule\n p.primeCompl (LocalizedModule.mkLinearMap p.primeCompl M)\n simpa [Localization.AtPrime.comap_maximalIdeal] using ass\n```\n\n-- snippet 26\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.sum_pow_mem_span_pow (L155-L160)\ntheorem sum_pow_mem_span_pow {\u03b9} (s : Finset \u03b9) (f : \u03b9 \u2192 \u03b1) (n : \u2115) :\n (\u2211 i \u2208 s, f i) ^ (s.card * n + 1) \u2208 span ((fun i => f i ^ (n + 1)) '' s) := by\nclassical\n simpa only [Multiset.card_map, Multiset.map_map, comp_apply, Multiset.toFinset_map,\n Finset.coe_image, Finset.val_toFinset] using pow_multiset_sum_mem_span_pow (s.1.map f) n\n```\n\n-- snippet 27\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.not_isField_iff_exists_prime (L282-L291)\ntheorem not_isField_iff_exists_prime [Nontrivial R] :\n \u00acIsField R \u2194 \u2203 p : Ideal R, p \u2260 \u22a5 \u2227 p.IsPrime := by\nrefine \u27e8fun h \u21a6 ?_, fun \u27e8I, h_bot, h_top\u27e9 \u21a6 not_isField_of_ne_of_ne h_bot h_top.ne_top\u27e9\n obtain \u27e8I, hI, hIm\u27e9 := exists_maximal_of_not_isField h\n exact \u27e8I, hI, hIm.isPrime\u27e9\n\n/-- Also see `Ideal.isSimpleOrder` for the forward direction as an instance when `R` is a\ndivision (semi)ring.\n\nThis result actually holds for all division semirings, but we lack the predicate to state it. -/\n```\n\n-- snippet 28\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.isAssociatedPrime_iff_exists_injective_linearMap (L257-L267)\ntheorem isAssociatedPrime_iff_exists_injective_linearMap [IsNoetherianRing R] :\n IsAssociatedPrime I M \u2194 I.IsPrime \u2227 \u2203 (f : R \u29f8 I \u2192\u2097[R] M), Function.Injective f := by\nrw [isAssociatedPrime_iff, and_congr_right_iff]\n refine fun _ \u21a6 \u27e8fun \u27e8x, h\u27e9 \u21a6 ?_, fun \u27e8f, h\u27e9 \u21a6 \u27e8(f \u2218\u2097 mkQ I) 1, ?_\u27e9\u27e9\n \u00b7 replace h : I = ker (toSpanSingleton R M x) := by simp [h, SetLike.ext_iff]\n exact \u27e8liftQ _ _ h.le, ker_eq_bot.mp (ker_liftQ_eq_bot' _ _ h)\u27e9\n \u00b7 conv_lhs => rw [\u2190 I.ker_mkQ, \u2190 ker_comp_of_ker_eq_bot (mkQ I) (ker_eq_bot_of_injective h)]\n simp [SetLike.ext_iff, \u2190 Ideal.Quotient.algebraMap_eq, Algebra.algebraMap_eq_smul_one]\n\nvariable {I J M}\n```\n\n-- snippet 29\n```lean\n-- Mathlib.RingTheory.Ideal.Basis.basisSpanSingleton_apply (L39-L44)\ntheorem basisSpanSingleton_apply (b : Basis \u03b9 R S) {x : S} (hx : x \u2260 0) (i : \u03b9) :\n (basisSpanSingleton b hx i : S) = x * b i := by\nsimp only [basisSpanSingleton, Basis.map_apply, LinearEquiv.trans_apply,\n Submodule.restrictScalarsEquiv_apply, LinearEquiv.ofInjective_apply, LinearEquiv.coe_ofEq_apply,\n LinearEquiv.restrictScalars_apply, LinearMap.mulLeft_apply]\n```\n\n-- snippet 30\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.pi (L50-L55)\ndef pi : Ideal (\u03a0 i, R i) where\n carrier := { r | \u2200 i, r i \u2208 I i }\nzero_mem' i := (I i).zero_mem\n add_mem' ha hb i := (I i).add_mem (ha i) (hb i)\n smul_mem' a _b hb i := (I i).mul_mem_left (a i) (hb i)\n```\n\n-- snippet 31\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.subset_of_injective (L165-L169)\ntheorem subset_of_injective (hf : Function.Injective f) :\n associatedPrimes R M \u2286 associatedPrimes R M' := fun _I h => h.map_of_injective f hf\n/-- If `0 \u2192 M \u2192 M' \u2192 M''` is an exact sequence, then the set of associated primes of `M'` is\ncontained in the union of those of `M` and `M''`. -/\n```\n\n-- snippet 32\n```lean\n-- Mathlib.RingTheory.Ideal.Cotangent.mem_toCotangent_ker (L58-L61)\ntheorem mem_toCotangent_ker {x : I} : x \u2208 LinearMap.ker I.toCotangent \u2194 (x : R) \u2208 I ^ 2 := by\nrw [\u2190 I.map_toCotangent_ker]\n simp\n```\n\n-- snippet 33\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.mem_colon_iff_le (L134-L137)\ntheorem mem_colon_iff_le {r} : r \u2208 N.colon N' \u2194 r \u2022 N' \u2264 N := by\naesop (add simp SetLike.coe_subset_coe)\n\n/-- A variant for arbitrary sets in commutative semirings -/\n```\n\n-- snippet 34\n```lean\n-- Mathlib.RingTheory.Ideal.Cotangent.toCotangent_surjective (L68-L69)\ntheorem toCotangent_surjective : Function.Surjective I.toCotangent := Submodule.mkQ_surjective _\n```\n\n-- snippet 35\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.not_isField_iff_exists_ideal_bot_lt_and_lt_top (L276-L281)\ntheorem not_isField_iff_exists_ideal_bot_lt_and_lt_top [Nontrivial R] :\n \u00acIsField R \u2194 \u2203 I : Ideal R, \u22a5 < I \u2227 I < \u22a4 := by\nrefine \u27e8fun h \u21a6 ?_, fun \u27e8I, h_bot, h_top\u27e9 \u21a6 not_isField_of_ne_of_ne h_bot.ne' h_top.ne\u27e9\n obtain \u27e8I, hI, hIm\u27e9 := exists_maximal_of_not_isField h\n exact \u27e8I, bot_lt_iff_ne_bot.mpr hI, lt_top_iff_ne_top.mpr hIm.ne_top\u27e9\n```\n\n-- snippet 36\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_bot (L120-L129)\nlemma colon_bot : N.colon ((\u22a5 : Submodule R M) : Set M) = \u22a4 := by\nsimp\n\nend Semiring\n\nsection CommSemiring\n\nvariable [CommSemiring R] [AddCommMonoid M] [Module R M]\nvariable {N N' : Submodule R M} {S : Set M}\n```\n\n-- snippet 37\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_finsetInf (L97-L100)\nlemma colon_finsetInf {\u03b9 : Type*} (s : Finset \u03b9) (f : \u03b9 \u2192 Submodule R M) :\n (s.inf f).colon S = s.inf (fun i \u21a6 (f i).colon S) := by\naesop (add simp mem_colon)\n```\n\n-- snippet 38\n```lean\n-- Mathlib.RingTheory.Ideal.BigOperators.sum_mem (L29-L33)\ntheorem sum_mem (I : Ideal \u03b1) {\u03b9 : Type*} {t : Finset \u03b9} {f : \u03b9 \u2192 \u03b1} :\n (\u2200 c \u2208 t, f c \u2208 I) \u2192 (\u2211 i \u2208 t, f i) \u2208 I :=\nSubmodule.sum_mem I\n\nend Ideal\n```\n\n-- snippet 39\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.preimage_comap_associatedPrimes_eq_associatedPrimes_of_isLocalizedModule (L122-L130)\nlemma preimage_comap_associatedPrimes_eq_associatedPrimes_of_isLocalizedModule\n [IsNoetherianRing R] :\n (Ideal.comap (algebraMap R R')) \u207b\u00b9' (associatedPrimes R M) = associatedPrimes R' M' := by\next p\n exact \u27e8mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule S f p,\n fun h \u21a6 comap_mem_associatedPrimes_of_mem_associatedPrimes_of_isLocalizedModule_of_fg S f p h\n ((isNoetherianRing_iff_ideal_fg R).mp \u2039_\u203a _)\u27e9\n\nvariable (R M) in\n```\n\n-- snippet 40\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.span_range_pow_eq_top (L186-L195)\ntheorem span_range_pow_eq_top (s : Set \u03b1) (hs : span s = \u22a4) (n : s \u2192 \u2115) :\n span (Set.range fun x \u21a6 x.1 ^ n x) = \u22a4 := by\nhave \u27e8t, hts, mem\u27e9 := Submodule.mem_span_finite_of_mem_span ((eq_top_iff_one _).mp hs)\n refine top_unique ((span_pow_eq_top _ ((eq_top_iff_one _).mpr mem) <|\n t.attach.sup fun x \u21a6 n \u27e8x, hts x.2\u27e9).ge.trans <| span_le.mpr ?_)\n rintro _ \u27e8x, hxt, rfl\u27e9\n rw [\u2190 Nat.sub_add_cancel (Finset.le_sup <| t.mem_attach \u27e8x, hxt\u27e9)]\n simp_rw [pow_add]\n exact mul_mem_left _ _ (subset_span \u27e8_, rfl\u27e9)\n```\n\n-- snippet 41\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.pow_multiset_sum_mem_span_pow (L128-L154)\ntheorem pow_multiset_sum_mem_span_pow [DecidableEq \u03b1] (s : Multiset \u03b1) (n : \u2115) :\n s.sum ^ (Multiset.card s * n + 1) \u2208\n span ((s.map fun (x : \u03b1) \u21a6 x ^ (n + 1)).toFinset : Set \u03b1) := by\ninduction s using Multiset.induction_on with\n | empty => simp\n | cons a s hs => ?_\n simp only [Finset.coe_insert, Multiset.map_cons, Multiset.toFinset_cons, Multiset.sum_cons,\n Multiset.card_cons, add_pow]\n refine Submodule.sum_mem _ ?_\n intro c _hc\n rw [mem_span_insert]\n by_cases! h : n + 1 \u2264 c\n \u00b7 refine \u27e8a ^ (c - (n + 1)) * s.sum ^ ((Multiset.card s + 1) * n + 1 - c) *\n ((Multiset.card s + 1) * n + 1).choose c, 0, Submodule.zero_mem _, ?_\u27e9\n rw [mul_comm _ (a ^ (n + 1))]\n simp_rw [\u2190 mul_assoc]\n rw [\u2190 pow_add, add_zero, add_tsub_cancel_of_le h]\n \u00b7 use 0\n simp_rw [zero_mul, zero_add]\n refine \u27e8_, ?_, rfl\u27e9\n replace h : c \u2264 n := Nat.lt_succ_iff.mp h\n have : (Multiset.card s + 1) * n + 1 - c = Multiset.card s * n + 1 + (n - c) := by\n rw [add_mul, one_mul, add_assoc, add_comm n 1, \u2190 add_assoc, add_tsub_assoc_of_le h]\n rw [this, pow_add]\n simp_rw [mul_assoc, mul_comm (s.sum ^ (Multiset.card s * n + 1)), \u2190 mul_assoc]\n exact mul_mem_left _ _ hs\n```\n\n-- snippet 42\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_eq_top_iff_subset (L85-L87)\nlemma colon_eq_top_iff_subset (S : Set M) : N.colon S = \u22a4 \u2194 S \u2286 N := by\naesop (add simp [mem_colon, Ideal.eq_top_iff_one])\n```\n\n-- snippet 43\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.span_single_eq_top (L203-L232)\nlemma span_single_eq_top {\u03b9 : Type*} [DecidableEq \u03b9] [Finite \u03b9] (R : \u03b9 \u2192 Type*)\n [\u2200 i, Semiring (R i)] : Ideal.span (Set.range fun i \u21a6 (Pi.single i 1 : \u03a0 i, R i)) = \u22a4 := by\nrw [_root_.eq_top_iff]\n rintro x -\n induction x using Pi.single_induction with\n | zero => simp\n | add f g hf hg => exact Ideal.add_mem _ hf hg\n | single i r =>\n rw [show Pi.single i r = Pi.single i r * Pi.single i 1 by simp [\u2190 Pi.single_mul_left]]\n exact Ideal.mul_mem_left _ _ (Ideal.subset_span \u27e8i, rfl\u27e9)\n\nend Ideal\n\nend CommSemiring\n\nsection DivisionSemiring\n\nvariable {K : Type*} [DivisionSemiring K] (I : Ideal K)\n\nnamespace Ideal\n\nvariable (K) in\n/-- A bijection between (left) ideals of a division ring and `{0, 1}`, sending `\u22a5` to `0`\nand `\u22a4` to `1`. -/\nnoncomputable def equivFinTwo : Ideal K \u2243 Fin 2 where\n toFun := fun I \u21a6 if I = \u22a5 then 0 else 1\n invFun := ![\u22a5, \u22a4]\n left_inv := fun I \u21a6 by rcases eq_bot_or_top I with rfl | rfl <;> simp\n right_inv := fun i \u21a6 by fin_cases i <;> simp\n```\n\n-- snippet 44\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.IsAssociatedPrime (L98-L102)\ndef IsAssociatedPrime : Prop :=\n(\u22a5 : Submodule R M).IsAssociatedPrime I\n\nvariable (R) in\n/-- The set of associated primes of a module. -/\n```\n\n-- snippet 45\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.bot_colon (L64-L67)\ntheorem bot_colon : colon (\u22a5 : Submodule R M) (N : Set M) = N.annihilator := by\next x\n simp [mem_colon, mem_annihilator]\n```\n\n-- snippet 46\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.biUnion_associatedPrimes_eq_compl_nonZeroDivisors (L240-L246)\ntheorem biUnion_associatedPrimes_eq_compl_nonZeroDivisors [IsNoetherianRing R] :\n \u22c3 p \u2208 associatedPrimes R R, p = (nonZeroDivisors R : Set R)\u1d9c :=\n(biUnion_associatedPrimes_eq_zero_divisors R R).trans <| by\n ext; simp [\u2190 nonZeroDivisorsLeft_eq_nonZeroDivisors, and_comm]\n\nvariable {R M}\n```\n\n-- snippet 47\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.top_colon (L102-L104)\nlemma top_colon : (\u22a4 : Submodule R M).colon S = \u22a4 := by\naesop (add simp mem_colon)\n```\n\n-- snippet 48\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.iInf_colon (L93-L95)\nlemma iInf_colon {\u03b9 : Sort*} (f : \u03b9 \u2192 Submodule R M) : (\u2a05 i, f i).colon S = \u2a05 i, (f i).colon S := by\naesop (add simp mem_colon)\n```\n\n-- snippet 49\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.inf_colon (L89-L91)\nlemma inf_colon : (N\u2081 \u2293 N\u2082).colon S = N\u2081.colon S \u2293 N\u2082.colon S := by\naesop (add simp mem_colon)\n```\n\n-- snippet 50\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.prod_mem (L196-L202)\ntheorem prod_mem {\u03b9 : Type*} {f : \u03b9 \u2192 \u03b1} {s : Finset \u03b9}\n (I : Ideal \u03b1) {i : \u03b9} (hi : i \u2208 s) (hfi : f i \u2208 I) :\n \u220f i \u2208 s, f i \u2208 I := by\nclassical\n rw [Finset.prod_eq_prod_diff_singleton_mul hi]\n exact Ideal.mul_mem_left _ _ hfi\n```\n\n-- snippet 51\n```lean\n-- Mathlib.RingTheory.Ideal.Cotangent.toCotangent_eq_zero (L66-L67)\ntheorem toCotangent_eq_zero (x : I) : I.toCotangent x = 0 \u2194 (x : R) \u2208 I ^ 2 := I.mem_toCotangent_ker\n```\n\n-- snippet 52\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.LinearEquiv (L128-L132)\ntheorem LinearEquiv.isAssociatedPrime_iff (l : M \u2243\u2097[R] M') :\n IsAssociatedPrime I M \u2194 IsAssociatedPrime I M' :=\n\u27e8fun h => h.map_of_injective l l.injective,\n fun h => h.map_of_injective l.symm l.symm.injective\u27e9\n```\n\n-- snippet 53\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.associatedPrimes (L158-L169)\ntheorem associatedPrimes.finite : (associatedPrimes A M).Finite := by\ninduction \u2039Module.Finite A M\u203a using\n IsNoetherianRing.induction_on_isQuotientEquivQuotientPrime A with\n | subsingleton N => simp [associatedPrimes.eq_empty_of_subsingleton]\n | quotient N p f =>\n have := associatedPrimes.eq_singleton_of_isPrimary p.2.isPrimary\n simp [LinearEquiv.AssociatedPrimes.eq f, this]\n | exact N\u2081 N\u2082 N\u2083 f g hf _ hfg h\u2081 h\u2083 =>\n exact (h\u2081.union h\u2083).subset (associatedPrimes.subset_union_of_exact hf hfg)\n\n/-- Every maximal ideal of a commutative Noetherian total ring of fractions `A` is\nan associated prime of the `A`-module `A`. -/\n```\n\n-- snippet 54\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.add_pow_add_pred_mem_of_pow_mem (L123-L127)\ntheorem add_pow_add_pred_mem_of_pow_mem {m n : \u2115}\n (ha : a ^ m \u2208 I) (hb : b ^ n \u2208 I) :\n (a + b) ^ (m + n - 1) \u2208 I :=\nI.add_pow_add_pred_mem_of_pow_mem_of_commute ha hb (Commute.all ..)\n```\n\n-- snippet 55\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule (L40-L69)\nlemma mem_associatedPrimes_of_comap_mem_associatedPrimes_of_isLocalizedModule\n (p : Ideal R') (ass : p.comap (algebraMap R R') \u2208 associatedPrimes R M) :\n p \u2208 associatedPrimes R' M' := by\nrcases ass with \u27e8hp, x, hx\u27e9\n constructor\n \u00b7 refine (IsLocalization.isPrime_iff_isPrime_disjoint S _ _).mpr\n \u27e8hp, (IsLocalization.disjoint_comap_iff S R' p).mpr ?_\u27e9\n by_contra eqtop\n simp [eqtop, Ideal.comap_top, Ideal.isPrime_iff] at hp\n \u00b7 use f x\n ext t\n rcases IsLocalization.exists_mk'_eq S t with \u27e8r, s, hrs\u27e9\n simp_rw [\u2190 hrs, Ideal.mem_radical_iff, mem_colon_singleton, \u2190 IsLocalizedModule.mk'_one S f,\n \u2190 IsLocalization.mk'_pow, IsLocalizedModule.mk'_smul_mk', mul_one, mem_bot,\n IsLocalizedModule.mk'_eq_zero']\n refine \u27e8fun h \u21a6 exists_comm.mp \u27e81, ?_\u27e9, fun \u27e8n, t, ht\u27e9 \u21a6 ?_\u27e9\n \u00b7 simp only [\u2190 mem_colon_singleton, one_smul, \u2190 mem_bot R, \u2190 hx, \u2190 Ideal.mem_radical_iff]\n exact hSR'.mk'_mem_iff.mp h\n \u00b7 have : hSR'.mk' R' r s = hSR'.mk' R' (t.1 * r) 1 * hSR'.mk' R' 1 (t * s) := by\n rw [\u2190 hSR'.mk'_mul, mul_one, one_mul, \u2190 sub_eq_zero, \u2190 hSR'.mk'_sub, Submonoid.coe_mul]\n simp [\u2190 mul_assoc, mul_comm r t.1, IsLocalization.mk'_zero]\n rw [this]\n apply Ideal.IsTwoSided.mul_mem_of_left\n rw [IsLocalization.mk'_one, \u2190 Ideal.mem_comap, hx]\n rcases eq_zero_or_pos n with rfl | hn\n \u00b7 exact Ideal.IsTwoSided.mul_mem_of_left _ \u27e81, by simpa using ht\u27e9\n \u00b7 use n\n rw [mem_colon_singleton, mul_pow, mul_smul, \u2190 mem_colon_singleton]\n exact Ideal.pow_mem_of_mem _ (by simpa using ht) n hn\n```\n\n-- snippet 56\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.isAssociatedPrime_iff (L117-L120)\ntheorem isAssociatedPrime_iff [IsNoetherianRing R] :\n IsAssociatedPrime I M \u2194 I.IsPrime \u2227 \u2203 x : M, I = colon \u22a5 {x} :=\n(\u22a5 : Submodule R M).isAssociatedPrime_iff\n```\n\n-- snippet 57\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.add_pow_mem_of_pow_mem_of_le_of_commute (L83-L96)\ntheorem add_pow_mem_of_pow_mem_of_le_of_commute {m n k : \u2115}\n (ha : a ^ m \u2208 I) (hb : b ^ n \u2208 I) (hk : m + n \u2264 k + 1)\n (hab : Commute a b) :\n (a + b) ^ k \u2208 I := by\nsimp_rw [hab.add_pow, \u2190 Nat.cast_comm]\n apply I.sum_mem\n intro c _\n apply mul_mem_left\n by_cases h : m \u2264 c\n \u00b7 rw [hab.pow_pow]\n exact I.mul_mem_left _ (I.pow_mem_of_pow_mem ha h)\n \u00b7 refine I.mul_mem_left _ (I.pow_mem_of_pow_mem hb ?_)\n lia\n```\n\n-- snippet 58\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.add_pow_mem_of_pow_mem_of_le (L118-L122)\ntheorem add_pow_mem_of_pow_mem_of_le {m n k : \u2115}\n (ha : a ^ m \u2208 I) (hb : b ^ n \u2208 I) (hk : m + n \u2264 k + 1) :\n (a + b) ^ k \u2208 I :=\nI.add_pow_mem_of_pow_mem_of_le_of_commute ha hb hk (Commute.all ..)\n```\n\n-- snippet 59\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_singleton_zero (L117-L119)\nlemma colon_singleton_zero : N.colon {0} = \u22a4 := by\nsimp\n```\n\n-- snippet 60\n```lean\n-- Mathlib.RingTheory.Ideal.Cotangent.toCotangent (L51-L53)\ndef toCotangent : I \u2192\u2097[R] I.Cotangent := Submodule.mkQ _\nset_option backward.isDefEq.respectTransparency false in\n```\n\n-- snippet 61\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_union (L106-L108)\nlemma colon_union : N.colon (S\u2081 \u222a S\u2082) = N.colon S\u2081 \u2293 N.colon S\u2082 := by\naesop (add simp mem_colon)\n```\n\n-- snippet 62\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.mem_colon_singleton (L48-L50)\ntheorem mem_colon_singleton {x : M} {r : R} : r \u2208 N.colon {x} \u2194 r \u2022 x \u2208 N := by\nsimp [mem_colon, forall_eq]\n```\n\n-- snippet 63\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.associatedPrimes (L103-L107)\ndef associatedPrimes : Set (Ideal R) :=\n{ I | IsAssociatedPrime I M }\n\nvariable {I J M} {M' : Type*} [AddCommMonoid M'] [Module R M'] (f : M \u2192\u2097[R] M')\n```\n\n-- snippet 64\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.span_pow_eq_top (L161-L185)\ntheorem span_pow_eq_top (s : Set \u03b1) (hs : span s = \u22a4) (n : \u2115) :\n span ((fun (x : \u03b1) => x ^ n) '' s) = \u22a4 := by\nrw [eq_top_iff_one]\n rcases n with - | n\n \u00b7 obtain rfl | \u27e8x, hx\u27e9 := eq_empty_or_nonempty s\n \u00b7 rw [Set.image_empty, hs]\n trivial\n \u00b7 exact subset_span \u27e8_, hx, pow_zero _\u27e9\n rw [eq_top_iff_one, span, Finsupp.mem_span_iff_linearCombination] at hs\n rcases hs with \u27e8f, hf\u27e9\n simp only [Finsupp.linearCombination, Finsupp.coe_lsum, Finsupp.sum, LinearMap.coe_smulRight,\n LinearMap.id_coe, id_eq, smul_eq_mul] at hf\n have := sum_pow_mem_span_pow f.support (fun a => f a * a) n\n rw [hf, one_pow] at this\n refine span_le.mpr ?_ this\n rintro _ hx\n simp_rw [Set.mem_image] at hx\n rcases hx with \u27e8x, _, rfl\u27e9\n have : span ({(x : \u03b1) ^ (n + 1)} : Set \u03b1) \u2264 span ((fun x : \u03b1 => x ^ (n + 1)) '' s) := by\n rw [span_le, Set.singleton_subset_iff]\n exact subset_span \u27e8x, x.prop, rfl\u27e9\n refine this ?_\n rw [mul_pow, mem_span_singleton]\n exact \u27e8f x ^ (n + 1), mul_comm _ _\u27e9\n```\n\n-- snippet 65\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_iUnion (L110-L112)\nlemma colon_iUnion {\u03b9 : Sort*} (f : \u03b9 \u2192 Set M) : N.colon (\u22c3 i, f i) = \u2a05 i, N.colon (f i) := by\naesop (add simp mem_colon)\n```\n\n-- snippet 66\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.isField_iff_isSimpleOrder_ideal (L292-L302)\ntheorem isField_iff_isSimpleOrder_ideal : IsField R \u2194 IsSimpleOrder (Ideal R) := by\ncases subsingleton_or_nontrivial R\n \u00b7 exact\n \u27e8fun h => (not_isField_of_subsingleton _ h).elim, fun h =>\n (false_of_nontrivial_of_subsingleton <| Ideal R).elim\u27e9\n rw [\u2190 not_iff_not, Ring.not_isField_iff_exists_ideal_bot_lt_and_lt_top]\n contrapose! +distrib\n simp_rw [not_lt_top_iff, not_bot_lt_iff]\n exact \u27e8fun h => \u27e8h\u27e9, fun h => h.2\u27e9\n\n/-- When a ring is not a field, the maximal ideals are nontrivial. -/\n```\n\n-- snippet 67\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.isSimpleOrder (L237-L249)\ninstance isSimpleOrder : IsSimpleOrder (Ideal K) :=\n\u27e8eq_bot_or_top\u27e9\n\nend Ideal\n\nend DivisionSemiring\n\n-- TODO: consider moving the lemmas below out of the `Ring` namespace since they are\n-- about `CommSemiring`s.\nnamespace Ring\n\nvariable {R : Type*} [CommSemiring R]\n```\n\n-- snippet 68\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.mem_colon (L45-L46)\ntheorem mem_colon {r} : r \u2208 N.colon S \u2194 \u2200 s \u2208 S, r \u2022 s \u2208 N := Set.smul_set_subset_iff\n```\n\n-- snippet 69\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.ne_bot_of_isMaximal_of_not_isField (L303-L314)\ntheorem ne_bot_of_isMaximal_of_not_isField [Nontrivial R] {M : Ideal R} (max : M.IsMaximal)\n (not_field : \u00acIsField R) : M \u2260 \u22a5 := by\nrintro rfl\n obtain \u27e8I, hIbot, hItop\u27e9 := not_isField_iff_exists_ideal_bot_lt_and_lt_top.mp not_field\n exact hIbot.ne (max.eq_of_le hItop.ne bot_le)\n\nend Ring\n\nnamespace Ideal\n\nvariable {R : Type*} [CommSemiring R] [Nontrivial R]\n```\n\n-- snippet 70\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.not_isAssociatedPrime_of_subsingleton (L133-L138)\ntheorem not_isAssociatedPrime_of_subsingleton [Subsingleton M] : \u00acIsAssociatedPrime I M := by\nrintro \u27e8hI, x, hx\u27e9\n apply hI.ne_top\n simp [hx, Subsingleton.elim x 0]\n\nvariable (R) in\n```\n\n-- snippet 71\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Basic.prod (L206-L211)\ntheorem prod : associatedPrimes R (M \u00d7 M') = associatedPrimes R M \u222a associatedPrimes R M' :=\n(subset_union_of_exact LinearMap.inl_injective .inl_snd).antisymm (Set.union_subset_iff.2\n \u27e8subset_of_injective LinearMap.inl_injective, subset_of_injective LinearMap.inr_injective\u27e9)\n\nend associatedPrimes\n```\n\n-- snippet 72\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.Submodule (L51-L55)\ndef Submodule.IsQuotientEquivQuotientPrime (N\u2081 N\u2082 : Submodule A M) :=\nN\u2081 \u2264 N\u2082 \u2227 \u2203 (p : PrimeSpectrum A), Nonempty ((\u21a5N\u2082 \u29f8 N\u2081.submoduleOf N\u2082) \u2243\u2097[A] A \u29f8 p.1)\n\nset_option backward.isDefEq.respectTransparency false in\nopen LinearMap in\n```\n\n-- snippet 73\n```lean\n-- Mathlib.RingTheory.Ideal.Cotangent.Cotangent (L41-L49)\ndef Cotangent : Type _ := I \u29f8 (I \u2022 \u22a4 : Submodule R I)\nderiving Inhabited, AddCommGroup, Module (R \u29f8 I)\n\nderiving instance Module S, IsScalarTower S S' for Cotangent I\n\nvariable [IsNoetherian R I] in\nderiving instance IsNoetherian R for Cotangent I\n\n/-- The quotient map from `I` to `I \u29f8 I ^ 2`. -/\n```\n\n-- snippet 74\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.annihilator_quotient (L175-L181)\ntheorem annihilator_quotient : Module.annihilator R (M \u29f8 N) = N.colon Set.univ := by\next r\n have htop : (\u22a4 : Submodule R (M \u29f8 N)) = (\u22a4 : Submodule R M).map N.mkQ := by\n simpa [map_top] using (LinearMap.range_eq_top.mpr (mkQ_surjective N)).symm\n rw [\u2190 annihilator_top (R := R) (M := M \u29f8 N), htop,\n annihilator_map_mkQ_eq_colon (N := N) (P := \u22a4), Submodule.top_coe]\n```\n\n-- snippet 75\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.colon_mono (L68-L70)\ntheorem colon_mono (hn : N\u2081 \u2264 N\u2082) (hs : S\u2081 \u2286 S\u2082) : N\u2081.colon S\u2082 \u2264 N\u2082.colon S\u2081 :=\nfun _ hrns \u21a6 mem_colon.mpr fun s\u2081 hs\u2081 \u21a6 hn <| mem_colon.mp hrns s\u2081 <| hs hs\u2081\n```\n\n-- snippet 76\n```lean\n-- Mathlib.RingTheory.Ideal.Basis.constr_basisSpanSingleton (L46-L54)\ntheorem constr_basisSpanSingleton {N : Type*} [Semiring N] [Module N S] [SMulCommClass R N S]\n (b : Basis \u03b9 R S) {x : S} (hx : x \u2260 0) :\n (b.constr N).toFun (((\u2191) : _ \u2192 S) \u2218 (basisSpanSingleton b hx)) = Algebra.lmul R S x :=\nb.ext fun i => by simp\n\nend Ideal\n\n/-- If `I : Ideal S` has a basis over `R`,\n`x \u2208 I` iff it is a linear combination of basis vectors. -/\n```\n\n-- snippet 77\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.exists_not_isUnit_of_not_isField (L250-L258)\ntheorem exists_not_isUnit_of_not_isField [Nontrivial R] (hf : \u00acIsField R) :\n \u2203 (x : R) (_hx : x \u2260 (0 : R)), \u00acIsUnit x := by\nhave : \u00ac_ := fun h => hf \u27e8exists_pair_ne R, mul_comm, h\u27e9\n simp_rw [isUnit_iff_exists_inv]\n push Not at this \u22a2\n obtain \u27e8x, hx, not_unit\u27e9 := this\n exact \u27e8x, hx, not_unit\u27e9\n\nopen Ideal in\n```\n\n-- snippet 78\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.bot_lt_of_maximal (L315-L318)\ntheorem bot_lt_of_maximal (M : Ideal R) [hm : M.IsMaximal] (non_field : \u00acIsField R) : \u22a5 < M :=\n(Ring.ne_bot_of_isMaximal_of_not_isField hm non_field).bot_lt\n\nend Ideal\n```\n\n-- snippet 79\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.mem_colon' (L131-L133)\ntheorem mem_colon' {r} : r \u2208 N.colon S \u2194 S \u2264 comap (r \u2022 (LinearMap.id : M \u2192\u2097[R] M)) N :=\nmem_colon\n```\n\n-- snippet 80\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Localization.minimalPrimes_annihilator_subset_associatedPrimes (L131-L150)\nlemma minimalPrimes_annihilator_subset_associatedPrimes [IsNoetherianRing R] [Module.Finite R M] :\n (Module.annihilator R M).minimalPrimes \u2286 associatedPrimes R M := by\nintro p hp\n have prime := hp.1.1\n let R\u209a := Localization.AtPrime p\n have : Nontrivial (LocalizedModule p.primeCompl M) := by\n simpa [\u2190 Module.mem_support_iff (p := \u27e8p, prime\u27e9), Module.support_eq_zeroLocus] using hp.1.2\n rcases associatedPrimes.nonempty R\u209a (LocalizedModule p.primeCompl M) with \u27e8q, hq\u27e9\n have q_prime : q.IsPrime := IsAssociatedPrime.isPrime hq\n simp only [\u2190 preimage_comap_associatedPrimes_eq_associatedPrimes_of_isLocalizedModule p.primeCompl\n R\u209a (LocalizedModule.mkLinearMap p.primeCompl M), Set.mem_preimage] at hq\n have ann_le : Module.annihilator R M \u2264 Ideal.comap (algebraMap R R\u209a) q :=\n le_of_eq_of_le Submodule.annihilator_top.symm (IsAssociatedPrime.annihilator_le hq)\n have le : Ideal.comap (algebraMap R R\u209a) q \u2264 p := by\n have := (IsLocalization.disjoint_comap_iff p.primeCompl R\u209a q).mpr q_prime.ne_top\n simpa only [Ideal.primeCompl, Submonoid.coe_set_mk, Subsemigroup.coe_set_mk,\n Set.disjoint_compl_left_iff_subset] using this\n simpa [Minimal.eq_of_le hp.out \u27e8IsAssociatedPrime.isPrime hq, ann_le\u27e9 le] using hq\n\nend Module.associatedPrimes\n```\n\n-- snippet 81\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.mem_colon_span_singleton (L154-L156)\ntheorem mem_colon_span_singleton {x : M} {r : R} : r \u2208 N.colon (span R {x}) \u2194 r \u2022 x \u2208 N := by\nsimp\n```\n\n-- snippet 82\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.mem_pi (L56-L58)\ntheorem mem_pi (r : \u03a0 i, R i) : r \u2208 pi I \u2194 \u2200 i, r i \u2208 I i :=\nIff.rfl\n```\n\n-- snippet 83\n```lean\n-- Mathlib.RingTheory.Ideal.Colon.iInf_colon_iUnion (L74-L77)\ntheorem iInf_colon_iUnion (\u03b9\u2081 : Sort*) (f : \u03b9\u2081 \u2192 Submodule R M) (\u03b9\u2082 : Sort*) (g : \u03b9\u2082 \u2192 Set M) :\n (\u2a05 i, f i).colon (\u22c3 j, g j) = \u2a05 (i) (j), (f i).colon (g j) := by\naesop (add simp mem_colon)\n```\n\n-- snippet 84\n```lean\n-- Mathlib.RingTheory.Ideal.Cotangent.toCotangent_eq (L62-L65)\ntheorem toCotangent_eq {x y : I} : I.toCotangent x = I.toCotangent y \u2194 (x - y : R) \u2208 I ^ 2 := by\nrw [\u2190 sub_eq_zero]\n exact I.mem_toCotangent_ker\n```\n\n-- snippet 85\n```lean\n-- Mathlib.RingTheory.Ideal.AssociatedPrime.Finiteness.IsNoetherianRing (L92-L117)\ntheorem IsNoetherianRing.exists_relSeries_isQuotientEquivQuotientPrime :\n \u2203 s : RelSeries {(N\u2081, N\u2082) | Submodule.IsQuotientEquivQuotientPrime (A := A) (M := M) N\u2081 N\u2082},\ns.head = \u22a5 \u2227 s.last = \u22a4 := by\n refine WellFoundedGT.induction_top \u27e8\u22a5, .singleton _ \u22a5, rfl, rfl\u27e9 ?_\n rintro N hN \u27e8s, hs\u2081, hs\u2082\u27e9\n have := Submodule.Quotient.nontrivial_iff.mpr hN\n obtain \u27e8p, hp\u27e9 := associatedPrimes.nonempty A (M \u29f8 N)\n rw [AssociatedPrimes.mem_iff, isAssociatedPrime_iff] at hp\n obtain \u27e8hp, x, rfl\u27e9 := hp\n obtain \u27e8x, rfl\u27e9 := Submodule.mkQ_surjective _ x\n have hxN : x \u2209 N := fun h \u21a6 hp.ne_top (by rw [show N.mkQ x = 0 by simpa]; simp)\n have := Submodule.isQuotientEquivQuotientPrime_iff.mpr \u27e8x, hp, rfl\u27e9\n refine \u27e8_, by simpa [hs\u2082], s.snoc _ (hs\u2082 \u25b8 this), by simpa, rfl\u27e9\n\n/-- If a property on finitely generated modules over a Noetherian ring satisfies that:\n\n- it holds for zero module (it's formalized as it holds for any module which is subsingleton),\n- it holds for `A \u29f8 p` for every prime ideal `p` of `A` (to avoid universe problem,\n it's formalized as it holds for any module isomorphic to `A \u29f8 p`),\n- it is stable by short exact sequences,\n\nthen the property holds for every finitely generated modules.\n\nNOTE: This should be the induction principle for `M`, but due to the bug\nhttps://github.com/leanprover/lean4/issues/4246\ncurrently it is induction for `Module.Finite A M`. -/\n```\n\n-- snippet 86\n```lean\n-- Mathlib.RingTheory.Ideal.Basic.not_isField_of_ne_of_ne (L271-L275)\ntheorem not_isField_of_ne_of_ne [Nontrivial R] {I : Ideal R} (h_bot : I \u2260 \u22a5) (h_top : I \u2260 \u22a4) :\n \u00ac IsField R := by\ncontrapose! h_bot\n exact ((isField_iff_maximal_bot.mp h_bot).eq_of_le h_top bot_le).symm\n```\n[/INST]", "sample_id": "C-Mathlib.RingTheory.Ideal.KrullsHeightTheorem.Ideal", "source": {"declaration": "Mathlib.RingTheory.Ideal.KrullsHeightTheorem.Ideal", "file": "Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.RingTheory.Ideal.KrullsHeightTheorem", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Ideal/KrullsHeightTheorem.lean#L381", "span": "L381-L385"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"context_enriched": true, "source_grounded_context_enriched": true, "statement": "lemma LinearIsometry.inr_apply [SeminormedAddCommGroup E] [NormedSpace \ud835\udd5c E]\n [SeminormedAddCommGroup F] [NormedSpace \ud835\udd5c F] (y : F) :\n LinearIsometry.inr \ud835\udd5c E F y = (0, y)", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 595, "declarations_count": 63, "diagnostics_count": 0, "duplicate_fingerprint": "1bf1055422929ff0", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 649, "lean_code_chars": 175, "lean_code_ratio": 0.2941, "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.Analysis.Normed.Operator.NormedSpace).", "role": "system"}, {"content": "Complete the following proof.\n\nOpen namespaces: Topology, scoped, NNReal, Metric, ContinuousLinearMap, Set, Real\n\n## Surrounding context in Mathlib/Analysis/Normed/Operator/NormedSpace.lean\n```lean\n-- Mathlib.Analysis.Normed.Operator.NormedSpace.bound_of_shell (L45-L53)\ntheorem bound_of_shell [RingHomIsometric \u03c3\u2081\u2082] (f : E \u2192\u209b\u2097[\u03c3\u2081\u2082] F) {\u03b5 C : \u211d} (\u03b5_pos : 0 < \u03b5) {c : \ud835\udd5c}\n (hc : 1 < \u2016c\u2016) (hf : \u2200 x, \u03b5 / \u2016c\u2016 \u2264 \u2016x\u2016 \u2192 \u2016x\u2016 < \u03b5 \u2192 \u2016f x\u2016 \u2264 C * \u2016x\u2016) (x : E) :\n \u2016f x\u2016 \u2264 C * \u2016x\u2016\n\n-- Mathlib.Analysis.Normed.Operator.NormedSpace.bound_of_ball_bound (L54-L67)\ntheorem bound_of_ball_bound {r : \u211d} (r_pos : 0 < r) (c : \u211d) (f : E \u2192\u2097[\ud835\udd5c] F\u2097)\n (h : \u2200 z \u2208 Metric.ball (0 : E) r, \u2016f z\u2016 \u2264 c) : \u2203 C, \u2200 z : E, \u2016f z\u2016 \u2264 C * \u2016z\u2016\n\n-- Mathlib.Analysis.Normed.Operator.NormedSpace.antilipschitz_of_comap_nhds_le (L68-L98)\ntheorem antilipschitz_of_comap_nhds_le [h : RingHomIsometric \u03c3\u2081\u2082] (f : E \u2192\u209b\u2097[\u03c3\u2081\u2082] F)\n (hf : (\ud835\udcdd 0).comap f \u2264 \ud835\udcdd 0) : \u2203 K, AntilipschitzWith K f\n```\n\n```lean\nlemma LinearIsometry.inr_apply [SeminormedAddCommGroup E] [NormedSpace \ud835\udd5c E]\n [SeminormedAddCommGroup F] [NormedSpace \ud835\udd5c F] (y : F) :\n LinearIsometry.inr \ud835\udd5c E F y = (0, y)\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.Analysis.Normed.Operator.NormedSpace).\n\nComplete the following proof.\n\nOpen namespaces: Topology, scoped, NNReal, Metric, ContinuousLinearMap, Set, Real\n\n## Surrounding context in Mathlib/Analysis/Normed/Operator/NormedSpace.lean\n```lean\n-- Mathlib.Analysis.Normed.Operator.NormedSpace.bound_of_shell (L45-L53)\ntheorem bound_of_shell [RingHomIsometric \u03c3\u2081\u2082] (f : E \u2192\u209b\u2097[\u03c3\u2081\u2082] F) {\u03b5 C : \u211d} (\u03b5_pos : 0 < \u03b5) {c : \ud835\udd5c}\n (hc : 1 < \u2016c\u2016) (hf : \u2200 x, \u03b5 / \u2016c\u2016 \u2264 \u2016x\u2016 \u2192 \u2016x\u2016 < \u03b5 \u2192 \u2016f x\u2016 \u2264 C * \u2016x\u2016) (x : E) :\n \u2016f x\u2016 \u2264 C * \u2016x\u2016\n\n-- Mathlib.Analysis.Normed.Operator.NormedSpace.bound_of_ball_bound (L54-L67)\ntheorem bound_of_ball_bound {r : \u211d} (r_pos : 0 < r) (c : \u211d) (f : E \u2192\u2097[\ud835\udd5c] F\u2097)\n (h : \u2200 z \u2208 Metric.ball (0 : E) r, \u2016f z\u2016 \u2264 c) : \u2203 C, \u2200 z : E, \u2016f z\u2016 \u2264 C * \u2016z\u2016\n\n-- Mathlib.Analysis.Normed.Operator.NormedSpace.antilipschitz_of_comap_nhds_le (L68-L98)\ntheorem antilipschitz_of_comap_nhds_le [h : RingHomIsometric \u03c3\u2081\u2082] (f : E \u2192\u209b\u2097[\u03c3\u2081\u2082] F)\n (hf : (\ud835\udcdd 0).comap f \u2264 \ud835\udcdd 0) : \u2203 K, AntilipschitzWith K f\n```\n\n```lean\nlemma LinearIsometry.inr_apply [SeminormedAddCommGroup E] [NormedSpace \ud835\udd5c E]\n [SeminormedAddCommGroup F] [NormedSpace \ud835\udd5c F] (y : F) :\n LinearIsometry.inr \ud835\udd5c E F y = (0, y)\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "sample_id": "A-Mathlib.Analysis.Normed.Operator.NormedSpace.LinearIsometry", "source": {"declaration": "Mathlib.Analysis.Normed.Operator.NormedSpace.LinearIsometry", "file": "Mathlib/Analysis/Normed/Operator/NormedSpace.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Analysis.Normed.Operator.NormedSpace", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Normed/Operator/NormedSpace.lean#L380", "span": "L380-L383"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"source_grounded_context_enriched": false, "trace_states": [{"state": "lemma Algebra.exists_notMem_and_isIntegral_forall_mem_of_ne_of_liesOver\n {R S : Type*} [CommRing R] [CommRing S] [Algebra R S]\n (p : Ideal R) [p.IsPrime] (q : Ideal S) [q.IsPrime] [q.LiesOver p]\n [Algebra.FiniteType R S]\n [Algebra.QuasiFiniteAt R q] :\n \u2203 s \u2209 q, \u2203 hs : IsIntegral R s, (\u2200 q' : Ideal S, q'.IsPrime \u2192 q' \u2260 q \u2192 q'.LiesOver p \u2192 s \u2208 q') \u2227\n \u2200 (q' : Ideal (integralClosure R S)), q'.IsPrime \u2192\n q' \u2260 q.under _ \u2192 q'.LiesOver p \u2192 \u27e8s, hs\u27e9 \u2208 q'", "tactic": "obtain \u27e8s\u2081, hs\u2081q, hs\u2081\u27e9 := Ideal.exists_not_mem_forall_mem_of_ne_of_liesOver (R := R) p q"}, {"state": "", "tactic": "obtain \u27e8s\u2082, hs\u2082q, hs\u2082\u27e9 := Algebra.ZariskisMainProperty.of_finiteType (R := R) q"}, {"state": "", "tactic": "obtain \u27e8s\u2083, hs\u2083\u27e9 := hs\u2082.2 (algebraMap _ _ s\u2081)"}, {"state": "", "tactic": "obtain \u27e8s\u2083, \u27e8_, n, rfl\u27e9, rfl\u27e9 := IsLocalization.exists_mk'_eq (.powers s\u2082) s\u2083"}, {"state": "", "tactic": "obtain \u27e8m, hm\u27e9 : \u2203 m, \u2191s\u2082 ^ m * \u2191s\u2083 = \u2191s\u2082 ^ m * (s\u2081 * \u2191s\u2082 ^ n) := by"}, {"state": "", "tactic": "simpa [IsLocalization.Away.map, IsLocalization.map_mk', IsLocalization.mk'_eq_iff_eq_mul, \u2190 map_mul, \u2190 map_pow, IsLocalization.eq_iff_exists (.powers s\u2082.1), Submonoid.mem_powers_iff] using hs\u2083 wlog hm0 : 0 < m generalizing m \u00b7 refine this (m + 1) (by grind) (by simp)"}, {"state": "", "tactic": "have hs\u2083q : s\u2083.1 \u2209 q := fun h \u21a6 (show \u2191s\u2082 ^ m * (s\u2081 * \u2191s\u2082 ^ n) \u2209 q from q.primeCompl.mul_mem (pow_mem hs\u2082q _) (mul_mem hs\u2081q (pow_mem hs\u2082q _))) (hm \u25b8 Ideal.mul_mem_left _ _ h)"}, {"state": "", "tactic": "refine \u27e8\u2191s\u2082 ^ m * \u2191s\u2083, q.primeCompl.mul_mem (pow_mem hs\u2082q _) hs\u2083q, (s\u2082 ^ m * s\u2083).2, fun q' _ hq'q _ \u21a6 hm \u25b8 Ideal.mul_mem_left _ _ (Ideal.mul_mem_right _ _ (hs\u2081 q' \u2039_\u203a hq'q \u2039_\u203a)), fun q' _ hq'q _ \u21a6 ?_\u27e9 let : Algebra (integralClosure R S) (Localization.Away s\u2082.1) := OreLocalization.instAlgebra let e : Localization.Away s\u2082 \u2243\u2090[integralClosure R S] Localization.Away s\u2082.1 := .ofBijective (Localization.awayMap\u2090 (Algebra.ofId _ _) s\u2082) hs\u2082 let q's : Ideal (Localization.Away s\u2082) := q'.map (algebraMap _ _) by_contra H"}, {"state": "", "tactic": "have hq's : Disjoint (Submonoid.powers s\u2082 : Set (integralClosure R S)) \u2191q' := by"}, {"state": "", "tactic": "rw [Ideal.disjoint_powers_iff_notMem _ (Ideal.IsPrime.isRadical \u2039_\u203a)]"}, {"state": "", "tactic": "contrapose H; exact Ideal.mul_mem_right s\u2083 _ (Ideal.pow_mem_of_mem _ H m hm0)"}, {"state": "", "tactic": "have : q's.IsPrime := IsLocalization.isPrime_of_isPrime_disjoint (.powers s\u2082) _ _ \u2039_\u203a hq's"}, {"state": "", "tactic": "have : q's.LiesOver q' := \u27e8(IsLocalization.comap_map_of_isPrime_disjoint _ _ \u2039_\u203a hq's).symm\u27e9"}, {"state": "", "tactic": "have : q's.LiesOver p := .trans _ q' _"}, {"state": "", "tactic": "have := hs\u2081 (q's.comap (e.symm.toAlgHom.comp (IsScalarTower.toAlgHom _ _ _)).toRingHom) inferInstance (by"}, {"state": "", "tactic": "contrapose hq'q"}, {"state": "", "tactic": "rw [\u2190 hq'q, Ideal.under, Ideal.comap_comap, AlgHom.toRingHom_eq_coe, AlgHom.comp_algebraMap, q's.over_def q']) (inferInstanceAs ((q's.comap ((e.symm.toAlgHom.comp (IsScalarTower.toAlgHom _ _ _)).restrictScalars R)).LiesOver _))"}, {"state": "", "tactic": "have : e.symm (algebraMap S (Localization.Away ((integralClosure R S).val.toRingHom s\u2082)) s\u2081) \u2208 q's := by"}, {"state": "", "tactic": "simpa using this"}, {"state": "", "tactic": "rw [\u2190 hs\u2083, \u2190 Ideal.IsPrime.mul_mem_left_iff (x := algebraMap _ _ (s\u2082 ^ n))] at this \u00b7 dsimp [Localization.awayMap, IsLocalization.Away.map] at this"}, {"state": "", "tactic": "rw [IsLocalization.map_mk', \u2190 e.symm.commutes, \u2190 map_mul, IsScalarTower.algebraMap_eq _ S _] at this replace this : e.symm ((algebraMap _ (Localization.Away s\u2082.1)) s\u2083) \u2208 q's := by"}, {"state": "", "tactic": "simpa [-map_mul, -map_pow, -AlgEquiv.commutes] using this replace this : s\u2083 \u2208 q' := by simpa [\u2190 Ideal.mem_comap, \u2190 q's.over_def q'] using this"}, {"state": "", "tactic": "exact H (Ideal.mul_mem_left _ (s\u2082 ^ m) this) \u00b7 rw [map_pow]; exact Ideal.notMem_of_isUnit _ (.pow _ (IsLocalization.Away.algebraMap_isUnit _)) #adaptation_note /-- The maxHeartbeats bump is required after leanprover/lean4#12564. -/ set_option maxHeartbeats 400000 in -- see adaptation note"}], "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 6367, "declarations_count": 763, "diagnostics_count": 0, "duplicate_fingerprint": "c12d1ed16ecfebfd", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 2588, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "medium", "line_count": 60, "natural_language_chars": 6367, "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.RingTheory.Etale.QuasiFinite).", "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.RingTheory.Etale.QuasiFinite.Algebra`:\nState 0: \u22a2 lemma Algebra.exists_notMem_and_isIntegral_forall_mem_of_ne_of_liesOver\n {R S : Type*} [CommRing R] [CommRing S] [Algebra R S]\n (p : Ideal R) [p.IsPrime] (q : Ideal S) [q.IsPrime] [q.LiesOver p]\n [Algebra.FiniteType R S]\n [Algebra.QuasiFiniteAt R q] :\n \u2203 s \u2209 q, \u2203 hs : IsIntegral R s, (\u2200 q' : Ideal S, q'.IsPrime \u2192 q' \u2260 q \u2192 q'.LiesOver p \u2192 s \u2208 q') \u2227\n \u2200 (q' : Ideal (integralClosure R S)), q'.IsPrime \u2192\n q' \u2260 q.under _ \u2192 q'.LiesOver p \u2192 \u27e8s, hs\u27e9 \u2208 q'\nTactic: obtain \u27e8s\u2081, hs\u2081q, hs\u2081\u27e9 := Ideal.exists_not_mem_forall_mem_of_ne_of_liesOver (R := R) p q\nState 1: \u22a2 \nTactic: obtain \u27e8s\u2082, hs\u2082q, hs\u2082\u27e9 := Algebra.ZariskisMainProperty.of_finiteType (R := R) q\nState 2: \u22a2 \nTactic: obtain \u27e8s\u2083, hs\u2083\u27e9 := hs\u2082.2 (algebraMap _ _ s\u2081)\nState 3: \u22a2 \nTactic: obtain \u27e8s\u2083, \u27e8_, n, rfl\u27e9, rfl\u27e9 := IsLocalization.exists_mk'_eq (.powers s\u2082) s\u2083\nState 4: \u22a2 \nTactic: obtain \u27e8m, hm\u27e9 : \u2203 m, \u2191s\u2082 ^ m * \u2191s\u2083 = \u2191s\u2082 ^ m * (s\u2081 * \u2191s\u2082 ^ n) := by\nState 5: \u22a2 \nTactic: simpa [IsLocalization.Away.map, IsLocalization.map_mk', IsLocalization.mk'_eq_iff_eq_mul, \u2190 map_mul, \u2190 map_pow, IsLocalization.eq_iff_exists (.powers s\u2082.1), Submonoid.mem_powers_iff] using hs\u2083 wlog hm0 : 0 < m generalizing m \u00b7 refine this (m + 1) (by grind) (by simp)\nState 6: \u22a2 \nTactic: have hs\u2083q : s\u2083.1 \u2209 q := fun h \u21a6 (show \u2191s\u2082 ^ m * (s\u2081 * \u2191s\u2082 ^ n) \u2209 q from q.primeCompl.mul_mem (pow_mem hs\u2082q _) (mul_mem hs\u2081q (pow_mem hs\u2082q _))) (hm \u25b8 Ideal.mul_mem_left _ _ h)\nState 7: \u22a2 \nTactic: refine \u27e8\u2191s\u2082 ^ m * \u2191s\u2083, q.primeCompl.mul_mem (pow_mem hs\u2082q _) hs\u2083q, (s\u2082 ^ m * s\u2083).2, fun q' _ hq'q _ \u21a6 hm \u25b8 Ideal.mul_mem_left _ _ (Ideal.mul_mem_right _ _ (hs\u2081 q' \u2039_\u203a hq'q \u2039_\u203a)), fun q' _ hq'q _ \u21a6 ?_\u27e9 let : Algebra (integralClosure R S) (Localization.Away s\u2082.1) := OreLocalization.instAlgebra let e : Localization.Away s\u2082 \u2243\u2090[integralClosure R S] Localization.Away s\u2082.1 := .ofBijective (Localization.awayMap\u2090 (Algebra.ofId _ _) s\u2082) hs\u2082 let q's : Ideal (Localization.Away s\u2082) := q'.map (algebraMap _ _) by_contra H\nState 8: \u22a2 \nTactic: have hq's : Disjoint (Submonoid.powers s\u2082 : Set (integralClosure R S)) \u2191q' := by\nState 9: \u22a2 \nTactic: rw [Ideal.disjoint_powers_iff_notMem _ (Ideal.IsPrime.isRadical \u2039_\u203a)]\nState 10: \u22a2 \nTactic: contrapose H; exact Ideal.mul_mem_right s\u2083 _ (Ideal.pow_mem_of_mem _ H m hm0)\nState 11: \u22a2 \nTactic: have : q's.IsPrime := IsLocalization.isPrime_of_isPrime_disjoint (.powers s\u2082) _ _ \u2039_\u203a hq's\nState 12: \u22a2 \nTactic: have : q's.LiesOver q' := \u27e8(IsLocalization.comap_map_of_isPrime_disjoint _ _ \u2039_\u203a hq's).symm\u27e9\nState 13: \u22a2 \nTactic: have : q's.LiesOver p := .trans _ q' _\nState 14: \u22a2 \nTactic: have := hs\u2081 (q's.comap (e.symm.toAlgHom.comp (IsScalarTower.toAlgHom _ _ _)).toRingHom) inferInstance (by\nState 15: \u22a2 \nTactic: contrapose hq'q\nState 16: \u22a2 \nTactic: rw [\u2190 hq'q, Ideal.under, Ideal.comap_comap, AlgHom.toRingHom_eq_coe, AlgHom.comp_algebraMap, q's.over_def q']) (inferInstanceAs ((q's.comap ((e.symm.toAlgHom.comp (IsScalarTower.toAlgHom _ _ _)).restrictScalars R)).LiesOver _))\nState 17: \u22a2 \nTactic: have : e.symm (algebraMap S (Localization.Away ((integralClosure R S).val.toRingHom s\u2082)) s\u2081) \u2208 q's := by\nState 18: \u22a2 \nTactic: simpa using this\nState 19: \u22a2 \nTactic: rw [\u2190 hs\u2083, \u2190 Ideal.IsPrime.mul_mem_left_iff (x := algebraMap _ _ (s\u2082 ^ n))] at this \u00b7 dsimp [Localization.awayMap, IsLocalization.Away.map] at this\nState 20: \u22a2 \nTactic: rw [IsLocalization.map_mk', \u2190 e.symm.commutes, \u2190 map_mul, IsScalarTower.algebraMap_eq _ S _] at this replace this : e.symm ((algebraMap _ (Localization.Away s\u2082.1)) s\u2083) \u2208 q's := by\nState 21: \u22a2 \nTactic: simpa [-map_mul, -map_pow, -AlgEquiv.commutes] using this replace this : s\u2083 \u2208 q' := by simpa [\u2190 Ideal.mem_comap, \u2190 q's.over_def q'] using this\nState 22: \u22a2 \nTactic: exact H (Ideal.mul_mem_left _ (s\u2082 ^ m) this) \u00b7 rw [map_pow]; exact Ideal.notMem_of_isUnit _ (.pow _ (IsLocalization.Away.algebraMap_isUnit _)) #adaptation_note /-- The maxHeartbeats bump is required after leanprover/lean4#12564. -/ set_option maxHeartbeats 400000 in -- see adaptation note\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.RingTheory.Etale.QuasiFinite).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following proof-state transcript was extracted from a real mathlib proof. Use it to answer the question below.\n\n```text\nProof-state transcript for `Mathlib.RingTheory.Etale.QuasiFinite.Algebra`:\nState 0: \u22a2 lemma Algebra.exists_notMem_and_isIntegral_forall_mem_of_ne_of_liesOver\n {R S : Type*} [CommRing R] [CommRing S] [Algebra R S]\n (p : Ideal R) [p.IsPrime] (q : Ideal S) [q.IsPrime] [q.LiesOver p]\n [Algebra.FiniteType R S]\n [Algebra.QuasiFiniteAt R q] :\n \u2203 s \u2209 q, \u2203 hs : IsIntegral R s, (\u2200 q' : Ideal S, q'.IsPrime \u2192 q' \u2260 q \u2192 q'.LiesOver p \u2192 s \u2208 q') \u2227\n \u2200 (q' : Ideal (integralClosure R S)), q'.IsPrime \u2192\n q' \u2260 q.under _ \u2192 q'.LiesOver p \u2192 \u27e8s, hs\u27e9 \u2208 q'\nTactic: obtain \u27e8s\u2081, hs\u2081q, hs\u2081\u27e9 := Ideal.exists_not_mem_forall_mem_of_ne_of_liesOver (R := R) p q\nState 1: \u22a2 \nTactic: obtain \u27e8s\u2082, hs\u2082q, hs\u2082\u27e9 := Algebra.ZariskisMainProperty.of_finiteType (R := R) q\nState 2: \u22a2 \nTactic: obtain \u27e8s\u2083, hs\u2083\u27e9 := hs\u2082.2 (algebraMap _ _ s\u2081)\nState 3: \u22a2 \nTactic: obtain \u27e8s\u2083, \u27e8_, n, rfl\u27e9, rfl\u27e9 := IsLocalization.exists_mk'_eq (.powers s\u2082) s\u2083\nState 4: \u22a2 \nTactic: obtain \u27e8m, hm\u27e9 : \u2203 m, \u2191s\u2082 ^ m * \u2191s\u2083 = \u2191s\u2082 ^ m * (s\u2081 * \u2191s\u2082 ^ n) := by\nState 5: \u22a2 \nTactic: simpa [IsLocalization.Away.map, IsLocalization.map_mk', IsLocalization.mk'_eq_iff_eq_mul, \u2190 map_mul, \u2190 map_pow, IsLocalization.eq_iff_exists (.powers s\u2082.1), Submonoid.mem_powers_iff] using hs\u2083 wlog hm0 : 0 < m generalizing m \u00b7 refine this (m + 1) (by grind) (by simp)\nState 6: \u22a2 \nTactic: have hs\u2083q : s\u2083.1 \u2209 q := fun h \u21a6 (show \u2191s\u2082 ^ m * (s\u2081 * \u2191s\u2082 ^ n) \u2209 q from q.primeCompl.mul_mem (pow_mem hs\u2082q _) (mul_mem hs\u2081q (pow_mem hs\u2082q _))) (hm \u25b8 Ideal.mul_mem_left _ _ h)\nState 7: \u22a2 \nTactic: refine \u27e8\u2191s\u2082 ^ m * \u2191s\u2083, q.primeCompl.mul_mem (pow_mem hs\u2082q _) hs\u2083q, (s\u2082 ^ m * s\u2083).2, fun q' _ hq'q _ \u21a6 hm \u25b8 Ideal.mul_mem_left _ _ (Ideal.mul_mem_right _ _ (hs\u2081 q' \u2039_\u203a hq'q \u2039_\u203a)), fun q' _ hq'q _ \u21a6 ?_\u27e9 let : Algebra (integralClosure R S) (Localization.Away s\u2082.1) := OreLocalization.instAlgebra let e : Localization.Away s\u2082 \u2243\u2090[integralClosure R S] Localization.Away s\u2082.1 := .ofBijective (Localization.awayMap\u2090 (Algebra.ofId _ _) s\u2082) hs\u2082 let q's : Ideal (Localization.Away s\u2082) := q'.map (algebraMap _ _) by_contra H\nState 8: \u22a2 \nTactic: have hq's : Disjoint (Submonoid.powers s\u2082 : Set (integralClosure R S)) \u2191q' := by\nState 9: \u22a2 \nTactic: rw [Ideal.disjoint_powers_iff_notMem _ (Ideal.IsPrime.isRadical \u2039_\u203a)]\nState 10: \u22a2 \nTactic: contrapose H; exact Ideal.mul_mem_right s\u2083 _ (Ideal.pow_mem_of_mem _ H m hm0)\nState 11: \u22a2 \nTactic: have : q's.IsPrime := IsLocalization.isPrime_of_isPrime_disjoint (.powers s\u2082) _ _ \u2039_\u203a hq's\nState 12: \u22a2 \nTactic: have : q's.LiesOver q' := \u27e8(IsLocalization.comap_map_of_isPrime_disjoint _ _ \u2039_\u203a hq's).symm\u27e9\nState 13: \u22a2 \nTactic: have : q's.LiesOver p := .trans _ q' _\nState 14: \u22a2 \nTactic: have := hs\u2081 (q's.comap (e.symm.toAlgHom.comp (IsScalarTower.toAlgHom _ _ _)).toRingHom) inferInstance (by\nState 15: \u22a2 \nTactic: contrapose hq'q\nState 16: \u22a2 \nTactic: rw [\u2190 hq'q, Ideal.under, Ideal.comap_comap, AlgHom.toRingHom_eq_coe, AlgHom.comp_algebraMap, q's.over_def q']) (inferInstanceAs ((q's.comap ((e.symm.toAlgHom.comp (IsScalarTower.toAlgHom _ _ _)).restrictScalars R)).LiesOver _))\nState 17: \u22a2 \nTactic: have : e.symm (algebraMap S (Localization.Away ((integralClosure R S).val.toRingHom s\u2082)) s\u2081) \u2208 q's := by\nState 18: \u22a2 \nTactic: simpa using this\nState 19: \u22a2 \nTactic: rw [\u2190 hs\u2083, \u2190 Ideal.IsPrime.mul_mem_left_iff (x := algebraMap _ _ (s\u2082 ^ n))] at this \u00b7 dsimp [Localization.awayMap, IsLocalization.Away.map] at this\nState 20: \u22a2 \nTactic: rw [IsLocalization.map_mk', \u2190 e.symm.commutes, \u2190 map_mul, IsScalarTower.algebraMap_eq _ S _] at this replace this : e.symm ((algebraMap _ (Localization.Away s\u2082.1)) s\u2083) \u2208 q's := by\nState 21: \u22a2 \nTactic: simpa [-map_mul, -map_pow, -AlgEquiv.commutes] using this replace this : s\u2083 \u2208 q' := by simpa [\u2190 Ideal.mem_comap, \u2190 q's.over_def q'] using this\nState 22: \u22a2 \nTactic: exact H (Ideal.mul_mem_left _ (s\u2082 ^ m) this) \u00b7 rw [map_pow]; exact Ideal.notMem_of_isUnit _ (.pow _ (IsLocalization.Away.algebraMap_isUnit _)) #adaptation_note /-- The maxHeartbeats bump is required after leanprover/lean4#12564. -/ set_option maxHeartbeats 400000 in -- see adaptation note\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.RingTheory.Etale.QuasiFinite.Algebra", "source": {"declaration": "Mathlib.RingTheory.Etale.QuasiFinite.Algebra", "file": "Mathlib/RingTheory/Etale/QuasiFinite.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.RingTheory.Etale.QuasiFinite", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/Etale/QuasiFinite.lean#L147", "span": "L147-L202"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"context_enriched": true, "source_grounded_context_enriched": true, "statement": "theorem one_lt_finprod {M : Type*} [CommMonoid M] [PartialOrder M] [IsOrderedCancelMonoid M]\n {f : \u03b9 \u2192 M}\n (h : \u2200 i, 1 \u2264 f i) (h' : \u2203 i, 1 < f i) (hf : HasFiniteMulSupport f) : 1 < \u220f\u1da0 i, f i", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 609, "declarations_count": 72, "diagnostics_count": 0, "duplicate_fingerprint": "f81d04a86979bc6e", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 596, "lean_code_chars": 197, "lean_code_ratio": 0.3235, "length_bucket": "short", "line_count": 9, "natural_language_chars": 412, "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.Algebra.BigOperators.Finprod).", "role": "system"}, {"content": "Complete the following proof.\n\n## Imports\n```lean\nimport Mathlib.Algebra.FiniteSupport.Basic\nimport Mathlib.Algebra.Module.End\nimport Mathlib.Algebra.Order.BigOperators.Ring.Finset\n```\n\nOpen namespaces: Function, Set, Classical, in, Batteries.ExtendedBinder\n\n## Surrounding context in Mathlib/Algebra/BigOperators/Finprod.lean\n```lean\n-- Mathlib.Algebra.BigOperators.Finprod.finprod_eq_prod_plift_of_mulSupport_toFinset_subset (L178-L184)\ntheorem finprod_eq_prod_plift_of_mulSupport_toFinset_subset {f : \u03b1 \u2192 M}\n (hf : HasFiniteMulSupport (f \u2218 PLift.down)) {s : Finset (PLift \u03b1)} (hs : hf.toFinset \u2286 s) :\n \u220f\u1da0 i, f i = \u220f i \u2208 s, f i.down\n\n-- Mathlib.Algebra.BigOperators.Finprod.finprod_eq_prod_plift_of_mulSupport_subset (L186-L191)\ntheorem finprod_eq_prod_plift_of_mulSupport_subset {f : \u03b1 \u2192 M} {s : Finset (PLift \u03b1)}\n (hs : mulSupport (f \u2218 PLift.down) \u2286 s) : \u220f\u1da0 i, f i = \u220f i \u2208 s, f i.down\n\n-- Mathlib.Algebra.BigOperators.Finprod.finprod_one (L193-L197)\ntheorem finprod_one : (\u220f\u1da0 _ : \u03b1, (1 : M)) = 1\n```\n\nRelevant lemmas available in scope: `one_lt_finprod_cond`\n\n```lean\ntheorem one_lt_finprod {M : Type*} [CommMonoid M] [PartialOrder M] [IsOrderedCancelMonoid M]\n {f : \u03b9 \u2192 M}\n (h : \u2200 i, 1 \u2264 f i) (h' : \u2203 i, 1 < f i) (hf : HasFiniteMulSupport f) : 1 < \u220f\u1da0 i, f i\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.Algebra.BigOperators.Finprod).\n\nComplete the following proof.\n\n## Imports\n```lean\nimport Mathlib.Algebra.FiniteSupport.Basic\nimport Mathlib.Algebra.Module.End\nimport Mathlib.Algebra.Order.BigOperators.Ring.Finset\n```\n\nOpen namespaces: Function, Set, Classical, in, Batteries.ExtendedBinder\n\n## Surrounding context in Mathlib/Algebra/BigOperators/Finprod.lean\n```lean\n-- Mathlib.Algebra.BigOperators.Finprod.finprod_eq_prod_plift_of_mulSupport_toFinset_subset (L178-L184)\ntheorem finprod_eq_prod_plift_of_mulSupport_toFinset_subset {f : \u03b1 \u2192 M}\n (hf : HasFiniteMulSupport (f \u2218 PLift.down)) {s : Finset (PLift \u03b1)} (hs : hf.toFinset \u2286 s) :\n \u220f\u1da0 i, f i = \u220f i \u2208 s, f i.down\n\n-- Mathlib.Algebra.BigOperators.Finprod.finprod_eq_prod_plift_of_mulSupport_subset (L186-L191)\ntheorem finprod_eq_prod_plift_of_mulSupport_subset {f : \u03b1 \u2192 M} {s : Finset (PLift \u03b1)}\n (hs : mulSupport (f \u2218 PLift.down) \u2286 s) : \u220f\u1da0 i, f i = \u220f i \u2208 s, f i.down\n\n-- Mathlib.Algebra.BigOperators.Finprod.finprod_one (L193-L197)\ntheorem finprod_one : (\u220f\u1da0 _ : \u03b1, (1 : M)) = 1\n```\n\nRelevant lemmas available in scope: `one_lt_finprod_cond`\n\n```lean\ntheorem one_lt_finprod {M : Type*} [CommMonoid M] [PartialOrder M] [IsOrderedCancelMonoid M]\n {f : \u03b9 \u2192 M}\n (h : \u2200 i, 1 \u2264 f i) (h' : \u2203 i, 1 < f i) (hf : HasFiniteMulSupport f) : 1 < \u220f\u1da0 i, f i\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "sample_id": "A-Mathlib.Algebra.BigOperators.Finprod.one_lt_finprod", "source": {"declaration": "Mathlib.Algebra.BigOperators.Finprod.one_lt_finprod", "file": "Mathlib/Algebra/BigOperators/Finprod.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Algebra.BigOperators.Finprod", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Algebra/BigOperators/Finprod.lean#L569", "span": "L569-L574"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "lemma support_inf_union_support_sup : (f \u2293 g).support \u222a (f \u2294 g).support = f.support \u222a g.support\n:= _unbalancedParenXYZ\ncoe_injective <| compl_injective <| by ext; simp [inf_eq_and_sup_eq_iff]", "diagnostic": "[CompilationUnit(i_begin=0, i_end=199, messages=[Message(data='Invalid field notation: Type of\\n f \u2293 g\\nis not known; cannot resolve field `support`\\n\\nHint: Consider replacing the field projection with a call to one of the following:\\n \u2022 `AddSubmonoid.support`\\n \u2022 `BoundingSieve.support`\\n \u2022 `ContDiffBumpBase.support`\\n \u2022 `DFinsupp.support`\\n \u2022 `Finsupp.support`\\n \u2022 `FreeAbelianGroup.support`\\n \u2022 `Function.support`\\n \u2022 `HahnSeries.support`\\n \u2022 `Module.support`\\n \u2022 `MvPolynomial.support`\\n \u2022 `PMF.support`\\n \u2022 `Polynomial.support`\\n \u2022 `RingPreordering.support`\\n \u2022 `SimpleGraph.support`\\n \u2022 `SkewMonoidAlgebra.support`\\n \u2022 `SkewPolynomial.support`\\n \u2022 `SummationFilter.support`\\n \u2022 `Equiv.Perm.support`\\n \u2022 `Filter.EventuallyEq.support`\\n \u2022 `Function.locallyFinsuppWithin.support`\\n \u2022 `MeasureTheory.Measure.support`\\n \u2022 `RootPairing.Base.support`\\n \u2022 `SimpleGraph.Subgraph.support`\\n \u2022 `SimpleGraph.Walk.support`\\n \u2022 `AlgebraicGeometry.Scheme.IdealSheafData.support`\\n \u2022 `Lean.Lsp.ShowDocumentClientCapabilities.support`', pos=Position(line=1, column=38), pos_end=Position(line=1, column=53), severity=, kind='lean.invalidField._namedError'), Message(data='Invalid field notation: Type of\\n f \u2294 g\\nis not known; cannot resolve field `support`\\n\\nHint: Consider replacing the field projection with a call to one of the following:\\n \u2022 `AddSubmonoid.support`\\n \u2022 `BoundingSieve.support`\\n \u2022 `ContDiffBumpBase.support`\\n \u2022 `DFinsupp.support`\\n \u2022 `Finsupp.support`\\n \u2022 `FreeAbelianGroup.support`\\n \u2022 `Function.support`\\n \u2022 `HahnSeries.support`\\n \u2022 `Module.support`\\n \u2022 `MvPolynomial.support`\\n \u2022 `PMF.support`\\n \u2022 `Polynomial.support`\\n \u2022 `RingPreordering.support`\\n \u2022 `SimpleGraph.support`\\n \u2022 `SkewMonoidAlgebra.support`\\n \u2022 `SkewPolynomial.support`\\n \u2022 `SummationFilter.support`\\n \u2022 `Equiv.Perm.support`\\n \u2022 `Filter.EventuallyEq.support`\\n \u2022 `Function.locallyFinsuppWithin.support`\\n \u2022 `MeasureTheory.Measure.support`\\n \u2022 `RootPairing.Base.support`\\n \u2022 `SimpleGraph.Subgraph.support`\\n \u2022 `SimpleGraph.Walk.support`\\n \u2022 `AlgebraicGeometry.Scheme.IdealSheafData.support`\\n \u2022 `Lean.Lsp.ShowDocumentClientCapabilities.support`', pos=Position(line=1, column=56), pos_end=Position(line=1, column=71), severity=, kind='lean.invalidField._namedError'), Message(data='Invalid field notation: Type of\\n f\\nis not known; cannot resolve field `support`\\n\\nHint: Consider replacing the field projection with a call to one of the following:\\n \u2022 `AddSubmonoid.support`\\n \u2022 `BoundingSieve.support`\\n \u2022 `ContDiffBumpBase.support`\\n \u2022 `DFinsupp.support`\\n \u2022 `Finsupp.support`\\n \u2022 `FreeAbelianGroup.support`\\n \u2022 `Function.support`\\n \u2022 `HahnSeries.support`\\n \u2022 `Module.support`\\n \u2022 `MvPolynomial.support`\\n \u2022 `PMF.support`\\n \u2022 `Polynomial.support`\\n \u2022 `RingPreordering.support`\\n \u2022 `SimpleGraph.support`\\n \u2022 `SkewMonoidAlgebra.support`\\n \u2022 `SkewPolynomial.support`\\n \u2022 `SummationFilter.support`\\n \u2022 `Equiv.Perm.support`\\n \u2022 `Filter.EventuallyEq.support`\\n \u2022 `Function.locallyFinsuppWithin.support`\\n \u2022 `MeasureTheory.Measure.support`\\n \u2022 `RootPairing.Base.support`\\n \u2022 `SimpleGraph.Subgraph.support`\\n \u2022 `SimpleGraph.Walk.support`\\n \u2022 `AlgebraicGeometry.Scheme.IdealSheafData.support`\\n \u2022 `Lean.Lsp.ShowDocumentClientCapabilities.support`', pos=Position(line=1, column=74), pos_end=Position(line=1, column=83), severity=, kind='lean.invalidField._namedError'), Message(data='Invalid field notation: Type of\\n g\\nis not known; cannot resolve field `support`\\n\\nHint: Consider replacing the field projection with a call to one of the following:\\n \u2022 `AddSubmonoid.support`\\n \u2022 `BoundingSieve.support`\\n \u2022 `ContDiffBumpBase.support`\\n \u2022 `DFinsupp.support`\\n \u2022 `Finsupp.support`\\n \u2022 `FreeAbelianGroup.support`\\n \u2022 `Function.support`\\n \u2022 `HahnSeries.support`\\n \u2022 `Module.support`\\n \u2022 `MvPolynomial.support`\\n \u2022 `PMF.support`\\n \u2022 `Polynomial.support`\\n \u2022 `RingPreordering.support`\\n \u2022 `SimpleGraph.support`\\n \u2022 `SkewMonoidAlgebra.support`\\n \u2022 `SkewPolynomial.support`\\n \u2022 `SummationFilter.support`\\n \u2022 `Equiv.Perm.support`\\n \u2022 `Filter.EventuallyEq.support`\\n \u2022 `Function.locallyFinsuppWithin.support`\\n \u2022 `MeasureTheory.Measure.support`\\n \u2022 `RootPairing.Base.support`\\n \u2022 `SimpleGraph.Subgraph.support`\\n \u2022 `SimpleGraph.Walk.support`\\n \u2022 `AlgebraicGeometry.Scheme.IdealSheafData.support`\\n \u2022 `Lean.Lsp.ShowDocumentClientCapabilities.support`', pos=Position(line=1, column=86), pos_end=Position(line=1, column=95), severity=, kind='lean.invalidField._namedError'), Message(data='Unknown identifier `_unbalancedParenXYZ`', pos=Position(line=2, column=3), pos_end=Position(line=2, column=22), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]", "mutation_kind": "term_arg_order", "source_grounded_context_enriched": false, "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 5573, "declarations_count": 482, "diagnostics_count": 1, "duplicate_fingerprint": "3f9f35826b9a1998", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1814, "lean_code_chars": 192, "lean_code_ratio": 0.0345, "length_bucket": "short", "line_count": 14, "natural_language_chars": 5381, "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.Order.Preorder.Finsupp).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma support_inf_union_support_sup : (f \u2293 g).support \u222a (f \u2294 g).support = f.support \u222a g.support\n:= _unbalancedParenXYZ\ncoe_injective <| compl_injective <| by ext; simp [inf_eq_and_sup_eq_iff]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=199, messages=[Message(data='Invalid field notation: Type of\\n f \u2293 g\\nis not known; cannot resolve field `support`\\n\\nHint: Consider replacing the field projection with a call to one of the following:\\n \u2022 `AddSubmonoid.support`\\n \u2022 `BoundingSieve.support`\\n \u2022 `ContDiffBumpBase.support`\\n \u2022 `DFinsupp.support`\\n \u2022 `Finsupp.support`\\n \u2022 `FreeAbelianGroup.support`\\n \u2022 `Function.support`\\n \u2022 `HahnSeries.support`\\n \u2022 `Module.support`\\n \u2022 `MvPolynomial.support`\\n \u2022 `PMF.support`\\n \u2022 `Polynomial.support`\\n \u2022 `RingPreordering.support`\\n \u2022 `SimpleGraph.support`\\n \u2022 `SkewMonoidAlgebra.support`\\n \u2022 `SkewPolynomial.support`\\n \u2022 `SummationFilter.support`\\n \u2022 `Equiv.Perm.support`\\n \u2022 `Filter.EventuallyEq.support`\\n \u2022 `Function.locallyFinsuppWithin.support`\\n \u2022 `MeasureTheory.Measure.support`\\n \u2022 `RootPairing.Base.support`\\n \u2022 `SimpleGraph.Subgraph.support`\\n \u2022 `SimpleGraph.Walk.support`\\n \u2022 `AlgebraicGeometry.Scheme.IdealSheafData.support`\\n \u2022 `Lean.Lsp.ShowDocumentClientCapabilities.support`', pos=Position(line=1, column=38), pos_end=Position(line=1, column=53), severity=, kind='lean.invalidField._namedError'), Message(data='Invalid field notation: Type of\\n f \u2294 g\\nis not known; cannot resolve field `support`\\n\\nHint: Consider replacing the field projection with a call to one of the following:\\n \u2022 `AddSubmonoid.support`\\n \u2022 `BoundingSieve.support`\\n \u2022 `ContDiffBumpBase.support`\\n \u2022 `DFinsupp.support`\\n \u2022 `Finsupp.support`\\n \u2022 `FreeAbelianGroup.support`\\n \u2022 `Function.support`\\n \u2022 `HahnSeries.support`\\n \u2022 `Module.support`\\n \u2022 `MvPolynomial.support`\\n \u2022 `PMF.support`\\n \u2022 `Polynomial.support`\\n \u2022 `RingPreordering.support`\\n \u2022 `SimpleGraph.support`\\n \u2022 `SkewMonoidAlgebra.support`\\n \u2022 `SkewPolynomial.support`\\n \u2022 `SummationFilter.support`\\n \u2022 `Equiv.Perm.support`\\n \u2022 `Filter.EventuallyEq.support`\\n \u2022 `Function.locallyFinsuppWithin.support`\\n \u2022 `MeasureTheory.Measure.support`\\n \u2022 `RootPairing.Base.support`\\n \u2022 `SimpleGraph.Subgraph.support`\\n \u2022 `SimpleGraph.Walk.support`\\n \u2022 `AlgebraicGeometry.Scheme.IdealSheafData.support`\\n \u2022 `Lean.Lsp.ShowDocumentClientCapabilities.support`', pos=Position(line=1, column=56), pos_end=Position(line=1, column=71), severity=, kind='lean.invalidField._namedError'), Message(data='Invalid field notation: Type of\\n f\\nis not known; cannot resolve field `support`\\n\\nHint: Consider replacing the field projection with a call to one of the following:\\n \u2022 `AddSubmonoid.support`\\n \u2022 `BoundingSieve.support`\\n \u2022 `ContDiffBumpBase.support`\\n \u2022 `DFinsupp.support`\\n \u2022 `Finsupp.support`\\n \u2022 `FreeAbelianGroup.support`\\n \u2022 `Function.support`\\n \u2022 `HahnSeries.support`\\n \u2022 `Module.support`\\n \u2022 `MvPolynomial.support`\\n \u2022 `PMF.support`\\n \u2022 `Polynomial.support`\\n \u2022 `RingPreordering.support`\\n \u2022 `SimpleGraph.support`\\n \u2022 `SkewMonoidAlgebra.support`\\n \u2022 `SkewPolynomial.support`\\n \u2022 `SummationFilter.support`\\n \u2022 `Equiv.Perm.support`\\n \u2022 `Filter.EventuallyEq.support`\\n \u2022 `Function.locallyFinsuppWithin.support`\\n \u2022 `MeasureTheory.Measure.support`\\n \u2022 `RootPairing.Base.support`\\n \u2022 `SimpleGraph.Subgraph.support`\\n \u2022 `SimpleGraph.Walk.support`\\n \u2022 `AlgebraicGeometry.Scheme.IdealSheafData.support`\\n \u2022 `Lean.Lsp.ShowDocumentClientCapabilities.support`', pos=Position(line=1, column=74), pos_end=Position(line=1, column=83), severity=, kind='lean.invalidField._namedError'), Message(data='Invalid field notation: Type of\\n g\\nis not known; cannot resolve field `support`\\n\\nHint: Consider replacing the field projection with a call to one of the following:\\n \u2022 `AddSubmonoid.support`\\n \u2022 `BoundingSieve.support`\\n \u2022 `ContDiffBumpBase.support`\\n \u2022 `DFinsupp.support`\\n \u2022 `Finsupp.support`\\n \u2022 `FreeAbelianGroup.support`\\n \u2022 `Function.support`\\n \u2022 `HahnSeries.support`\\n \u2022 `Module.support`\\n \u2022 `MvPolynomial.support`\\n \u2022 `PMF.support`\\n \u2022 `Polynomial.support`\\n \u2022 `RingPreordering.support`\\n \u2022 `SimpleGraph.support`\\n \u2022 `SkewMonoidAlgebra.support`\\n \u2022 `SkewPolynomial.support`\\n \u2022 `SummationFilter.support`\\n \u2022 `Equiv.Perm.support`\\n \u2022 `Filter.EventuallyEq.support`\\n \u2022 `Function.locallyFinsuppWithin.support`\\n \u2022 `MeasureTheory.Measure.support`\\n \u2022 `RootPairing.Base.support`\\n \u2022 `SimpleGraph.Subgraph.support`\\n \u2022 `SimpleGraph.Walk.support`\\n \u2022 `AlgebraicGeometry.Scheme.IdealSheafData.support`\\n \u2022 `Lean.Lsp.ShowDocumentClientCapabilities.support`', pos=Position(line=1, column=86), pos_end=Position(line=1, column=95), severity=, kind='lean.invalidField._namedError'), Message(data='Unknown identifier `_unbalancedParenXYZ`', pos=Position(line=2, column=3), pos_end=Position(line=2, column=22), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.", "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.Order.Preorder.Finsupp).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma support_inf_union_support_sup : (f \u2293 g).support \u222a (f \u2294 g).support = f.support \u222a g.support\n:= _unbalancedParenXYZ\ncoe_injective <| compl_injective <| by ext; simp [inf_eq_and_sup_eq_iff]\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=199, messages=[Message(data='Invalid field notation: Type of\\n f \u2293 g\\nis not known; cannot resolve field `support`\\n\\nHint: Consider replacing the field projection with a call to one of the following:\\n \u2022 `AddSubmonoid.support`\\n \u2022 `BoundingSieve.support`\\n \u2022 `ContDiffBumpBase.support`\\n \u2022 `DFinsupp.support`\\n \u2022 `Finsupp.support`\\n \u2022 `FreeAbelianGroup.support`\\n \u2022 `Function.support`\\n \u2022 `HahnSeries.support`\\n \u2022 `Module.support`\\n \u2022 `MvPolynomial.support`\\n \u2022 `PMF.support`\\n \u2022 `Polynomial.support`\\n \u2022 `RingPreordering.support`\\n \u2022 `SimpleGraph.support`\\n \u2022 `SkewMonoidAlgebra.support`\\n \u2022 `SkewPolynomial.support`\\n \u2022 `SummationFilter.support`\\n \u2022 `Equiv.Perm.support`\\n \u2022 `Filter.EventuallyEq.support`\\n \u2022 `Function.locallyFinsuppWithin.support`\\n \u2022 `MeasureTheory.Measure.support`\\n \u2022 `RootPairing.Base.support`\\n \u2022 `SimpleGraph.Subgraph.support`\\n \u2022 `SimpleGraph.Walk.support`\\n \u2022 `AlgebraicGeometry.Scheme.IdealSheafData.support`\\n \u2022 `Lean.Lsp.ShowDocumentClientCapabilities.support`', pos=Position(line=1, column=38), pos_end=Position(line=1, column=53), severity=, kind='lean.invalidField._namedError'), Message(data='Invalid field notation: Type of\\n f \u2294 g\\nis not known; cannot resolve field `support`\\n\\nHint: Consider replacing the field projection with a call to one of the following:\\n \u2022 `AddSubmonoid.support`\\n \u2022 `BoundingSieve.support`\\n \u2022 `ContDiffBumpBase.support`\\n \u2022 `DFinsupp.support`\\n \u2022 `Finsupp.support`\\n \u2022 `FreeAbelianGroup.support`\\n \u2022 `Function.support`\\n \u2022 `HahnSeries.support`\\n \u2022 `Module.support`\\n \u2022 `MvPolynomial.support`\\n \u2022 `PMF.support`\\n \u2022 `Polynomial.support`\\n \u2022 `RingPreordering.support`\\n \u2022 `SimpleGraph.support`\\n \u2022 `SkewMonoidAlgebra.support`\\n \u2022 `SkewPolynomial.support`\\n \u2022 `SummationFilter.support`\\n \u2022 `Equiv.Perm.support`\\n \u2022 `Filter.EventuallyEq.support`\\n \u2022 `Function.locallyFinsuppWithin.support`\\n \u2022 `MeasureTheory.Measure.support`\\n \u2022 `RootPairing.Base.support`\\n \u2022 `SimpleGraph.Subgraph.support`\\n \u2022 `SimpleGraph.Walk.support`\\n \u2022 `AlgebraicGeometry.Scheme.IdealSheafData.support`\\n \u2022 `Lean.Lsp.ShowDocumentClientCapabilities.support`', pos=Position(line=1, column=56), pos_end=Position(line=1, column=71), severity=, kind='lean.invalidField._namedError'), Message(data='Invalid field notation: Type of\\n f\\nis not known; cannot resolve field `support`\\n\\nHint: Consider replacing the field projection with a call to one of the following:\\n \u2022 `AddSubmonoid.support`\\n \u2022 `BoundingSieve.support`\\n \u2022 `ContDiffBumpBase.support`\\n \u2022 `DFinsupp.support`\\n \u2022 `Finsupp.support`\\n \u2022 `FreeAbelianGroup.support`\\n \u2022 `Function.support`\\n \u2022 `HahnSeries.support`\\n \u2022 `Module.support`\\n \u2022 `MvPolynomial.support`\\n \u2022 `PMF.support`\\n \u2022 `Polynomial.support`\\n \u2022 `RingPreordering.support`\\n \u2022 `SimpleGraph.support`\\n \u2022 `SkewMonoidAlgebra.support`\\n \u2022 `SkewPolynomial.support`\\n \u2022 `SummationFilter.support`\\n \u2022 `Equiv.Perm.support`\\n \u2022 `Filter.EventuallyEq.support`\\n \u2022 `Function.locallyFinsuppWithin.support`\\n \u2022 `MeasureTheory.Measure.support`\\n \u2022 `RootPairing.Base.support`\\n \u2022 `SimpleGraph.Subgraph.support`\\n \u2022 `SimpleGraph.Walk.support`\\n \u2022 `AlgebraicGeometry.Scheme.IdealSheafData.support`\\n \u2022 `Lean.Lsp.ShowDocumentClientCapabilities.support`', pos=Position(line=1, column=74), pos_end=Position(line=1, column=83), severity=, kind='lean.invalidField._namedError'), Message(data='Invalid field notation: Type of\\n g\\nis not known; cannot resolve field `support`\\n\\nHint: Consider replacing the field projection with a call to one of the following:\\n \u2022 `AddSubmonoid.support`\\n \u2022 `BoundingSieve.support`\\n \u2022 `ContDiffBumpBase.support`\\n \u2022 `DFinsupp.support`\\n \u2022 `Finsupp.support`\\n \u2022 `FreeAbelianGroup.support`\\n \u2022 `Function.support`\\n \u2022 `HahnSeries.support`\\n \u2022 `Module.support`\\n \u2022 `MvPolynomial.support`\\n \u2022 `PMF.support`\\n \u2022 `Polynomial.support`\\n \u2022 `RingPreordering.support`\\n \u2022 `SimpleGraph.support`\\n \u2022 `SkewMonoidAlgebra.support`\\n \u2022 `SkewPolynomial.support`\\n \u2022 `SummationFilter.support`\\n \u2022 `Equiv.Perm.support`\\n \u2022 `Filter.EventuallyEq.support`\\n \u2022 `Function.locallyFinsuppWithin.support`\\n \u2022 `MeasureTheory.Measure.support`\\n \u2022 `RootPairing.Base.support`\\n \u2022 `SimpleGraph.Subgraph.support`\\n \u2022 `SimpleGraph.Walk.support`\\n \u2022 `AlgebraicGeometry.Scheme.IdealSheafData.support`\\n \u2022 `Lean.Lsp.ShowDocumentClientCapabilities.support`', pos=Position(line=1, column=86), pos_end=Position(line=1, column=95), severity=, kind='lean.invalidField._namedError'), Message(data='Unknown identifier `_unbalancedParenXYZ`', pos=Position(line=2, column=3), pos_end=Position(line=2, column=22), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None)]\n```\n\nReturn a corrected, compiling version of the code.[/INST]", "sample_id": "B-Mathlib.Order.Preorder.Finsupp.support_inf_union_support_sup", "source": {"declaration": "Mathlib.Order.Preorder.Finsupp.support_inf_union_support_sup", "file": "Mathlib/Order/Preorder/Finsupp.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Order.Preorder.Finsupp", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Order/Preorder/Finsupp.lean#L105", "span": "L105-L107"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "A", "construction": {"context_enriched": true, "source_grounded_context_enriched": true, "statement": "lemma ConvexOn.exists_lipschitzOnWith_of_isBounded (hf : ConvexOn \u211d (ball x\u2080 r) f) (hr : r' < r)\n (hf' : IsBounded (f '' ball x\u2080 r)) : \u2203 K, LipschitzOnWith K f (ball x\u2080 r')", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 586, "declarations_count": 70, "diagnostics_count": 0, "duplicate_fingerprint": "c0e6dfaab8e10b9e", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 605, "lean_code_chars": 176, "lean_code_ratio": 0.3003, "length_bucket": "short", "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.Analysis.Convex.Continuous).", "role": "system"}, {"content": "Complete the following proof.\n\nOpen namespaces: FiniteDimensional, Metric, Set, List, Bornology, scoped, Topology\n\n## Surrounding context in Mathlib/Analysis/Convex/Continuous.lean\n```lean\n-- Mathlib.Analysis.Convex.Continuous.ConcaveOn (L69-L73)\nlemma ConcaveOn.lipschitzOnWith_of_abs_le (hf : ConcaveOn \u211d (ball x\u2080 r) f) (h\u03b5 : 0 < \u03b5)\n (hM : \u2200 a, dist a x\u2080 < r \u2192 |f a| \u2264 M) :\n LipschitzOnWith (2 * M / \u03b5).toNNReal f (ball x\u2080 (r - \u03b5))\n\n-- Mathlib.Analysis.Convex.Continuous.ConcaveOn (L83-L87)\nlemma ConcaveOn.exists_lipschitzOnWith_of_isBounded (hf : ConcaveOn \u211d (ball x\u2080 r) f) (hr : r' < r)\n (hf' : IsBounded (f '' ball x\u2080 r)) : \u2203 K, LipschitzOnWith K f (ball x\u2080 r')\n\n-- Mathlib.Analysis.Convex.Continuous.ConcaveOn (L109-L112)\nlemma ConcaveOn.isBoundedUnder_abs (hf : ConcaveOn \u211d C f) {x\u2080 : E} (hC : C \u2208 \ud835\udcdd x\u2080) :\n (\ud835\udcdd x\u2080).IsBoundedUnder (\u00b7 \u2264 \u00b7) |f| \u2194 (\ud835\udcdd x\u2080).IsBoundedUnder (\u00b7 \u2265 \u00b7) f\n```\n\nRelevant lemmas available in scope: `oneside`, `hx`, `hx'`, `hy'`, `hz`, `hab`, `hxyz`, `h`\n\n```lean\nlemma ConvexOn.exists_lipschitzOnWith_of_isBounded (hf : ConvexOn \u211d (ball x\u2080 r) f) (hr : r' < r)\n (hf' : IsBounded (f '' ball x\u2080 r)) : \u2203 K, LipschitzOnWith K f (ball x\u2080 r')\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.Analysis.Convex.Continuous).\n\nComplete the following proof.\n\nOpen namespaces: FiniteDimensional, Metric, Set, List, Bornology, scoped, Topology\n\n## Surrounding context in Mathlib/Analysis/Convex/Continuous.lean\n```lean\n-- Mathlib.Analysis.Convex.Continuous.ConcaveOn (L69-L73)\nlemma ConcaveOn.lipschitzOnWith_of_abs_le (hf : ConcaveOn \u211d (ball x\u2080 r) f) (h\u03b5 : 0 < \u03b5)\n (hM : \u2200 a, dist a x\u2080 < r \u2192 |f a| \u2264 M) :\n LipschitzOnWith (2 * M / \u03b5).toNNReal f (ball x\u2080 (r - \u03b5))\n\n-- Mathlib.Analysis.Convex.Continuous.ConcaveOn (L83-L87)\nlemma ConcaveOn.exists_lipschitzOnWith_of_isBounded (hf : ConcaveOn \u211d (ball x\u2080 r) f) (hr : r' < r)\n (hf' : IsBounded (f '' ball x\u2080 r)) : \u2203 K, LipschitzOnWith K f (ball x\u2080 r')\n\n-- Mathlib.Analysis.Convex.Continuous.ConcaveOn (L109-L112)\nlemma ConcaveOn.isBoundedUnder_abs (hf : ConcaveOn \u211d C f) {x\u2080 : E} (hC : C \u2208 \ud835\udcdd x\u2080) :\n (\ud835\udcdd x\u2080).IsBoundedUnder (\u00b7 \u2264 \u00b7) |f| \u2194 (\ud835\udcdd x\u2080).IsBoundedUnder (\u00b7 \u2265 \u00b7) f\n```\n\nRelevant lemmas available in scope: `oneside`, `hx`, `hx'`, `hy'`, `hz`, `hab`, `hxyz`, `h`\n\n```lean\nlemma ConvexOn.exists_lipschitzOnWith_of_isBounded (hf : ConvexOn \u211d (ball x\u2080 r) f) (hr : r' < r)\n (hf' : IsBounded (f '' ball x\u2080 r)) : \u2203 K, LipschitzOnWith K f (ball x\u2080 r')\n```\n\nProvide a complete Lean proof for the statement above. Do not include the statement in your answer.", "sample_id": "A-Mathlib.Analysis.Convex.Continuous.ConvexOn", "source": {"declaration": "Mathlib.Analysis.Convex.Continuous.ConvexOn", "file": "Mathlib/Analysis/Convex/Continuous.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Analysis.Convex.Continuous", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Convex/Continuous.lean#L74", "span": "L74-L82"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "C", "construction": {"retrieval_snippets": ["-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_injective (L40-L41)\ntheorem mop_injective : Function.Injective (mop : C \u2192 C\u1d39\u1d52\u1d56) := @mop.inj C", "-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_injective (L42-L44)\ntheorem unmop_injective : Function.Injective (unmop : C\u1d39\u1d52\u1d56 \u2192 C) :=\nfun _ _ h => congrArg mop h", "-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_inj_iff (L45-L46)\ntheorem mop_inj_iff (x y : C) : mop x = mop y \u2194 x = y := mop_injective.eq_iff", "-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_inj_iff (L48-L49)\ntheorem unmop_inj_iff (x y : C\u1d39\u1d52\u1d56) : unmop x = unmop y \u2194 x = y := unmop_injective.eq_iff", "-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_unmop (L51-L53)\ntheorem mop_unmop (X : C\u1d39\u1d52\u1d56) : mop (unmop X) = X := rfl\n-- can't be simp bc after putting the lhs in whnf it's `X = X`", "-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_mop (L54-L55)\ntheorem unmop_mop (X : C) : unmop (mop X) = X := rfl", "-- Mathlib.CategoryTheory.Monoidal.Opposite.monoidalOppositeCategory (L56-L71)\ninstance monoidalOppositeCategory [Category.{v\u2081} C] : Category C\u1d39\u1d52\u1d56 where\n Hom X Y := (unmop X \u27f6 unmop Y)\u1d39\u1d52\u1d56\nid X := mop (\ud835\udfd9 (unmop X))\n comp f g := mop (unmop f \u226b unmop g)\n\nend MonoidalOpposite\n\nend CategoryTheory\n\nopen CategoryTheory\n\nopen CategoryTheory.MonoidalOpposite\n\nvariable [Category.{v\u2081} C]\n\n/-- The monoidal opposite of a morphism `f : X \u27f6 Y` is just `f`, thought of as `mop X \u27f6 mop Y`. -/", "-- Mathlib.CategoryTheory.Monoidal.Opposite.Quiver (L72-L74)\ndef Quiver.Hom.mop {X Y : C} (f : X \u27f6 Y) : mop X \u27f6 mop Y := MonoidalOpposite.mop f\n/-- We can think of a morphism `f : mop X \u27f6 mop Y` as a morphism `X \u27f6 Y`. -/", "-- Mathlib.CategoryTheory.Monoidal.Opposite.Quiver (L75-L80)\ndef Quiver.Hom.unmop {X Y : C\u1d39\u1d52\u1d56} (f : X \u27f6 Y) : unmop X \u27f6 unmop Y := MonoidalOpposite.unmop f\nnamespace Quiver.Hom\n\nopen MonoidalOpposite renaming mop \u2192 mop', unmop \u2192 unmop'", "-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_inj (L81-L84)\ntheorem mop_inj {X Y : C} :\n Function.Injective (Quiver.Hom.mop : (X \u27f6 Y) \u2192 (mop' X \u27f6 mop' Y)) :=\nfun _ _ H => congr_arg Quiver.Hom.unmop H", "-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_inj (L85-L88)\ntheorem unmop_inj {X Y : C\u1d39\u1d52\u1d56} :\n Function.Injective (Quiver.Hom.unmop : (X \u27f6 Y) \u2192 (unmop' X \u27f6 unmop' Y)) :=\nfun _ _ H => congr_arg Quiver.Hom.mop H", "-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_mop (L90-L92)\ntheorem unmop_mop {X Y : C} {f : X \u27f6 Y} : f.mop.unmop = f :=\nrfl", "-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_unmop (L94-L100)\ntheorem mop_unmop {X Y : C\u1d39\u1d52\u1d56} {f : X \u27f6 Y} : f.unmop.mop = f :=\nrfl\n\nend Quiver.Hom\n\nnamespace CategoryTheory", "-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_comp (L102-L104)\ntheorem mop_comp {X Y Z : C} {f : X \u27f6 Y} {g : Y \u27f6 Z} :\n (f \u226b g).mop = f.mop \u226b g.mop := rfl", "-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_id (L106-L107)\ntheorem mop_id {X : C} : (\ud835\udfd9 X).mop = \ud835\udfd9 (mop X) := rfl", "-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_id (L113-L114)\ntheorem unmop_id {X : C\u1d39\u1d52\u1d56} : (\ud835\udfd9 X).unmop = \ud835\udfd9 (unmop X) := rfl", "-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_id_mop (L116-L117)\ntheorem unmop_id_mop {X : C} : (\ud835\udfd9 (mop X)).unmop = \ud835\udfd9 X := rfl", "-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_id_unmop (L119-L121)\ntheorem mop_id_unmop {X : C\u1d39\u1d52\u1d56} : (\ud835\udfd9 (unmop X)).mop = \ud835\udfd9 X := rfl\n-- aesop prefers this lemma as a safe apply over Quiver.Hom.unmop_inj", "-- Mathlib.CategoryTheory.Monoidal.Opposite.MonoidalOpposite (L122-L128)\nlemma MonoidalOpposite.hom_ext {x y : C\u1d39\u1d52\u1d56} {f g : x \u27f6 y} (h : f.unmop = g.unmop) :\n f = g :=\nQuiver.Hom.unmop_inj h\n\nvariable (C)\n\n/-- The identity functor on `C`, viewed as a functor from `C` to its monoidal opposite. -/", "-- Mathlib.CategoryTheory.Monoidal.Opposite.mopFunctor (L130-L131)\ndef mopFunctor : C \u2964 C\u1d39\u1d52\u1d56 := Functor.mk mop .mop\n/-- The identity functor on `C`, viewed as a functor from the monoidal opposite of `C` to `C`. -/", "-- Mathlib.CategoryTheory.Monoidal.Opposite.unmopFunctor (L133-L139)\ndef unmopFunctor : C\u1d39\u1d52\u1d56 \u2964 C := Functor.mk unmop .unmop\nvariable {C}\n\nnamespace Iso\n\n/-- An isomorphism in `C` gives an isomorphism in `C\u1d39\u1d52\u1d56`. -/", "-- Mathlib.CategoryTheory.Monoidal.Opposite.mop (L140-L142)\nabbrev mop {X Y : C} (f : X \u2245 Y) : mop X \u2245 mop Y := (mopFunctor C).mapIso f\n/-- An isomorphism in `C\u1d39\u1d52\u1d56` gives an isomorphism in `C`. -/", "-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop (L143-L148)\nabbrev unmop {X Y : C\u1d39\u1d52\u1d56} (f : X \u2245 Y) : unmop X \u2245 unmop Y := (unmopFunctor C).mapIso f\nend Iso\n\nnamespace IsIso", "-- Mathlib.CategoryTheory.Monoidal.Opposite.monoidalCategoryOp (L160-L178)\ninstance monoidalCategoryOp : MonoidalCategory C\u1d52\u1d56 where\n tensorObj X Y := op (unop X \u2297 unop Y)\nwhiskerLeft X _ _ f := (X.unop \u25c1 f.unop).op\n whiskerRight f X := (f.unop \u25b7 X.unop).op\n tensorHom f g := (f.unop \u2297\u2098 g.unop).op\n tensorHom_def _ _ := Quiver.Hom.unop_inj (tensorHom_def' _ _)\n tensorHom_comp_tensorHom _ _ _ _ := Quiver.Hom.unop_inj <| by simp\n tensorUnit := op (\ud835\udfd9_ C)\n associator X Y Z := (\u03b1_ (unop X) (unop Y) (unop Z)).symm.op\n leftUnitor X := (\u03bb_ (unop X)).symm.op\n rightUnitor X := (\u03c1_ (unop X)).symm.op\n associator_naturality f g h := Quiver.Hom.unop_inj <| by simp\n leftUnitor_naturality f := Quiver.Hom.unop_inj <| by simp\n rightUnitor_naturality f := Quiver.Hom.unop_inj <| by simp\n triangle X Y := Quiver.Hom.unop_inj <| by dsimp; monoidal_coherence\n pentagon W X Y Z := Quiver.Hom.unop_inj <| by dsimp; monoidal_coherence\n\nsection OppositeLemmas", "-- Mathlib.CategoryTheory.Monoidal.Opposite.op_tensor_op (L235-L236)\ntheorem op_tensor_op {W X Y Z : C} (f : W \u27f6 X) (g : Y \u27f6 Z) : f.op \u2297\u2098 g.op = (f \u2297\u2098 g).op := rfl", "-- Mathlib.CategoryTheory.Monoidal.Action.End.actionOfMonoidalFunctorToEndofunctor (L187-L201)\ndef actionOfMonoidalFunctorToEndofunctor (F : C \u2964 D \u2964 D) [F.Monoidal] :\n MonoidalRightAction C D where\n actionObj d c := (F.obj c).obj d\nactionHomLeft f c := (F.obj c).map f\n actionHomRight d _ _ f := (F.map f).app d\n actionAssocIso d c c' := Functor.Monoidal.\u03bcIso F c c' |>.app d |>.symm\n actionUnitIso d := Functor.Monoidal.\u03b5Iso F |>.app d |>.symm\n actionAssocIso_hom_naturality {c\u2081 c\u2081' c\u2082 c\u2082' c\u2083 c\u2083'} f g h := by\n have e := congrArg (fun t \u21a6 t.app c\u2081) <|\n Functor.OplaxMonoidal.\u03b4_natural F g h\n dsimp at e\n simp [reassoc_of% e]\n\n/-- If the action of `C` on `D` comes from a monoidal functor `C \u2964 (D \u2964 D)`,\nthen `curriedActionMop C D` is naturally isomorphic to that functor. -/", "-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeRightAction_actionObj_mop (L309-L311)\nlemma monoidalOppositeRightAction_actionObj_mop (c : C) (d : D) :\n d \u2299\u1d63 mop c = c \u2299\u2097 d := rfl", "-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03b4\u2097_associativity_inv (L135-L143)\nlemma \u03b4\u2097_associativity_inv (c c' : C) (d : D) :\n \u03b4\u2097 F c (c' \u2299\u2097 d) \u226b\n c \u22b4\u2097 \u03b4\u2097 F c' d \u226b (\u03b1\u2097 _ _ _).inv =\n F.map (\u03b1\u2097 _ _ _).inv \u226b \u03b4\u2097 F (c \u2297 c' : C) d := by\nsimpa [-\u03b4\u2097_associativity, -\u03b4\u2097_associativity_assoc] using\n F.map (\u03b1\u2097 _ _ _).inv \u226b=\n (\u03b4\u2097_associativity F c c' d).symm =\u226b\n (\u03b1\u2097 _ _ _).inv", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionLeft (L337-L340)\nabbrev actionLeft (c : C) : D \u2964 D := curriedAction C D |>.obj c\nvariable {D} in\n/-- Bundle `c \u21a6 c \u2299\u2097 d` as a functor. -/", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.hom_inv_actionHomLeft (L258-L261)\ntheorem hom_inv_actionHomLeft {x y : C} (f : x \u2245 y) (z : D) :\n f.hom \u22b5\u2097 z \u226b f.inv \u22b5\u2097 z = \ud835\udfd9 (x \u2299\u2097 z) := by\nrw [\u2190 comp_actionHomLeft, Iso.hom_inv_id, id_actionHomLeft]", "-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03b4\u1d63_associativity_inv (L297-L305)\nlemma \u03b4\u1d63_associativity_inv (d : D) (c c' : C) :\n \u03b4\u1d63 F (d \u2299\u1d63 c) c' \u226b\n \u03b4\u1d63 F d c \u22b5\u1d63 c' \u226b (\u03b1\u1d63 _ _ _).inv =\n F.map (\u03b1\u1d63 _ _ _).inv \u226b \u03b4\u1d63 F d (c \u2297 c' : C) := by\nsimpa [-\u03b4\u1d63_associativity, -\u03b4\u1d63_associativity_assoc] using\n F.map (\u03b1\u1d63 _ _ _).inv \u226b=\n (\u03b4\u1d63_associativity F d c c').symm =\u226b\n (\u03b1\u1d63 _ _ _).inv", "-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03b4\u1d63_unitality_hom (L307-L335)\nlemma \u03b4\u1d63_unitality_hom (d : D) :\n \u03b4\u1d63 F d (\ud835\udfd9_ C) \u226b (\u03c1\u1d63 (F.obj d)).hom = F.map (\u03c1\u1d63 d).hom := by\nsimpa [-\u03b4\u1d63_unitality_inv] using\n F.map (\u03c1\u1d63[C] d).hom \u226b=\n (\u03b4\u1d63_unitality_inv F d).symm =\u226b\n (\u03c1\u1d63[C] (F.obj d)).hom\n\nend OplaxRightLinear\n\n/-- `F.RightLinear C` asserts that `F` is both lax and oplax left-linear,\nin a compatible way, i.e that `\u03bc\u1d63` is inverse to `\u03b4\u1d63`. -/\nclass RightLinear\n (F : D \u2964 D') (C : Type*) [Category* C] [MonoidalCategory C]\n [MonoidalRightAction C D] [MonoidalRightAction C D'] extends\n F.LaxRightLinear C, F.OplaxRightLinear C where\n \u03bc\u1d63_comp_\u03b4\u1d63 (F) (d : D) (c : C) :\n LaxRightLinear.\u03bc\u1d63 F d c \u226b OplaxRightLinear.\u03b4\u1d63 F d c = \ud835\udfd9 _\n \u03b4\u1d63_comp_\u03bc\u1d63 (F) (d : D) (c : C) :\n OplaxRightLinear.\u03b4\u1d63 F d c \u226b LaxRightLinear.\u03bc\u1d63 F d c = \ud835\udfd9 _\n\nnamespace RightLinear\n\nopen LaxRightLinear OplaxRightLinear\n\nvariable\n (F : D \u2964 D') {C : Type*} [Category* C] [MonoidalCategory C]\n [MonoidalRightAction C D] [MonoidalRightAction C D']\n [F.RightLinear C]", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomRight_inv_hom' (L283-L286)\ntheorem actionHomRight_inv_hom' (x : C) {y z : D} (f : y \u27f6 z) [IsIso f] :\n x \u22b4\u2097 inv f \u226b x \u22b4\u2097 f = \ud835\udfd9 (x \u2299\u2097 z) := by\nrw [\u2190 actionHomRight_comp, IsIso.inv_hom_id, actionHomRight_id]", "-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionHomLeft_op (L209-L212)\nlemma oppositeLeftAction_actionHomLeft_op\n {c c' : C} (f : c \u27f6 c') (d : D) :\n f.op \u22b5\u2097 op d = op (f \u22b5\u2097 d) := rfl", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomLeft_action (L226-L229)\ntheorem actionHomLeft_action {x x' : C} (f : x \u27f6 x') (y : C) (z : D) :\n f \u22b5\u2097 (y \u2299\u2097 z) = (\u03b1\u2097 x y z).inv \u226b (f \u25b7 y) \u22b5\u2097 z \u226b (\u03b1\u2097 x' y z).hom := by\nsimp [whiskerRight_actionHomLeft]", "-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction (L70-L91)\ndef monoidalOppositeLeftAction [MonoidalRightAction C D] :\n MonoidalLeftAction C\u1d39\u1d52\u1d56 D where\n actionObj c d := d \u2299\u1d63 unmop c\nactionHomLeft {c c'} f d := d \u22b4\u1d63 f.unmop\n actionHomRight c {d d'} f := f \u22b5\u1d63 unmop c\n actionHom {c c'} {d d} f g := g \u2299\u1d63\u2098 f.unmop\n actionAssocIso _ _ _ := \u03b1\u1d63 _ _ _\n actionUnitIso _ := \u03c1\u1d63 _\n actionHom_def _ _ := MonoidalRightAction.actionHom_def' _ _\n actionAssocIso_hom_naturality _ _ _ :=\n MonoidalRightAction.actionAssocIso_hom_naturality _ _ _\n actionUnitIso_hom_naturality _ :=\n MonoidalRightAction.actionUnitIso_hom_naturality _\n rightUnitor_actionHom c d :=\n MonoidalRightAction.actionHom_leftUnitor _ _\n associator_actionHom c\u2081 c\u2082 c\u2083 d := by\n simpa only [mop_tensorObj, mop_hom_associator,\n MonoidalRightAction.actionHomRight_inv_hom_assoc] using\n (d \u22b4\u1d63 (\u03b1_ (unmop c\u2083) (unmop c\u2082) (unmop c\u2081)).inv) \u226b=\n MonoidalRightAction.actionHom_associator\n (unmop c\u2083) (unmop c\u2082) (unmop c\u2081) d |>.symm", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomLeft_tensor (L524-L529)\ntheorem actionHomLeft_tensor {z z' : D} (f : z \u27f6 z') (x y : C) :\n (f \u22b5\u1d63 (x \u2297 y)) = (\u03b1\u1d63 z x y).hom \u226b (f \u22b5\u1d63 x) \u22b5\u1d63 y \u226b (\u03b1\u1d63 z' x y).inv := by\nsimp only [\u2190 actionHom_id]\n rw [\u2190 Category.assoc, \u2190 actionAssocIso_hom_naturality]\n simp", "-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03bc\u2097Iso (L178-L183)\nabbrev \u03bc\u2097Iso (c : C) (d : D) : c \u2299\u2097 F.obj d \u2245 F.obj (c \u2299\u2097 d) where\n hom := LaxLeftLinear.\u03bc\u2097 F c d\ninv := OplaxLeftLinear.\u03b4\u2097 F c d\n\nvariable (c : C) (d : D)", "-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03bc\u1d63_associativity_inv (L241-L248)\nlemma \u03bc\u1d63_associativity_inv (d : D) (c c' : C) :\n \u03bc\u1d63 F d c \u22b5\u1d63 c' \u226b \u03bc\u1d63 F (d \u2299\u1d63 c) c' \u226b F.map (\u03b1\u1d63 _ _ _).inv =\n (\u03b1\u1d63 (F.obj d) c c').inv \u226b \u03bc\u1d63 F d (c \u2297 c') := by\nsimpa [-\u03bc\u1d63_associativity, -\u03bc\u1d63_associativity_assoc] using\n (\u03b1\u1d63 _ _ _).inv \u226b=\n (\u03bc\u1d63_associativity F d c c').symm =\u226b\n F.map (\u03b1\u1d63 _ _ _).inv", "-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.inv_\u03bc\u2097 (L189-L192)\nlemma inv_\u03bc\u2097 :\n CategoryTheory.inv (\u03bc\u2097 F c d) = \u03b4\u2097 F c d :=\nEq.symm <| IsIso.eq_inv_of_hom_inv_id <| \u03bc\u2097_comp_\u03b4\u2097 F c d", "-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction_actionHomLeft_mop (L100-L103)\nlemma monoidalOppositeLeftAction_actionHomLeft_mop\n {c c' : C} (f : c \u27f6 c') (d : D) :\n f.mop \u22b5\u2097 d = d \u22b4\u1d63 f := rfl", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.isIso_actionHom (L300-L304)\ninstance isIso_actionHom {x y : C} {x' y' : D}\n (f : x \u27f6 y) (g : x' \u27f6 y') [IsIso f] [IsIso g] :\n IsIso (f \u2299\u2097\u2098 g) :=\n\u27e8(inv f) \u2299\u2097\u2098 (inv g), by simp [\u2190 actionHom_comp]\u27e9", "-- Mathlib.CategoryTheory.Monoidal.Action.End.actionOfMonoidalFunctorToEndofunctorMop (L98-L145)\ndef actionOfMonoidalFunctorToEndofunctorMop (F : C \u2964 (D \u2964 D)\u1d39\u1d52\u1d56) [F.Monoidal] :\n MonoidalLeftAction C D where\n actionObj c d := (F.obj c).unmop.obj d\nactionHomLeft f d := (F.map f).unmop.app d\n actionHomRight c _ _ f := (F.obj c).unmop.map f\n actionAssocIso c c' d := Functor.Monoidal.\u03bcIso F c c' |>.unmop.app d |>.symm\n actionUnitIso d := Functor.Monoidal.\u03b5Iso F |>.unmop.app d |>.symm\n actionAssocIso_hom_naturality {c\u2081 c\u2081' c\u2082 c\u2082' c\u2083 c\u2083'} f g h := by\n have e := congrArg (fun t \u21a6 t.unmop.app c\u2083) <|\n Functor.OplaxMonoidal.\u03b4_natural F f g\n dsimp at e\n simp [reassoc_of% e]\n whiskerRight_actionHomLeft {x y} c f d := by\n have e := congrArg (fun t \u21a6 t.unmop.app d) <|\n Functor.LaxMonoidal.\u03bc_natural_left F f c\n dsimp at e\n simp [e, \u2190 NatTrans.comp_app, \u2190 unmop_comp]\n whiskerLeft_actionHomLeft c {x y} f d := by\n have e := congrArg (fun t \u21a6 t.unmop.app d) <|\n Functor.LaxMonoidal.\u03bc_natural_right F c f\n dsimp at e\n simp [e, \u2190 NatTrans.comp_app, \u2190 unmop_comp]\n associator_actionHom c\u2081 c\u2082 c\u2083 d := by\n have e := congrArg (fun t \u21a6 t.unmop.app d) <|\n Functor.OplaxMonoidal.associativity F c\u2081 c\u2082 c\u2083\n dsimp at e\n simp only [Category.comp_id] at e\n simp [e]\n leftUnitor_actionHom c d := by\n have e := (F.map (\u03bb_ c).hom).unmop.app d \u226b=\n (congrArg (fun t \u21a6 t.unmop.app d) <|\n Functor.OplaxMonoidal.left_unitality F c)\n dsimp at e\n simp only [Category.comp_id, \u2190 NatTrans.comp_app_assoc, \u2190 unmop_comp,\n \u2190 F.map_comp_assoc, Iso.hom_inv_id, Functor.map_id, Category.id_comp] at e\n simp [e]\n rightUnitor_actionHom c d := by\n have e := (F.map (\u03c1_ c).hom).unmop.app d \u226b=\n (congrArg (fun t \u21a6 t.unmop.app d) <|\n Functor.OplaxMonoidal.right_unitality F c)\n dsimp at e\n simp only [Category.comp_id, \u2190 NatTrans.comp_app_assoc, \u2190 unmop_comp,\n \u2190 F.map_comp_assoc, Iso.hom_inv_id, Functor.map_id, Category.id_comp] at e\n simp [e]\n\n/-- If the (left) action of `C` on `D` comes from a monoidal functor\n`C \u2964 (D \u2964 D)\u1d39\u1d52\u1d56`, then `curriedActionMop C D` is naturally isomorphic to that\nfunctor. -/", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.selRightfAction (L485-L501)\ninstance selRightfAction [MonoidalCategory C] : MonoidalRightAction C C where\n actionObj x y := x \u2297 y\nactionHom f g := f \u2297\u2098 g\n actionUnitIso x := \u03c1_ x\n actionAssocIso x y z := \u03b1_ x y z |>.symm\n actionHomLeft f x := f \u25b7 x\n actionHomRight x _ _ f := x \u25c1 f\n actionHom_def := by simp [tensorHom_def]\n\nnamespace MonoidalRightAction\n\nopen Category\n\nvariable {C D} [MonoidalCategory C] [MonoidalRightAction C D]\n\n-- Simp normal forms are aligned with the ones in `MonoidalCategory`.", "-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.rightActionOfMonoidalOppositeLeftAction (L261-L282)\ndef rightActionOfMonoidalOppositeLeftAction [MonoidalLeftAction C\u1d39\u1d52\u1d56 D] :\n MonoidalRightAction C D where\n actionObj d c := mop c \u2299\u2097 d\nactionHomLeft {d d'} f c := mop c \u22b4\u2097 f\n actionHomRight d _ _ f := f.mop \u22b5\u2097 d\n actionHom {c c'} {d d'} f g := g.mop \u2299\u2097\u2098 f\n actionAssocIso _ _ _ := \u03b1\u2097 _ _ _\n actionUnitIso _ := \u03bb\u2097 _\n actionHom_def _ _ := MonoidalLeftAction.actionHom_def' _ _\n actionAssocIso_hom_naturality _ _ _ :=\n MonoidalLeftAction.actionAssocIso_hom_naturality _ _ _\n actionUnitIso_hom_naturality _ :=\n MonoidalLeftAction.actionUnitIso_hom_naturality _\n actionHom_associator c\u2081 c\u2082 c\u2083 d := by\n simpa only [mop_tensorObj, mop_hom_associator,\n MonoidalLeftAction.inv_hom_actionHomLeft_assoc] using\n (\u03b1_ (mop c\u2083) (mop c\u2082) (mop c\u2081)).inv \u22b5\u2097 d \u226b=\n MonoidalLeftAction.associator_actionHom\n (mop c\u2083) (mop c\u2082) (mop c\u2081) d |>.symm\n\n/-- Define a right action of `C\u1d39\u1d52\u1d56` on `D` from a left action of `C` on `D` via\nthe formula `d \u2299\u1d63 mop c = c \u2299\u2097 d`. -/", "-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeRightAction_actionRight_mop (L316-L319)\nlemma monoidalOppositeRightAction_actionRight_mop\n (c : C) {d d' : D} (f : d \u27f6 d') :\n f \u22b5\u1d63 mop c = c \u22b4\u2097 f := rfl", "-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction (L164-L200)\ndef leftActionOfOppositeLeftAction [MonoidalLeftAction C\u1d52\u1d56 D\u1d52\u1d56] :\n MonoidalLeftAction C D where\n actionObj c d := unop <| op c \u2299\u2097 op d\nactionHomLeft {c c'} f d := (f.op \u22b5\u2097 op d).unop\n actionHomRight c {d d'} f := (op c \u22b4\u2097 f.op).unop\n actionHom {c c'} {d d} f g := (f.op \u2299\u2097\u2098 g.op).unop\n actionAssocIso _ _ _ := Iso.unop <| (\u03b1\u2097 _ _ _).symm\n actionUnitIso _ := Iso.unop <| (\u03bb\u2097 _).symm\n actionHom_def f g := by\n apply Quiver.Hom.op_inj\n simpa [MonoidalLeftAction.action_exchange] using\n MonoidalLeftAction.actionHom_def f.op g.op\n actionAssocIso_hom_naturality f g h := by\n apply Quiver.Hom.op_inj\n haveI := (\u03b1\u2097 (op _) (op _) (op _)).inv \u226b=\n MonoidalLeftAction.actionAssocIso_hom_naturality f.op g.op h.op\n simp only [Iso.inv_hom_id_assoc] at this\n simp [\u2190 this]\n actionUnitIso_hom_naturality _ := by\n apply Quiver.Hom.op_inj\n simp\n whiskerRight_actionHomLeft _ _ _ := by\n apply Quiver.Hom.op_inj\n simp\n associator_actionHom _ _ _ _ := by\n apply Quiver.Hom.op_inj\n apply IsIso.inv_eq_inv.mp\n simp\n leftUnitor_actionHom _ _ := by\n apply Quiver.Hom.op_inj\n apply IsIso.inv_eq_inv.mp\n simp\n rightUnitor_actionHom _ _ := by\n apply Quiver.Hom.op_inj\n apply IsIso.inv_eq_inv.mp\n simp", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHom_def' (L236-L239)\ntheorem actionHom_def' {x\u2081 y\u2081 : C} {x\u2082 y\u2082 : D} (f : x\u2081 \u27f6 y\u2081) (g : x\u2082 \u27f6 y\u2082) :\n f \u2299\u2097\u2098 g = x\u2081 \u22b4\u2097 g \u226b f \u22b5\u2097 y\u2082 :=\naction_exchange f g \u25b8 actionHom_def f g", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.inv_actionHomRight (L311-L314)\nlemma inv_actionHomRight (x : C) {y z : D} (f : y \u27f6 z) [IsIso f] :\n inv (x \u22b4\u2097 f) = x \u22b4\u2097 inv f :=\nIsIso.inv_eq_of_hom_inv_id <| actionHomRight_hom_inv' x f", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomRight_hom_inv (L253-L256)\ntheorem actionHomRight_hom_inv (x : C) {y z : D} (f : y \u2245 z) :\n x \u22b4\u2097 f.hom \u226b x \u22b4\u2097 f.inv = \ud835\udfd9 (x \u2299\u2097 y : D) := by\nrw [\u2190 actionHomRight_comp, Iso.hom_inv_id, actionHomRight_id]", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionUnitNatIso (L355-L356)\ndef actionUnitNatIso : actionLeft D (\ud835\udfd9_ C) \u2245 \ud835\udfed D := NatIso.ofComponents (\u03bb\u2097 \u00b7)", "-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction_actionAssocIso_unop (L246-L249)\nlemma leftActionOfOppositeLeftAction_actionAssocIso_unop\n (c c' : C\u1d52\u1d56) (d : D\u1d52\u1d56) :\n \u03b1\u2097 (unop c) (unop c') (unop d) = (\u03b1\u2097 c c' d).symm.unop := rfl", "-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeRightAction (L284-L303)\ndef monoidalOppositeRightAction [MonoidalLeftAction C D] :\n MonoidalRightAction C\u1d39\u1d52\u1d56 D where\n actionObj d c := unmop c \u2299\u2097 d\nactionHomLeft {d d'} f c := unmop c \u22b4\u2097 f\n actionHomRight d _ _ f := f.unmop \u22b5\u2097 d\n actionHom {c c'} {d d'} f g := g.unmop \u2299\u2097\u2098 f\n actionAssocIso _ _ _ := \u03b1\u2097 _ _ _\n actionUnitIso _ := \u03bb\u2097 _\n actionHom_def _ _ := MonoidalLeftAction.actionHom_def' _ _\n actionAssocIso_hom_naturality _ _ _ :=\n MonoidalLeftAction.actionAssocIso_hom_naturality _ _ _\n actionUnitIso_hom_naturality _ :=\n MonoidalLeftAction.actionUnitIso_hom_naturality _\n actionHom_associator c\u2081 c\u2082 c\u2083 d := by\n simpa only [mop_tensorObj, mop_hom_associator,\n MonoidalLeftAction.inv_hom_actionHomLeft_assoc] using\n (\u03b1_ (unmop c\u2083) (unmop c\u2082) (unmop c\u2081)).inv \u22b5\u2097 d \u226b=\n MonoidalLeftAction.associator_actionHom\n (unmop c\u2083) (unmop c\u2082) (unmop c\u2081) d |>.symm", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomRight_comp (L203-L206)\ntheorem actionHomRight_comp (w : C) {x y z : D} (f : x \u27f6 y) (g : y \u27f6 z) :\n w \u22b4\u2097 (f \u226b g) = w \u22b4\u2097 f \u226b w \u22b4\u2097 g := by\nsimp [\u2190 id_actionHom, \u2190 actionHom_comp]", "-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03b4\u2097_unitality_hom (L145-L173)\nlemma \u03b4\u2097_unitality_hom (d : D) :\n \u03b4\u2097 F (\ud835\udfd9_ C) d \u226b (\u03bb\u2097 (F.obj d)).hom = F.map (\u03bb\u2097 d).hom := by\nsimpa [-\u03b4\u2097_unitality_inv] using\n F.map (\u03bb\u2097[C] d).hom \u226b=\n (\u03b4\u2097_unitality_inv F d).symm =\u226b\n (\u03bb\u2097[C] (F.obj d)).hom\n\nend OplaxLeftLinear\n\n/-- `F.LeftLinear C` asserts that `F` is both lax and oplax left-linear,\nin a compatible way, i.e that `\u03bc\u2097` is inverse to `\u03b4\u2097`. -/\nclass LeftLinear\n (F : D \u2964 D') (C : Type*) [Category* C] [MonoidalCategory C]\n [MonoidalLeftAction C D] [MonoidalLeftAction C D'] extends\n F.LaxLeftLinear C, F.OplaxLeftLinear C where\n \u03bc\u2097_comp_\u03b4\u2097 (F) (c : C) (d : D) :\n LaxLeftLinear.\u03bc\u2097 F c d \u226b OplaxLeftLinear.\u03b4\u2097 F c d = \ud835\udfd9 _\n \u03b4\u2097_comp_\u03bc\u2097 (F) (c : C) (d : D) :\n OplaxLeftLinear.\u03b4\u2097 F c d \u226b LaxLeftLinear.\u03bc\u2097 F c d = \ud835\udfd9 _\n\nnamespace LeftLinear\n\nopen LaxLeftLinear OplaxLeftLinear\n\nvariable\n (F : D \u2964 D') {C : Type*} [Category* C] [MonoidalCategory C]\n [MonoidalLeftAction C D] [MonoidalLeftAction C D']\n [F.LeftLinear C]", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.hom_inv_actionHomLeft' (L278-L281)\ntheorem hom_inv_actionHomLeft' {x y : C} (f : x \u27f6 y) [IsIso f] (z : D) :\n f \u22b5\u2097 z \u226b inv f \u22b5\u2097 z = \ud835\udfd9 (x \u2299\u2097 z) := by\nrw [\u2190 comp_actionHomLeft, IsIso.hom_inv_id, id_actionHomLeft]", "-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionHom_op (L217-L220)\nlemma oppositeLeftAction_actionHom_op\n {c c' : C} {d d' : D} (f : c \u27f6 c') (g : d \u27f6 d') :\n f.op \u2299\u2097\u2098 g.op = op (f \u2299\u2097\u2098 g) := rfl", "-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionActionOfMonoidalFunctorToEndofunctorIso (L203-L216)\ndef curriedActionActionOfMonoidalFunctorToEndofunctorIso\n (F : C \u2964 (D \u2964 D)) [F.Monoidal] :\n letI := actionOfMonoidalFunctorToEndofunctor F\ncurriedAction C D \u2245 F :=\n .refl _\n\nend MonoidalRightAction\n\nnamespace endofunctorMonoidalCategory\n/-- Functor evaluation gives a right action of `C \u2964 C`.\n\nNote that in the literature, this is defined as a left action, but mathlib's\nmonoidal structure on `C \u2964 C` is the monoidal opposite of the one usually\nconsidered in the literature. -/", "-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction_actionRight_unop (L238-L241)\nlemma leftActionOfOppositeLeftAction_actionRight_unop\n (c : C\u1d52\u1d56) {d d' : D\u1d52\u1d56} (f : d \u27f6 d') :\n unop c \u22b4\u2097 f.unop = unop (c \u22b4\u2097 f) := rfl", "-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction_actionHom_mop_mop (L108-L111)\nlemma monoidalOppositeLeftAction_actionHom_mop_mop\n {c c' : C} {d d' : D} (f : c \u27f6 c') (g : d \u27f6 d') :\n f.mop \u2299\u2097\u2098 g = g \u2299\u1d63\u2098 f := rfl", "-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03bc\u2097_associativity_inv (L79-L86)\nlemma \u03bc\u2097_associativity_inv (c c' : C) (d : D) :\n c \u22b4\u2097 \u03bc\u2097 F c' d \u226b \u03bc\u2097 F c (c' \u2299\u2097 d) \u226b F.map (\u03b1\u2097 _ _ _).inv =\n (\u03b1\u2097 c c' (F.obj d)).inv \u226b \u03bc\u2097 F (c \u2297 c') d := by\nsimpa [-\u03bc\u2097_associativity, -\u03bc\u2097_associativity_assoc] using\n (\u03b1\u2097 _ _ _).inv \u226b=\n (\u03bc\u2097_associativity F c c' d).symm =\u226b\n F.map (\u03b1\u2097 _ _ _).inv", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.tensor_actionHomRight (L214-L219)\ntheorem tensor_actionHomRight (x y : C) {z z' : D} (f : z \u27f6 z') :\n (x \u2297 y) \u22b4\u2097 f = (\u03b1\u2097 x y z).hom \u226b x \u22b4\u2097 y \u22b4\u2097 f \u226b (\u03b1\u2097 x y z').inv := by\nsimp only [\u2190 id_actionHom]\n rw [\u2190 Category.assoc, \u2190 actionAssocIso_hom_naturality]\n simp", "-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionAssocIso_op (L221-L223)\nlemma oppositeLeftAction_actionAssocIso_op (c c' : C) (d : D) :\n \u03b1\u2097 (op c) (op c') (op d) = (\u03b1\u2097 c c' d).symm.op := rfl", "-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction_actionObj_unop (L231-L233)\nlemma leftActionOfOppositeLeftAction_actionObj_unop (c : C\u1d52\u1d56) (d : D\u1d52\u1d56) :\n (unop c) \u2299\u2097 (unop d) = unop (c \u2299\u2097 d) := rfl", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.isIso_actionHomLeft (L296-L299)\ninstance isIso_actionHomLeft {x y : C} (f : x \u27f6 y) [IsIso f] (z : D) :\n IsIso (f \u22b5\u2097 z) :=\n\u27e8inv f \u22b5\u2097 z, by simp\u27e9", "-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeRightAction_actionHomRight_mop (L312-L315)\nlemma monoidalOppositeRightAction_actionHomRight_mop\n {c c' : C} (f : c \u27f6 c') (d : D) :\n d \u22b4\u1d63 f.mop = f \u22b5\u2097 d := rfl", "-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionActionOfMonoidalFunctorToEndofunctorMopIso (L147-L161)\ndef curriedActionActionOfMonoidalFunctorToEndofunctorMopIso\n (F : C \u2964 (D \u2964 D)\u1d39\u1d52\u1d56) [F.Monoidal] :\n letI := actionOfMonoidalFunctorToEndofunctorMop F\ncurriedActionMop C D \u2245 F :=\n .refl _\n\nend MonoidalLeftAction\n\nnamespace MonoidalRightAction\n\nvariable {C D}\n\nopen MonoidalOpposite in\n/-- When `C` acts on the right on `D`, the functor `curriedAction : C \u2964 (D \u2964 D)`\nis monoidal, where `D \u2964 D` has the composition monoidal structure. -/", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.inv_actionHomLeft (L306-L309)\nlemma inv_actionHomLeft {x y : C} (f : x \u27f6 y) [IsIso f] (z : D) :\n inv (f \u22b5\u2097 z) = inv f \u22b5\u2097 z :=\nIsIso.inv_eq_of_hom_inv_id <| hom_inv_actionHomLeft' f z", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.action_exchange (L231-L234)\ntheorem action_exchange {w x : C} {y z : D} (f : w \u27f6 x) (g : y \u27f6 z) :\n w \u22b4\u2097 g \u226b f \u22b5\u2097 z = f \u22b5\u2097 y \u226b x \u22b4\u2097 g := by\nsimp only [\u2190 id_actionHom, \u2190 actionHom_id, \u2190 actionHom_comp, id_comp, comp_id]", "-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.inv_\u03b4\u2097 (L194-L229)\nlemma inv_\u03b4\u2097 :\n CategoryTheory.inv (\u03b4\u2097 F c d) = \u03bc\u2097 F c d :=\nEq.symm <| IsIso.eq_inv_of_hom_inv_id <| \u03b4\u2097_comp_\u03bc\u2097 F c d\n\nend LeftLinear\n\nend leftAction\n\nsection rightAction\n\nopen MonoidalRightAction\n\n/-- `F.LaxLinear C` equips `F : D \u2964 D'` with a family of morphisms\n`\u03bc\u2097 F : \u2200 (c : C) (d : D), c \u2299\u2097 F.obj d \u27f6 F.obj (c \u2299\u2097 d)`\nthat is natural in each variable and coherent with respect to left actions\nof `C` on `D` and `D'`. -/\nclass LaxRightLinear\n (F : D \u2964 D') (C : Type*) [Category* C] [MonoidalCategory C]\n [MonoidalRightAction C D] [MonoidalRightAction C D'] where\n /-- The \"\u03bc\u1d63\" morphism. -/\n \u03bc\u1d63 (F) (d : D) (c : C) : F.obj d \u2299\u1d63 c \u27f6 F.obj (d \u2299\u1d63 c)\n \u03bc\u1d63_naturality_right (F) (d : D) {c c' : C} (f : c \u27f6 c') :\n F.obj d \u22b4\u1d63 f \u226b \u03bc\u1d63 d c' = \u03bc\u1d63 d c \u226b F.map (d \u22b4\u1d63 f) := by cat_disch\n \u03bc\u1d63_naturality_left (F) {d d' : D} (f : d \u27f6 d') (c : C) :\n F.map f \u22b5\u1d63 c \u226b \u03bc\u1d63 d' c = \u03bc\u1d63 d c \u226b F.map (f \u22b5\u1d63 c) := by cat_disch\n \u03bc\u1d63_associativity (F) (d : D) (c c' : C) :\n \u03bc\u1d63 d (c \u2297 c') \u226b F.map (\u03b1\u1d63 _ _ _).hom =\n (\u03b1\u1d63 (F.obj d) c c').hom \u226b (\u03bc\u1d63 d c) \u22b5\u1d63 c' \u226b\n \u03bc\u1d63 (d \u2299\u1d63 c) c' := by cat_disch\n \u03bc\u1d63_unitality (F) (d : D) :\n (\u03c1\u1d63 (F.obj d)).hom = \u03bc\u1d63 d (\ud835\udfd9_ C) \u226b F.map (\u03c1\u1d63 d).hom := by cat_disch\n\nnamespace LaxRightLinear\n\n-- These are [reassoc (attr := simp)] on the basis that analog lemmas for\n-- lax monoidal functors are also [reassoc (attr := simp)].", "-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionMop_map_unmop_app (L58-L66)\nlemma curriedActionMop_map_unmop_app {c c' : C} (f : c \u27f6 c') (d : D) :\n ((curriedActionMop C D).map f).unmop.app d = f \u22b5\u2097 d :=\nrfl\n\nset_option backward.isDefEq.respectTransparency false in\nopen MonoidalOpposite in\n/-- When `C` acts on the left on `D`, the functor\n`curriedActionMop : C \u2964 (D \u2964 D)\u1d39\u1d52\u1d56` is monoidal, where `D \u2964 D` has the\ncomposition monoidal structure. -/", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.comp_actionHomLeft (L221-L224)\ntheorem comp_actionHomLeft {w x y : C} (f : w \u27f6 x) (g : x \u27f6 y) (z : D) :\n (f \u226b g) \u22b5\u2097 z = f \u22b5\u2097 z \u226b g \u22b5\u2097 z := by\nsimp only [\u2190 actionHom_id, \u2190 actionHom_comp, Category.id_comp]", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.curriedAction (L326-L335)\ndef curriedAction : C \u2964 D \u2964 D where\n obj x :=\n{ obj y := x \u2299\u2097 y\n map f := x \u22b4\u2097 f }\n map f :=\n { app y := f \u22b5\u2097 y\n naturality _ _ _ := by simp [action_exchange] }\n\nvariable {C} in\n/-- Bundle `d \u21a6 c \u2299\u2097 d` as a functor. -/", "-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionMopMonoidal (L68-L89)\ninstance curriedActionMopMonoidal : (curriedActionMop C D).Monoidal where\n \u03b5 := .mop <| (actionUnitNatIso C D).inv\n\u03bc _ _ := .mop <| { app _ := \u03b1\u2097 _ _ _ |>.inv }\n \u03b4 _ _ := .mop <| { app _ := \u03b1\u2097 _ _ _ |>.hom }\n \u03b7 := .mop <| (actionUnitNatIso C D).hom\n associativity c\u2081 c\u2082 c\u2083 := by\n apply (mopEquiv (D \u2964 D)).fullyFaithfulInverse.map_injective\n ext d\n simpa [-associator_actionHom] using\n (IsIso.inv_eq_inv.mpr <| associator_actionHom c\u2081 c\u2082 c\u2083 d).symm =\u226b\n (\u03b1_ c\u2081 c\u2082 c\u2083).hom \u22b5\u2097 d\n oplax_right_unitality x := by\n apply MonoidalOpposite.hom_ext\n ext t\n simpa [-rightUnitor_actionHom] using\n (\u03c1_ x).inv \u22b5\u2097 t \u226b= rightUnitor_actionHom x t\n oplax_left_unitality x := by\n apply MonoidalOpposite.hom_ext\n ext t\n simpa [-leftUnitor_actionHom] using\n (\u03bb_ x).inv \u22b5\u2097 t \u226b= leftUnitor_actionHom x t", "-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.inv_\u03b4\u1d63 (L356-L364)\nlemma inv_\u03b4\u1d63 :\n CategoryTheory.inv (\u03b4\u1d63 F d c) = \u03bc\u1d63 F d c :=\nEq.symm <| IsIso.eq_inv_of_hom_inv_id <| \u03b4\u1d63_comp_\u03bc\u1d63 F d c\n\nend RightLinear\n\nend rightAction\n\nend CategoryTheory.Functor", "-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfMonoidalOppositeRightAction (L45-L68)\ndef leftActionOfMonoidalOppositeRightAction [MonoidalRightAction C\u1d39\u1d52\u1d56 D] :\n MonoidalLeftAction C D where\n actionObj c d := d \u2299\u1d63 mop c\nactionHomLeft {c c'} f d := d \u22b4\u1d63 f.mop\n actionHomRight c {d d'} f := f \u22b5\u1d63 mop c\n actionHom {c c'} {d d} f g := g \u2299\u1d63\u2098 f.mop\n actionAssocIso _ _ _ := \u03b1\u1d63 _ _ _\n actionUnitIso _ := \u03c1\u1d63 _\n actionHom_def _ _ := MonoidalRightAction.actionHom_def' _ _\n actionAssocIso_hom_naturality _ _ _ :=\n MonoidalRightAction.actionAssocIso_hom_naturality _ _ _\n actionUnitIso_hom_naturality _ :=\n MonoidalRightAction.actionUnitIso_hom_naturality _\n rightUnitor_actionHom c d :=\n MonoidalRightAction.actionHom_leftUnitor _ _\n associator_actionHom c\u2081 c\u2082 c\u2083 d := by\n simpa only [mop_tensorObj, mop_hom_associator,\n MonoidalRightAction.actionHomRight_inv_hom_assoc] using\n (d \u22b4\u1d63 (\u03b1_ (mop c\u2083) (mop c\u2082) (mop c\u2081)).inv) \u226b=\n MonoidalRightAction.actionHom_associator\n (mop c\u2083) (mop c\u2082) (mop c\u2081) d |>.symm\n\n/-- Define a left action of `C\u1d39\u1d52\u1d56` on `D` from a right action of `C` on `D` via\nthe formula `mop c \u2299\u2097 d = d \u2299\u1d63 c`. -/", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.isIso_actionHomRight (L292-L295)\ninstance isIso_actionHomRight (x : C) {y z : D} (f : y \u27f6 z) [IsIso f] :\n IsIso (x \u22b4\u2097 f) :=\n\u27e8x \u22b4\u2097 inv f, by simp\u27e9", "-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction_actionAssocIso_mop_mop (L112-L114)\nlemma monoidalOppositeLeftAction_actionAssocIso_mop_mop (c c' : C) (d : D) :\n \u03b1\u2097 (mop c) (mop c') d = \u03b1\u1d63 d c' c := rfl", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.inv_actionHom (L316-L320)\nlemma inv_actionHom {x y : C} {x' y' : D}\n (f : x \u27f6 y) (g : x' \u27f6 y') [IsIso f] [IsIso g] :\n inv (f \u2299\u2097\u2098 g) = (inv f) \u2299\u2097\u2098 (inv g) :=\nIsIso.inv_eq_of_hom_inv_id <| by simp [\u2190 actionHom_comp]", "-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionRight_op (L213-L216)\nlemma oppositeLeftAction_actionRight_op\n (c : C) {d d' : D} (f : d \u27f6 d') :\n op c \u22b4\u2097 f.op = op (c \u22b4\u2097 f) := rfl", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionUnitIso_inv_naturality (L248-L251)\ntheorem actionUnitIso_inv_naturality {d d' : D} (f : d \u27f6 d') :\n (\u03bb\u2097 d).inv \u226b (\ud835\udfd9_ C) \u22b4\u2097 f = f \u226b (\u03bb\u2097 d').inv := by\nrw [Iso.inv_comp_eq, \u2190 Category.assoc, Eq.comm, Iso.comp_inv_eq, actionUnitIso_hom_naturality]", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHom_id (L198-L201)\nlemma actionHom_id {c c' : C} (f : c \u27f6 c') (d : D) :\n f \u2299\u2097\u2098 (\ud835\udfd9 d) = f \u22b5\u2097 d := by\nsimp [actionHom_def]", "-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionMop (L50-L56)\ndef curriedActionMop : C \u2964 (D \u2964 D)\u1d39\u1d52\u1d56 :=\n(curriedAction C D) \u22d9 mopFunctor _\n\n-- This simp lemma is necessary because the simps projection generated for\n-- unmop of a morphism is actually its underlying unmop field, rather than\n-- the application of `Quiver.Hom.unmop`.\nvariable {C D} in", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionAssocNatIso (L346-L353)\ndef actionAssocNatIso :\n bifunctorComp\u2081\u2082 (curriedTensor C) (curriedAction C D) \u2245\n bifunctorComp\u2082\u2083 (curriedAction C D) (curriedAction C D) :=\nNatIso.ofComponents fun _ \u21a6\n NatIso.ofComponents fun _ \u21a6\n NatIso.ofComponents fun _ \u21a6 \u03b1\u2097 _ _ _\n\n/-- Bundle `\u03bb\u2097 _` as an isomorphism of functors. -/", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.selfLeftAction (L175-L191)\ninstance selfLeftAction [MonoidalCategory C] : MonoidalLeftAction C C where\n actionObj x y := x \u2297 y\nactionHom f g := f \u2297\u2098 g\n actionUnitIso x := \u03bb_ x\n actionAssocIso x y z := \u03b1_ x y z\n actionHomLeft f x := f \u25b7 x\n actionHomRight x _ _ f := x \u25c1 f\n actionHom_def := by simp [tensorHom_def]\n\nnamespace MonoidalLeftAction\n\nopen Category\n\nvariable {C D} [MonoidalCategory C] [MonoidalLeftAction C D]\n\n-- Simp normal forms are aligned with the ones in `MonoidalCategory`.", "-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction (L122-L162)\ndef oppositeLeftAction [MonoidalLeftAction C D] :\n MonoidalLeftAction C\u1d52\u1d56 D\u1d52\u1d56 where\n actionObj c d := op <| c.unop \u2299\u2097 d.unop\nactionHomLeft f d := (f.unop \u22b5\u2097 unop d).op\n actionHomRight c _ _ f := (unop c \u22b4\u2097 f.unop).op\n actionHom f g := (f.unop \u2299\u2097\u2098 g.unop).op\n actionAssocIso _ _ _ := Iso.op <| (\u03b1\u2097 _ _ _).symm\n actionUnitIso _ := Iso.op <| (\u03bb\u2097 _).symm\n actionHom_def\n | op f, op g => by\n apply Quiver.Hom.unop_inj\n simpa [MonoidalLeftAction.action_exchange] using\n MonoidalLeftAction.actionHom_def f g\n actionAssocIso_hom_naturality\n | op f, op g, op h => by\n apply Quiver.Hom.unop_inj\n haveI := (\u03b1\u2097 (unop _) (unop _) (unop _)).inv \u226b=\n MonoidalLeftAction.actionAssocIso_hom_naturality f g h\n simp only [Iso.inv_hom_id_assoc] at this\n simp [\u2190 this]\n actionUnitIso_hom_naturality _ := by\n apply Quiver.Hom.unop_inj\n simp\n whiskerRight_actionHomLeft _ _ _ := by\n apply Quiver.Hom.unop_inj\n simp\n associator_actionHom _ _ _ _ := by\n apply Quiver.Hom.unop_inj\n apply IsIso.inv_eq_inv.mp\n simp\n leftUnitor_actionHom _ _ := by\n apply Quiver.Hom.unop_inj\n apply IsIso.inv_eq_inv.mp\n simp\n rightUnitor_actionHom _ _ := by\n apply Quiver.Hom.unop_inj\n apply IsIso.inv_eq_inv.mp\n simp\n\n/-- Define a left action of `C` on `D` from a left action of `C\u1d52\u1d56` on `D\u1d52\u1d56` via\nthe formula `c \u2299\u2097 d = unop ((op c) \u2299\u2097 (op d))`. -/", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.inv_hom_actionHomLeft' (L288-L291)\ntheorem inv_hom_actionHomLeft' {x y : C} (f : x \u27f6 y) [IsIso f] (z : D) :\n inv f \u22b5\u2097 z \u226b f \u22b5\u2097 z = \ud835\udfd9 (y \u2299\u2097 z) := by\nrw [\u2190 comp_actionHomLeft, IsIso.inv_hom_id, id_actionHomLeft]", "-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionObj_op (L206-L208)\nlemma oppositeLeftAction_actionObj_op (c : C) (d : D) :\n (op c) \u2299\u2097 (op d) = op (c \u2299\u2097 d) := rfl", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.inv_hom_actionHomLeft (L268-L271)\ntheorem inv_hom_actionHomLeft {x y : C} (f : x \u2245 y) (z : D) :\n f.inv \u22b5\u2097 z \u226b f.hom \u22b5\u2097 z = \ud835\udfd9 (y \u2299\u2097 z) := by\nrw [\u2190 comp_actionHomLeft, Iso.inv_hom_id, id_actionHomLeft]", "-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03bc\u1d63_unitality_inv (L250-L285)\nlemma \u03bc\u1d63_unitality_inv (d : D) :\n (\u03c1\u1d63 (F.obj d)).inv \u226b \u03bc\u1d63 F d (\ud835\udfd9_ C) = F.map (\u03c1\u1d63 d).inv := by\nsimpa [-\u03bc\u1d63_unitality] using\n (\u03c1\u1d63[C] (F.obj d)).inv \u226b=\n (\u03bc\u1d63_unitality F d).symm =\u226b\n F.map (\u03c1\u1d63[C] d).inv\n\nend LaxRightLinear\n\n/-- `F.OplaxLinear C` equips `F : D \u2964 D'` with a family of morphisms\n`\u03b4\u2097 F : \u2200 (c : C) (d : D), c \u2299\u2097 F.obj d \u27f6 F.obj (c \u2299\u2097 d)`\nthat is natural in each variable and coherent with respect to left actions\nof `C` on `D` and `D'`. -/\nclass OplaxRightLinear\n (F : D \u2964 D') (C : Type*) [Category* C] [MonoidalCategory C]\n [MonoidalRightAction C D] [MonoidalRightAction C D'] where\n /-- The oplax lineator morphism. -/\n \u03b4\u1d63 (F) (d : D) (c : C) : F.obj (d \u2299\u1d63 c) \u27f6 (F.obj d) \u2299\u1d63 c\n \u03b4\u1d63_naturality_right (F) (d : D) {c c' : C} (f : c \u27f6 c') :\n F.map (d \u22b4\u1d63 f) \u226b \u03b4\u1d63 d c' =\n \u03b4\u1d63 d c \u226b F.obj d \u22b4\u1d63 f := by cat_disch\n \u03b4\u1d63_naturality_left (F) {d d' : D} (f : d \u27f6 d') (c : C) :\n F.map (f \u22b5\u1d63 c) \u226b \u03b4\u1d63 d' c =\n \u03b4\u1d63 d c \u226b F.map f \u22b5\u1d63 c := by cat_disch\n \u03b4\u1d63_associativity (F) (d : D) (c c' : C) :\n \u03b4\u1d63 d (c \u2297 c') \u226b (\u03b1\u1d63 _ _ _).hom =\n F.map (\u03b1\u1d63 _ _ _).hom \u226b \u03b4\u1d63 (d \u2299\u1d63 c) c' \u226b\n \u03b4\u1d63 d c \u22b5\u1d63 c' := by cat_disch\n \u03b4\u1d63_unitality_inv (F) (d : D) :\n (\u03c1\u1d63 (F.obj d)).inv =\n F.map (\u03c1\u1d63 d).inv \u226b \u03b4\u1d63 d (\ud835\udfd9_ C) := by cat_disch\n\nnamespace OplaxRightLinear\n\n-- These are [reassoc (attr := simp)] on the basis that analog lemmas for\n-- oplax monoidal functors are also [reassoc (attr := simp)].", "-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionMonoidal (L163-L185)\ninstance curriedActionMonoidal [MonoidalRightAction C D] :\n (curriedAction C D).Monoidal where\n \u03b5 := (actionUnitNatIso C D).inv\n\u03bc _ _ := { app _ := \u03b1\u1d63 _ _ _ |>.inv }\n \u03b4 _ _ := { app _ := \u03b1\u1d63 _ _ _ |>.hom }\n \u03b7 := (actionUnitNatIso C D).hom\n associativity c\u2081 c\u2082 c\u2083 := by\n ext d\n simpa [-actionHom_associator] using\n (IsIso.inv_eq_inv.mpr <| actionHom_associator c\u2081 c\u2082 c\u2083 d).symm =\u226b\n d \u22b4\u1d63 (\u03b1_ c\u2081 c\u2082 c\u2083).hom\n oplax_right_unitality x := by\n ext t\n simpa [-actionHom_rightUnitor] using\n t \u22b4\u1d63 (\u03c1_ x).inv \u226b= actionHom_rightUnitor x t\n oplax_left_unitality x := by\n ext t\n simpa [-actionHom_leftUnitor] using\n t \u22b4\u1d63 (\u03bb_ x).inv \u226b= actionHom_leftUnitor x t\n\nset_option backward.isDefEq.respectTransparency false in\n/-- A monoidal functor `F : C \u2964 D \u2964 D` can be thought of as a right action\nof `C` on `D`. -/", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.action_actionHomRight (L536-L539)\ntheorem action_actionHomRight (y : D) (z : C) {x x' : C} (f : x \u27f6 x') :\n (y \u2299\u1d63 z) \u22b4\u1d63 f = (\u03b1\u1d63 y z x).inv \u226b y \u22b4\u1d63 (z \u25c1 f) \u226b (\u03b1\u1d63 y z x').hom := by\nsimp [whiskerRight_actionHomLeft]", "-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction_actionHom_unop (L242-L245)\nlemma leftActionOfOppositeLeftAction_actionHom_unop\n {c c' : C\u1d52\u1d56} {d d' : D\u1d52\u1d56} (f : c \u27f6 c') (g : d \u27f6 d') :\n f.unop \u2299\u2097\u2098 g.unop = unop (f \u2299\u2097\u2098 g) := rfl", "-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03bc\u2097_unitality_inv (L88-L123)\nlemma \u03bc\u2097_unitality_inv (d : D) :\n (\u03bb\u2097 (F.obj d)).inv \u226b \u03bc\u2097 F (\ud835\udfd9_ C) d = F.map (\u03bb\u2097 d).inv := by\nsimpa [-\u03bc\u2097_unitality] using\n (\u03bb\u2097[C] (F.obj d)).inv \u226b=\n (\u03bc\u2097_unitality F d).symm =\u226b\n F.map (\u03bb\u2097[C] d).inv\n\nend LaxLeftLinear\n\n/-- `F.OplaxLinear C` equips `F : D \u2964 D'` with a family of morphisms\n`\u03b4\u2097 F : \u2200 (c : C) (d : D), c \u2299\u2097 F.obj d \u27f6 F.obj (c \u2299\u2097 d)`\nthat is natural in each variable and coherent with respect to left actions\nof `C` on `D` and `D'`. -/\nclass OplaxLeftLinear\n (F : D \u2964 D') (C : Type*) [Category* C] [MonoidalCategory C]\n [MonoidalLeftAction C D] [MonoidalLeftAction C D'] where\n /-- The oplax lineator morphism. -/\n \u03b4\u2097 (F) (c : C) (d : D) : F.obj (c \u2299\u2097 d) \u27f6 c \u2299\u2097 F.obj d\n \u03b4\u2097_naturality_left (F) {c c' : C} (f : c \u27f6 c') (d : D) :\n F.map (f \u22b5\u2097 d) \u226b \u03b4\u2097 c' d =\n \u03b4\u2097 c d \u226b f \u22b5\u2097 F.obj d := by cat_disch\n \u03b4\u2097_naturality_right (F) (c : C) {d d' : D} (f : d \u27f6 d') :\n F.map (c \u22b4\u2097 f) \u226b \u03b4\u2097 c d' =\n \u03b4\u2097 c d \u226b c \u22b4\u2097 F.map f := by cat_disch\n \u03b4\u2097_associativity (F) (c c' : C) (d : D) :\n \u03b4\u2097 (c \u2297 c') d \u226b (\u03b1\u2097 _ _ _).hom =\n F.map (\u03b1\u2097 _ _ _).hom \u226b \u03b4\u2097 c (c' \u2299\u2097 d) \u226b\n c \u22b4\u2097 \u03b4\u2097 c' d := by cat_disch\n \u03b4\u2097_unitality_inv (F) (d : D) :\n (\u03bb\u2097 (F.obj d)).inv =\n F.map (\u03bb\u2097 d).inv \u226b \u03b4\u2097 (\ud835\udfd9_ C) d := by cat_disch\n\nnamespace OplaxLeftLinear\n\n-- These are [reassoc (attr := simp)] on the basis that analog lemmas for\n-- oplax monoidal functors are also [reassoc (attr := simp)].", "-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03bc\u1d63Iso (L340-L345)\nabbrev \u03bc\u1d63Iso (d : D) (c : C) : F.obj d \u2299\u1d63 c \u2245 F.obj (d \u2299\u1d63 c) where\n hom := LaxRightLinear.\u03bc\u1d63 F d c\ninv := OplaxRightLinear.\u03b4\u1d63 F d c\n\nvariable (c : C) (d : D)", "-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction_actionHomLeft_unop (L234-L237)\nlemma leftActionOfOppositeLeftAction_actionHomLeft_unop\n {c c' : C\u1d52\u1d56} (f : c \u27f6 c') (d : D\u1d52\u1d56) :\n f.unop \u22b5\u2097 unop d = unop (f \u22b5\u2097 d) := rfl", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionAssocIso_inv_naturality (L241-L246)\ntheorem actionAssocIso_inv_naturality\n {c\u2081 c\u2082 c\u2083 c\u2084 : C} {d\u2081 d\u2082 : D} (f : c\u2081 \u27f6 c\u2082) (g : c\u2083 \u27f6 c\u2084) (h : d\u2081 \u27f6 d\u2082) :\n (f \u2299\u2097\u2098 g \u2299\u2097\u2098 h) \u226b (\u03b1\u2097 c\u2082 c\u2084 d\u2082).inv =\n (\u03b1\u2097 c\u2081 c\u2083 d\u2081).inv \u226b ((f \u2297\u2098 g) \u2299\u2097\u2098 h) := by\nrw [Iso.comp_inv_eq, Category.assoc, Eq.comm, Iso.inv_comp_eq, actionAssocIso_hom_naturality]", "-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.inv_\u03bc\u1d63 (L351-L354)\nlemma inv_\u03bc\u1d63 :\n CategoryTheory.inv (\u03bc\u1d63 F d c) = \u03b4\u1d63 F d c :=\nEq.symm <| IsIso.eq_inv_of_hom_inv_id <| \u03bc\u1d63_comp_\u03b4\u1d63 F d c", "-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction_actionObj_mop (L97-L99)\nlemma monoidalOppositeLeftAction_actionObj_mop (c : C) (d : D) :\n mop c \u2299\u2097 d = d \u2299\u1d63 c := rfl", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.unit_actionHomRight (L208-L212)\ntheorem unit_actionHomRight {x y : D} (f : x \u27f6 y) :\n (\ud835\udfd9_ C) \u22b4\u2097 f = (\u03bb\u2097 x).hom \u226b f \u226b (\u03bb\u2097 y).inv := by\nrw [\u2190 Category.assoc, actionUnitIso_hom_naturality]\n simp", "-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction_actionRight_mop (L104-L107)\nlemma monoidalOppositeLeftAction_actionRight_mop\n (c : C) {d d' : D} (f : d \u27f6 d') :\n mop c \u22b4\u2097 f = f \u22b5\u1d63 c := rfl", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomRight_hom_inv' (L273-L276)\ntheorem actionHomRight_hom_inv' (x : C) {y z : D} (f : y \u27f6 z) [IsIso f] :\n x \u22b4\u2097 f \u226b x \u22b4\u2097 inv f = \ud835\udfd9 (x \u2299\u2097 y) := by\nrw [\u2190 actionHomRight_comp, IsIso.hom_inv_id, actionHomRight_id]", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.id_actionHom (L193-L196)\nlemma id_actionHom (c : C) {d d' : D} (f : d \u27f6 d') :\n (\ud835\udfd9 c) \u2299\u2097\u2098 f = c \u22b4\u2097 f := by\nsimp [actionHom_def]", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionRight (L342-L344)\nabbrev actionRight (d : D) : C \u2964 D := curriedAction C D |>.flip.obj d\n/-- Bundle `\u03b1\u2097 _ _ _` as an isomorphism of trifunctors. -/", "-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomRight_inv_hom (L263-L266)\ntheorem actionHomRight_inv_hom (x : C) {y z : D} (f : y \u2245 z) :\n x \u22b4\u2097 f.inv \u226b x \u22b4\u2097 f.hom = \ud835\udfd9 (x \u2299\u2097 z) := by\nrw [\u2190 actionHomRight_comp, Iso.inv_hom_id, actionHomRight_id]"], "source_grounded_context_enriched": false, "statement": "theorem unmop_comp {X Y Z : C\u1d39\u1d52\u1d56} {f : X \u27f6 Y} {g : Y \u27f6 Z} :\n (f \u226b g).unmop = f.unmop \u226b g.unmop", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 45435, "declarations_count": 5115, "diagnostics_count": 0, "duplicate_fingerprint": "0ba50c925a3399d5", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 19436, "lean_code_chars": 42165, "lean_code_ratio": 0.928, "length_bucket": "long", "line_count": 1352, "natural_language_chars": 3270, "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.CategoryTheory.Monoidal.Opposite).", "role": "system"}, {"content": "Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem unmop_comp {X Y Z : C\u1d39\u1d52\u1d56} {f : X \u27f6 Y} {g : Y \u27f6 Z} :\n (f \u226b g).unmop = f.unmop \u226b g.unmop\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_injective (L40-L41)\ntheorem mop_injective : Function.Injective (mop : C \u2192 C\u1d39\u1d52\u1d56) := @mop.inj C\n```\n\n-- snippet 2\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_injective (L42-L44)\ntheorem unmop_injective : Function.Injective (unmop : C\u1d39\u1d52\u1d56 \u2192 C) :=\nfun _ _ h => congrArg mop h\n```\n\n-- snippet 3\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_inj_iff (L45-L46)\ntheorem mop_inj_iff (x y : C) : mop x = mop y \u2194 x = y := mop_injective.eq_iff\n```\n\n-- snippet 4\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_inj_iff (L48-L49)\ntheorem unmop_inj_iff (x y : C\u1d39\u1d52\u1d56) : unmop x = unmop y \u2194 x = y := unmop_injective.eq_iff\n```\n\n-- snippet 5\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_unmop (L51-L53)\ntheorem mop_unmop (X : C\u1d39\u1d52\u1d56) : mop (unmop X) = X := rfl\n-- can't be simp bc after putting the lhs in whnf it's `X = X`\n```\n\n-- snippet 6\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_mop (L54-L55)\ntheorem unmop_mop (X : C) : unmop (mop X) = X := rfl\n```\n\n-- snippet 7\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.monoidalOppositeCategory (L56-L71)\ninstance monoidalOppositeCategory [Category.{v\u2081} C] : Category C\u1d39\u1d52\u1d56 where\n Hom X Y := (unmop X \u27f6 unmop Y)\u1d39\u1d52\u1d56\nid X := mop (\ud835\udfd9 (unmop X))\n comp f g := mop (unmop f \u226b unmop g)\n\nend MonoidalOpposite\n\nend CategoryTheory\n\nopen CategoryTheory\n\nopen CategoryTheory.MonoidalOpposite\n\nvariable [Category.{v\u2081} C]\n\n/-- The monoidal opposite of a morphism `f : X \u27f6 Y` is just `f`, thought of as `mop X \u27f6 mop Y`. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.Quiver (L72-L74)\ndef Quiver.Hom.mop {X Y : C} (f : X \u27f6 Y) : mop X \u27f6 mop Y := MonoidalOpposite.mop f\n/-- We can think of a morphism `f : mop X \u27f6 mop Y` as a morphism `X \u27f6 Y`. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.Quiver (L75-L80)\ndef Quiver.Hom.unmop {X Y : C\u1d39\u1d52\u1d56} (f : X \u27f6 Y) : unmop X \u27f6 unmop Y := MonoidalOpposite.unmop f\nnamespace Quiver.Hom\n\nopen MonoidalOpposite renaming mop \u2192 mop', unmop \u2192 unmop'\n```\n\n-- snippet 10\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_inj (L81-L84)\ntheorem mop_inj {X Y : C} :\n Function.Injective (Quiver.Hom.mop : (X \u27f6 Y) \u2192 (mop' X \u27f6 mop' Y)) :=\nfun _ _ H => congr_arg Quiver.Hom.unmop H\n```\n\n-- snippet 11\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_inj (L85-L88)\ntheorem unmop_inj {X Y : C\u1d39\u1d52\u1d56} :\n Function.Injective (Quiver.Hom.unmop : (X \u27f6 Y) \u2192 (unmop' X \u27f6 unmop' Y)) :=\nfun _ _ H => congr_arg Quiver.Hom.mop H\n```\n\n-- snippet 12\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_mop (L90-L92)\ntheorem unmop_mop {X Y : C} {f : X \u27f6 Y} : f.mop.unmop = f :=\nrfl\n```\n\n-- snippet 13\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_unmop (L94-L100)\ntheorem mop_unmop {X Y : C\u1d39\u1d52\u1d56} {f : X \u27f6 Y} : f.unmop.mop = f :=\nrfl\n\nend Quiver.Hom\n\nnamespace CategoryTheory\n```\n\n-- snippet 14\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_comp (L102-L104)\ntheorem mop_comp {X Y Z : C} {f : X \u27f6 Y} {g : Y \u27f6 Z} :\n (f \u226b g).mop = f.mop \u226b g.mop := rfl\n```\n\n-- snippet 15\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_id (L106-L107)\ntheorem mop_id {X : C} : (\ud835\udfd9 X).mop = \ud835\udfd9 (mop X) := rfl\n```\n\n-- snippet 16\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_id (L113-L114)\ntheorem unmop_id {X : C\u1d39\u1d52\u1d56} : (\ud835\udfd9 X).unmop = \ud835\udfd9 (unmop X) := rfl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_id_mop (L116-L117)\ntheorem unmop_id_mop {X : C} : (\ud835\udfd9 (mop X)).unmop = \ud835\udfd9 X := rfl\n```\n\n-- snippet 18\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_id_unmop (L119-L121)\ntheorem mop_id_unmop {X : C\u1d39\u1d52\u1d56} : (\ud835\udfd9 (unmop X)).mop = \ud835\udfd9 X := rfl\n-- aesop prefers this lemma as a safe apply over Quiver.Hom.unmop_inj\n```\n\n-- snippet 19\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.MonoidalOpposite (L122-L128)\nlemma MonoidalOpposite.hom_ext {x y : C\u1d39\u1d52\u1d56} {f g : x \u27f6 y} (h : f.unmop = g.unmop) :\n f = g :=\nQuiver.Hom.unmop_inj h\n\nvariable (C)\n\n/-- The identity functor on `C`, viewed as a functor from `C` to its monoidal opposite. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.mopFunctor (L130-L131)\ndef mopFunctor : C \u2964 C\u1d39\u1d52\u1d56 := Functor.mk mop .mop\n/-- The identity functor on `C`, viewed as a functor from the monoidal opposite of `C` to `C`. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.unmopFunctor (L133-L139)\ndef unmopFunctor : C\u1d39\u1d52\u1d56 \u2964 C := Functor.mk unmop .unmop\nvariable {C}\n\nnamespace Iso\n\n/-- An isomorphism in `C` gives an isomorphism in `C\u1d39\u1d52\u1d56`. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.mop (L140-L142)\nabbrev mop {X Y : C} (f : X \u2245 Y) : mop X \u2245 mop Y := (mopFunctor C).mapIso f\n/-- An isomorphism in `C\u1d39\u1d52\u1d56` gives an isomorphism in `C`. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop (L143-L148)\nabbrev unmop {X Y : C\u1d39\u1d52\u1d56} (f : X \u2245 Y) : unmop X \u2245 unmop Y := (unmopFunctor C).mapIso f\nend Iso\n\nnamespace IsIso\n```\n\n-- snippet 24\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.monoidalCategoryOp (L160-L178)\ninstance monoidalCategoryOp : MonoidalCategory C\u1d52\u1d56 where\n tensorObj X Y := op (unop X \u2297 unop Y)\nwhiskerLeft X _ _ f := (X.unop \u25c1 f.unop).op\n whiskerRight f X := (f.unop \u25b7 X.unop).op\n tensorHom f g := (f.unop \u2297\u2098 g.unop).op\n tensorHom_def _ _ := Quiver.Hom.unop_inj (tensorHom_def' _ _)\n tensorHom_comp_tensorHom _ _ _ _ := Quiver.Hom.unop_inj <| by simp\n tensorUnit := op (\ud835\udfd9_ C)\n associator X Y Z := (\u03b1_ (unop X) (unop Y) (unop Z)).symm.op\n leftUnitor X := (\u03bb_ (unop X)).symm.op\n rightUnitor X := (\u03c1_ (unop X)).symm.op\n associator_naturality f g h := Quiver.Hom.unop_inj <| by simp\n leftUnitor_naturality f := Quiver.Hom.unop_inj <| by simp\n rightUnitor_naturality f := Quiver.Hom.unop_inj <| by simp\n triangle X Y := Quiver.Hom.unop_inj <| by dsimp; monoidal_coherence\n pentagon W X Y Z := Quiver.Hom.unop_inj <| by dsimp; monoidal_coherence\n\nsection OppositeLemmas\n```\n\n-- snippet 25\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.op_tensor_op (L235-L236)\ntheorem op_tensor_op {W X Y Z : C} (f : W \u27f6 X) (g : Y \u27f6 Z) : f.op \u2297\u2098 g.op = (f \u2297\u2098 g).op := rfl\n```\n\n-- snippet 26\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.End.actionOfMonoidalFunctorToEndofunctor (L187-L201)\ndef actionOfMonoidalFunctorToEndofunctor (F : C \u2964 D \u2964 D) [F.Monoidal] :\n MonoidalRightAction C D where\n actionObj d c := (F.obj c).obj d\nactionHomLeft f c := (F.obj c).map f\n actionHomRight d _ _ f := (F.map f).app d\n actionAssocIso d c c' := Functor.Monoidal.\u03bcIso F c c' |>.app d |>.symm\n actionUnitIso d := Functor.Monoidal.\u03b5Iso F |>.app d |>.symm\n actionAssocIso_hom_naturality {c\u2081 c\u2081' c\u2082 c\u2082' c\u2083 c\u2083'} f g h := by\n have e := congrArg (fun t \u21a6 t.app c\u2081) <|\n Functor.OplaxMonoidal.\u03b4_natural F g h\n dsimp at e\n simp [reassoc_of% e]\n\n/-- If the action of `C` on `D` comes from a monoidal functor `C \u2964 (D \u2964 D)`,\nthen `curriedActionMop C D` is naturally isomorphic to that functor. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeRightAction_actionObj_mop (L309-L311)\nlemma monoidalOppositeRightAction_actionObj_mop (c : C) (d : D) :\n d \u2299\u1d63 mop c = c \u2299\u2097 d := rfl\n```\n\n-- snippet 28\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03b4\u2097_associativity_inv (L135-L143)\nlemma \u03b4\u2097_associativity_inv (c c' : C) (d : D) :\n \u03b4\u2097 F c (c' \u2299\u2097 d) \u226b\n c \u22b4\u2097 \u03b4\u2097 F c' d \u226b (\u03b1\u2097 _ _ _).inv =\n F.map (\u03b1\u2097 _ _ _).inv \u226b \u03b4\u2097 F (c \u2297 c' : C) d := by\nsimpa [-\u03b4\u2097_associativity, -\u03b4\u2097_associativity_assoc] using\n F.map (\u03b1\u2097 _ _ _).inv \u226b=\n (\u03b4\u2097_associativity F c c' d).symm =\u226b\n (\u03b1\u2097 _ _ _).inv\n```\n\n-- snippet 29\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionLeft (L337-L340)\nabbrev actionLeft (c : C) : D \u2964 D := curriedAction C D |>.obj c\nvariable {D} in\n/-- Bundle `c \u21a6 c \u2299\u2097 d` as a functor. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.hom_inv_actionHomLeft (L258-L261)\ntheorem hom_inv_actionHomLeft {x y : C} (f : x \u2245 y) (z : D) :\n f.hom \u22b5\u2097 z \u226b f.inv \u22b5\u2097 z = \ud835\udfd9 (x \u2299\u2097 z) := by\nrw [\u2190 comp_actionHomLeft, Iso.hom_inv_id, id_actionHomLeft]\n```\n\n-- snippet 31\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03b4\u1d63_associativity_inv (L297-L305)\nlemma \u03b4\u1d63_associativity_inv (d : D) (c c' : C) :\n \u03b4\u1d63 F (d \u2299\u1d63 c) c' \u226b\n \u03b4\u1d63 F d c \u22b5\u1d63 c' \u226b (\u03b1\u1d63 _ _ _).inv =\n F.map (\u03b1\u1d63 _ _ _).inv \u226b \u03b4\u1d63 F d (c \u2297 c' : C) := by\nsimpa [-\u03b4\u1d63_associativity, -\u03b4\u1d63_associativity_assoc] using\n F.map (\u03b1\u1d63 _ _ _).inv \u226b=\n (\u03b4\u1d63_associativity F d c c').symm =\u226b\n (\u03b1\u1d63 _ _ _).inv\n```\n\n-- snippet 32\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03b4\u1d63_unitality_hom (L307-L335)\nlemma \u03b4\u1d63_unitality_hom (d : D) :\n \u03b4\u1d63 F d (\ud835\udfd9_ C) \u226b (\u03c1\u1d63 (F.obj d)).hom = F.map (\u03c1\u1d63 d).hom := by\nsimpa [-\u03b4\u1d63_unitality_inv] using\n F.map (\u03c1\u1d63[C] d).hom \u226b=\n (\u03b4\u1d63_unitality_inv F d).symm =\u226b\n (\u03c1\u1d63[C] (F.obj d)).hom\n\nend OplaxRightLinear\n\n/-- `F.RightLinear C` asserts that `F` is both lax and oplax left-linear,\nin a compatible way, i.e that `\u03bc\u1d63` is inverse to `\u03b4\u1d63`. -/\nclass RightLinear\n (F : D \u2964 D') (C : Type*) [Category* C] [MonoidalCategory C]\n [MonoidalRightAction C D] [MonoidalRightAction C D'] extends\n F.LaxRightLinear C, F.OplaxRightLinear C where\n \u03bc\u1d63_comp_\u03b4\u1d63 (F) (d : D) (c : C) :\n LaxRightLinear.\u03bc\u1d63 F d c \u226b OplaxRightLinear.\u03b4\u1d63 F d c = \ud835\udfd9 _\n \u03b4\u1d63_comp_\u03bc\u1d63 (F) (d : D) (c : C) :\n OplaxRightLinear.\u03b4\u1d63 F d c \u226b LaxRightLinear.\u03bc\u1d63 F d c = \ud835\udfd9 _\n\nnamespace RightLinear\n\nopen LaxRightLinear OplaxRightLinear\n\nvariable\n (F : D \u2964 D') {C : Type*} [Category* C] [MonoidalCategory C]\n [MonoidalRightAction C D] [MonoidalRightAction C D']\n [F.RightLinear C]\n```\n\n-- snippet 33\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomRight_inv_hom' (L283-L286)\ntheorem actionHomRight_inv_hom' (x : C) {y z : D} (f : y \u27f6 z) [IsIso f] :\n x \u22b4\u2097 inv f \u226b x \u22b4\u2097 f = \ud835\udfd9 (x \u2299\u2097 z) := by\nrw [\u2190 actionHomRight_comp, IsIso.inv_hom_id, actionHomRight_id]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionHomLeft_op (L209-L212)\nlemma oppositeLeftAction_actionHomLeft_op\n {c c' : C} (f : c \u27f6 c') (d : D) :\n f.op \u22b5\u2097 op d = op (f \u22b5\u2097 d) := rfl\n```\n\n-- snippet 35\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomLeft_action (L226-L229)\ntheorem actionHomLeft_action {x x' : C} (f : x \u27f6 x') (y : C) (z : D) :\n f \u22b5\u2097 (y \u2299\u2097 z) = (\u03b1\u2097 x y z).inv \u226b (f \u25b7 y) \u22b5\u2097 z \u226b (\u03b1\u2097 x' y z).hom := by\nsimp [whiskerRight_actionHomLeft]\n```\n\n-- snippet 36\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction (L70-L91)\ndef monoidalOppositeLeftAction [MonoidalRightAction C D] :\n MonoidalLeftAction C\u1d39\u1d52\u1d56 D where\n actionObj c d := d \u2299\u1d63 unmop c\nactionHomLeft {c c'} f d := d \u22b4\u1d63 f.unmop\n actionHomRight c {d d'} f := f \u22b5\u1d63 unmop c\n actionHom {c c'} {d d} f g := g \u2299\u1d63\u2098 f.unmop\n actionAssocIso _ _ _ := \u03b1\u1d63 _ _ _\n actionUnitIso _ := \u03c1\u1d63 _\n actionHom_def _ _ := MonoidalRightAction.actionHom_def' _ _\n actionAssocIso_hom_naturality _ _ _ :=\n MonoidalRightAction.actionAssocIso_hom_naturality _ _ _\n actionUnitIso_hom_naturality _ :=\n MonoidalRightAction.actionUnitIso_hom_naturality _\n rightUnitor_actionHom c d :=\n MonoidalRightAction.actionHom_leftUnitor _ _\n associator_actionHom c\u2081 c\u2082 c\u2083 d := by\n simpa only [mop_tensorObj, mop_hom_associator,\n MonoidalRightAction.actionHomRight_inv_hom_assoc] using\n (d \u22b4\u1d63 (\u03b1_ (unmop c\u2083) (unmop c\u2082) (unmop c\u2081)).inv) \u226b=\n MonoidalRightAction.actionHom_associator\n (unmop c\u2083) (unmop c\u2082) (unmop c\u2081) d |>.symm\n```\n\n-- snippet 37\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomLeft_tensor (L524-L529)\ntheorem actionHomLeft_tensor {z z' : D} (f : z \u27f6 z') (x y : C) :\n (f \u22b5\u1d63 (x \u2297 y)) = (\u03b1\u1d63 z x y).hom \u226b (f \u22b5\u1d63 x) \u22b5\u1d63 y \u226b (\u03b1\u1d63 z' x y).inv := by\nsimp only [\u2190 actionHom_id]\n rw [\u2190 Category.assoc, \u2190 actionAssocIso_hom_naturality]\n simp\n```\n\n-- snippet 38\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03bc\u2097Iso (L178-L183)\nabbrev \u03bc\u2097Iso (c : C) (d : D) : c \u2299\u2097 F.obj d \u2245 F.obj (c \u2299\u2097 d) where\n hom := LaxLeftLinear.\u03bc\u2097 F c d\ninv := OplaxLeftLinear.\u03b4\u2097 F c d\n\nvariable (c : C) (d : D)\n```\n\n-- snippet 39\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03bc\u1d63_associativity_inv (L241-L248)\nlemma \u03bc\u1d63_associativity_inv (d : D) (c c' : C) :\n \u03bc\u1d63 F d c \u22b5\u1d63 c' \u226b \u03bc\u1d63 F (d \u2299\u1d63 c) c' \u226b F.map (\u03b1\u1d63 _ _ _).inv =\n (\u03b1\u1d63 (F.obj d) c c').inv \u226b \u03bc\u1d63 F d (c \u2297 c') := by\nsimpa [-\u03bc\u1d63_associativity, -\u03bc\u1d63_associativity_assoc] using\n (\u03b1\u1d63 _ _ _).inv \u226b=\n (\u03bc\u1d63_associativity F d c c').symm =\u226b\n F.map (\u03b1\u1d63 _ _ _).inv\n```\n\n-- snippet 40\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.inv_\u03bc\u2097 (L189-L192)\nlemma inv_\u03bc\u2097 :\n CategoryTheory.inv (\u03bc\u2097 F c d) = \u03b4\u2097 F c d :=\nEq.symm <| IsIso.eq_inv_of_hom_inv_id <| \u03bc\u2097_comp_\u03b4\u2097 F c d\n```\n\n-- snippet 41\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction_actionHomLeft_mop (L100-L103)\nlemma monoidalOppositeLeftAction_actionHomLeft_mop\n {c c' : C} (f : c \u27f6 c') (d : D) :\n f.mop \u22b5\u2097 d = d \u22b4\u1d63 f := rfl\n```\n\n-- snippet 42\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.isIso_actionHom (L300-L304)\ninstance isIso_actionHom {x y : C} {x' y' : D}\n (f : x \u27f6 y) (g : x' \u27f6 y') [IsIso f] [IsIso g] :\n IsIso (f \u2299\u2097\u2098 g) :=\n\u27e8(inv f) \u2299\u2097\u2098 (inv g), by simp [\u2190 actionHom_comp]\u27e9\n```\n\n-- snippet 43\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.End.actionOfMonoidalFunctorToEndofunctorMop (L98-L145)\ndef actionOfMonoidalFunctorToEndofunctorMop (F : C \u2964 (D \u2964 D)\u1d39\u1d52\u1d56) [F.Monoidal] :\n MonoidalLeftAction C D where\n actionObj c d := (F.obj c).unmop.obj d\nactionHomLeft f d := (F.map f).unmop.app d\n actionHomRight c _ _ f := (F.obj c).unmop.map f\n actionAssocIso c c' d := Functor.Monoidal.\u03bcIso F c c' |>.unmop.app d |>.symm\n actionUnitIso d := Functor.Monoidal.\u03b5Iso F |>.unmop.app d |>.symm\n actionAssocIso_hom_naturality {c\u2081 c\u2081' c\u2082 c\u2082' c\u2083 c\u2083'} f g h := by\n have e := congrArg (fun t \u21a6 t.unmop.app c\u2083) <|\n Functor.OplaxMonoidal.\u03b4_natural F f g\n dsimp at e\n simp [reassoc_of% e]\n whiskerRight_actionHomLeft {x y} c f d := by\n have e := congrArg (fun t \u21a6 t.unmop.app d) <|\n Functor.LaxMonoidal.\u03bc_natural_left F f c\n dsimp at e\n simp [e, \u2190 NatTrans.comp_app, \u2190 unmop_comp]\n whiskerLeft_actionHomLeft c {x y} f d := by\n have e := congrArg (fun t \u21a6 t.unmop.app d) <|\n Functor.LaxMonoidal.\u03bc_natural_right F c f\n dsimp at e\n simp [e, \u2190 NatTrans.comp_app, \u2190 unmop_comp]\n associator_actionHom c\u2081 c\u2082 c\u2083 d := by\n have e := congrArg (fun t \u21a6 t.unmop.app d) <|\n Functor.OplaxMonoidal.associativity F c\u2081 c\u2082 c\u2083\n dsimp at e\n simp only [Category.comp_id] at e\n simp [e]\n leftUnitor_actionHom c d := by\n have e := (F.map (\u03bb_ c).hom).unmop.app d \u226b=\n (congrArg (fun t \u21a6 t.unmop.app d) <|\n Functor.OplaxMonoidal.left_unitality F c)\n dsimp at e\n simp only [Category.comp_id, \u2190 NatTrans.comp_app_assoc, \u2190 unmop_comp,\n \u2190 F.map_comp_assoc, Iso.hom_inv_id, Functor.map_id, Category.id_comp] at e\n simp [e]\n rightUnitor_actionHom c d := by\n have e := (F.map (\u03c1_ c).hom).unmop.app d \u226b=\n (congrArg (fun t \u21a6 t.unmop.app d) <|\n Functor.OplaxMonoidal.right_unitality F c)\n dsimp at e\n simp only [Category.comp_id, \u2190 NatTrans.comp_app_assoc, \u2190 unmop_comp,\n \u2190 F.map_comp_assoc, Iso.hom_inv_id, Functor.map_id, Category.id_comp] at e\n simp [e]\n\n/-- If the (left) action of `C` on `D` comes from a monoidal functor\n`C \u2964 (D \u2964 D)\u1d39\u1d52\u1d56`, then `curriedActionMop C D` is naturally isomorphic to that\nfunctor. -/\n```\n\n-- snippet 44\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.selRightfAction (L485-L501)\ninstance selRightfAction [MonoidalCategory C] : MonoidalRightAction C C where\n actionObj x y := x \u2297 y\nactionHom f g := f \u2297\u2098 g\n actionUnitIso x := \u03c1_ x\n actionAssocIso x y z := \u03b1_ x y z |>.symm\n actionHomLeft f x := f \u25b7 x\n actionHomRight x _ _ f := x \u25c1 f\n actionHom_def := by simp [tensorHom_def]\n\nnamespace MonoidalRightAction\n\nopen Category\n\nvariable {C D} [MonoidalCategory C] [MonoidalRightAction C D]\n\n-- Simp normal forms are aligned with the ones in `MonoidalCategory`.\n```\n\n-- snippet 45\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.rightActionOfMonoidalOppositeLeftAction (L261-L282)\ndef rightActionOfMonoidalOppositeLeftAction [MonoidalLeftAction C\u1d39\u1d52\u1d56 D] :\n MonoidalRightAction C D where\n actionObj d c := mop c \u2299\u2097 d\nactionHomLeft {d d'} f c := mop c \u22b4\u2097 f\n actionHomRight d _ _ f := f.mop \u22b5\u2097 d\n actionHom {c c'} {d d'} f g := g.mop \u2299\u2097\u2098 f\n actionAssocIso _ _ _ := \u03b1\u2097 _ _ _\n actionUnitIso _ := \u03bb\u2097 _\n actionHom_def _ _ := MonoidalLeftAction.actionHom_def' _ _\n actionAssocIso_hom_naturality _ _ _ :=\n MonoidalLeftAction.actionAssocIso_hom_naturality _ _ _\n actionUnitIso_hom_naturality _ :=\n MonoidalLeftAction.actionUnitIso_hom_naturality _\n actionHom_associator c\u2081 c\u2082 c\u2083 d := by\n simpa only [mop_tensorObj, mop_hom_associator,\n MonoidalLeftAction.inv_hom_actionHomLeft_assoc] using\n (\u03b1_ (mop c\u2083) (mop c\u2082) (mop c\u2081)).inv \u22b5\u2097 d \u226b=\n MonoidalLeftAction.associator_actionHom\n (mop c\u2083) (mop c\u2082) (mop c\u2081) d |>.symm\n\n/-- Define a right action of `C\u1d39\u1d52\u1d56` on `D` from a left action of `C` on `D` via\nthe formula `d \u2299\u1d63 mop c = c \u2299\u2097 d`. -/\n```\n\n-- snippet 46\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeRightAction_actionRight_mop (L316-L319)\nlemma monoidalOppositeRightAction_actionRight_mop\n (c : C) {d d' : D} (f : d \u27f6 d') :\n f \u22b5\u1d63 mop c = c \u22b4\u2097 f := rfl\n```\n\n-- snippet 47\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction (L164-L200)\ndef leftActionOfOppositeLeftAction [MonoidalLeftAction C\u1d52\u1d56 D\u1d52\u1d56] :\n MonoidalLeftAction C D where\n actionObj c d := unop <| op c \u2299\u2097 op d\nactionHomLeft {c c'} f d := (f.op \u22b5\u2097 op d).unop\n actionHomRight c {d d'} f := (op c \u22b4\u2097 f.op).unop\n actionHom {c c'} {d d} f g := (f.op \u2299\u2097\u2098 g.op).unop\n actionAssocIso _ _ _ := Iso.unop <| (\u03b1\u2097 _ _ _).symm\n actionUnitIso _ := Iso.unop <| (\u03bb\u2097 _).symm\n actionHom_def f g := by\n apply Quiver.Hom.op_inj\n simpa [MonoidalLeftAction.action_exchange] using\n MonoidalLeftAction.actionHom_def f.op g.op\n actionAssocIso_hom_naturality f g h := by\n apply Quiver.Hom.op_inj\n haveI := (\u03b1\u2097 (op _) (op _) (op _)).inv \u226b=\n MonoidalLeftAction.actionAssocIso_hom_naturality f.op g.op h.op\n simp only [Iso.inv_hom_id_assoc] at this\n simp [\u2190 this]\n actionUnitIso_hom_naturality _ := by\n apply Quiver.Hom.op_inj\n simp\n whiskerRight_actionHomLeft _ _ _ := by\n apply Quiver.Hom.op_inj\n simp\n associator_actionHom _ _ _ _ := by\n apply Quiver.Hom.op_inj\n apply IsIso.inv_eq_inv.mp\n simp\n leftUnitor_actionHom _ _ := by\n apply Quiver.Hom.op_inj\n apply IsIso.inv_eq_inv.mp\n simp\n rightUnitor_actionHom _ _ := by\n apply Quiver.Hom.op_inj\n apply IsIso.inv_eq_inv.mp\n simp\n```\n\n-- snippet 48\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHom_def' (L236-L239)\ntheorem actionHom_def' {x\u2081 y\u2081 : C} {x\u2082 y\u2082 : D} (f : x\u2081 \u27f6 y\u2081) (g : x\u2082 \u27f6 y\u2082) :\n f \u2299\u2097\u2098 g = x\u2081 \u22b4\u2097 g \u226b f \u22b5\u2097 y\u2082 :=\naction_exchange f g \u25b8 actionHom_def f g\n```\n\n-- snippet 49\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.inv_actionHomRight (L311-L314)\nlemma inv_actionHomRight (x : C) {y z : D} (f : y \u27f6 z) [IsIso f] :\n inv (x \u22b4\u2097 f) = x \u22b4\u2097 inv f :=\nIsIso.inv_eq_of_hom_inv_id <| actionHomRight_hom_inv' x f\n```\n\n-- snippet 50\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomRight_hom_inv (L253-L256)\ntheorem actionHomRight_hom_inv (x : C) {y z : D} (f : y \u2245 z) :\n x \u22b4\u2097 f.hom \u226b x \u22b4\u2097 f.inv = \ud835\udfd9 (x \u2299\u2097 y : D) := by\nrw [\u2190 actionHomRight_comp, Iso.hom_inv_id, actionHomRight_id]\n```\n\n-- snippet 51\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionUnitNatIso (L355-L356)\ndef actionUnitNatIso : actionLeft D (\ud835\udfd9_ C) \u2245 \ud835\udfed D := NatIso.ofComponents (\u03bb\u2097 \u00b7)\n```\n\n-- snippet 52\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction_actionAssocIso_unop (L246-L249)\nlemma leftActionOfOppositeLeftAction_actionAssocIso_unop\n (c c' : C\u1d52\u1d56) (d : D\u1d52\u1d56) :\n \u03b1\u2097 (unop c) (unop c') (unop d) = (\u03b1\u2097 c c' d).symm.unop := rfl\n```\n\n-- snippet 53\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeRightAction (L284-L303)\ndef monoidalOppositeRightAction [MonoidalLeftAction C D] :\n MonoidalRightAction C\u1d39\u1d52\u1d56 D where\n actionObj d c := unmop c \u2299\u2097 d\nactionHomLeft {d d'} f c := unmop c \u22b4\u2097 f\n actionHomRight d _ _ f := f.unmop \u22b5\u2097 d\n actionHom {c c'} {d d'} f g := g.unmop \u2299\u2097\u2098 f\n actionAssocIso _ _ _ := \u03b1\u2097 _ _ _\n actionUnitIso _ := \u03bb\u2097 _\n actionHom_def _ _ := MonoidalLeftAction.actionHom_def' _ _\n actionAssocIso_hom_naturality _ _ _ :=\n MonoidalLeftAction.actionAssocIso_hom_naturality _ _ _\n actionUnitIso_hom_naturality _ :=\n MonoidalLeftAction.actionUnitIso_hom_naturality _\n actionHom_associator c\u2081 c\u2082 c\u2083 d := by\n simpa only [mop_tensorObj, mop_hom_associator,\n MonoidalLeftAction.inv_hom_actionHomLeft_assoc] using\n (\u03b1_ (unmop c\u2083) (unmop c\u2082) (unmop c\u2081)).inv \u22b5\u2097 d \u226b=\n MonoidalLeftAction.associator_actionHom\n (unmop c\u2083) (unmop c\u2082) (unmop c\u2081) d |>.symm\n```\n\n-- snippet 54\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomRight_comp (L203-L206)\ntheorem actionHomRight_comp (w : C) {x y z : D} (f : x \u27f6 y) (g : y \u27f6 z) :\n w \u22b4\u2097 (f \u226b g) = w \u22b4\u2097 f \u226b w \u22b4\u2097 g := by\nsimp [\u2190 id_actionHom, \u2190 actionHom_comp]\n```\n\n-- snippet 55\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03b4\u2097_unitality_hom (L145-L173)\nlemma \u03b4\u2097_unitality_hom (d : D) :\n \u03b4\u2097 F (\ud835\udfd9_ C) d \u226b (\u03bb\u2097 (F.obj d)).hom = F.map (\u03bb\u2097 d).hom := by\nsimpa [-\u03b4\u2097_unitality_inv] using\n F.map (\u03bb\u2097[C] d).hom \u226b=\n (\u03b4\u2097_unitality_inv F d).symm =\u226b\n (\u03bb\u2097[C] (F.obj d)).hom\n\nend OplaxLeftLinear\n\n/-- `F.LeftLinear C` asserts that `F` is both lax and oplax left-linear,\nin a compatible way, i.e that `\u03bc\u2097` is inverse to `\u03b4\u2097`. -/\nclass LeftLinear\n (F : D \u2964 D') (C : Type*) [Category* C] [MonoidalCategory C]\n [MonoidalLeftAction C D] [MonoidalLeftAction C D'] extends\n F.LaxLeftLinear C, F.OplaxLeftLinear C where\n \u03bc\u2097_comp_\u03b4\u2097 (F) (c : C) (d : D) :\n LaxLeftLinear.\u03bc\u2097 F c d \u226b OplaxLeftLinear.\u03b4\u2097 F c d = \ud835\udfd9 _\n \u03b4\u2097_comp_\u03bc\u2097 (F) (c : C) (d : D) :\n OplaxLeftLinear.\u03b4\u2097 F c d \u226b LaxLeftLinear.\u03bc\u2097 F c d = \ud835\udfd9 _\n\nnamespace LeftLinear\n\nopen LaxLeftLinear OplaxLeftLinear\n\nvariable\n (F : D \u2964 D') {C : Type*} [Category* C] [MonoidalCategory C]\n [MonoidalLeftAction C D] [MonoidalLeftAction C D']\n [F.LeftLinear C]\n```\n\n-- snippet 56\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.hom_inv_actionHomLeft' (L278-L281)\ntheorem hom_inv_actionHomLeft' {x y : C} (f : x \u27f6 y) [IsIso f] (z : D) :\n f \u22b5\u2097 z \u226b inv f \u22b5\u2097 z = \ud835\udfd9 (x \u2299\u2097 z) := by\nrw [\u2190 comp_actionHomLeft, IsIso.hom_inv_id, id_actionHomLeft]\n```\n\n-- snippet 57\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionHom_op (L217-L220)\nlemma oppositeLeftAction_actionHom_op\n {c c' : C} {d d' : D} (f : c \u27f6 c') (g : d \u27f6 d') :\n f.op \u2299\u2097\u2098 g.op = op (f \u2299\u2097\u2098 g) := rfl\n```\n\n-- snippet 58\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionActionOfMonoidalFunctorToEndofunctorIso (L203-L216)\ndef curriedActionActionOfMonoidalFunctorToEndofunctorIso\n (F : C \u2964 (D \u2964 D)) [F.Monoidal] :\n letI := actionOfMonoidalFunctorToEndofunctor F\ncurriedAction C D \u2245 F :=\n .refl _\n\nend MonoidalRightAction\n\nnamespace endofunctorMonoidalCategory\n/-- Functor evaluation gives a right action of `C \u2964 C`.\n\nNote that in the literature, this is defined as a left action, but mathlib's\nmonoidal structure on `C \u2964 C` is the monoidal opposite of the one usually\nconsidered in the literature. -/\n```\n\n-- snippet 59\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction_actionRight_unop (L238-L241)\nlemma leftActionOfOppositeLeftAction_actionRight_unop\n (c : C\u1d52\u1d56) {d d' : D\u1d52\u1d56} (f : d \u27f6 d') :\n unop c \u22b4\u2097 f.unop = unop (c \u22b4\u2097 f) := rfl\n```\n\n-- snippet 60\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction_actionHom_mop_mop (L108-L111)\nlemma monoidalOppositeLeftAction_actionHom_mop_mop\n {c c' : C} {d d' : D} (f : c \u27f6 c') (g : d \u27f6 d') :\n f.mop \u2299\u2097\u2098 g = g \u2299\u1d63\u2098 f := rfl\n```\n\n-- snippet 61\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03bc\u2097_associativity_inv (L79-L86)\nlemma \u03bc\u2097_associativity_inv (c c' : C) (d : D) :\n c \u22b4\u2097 \u03bc\u2097 F c' d \u226b \u03bc\u2097 F c (c' \u2299\u2097 d) \u226b F.map (\u03b1\u2097 _ _ _).inv =\n (\u03b1\u2097 c c' (F.obj d)).inv \u226b \u03bc\u2097 F (c \u2297 c') d := by\nsimpa [-\u03bc\u2097_associativity, -\u03bc\u2097_associativity_assoc] using\n (\u03b1\u2097 _ _ _).inv \u226b=\n (\u03bc\u2097_associativity F c c' d).symm =\u226b\n F.map (\u03b1\u2097 _ _ _).inv\n```\n\n-- snippet 62\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.tensor_actionHomRight (L214-L219)\ntheorem tensor_actionHomRight (x y : C) {z z' : D} (f : z \u27f6 z') :\n (x \u2297 y) \u22b4\u2097 f = (\u03b1\u2097 x y z).hom \u226b x \u22b4\u2097 y \u22b4\u2097 f \u226b (\u03b1\u2097 x y z').inv := by\nsimp only [\u2190 id_actionHom]\n rw [\u2190 Category.assoc, \u2190 actionAssocIso_hom_naturality]\n simp\n```\n\n-- snippet 63\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionAssocIso_op (L221-L223)\nlemma oppositeLeftAction_actionAssocIso_op (c c' : C) (d : D) :\n \u03b1\u2097 (op c) (op c') (op d) = (\u03b1\u2097 c c' d).symm.op := rfl\n```\n\n-- snippet 64\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction_actionObj_unop (L231-L233)\nlemma leftActionOfOppositeLeftAction_actionObj_unop (c : C\u1d52\u1d56) (d : D\u1d52\u1d56) :\n (unop c) \u2299\u2097 (unop d) = unop (c \u2299\u2097 d) := rfl\n```\n\n-- snippet 65\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.isIso_actionHomLeft (L296-L299)\ninstance isIso_actionHomLeft {x y : C} (f : x \u27f6 y) [IsIso f] (z : D) :\n IsIso (f \u22b5\u2097 z) :=\n\u27e8inv f \u22b5\u2097 z, by simp\u27e9\n```\n\n-- snippet 66\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeRightAction_actionHomRight_mop (L312-L315)\nlemma monoidalOppositeRightAction_actionHomRight_mop\n {c c' : C} (f : c \u27f6 c') (d : D) :\n d \u22b4\u1d63 f.mop = f \u22b5\u2097 d := rfl\n```\n\n-- snippet 67\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionActionOfMonoidalFunctorToEndofunctorMopIso (L147-L161)\ndef curriedActionActionOfMonoidalFunctorToEndofunctorMopIso\n (F : C \u2964 (D \u2964 D)\u1d39\u1d52\u1d56) [F.Monoidal] :\n letI := actionOfMonoidalFunctorToEndofunctorMop F\ncurriedActionMop C D \u2245 F :=\n .refl _\n\nend MonoidalLeftAction\n\nnamespace MonoidalRightAction\n\nvariable {C D}\n\nopen MonoidalOpposite in\n/-- When `C` acts on the right on `D`, the functor `curriedAction : C \u2964 (D \u2964 D)`\nis monoidal, where `D \u2964 D` has the composition monoidal structure. -/\n```\n\n-- snippet 68\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.inv_actionHomLeft (L306-L309)\nlemma inv_actionHomLeft {x y : C} (f : x \u27f6 y) [IsIso f] (z : D) :\n inv (f \u22b5\u2097 z) = inv f \u22b5\u2097 z :=\nIsIso.inv_eq_of_hom_inv_id <| hom_inv_actionHomLeft' f z\n```\n\n-- snippet 69\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.action_exchange (L231-L234)\ntheorem action_exchange {w x : C} {y z : D} (f : w \u27f6 x) (g : y \u27f6 z) :\n w \u22b4\u2097 g \u226b f \u22b5\u2097 z = f \u22b5\u2097 y \u226b x \u22b4\u2097 g := by\nsimp only [\u2190 id_actionHom, \u2190 actionHom_id, \u2190 actionHom_comp, id_comp, comp_id]\n```\n\n-- snippet 70\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.inv_\u03b4\u2097 (L194-L229)\nlemma inv_\u03b4\u2097 :\n CategoryTheory.inv (\u03b4\u2097 F c d) = \u03bc\u2097 F c d :=\nEq.symm <| IsIso.eq_inv_of_hom_inv_id <| \u03b4\u2097_comp_\u03bc\u2097 F c d\n\nend LeftLinear\n\nend leftAction\n\nsection rightAction\n\nopen MonoidalRightAction\n\n/-- `F.LaxLinear C` equips `F : D \u2964 D'` with a family of morphisms\n`\u03bc\u2097 F : \u2200 (c : C) (d : D), c \u2299\u2097 F.obj d \u27f6 F.obj (c \u2299\u2097 d)`\nthat is natural in each variable and coherent with respect to left actions\nof `C` on `D` and `D'`. -/\nclass LaxRightLinear\n (F : D \u2964 D') (C : Type*) [Category* C] [MonoidalCategory C]\n [MonoidalRightAction C D] [MonoidalRightAction C D'] where\n /-- The \"\u03bc\u1d63\" morphism. -/\n \u03bc\u1d63 (F) (d : D) (c : C) : F.obj d \u2299\u1d63 c \u27f6 F.obj (d \u2299\u1d63 c)\n \u03bc\u1d63_naturality_right (F) (d : D) {c c' : C} (f : c \u27f6 c') :\n F.obj d \u22b4\u1d63 f \u226b \u03bc\u1d63 d c' = \u03bc\u1d63 d c \u226b F.map (d \u22b4\u1d63 f) := by cat_disch\n \u03bc\u1d63_naturality_left (F) {d d' : D} (f : d \u27f6 d') (c : C) :\n F.map f \u22b5\u1d63 c \u226b \u03bc\u1d63 d' c = \u03bc\u1d63 d c \u226b F.map (f \u22b5\u1d63 c) := by cat_disch\n \u03bc\u1d63_associativity (F) (d : D) (c c' : C) :\n \u03bc\u1d63 d (c \u2297 c') \u226b F.map (\u03b1\u1d63 _ _ _).hom =\n (\u03b1\u1d63 (F.obj d) c c').hom \u226b (\u03bc\u1d63 d c) \u22b5\u1d63 c' \u226b\n \u03bc\u1d63 (d \u2299\u1d63 c) c' := by cat_disch\n \u03bc\u1d63_unitality (F) (d : D) :\n (\u03c1\u1d63 (F.obj d)).hom = \u03bc\u1d63 d (\ud835\udfd9_ C) \u226b F.map (\u03c1\u1d63 d).hom := by cat_disch\n\nnamespace LaxRightLinear\n\n-- These are [reassoc (attr := simp)] on the basis that analog lemmas for\n-- lax monoidal functors are also [reassoc (attr := simp)].\n```\n\n-- snippet 71\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionMop_map_unmop_app (L58-L66)\nlemma curriedActionMop_map_unmop_app {c c' : C} (f : c \u27f6 c') (d : D) :\n ((curriedActionMop C D).map f).unmop.app d = f \u22b5\u2097 d :=\nrfl\n\nset_option backward.isDefEq.respectTransparency false in\nopen MonoidalOpposite in\n/-- When `C` acts on the left on `D`, the functor\n`curriedActionMop : C \u2964 (D \u2964 D)\u1d39\u1d52\u1d56` is monoidal, where `D \u2964 D` has the\ncomposition monoidal structure. -/\n```\n\n-- snippet 72\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.comp_actionHomLeft (L221-L224)\ntheorem comp_actionHomLeft {w x y : C} (f : w \u27f6 x) (g : x \u27f6 y) (z : D) :\n (f \u226b g) \u22b5\u2097 z = f \u22b5\u2097 z \u226b g \u22b5\u2097 z := by\nsimp only [\u2190 actionHom_id, \u2190 actionHom_comp, Category.id_comp]\n```\n\n-- snippet 73\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.curriedAction (L326-L335)\ndef curriedAction : C \u2964 D \u2964 D where\n obj x :=\n{ obj y := x \u2299\u2097 y\n map f := x \u22b4\u2097 f }\n map f :=\n { app y := f \u22b5\u2097 y\n naturality _ _ _ := by simp [action_exchange] }\n\nvariable {C} in\n/-- Bundle `d \u21a6 c \u2299\u2097 d` as a functor. -/\n```\n\n-- snippet 74\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionMopMonoidal (L68-L89)\ninstance curriedActionMopMonoidal : (curriedActionMop C D).Monoidal where\n \u03b5 := .mop <| (actionUnitNatIso C D).inv\n\u03bc _ _ := .mop <| { app _ := \u03b1\u2097 _ _ _ |>.inv }\n \u03b4 _ _ := .mop <| { app _ := \u03b1\u2097 _ _ _ |>.hom }\n \u03b7 := .mop <| (actionUnitNatIso C D).hom\n associativity c\u2081 c\u2082 c\u2083 := by\n apply (mopEquiv (D \u2964 D)).fullyFaithfulInverse.map_injective\n ext d\n simpa [-associator_actionHom] using\n (IsIso.inv_eq_inv.mpr <| associator_actionHom c\u2081 c\u2082 c\u2083 d).symm =\u226b\n (\u03b1_ c\u2081 c\u2082 c\u2083).hom \u22b5\u2097 d\n oplax_right_unitality x := by\n apply MonoidalOpposite.hom_ext\n ext t\n simpa [-rightUnitor_actionHom] using\n (\u03c1_ x).inv \u22b5\u2097 t \u226b= rightUnitor_actionHom x t\n oplax_left_unitality x := by\n apply MonoidalOpposite.hom_ext\n ext t\n simpa [-leftUnitor_actionHom] using\n (\u03bb_ x).inv \u22b5\u2097 t \u226b= leftUnitor_actionHom x t\n```\n\n-- snippet 75\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.inv_\u03b4\u1d63 (L356-L364)\nlemma inv_\u03b4\u1d63 :\n CategoryTheory.inv (\u03b4\u1d63 F d c) = \u03bc\u1d63 F d c :=\nEq.symm <| IsIso.eq_inv_of_hom_inv_id <| \u03b4\u1d63_comp_\u03bc\u1d63 F d c\n\nend RightLinear\n\nend rightAction\n\nend CategoryTheory.Functor\n```\n\n-- snippet 76\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfMonoidalOppositeRightAction (L45-L68)\ndef leftActionOfMonoidalOppositeRightAction [MonoidalRightAction C\u1d39\u1d52\u1d56 D] :\n MonoidalLeftAction C D where\n actionObj c d := d \u2299\u1d63 mop c\nactionHomLeft {c c'} f d := d \u22b4\u1d63 f.mop\n actionHomRight c {d d'} f := f \u22b5\u1d63 mop c\n actionHom {c c'} {d d} f g := g \u2299\u1d63\u2098 f.mop\n actionAssocIso _ _ _ := \u03b1\u1d63 _ _ _\n actionUnitIso _ := \u03c1\u1d63 _\n actionHom_def _ _ := MonoidalRightAction.actionHom_def' _ _\n actionAssocIso_hom_naturality _ _ _ :=\n MonoidalRightAction.actionAssocIso_hom_naturality _ _ _\n actionUnitIso_hom_naturality _ :=\n MonoidalRightAction.actionUnitIso_hom_naturality _\n rightUnitor_actionHom c d :=\n MonoidalRightAction.actionHom_leftUnitor _ _\n associator_actionHom c\u2081 c\u2082 c\u2083 d := by\n simpa only [mop_tensorObj, mop_hom_associator,\n MonoidalRightAction.actionHomRight_inv_hom_assoc] using\n (d \u22b4\u1d63 (\u03b1_ (mop c\u2083) (mop c\u2082) (mop c\u2081)).inv) \u226b=\n MonoidalRightAction.actionHom_associator\n (mop c\u2083) (mop c\u2082) (mop c\u2081) d |>.symm\n\n/-- Define a left action of `C\u1d39\u1d52\u1d56` on `D` from a right action of `C` on `D` via\nthe formula `mop c \u2299\u2097 d = d \u2299\u1d63 c`. -/\n```\n\n-- snippet 77\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.isIso_actionHomRight (L292-L295)\ninstance isIso_actionHomRight (x : C) {y z : D} (f : y \u27f6 z) [IsIso f] :\n IsIso (x \u22b4\u2097 f) :=\n\u27e8x \u22b4\u2097 inv f, by simp\u27e9\n```\n\n-- snippet 78\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction_actionAssocIso_mop_mop (L112-L114)\nlemma monoidalOppositeLeftAction_actionAssocIso_mop_mop (c c' : C) (d : D) :\n \u03b1\u2097 (mop c) (mop c') d = \u03b1\u1d63 d c' c := rfl\n```\n\n-- snippet 79\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.inv_actionHom (L316-L320)\nlemma inv_actionHom {x y : C} {x' y' : D}\n (f : x \u27f6 y) (g : x' \u27f6 y') [IsIso f] [IsIso g] :\n inv (f \u2299\u2097\u2098 g) = (inv f) \u2299\u2097\u2098 (inv g) :=\nIsIso.inv_eq_of_hom_inv_id <| by simp [\u2190 actionHom_comp]\n```\n\n-- snippet 80\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionRight_op (L213-L216)\nlemma oppositeLeftAction_actionRight_op\n (c : C) {d d' : D} (f : d \u27f6 d') :\n op c \u22b4\u2097 f.op = op (c \u22b4\u2097 f) := rfl\n```\n\n-- snippet 81\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionUnitIso_inv_naturality (L248-L251)\ntheorem actionUnitIso_inv_naturality {d d' : D} (f : d \u27f6 d') :\n (\u03bb\u2097 d).inv \u226b (\ud835\udfd9_ C) \u22b4\u2097 f = f \u226b (\u03bb\u2097 d').inv := by\nrw [Iso.inv_comp_eq, \u2190 Category.assoc, Eq.comm, Iso.comp_inv_eq, actionUnitIso_hom_naturality]\n```\n\n-- snippet 82\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHom_id (L198-L201)\nlemma actionHom_id {c c' : C} (f : c \u27f6 c') (d : D) :\n f \u2299\u2097\u2098 (\ud835\udfd9 d) = f \u22b5\u2097 d := by\nsimp [actionHom_def]\n```\n\n-- snippet 83\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionMop (L50-L56)\ndef curriedActionMop : C \u2964 (D \u2964 D)\u1d39\u1d52\u1d56 :=\n(curriedAction C D) \u22d9 mopFunctor _\n\n-- This simp lemma is necessary because the simps projection generated for\n-- unmop of a morphism is actually its underlying unmop field, rather than\n-- the application of `Quiver.Hom.unmop`.\nvariable {C D} in\n```\n\n-- snippet 84\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionAssocNatIso (L346-L353)\ndef actionAssocNatIso :\n bifunctorComp\u2081\u2082 (curriedTensor C) (curriedAction C D) \u2245\n bifunctorComp\u2082\u2083 (curriedAction C D) (curriedAction C D) :=\nNatIso.ofComponents fun _ \u21a6\n NatIso.ofComponents fun _ \u21a6\n NatIso.ofComponents fun _ \u21a6 \u03b1\u2097 _ _ _\n\n/-- Bundle `\u03bb\u2097 _` as an isomorphism of functors. -/\n```\n\n-- snippet 85\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.selfLeftAction (L175-L191)\ninstance selfLeftAction [MonoidalCategory C] : MonoidalLeftAction C C where\n actionObj x y := x \u2297 y\nactionHom f g := f \u2297\u2098 g\n actionUnitIso x := \u03bb_ x\n actionAssocIso x y z := \u03b1_ x y z\n actionHomLeft f x := f \u25b7 x\n actionHomRight x _ _ f := x \u25c1 f\n actionHom_def := by simp [tensorHom_def]\n\nnamespace MonoidalLeftAction\n\nopen Category\n\nvariable {C D} [MonoidalCategory C] [MonoidalLeftAction C D]\n\n-- Simp normal forms are aligned with the ones in `MonoidalCategory`.\n```\n\n-- snippet 86\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction (L122-L162)\ndef oppositeLeftAction [MonoidalLeftAction C D] :\n MonoidalLeftAction C\u1d52\u1d56 D\u1d52\u1d56 where\n actionObj c d := op <| c.unop \u2299\u2097 d.unop\nactionHomLeft f d := (f.unop \u22b5\u2097 unop d).op\n actionHomRight c _ _ f := (unop c \u22b4\u2097 f.unop).op\n actionHom f g := (f.unop \u2299\u2097\u2098 g.unop).op\n actionAssocIso _ _ _ := Iso.op <| (\u03b1\u2097 _ _ _).symm\n actionUnitIso _ := Iso.op <| (\u03bb\u2097 _).symm\n actionHom_def\n | op f, op g => by\n apply Quiver.Hom.unop_inj\n simpa [MonoidalLeftAction.action_exchange] using\n MonoidalLeftAction.actionHom_def f g\n actionAssocIso_hom_naturality\n | op f, op g, op h => by\n apply Quiver.Hom.unop_inj\n haveI := (\u03b1\u2097 (unop _) (unop _) (unop _)).inv \u226b=\n MonoidalLeftAction.actionAssocIso_hom_naturality f g h\n simp only [Iso.inv_hom_id_assoc] at this\n simp [\u2190 this]\n actionUnitIso_hom_naturality _ := by\n apply Quiver.Hom.unop_inj\n simp\n whiskerRight_actionHomLeft _ _ _ := by\n apply Quiver.Hom.unop_inj\n simp\n associator_actionHom _ _ _ _ := by\n apply Quiver.Hom.unop_inj\n apply IsIso.inv_eq_inv.mp\n simp\n leftUnitor_actionHom _ _ := by\n apply Quiver.Hom.unop_inj\n apply IsIso.inv_eq_inv.mp\n simp\n rightUnitor_actionHom _ _ := by\n apply Quiver.Hom.unop_inj\n apply IsIso.inv_eq_inv.mp\n simp\n\n/-- Define a left action of `C` on `D` from a left action of `C\u1d52\u1d56` on `D\u1d52\u1d56` via\nthe formula `c \u2299\u2097 d = unop ((op c) \u2299\u2097 (op d))`. -/\n```\n\n-- snippet 87\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.inv_hom_actionHomLeft' (L288-L291)\ntheorem inv_hom_actionHomLeft' {x y : C} (f : x \u27f6 y) [IsIso f] (z : D) :\n inv f \u22b5\u2097 z \u226b f \u22b5\u2097 z = \ud835\udfd9 (y \u2299\u2097 z) := by\nrw [\u2190 comp_actionHomLeft, IsIso.inv_hom_id, id_actionHomLeft]\n```\n\n-- snippet 88\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionObj_op (L206-L208)\nlemma oppositeLeftAction_actionObj_op (c : C) (d : D) :\n (op c) \u2299\u2097 (op d) = op (c \u2299\u2097 d) := rfl\n```\n\n-- snippet 89\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.inv_hom_actionHomLeft (L268-L271)\ntheorem inv_hom_actionHomLeft {x y : C} (f : x \u2245 y) (z : D) :\n f.inv \u22b5\u2097 z \u226b f.hom \u22b5\u2097 z = \ud835\udfd9 (y \u2299\u2097 z) := by\nrw [\u2190 comp_actionHomLeft, Iso.inv_hom_id, id_actionHomLeft]\n```\n\n-- snippet 90\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03bc\u1d63_unitality_inv (L250-L285)\nlemma \u03bc\u1d63_unitality_inv (d : D) :\n (\u03c1\u1d63 (F.obj d)).inv \u226b \u03bc\u1d63 F d (\ud835\udfd9_ C) = F.map (\u03c1\u1d63 d).inv := by\nsimpa [-\u03bc\u1d63_unitality] using\n (\u03c1\u1d63[C] (F.obj d)).inv \u226b=\n (\u03bc\u1d63_unitality F d).symm =\u226b\n F.map (\u03c1\u1d63[C] d).inv\n\nend LaxRightLinear\n\n/-- `F.OplaxLinear C` equips `F : D \u2964 D'` with a family of morphisms\n`\u03b4\u2097 F : \u2200 (c : C) (d : D), c \u2299\u2097 F.obj d \u27f6 F.obj (c \u2299\u2097 d)`\nthat is natural in each variable and coherent with respect to left actions\nof `C` on `D` and `D'`. -/\nclass OplaxRightLinear\n (F : D \u2964 D') (C : Type*) [Category* C] [MonoidalCategory C]\n [MonoidalRightAction C D] [MonoidalRightAction C D'] where\n /-- The oplax lineator morphism. -/\n \u03b4\u1d63 (F) (d : D) (c : C) : F.obj (d \u2299\u1d63 c) \u27f6 (F.obj d) \u2299\u1d63 c\n \u03b4\u1d63_naturality_right (F) (d : D) {c c' : C} (f : c \u27f6 c') :\n F.map (d \u22b4\u1d63 f) \u226b \u03b4\u1d63 d c' =\n \u03b4\u1d63 d c \u226b F.obj d \u22b4\u1d63 f := by cat_disch\n \u03b4\u1d63_naturality_left (F) {d d' : D} (f : d \u27f6 d') (c : C) :\n F.map (f \u22b5\u1d63 c) \u226b \u03b4\u1d63 d' c =\n \u03b4\u1d63 d c \u226b F.map f \u22b5\u1d63 c := by cat_disch\n \u03b4\u1d63_associativity (F) (d : D) (c c' : C) :\n \u03b4\u1d63 d (c \u2297 c') \u226b (\u03b1\u1d63 _ _ _).hom =\n F.map (\u03b1\u1d63 _ _ _).hom \u226b \u03b4\u1d63 (d \u2299\u1d63 c) c' \u226b\n \u03b4\u1d63 d c \u22b5\u1d63 c' := by cat_disch\n \u03b4\u1d63_unitality_inv (F) (d : D) :\n (\u03c1\u1d63 (F.obj d)).inv =\n F.map (\u03c1\u1d63 d).inv \u226b \u03b4\u1d63 d (\ud835\udfd9_ C) := by cat_disch\n\nnamespace OplaxRightLinear\n\n-- These are [reassoc (attr := simp)] on the basis that analog lemmas for\n-- oplax monoidal functors are also [reassoc (attr := simp)].\n```\n\n-- snippet 91\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionMonoidal (L163-L185)\ninstance curriedActionMonoidal [MonoidalRightAction C D] :\n (curriedAction C D).Monoidal where\n \u03b5 := (actionUnitNatIso C D).inv\n\u03bc _ _ := { app _ := \u03b1\u1d63 _ _ _ |>.inv }\n \u03b4 _ _ := { app _ := \u03b1\u1d63 _ _ _ |>.hom }\n \u03b7 := (actionUnitNatIso C D).hom\n associativity c\u2081 c\u2082 c\u2083 := by\n ext d\n simpa [-actionHom_associator] using\n (IsIso.inv_eq_inv.mpr <| actionHom_associator c\u2081 c\u2082 c\u2083 d).symm =\u226b\n d \u22b4\u1d63 (\u03b1_ c\u2081 c\u2082 c\u2083).hom\n oplax_right_unitality x := by\n ext t\n simpa [-actionHom_rightUnitor] using\n t \u22b4\u1d63 (\u03c1_ x).inv \u226b= actionHom_rightUnitor x t\n oplax_left_unitality x := by\n ext t\n simpa [-actionHom_leftUnitor] using\n t \u22b4\u1d63 (\u03bb_ x).inv \u226b= actionHom_leftUnitor x t\n\nset_option backward.isDefEq.respectTransparency false in\n/-- A monoidal functor `F : C \u2964 D \u2964 D` can be thought of as a right action\nof `C` on `D`. -/\n```\n\n-- snippet 92\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.action_actionHomRight (L536-L539)\ntheorem action_actionHomRight (y : D) (z : C) {x x' : C} (f : x \u27f6 x') :\n (y \u2299\u1d63 z) \u22b4\u1d63 f = (\u03b1\u1d63 y z x).inv \u226b y \u22b4\u1d63 (z \u25c1 f) \u226b (\u03b1\u1d63 y z x').hom := by\nsimp [whiskerRight_actionHomLeft]\n```\n\n-- snippet 93\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction_actionHom_unop (L242-L245)\nlemma leftActionOfOppositeLeftAction_actionHom_unop\n {c c' : C\u1d52\u1d56} {d d' : D\u1d52\u1d56} (f : c \u27f6 c') (g : d \u27f6 d') :\n f.unop \u2299\u2097\u2098 g.unop = unop (f \u2299\u2097\u2098 g) := rfl\n```\n\n-- snippet 94\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03bc\u2097_unitality_inv (L88-L123)\nlemma \u03bc\u2097_unitality_inv (d : D) :\n (\u03bb\u2097 (F.obj d)).inv \u226b \u03bc\u2097 F (\ud835\udfd9_ C) d = F.map (\u03bb\u2097 d).inv := by\nsimpa [-\u03bc\u2097_unitality] using\n (\u03bb\u2097[C] (F.obj d)).inv \u226b=\n (\u03bc\u2097_unitality F d).symm =\u226b\n F.map (\u03bb\u2097[C] d).inv\n\nend LaxLeftLinear\n\n/-- `F.OplaxLinear C` equips `F : D \u2964 D'` with a family of morphisms\n`\u03b4\u2097 F : \u2200 (c : C) (d : D), c \u2299\u2097 F.obj d \u27f6 F.obj (c \u2299\u2097 d)`\nthat is natural in each variable and coherent with respect to left actions\nof `C` on `D` and `D'`. -/\nclass OplaxLeftLinear\n (F : D \u2964 D') (C : Type*) [Category* C] [MonoidalCategory C]\n [MonoidalLeftAction C D] [MonoidalLeftAction C D'] where\n /-- The oplax lineator morphism. -/\n \u03b4\u2097 (F) (c : C) (d : D) : F.obj (c \u2299\u2097 d) \u27f6 c \u2299\u2097 F.obj d\n \u03b4\u2097_naturality_left (F) {c c' : C} (f : c \u27f6 c') (d : D) :\n F.map (f \u22b5\u2097 d) \u226b \u03b4\u2097 c' d =\n \u03b4\u2097 c d \u226b f \u22b5\u2097 F.obj d := by cat_disch\n \u03b4\u2097_naturality_right (F) (c : C) {d d' : D} (f : d \u27f6 d') :\n F.map (c \u22b4\u2097 f) \u226b \u03b4\u2097 c d' =\n \u03b4\u2097 c d \u226b c \u22b4\u2097 F.map f := by cat_disch\n \u03b4\u2097_associativity (F) (c c' : C) (d : D) :\n \u03b4\u2097 (c \u2297 c') d \u226b (\u03b1\u2097 _ _ _).hom =\n F.map (\u03b1\u2097 _ _ _).hom \u226b \u03b4\u2097 c (c' \u2299\u2097 d) \u226b\n c \u22b4\u2097 \u03b4\u2097 c' d := by cat_disch\n \u03b4\u2097_unitality_inv (F) (d : D) :\n (\u03bb\u2097 (F.obj d)).inv =\n F.map (\u03bb\u2097 d).inv \u226b \u03b4\u2097 (\ud835\udfd9_ C) d := by cat_disch\n\nnamespace OplaxLeftLinear\n\n-- These are [reassoc (attr := simp)] on the basis that analog lemmas for\n-- oplax monoidal functors are also [reassoc (attr := simp)].\n```\n\n-- snippet 95\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03bc\u1d63Iso (L340-L345)\nabbrev \u03bc\u1d63Iso (d : D) (c : C) : F.obj d \u2299\u1d63 c \u2245 F.obj (d \u2299\u1d63 c) where\n hom := LaxRightLinear.\u03bc\u1d63 F d c\ninv := OplaxRightLinear.\u03b4\u1d63 F d c\n\nvariable (c : C) (d : D)\n```\n\n-- snippet 96\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction_actionHomLeft_unop (L234-L237)\nlemma leftActionOfOppositeLeftAction_actionHomLeft_unop\n {c c' : C\u1d52\u1d56} (f : c \u27f6 c') (d : D\u1d52\u1d56) :\n f.unop \u22b5\u2097 unop d = unop (f \u22b5\u2097 d) := rfl\n```\n\n-- snippet 97\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionAssocIso_inv_naturality (L241-L246)\ntheorem actionAssocIso_inv_naturality\n {c\u2081 c\u2082 c\u2083 c\u2084 : C} {d\u2081 d\u2082 : D} (f : c\u2081 \u27f6 c\u2082) (g : c\u2083 \u27f6 c\u2084) (h : d\u2081 \u27f6 d\u2082) :\n (f \u2299\u2097\u2098 g \u2299\u2097\u2098 h) \u226b (\u03b1\u2097 c\u2082 c\u2084 d\u2082).inv =\n (\u03b1\u2097 c\u2081 c\u2083 d\u2081).inv \u226b ((f \u2297\u2098 g) \u2299\u2097\u2098 h) := by\nrw [Iso.comp_inv_eq, Category.assoc, Eq.comm, Iso.inv_comp_eq, actionAssocIso_hom_naturality]\n```\n\n-- snippet 98\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.inv_\u03bc\u1d63 (L351-L354)\nlemma inv_\u03bc\u1d63 :\n CategoryTheory.inv (\u03bc\u1d63 F d c) = \u03b4\u1d63 F d c :=\nEq.symm <| IsIso.eq_inv_of_hom_inv_id <| \u03bc\u1d63_comp_\u03b4\u1d63 F d c\n```\n\n-- snippet 99\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction_actionObj_mop (L97-L99)\nlemma monoidalOppositeLeftAction_actionObj_mop (c : C) (d : D) :\n mop c \u2299\u2097 d = d \u2299\u1d63 c := rfl\n```\n\n-- snippet 100\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.unit_actionHomRight (L208-L212)\ntheorem unit_actionHomRight {x y : D} (f : x \u27f6 y) :\n (\ud835\udfd9_ C) \u22b4\u2097 f = (\u03bb\u2097 x).hom \u226b f \u226b (\u03bb\u2097 y).inv := by\nrw [\u2190 Category.assoc, actionUnitIso_hom_naturality]\n simp\n```\n\n-- snippet 101\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction_actionRight_mop (L104-L107)\nlemma monoidalOppositeLeftAction_actionRight_mop\n (c : C) {d d' : D} (f : d \u27f6 d') :\n mop c \u22b4\u2097 f = f \u22b5\u1d63 c := rfl\n```\n\n-- snippet 102\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomRight_hom_inv' (L273-L276)\ntheorem actionHomRight_hom_inv' (x : C) {y z : D} (f : y \u27f6 z) [IsIso f] :\n x \u22b4\u2097 f \u226b x \u22b4\u2097 inv f = \ud835\udfd9 (x \u2299\u2097 y) := by\nrw [\u2190 actionHomRight_comp, IsIso.hom_inv_id, actionHomRight_id]\n```\n\n-- snippet 103\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.id_actionHom (L193-L196)\nlemma id_actionHom (c : C) {d d' : D} (f : d \u27f6 d') :\n (\ud835\udfd9 c) \u2299\u2097\u2098 f = c \u22b4\u2097 f := by\nsimp [actionHom_def]\n```\n\n-- snippet 104\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionRight (L342-L344)\nabbrev actionRight (d : D) : C \u2964 D := curriedAction C D |>.flip.obj d\n/-- Bundle `\u03b1\u2097 _ _ _` as an isomorphism of trifunctors. -/\n```\n\n-- snippet 105\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomRight_inv_hom (L263-L266)\ntheorem actionHomRight_inv_hom (x : C) {y z : D} (f : y \u2245 z) :\n x \u22b4\u2097 f.inv \u226b x \u22b4\u2097 f.hom = \ud835\udfd9 (x \u2299\u2097 z) := by\nrw [\u2190 actionHomRight_comp, Iso.inv_hom_id, actionHomRight_id]\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.CategoryTheory.Monoidal.Opposite).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]Prove the following theorem. The retrieved context below may help.\n\n```lean\ntheorem unmop_comp {X Y Z : C\u1d39\u1d52\u1d56} {f : X \u27f6 Y} {g : Y \u27f6 Z} :\n (f \u226b g).unmop = f.unmop \u226b g.unmop\n```\n\n## Retrieved context\n-- snippet 1\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_injective (L40-L41)\ntheorem mop_injective : Function.Injective (mop : C \u2192 C\u1d39\u1d52\u1d56) := @mop.inj C\n```\n\n-- snippet 2\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_injective (L42-L44)\ntheorem unmop_injective : Function.Injective (unmop : C\u1d39\u1d52\u1d56 \u2192 C) :=\nfun _ _ h => congrArg mop h\n```\n\n-- snippet 3\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_inj_iff (L45-L46)\ntheorem mop_inj_iff (x y : C) : mop x = mop y \u2194 x = y := mop_injective.eq_iff\n```\n\n-- snippet 4\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_inj_iff (L48-L49)\ntheorem unmop_inj_iff (x y : C\u1d39\u1d52\u1d56) : unmop x = unmop y \u2194 x = y := unmop_injective.eq_iff\n```\n\n-- snippet 5\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_unmop (L51-L53)\ntheorem mop_unmop (X : C\u1d39\u1d52\u1d56) : mop (unmop X) = X := rfl\n-- can't be simp bc after putting the lhs in whnf it's `X = X`\n```\n\n-- snippet 6\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_mop (L54-L55)\ntheorem unmop_mop (X : C) : unmop (mop X) = X := rfl\n```\n\n-- snippet 7\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.monoidalOppositeCategory (L56-L71)\ninstance monoidalOppositeCategory [Category.{v\u2081} C] : Category C\u1d39\u1d52\u1d56 where\n Hom X Y := (unmop X \u27f6 unmop Y)\u1d39\u1d52\u1d56\nid X := mop (\ud835\udfd9 (unmop X))\n comp f g := mop (unmop f \u226b unmop g)\n\nend MonoidalOpposite\n\nend CategoryTheory\n\nopen CategoryTheory\n\nopen CategoryTheory.MonoidalOpposite\n\nvariable [Category.{v\u2081} C]\n\n/-- The monoidal opposite of a morphism `f : X \u27f6 Y` is just `f`, thought of as `mop X \u27f6 mop Y`. -/\n```\n\n-- snippet 8\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.Quiver (L72-L74)\ndef Quiver.Hom.mop {X Y : C} (f : X \u27f6 Y) : mop X \u27f6 mop Y := MonoidalOpposite.mop f\n/-- We can think of a morphism `f : mop X \u27f6 mop Y` as a morphism `X \u27f6 Y`. -/\n```\n\n-- snippet 9\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.Quiver (L75-L80)\ndef Quiver.Hom.unmop {X Y : C\u1d39\u1d52\u1d56} (f : X \u27f6 Y) : unmop X \u27f6 unmop Y := MonoidalOpposite.unmop f\nnamespace Quiver.Hom\n\nopen MonoidalOpposite renaming mop \u2192 mop', unmop \u2192 unmop'\n```\n\n-- snippet 10\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_inj (L81-L84)\ntheorem mop_inj {X Y : C} :\n Function.Injective (Quiver.Hom.mop : (X \u27f6 Y) \u2192 (mop' X \u27f6 mop' Y)) :=\nfun _ _ H => congr_arg Quiver.Hom.unmop H\n```\n\n-- snippet 11\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_inj (L85-L88)\ntheorem unmop_inj {X Y : C\u1d39\u1d52\u1d56} :\n Function.Injective (Quiver.Hom.unmop : (X \u27f6 Y) \u2192 (unmop' X \u27f6 unmop' Y)) :=\nfun _ _ H => congr_arg Quiver.Hom.mop H\n```\n\n-- snippet 12\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_mop (L90-L92)\ntheorem unmop_mop {X Y : C} {f : X \u27f6 Y} : f.mop.unmop = f :=\nrfl\n```\n\n-- snippet 13\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_unmop (L94-L100)\ntheorem mop_unmop {X Y : C\u1d39\u1d52\u1d56} {f : X \u27f6 Y} : f.unmop.mop = f :=\nrfl\n\nend Quiver.Hom\n\nnamespace CategoryTheory\n```\n\n-- snippet 14\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_comp (L102-L104)\ntheorem mop_comp {X Y Z : C} {f : X \u27f6 Y} {g : Y \u27f6 Z} :\n (f \u226b g).mop = f.mop \u226b g.mop := rfl\n```\n\n-- snippet 15\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_id (L106-L107)\ntheorem mop_id {X : C} : (\ud835\udfd9 X).mop = \ud835\udfd9 (mop X) := rfl\n```\n\n-- snippet 16\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_id (L113-L114)\ntheorem unmop_id {X : C\u1d39\u1d52\u1d56} : (\ud835\udfd9 X).unmop = \ud835\udfd9 (unmop X) := rfl\n```\n\n-- snippet 17\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop_id_mop (L116-L117)\ntheorem unmop_id_mop {X : C} : (\ud835\udfd9 (mop X)).unmop = \ud835\udfd9 X := rfl\n```\n\n-- snippet 18\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.mop_id_unmop (L119-L121)\ntheorem mop_id_unmop {X : C\u1d39\u1d52\u1d56} : (\ud835\udfd9 (unmop X)).mop = \ud835\udfd9 X := rfl\n-- aesop prefers this lemma as a safe apply over Quiver.Hom.unmop_inj\n```\n\n-- snippet 19\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.MonoidalOpposite (L122-L128)\nlemma MonoidalOpposite.hom_ext {x y : C\u1d39\u1d52\u1d56} {f g : x \u27f6 y} (h : f.unmop = g.unmop) :\n f = g :=\nQuiver.Hom.unmop_inj h\n\nvariable (C)\n\n/-- The identity functor on `C`, viewed as a functor from `C` to its monoidal opposite. -/\n```\n\n-- snippet 20\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.mopFunctor (L130-L131)\ndef mopFunctor : C \u2964 C\u1d39\u1d52\u1d56 := Functor.mk mop .mop\n/-- The identity functor on `C`, viewed as a functor from the monoidal opposite of `C` to `C`. -/\n```\n\n-- snippet 21\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.unmopFunctor (L133-L139)\ndef unmopFunctor : C\u1d39\u1d52\u1d56 \u2964 C := Functor.mk unmop .unmop\nvariable {C}\n\nnamespace Iso\n\n/-- An isomorphism in `C` gives an isomorphism in `C\u1d39\u1d52\u1d56`. -/\n```\n\n-- snippet 22\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.mop (L140-L142)\nabbrev mop {X Y : C} (f : X \u2245 Y) : mop X \u2245 mop Y := (mopFunctor C).mapIso f\n/-- An isomorphism in `C\u1d39\u1d52\u1d56` gives an isomorphism in `C`. -/\n```\n\n-- snippet 23\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.unmop (L143-L148)\nabbrev unmop {X Y : C\u1d39\u1d52\u1d56} (f : X \u2245 Y) : unmop X \u2245 unmop Y := (unmopFunctor C).mapIso f\nend Iso\n\nnamespace IsIso\n```\n\n-- snippet 24\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.monoidalCategoryOp (L160-L178)\ninstance monoidalCategoryOp : MonoidalCategory C\u1d52\u1d56 where\n tensorObj X Y := op (unop X \u2297 unop Y)\nwhiskerLeft X _ _ f := (X.unop \u25c1 f.unop).op\n whiskerRight f X := (f.unop \u25b7 X.unop).op\n tensorHom f g := (f.unop \u2297\u2098 g.unop).op\n tensorHom_def _ _ := Quiver.Hom.unop_inj (tensorHom_def' _ _)\n tensorHom_comp_tensorHom _ _ _ _ := Quiver.Hom.unop_inj <| by simp\n tensorUnit := op (\ud835\udfd9_ C)\n associator X Y Z := (\u03b1_ (unop X) (unop Y) (unop Z)).symm.op\n leftUnitor X := (\u03bb_ (unop X)).symm.op\n rightUnitor X := (\u03c1_ (unop X)).symm.op\n associator_naturality f g h := Quiver.Hom.unop_inj <| by simp\n leftUnitor_naturality f := Quiver.Hom.unop_inj <| by simp\n rightUnitor_naturality f := Quiver.Hom.unop_inj <| by simp\n triangle X Y := Quiver.Hom.unop_inj <| by dsimp; monoidal_coherence\n pentagon W X Y Z := Quiver.Hom.unop_inj <| by dsimp; monoidal_coherence\n\nsection OppositeLemmas\n```\n\n-- snippet 25\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Opposite.op_tensor_op (L235-L236)\ntheorem op_tensor_op {W X Y Z : C} (f : W \u27f6 X) (g : Y \u27f6 Z) : f.op \u2297\u2098 g.op = (f \u2297\u2098 g).op := rfl\n```\n\n-- snippet 26\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.End.actionOfMonoidalFunctorToEndofunctor (L187-L201)\ndef actionOfMonoidalFunctorToEndofunctor (F : C \u2964 D \u2964 D) [F.Monoidal] :\n MonoidalRightAction C D where\n actionObj d c := (F.obj c).obj d\nactionHomLeft f c := (F.obj c).map f\n actionHomRight d _ _ f := (F.map f).app d\n actionAssocIso d c c' := Functor.Monoidal.\u03bcIso F c c' |>.app d |>.symm\n actionUnitIso d := Functor.Monoidal.\u03b5Iso F |>.app d |>.symm\n actionAssocIso_hom_naturality {c\u2081 c\u2081' c\u2082 c\u2082' c\u2083 c\u2083'} f g h := by\n have e := congrArg (fun t \u21a6 t.app c\u2081) <|\n Functor.OplaxMonoidal.\u03b4_natural F g h\n dsimp at e\n simp [reassoc_of% e]\n\n/-- If the action of `C` on `D` comes from a monoidal functor `C \u2964 (D \u2964 D)`,\nthen `curriedActionMop C D` is naturally isomorphic to that functor. -/\n```\n\n-- snippet 27\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeRightAction_actionObj_mop (L309-L311)\nlemma monoidalOppositeRightAction_actionObj_mop (c : C) (d : D) :\n d \u2299\u1d63 mop c = c \u2299\u2097 d := rfl\n```\n\n-- snippet 28\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03b4\u2097_associativity_inv (L135-L143)\nlemma \u03b4\u2097_associativity_inv (c c' : C) (d : D) :\n \u03b4\u2097 F c (c' \u2299\u2097 d) \u226b\n c \u22b4\u2097 \u03b4\u2097 F c' d \u226b (\u03b1\u2097 _ _ _).inv =\n F.map (\u03b1\u2097 _ _ _).inv \u226b \u03b4\u2097 F (c \u2297 c' : C) d := by\nsimpa [-\u03b4\u2097_associativity, -\u03b4\u2097_associativity_assoc] using\n F.map (\u03b1\u2097 _ _ _).inv \u226b=\n (\u03b4\u2097_associativity F c c' d).symm =\u226b\n (\u03b1\u2097 _ _ _).inv\n```\n\n-- snippet 29\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionLeft (L337-L340)\nabbrev actionLeft (c : C) : D \u2964 D := curriedAction C D |>.obj c\nvariable {D} in\n/-- Bundle `c \u21a6 c \u2299\u2097 d` as a functor. -/\n```\n\n-- snippet 30\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.hom_inv_actionHomLeft (L258-L261)\ntheorem hom_inv_actionHomLeft {x y : C} (f : x \u2245 y) (z : D) :\n f.hom \u22b5\u2097 z \u226b f.inv \u22b5\u2097 z = \ud835\udfd9 (x \u2299\u2097 z) := by\nrw [\u2190 comp_actionHomLeft, Iso.hom_inv_id, id_actionHomLeft]\n```\n\n-- snippet 31\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03b4\u1d63_associativity_inv (L297-L305)\nlemma \u03b4\u1d63_associativity_inv (d : D) (c c' : C) :\n \u03b4\u1d63 F (d \u2299\u1d63 c) c' \u226b\n \u03b4\u1d63 F d c \u22b5\u1d63 c' \u226b (\u03b1\u1d63 _ _ _).inv =\n F.map (\u03b1\u1d63 _ _ _).inv \u226b \u03b4\u1d63 F d (c \u2297 c' : C) := by\nsimpa [-\u03b4\u1d63_associativity, -\u03b4\u1d63_associativity_assoc] using\n F.map (\u03b1\u1d63 _ _ _).inv \u226b=\n (\u03b4\u1d63_associativity F d c c').symm =\u226b\n (\u03b1\u1d63 _ _ _).inv\n```\n\n-- snippet 32\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03b4\u1d63_unitality_hom (L307-L335)\nlemma \u03b4\u1d63_unitality_hom (d : D) :\n \u03b4\u1d63 F d (\ud835\udfd9_ C) \u226b (\u03c1\u1d63 (F.obj d)).hom = F.map (\u03c1\u1d63 d).hom := by\nsimpa [-\u03b4\u1d63_unitality_inv] using\n F.map (\u03c1\u1d63[C] d).hom \u226b=\n (\u03b4\u1d63_unitality_inv F d).symm =\u226b\n (\u03c1\u1d63[C] (F.obj d)).hom\n\nend OplaxRightLinear\n\n/-- `F.RightLinear C` asserts that `F` is both lax and oplax left-linear,\nin a compatible way, i.e that `\u03bc\u1d63` is inverse to `\u03b4\u1d63`. -/\nclass RightLinear\n (F : D \u2964 D') (C : Type*) [Category* C] [MonoidalCategory C]\n [MonoidalRightAction C D] [MonoidalRightAction C D'] extends\n F.LaxRightLinear C, F.OplaxRightLinear C where\n \u03bc\u1d63_comp_\u03b4\u1d63 (F) (d : D) (c : C) :\n LaxRightLinear.\u03bc\u1d63 F d c \u226b OplaxRightLinear.\u03b4\u1d63 F d c = \ud835\udfd9 _\n \u03b4\u1d63_comp_\u03bc\u1d63 (F) (d : D) (c : C) :\n OplaxRightLinear.\u03b4\u1d63 F d c \u226b LaxRightLinear.\u03bc\u1d63 F d c = \ud835\udfd9 _\n\nnamespace RightLinear\n\nopen LaxRightLinear OplaxRightLinear\n\nvariable\n (F : D \u2964 D') {C : Type*} [Category* C] [MonoidalCategory C]\n [MonoidalRightAction C D] [MonoidalRightAction C D']\n [F.RightLinear C]\n```\n\n-- snippet 33\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomRight_inv_hom' (L283-L286)\ntheorem actionHomRight_inv_hom' (x : C) {y z : D} (f : y \u27f6 z) [IsIso f] :\n x \u22b4\u2097 inv f \u226b x \u22b4\u2097 f = \ud835\udfd9 (x \u2299\u2097 z) := by\nrw [\u2190 actionHomRight_comp, IsIso.inv_hom_id, actionHomRight_id]\n```\n\n-- snippet 34\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionHomLeft_op (L209-L212)\nlemma oppositeLeftAction_actionHomLeft_op\n {c c' : C} (f : c \u27f6 c') (d : D) :\n f.op \u22b5\u2097 op d = op (f \u22b5\u2097 d) := rfl\n```\n\n-- snippet 35\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomLeft_action (L226-L229)\ntheorem actionHomLeft_action {x x' : C} (f : x \u27f6 x') (y : C) (z : D) :\n f \u22b5\u2097 (y \u2299\u2097 z) = (\u03b1\u2097 x y z).inv \u226b (f \u25b7 y) \u22b5\u2097 z \u226b (\u03b1\u2097 x' y z).hom := by\nsimp [whiskerRight_actionHomLeft]\n```\n\n-- snippet 36\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction (L70-L91)\ndef monoidalOppositeLeftAction [MonoidalRightAction C D] :\n MonoidalLeftAction C\u1d39\u1d52\u1d56 D where\n actionObj c d := d \u2299\u1d63 unmop c\nactionHomLeft {c c'} f d := d \u22b4\u1d63 f.unmop\n actionHomRight c {d d'} f := f \u22b5\u1d63 unmop c\n actionHom {c c'} {d d} f g := g \u2299\u1d63\u2098 f.unmop\n actionAssocIso _ _ _ := \u03b1\u1d63 _ _ _\n actionUnitIso _ := \u03c1\u1d63 _\n actionHom_def _ _ := MonoidalRightAction.actionHom_def' _ _\n actionAssocIso_hom_naturality _ _ _ :=\n MonoidalRightAction.actionAssocIso_hom_naturality _ _ _\n actionUnitIso_hom_naturality _ :=\n MonoidalRightAction.actionUnitIso_hom_naturality _\n rightUnitor_actionHom c d :=\n MonoidalRightAction.actionHom_leftUnitor _ _\n associator_actionHom c\u2081 c\u2082 c\u2083 d := by\n simpa only [mop_tensorObj, mop_hom_associator,\n MonoidalRightAction.actionHomRight_inv_hom_assoc] using\n (d \u22b4\u1d63 (\u03b1_ (unmop c\u2083) (unmop c\u2082) (unmop c\u2081)).inv) \u226b=\n MonoidalRightAction.actionHom_associator\n (unmop c\u2083) (unmop c\u2082) (unmop c\u2081) d |>.symm\n```\n\n-- snippet 37\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomLeft_tensor (L524-L529)\ntheorem actionHomLeft_tensor {z z' : D} (f : z \u27f6 z') (x y : C) :\n (f \u22b5\u1d63 (x \u2297 y)) = (\u03b1\u1d63 z x y).hom \u226b (f \u22b5\u1d63 x) \u22b5\u1d63 y \u226b (\u03b1\u1d63 z' x y).inv := by\nsimp only [\u2190 actionHom_id]\n rw [\u2190 Category.assoc, \u2190 actionAssocIso_hom_naturality]\n simp\n```\n\n-- snippet 38\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03bc\u2097Iso (L178-L183)\nabbrev \u03bc\u2097Iso (c : C) (d : D) : c \u2299\u2097 F.obj d \u2245 F.obj (c \u2299\u2097 d) where\n hom := LaxLeftLinear.\u03bc\u2097 F c d\ninv := OplaxLeftLinear.\u03b4\u2097 F c d\n\nvariable (c : C) (d : D)\n```\n\n-- snippet 39\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03bc\u1d63_associativity_inv (L241-L248)\nlemma \u03bc\u1d63_associativity_inv (d : D) (c c' : C) :\n \u03bc\u1d63 F d c \u22b5\u1d63 c' \u226b \u03bc\u1d63 F (d \u2299\u1d63 c) c' \u226b F.map (\u03b1\u1d63 _ _ _).inv =\n (\u03b1\u1d63 (F.obj d) c c').inv \u226b \u03bc\u1d63 F d (c \u2297 c') := by\nsimpa [-\u03bc\u1d63_associativity, -\u03bc\u1d63_associativity_assoc] using\n (\u03b1\u1d63 _ _ _).inv \u226b=\n (\u03bc\u1d63_associativity F d c c').symm =\u226b\n F.map (\u03b1\u1d63 _ _ _).inv\n```\n\n-- snippet 40\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.inv_\u03bc\u2097 (L189-L192)\nlemma inv_\u03bc\u2097 :\n CategoryTheory.inv (\u03bc\u2097 F c d) = \u03b4\u2097 F c d :=\nEq.symm <| IsIso.eq_inv_of_hom_inv_id <| \u03bc\u2097_comp_\u03b4\u2097 F c d\n```\n\n-- snippet 41\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction_actionHomLeft_mop (L100-L103)\nlemma monoidalOppositeLeftAction_actionHomLeft_mop\n {c c' : C} (f : c \u27f6 c') (d : D) :\n f.mop \u22b5\u2097 d = d \u22b4\u1d63 f := rfl\n```\n\n-- snippet 42\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.isIso_actionHom (L300-L304)\ninstance isIso_actionHom {x y : C} {x' y' : D}\n (f : x \u27f6 y) (g : x' \u27f6 y') [IsIso f] [IsIso g] :\n IsIso (f \u2299\u2097\u2098 g) :=\n\u27e8(inv f) \u2299\u2097\u2098 (inv g), by simp [\u2190 actionHom_comp]\u27e9\n```\n\n-- snippet 43\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.End.actionOfMonoidalFunctorToEndofunctorMop (L98-L145)\ndef actionOfMonoidalFunctorToEndofunctorMop (F : C \u2964 (D \u2964 D)\u1d39\u1d52\u1d56) [F.Monoidal] :\n MonoidalLeftAction C D where\n actionObj c d := (F.obj c).unmop.obj d\nactionHomLeft f d := (F.map f).unmop.app d\n actionHomRight c _ _ f := (F.obj c).unmop.map f\n actionAssocIso c c' d := Functor.Monoidal.\u03bcIso F c c' |>.unmop.app d |>.symm\n actionUnitIso d := Functor.Monoidal.\u03b5Iso F |>.unmop.app d |>.symm\n actionAssocIso_hom_naturality {c\u2081 c\u2081' c\u2082 c\u2082' c\u2083 c\u2083'} f g h := by\n have e := congrArg (fun t \u21a6 t.unmop.app c\u2083) <|\n Functor.OplaxMonoidal.\u03b4_natural F f g\n dsimp at e\n simp [reassoc_of% e]\n whiskerRight_actionHomLeft {x y} c f d := by\n have e := congrArg (fun t \u21a6 t.unmop.app d) <|\n Functor.LaxMonoidal.\u03bc_natural_left F f c\n dsimp at e\n simp [e, \u2190 NatTrans.comp_app, \u2190 unmop_comp]\n whiskerLeft_actionHomLeft c {x y} f d := by\n have e := congrArg (fun t \u21a6 t.unmop.app d) <|\n Functor.LaxMonoidal.\u03bc_natural_right F c f\n dsimp at e\n simp [e, \u2190 NatTrans.comp_app, \u2190 unmop_comp]\n associator_actionHom c\u2081 c\u2082 c\u2083 d := by\n have e := congrArg (fun t \u21a6 t.unmop.app d) <|\n Functor.OplaxMonoidal.associativity F c\u2081 c\u2082 c\u2083\n dsimp at e\n simp only [Category.comp_id] at e\n simp [e]\n leftUnitor_actionHom c d := by\n have e := (F.map (\u03bb_ c).hom).unmop.app d \u226b=\n (congrArg (fun t \u21a6 t.unmop.app d) <|\n Functor.OplaxMonoidal.left_unitality F c)\n dsimp at e\n simp only [Category.comp_id, \u2190 NatTrans.comp_app_assoc, \u2190 unmop_comp,\n \u2190 F.map_comp_assoc, Iso.hom_inv_id, Functor.map_id, Category.id_comp] at e\n simp [e]\n rightUnitor_actionHom c d := by\n have e := (F.map (\u03c1_ c).hom).unmop.app d \u226b=\n (congrArg (fun t \u21a6 t.unmop.app d) <|\n Functor.OplaxMonoidal.right_unitality F c)\n dsimp at e\n simp only [Category.comp_id, \u2190 NatTrans.comp_app_assoc, \u2190 unmop_comp,\n \u2190 F.map_comp_assoc, Iso.hom_inv_id, Functor.map_id, Category.id_comp] at e\n simp [e]\n\n/-- If the (left) action of `C` on `D` comes from a monoidal functor\n`C \u2964 (D \u2964 D)\u1d39\u1d52\u1d56`, then `curriedActionMop C D` is naturally isomorphic to that\nfunctor. -/\n```\n\n-- snippet 44\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.selRightfAction (L485-L501)\ninstance selRightfAction [MonoidalCategory C] : MonoidalRightAction C C where\n actionObj x y := x \u2297 y\nactionHom f g := f \u2297\u2098 g\n actionUnitIso x := \u03c1_ x\n actionAssocIso x y z := \u03b1_ x y z |>.symm\n actionHomLeft f x := f \u25b7 x\n actionHomRight x _ _ f := x \u25c1 f\n actionHom_def := by simp [tensorHom_def]\n\nnamespace MonoidalRightAction\n\nopen Category\n\nvariable {C D} [MonoidalCategory C] [MonoidalRightAction C D]\n\n-- Simp normal forms are aligned with the ones in `MonoidalCategory`.\n```\n\n-- snippet 45\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.rightActionOfMonoidalOppositeLeftAction (L261-L282)\ndef rightActionOfMonoidalOppositeLeftAction [MonoidalLeftAction C\u1d39\u1d52\u1d56 D] :\n MonoidalRightAction C D where\n actionObj d c := mop c \u2299\u2097 d\nactionHomLeft {d d'} f c := mop c \u22b4\u2097 f\n actionHomRight d _ _ f := f.mop \u22b5\u2097 d\n actionHom {c c'} {d d'} f g := g.mop \u2299\u2097\u2098 f\n actionAssocIso _ _ _ := \u03b1\u2097 _ _ _\n actionUnitIso _ := \u03bb\u2097 _\n actionHom_def _ _ := MonoidalLeftAction.actionHom_def' _ _\n actionAssocIso_hom_naturality _ _ _ :=\n MonoidalLeftAction.actionAssocIso_hom_naturality _ _ _\n actionUnitIso_hom_naturality _ :=\n MonoidalLeftAction.actionUnitIso_hom_naturality _\n actionHom_associator c\u2081 c\u2082 c\u2083 d := by\n simpa only [mop_tensorObj, mop_hom_associator,\n MonoidalLeftAction.inv_hom_actionHomLeft_assoc] using\n (\u03b1_ (mop c\u2083) (mop c\u2082) (mop c\u2081)).inv \u22b5\u2097 d \u226b=\n MonoidalLeftAction.associator_actionHom\n (mop c\u2083) (mop c\u2082) (mop c\u2081) d |>.symm\n\n/-- Define a right action of `C\u1d39\u1d52\u1d56` on `D` from a left action of `C` on `D` via\nthe formula `d \u2299\u1d63 mop c = c \u2299\u2097 d`. -/\n```\n\n-- snippet 46\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeRightAction_actionRight_mop (L316-L319)\nlemma monoidalOppositeRightAction_actionRight_mop\n (c : C) {d d' : D} (f : d \u27f6 d') :\n f \u22b5\u1d63 mop c = c \u22b4\u2097 f := rfl\n```\n\n-- snippet 47\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction (L164-L200)\ndef leftActionOfOppositeLeftAction [MonoidalLeftAction C\u1d52\u1d56 D\u1d52\u1d56] :\n MonoidalLeftAction C D where\n actionObj c d := unop <| op c \u2299\u2097 op d\nactionHomLeft {c c'} f d := (f.op \u22b5\u2097 op d).unop\n actionHomRight c {d d'} f := (op c \u22b4\u2097 f.op).unop\n actionHom {c c'} {d d} f g := (f.op \u2299\u2097\u2098 g.op).unop\n actionAssocIso _ _ _ := Iso.unop <| (\u03b1\u2097 _ _ _).symm\n actionUnitIso _ := Iso.unop <| (\u03bb\u2097 _).symm\n actionHom_def f g := by\n apply Quiver.Hom.op_inj\n simpa [MonoidalLeftAction.action_exchange] using\n MonoidalLeftAction.actionHom_def f.op g.op\n actionAssocIso_hom_naturality f g h := by\n apply Quiver.Hom.op_inj\n haveI := (\u03b1\u2097 (op _) (op _) (op _)).inv \u226b=\n MonoidalLeftAction.actionAssocIso_hom_naturality f.op g.op h.op\n simp only [Iso.inv_hom_id_assoc] at this\n simp [\u2190 this]\n actionUnitIso_hom_naturality _ := by\n apply Quiver.Hom.op_inj\n simp\n whiskerRight_actionHomLeft _ _ _ := by\n apply Quiver.Hom.op_inj\n simp\n associator_actionHom _ _ _ _ := by\n apply Quiver.Hom.op_inj\n apply IsIso.inv_eq_inv.mp\n simp\n leftUnitor_actionHom _ _ := by\n apply Quiver.Hom.op_inj\n apply IsIso.inv_eq_inv.mp\n simp\n rightUnitor_actionHom _ _ := by\n apply Quiver.Hom.op_inj\n apply IsIso.inv_eq_inv.mp\n simp\n```\n\n-- snippet 48\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHom_def' (L236-L239)\ntheorem actionHom_def' {x\u2081 y\u2081 : C} {x\u2082 y\u2082 : D} (f : x\u2081 \u27f6 y\u2081) (g : x\u2082 \u27f6 y\u2082) :\n f \u2299\u2097\u2098 g = x\u2081 \u22b4\u2097 g \u226b f \u22b5\u2097 y\u2082 :=\naction_exchange f g \u25b8 actionHom_def f g\n```\n\n-- snippet 49\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.inv_actionHomRight (L311-L314)\nlemma inv_actionHomRight (x : C) {y z : D} (f : y \u27f6 z) [IsIso f] :\n inv (x \u22b4\u2097 f) = x \u22b4\u2097 inv f :=\nIsIso.inv_eq_of_hom_inv_id <| actionHomRight_hom_inv' x f\n```\n\n-- snippet 50\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomRight_hom_inv (L253-L256)\ntheorem actionHomRight_hom_inv (x : C) {y z : D} (f : y \u2245 z) :\n x \u22b4\u2097 f.hom \u226b x \u22b4\u2097 f.inv = \ud835\udfd9 (x \u2299\u2097 y : D) := by\nrw [\u2190 actionHomRight_comp, Iso.hom_inv_id, actionHomRight_id]\n```\n\n-- snippet 51\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionUnitNatIso (L355-L356)\ndef actionUnitNatIso : actionLeft D (\ud835\udfd9_ C) \u2245 \ud835\udfed D := NatIso.ofComponents (\u03bb\u2097 \u00b7)\n```\n\n-- snippet 52\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction_actionAssocIso_unop (L246-L249)\nlemma leftActionOfOppositeLeftAction_actionAssocIso_unop\n (c c' : C\u1d52\u1d56) (d : D\u1d52\u1d56) :\n \u03b1\u2097 (unop c) (unop c') (unop d) = (\u03b1\u2097 c c' d).symm.unop := rfl\n```\n\n-- snippet 53\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeRightAction (L284-L303)\ndef monoidalOppositeRightAction [MonoidalLeftAction C D] :\n MonoidalRightAction C\u1d39\u1d52\u1d56 D where\n actionObj d c := unmop c \u2299\u2097 d\nactionHomLeft {d d'} f c := unmop c \u22b4\u2097 f\n actionHomRight d _ _ f := f.unmop \u22b5\u2097 d\n actionHom {c c'} {d d'} f g := g.unmop \u2299\u2097\u2098 f\n actionAssocIso _ _ _ := \u03b1\u2097 _ _ _\n actionUnitIso _ := \u03bb\u2097 _\n actionHom_def _ _ := MonoidalLeftAction.actionHom_def' _ _\n actionAssocIso_hom_naturality _ _ _ :=\n MonoidalLeftAction.actionAssocIso_hom_naturality _ _ _\n actionUnitIso_hom_naturality _ :=\n MonoidalLeftAction.actionUnitIso_hom_naturality _\n actionHom_associator c\u2081 c\u2082 c\u2083 d := by\n simpa only [mop_tensorObj, mop_hom_associator,\n MonoidalLeftAction.inv_hom_actionHomLeft_assoc] using\n (\u03b1_ (unmop c\u2083) (unmop c\u2082) (unmop c\u2081)).inv \u22b5\u2097 d \u226b=\n MonoidalLeftAction.associator_actionHom\n (unmop c\u2083) (unmop c\u2082) (unmop c\u2081) d |>.symm\n```\n\n-- snippet 54\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomRight_comp (L203-L206)\ntheorem actionHomRight_comp (w : C) {x y z : D} (f : x \u27f6 y) (g : y \u27f6 z) :\n w \u22b4\u2097 (f \u226b g) = w \u22b4\u2097 f \u226b w \u22b4\u2097 g := by\nsimp [\u2190 id_actionHom, \u2190 actionHom_comp]\n```\n\n-- snippet 55\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03b4\u2097_unitality_hom (L145-L173)\nlemma \u03b4\u2097_unitality_hom (d : D) :\n \u03b4\u2097 F (\ud835\udfd9_ C) d \u226b (\u03bb\u2097 (F.obj d)).hom = F.map (\u03bb\u2097 d).hom := by\nsimpa [-\u03b4\u2097_unitality_inv] using\n F.map (\u03bb\u2097[C] d).hom \u226b=\n (\u03b4\u2097_unitality_inv F d).symm =\u226b\n (\u03bb\u2097[C] (F.obj d)).hom\n\nend OplaxLeftLinear\n\n/-- `F.LeftLinear C` asserts that `F` is both lax and oplax left-linear,\nin a compatible way, i.e that `\u03bc\u2097` is inverse to `\u03b4\u2097`. -/\nclass LeftLinear\n (F : D \u2964 D') (C : Type*) [Category* C] [MonoidalCategory C]\n [MonoidalLeftAction C D] [MonoidalLeftAction C D'] extends\n F.LaxLeftLinear C, F.OplaxLeftLinear C where\n \u03bc\u2097_comp_\u03b4\u2097 (F) (c : C) (d : D) :\n LaxLeftLinear.\u03bc\u2097 F c d \u226b OplaxLeftLinear.\u03b4\u2097 F c d = \ud835\udfd9 _\n \u03b4\u2097_comp_\u03bc\u2097 (F) (c : C) (d : D) :\n OplaxLeftLinear.\u03b4\u2097 F c d \u226b LaxLeftLinear.\u03bc\u2097 F c d = \ud835\udfd9 _\n\nnamespace LeftLinear\n\nopen LaxLeftLinear OplaxLeftLinear\n\nvariable\n (F : D \u2964 D') {C : Type*} [Category* C] [MonoidalCategory C]\n [MonoidalLeftAction C D] [MonoidalLeftAction C D']\n [F.LeftLinear C]\n```\n\n-- snippet 56\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.hom_inv_actionHomLeft' (L278-L281)\ntheorem hom_inv_actionHomLeft' {x y : C} (f : x \u27f6 y) [IsIso f] (z : D) :\n f \u22b5\u2097 z \u226b inv f \u22b5\u2097 z = \ud835\udfd9 (x \u2299\u2097 z) := by\nrw [\u2190 comp_actionHomLeft, IsIso.hom_inv_id, id_actionHomLeft]\n```\n\n-- snippet 57\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionHom_op (L217-L220)\nlemma oppositeLeftAction_actionHom_op\n {c c' : C} {d d' : D} (f : c \u27f6 c') (g : d \u27f6 d') :\n f.op \u2299\u2097\u2098 g.op = op (f \u2299\u2097\u2098 g) := rfl\n```\n\n-- snippet 58\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionActionOfMonoidalFunctorToEndofunctorIso (L203-L216)\ndef curriedActionActionOfMonoidalFunctorToEndofunctorIso\n (F : C \u2964 (D \u2964 D)) [F.Monoidal] :\n letI := actionOfMonoidalFunctorToEndofunctor F\ncurriedAction C D \u2245 F :=\n .refl _\n\nend MonoidalRightAction\n\nnamespace endofunctorMonoidalCategory\n/-- Functor evaluation gives a right action of `C \u2964 C`.\n\nNote that in the literature, this is defined as a left action, but mathlib's\nmonoidal structure on `C \u2964 C` is the monoidal opposite of the one usually\nconsidered in the literature. -/\n```\n\n-- snippet 59\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction_actionRight_unop (L238-L241)\nlemma leftActionOfOppositeLeftAction_actionRight_unop\n (c : C\u1d52\u1d56) {d d' : D\u1d52\u1d56} (f : d \u27f6 d') :\n unop c \u22b4\u2097 f.unop = unop (c \u22b4\u2097 f) := rfl\n```\n\n-- snippet 60\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction_actionHom_mop_mop (L108-L111)\nlemma monoidalOppositeLeftAction_actionHom_mop_mop\n {c c' : C} {d d' : D} (f : c \u27f6 c') (g : d \u27f6 d') :\n f.mop \u2299\u2097\u2098 g = g \u2299\u1d63\u2098 f := rfl\n```\n\n-- snippet 61\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03bc\u2097_associativity_inv (L79-L86)\nlemma \u03bc\u2097_associativity_inv (c c' : C) (d : D) :\n c \u22b4\u2097 \u03bc\u2097 F c' d \u226b \u03bc\u2097 F c (c' \u2299\u2097 d) \u226b F.map (\u03b1\u2097 _ _ _).inv =\n (\u03b1\u2097 c c' (F.obj d)).inv \u226b \u03bc\u2097 F (c \u2297 c') d := by\nsimpa [-\u03bc\u2097_associativity, -\u03bc\u2097_associativity_assoc] using\n (\u03b1\u2097 _ _ _).inv \u226b=\n (\u03bc\u2097_associativity F c c' d).symm =\u226b\n F.map (\u03b1\u2097 _ _ _).inv\n```\n\n-- snippet 62\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.tensor_actionHomRight (L214-L219)\ntheorem tensor_actionHomRight (x y : C) {z z' : D} (f : z \u27f6 z') :\n (x \u2297 y) \u22b4\u2097 f = (\u03b1\u2097 x y z).hom \u226b x \u22b4\u2097 y \u22b4\u2097 f \u226b (\u03b1\u2097 x y z').inv := by\nsimp only [\u2190 id_actionHom]\n rw [\u2190 Category.assoc, \u2190 actionAssocIso_hom_naturality]\n simp\n```\n\n-- snippet 63\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionAssocIso_op (L221-L223)\nlemma oppositeLeftAction_actionAssocIso_op (c c' : C) (d : D) :\n \u03b1\u2097 (op c) (op c') (op d) = (\u03b1\u2097 c c' d).symm.op := rfl\n```\n\n-- snippet 64\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction_actionObj_unop (L231-L233)\nlemma leftActionOfOppositeLeftAction_actionObj_unop (c : C\u1d52\u1d56) (d : D\u1d52\u1d56) :\n (unop c) \u2299\u2097 (unop d) = unop (c \u2299\u2097 d) := rfl\n```\n\n-- snippet 65\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.isIso_actionHomLeft (L296-L299)\ninstance isIso_actionHomLeft {x y : C} (f : x \u27f6 y) [IsIso f] (z : D) :\n IsIso (f \u22b5\u2097 z) :=\n\u27e8inv f \u22b5\u2097 z, by simp\u27e9\n```\n\n-- snippet 66\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeRightAction_actionHomRight_mop (L312-L315)\nlemma monoidalOppositeRightAction_actionHomRight_mop\n {c c' : C} (f : c \u27f6 c') (d : D) :\n d \u22b4\u1d63 f.mop = f \u22b5\u2097 d := rfl\n```\n\n-- snippet 67\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionActionOfMonoidalFunctorToEndofunctorMopIso (L147-L161)\ndef curriedActionActionOfMonoidalFunctorToEndofunctorMopIso\n (F : C \u2964 (D \u2964 D)\u1d39\u1d52\u1d56) [F.Monoidal] :\n letI := actionOfMonoidalFunctorToEndofunctorMop F\ncurriedActionMop C D \u2245 F :=\n .refl _\n\nend MonoidalLeftAction\n\nnamespace MonoidalRightAction\n\nvariable {C D}\n\nopen MonoidalOpposite in\n/-- When `C` acts on the right on `D`, the functor `curriedAction : C \u2964 (D \u2964 D)`\nis monoidal, where `D \u2964 D` has the composition monoidal structure. -/\n```\n\n-- snippet 68\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.inv_actionHomLeft (L306-L309)\nlemma inv_actionHomLeft {x y : C} (f : x \u27f6 y) [IsIso f] (z : D) :\n inv (f \u22b5\u2097 z) = inv f \u22b5\u2097 z :=\nIsIso.inv_eq_of_hom_inv_id <| hom_inv_actionHomLeft' f z\n```\n\n-- snippet 69\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.action_exchange (L231-L234)\ntheorem action_exchange {w x : C} {y z : D} (f : w \u27f6 x) (g : y \u27f6 z) :\n w \u22b4\u2097 g \u226b f \u22b5\u2097 z = f \u22b5\u2097 y \u226b x \u22b4\u2097 g := by\nsimp only [\u2190 id_actionHom, \u2190 actionHom_id, \u2190 actionHom_comp, id_comp, comp_id]\n```\n\n-- snippet 70\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.inv_\u03b4\u2097 (L194-L229)\nlemma inv_\u03b4\u2097 :\n CategoryTheory.inv (\u03b4\u2097 F c d) = \u03bc\u2097 F c d :=\nEq.symm <| IsIso.eq_inv_of_hom_inv_id <| \u03b4\u2097_comp_\u03bc\u2097 F c d\n\nend LeftLinear\n\nend leftAction\n\nsection rightAction\n\nopen MonoidalRightAction\n\n/-- `F.LaxLinear C` equips `F : D \u2964 D'` with a family of morphisms\n`\u03bc\u2097 F : \u2200 (c : C) (d : D), c \u2299\u2097 F.obj d \u27f6 F.obj (c \u2299\u2097 d)`\nthat is natural in each variable and coherent with respect to left actions\nof `C` on `D` and `D'`. -/\nclass LaxRightLinear\n (F : D \u2964 D') (C : Type*) [Category* C] [MonoidalCategory C]\n [MonoidalRightAction C D] [MonoidalRightAction C D'] where\n /-- The \"\u03bc\u1d63\" morphism. -/\n \u03bc\u1d63 (F) (d : D) (c : C) : F.obj d \u2299\u1d63 c \u27f6 F.obj (d \u2299\u1d63 c)\n \u03bc\u1d63_naturality_right (F) (d : D) {c c' : C} (f : c \u27f6 c') :\n F.obj d \u22b4\u1d63 f \u226b \u03bc\u1d63 d c' = \u03bc\u1d63 d c \u226b F.map (d \u22b4\u1d63 f) := by cat_disch\n \u03bc\u1d63_naturality_left (F) {d d' : D} (f : d \u27f6 d') (c : C) :\n F.map f \u22b5\u1d63 c \u226b \u03bc\u1d63 d' c = \u03bc\u1d63 d c \u226b F.map (f \u22b5\u1d63 c) := by cat_disch\n \u03bc\u1d63_associativity (F) (d : D) (c c' : C) :\n \u03bc\u1d63 d (c \u2297 c') \u226b F.map (\u03b1\u1d63 _ _ _).hom =\n (\u03b1\u1d63 (F.obj d) c c').hom \u226b (\u03bc\u1d63 d c) \u22b5\u1d63 c' \u226b\n \u03bc\u1d63 (d \u2299\u1d63 c) c' := by cat_disch\n \u03bc\u1d63_unitality (F) (d : D) :\n (\u03c1\u1d63 (F.obj d)).hom = \u03bc\u1d63 d (\ud835\udfd9_ C) \u226b F.map (\u03c1\u1d63 d).hom := by cat_disch\n\nnamespace LaxRightLinear\n\n-- These are [reassoc (attr := simp)] on the basis that analog lemmas for\n-- lax monoidal functors are also [reassoc (attr := simp)].\n```\n\n-- snippet 71\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionMop_map_unmop_app (L58-L66)\nlemma curriedActionMop_map_unmop_app {c c' : C} (f : c \u27f6 c') (d : D) :\n ((curriedActionMop C D).map f).unmop.app d = f \u22b5\u2097 d :=\nrfl\n\nset_option backward.isDefEq.respectTransparency false in\nopen MonoidalOpposite in\n/-- When `C` acts on the left on `D`, the functor\n`curriedActionMop : C \u2964 (D \u2964 D)\u1d39\u1d52\u1d56` is monoidal, where `D \u2964 D` has the\ncomposition monoidal structure. -/\n```\n\n-- snippet 72\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.comp_actionHomLeft (L221-L224)\ntheorem comp_actionHomLeft {w x y : C} (f : w \u27f6 x) (g : x \u27f6 y) (z : D) :\n (f \u226b g) \u22b5\u2097 z = f \u22b5\u2097 z \u226b g \u22b5\u2097 z := by\nsimp only [\u2190 actionHom_id, \u2190 actionHom_comp, Category.id_comp]\n```\n\n-- snippet 73\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.curriedAction (L326-L335)\ndef curriedAction : C \u2964 D \u2964 D where\n obj x :=\n{ obj y := x \u2299\u2097 y\n map f := x \u22b4\u2097 f }\n map f :=\n { app y := f \u22b5\u2097 y\n naturality _ _ _ := by simp [action_exchange] }\n\nvariable {C} in\n/-- Bundle `d \u21a6 c \u2299\u2097 d` as a functor. -/\n```\n\n-- snippet 74\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionMopMonoidal (L68-L89)\ninstance curriedActionMopMonoidal : (curriedActionMop C D).Monoidal where\n \u03b5 := .mop <| (actionUnitNatIso C D).inv\n\u03bc _ _ := .mop <| { app _ := \u03b1\u2097 _ _ _ |>.inv }\n \u03b4 _ _ := .mop <| { app _ := \u03b1\u2097 _ _ _ |>.hom }\n \u03b7 := .mop <| (actionUnitNatIso C D).hom\n associativity c\u2081 c\u2082 c\u2083 := by\n apply (mopEquiv (D \u2964 D)).fullyFaithfulInverse.map_injective\n ext d\n simpa [-associator_actionHom] using\n (IsIso.inv_eq_inv.mpr <| associator_actionHom c\u2081 c\u2082 c\u2083 d).symm =\u226b\n (\u03b1_ c\u2081 c\u2082 c\u2083).hom \u22b5\u2097 d\n oplax_right_unitality x := by\n apply MonoidalOpposite.hom_ext\n ext t\n simpa [-rightUnitor_actionHom] using\n (\u03c1_ x).inv \u22b5\u2097 t \u226b= rightUnitor_actionHom x t\n oplax_left_unitality x := by\n apply MonoidalOpposite.hom_ext\n ext t\n simpa [-leftUnitor_actionHom] using\n (\u03bb_ x).inv \u22b5\u2097 t \u226b= leftUnitor_actionHom x t\n```\n\n-- snippet 75\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.inv_\u03b4\u1d63 (L356-L364)\nlemma inv_\u03b4\u1d63 :\n CategoryTheory.inv (\u03b4\u1d63 F d c) = \u03bc\u1d63 F d c :=\nEq.symm <| IsIso.eq_inv_of_hom_inv_id <| \u03b4\u1d63_comp_\u03bc\u1d63 F d c\n\nend RightLinear\n\nend rightAction\n\nend CategoryTheory.Functor\n```\n\n-- snippet 76\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfMonoidalOppositeRightAction (L45-L68)\ndef leftActionOfMonoidalOppositeRightAction [MonoidalRightAction C\u1d39\u1d52\u1d56 D] :\n MonoidalLeftAction C D where\n actionObj c d := d \u2299\u1d63 mop c\nactionHomLeft {c c'} f d := d \u22b4\u1d63 f.mop\n actionHomRight c {d d'} f := f \u22b5\u1d63 mop c\n actionHom {c c'} {d d} f g := g \u2299\u1d63\u2098 f.mop\n actionAssocIso _ _ _ := \u03b1\u1d63 _ _ _\n actionUnitIso _ := \u03c1\u1d63 _\n actionHom_def _ _ := MonoidalRightAction.actionHom_def' _ _\n actionAssocIso_hom_naturality _ _ _ :=\n MonoidalRightAction.actionAssocIso_hom_naturality _ _ _\n actionUnitIso_hom_naturality _ :=\n MonoidalRightAction.actionUnitIso_hom_naturality _\n rightUnitor_actionHom c d :=\n MonoidalRightAction.actionHom_leftUnitor _ _\n associator_actionHom c\u2081 c\u2082 c\u2083 d := by\n simpa only [mop_tensorObj, mop_hom_associator,\n MonoidalRightAction.actionHomRight_inv_hom_assoc] using\n (d \u22b4\u1d63 (\u03b1_ (mop c\u2083) (mop c\u2082) (mop c\u2081)).inv) \u226b=\n MonoidalRightAction.actionHom_associator\n (mop c\u2083) (mop c\u2082) (mop c\u2081) d |>.symm\n\n/-- Define a left action of `C\u1d39\u1d52\u1d56` on `D` from a right action of `C` on `D` via\nthe formula `mop c \u2299\u2097 d = d \u2299\u1d63 c`. -/\n```\n\n-- snippet 77\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.isIso_actionHomRight (L292-L295)\ninstance isIso_actionHomRight (x : C) {y z : D} (f : y \u27f6 z) [IsIso f] :\n IsIso (x \u22b4\u2097 f) :=\n\u27e8x \u22b4\u2097 inv f, by simp\u27e9\n```\n\n-- snippet 78\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction_actionAssocIso_mop_mop (L112-L114)\nlemma monoidalOppositeLeftAction_actionAssocIso_mop_mop (c c' : C) (d : D) :\n \u03b1\u2097 (mop c) (mop c') d = \u03b1\u1d63 d c' c := rfl\n```\n\n-- snippet 79\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.inv_actionHom (L316-L320)\nlemma inv_actionHom {x y : C} {x' y' : D}\n (f : x \u27f6 y) (g : x' \u27f6 y') [IsIso f] [IsIso g] :\n inv (f \u2299\u2097\u2098 g) = (inv f) \u2299\u2097\u2098 (inv g) :=\nIsIso.inv_eq_of_hom_inv_id <| by simp [\u2190 actionHom_comp]\n```\n\n-- snippet 80\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionRight_op (L213-L216)\nlemma oppositeLeftAction_actionRight_op\n (c : C) {d d' : D} (f : d \u27f6 d') :\n op c \u22b4\u2097 f.op = op (c \u22b4\u2097 f) := rfl\n```\n\n-- snippet 81\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionUnitIso_inv_naturality (L248-L251)\ntheorem actionUnitIso_inv_naturality {d d' : D} (f : d \u27f6 d') :\n (\u03bb\u2097 d).inv \u226b (\ud835\udfd9_ C) \u22b4\u2097 f = f \u226b (\u03bb\u2097 d').inv := by\nrw [Iso.inv_comp_eq, \u2190 Category.assoc, Eq.comm, Iso.comp_inv_eq, actionUnitIso_hom_naturality]\n```\n\n-- snippet 82\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHom_id (L198-L201)\nlemma actionHom_id {c c' : C} (f : c \u27f6 c') (d : D) :\n f \u2299\u2097\u2098 (\ud835\udfd9 d) = f \u22b5\u2097 d := by\nsimp [actionHom_def]\n```\n\n-- snippet 83\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionMop (L50-L56)\ndef curriedActionMop : C \u2964 (D \u2964 D)\u1d39\u1d52\u1d56 :=\n(curriedAction C D) \u22d9 mopFunctor _\n\n-- This simp lemma is necessary because the simps projection generated for\n-- unmop of a morphism is actually its underlying unmop field, rather than\n-- the application of `Quiver.Hom.unmop`.\nvariable {C D} in\n```\n\n-- snippet 84\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionAssocNatIso (L346-L353)\ndef actionAssocNatIso :\n bifunctorComp\u2081\u2082 (curriedTensor C) (curriedAction C D) \u2245\n bifunctorComp\u2082\u2083 (curriedAction C D) (curriedAction C D) :=\nNatIso.ofComponents fun _ \u21a6\n NatIso.ofComponents fun _ \u21a6\n NatIso.ofComponents fun _ \u21a6 \u03b1\u2097 _ _ _\n\n/-- Bundle `\u03bb\u2097 _` as an isomorphism of functors. -/\n```\n\n-- snippet 85\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.selfLeftAction (L175-L191)\ninstance selfLeftAction [MonoidalCategory C] : MonoidalLeftAction C C where\n actionObj x y := x \u2297 y\nactionHom f g := f \u2297\u2098 g\n actionUnitIso x := \u03bb_ x\n actionAssocIso x y z := \u03b1_ x y z\n actionHomLeft f x := f \u25b7 x\n actionHomRight x _ _ f := x \u25c1 f\n actionHom_def := by simp [tensorHom_def]\n\nnamespace MonoidalLeftAction\n\nopen Category\n\nvariable {C D} [MonoidalCategory C] [MonoidalLeftAction C D]\n\n-- Simp normal forms are aligned with the ones in `MonoidalCategory`.\n```\n\n-- snippet 86\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction (L122-L162)\ndef oppositeLeftAction [MonoidalLeftAction C D] :\n MonoidalLeftAction C\u1d52\u1d56 D\u1d52\u1d56 where\n actionObj c d := op <| c.unop \u2299\u2097 d.unop\nactionHomLeft f d := (f.unop \u22b5\u2097 unop d).op\n actionHomRight c _ _ f := (unop c \u22b4\u2097 f.unop).op\n actionHom f g := (f.unop \u2299\u2097\u2098 g.unop).op\n actionAssocIso _ _ _ := Iso.op <| (\u03b1\u2097 _ _ _).symm\n actionUnitIso _ := Iso.op <| (\u03bb\u2097 _).symm\n actionHom_def\n | op f, op g => by\n apply Quiver.Hom.unop_inj\n simpa [MonoidalLeftAction.action_exchange] using\n MonoidalLeftAction.actionHom_def f g\n actionAssocIso_hom_naturality\n | op f, op g, op h => by\n apply Quiver.Hom.unop_inj\n haveI := (\u03b1\u2097 (unop _) (unop _) (unop _)).inv \u226b=\n MonoidalLeftAction.actionAssocIso_hom_naturality f g h\n simp only [Iso.inv_hom_id_assoc] at this\n simp [\u2190 this]\n actionUnitIso_hom_naturality _ := by\n apply Quiver.Hom.unop_inj\n simp\n whiskerRight_actionHomLeft _ _ _ := by\n apply Quiver.Hom.unop_inj\n simp\n associator_actionHom _ _ _ _ := by\n apply Quiver.Hom.unop_inj\n apply IsIso.inv_eq_inv.mp\n simp\n leftUnitor_actionHom _ _ := by\n apply Quiver.Hom.unop_inj\n apply IsIso.inv_eq_inv.mp\n simp\n rightUnitor_actionHom _ _ := by\n apply Quiver.Hom.unop_inj\n apply IsIso.inv_eq_inv.mp\n simp\n\n/-- Define a left action of `C` on `D` from a left action of `C\u1d52\u1d56` on `D\u1d52\u1d56` via\nthe formula `c \u2299\u2097 d = unop ((op c) \u2299\u2097 (op d))`. -/\n```\n\n-- snippet 87\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.inv_hom_actionHomLeft' (L288-L291)\ntheorem inv_hom_actionHomLeft' {x y : C} (f : x \u27f6 y) [IsIso f] (z : D) :\n inv f \u22b5\u2097 z \u226b f \u22b5\u2097 z = \ud835\udfd9 (y \u2299\u2097 z) := by\nrw [\u2190 comp_actionHomLeft, IsIso.inv_hom_id, id_actionHomLeft]\n```\n\n-- snippet 88\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.oppositeLeftAction_actionObj_op (L206-L208)\nlemma oppositeLeftAction_actionObj_op (c : C) (d : D) :\n (op c) \u2299\u2097 (op d) = op (c \u2299\u2097 d) := rfl\n```\n\n-- snippet 89\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.inv_hom_actionHomLeft (L268-L271)\ntheorem inv_hom_actionHomLeft {x y : C} (f : x \u2245 y) (z : D) :\n f.inv \u22b5\u2097 z \u226b f.hom \u22b5\u2097 z = \ud835\udfd9 (y \u2299\u2097 z) := by\nrw [\u2190 comp_actionHomLeft, Iso.inv_hom_id, id_actionHomLeft]\n```\n\n-- snippet 90\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03bc\u1d63_unitality_inv (L250-L285)\nlemma \u03bc\u1d63_unitality_inv (d : D) :\n (\u03c1\u1d63 (F.obj d)).inv \u226b \u03bc\u1d63 F d (\ud835\udfd9_ C) = F.map (\u03c1\u1d63 d).inv := by\nsimpa [-\u03bc\u1d63_unitality] using\n (\u03c1\u1d63[C] (F.obj d)).inv \u226b=\n (\u03bc\u1d63_unitality F d).symm =\u226b\n F.map (\u03c1\u1d63[C] d).inv\n\nend LaxRightLinear\n\n/-- `F.OplaxLinear C` equips `F : D \u2964 D'` with a family of morphisms\n`\u03b4\u2097 F : \u2200 (c : C) (d : D), c \u2299\u2097 F.obj d \u27f6 F.obj (c \u2299\u2097 d)`\nthat is natural in each variable and coherent with respect to left actions\nof `C` on `D` and `D'`. -/\nclass OplaxRightLinear\n (F : D \u2964 D') (C : Type*) [Category* C] [MonoidalCategory C]\n [MonoidalRightAction C D] [MonoidalRightAction C D'] where\n /-- The oplax lineator morphism. -/\n \u03b4\u1d63 (F) (d : D) (c : C) : F.obj (d \u2299\u1d63 c) \u27f6 (F.obj d) \u2299\u1d63 c\n \u03b4\u1d63_naturality_right (F) (d : D) {c c' : C} (f : c \u27f6 c') :\n F.map (d \u22b4\u1d63 f) \u226b \u03b4\u1d63 d c' =\n \u03b4\u1d63 d c \u226b F.obj d \u22b4\u1d63 f := by cat_disch\n \u03b4\u1d63_naturality_left (F) {d d' : D} (f : d \u27f6 d') (c : C) :\n F.map (f \u22b5\u1d63 c) \u226b \u03b4\u1d63 d' c =\n \u03b4\u1d63 d c \u226b F.map f \u22b5\u1d63 c := by cat_disch\n \u03b4\u1d63_associativity (F) (d : D) (c c' : C) :\n \u03b4\u1d63 d (c \u2297 c') \u226b (\u03b1\u1d63 _ _ _).hom =\n F.map (\u03b1\u1d63 _ _ _).hom \u226b \u03b4\u1d63 (d \u2299\u1d63 c) c' \u226b\n \u03b4\u1d63 d c \u22b5\u1d63 c' := by cat_disch\n \u03b4\u1d63_unitality_inv (F) (d : D) :\n (\u03c1\u1d63 (F.obj d)).inv =\n F.map (\u03c1\u1d63 d).inv \u226b \u03b4\u1d63 d (\ud835\udfd9_ C) := by cat_disch\n\nnamespace OplaxRightLinear\n\n-- These are [reassoc (attr := simp)] on the basis that analog lemmas for\n-- oplax monoidal functors are also [reassoc (attr := simp)].\n```\n\n-- snippet 91\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.End.curriedActionMonoidal (L163-L185)\ninstance curriedActionMonoidal [MonoidalRightAction C D] :\n (curriedAction C D).Monoidal where\n \u03b5 := (actionUnitNatIso C D).inv\n\u03bc _ _ := { app _ := \u03b1\u1d63 _ _ _ |>.inv }\n \u03b4 _ _ := { app _ := \u03b1\u1d63 _ _ _ |>.hom }\n \u03b7 := (actionUnitNatIso C D).hom\n associativity c\u2081 c\u2082 c\u2083 := by\n ext d\n simpa [-actionHom_associator] using\n (IsIso.inv_eq_inv.mpr <| actionHom_associator c\u2081 c\u2082 c\u2083 d).symm =\u226b\n d \u22b4\u1d63 (\u03b1_ c\u2081 c\u2082 c\u2083).hom\n oplax_right_unitality x := by\n ext t\n simpa [-actionHom_rightUnitor] using\n t \u22b4\u1d63 (\u03c1_ x).inv \u226b= actionHom_rightUnitor x t\n oplax_left_unitality x := by\n ext t\n simpa [-actionHom_leftUnitor] using\n t \u22b4\u1d63 (\u03bb_ x).inv \u226b= actionHom_leftUnitor x t\n\nset_option backward.isDefEq.respectTransparency false in\n/-- A monoidal functor `F : C \u2964 D \u2964 D` can be thought of as a right action\nof `C` on `D`. -/\n```\n\n-- snippet 92\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.action_actionHomRight (L536-L539)\ntheorem action_actionHomRight (y : D) (z : C) {x x' : C} (f : x \u27f6 x') :\n (y \u2299\u1d63 z) \u22b4\u1d63 f = (\u03b1\u1d63 y z x).inv \u226b y \u22b4\u1d63 (z \u25c1 f) \u226b (\u03b1\u1d63 y z x').hom := by\nsimp [whiskerRight_actionHomLeft]\n```\n\n-- snippet 93\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction_actionHom_unop (L242-L245)\nlemma leftActionOfOppositeLeftAction_actionHom_unop\n {c c' : C\u1d52\u1d56} {d d' : D\u1d52\u1d56} (f : c \u27f6 c') (g : d \u27f6 d') :\n f.unop \u2299\u2097\u2098 g.unop = unop (f \u2299\u2097\u2098 g) := rfl\n```\n\n-- snippet 94\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03bc\u2097_unitality_inv (L88-L123)\nlemma \u03bc\u2097_unitality_inv (d : D) :\n (\u03bb\u2097 (F.obj d)).inv \u226b \u03bc\u2097 F (\ud835\udfd9_ C) d = F.map (\u03bb\u2097 d).inv := by\nsimpa [-\u03bc\u2097_unitality] using\n (\u03bb\u2097[C] (F.obj d)).inv \u226b=\n (\u03bc\u2097_unitality F d).symm =\u226b\n F.map (\u03bb\u2097[C] d).inv\n\nend LaxLeftLinear\n\n/-- `F.OplaxLinear C` equips `F : D \u2964 D'` with a family of morphisms\n`\u03b4\u2097 F : \u2200 (c : C) (d : D), c \u2299\u2097 F.obj d \u27f6 F.obj (c \u2299\u2097 d)`\nthat is natural in each variable and coherent with respect to left actions\nof `C` on `D` and `D'`. -/\nclass OplaxLeftLinear\n (F : D \u2964 D') (C : Type*) [Category* C] [MonoidalCategory C]\n [MonoidalLeftAction C D] [MonoidalLeftAction C D'] where\n /-- The oplax lineator morphism. -/\n \u03b4\u2097 (F) (c : C) (d : D) : F.obj (c \u2299\u2097 d) \u27f6 c \u2299\u2097 F.obj d\n \u03b4\u2097_naturality_left (F) {c c' : C} (f : c \u27f6 c') (d : D) :\n F.map (f \u22b5\u2097 d) \u226b \u03b4\u2097 c' d =\n \u03b4\u2097 c d \u226b f \u22b5\u2097 F.obj d := by cat_disch\n \u03b4\u2097_naturality_right (F) (c : C) {d d' : D} (f : d \u27f6 d') :\n F.map (c \u22b4\u2097 f) \u226b \u03b4\u2097 c d' =\n \u03b4\u2097 c d \u226b c \u22b4\u2097 F.map f := by cat_disch\n \u03b4\u2097_associativity (F) (c c' : C) (d : D) :\n \u03b4\u2097 (c \u2297 c') d \u226b (\u03b1\u2097 _ _ _).hom =\n F.map (\u03b1\u2097 _ _ _).hom \u226b \u03b4\u2097 c (c' \u2299\u2097 d) \u226b\n c \u22b4\u2097 \u03b4\u2097 c' d := by cat_disch\n \u03b4\u2097_unitality_inv (F) (d : D) :\n (\u03bb\u2097 (F.obj d)).inv =\n F.map (\u03bb\u2097 d).inv \u226b \u03b4\u2097 (\ud835\udfd9_ C) d := by cat_disch\n\nnamespace OplaxLeftLinear\n\n-- These are [reassoc (attr := simp)] on the basis that analog lemmas for\n-- oplax monoidal functors are also [reassoc (attr := simp)].\n```\n\n-- snippet 95\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.\u03bc\u1d63Iso (L340-L345)\nabbrev \u03bc\u1d63Iso (d : D) (c : C) : F.obj d \u2299\u1d63 c \u2245 F.obj (d \u2299\u1d63 c) where\n hom := LaxRightLinear.\u03bc\u1d63 F d c\ninv := OplaxRightLinear.\u03b4\u1d63 F d c\n\nvariable (c : C) (d : D)\n```\n\n-- snippet 96\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.leftActionOfOppositeLeftAction_actionHomLeft_unop (L234-L237)\nlemma leftActionOfOppositeLeftAction_actionHomLeft_unop\n {c c' : C\u1d52\u1d56} (f : c \u27f6 c') (d : D\u1d52\u1d56) :\n f.unop \u22b5\u2097 unop d = unop (f \u22b5\u2097 d) := rfl\n```\n\n-- snippet 97\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionAssocIso_inv_naturality (L241-L246)\ntheorem actionAssocIso_inv_naturality\n {c\u2081 c\u2082 c\u2083 c\u2084 : C} {d\u2081 d\u2082 : D} (f : c\u2081 \u27f6 c\u2082) (g : c\u2083 \u27f6 c\u2084) (h : d\u2081 \u27f6 d\u2082) :\n (f \u2299\u2097\u2098 g \u2299\u2097\u2098 h) \u226b (\u03b1\u2097 c\u2082 c\u2084 d\u2082).inv =\n (\u03b1\u2097 c\u2081 c\u2083 d\u2081).inv \u226b ((f \u2297\u2098 g) \u2299\u2097\u2098 h) := by\nrw [Iso.comp_inv_eq, Category.assoc, Eq.comm, Iso.inv_comp_eq, actionAssocIso_hom_naturality]\n```\n\n-- snippet 98\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.LinearFunctor.inv_\u03bc\u1d63 (L351-L354)\nlemma inv_\u03bc\u1d63 :\n CategoryTheory.inv (\u03bc\u1d63 F d c) = \u03b4\u1d63 F d c :=\nEq.symm <| IsIso.eq_inv_of_hom_inv_id <| \u03bc\u1d63_comp_\u03b4\u1d63 F d c\n```\n\n-- snippet 99\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction_actionObj_mop (L97-L99)\nlemma monoidalOppositeLeftAction_actionObj_mop (c : C) (d : D) :\n mop c \u2299\u2097 d = d \u2299\u1d63 c := rfl\n```\n\n-- snippet 100\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.unit_actionHomRight (L208-L212)\ntheorem unit_actionHomRight {x y : D} (f : x \u27f6 y) :\n (\ud835\udfd9_ C) \u22b4\u2097 f = (\u03bb\u2097 x).hom \u226b f \u226b (\u03bb\u2097 y).inv := by\nrw [\u2190 Category.assoc, actionUnitIso_hom_naturality]\n simp\n```\n\n-- snippet 101\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Opposites.monoidalOppositeLeftAction_actionRight_mop (L104-L107)\nlemma monoidalOppositeLeftAction_actionRight_mop\n (c : C) {d d' : D} (f : d \u27f6 d') :\n mop c \u22b4\u2097 f = f \u22b5\u1d63 c := rfl\n```\n\n-- snippet 102\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomRight_hom_inv' (L273-L276)\ntheorem actionHomRight_hom_inv' (x : C) {y z : D} (f : y \u27f6 z) [IsIso f] :\n x \u22b4\u2097 f \u226b x \u22b4\u2097 inv f = \ud835\udfd9 (x \u2299\u2097 y) := by\nrw [\u2190 actionHomRight_comp, IsIso.hom_inv_id, actionHomRight_id]\n```\n\n-- snippet 103\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.id_actionHom (L193-L196)\nlemma id_actionHom (c : C) {d d' : D} (f : d \u27f6 d') :\n (\ud835\udfd9 c) \u2299\u2097\u2098 f = c \u22b4\u2097 f := by\nsimp [actionHom_def]\n```\n\n-- snippet 104\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionRight (L342-L344)\nabbrev actionRight (d : D) : C \u2964 D := curriedAction C D |>.flip.obj d\n/-- Bundle `\u03b1\u2097 _ _ _` as an isomorphism of trifunctors. -/\n```\n\n-- snippet 105\n```lean\n-- Mathlib.CategoryTheory.Monoidal.Action.Basic.actionHomRight_inv_hom (L263-L266)\ntheorem actionHomRight_inv_hom (x : C) {y z : D} (f : y \u2245 z) :\n x \u22b4\u2097 f.inv \u226b x \u22b4\u2097 f.hom = \ud835\udfd9 (x \u2299\u2097 z) := by\nrw [\u2190 actionHomRight_comp, Iso.inv_hom_id, actionHomRight_id]\n```\n[/INST]", "sample_id": "C-Mathlib.CategoryTheory.Monoidal.Opposite.unmop_comp", "source": {"declaration": "Mathlib.CategoryTheory.Monoidal.Opposite.unmop_comp", "file": "Mathlib/CategoryTheory/Monoidal/Opposite.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.CategoryTheory.Monoidal.Opposite", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/CategoryTheory/Monoidal/Opposite.lean#L109", "span": "L109-L111"}} {"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 exists_prime_dvd_of_not_inf_one {a b : \u03b1} (ha : a \u2260 0) (hb : b \u2260 0)\n (h : Associates.mk a \u2293 Associates.mk b \u2260 1) : \u2203 p : \u03b1, Prime p \u2227 p \u2223 a \u2227 p \u2223 b", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 741, "declarations_count": 66, "diagnostics_count": 0, "duplicate_fingerprint": "05972b6db688cbce", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 732, "lean_code_chars": 159, "lean_code_ratio": 0.2146, "length_bucket": "short", "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.RingTheory.UniqueFactorizationDomain.FactorSet).", "role": "system"}, {"content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\nOpen namespaces: UniqueFactorizationMonoid, Associated, Multiset, Classical, in\n\n## Surrounding context in Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean\n```lean\n-- Mathlib.RingTheory.UniqueFactorizationDomain.FactorSet.FactorSet (L42-L44)\nabbrev FactorSet.{u} (\u03b1 : Type u) [CommMonoidWithZero \u03b1] : Type u\n\n-- Mathlib.RingTheory.UniqueFactorizationDomain.FactorSet.FactorSet (L47-L49)\ntheorem FactorSet.coe_add {a b : Multiset { a : Associates \u03b1 // Irreducible a }} :\n (\u2191(a + b) : FactorSet \u03b1) = a + b\n\n-- Mathlib.RingTheory.UniqueFactorizationDomain.FactorSet.FactorSet (L50-L61)\ntheorem FactorSet.sup_add_inf_eq_add [DecidableEq (Associates \u03b1)] :\n \u2200 a b : FactorSet \u03b1, a \u2294 b + a \u2293 b = a + b\n | \u22a4, b => show \u22a4 \u2294 b + \u22a4 \u2293 b = \u22a4 + b by simp\n | a, \u22a4 => show a \u2294 \u22a4 + a \u2293 \u22a4 = a + \u22a4 by simp\n | WithTop.some a, WithTop.some b =>\n show (a : FactorSet \u03b1) \u2294 b + (a : FactorSet \u03b1) \u2293 b = a + b by\n rw [\u2190 WithTop.coe_sup, \u2190 WithTop.coe_inf, \u2190 WithTop.coe_add, \u2190 WithTop.coe_add,\n WithTop.coe_eq_coe]\n exact Multiset.union_add_inter _ _\n\n/-- Evaluates the product of a `FactorSet` to be the product of the corresponding multiset,\n or `0` if there is none. -/\n```\n\nRelevant lemmas available in scope: `hz`, `Multiset.prod_zero`, `p0_irr`, `dvd_of_mk_le_mk`, `dvd_of_mem_factors'`, `ha`, `hb`\n\n```lean\ntheorem exists_prime_dvd_of_not_inf_one {a b : \u03b1} (ha : a \u2260 0) (hb : b \u2260 0)\n (h : Associates.mk a \u2293 Associates.mk b \u2260 1) : \u2203 p : \u03b1, Prime p \u2227 p \u2223 a \u2227 p \u2223 b\n```\n\nDeclaration: `Mathlib.RingTheory.UniqueFactorizationDomain.FactorSet.exists_prime_dvd_of_not_inf_one` (module Mathlib.RingTheory.UniqueFactorizationDomain.FactorSet).", "role": "user"}], "rendered_text": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.RingTheory.UniqueFactorizationDomain.FactorSet).\n\nExplain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\nOpen namespaces: UniqueFactorizationMonoid, Associated, Multiset, Classical, in\n\n## Surrounding context in Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean\n```lean\n-- Mathlib.RingTheory.UniqueFactorizationDomain.FactorSet.FactorSet (L42-L44)\nabbrev FactorSet.{u} (\u03b1 : Type u) [CommMonoidWithZero \u03b1] : Type u\n\n-- Mathlib.RingTheory.UniqueFactorizationDomain.FactorSet.FactorSet (L47-L49)\ntheorem FactorSet.coe_add {a b : Multiset { a : Associates \u03b1 // Irreducible a }} :\n (\u2191(a + b) : FactorSet \u03b1) = a + b\n\n-- Mathlib.RingTheory.UniqueFactorizationDomain.FactorSet.FactorSet (L50-L61)\ntheorem FactorSet.sup_add_inf_eq_add [DecidableEq (Associates \u03b1)] :\n \u2200 a b : FactorSet \u03b1, a \u2294 b + a \u2293 b = a + b\n | \u22a4, b => show \u22a4 \u2294 b + \u22a4 \u2293 b = \u22a4 + b by simp\n | a, \u22a4 => show a \u2294 \u22a4 + a \u2293 \u22a4 = a + \u22a4 by simp\n | WithTop.some a, WithTop.some b =>\n show (a : FactorSet \u03b1) \u2294 b + (a : FactorSet \u03b1) \u2293 b = a + b by\n rw [\u2190 WithTop.coe_sup, \u2190 WithTop.coe_inf, \u2190 WithTop.coe_add, \u2190 WithTop.coe_add,\n WithTop.coe_eq_coe]\n exact Multiset.union_add_inter _ _\n\n/-- Evaluates the product of a `FactorSet` to be the product of the corresponding multiset,\n or `0` if there is none. -/\n```\n\nRelevant lemmas available in scope: `hz`, `Multiset.prod_zero`, `p0_irr`, `dvd_of_mk_le_mk`, `dvd_of_mem_factors'`, `ha`, `hb`\n\n```lean\ntheorem exists_prime_dvd_of_not_inf_one {a b : \u03b1} (ha : a \u2260 0) (hb : b \u2260 0)\n (h : Associates.mk a \u2293 Associates.mk b \u2260 1) : \u2203 p : \u03b1, Prime p \u2227 p \u2223 a \u2227 p \u2223 b\n```\n\nDeclaration: `Mathlib.RingTheory.UniqueFactorizationDomain.FactorSet.exists_prime_dvd_of_not_inf_one` (module Mathlib.RingTheory.UniqueFactorizationDomain.FactorSet).", "sample_id": "F-Mathlib.RingTheory.UniqueFactorizationDomain.FactorSet.exists_prime_dvd_of_not_inf_one", "source": {"declaration": "Mathlib.RingTheory.UniqueFactorizationDomain.FactorSet.exists_prime_dvd_of_not_inf_one", "file": "Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.RingTheory.UniqueFactorizationDomain.FactorSet", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/RingTheory/UniqueFactorizationDomain/FactorSet.lean#L393", "span": "L393-L413"}} {"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 setIntegral_eq_tsum (h : IsFundamentalDomain G s \u03bc) {f : \u03b1 \u2192 E} {t : Set \u03b1}\n (hf : IntegrableOn f t \u03bc) : \u222b x in t, f x \u2202\u03bc = \u2211' g : G, \u222b x in t \u2229 g \u2022 s, f x \u2202\u03bc", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 713, "declarations_count": 74, "diagnostics_count": 0, "duplicate_fingerprint": "620175e768e550f2", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 688, "lean_code_chars": 170, "lean_code_ratio": 0.2384, "length_bucket": "short", "line_count": 8, "natural_language_chars": 543, "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.MeasureTheory.Group.FundamentalDomain).", "role": "system"}, {"content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\nOpen namespaces: scoped, ENNReal, Pointwise, Topology, NNReal, MeasureTheory, MeasureTheory.Measure, Set\n\n## Surrounding context in Mathlib/MeasureTheory/Group/FundamentalDomain.lean\n```lean\n-- Mathlib.MeasureTheory.Group.FundamentalDomain.mk' (L89-L98)\ntheorem mk' (h_meas : NullMeasurableSet s \u03bc) (h_exists : \u2200 x : \u03b1, \u2203! g : G, g \u2022 x \u2208 s) :\n IsFundamentalDomain G s \u03bc where\n nullMeasurableSet\n\n-- Mathlib.MeasureTheory.Group.FundamentalDomain.mk'' (L101-L112)\ntheorem mk'' (h_meas : NullMeasurableSet s \u03bc) (h_ae_covers : \u2200\u1d50 x \u2202\u03bc, \u2203 g : G, g \u2022 x \u2208 s)\n (h_ae_disjoint : \u2200 g, g \u2260 (1 : G) \u2192 AEDisjoint \u03bc (g \u2022 s) s)\n (h_qmp : \u2200 g : G, QuasiMeasurePreserving ((g \u2022 \u00b7) : \u03b1 \u2192 \u03b1) \u03bc \u03bc) :\n IsFundamentalDomain G s \u03bc where\n nullMeasurableSet\n\n-- Mathlib.MeasureTheory.Group.FundamentalDomain.mk_of_measure_univ_le (L118-L135)\ntheorem mk_of_measure_univ_le [IsFiniteMeasure \u03bc] [Countable G] (h_meas : NullMeasurableSet s \u03bc)\n (h_ae_disjoint : \u2200 g \u2260 (1 : G), AEDisjoint \u03bc (g \u2022 s) s)\n (h_qmp : \u2200 g : G, QuasiMeasurePreserving (g \u2022 \u00b7 : \u03b1 \u2192 \u03b1) \u03bc \u03bc)\n (h_measure_univ_le : \u03bc (univ : Set \u03b1) \u2264 \u2211' g : G, \u03bc (g \u2022 s)) : IsFundamentalDomain G s \u03bc\n```\n\n```lean\ntheorem setIntegral_eq_tsum (h : IsFundamentalDomain G s \u03bc) {f : \u03b1 \u2192 E} {t : Set \u03b1}\n (hf : IntegrableOn f t \u03bc) : \u222b x in t, f x \u2202\u03bc = \u2211' g : G, \u222b x in t \u2229 g \u2022 s, f x \u2202\u03bc\n```\n\nDeclaration: `Mathlib.MeasureTheory.Group.FundamentalDomain.setIntegral_eq_tsum` (module Mathlib.MeasureTheory.Group.FundamentalDomain).", "role": "user"}], "rendered_text": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.MeasureTheory.Group.FundamentalDomain).\n\nExplain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\nOpen namespaces: scoped, ENNReal, Pointwise, Topology, NNReal, MeasureTheory, MeasureTheory.Measure, Set\n\n## Surrounding context in Mathlib/MeasureTheory/Group/FundamentalDomain.lean\n```lean\n-- Mathlib.MeasureTheory.Group.FundamentalDomain.mk' (L89-L98)\ntheorem mk' (h_meas : NullMeasurableSet s \u03bc) (h_exists : \u2200 x : \u03b1, \u2203! g : G, g \u2022 x \u2208 s) :\n IsFundamentalDomain G s \u03bc where\n nullMeasurableSet\n\n-- Mathlib.MeasureTheory.Group.FundamentalDomain.mk'' (L101-L112)\ntheorem mk'' (h_meas : NullMeasurableSet s \u03bc) (h_ae_covers : \u2200\u1d50 x \u2202\u03bc, \u2203 g : G, g \u2022 x \u2208 s)\n (h_ae_disjoint : \u2200 g, g \u2260 (1 : G) \u2192 AEDisjoint \u03bc (g \u2022 s) s)\n (h_qmp : \u2200 g : G, QuasiMeasurePreserving ((g \u2022 \u00b7) : \u03b1 \u2192 \u03b1) \u03bc \u03bc) :\n IsFundamentalDomain G s \u03bc where\n nullMeasurableSet\n\n-- Mathlib.MeasureTheory.Group.FundamentalDomain.mk_of_measure_univ_le (L118-L135)\ntheorem mk_of_measure_univ_le [IsFiniteMeasure \u03bc] [Countable G] (h_meas : NullMeasurableSet s \u03bc)\n (h_ae_disjoint : \u2200 g \u2260 (1 : G), AEDisjoint \u03bc (g \u2022 s) s)\n (h_qmp : \u2200 g : G, QuasiMeasurePreserving (g \u2022 \u00b7 : \u03b1 \u2192 \u03b1) \u03bc \u03bc)\n (h_measure_univ_le : \u03bc (univ : Set \u03b1) \u2264 \u2211' g : G, \u03bc (g \u2022 s)) : IsFundamentalDomain G s \u03bc\n```\n\n```lean\ntheorem setIntegral_eq_tsum (h : IsFundamentalDomain G s \u03bc) {f : \u03b1 \u2192 E} {t : Set \u03b1}\n (hf : IntegrableOn f t \u03bc) : \u222b x in t, f x \u2202\u03bc = \u2211' g : G, \u222b x in t \u2229 g \u2022 s, f x \u2202\u03bc\n```\n\nDeclaration: `Mathlib.MeasureTheory.Group.FundamentalDomain.setIntegral_eq_tsum` (module Mathlib.MeasureTheory.Group.FundamentalDomain).", "sample_id": "F-Mathlib.MeasureTheory.Group.FundamentalDomain.setIntegral_eq_tsum", "source": {"declaration": "Mathlib.MeasureTheory.Group.FundamentalDomain.setIntegral_eq_tsum", "file": "Mathlib/MeasureTheory/Group/FundamentalDomain.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.MeasureTheory.Group.FundamentalDomain", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Group/FundamentalDomain.lean#L391", "span": "L391-L398"}} {"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 not_differentiableAt_of_local_left_inverse_hasDerivAt_zero {f g : \ud835\udd5c \u2192 \ud835\udd5c} {a : \ud835\udd5c}\n (hf : HasDerivAt f 0 (g a)) (hfg : f \u2218 g =\u1da0[\ud835\udcdd a] id) : \u00acDifferentiableAt \ud835\udd5c g a", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 736, "declarations_count": 64, "diagnostics_count": 0, "duplicate_fingerprint": "cbe8d855d620b766", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 730, "lean_code_chars": 172, "lean_code_ratio": 0.2337, "length_bucket": "short", "line_count": 8, "natural_language_chars": 564, "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.Analysis.Calculus.Deriv.Inverse).", "role": "system"}, {"content": "Explain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\nOpen namespaces: scoped, Topology, Filter, Set\n\n## Surrounding context in Mathlib/Analysis/Calculus/Deriv/Inverse.lean\n```lean\n-- Mathlib.Analysis.Calculus.Deriv.Inverse.HasStrictDerivAt (L40-L44)\ntheorem HasStrictDerivAt.hasStrictFDerivAt_equiv {f : \ud835\udd5c \u2192 \ud835\udd5c} {f' x : \ud835\udd5c}\n (hf : HasStrictDerivAt f f' x) (hf' : f' \u2260 0) :\n HasStrictFDerivAt f (ContinuousLinearEquiv.unitsEquivAut \ud835\udd5c (Units.mk0 f' hf') : \ud835\udd5c \u2192L[\ud835\udd5c] \ud835\udd5c) x\n\n-- Mathlib.Analysis.Calculus.Deriv.Inverse.HasDerivAt (L45-L55)\ntheorem HasDerivAt.hasFDerivAt_equiv {f : \ud835\udd5c \u2192 \ud835\udd5c} {f' x : \ud835\udd5c} (hf : HasDerivAt f f' x)\n (hf' : f' \u2260 0) :\n HasFDerivAt f (ContinuousLinearEquiv.unitsEquivAut \ud835\udd5c (Units.mk0 f' hf') : \ud835\udd5c \u2192L[\ud835\udd5c] \ud835\udd5c) x\n\n-- Mathlib.Analysis.Calculus.Deriv.Inverse.HasStrictDerivAt (L56-L66)\ntheorem HasStrictDerivAt.of_local_left_inverse {f g : \ud835\udd5c \u2192 \ud835\udd5c} {f' a : \ud835\udd5c} (hg : ContinuousAt g a)\n (hf : HasStrictDerivAt f f' (g a)) (hf' : f' \u2260 0) (hfg : \u2200\u1da0 y in \ud835\udcdd a, f (g y) = y) :\n HasStrictDerivAt g f'\u207b\u00b9 a\n```\n\nRelevant lemmas available in scope: `hg`\n\n```lean\ntheorem not_differentiableAt_of_local_left_inverse_hasDerivAt_zero {f g : \ud835\udd5c \u2192 \ud835\udd5c} {a : \ud835\udd5c}\n (hf : HasDerivAt f 0 (g a)) (hfg : f \u2218 g =\u1da0[\ud835\udcdd a] id) : \u00acDifferentiableAt \ud835\udd5c g a\n```\n\nDeclaration: `Mathlib.Analysis.Calculus.Deriv.Inverse.not_differentiableAt_of_local_left_inverse_hasDerivAt_zero` (module Mathlib.Analysis.Calculus.Deriv.Inverse).", "role": "user"}], "rendered_text": "You are Leanstral, a Lean 4 proof assistant. The target mathlib commit is 5e932f97dd25535344f80f9dd8da3aab83df0fe6 (module Mathlib.Analysis.Calculus.Deriv.Inverse).\n\nExplain the Lean statement below in plain mathematical language, then formalize a short related example in Lean 4.\n\nOpen namespaces: scoped, Topology, Filter, Set\n\n## Surrounding context in Mathlib/Analysis/Calculus/Deriv/Inverse.lean\n```lean\n-- Mathlib.Analysis.Calculus.Deriv.Inverse.HasStrictDerivAt (L40-L44)\ntheorem HasStrictDerivAt.hasStrictFDerivAt_equiv {f : \ud835\udd5c \u2192 \ud835\udd5c} {f' x : \ud835\udd5c}\n (hf : HasStrictDerivAt f f' x) (hf' : f' \u2260 0) :\n HasStrictFDerivAt f (ContinuousLinearEquiv.unitsEquivAut \ud835\udd5c (Units.mk0 f' hf') : \ud835\udd5c \u2192L[\ud835\udd5c] \ud835\udd5c) x\n\n-- Mathlib.Analysis.Calculus.Deriv.Inverse.HasDerivAt (L45-L55)\ntheorem HasDerivAt.hasFDerivAt_equiv {f : \ud835\udd5c \u2192 \ud835\udd5c} {f' x : \ud835\udd5c} (hf : HasDerivAt f f' x)\n (hf' : f' \u2260 0) :\n HasFDerivAt f (ContinuousLinearEquiv.unitsEquivAut \ud835\udd5c (Units.mk0 f' hf') : \ud835\udd5c \u2192L[\ud835\udd5c] \ud835\udd5c) x\n\n-- Mathlib.Analysis.Calculus.Deriv.Inverse.HasStrictDerivAt (L56-L66)\ntheorem HasStrictDerivAt.of_local_left_inverse {f g : \ud835\udd5c \u2192 \ud835\udd5c} {f' a : \ud835\udd5c} (hg : ContinuousAt g a)\n (hf : HasStrictDerivAt f f' (g a)) (hf' : f' \u2260 0) (hfg : \u2200\u1da0 y in \ud835\udcdd a, f (g y) = y) :\n HasStrictDerivAt g f'\u207b\u00b9 a\n```\n\nRelevant lemmas available in scope: `hg`\n\n```lean\ntheorem not_differentiableAt_of_local_left_inverse_hasDerivAt_zero {f g : \ud835\udd5c \u2192 \ud835\udd5c} {a : \ud835\udd5c}\n (hf : HasDerivAt f 0 (g a)) (hfg : f \u2218 g =\u1da0[\ud835\udcdd a] id) : \u00acDifferentiableAt \ud835\udd5c g a\n```\n\nDeclaration: `Mathlib.Analysis.Calculus.Deriv.Inverse.not_differentiableAt_of_local_left_inverse_hasDerivAt_zero` (module Mathlib.Analysis.Calculus.Deriv.Inverse).", "sample_id": "F-Mathlib.Analysis.Calculus.Deriv.Inverse.not_differentiableAt_of_local_left_inverse_hasDerivAt_zero", "source": {"declaration": "Mathlib.Analysis.Calculus.Deriv.Inverse.not_differentiableAt_of_local_left_inverse_hasDerivAt_zero", "file": "Mathlib/Analysis/Calculus/Deriv/Inverse.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Analysis.Calculus.Deriv.Inverse", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Calculus/Deriv/Inverse.lean#L161", "span": "L161-L165"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "theorem nontrivial_of_fixedPoints_ne_univ (h : fixedPoints G \u03b1 \u2260 .univ) :\n Nontrivial \u03b1\n frobnicateTacticThatDoesNotExist :=\n(subsingleton_or_nontrivial \u03b1).resolve_left fun _ \u21a6 h fixedPoints_of_subsingleton\n\nsection Orbit\n\n-- TODO: This proof is redoing a special case of `MulAction.IsInvariantBlock.isBlock`. Can we move\n-- this lemma earlier to golf?", "diagnostic": "[CompilationUnit(i_begin=0, i_end=219, messages=[Message(data='Function expected at\\n Nontrivial \u03b1\\nbut this term has type\\n Prop\\n\\nNote: Expected a function because this term is being applied to the argument\\n frobnicateTacticThatDoesNotExist', pos=Position(line=2, column=4), pos_end=Position(line=3, column=34), severity=, kind=None), Message(data=\"Function expected at\\n fixedPoints\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n G\\n\\nHint: The identifier `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=1, column=47), pos_end=Position(line=1, column=62), severity=, kind=None), Message(data='Invalid dotted identifier notation: The expected type of `.univ` could not be determined\\n\\nHint: Using one of these would be unambiguous:\\n [apply] `AbsConvex.univ`\\n [apply] `Absorbs.univ`\\n [apply] `AlgebraicIndepOn.univ`\\n [apply] `Cardinal.univ`\\n [apply] `Class.univ`\\n [apply] `Finset.univ`\\n [apply] `IsCofinal.univ`\\n [apply] `IsDiscrete.univ`\\n [apply] `IsG\u03b4.univ`\\n [apply] `IsLinearSet.univ`\\n [apply] `IsRetrocompact.univ`\\n [apply] `IsSemilinearSet.univ`\\n [apply] `MeasurableSet.univ`\\n [apply] `Ordinal.univ`\\n [apply] `Semiquot.univ`\\n [apply] `Set.univ`\\n [apply] `UnitsInt.univ`\\n [apply] `AddAction.IsBlock.univ`\\n [apply] `AddAction.IsFixedBlock.univ`\\n [apply] `Cardinal.IsInaccessible.univ`\\n [apply] `Cardinal.IsStrongLimit.univ`\\n [apply] `Equiv.Set.univ`\\n [apply] `Filter.CardinalGenerateSets.univ`\\n [apply] `Filter.CountableGenerateSets.univ`\\n [apply] `Filter.GenerateSets.univ`\\n [apply] `FiniteInter.finiteInterClosure.univ`\\n [apply] `Fintype.IsSimpleOrder.univ`\\n [apply] `Homeomorph.Set.univ`\\n [apply] `Lean.ToLevel.univ`\\n [apply] `Matrix.charpoly.univ`\\n [apply] `MeasurableEquiv.Set.univ`\\n [apply] `MulAction.IsBlock.univ`\\n [apply] `MulAction.IsFixedBlock.univ`\\n [apply] `Order.IsExtent.univ`\\n [apply] `Order.IsIntent.univ`\\n [apply] `OrderIso.Set.univ`\\n [apply] `Rack.toEnvelGroup.univ`\\n [apply] `Set.IsIntersectingOf.univ`\\n [apply] `Set.Sigma.univ`\\n [apply] `TopologicalSpace.GenerateOpen.univ`\\n [apply] `TopologicalSpace.IsCompletelyMetrizableSpace.univ`\\n [apply] `Topology.IsConstructible.univ`\\n [apply] `Topology.IsLocallyConstructible.univ`\\n [apply] `Filter.CardinalGenerateSets.below.univ`\\n [apply] `Filter.CountableGenerateSets.below.univ`\\n [apply] `Filter.GenerateSets.below.univ`\\n [apply] `FiniteInter.finiteInterClosure.below.univ`\\n [apply] `TopologicalSpace.GenerateOpen.below.univ`\\n [apply] `Mathlib.Tactic.Abel.Context.univ`', pos=Position(line=1, column=65), pos_end=Position(line=1, column=70), severity=, kind='lean.invalidDottedIdent._namedError'), Message(data='Unknown identifier `fixedPoints_of_subsingleton`', pos=Position(line=4, column=54), pos_end=Position(line=4, column=81), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=219, i_end=363, messages=[], 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": 4359, "declarations_count": 455, "diagnostics_count": 1, "duplicate_fingerprint": "c22c13a76156ae8b", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1404, "lean_code_chars": 357, "lean_code_ratio": 0.0819, "length_bucket": "short", "line_count": 20, "natural_language_chars": 4002, "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.GroupTheory.GroupAction.Basic).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem nontrivial_of_fixedPoints_ne_univ (h : fixedPoints G \u03b1 \u2260 .univ) :\n Nontrivial \u03b1\n frobnicateTacticThatDoesNotExist :=\n(subsingleton_or_nontrivial \u03b1).resolve_left fun _ \u21a6 h fixedPoints_of_subsingleton\n\nsection Orbit\n\n-- TODO: This proof is redoing a special case of `MulAction.IsInvariantBlock.isBlock`. Can we move\n-- this lemma earlier to golf?\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=219, messages=[Message(data='Function expected at\\n Nontrivial \u03b1\\nbut this term has type\\n Prop\\n\\nNote: Expected a function because this term is being applied to the argument\\n frobnicateTacticThatDoesNotExist', pos=Position(line=2, column=4), pos_end=Position(line=3, column=34), severity=, kind=None), Message(data=\"Function expected at\\n fixedPoints\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n G\\n\\nHint: The identifier `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=1, column=47), pos_end=Position(line=1, column=62), severity=, kind=None), Message(data='Invalid dotted identifier notation: The expected type of `.univ` could not be determined\\n\\nHint: Using one of these would be unambiguous:\\n [apply] `AbsConvex.univ`\\n [apply] `Absorbs.univ`\\n [apply] `AlgebraicIndepOn.univ`\\n [apply] `Cardinal.univ`\\n [apply] `Class.univ`\\n [apply] `Finset.univ`\\n [apply] `IsCofinal.univ`\\n [apply] `IsDiscrete.univ`\\n [apply] `IsG\u03b4.univ`\\n [apply] `IsLinearSet.univ`\\n [apply] `IsRetrocompact.univ`\\n [apply] `IsSemilinearSet.univ`\\n [apply] `MeasurableSet.univ`\\n [apply] `Ordinal.univ`\\n [apply] `Semiquot.univ`\\n [apply] `Set.univ`\\n [apply] `UnitsInt.univ`\\n [apply] `AddAction.IsBlock.univ`\\n [apply] `AddAction.IsFixedBlock.univ`\\n [apply] `Cardinal.IsInaccessible.univ`\\n [apply] `Cardinal.IsStrongLimit.univ`\\n [apply] `Equiv.Set.univ`\\n [apply] `Filter.CardinalGenerateSets.univ`\\n [apply] `Filter.CountableGenerateSets.univ`\\n [apply] `Filter.GenerateSets.univ`\\n [apply] `FiniteInter.finiteInterClosure.univ`\\n [apply] `Fintype.IsSimpleOrder.univ`\\n [apply] `Homeomorph.Set.univ`\\n [apply] `Lean.ToLevel.univ`\\n [apply] `Matrix.charpoly.univ`\\n [apply] `MeasurableEquiv.Set.univ`\\n [apply] `MulAction.IsBlock.univ`\\n [apply] `MulAction.IsFixedBlock.univ`\\n [apply] `Order.IsExtent.univ`\\n [apply] `Order.IsIntent.univ`\\n [apply] `OrderIso.Set.univ`\\n [apply] `Rack.toEnvelGroup.univ`\\n [apply] `Set.IsIntersectingOf.univ`\\n [apply] `Set.Sigma.univ`\\n [apply] `TopologicalSpace.GenerateOpen.univ`\\n [apply] `TopologicalSpace.IsCompletelyMetrizableSpace.univ`\\n [apply] `Topology.IsConstructible.univ`\\n [apply] `Topology.IsLocallyConstructible.univ`\\n [apply] `Filter.CardinalGenerateSets.below.univ`\\n [apply] `Filter.CountableGenerateSets.below.univ`\\n [apply] `Filter.GenerateSets.below.univ`\\n [apply] `FiniteInter.finiteInterClosure.below.univ`\\n [apply] `TopologicalSpace.GenerateOpen.below.univ`\\n [apply] `Mathlib.Tactic.Abel.Context.univ`', pos=Position(line=1, column=65), pos_end=Position(line=1, column=70), severity=, kind='lean.invalidDottedIdent._namedError'), Message(data='Unknown identifier `fixedPoints_of_subsingleton`', pos=Position(line=4, column=54), pos_end=Position(line=4, column=81), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=219, i_end=363, 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.GroupTheory.GroupAction.Basic).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\ntheorem nontrivial_of_fixedPoints_ne_univ (h : fixedPoints G \u03b1 \u2260 .univ) :\n Nontrivial \u03b1\n frobnicateTacticThatDoesNotExist :=\n(subsingleton_or_nontrivial \u03b1).resolve_left fun _ \u21a6 h fixedPoints_of_subsingleton\n\nsection Orbit\n\n-- TODO: This proof is redoing a special case of `MulAction.IsInvariantBlock.isBlock`. Can we move\n-- this lemma earlier to golf?\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=219, messages=[Message(data='Function expected at\\n Nontrivial \u03b1\\nbut this term has type\\n Prop\\n\\nNote: Expected a function because this term is being applied to the argument\\n frobnicateTacticThatDoesNotExist', pos=Position(line=2, column=4), pos_end=Position(line=3, column=34), severity=, kind=None), Message(data=\"Function expected at\\n fixedPoints\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n G\\n\\nHint: The identifier `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=1, column=47), pos_end=Position(line=1, column=62), severity=, kind=None), Message(data='Invalid dotted identifier notation: The expected type of `.univ` could not be determined\\n\\nHint: Using one of these would be unambiguous:\\n [apply] `AbsConvex.univ`\\n [apply] `Absorbs.univ`\\n [apply] `AlgebraicIndepOn.univ`\\n [apply] `Cardinal.univ`\\n [apply] `Class.univ`\\n [apply] `Finset.univ`\\n [apply] `IsCofinal.univ`\\n [apply] `IsDiscrete.univ`\\n [apply] `IsG\u03b4.univ`\\n [apply] `IsLinearSet.univ`\\n [apply] `IsRetrocompact.univ`\\n [apply] `IsSemilinearSet.univ`\\n [apply] `MeasurableSet.univ`\\n [apply] `Ordinal.univ`\\n [apply] `Semiquot.univ`\\n [apply] `Set.univ`\\n [apply] `UnitsInt.univ`\\n [apply] `AddAction.IsBlock.univ`\\n [apply] `AddAction.IsFixedBlock.univ`\\n [apply] `Cardinal.IsInaccessible.univ`\\n [apply] `Cardinal.IsStrongLimit.univ`\\n [apply] `Equiv.Set.univ`\\n [apply] `Filter.CardinalGenerateSets.univ`\\n [apply] `Filter.CountableGenerateSets.univ`\\n [apply] `Filter.GenerateSets.univ`\\n [apply] `FiniteInter.finiteInterClosure.univ`\\n [apply] `Fintype.IsSimpleOrder.univ`\\n [apply] `Homeomorph.Set.univ`\\n [apply] `Lean.ToLevel.univ`\\n [apply] `Matrix.charpoly.univ`\\n [apply] `MeasurableEquiv.Set.univ`\\n [apply] `MulAction.IsBlock.univ`\\n [apply] `MulAction.IsFixedBlock.univ`\\n [apply] `Order.IsExtent.univ`\\n [apply] `Order.IsIntent.univ`\\n [apply] `OrderIso.Set.univ`\\n [apply] `Rack.toEnvelGroup.univ`\\n [apply] `Set.IsIntersectingOf.univ`\\n [apply] `Set.Sigma.univ`\\n [apply] `TopologicalSpace.GenerateOpen.univ`\\n [apply] `TopologicalSpace.IsCompletelyMetrizableSpace.univ`\\n [apply] `Topology.IsConstructible.univ`\\n [apply] `Topology.IsLocallyConstructible.univ`\\n [apply] `Filter.CardinalGenerateSets.below.univ`\\n [apply] `Filter.CountableGenerateSets.below.univ`\\n [apply] `Filter.GenerateSets.below.univ`\\n [apply] `FiniteInter.finiteInterClosure.below.univ`\\n [apply] `TopologicalSpace.GenerateOpen.below.univ`\\n [apply] `Mathlib.Tactic.Abel.Context.univ`', pos=Position(line=1, column=65), pos_end=Position(line=1, column=70), severity=, kind='lean.invalidDottedIdent._namedError'), Message(data='Unknown identifier `fixedPoints_of_subsingleton`', pos=Position(line=4, column=54), pos_end=Position(line=4, column=81), severity=, kind='lean.unknownIdentifier._namedError')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=219, i_end=363, 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.GroupTheory.GroupAction.Basic.nontrivial_of_fixedPoints_ne_univ", "source": {"declaration": "Mathlib.GroupTheory.GroupAction.Basic.nontrivial_of_fixedPoints_ne_univ", "file": "Mathlib/GroupTheory/GroupAction/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.GroupTheory.GroupAction.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/GroupTheory/GroupAction/Basic.lean#L126", "span": "L126-L133"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"context_enriched": true, "excerpt": "```lean\ndef CongrResult.mk' (lhs rhs : Expr) (pf : Expr) : CongrResult where\n lhs := lhs\nrhs := rhs\n pf? :=\n if (isRefl? pf).isSome then\n none\n else\n some fun\n | .eq => do ensureSidesDefeq (\u2190 toEqPf)\n | .heq => do ensureSidesDefeq (\u2190 toHEqPf)\nwhere\n /-- Given a `pf` of an `Iff`, `Eq`, or `HEq`, return a proof of `Eq`.\n If `pf` is not obviously any of these, weakly try inserting `propext` to make an `Iff`\n and otherwise unify the type with `Eq`. -/\n toEqPf : MetaM Expr := do\n let ty \u2190 whnf (\u2190 inferType pf)\n if let some .. := ty.iff? then\n mkPropExt pf\n else if let some .. := ty.eq? then\n return pf\n else if let some (lhsTy, _, rhsTy, _) := ty.heq? then\n unless \u2190 isDefEq lhsTy rhsTy do\n throwError \"Cannot turn HEq proof into an equality proof. Has type{indentD ty}\"\n mkAppM ``eq_of_heq #[pf]\n else if \u2190 Meta.isProp lhs then\n mkPropExt (\u2190 ensureIff pf)\n else\n discard <| mkEqForExpectedType (\u2190 inferType pf)\n return pf\n /-- Given a `pf` of an `Iff`, `Eq`, or `HEq`, return a proof of `HEq`.\n If `pf` is not obviously any of these, weakly try making it be an `Eq` or an `Iff`,\n and otherwise make it be a `HEq`. -/\n toHEqPf : MetaM Expr := do\n let ty \u2190 whnf (\u2190 inferType pf)\n if let some .. := ty.iff? then\n mkAppM ``heq_of_eq #[\u2190 mkPropExt pf]\n else if let some .. := ty.eq? then\n mkAppM ``heq_of_eq #[pf]\n else if let some .. := ty.heq? then\n return pf\n else if \u2190 withNewMCtxDepth <| isDefEq (\u2190 inferType lhs) (\u2190 inferType rhs) then\n mkAppM ``heq_of_eq #[\u2190 toEqPf]\n else\n discard <| mkHEqForExpectedType (\u2190 inferType pf)\n return pf\n /-- Get the sides of the type of `pf` and unify them with the respective `lhs` and `rhs`. -/\n ensureSidesDefeq (pf : Expr) : MetaM Expr := do\n let pfTy \u2190 inferType pf\n let some (_, lhs', _, rhs') := (\u2190 whnf pfTy).sides?\n | panic! \"Unexpectedly did not generate an eq or heq\"\n unless \u2190 isDefEq lhs lhs' do\n throwError \"Congruence hole has type{indentD pfTy}\\n\\\n but its left-hand side is not definitionally equal to the expected value{indentD lhs}\"\n unless \u2190 isDefEq rhs rhs' do\n throwError \"Congruence hole has type{indentD pfTy}\\n\\\n but its right-hand side is not definitionally equal to the expected value{indentD rhs}\"\n return pf\n\n/-- Force the lhs and rhs to be defeq. For when `dsimp`-like congruence is necessary.\nClears the proof. -/\n```", "instruction": "Edit `CongrResult` so it still compiles and the proof is simplified where possible. Return the full updated `CongrResult` block.", "proof_is_oneliner": false, "source_grounded_context_enriched": true, "target_span": "L326-L385", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 3142, "declarations_count": 427, "diagnostics_count": 0, "duplicate_fingerprint": "0b0450f95baa0ae2", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1194, "lean_code_chars": 2463, "lean_code_ratio": 0.7839, "length_bucket": "short", "line_count": 69, "natural_language_chars": 679, "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.TermCongr).", "role": "system"}, {"content": "You are editing a file in `Mathlib/Tactic/TermCongr.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Tactic.TermCongr.CongrResult`, L326-L385)\nOpen namespaces: Lean, Elab, Meta\n\n## Surrounding context in Mathlib/Tactic/TermCongr.lean\n```lean\n-- Mathlib.Tactic.TermCongr.cHole (L110-L113)\ndef cHole {\u03b1 : Sort u} (val : \u03b1) {p : Prop} (_pf : p) : \u03b1\n\n-- Mathlib.Tactic.TermCongr.mkCHole (L122-L131)\ndef mkCHole (forLhs : Bool) (val pf : Expr) : MetaM Expr\n\n-- Mathlib.Tactic.TermCongr.cHole (L132-L143)\ndef cHole? (e : Expr) (mvarCounterSaved? : Option Nat\n```\n\nRelevant lemmas available in scope: `non`\n\n```lean\ndef CongrResult.mk' (lhs rhs : Expr) (pf : Expr) : CongrResult where\n lhs := lhs\nrhs := rhs\n pf? :=\n if (isRefl? pf).isSome then\n none\n else\n some fun\n | .eq => do ensureSidesDefeq (\u2190 toEqPf)\n | .heq => do ensureSidesDefeq (\u2190 toHEqPf)\nwhere\n /-- Given a `pf` of an `Iff`, `Eq`, or `HEq`, return a proof of `Eq`.\n If `pf` is not obviously any of these, weakly try inserting `propext` to make an `Iff`\n and otherwise unify the type with `Eq`. -/\n toEqPf : MetaM Expr := do\n let ty \u2190 whnf (\u2190 inferType pf)\n if let some .. := ty.iff? then\n mkPropExt pf\n else if let some .. := ty.eq? then\n return pf\n else if let some (lhsTy, _, rhsTy, _) := ty.heq? then\n unless \u2190 isDefEq lhsTy rhsTy do\n throwError \"Cannot turn HEq proof into an equality proof. Has type{indentD ty}\"\n mkAppM ``eq_of_heq #[pf]\n else if \u2190 Meta.isProp lhs then\n mkPropExt (\u2190 ensureIff pf)\n else\n discard <| mkEqForExpectedType (\u2190 inferType pf)\n return pf\n /-- Given a `pf` of an `Iff`, `Eq`, or `HEq`, return a proof of `HEq`.\n If `pf` is not obviously any of these, weakly try making it be an `Eq` or an `Iff`,\n and otherwise make it be a `HEq`. -/\n toHEqPf : MetaM Expr := do\n let ty \u2190 whnf (\u2190 inferType pf)\n if let some .. := ty.iff? then\n mkAppM ``heq_of_eq #[\u2190 mkPropExt pf]\n else if let some .. := ty.eq? then\n mkAppM ``heq_of_eq #[pf]\n else if let some .. := ty.heq? then\n return pf\n else if \u2190 withNewMCtxDepth <| isDefEq (\u2190 inferType lhs) (\u2190 inferType rhs) then\n mkAppM ``heq_of_eq #[\u2190 toEqPf]\n else\n discard <| mkHEqForExpectedType (\u2190 inferType pf)\n return pf\n /-- Get the sides of the type of `pf` and unify them with the respective `lhs` and `rhs`. -/\n ensureSidesDefeq (pf : Expr) : MetaM Expr := do\n let pfTy \u2190 inferType pf\n let some (_, lhs', _, rhs') := (\u2190 whnf pfTy).sides?\n | panic! \"Unexpectedly did not generate an eq or heq\"\n unless \u2190 isDefEq lhs lhs' do\n throwError \"Congruence hole has type{indentD pfTy}\\n\\\n but its left-hand side is not definitionally equal to the expected value{indentD lhs}\"\n unless \u2190 isDefEq rhs rhs' do\n throwError \"Congruence hole has type{indentD pfTy}\\n\\\n but its right-hand side is not definitionally equal to the expected value{indentD rhs}\"\n return pf\n\n/-- Force the lhs and rhs to be defeq. For when `dsimp`-like congruence is necessary.\nClears the proof. -/\n```\n\n## Edit instruction\nEdit `CongrResult` so it still compiles and the proof is simplified where possible. Return the full updated `CongrResult` 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.Tactic.TermCongr).\n\nYou are editing a file in `Mathlib/Tactic/TermCongr.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Tactic.TermCongr.CongrResult`, L326-L385)\nOpen namespaces: Lean, Elab, Meta\n\n## Surrounding context in Mathlib/Tactic/TermCongr.lean\n```lean\n-- Mathlib.Tactic.TermCongr.cHole (L110-L113)\ndef cHole {\u03b1 : Sort u} (val : \u03b1) {p : Prop} (_pf : p) : \u03b1\n\n-- Mathlib.Tactic.TermCongr.mkCHole (L122-L131)\ndef mkCHole (forLhs : Bool) (val pf : Expr) : MetaM Expr\n\n-- Mathlib.Tactic.TermCongr.cHole (L132-L143)\ndef cHole? (e : Expr) (mvarCounterSaved? : Option Nat\n```\n\nRelevant lemmas available in scope: `non`\n\n```lean\ndef CongrResult.mk' (lhs rhs : Expr) (pf : Expr) : CongrResult where\n lhs := lhs\nrhs := rhs\n pf? :=\n if (isRefl? pf).isSome then\n none\n else\n some fun\n | .eq => do ensureSidesDefeq (\u2190 toEqPf)\n | .heq => do ensureSidesDefeq (\u2190 toHEqPf)\nwhere\n /-- Given a `pf` of an `Iff`, `Eq`, or `HEq`, return a proof of `Eq`.\n If `pf` is not obviously any of these, weakly try inserting `propext` to make an `Iff`\n and otherwise unify the type with `Eq`. -/\n toEqPf : MetaM Expr := do\n let ty \u2190 whnf (\u2190 inferType pf)\n if let some .. := ty.iff? then\n mkPropExt pf\n else if let some .. := ty.eq? then\n return pf\n else if let some (lhsTy, _, rhsTy, _) := ty.heq? then\n unless \u2190 isDefEq lhsTy rhsTy do\n throwError \"Cannot turn HEq proof into an equality proof. Has type{indentD ty}\"\n mkAppM ``eq_of_heq #[pf]\n else if \u2190 Meta.isProp lhs then\n mkPropExt (\u2190 ensureIff pf)\n else\n discard <| mkEqForExpectedType (\u2190 inferType pf)\n return pf\n /-- Given a `pf` of an `Iff`, `Eq`, or `HEq`, return a proof of `HEq`.\n If `pf` is not obviously any of these, weakly try making it be an `Eq` or an `Iff`,\n and otherwise make it be a `HEq`. -/\n toHEqPf : MetaM Expr := do\n let ty \u2190 whnf (\u2190 inferType pf)\n if let some .. := ty.iff? then\n mkAppM ``heq_of_eq #[\u2190 mkPropExt pf]\n else if let some .. := ty.eq? then\n mkAppM ``heq_of_eq #[pf]\n else if let some .. := ty.heq? then\n return pf\n else if \u2190 withNewMCtxDepth <| isDefEq (\u2190 inferType lhs) (\u2190 inferType rhs) then\n mkAppM ``heq_of_eq #[\u2190 toEqPf]\n else\n discard <| mkHEqForExpectedType (\u2190 inferType pf)\n return pf\n /-- Get the sides of the type of `pf` and unify them with the respective `lhs` and `rhs`. -/\n ensureSidesDefeq (pf : Expr) : MetaM Expr := do\n let pfTy \u2190 inferType pf\n let some (_, lhs', _, rhs') := (\u2190 whnf pfTy).sides?\n | panic! \"Unexpectedly did not generate an eq or heq\"\n unless \u2190 isDefEq lhs lhs' do\n throwError \"Congruence hole has type{indentD pfTy}\\n\\\n but its left-hand side is not definitionally equal to the expected value{indentD lhs}\"\n unless \u2190 isDefEq rhs rhs' do\n throwError \"Congruence hole has type{indentD pfTy}\\n\\\n but its right-hand side is not definitionally equal to the expected value{indentD rhs}\"\n return pf\n\n/-- Force the lhs and rhs to be defeq. For when `dsimp`-like congruence is necessary.\nClears the proof. -/\n```\n\n## Edit instruction\nEdit `CongrResult` so it still compiles and the proof is simplified where possible. Return the full updated `CongrResult` block.\n", "sample_id": "D-Mathlib.Tactic.TermCongr.CongrResult", "source": {"declaration": "Mathlib.Tactic.TermCongr.CongrResult", "file": "Mathlib/Tactic/TermCongr.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Tactic.TermCongr", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Tactic/TermCongr.lean#L326", "span": "L326-L385"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"context_enriched": true, "excerpt": "```lean\ntheorem ae_tendsto_div : \u2200\u1d50 x \u2202\u03bc, \u2203 c, Tendsto (fun a => \u03c1 a / \u03bc a) (v.filterAt x) (\ud835\udcdd c) := by\nobtain \u27e8w, w_count, w_dense, _, w_top\u27e9 :\n \u2203 w : Set \u211d\u22650\u221e, w.Countable \u2227 Dense w \u2227 0 \u2209 w \u2227 \u221e \u2209 w :=\n ENNReal.exists_countable_dense_no_zero_top\n have I : \u2200 x \u2208 w, x \u2260 \u221e := fun x xs hx => w_top (hx \u25b8 xs)\n have A : \u2200 c \u2208 w, \u2200 d \u2208 w, c < d \u2192 \u2200\u1d50 x \u2202\u03bc,\n \u00ac((\u2203\u1da0 a in v.filterAt x, \u03c1 a / \u03bc a < c) \u2227 \u2203\u1da0 a in v.filterAt x, d < \u03c1 a / \u03bc a) := by\n intro c hc d hd hcd\n lift c to \u211d\u22650 using I c hc\n lift d to \u211d\u22650 using I d hd\n apply v.null_of_frequently_le_of_frequently_ge h\u03c1 (ENNReal.coe_lt_coe.1 hcd)\n \u00b7 simp only [and_imp, exists_prop, not_frequently, not_and, not_lt, not_le, not_eventually,\n mem_setOf_eq, mem_compl_iff, not_forall]\n intro x h1x _\n apply h1x.mono fun a ha => ?_\n refine (ENNReal.div_le_iff_le_mul ?_ (Or.inr (bot_le.trans_lt ha).ne')).1 ha.le\n simp only [ENNReal.coe_ne_top, Ne, or_true, not_false_iff]\n \u00b7 simp only [and_imp, exists_prop, not_frequently, not_and, not_lt, not_le, not_eventually,\n mem_setOf_eq, mem_compl_iff, not_forall]\n intro x _ h2x\n apply h2x.mono fun a ha => ?_\n exact ENNReal.mul_le_of_le_div ha.le\n have B : \u2200\u1d50 x \u2202\u03bc, \u2200 c \u2208 w, \u2200 d \u2208 w, c < d \u2192\n \u00ac((\u2203\u1da0 a in v.filterAt x, \u03c1 a / \u03bc a < c) \u2227 \u2203\u1da0 a in v.filterAt x, d < \u03c1 a / \u03bc a) := by\n simpa only [ae_ball_iff w_count, ae_all_iff]\n filter_upwards [B]\n intro x hx\n exact tendsto_of_no_upcrossings w_dense hx\n```", "instruction": "Edit `ae_tendsto_div` so it still compiles and the proof is simplified where possible. Return the full updated `ae_tendsto_div` block.", "proof_is_oneliner": false, "source_grounded_context_enriched": true, "target_span": "L233-L261", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 2223, "declarations_count": 262, "diagnostics_count": 0, "duplicate_fingerprint": "99a445ace9af74f3", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1265, "lean_code_chars": 1469, "lean_code_ratio": 0.6608, "length_bucket": "short", "line_count": 37, "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.MeasureTheory.Covering.Differentiation).", "role": "system"}, {"content": "You are editing a file in `Mathlib/MeasureTheory/Covering/Differentiation.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.MeasureTheory.Covering.Differentiation.ae_tendsto_div`, L233-L261)\nOpen namespaces: MeasureTheory, Metric, Set, Filter, TopologicalSpace, MeasureTheory.Measure, scoped, ENNReal\n\n## Surrounding context in Mathlib/MeasureTheory/Covering/Differentiation.lean\n```lean\n-- Mathlib.MeasureTheory.Covering.Differentiation.ae_eventually_measure_pos (L98-L117)\ntheorem ae_eventually_measure_pos [SecondCountableTopology \u03b1] :\n \u2200\u1d50 x \u2202\u03bc, \u2200\u1da0 a in v.filterAt x, 0 < \u03bc a\n\n-- Mathlib.MeasureTheory.Covering.Differentiation.eventually_measure_lt_top (L118-L123)\ntheorem eventually_measure_lt_top [IsLocallyFiniteMeasure \u03bc] (x : \u03b1) :\n \u2200\u1da0 a in v.filterAt x, \u03bc a < \u221e\n\n-- Mathlib.MeasureTheory.Covering.Differentiation.measure_le_of_frequently_le (L124-L149)\ntheorem measure_le_of_frequently_le [SecondCountableTopology \u03b1] [BorelSpace \u03b1] {\u03c1 : Measure \u03b1}\n (\u03bd : Measure \u03b1) [IsLocallyFiniteMeasure \u03bd] (h\u03c1 : \u03c1 \u226a \u03bc) (s : Set \u03b1)\n (hs : \u2200 x \u2208 s, \u2203\u1da0 a in v.filterAt x, \u03c1 a \u2264 \u03bd a) : \u03c1 s \u2264 \u03bd s\n```\n\nRelevant lemmas available in scope: `I`, `A`, `c`, `v.null_of_frequently_le_of_frequently_ge`, `x`, `h1x.mono`, `h2x.mono`, `ENNReal.mul_le_of_le_div`\n\n```lean\ntheorem ae_tendsto_div : \u2200\u1d50 x \u2202\u03bc, \u2203 c, Tendsto (fun a => \u03c1 a / \u03bc a) (v.filterAt x) (\ud835\udcdd c) := by\nobtain \u27e8w, w_count, w_dense, _, w_top\u27e9 :\n \u2203 w : Set \u211d\u22650\u221e, w.Countable \u2227 Dense w \u2227 0 \u2209 w \u2227 \u221e \u2209 w :=\n ENNReal.exists_countable_dense_no_zero_top\n have I : \u2200 x \u2208 w, x \u2260 \u221e := fun x xs hx => w_top (hx \u25b8 xs)\n have A : \u2200 c \u2208 w, \u2200 d \u2208 w, c < d \u2192 \u2200\u1d50 x \u2202\u03bc,\n \u00ac((\u2203\u1da0 a in v.filterAt x, \u03c1 a / \u03bc a < c) \u2227 \u2203\u1da0 a in v.filterAt x, d < \u03c1 a / \u03bc a) := by\n intro c hc d hd hcd\n lift c to \u211d\u22650 using I c hc\n lift d to \u211d\u22650 using I d hd\n apply v.null_of_frequently_le_of_frequently_ge h\u03c1 (ENNReal.coe_lt_coe.1 hcd)\n \u00b7 simp only [and_imp, exists_prop, not_frequently, not_and, not_lt, not_le, not_eventually,\n mem_setOf_eq, mem_compl_iff, not_forall]\n intro x h1x _\n apply h1x.mono fun a ha => ?_\n refine (ENNReal.div_le_iff_le_mul ?_ (Or.inr (bot_le.trans_lt ha).ne')).1 ha.le\n simp only [ENNReal.coe_ne_top, Ne, or_true, not_false_iff]\n \u00b7 simp only [and_imp, exists_prop, not_frequently, not_and, not_lt, not_le, not_eventually,\n mem_setOf_eq, mem_compl_iff, not_forall]\n intro x _ h2x\n apply h2x.mono fun a ha => ?_\n exact ENNReal.mul_le_of_le_div ha.le\n have B : \u2200\u1d50 x \u2202\u03bc, \u2200 c \u2208 w, \u2200 d \u2208 w, c < d \u2192\n \u00ac((\u2203\u1da0 a in v.filterAt x, \u03c1 a / \u03bc a < c) \u2227 \u2203\u1da0 a in v.filterAt x, d < \u03c1 a / \u03bc a) := by\n simpa only [ae_ball_iff w_count, ae_all_iff]\n filter_upwards [B]\n intro x hx\n exact tendsto_of_no_upcrossings w_dense hx\n```\n\n## Edit instruction\nEdit `ae_tendsto_div` so it still compiles and the proof is simplified where possible. Return the full updated `ae_tendsto_div` 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.MeasureTheory.Covering.Differentiation).\n\nYou are editing a file in `Mathlib/MeasureTheory/Covering/Differentiation.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.MeasureTheory.Covering.Differentiation.ae_tendsto_div`, L233-L261)\nOpen namespaces: MeasureTheory, Metric, Set, Filter, TopologicalSpace, MeasureTheory.Measure, scoped, ENNReal\n\n## Surrounding context in Mathlib/MeasureTheory/Covering/Differentiation.lean\n```lean\n-- Mathlib.MeasureTheory.Covering.Differentiation.ae_eventually_measure_pos (L98-L117)\ntheorem ae_eventually_measure_pos [SecondCountableTopology \u03b1] :\n \u2200\u1d50 x \u2202\u03bc, \u2200\u1da0 a in v.filterAt x, 0 < \u03bc a\n\n-- Mathlib.MeasureTheory.Covering.Differentiation.eventually_measure_lt_top (L118-L123)\ntheorem eventually_measure_lt_top [IsLocallyFiniteMeasure \u03bc] (x : \u03b1) :\n \u2200\u1da0 a in v.filterAt x, \u03bc a < \u221e\n\n-- Mathlib.MeasureTheory.Covering.Differentiation.measure_le_of_frequently_le (L124-L149)\ntheorem measure_le_of_frequently_le [SecondCountableTopology \u03b1] [BorelSpace \u03b1] {\u03c1 : Measure \u03b1}\n (\u03bd : Measure \u03b1) [IsLocallyFiniteMeasure \u03bd] (h\u03c1 : \u03c1 \u226a \u03bc) (s : Set \u03b1)\n (hs : \u2200 x \u2208 s, \u2203\u1da0 a in v.filterAt x, \u03c1 a \u2264 \u03bd a) : \u03c1 s \u2264 \u03bd s\n```\n\nRelevant lemmas available in scope: `I`, `A`, `c`, `v.null_of_frequently_le_of_frequently_ge`, `x`, `h1x.mono`, `h2x.mono`, `ENNReal.mul_le_of_le_div`\n\n```lean\ntheorem ae_tendsto_div : \u2200\u1d50 x \u2202\u03bc, \u2203 c, Tendsto (fun a => \u03c1 a / \u03bc a) (v.filterAt x) (\ud835\udcdd c) := by\nobtain \u27e8w, w_count, w_dense, _, w_top\u27e9 :\n \u2203 w : Set \u211d\u22650\u221e, w.Countable \u2227 Dense w \u2227 0 \u2209 w \u2227 \u221e \u2209 w :=\n ENNReal.exists_countable_dense_no_zero_top\n have I : \u2200 x \u2208 w, x \u2260 \u221e := fun x xs hx => w_top (hx \u25b8 xs)\n have A : \u2200 c \u2208 w, \u2200 d \u2208 w, c < d \u2192 \u2200\u1d50 x \u2202\u03bc,\n \u00ac((\u2203\u1da0 a in v.filterAt x, \u03c1 a / \u03bc a < c) \u2227 \u2203\u1da0 a in v.filterAt x, d < \u03c1 a / \u03bc a) := by\n intro c hc d hd hcd\n lift c to \u211d\u22650 using I c hc\n lift d to \u211d\u22650 using I d hd\n apply v.null_of_frequently_le_of_frequently_ge h\u03c1 (ENNReal.coe_lt_coe.1 hcd)\n \u00b7 simp only [and_imp, exists_prop, not_frequently, not_and, not_lt, not_le, not_eventually,\n mem_setOf_eq, mem_compl_iff, not_forall]\n intro x h1x _\n apply h1x.mono fun a ha => ?_\n refine (ENNReal.div_le_iff_le_mul ?_ (Or.inr (bot_le.trans_lt ha).ne')).1 ha.le\n simp only [ENNReal.coe_ne_top, Ne, or_true, not_false_iff]\n \u00b7 simp only [and_imp, exists_prop, not_frequently, not_and, not_lt, not_le, not_eventually,\n mem_setOf_eq, mem_compl_iff, not_forall]\n intro x _ h2x\n apply h2x.mono fun a ha => ?_\n exact ENNReal.mul_le_of_le_div ha.le\n have B : \u2200\u1d50 x \u2202\u03bc, \u2200 c \u2208 w, \u2200 d \u2208 w, c < d \u2192\n \u00ac((\u2203\u1da0 a in v.filterAt x, \u03c1 a / \u03bc a < c) \u2227 \u2203\u1da0 a in v.filterAt x, d < \u03c1 a / \u03bc a) := by\n simpa only [ae_ball_iff w_count, ae_all_iff]\n filter_upwards [B]\n intro x hx\n exact tendsto_of_no_upcrossings w_dense hx\n```\n\n## Edit instruction\nEdit `ae_tendsto_div` so it still compiles and the proof is simplified where possible. Return the full updated `ae_tendsto_div` block.\n", "sample_id": "D-Mathlib.MeasureTheory.Covering.Differentiation.ae_tendsto_div", "source": {"declaration": "Mathlib.MeasureTheory.Covering.Differentiation.ae_tendsto_div", "file": "Mathlib/MeasureTheory/Covering/Differentiation.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.MeasureTheory.Covering.Differentiation", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/MeasureTheory/Covering/Differentiation.lean#L233", "span": "L233-L261"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "B", "construction": {"broken_code": "lemma Spec_stalkClosedPointIso :\n Spec.map (stalkClosedPointIso R).inv = (Spec R).fromSpecStalk (closedPoint R)\n:= by thisIsWrongLemmaNameXYZ\nrw [stalkClosedPointIso_inv, Spec.fromSpecStalk_eq']\n\nend stalkClosedPointIso\n\nsection stalkClosedPointTo\n\nvariable {R} (f : Spec R \u27f6 X)\n\nnamespace Scheme\n\n/--\nGiven a local ring `(R, \ud835\udd2a)` and a morphism `f : Spec R \u27f6 X`,\nthey induce a (local) ring homomorphism `\u03c6 : \ud835\udcaa_{X, f \ud835\udd2a} \u27f6 R`.\n\nThis is inverse to `\u03c6 \u21a6 Spec.map \u03c6 \u226b X.fromSpecStalk (f \ud835\udd2a)`. See `SpecToEquivOfLocalRing`.\n-/\nnoncomputable", "diagnostic": "[CompilationUnit(i_begin=0, i_end=122, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None), Message(data=\"Invalid field notation: Type of\\n Spec\\nis not known; cannot resolve field `map`\\n\\nHint: Consider replacing the field projection with a call to one of the following:\\n \u2022 `Abelianization.map`\\n \u2022 `AbstractCompletion.map`\\n \u2022 `AccPt.map`\\n \u2022 `AddCommute.map`\\n \u2022 `AddCon.map`\\n \u2022 `AddConjClasses.map`\\n \u2022 `AddIrreducible.map`\\n \u2022 `AddMonoidAlgebra.map`\\n \u2022 `AddSemiconjBy.map`\\n \u2022 `AddSubgroup.map`\\n \u2022 `AddSubmonoid.map`\\n \u2022 `AddSubsemigroup.map`\\n \u2022 `AddUnits.map`\\n \u2022 `AddValuation.map`\\n \u2022 `AdicCompletion.map`\\n \u2022 `AdjoinRoot.map`\\n \u2022 `AffineSubspace.map`\\n \u2022 `AlgebraicIndependent.map`\\n \u2022 `Array.map`\\n \u2022 `Associated.map`\\n \u2022 `BaseIO.map`\\n \u2022 `Behrend.map`\\n \u2022 `BooleanSubalgebra.map`\\n \u2022 `ByteArray.map`\\n \u2022 `CStarMatrix.map`\\n \u2022 `Cardinal.map`\\n \u2022 `Cauchy.map`\\n \u2022 `CliffordAlgebra.map`\\n \u2022 `ClosedSubmodule.map`\\n \u2022 `ClusterPt.map`\\n \u2022 `Codisjoint.map`\\n \u2022 `Commute.map`\\n \u2022 `CompleteOrthogonalIdempotents.map`\\n \u2022 `CompleteSublattice.map`\\n \u2022 `Computation.map`\\n \u2022 `Con.map`\\n \u2022 `ConjClasses.map`\\n \u2022 `ContT.map`\\n \u2022 `ConvexCone.map`\\n \u2022 `CoxeterSystem.map`\\n \u2022 `Cubic.map`\\n \u2022 `Cycle.map`\\n \u2022 `DMatrix.map`\\n \u2022 `DirectLimit.map`\\n \u2022 `DirectSum.map`\\n \u2022 `DiscreteQuotient.map`\\n \u2022 `Disjoint.map`\\n \u2022 `EIO.map`\\n \u2022 `ENat.map`\\n \u2022 `EStateM.map`\\n \u2022 `Equiv.map`\\n \u2022 `EquivFunctor.map`\\n \u2022 `Erased.map`\\n \u2022 `Even.map`\\n \u2022 `Except.map`\\n \u2022 `ExceptT.map`\\n \u2022 `ExteriorAlgebra.map`\\n \u2022 `Filter.map`\\n \u2022 `FinVec.map`\\n \u2022 `Finpartition.map`\\n \u2022 `Finset.map`\\n \u2022 `Flag.map`\\n \u2022 `FloatArray.map`\\n \u2022 `FractionalIdeal.map`\\n \u2022 `FreeAbelianGroup.map`\\n \u2022 `FreeAddGroup.map`\\n \u2022 `FreeAddMagma.map`\\n \u2022 `FreeAddMonoid.map`\\n \u2022 `FreeAddSemigroup.map`\\n \u2022 `FreeCommRing.map`\\n \u2022 `FreeGroup.map`\\n \u2022 `FreeGroupBasis.map`\\n \u2022 `FreeMagma.map`\\n \u2022 `FreeMonoid.map`\\n \u2022 `FreeRing.map`\\n \u2022 `FreeSemigroup.map`\\n \u2022 `FunOnFinite.map`\\n \u2022 `Functor.map`\\n \u2022 `FundamentalGroup.map`\\n \u2022 `FundamentalGroupoid.map`\\n \u2022 `HahnSeries.map`\\n \u2022 `HasProd.map`\\n \u2022 `HasSum.map`\\n \u2022 `HomogeneousIdeal.map`\\n \u2022 `HomogeneousLocalization.map`\\n \u2022 `Ideal.map`\\n \u2022 `Inseparable.map`\\n \u2022 `IntermediateField.map`\\n \u2022 `Interval.map`\\n \u2022 `Invertible.map`\\n \u2022 `Irreducible.map`\\n \u2022 `IsAddUnit.map`\\n \u2022 `IsAdjoinRoot.map`\\n \u2022 `IsCompl.map`\\n \u2022 `IsCoprime.map`\\n \u2022 `IsFractionRing.map`\\n \u2022 `IsFractional.map`\\n \u2022 `IsGroupLikeElem.map`\\n \u2022 `IsIdempotentElem.map`\\n \u2022 `IsIntegral.map`\\n \u2022 `IsLocalization.map`\\n \u2022 `IsLocalizedModule.map`\\n \u2022 `IsNilpotent.map`\\n \u2022 `IsPGroup.map`\\n \u2022 `IsQuasiregular.map`\\n \u2022 `IsSMulRegular.map`\\n \u2022 `IsSelfAdjoint.map`\\n \u2022 `IsSeparable.map`\\n \u2022 `IsSquare.map`\\n \u2022 `IsStarNormal.map`\\n \u2022 `IsStarProjection.map`\\n \u2022 `IsTensorProduct.map`\\n \u2022 `IsTopologicallyNilpotent.map`\\n \u2022 `IsUnit.map`\\n \u2022 `JoinedIn.map`\\n \u2022 `KaehlerDifferential.map`\\n \u2022 `LTSeries.map`\\n \u2022 `Language.map`\\n \u2022 `LieIdeal.map`\\n \u2022 `LieSubalgebra.map`\\n \u2022 `LieSubmodule.map`\\n \u2022 `LinearIndependent.map`\\n \u2022 `List.map`\\n \u2022 `LocalSubring.map`\\n \u2022 `LocalizedModule.map`\\n \u2022 `LocallyConstant.map`\\n \u2022 `LowerSet.map`\\n \u2022 `MLList.map`\\n \u2022 `Matrix.map`\\n \u2022 `Matroid.map`\\n \u2022 `MeasurableSpace.map`\\n \u2022 `MonoidAlgebra.map`\\n \u2022 `MultilinearMap.map`\\n \u2022 `Multipliable.map`\\n \u2022 `Multiset.map`\\n \u2022 `MvFunctor.map`\\n \u2022 `MvPFunctor.map`\\n \u2022 `MvPolynomial.map`\\n \u2022 `MvPowerSeries.map`\\n \u2022 `NonUnitalStarSubalgebra.map`\\n \u2022 `NonUnitalSubalgebra.map`\\n \u2022 `NonUnitalSubring.map`\\n \u2022 `NonUnitalSubsemiring.map`\\n \u2022 `Nondet.map`\\n \u2022 `Nonempty.map`\\n \u2022 `NonemptyInterval.map`\\n \u2022 `Odd.map`\\n \u2022 `OnePoint.map`\\n \u2022 `Option.map`\\n \u2022 `Ordnode.map`\\n \u2022 `Ordset.map`\\n \u2022 `Orientation.map`\\n \u2022 `OrthogonalIdempotents.map`\\n \u2022 `OrthonormalBasis.map`\\n \u2022 `PFun.map`\\n \u2022 `PFunctor.map`\\n \u2022 `PLift.map`\\n \u2022 `PMF.map`\\n \u2022 `PSigma.map`\\n \u2022 `Part.map`\\n \u2022 `Partrec.map`\\n \u2022 `Path.map`\\n \u2022 `Perfection.map`\\n \u2022 `PerfectionMap.map`\\n \u2022 `Pi.map`\\n \u2022 `PiTensorProduct.map`\\n \u2022 `PointedCone.map`\\n \u2022 `Poly.map`\\n \u2022 `Polynomial.map`\\n \u2022 `PolynomialModule.map`\\n \u2022 `PontryaginDual.map`\\n \u2022 `PowerBasis.map`\\n \u2022 `PowerSeries.map`\\n \u2022 `PreAbstractSimplicialComplex.map`\\n \u2022 `Prefunctor.map`\\n \u2022 `PresheafOfModules.map`\\n \u2022 `Prod.map`\\n \u2022 `Projectivization.map`\\n \u2022 `ProperCone.map`\\n \u2022 `Quot.map`\\n \u2022 `QuotSMulTop.map`\\n \u2022 `Quotient.map`\\n \u2022 `QuotientAddGroup.map`\\n \u2022 `QuotientGroup.map`\\n \u2022 `RCLike.map`\\n \u2022 `RatFunc.map`\\n \u2022 `RegularExpression.map`\\n \u2022 `RelSeries.map`\\n \u2022 `RestrictedProduct.map`\\n \u2022 `RingCon.map`\\n \u2022 `RootPairing.map`\\n \u2022 `SModEq.map`\\n \u2022 `SameRay.map`\\n \u2022 `SatisfiesM.map`\\n \u2022 `SemiconjBy.map`\\n \u2022 `SemidirectProduct.map`\\n \u2022 `Semiquot.map`\\n \u2022 `SeparationQuotient.map`\\n \u2022 `Setoid.map`\\n \u2022 `Sigma.map`\\n \u2022 `SimpleGraph.map`\\n \u2022 `SingularManifold.map`\\n \u2022 `SlashAction.map`\\n \u2022 `Specialization.map`\\n \u2022 `Specializes.map`\\n \u2022 `StandardEtalePair.map`\\n \u2022 `StarSubalgebra.map`\\n \u2022 `StateT.map`\\n \u2022 `StdSimplex.map`\\n \u2022 `Stream'.map`\\n \u2022 `String.map`\\n \u2022 `Subalgebra.map`\\n \u2022 `Subfield.map`\\n \u2022 `Subgroup.map`\\n \u2022 `Sublattice.map`\\n \u2022 `Submodule.map`\\n \u2022 `Submonoid.map`\\n \u2022 `Subring.map`\\n \u2022 `Subsemigroup.map`\\n \u2022 `Subsemiring.map`\\n \u2022 `Subtype.map`\\n \u2022 `Sum.map`\\n \u2022 `Summable.map`\\n \u2022 `SummationFilter.map`\\n \u2022 `Sym.map`\\n \u2022 `Sym2.map`\\n \u2022 `Task.map`\\n \u2022 `TensorProduct.map`\\n \u2022 `Thunk.map`\\n \u2022 `Tree.map`\\n \u2022 `TrivSqZeroExt.map`\\n \u2022 `Trunc.map`\\n \u2022 `TwoSidedIdeal.map`\\n \u2022 `ULift.map`\\n \u2022 `Ultrafilter.map`\\n \u2022 `Unitary.map`\\n \u2022 `Units.map`\\n \u2022 `UpperSet.map`\\n \u2022 `Valuation.map`\\n \u2022 `Vector.map`\\n \u2022 `Wbtw.map`\\n \u2022 `WeakSpace.map`\\n \u2022 `WeierstrassCurve.map`\\n \u2022 `WithAbs.map`\\n \u2022 `WithBot.map`\\n \u2022 `WithLp.map`\\n \u2022 `WithOne.map`\\n \u2022 `WithTop.map`\\n \u2022 `WithVal.map`\\n \u2022 `WithZero.map`\\n \u2022 `WittVector.map`\\n \u2022 `ZFSet.map`\\n \u2022 `ZSpan.map`\\n \u2022 `bernsteinPolynomial.map`\\n \u2022 `exteriorPower.map`\\n \u2022 `groupCohomology.map`\\n \u2022 `groupHomology.map`\\n \u2022 `lowerCentralSeries.map`\\n \u2022 `stdSimplex.map`\\n \u2022 `unitary.map`\\n \u2022 `upperCentralSeries.map`\\n \u2022 `AddCommGroup.DirectLimit.map`\\n \u2022 `AddCommGroup.ModEq.map`\\n \u2022 `AddMagma.FreeAddSemigroup.map`\\n \u2022 `AddMonoid.Coprod.map`\\n \u2022 `AddSubgroup.IsSubnormal.map`\\n \u2022 `AddSubgroup.Normal.map`\\n \u2022 `AddSubmonoid.FG.map`\\n \u2022 `AddSubmonoid.LocalizationMap.map`\\n \u2022 `AddValuation.IsEquiv.map`\\n \u2022 `AdicCompletion.AdicCauchySequence.map`\\n \u2022 `Aesop.EMap.map`\\n \u2022 `Aesop.FVarIdSubst.map`\\n \u2022 `Aesop.InstMap.map`\\n \u2022 `Aesop.Rule.map`\\n \u2022 `Aesop.RulePatternCache.map`\\n \u2022 `Aesop.VariableMap.map`\\n \u2022 `Affine.Simplex.map`\\n \u2022 `AffineSubspace.WOppSide.map`\\n \u2022 `AffineSubspace.WSameSide.map`\\n \u2022 `Algebra.H1Cotangent.map`\\n \u2022 `Algebra.PreSubmersivePresentation.map`\\n \u2022 `Algebra.TensorProduct.map`\\n \u2022 `AlgebraicGeometry.AffineSpace.map`\\n \u2022 `AlgebraicGeometry.Proj.map`\\n \u2022 `AlgebraicGeometry.Spec.map`\\n \u2022 `AlgebraicGeometry.tilde.map`\\n \u2022 `AlgebraicTopology.AlternatingCofaceMapComplex.map`\\n \u2022 `AlgebraicTopology.AlternatingFaceMapComplex.map`\\n \u2022 `AlgebraicTopology.NormalizedMooreComplex.map`\\n \u2022 `Array.mapFinIdxM.map`\\n \u2022 `Batteries.RBNode.map`\\n \u2022 `Batteries.RBSet.map`\\n \u2022 `Bialgebra.TensorProduct.map`\\n \u2022 `BoxIntegral.BoxAdditiveMap.map`\\n \u2022 `CategoryTheory.Bundled.map`\\n \u2022 `CategoryTheory.CategoryOfElements.map`\\n \u2022 `CategoryTheory.CommSq.map`\\n \u2022 `CategoryTheory.Comma.map`\\n \u2022 `CategoryTheory.CostructuredArrow.map`\\n \u2022 `CategoryTheory.EnrichedFunctor.map`\\n \u2022 `CategoryTheory.FreeGroupoid.map`\\n \u2022 `CategoryTheory.Functor.map`\\n \u2022 `CategoryTheory.map`\\n \u2022 `CategoryTheory.GradedObject.map`\\n \u2022 `CategoryTheory.Grothendieck.map`\\n \u2022 `CategoryTheory.IsHomLift.map`\\n \u2022 `CategoryTheory.IsPullback.map`\\n \u2022 `CategoryTheory.IsPushout.map`\\n \u2022 `CategoryTheory.IsSplitCoequalizer.map`\\n \u2022 `CategoryTheory.IsSplitEqualizer.map`\\n \u2022 `CategoryTheory.LocalizerMorphism.map`\\n \u2022 `CategoryTheory.MonoOver.map`\\n \u2022 `CategoryTheory.MorphismProperty.map`\\n \u2022 `CategoryTheory.ObjectProperty.map`\\n \u2022 `CategoryTheory.Over.map`\\n \u2022 `CategoryTheory.PreOneHypercover.map`\\n \u2022 `CategoryTheory.PreZeroHypercover.map`\\n \u2022 `CategoryTheory.Presieve.map`\\n \u2022 `CategoryTheory.Retract.map`\\n \u2022 `CategoryTheory.RetractArrow.map`\\n \u2022 `CategoryTheory.ShiftedHom.map`\\n \u2022 `CategoryTheory.ShortComplex.map`\\n \u2022 `CategoryTheory.Sigma.map`\\n \u2022 `CategoryTheory.SplitEpi.map`\\n \u2022 `CategoryTheory.SplitMono.map`\\n \u2022 `CategoryTheory.Square.map`\\n \u2022 `CategoryTheory.StrictlyUnitaryLaxFunctorCore.map`\\n \u2022 `CategoryTheory.StrictlyUnitaryPseudofunctorCore.map`\\n \u2022 `CategoryTheory.StructuredArrow.map`\\n \u2022 `CategoryTheory.Subfunctor.map`\\n \u2022 `CategoryTheory.Subgroupoid.map`\\n \u2022 `CategoryTheory.Subobject.map`\\n \u2022 `CategoryTheory.ThinSkeleton.map`\\n \u2022 `CategoryTheory.TransfiniteCompositionOfShape.map`\\n \u2022 `CategoryTheory.Under.map`\\n \u2022 `CategoryTheory.WithInitial.map`\\n \u2022 `CategoryTheory.WithTerminal.map`\\n \u2022 `CategoryTheory.wideSubcategoryInclusion.map`\\n \u2022 `Coalgebra.TensorProduct.map`\\n \u2022 `CochainComplex.ConnectData.map`\\n \u2022 `CochainComplex.mappingCone.map`\\n \u2022 `Combinatorics.Line.map`\\n \u2022 `CommRingCat.KaehlerDifferential.map`\\n \u2022 `DerivedCategory.triangleOfSES.map`\\n \u2022 `EStateM.Result.map`\\n \u2022 `Filter.Germ.map`\\n \u2022 `Filter.HasAntitoneBasis.map`\\n \u2022 `Filter.HasBasis.map`\\n \u2022 `Filter.NeBot.map`\\n \u2022 `Filter.Realizer.map`\\n \u2022 `Filter.Subsingleton.map`\\n \u2022 `Filter.TotallyBounded.map`\\n \u2022 `Finset.Nonempty.map`\\n \u2022 `Function.IsFixedPt.map`\\n \u2022 `Function.IsPeriodicPt.map`\\n \u2022 `Functor.Comp.map`\\n \u2022 `Functor.Const.map`\\n \u2022 `GenContFract.Pair.map`\\n \u2022 `Group.IsPerfect.map`\\n \u2022 `HomogeneousLocalization.Away.map`\\n \u2022 `HomogeneousLocalization.NumDenSameDeg.map`\\n \u2022 `HomologicalComplex\u2082.total.map`\\n \u2022 `Hyperreal.IsSt.map`\\n \u2022 `Ideal.FG.map`\\n \u2022 `Ideal.ResidueField.map`\\n \u2022 `Ideal.primaryComponent.map`\\n \u2022 `IntermediateField.LinearDisjoint.map`\\n \u2022 `IsLocalRing.ResidueField.map`\\n \u2022 `IsLocalization.Away.map`\\n \u2022 `Lean.AttributeExtensionState.map`\\n \u2022 `Lean.ClosedTermCache.map`\\n \u2022 `Lean.PersistentArray.map`\\n \u2022 `Lean.PersistentHashMap.map`\\n \u2022 `Lean.RBNode.map`\\n \u2022 `LieAlgebra.ExtendScalars.map`\\n \u2022 `List.Disjoint.map`\\n \u2022 `List.IsInfix.map`\\n \u2022 `List.IsPrefix.map`\\n \u2022 `List.IsRotated.map`\\n \u2022 `List.IsSuffix.map`\\n \u2022 `List.Nodup.map`\\n \u2022 `List.Pairwise.map`\\n \u2022 `List.Palindrome.map`\\n \u2022 `List.Perm.map`\\n \u2022 `List.Sublist.map`\\n \u2022 `List.Subperm.map`\\n \u2022 `List.Triplewise.map`\\n \u2022 `List.Vector.map`\\n \u2022 `List.Wbtw.map`\\n \u2022 `Magma.AssocQuotient.map`\\n \u2022 `Matrix.BlockTriangular.map`\\n \u2022 `Matrix.GeneralLinearGroup.map`\\n \u2022 `Matrix.IsDiag.map`\\n \u2022 `Matrix.IsHermitian.map`\\n \u2022 `Matrix.IsSymm.map`\\n \u2022 `Matrix.SpecialLinearGroup.map`\\n \u2022 `Matroid.Indep.map`\\n \u2022 `Matroid.IsBase.map`\\n \u2022 `Matroid.IsBasis.map`\\n \u2022 `MeasureTheory.FiniteMeasure.map`\\n \u2022 `MeasureTheory.IsTightMeasureSet.map`\\n \u2022 `MeasureTheory.Measure.map`\\n \u2022 `MeasureTheory.OuterMeasure.map`\\n \u2022 `MeasureTheory.ProbabilityMeasure.map`\\n \u2022 `MeasureTheory.SimpleFunc.map`\\n \u2022 `MeasureTheory.VectorMeasure.map`\\n \u2022 `Module.Basis.map`\\n \u2022 `Module.DirectLimit.map`\\n \u2022 `Module.Finite.map`\\n \u2022 `Module.Ray.map`\\n \u2022 `Module.Relations.map`\\n \u2022 `ModuleCat.exteriorPower.map`\\n \u2022 `Monoid.Coprod.map`\\n \u2022 `Multiset.Nodup.map`\\n \u2022 `MvPolynomial.IsHomogeneous.map`\\n \u2022 `MvPolynomial.IsSymmetric.map`\\n \u2022 `MvPowerSeries.HasEval.map`\\n \u2022 `MvPowerSeries.HasSubst.map`\\n \u2022 `MvQPF.Cofix.map`\\n \u2022 `MvQPF.Comp.map`\\n \u2022 `MvQPF.Const.map`\\n \u2022 `MvQPF.Fix.map`\\n \u2022 `MvQPF.Prj.map`\\n \u2022 `MvQPF.Quot1.map`\\n \u2022 `Nat.Partrec'.map`\\n \u2022 `NormedAddGroupHom.Equalizer.map`\\n \u2022 `OmegaCompletePartialOrder.Chain.map`\\n \u2022 `OmegaCompletePartialOrder.ContinuousHom.map`\\n \u2022 `Path.Homotopic.map`\\n \u2022 `Path.Homotopy.map`\\n \u2022 `Polynomial.IsRoot.map`\\n \u2022 `Polynomial.IsSplittingField.map`\\n \u2022 `Polynomial.IsWeaklyEisensteinAt.map`\\n \u2022 `Polynomial.Monic.map`\\n \u2022 `Polynomial.MonicDegreeEq.map`\\n \u2022 `Polynomial.Separable.map`\\n \u2022 `Polynomial.Splits.map`\\n \u2022 `PowerSeries.HasEval.map`\\n \u2022 `PrimeSpectrum.BasicConstructibleSetData.map`\\n \u2022 `PrimeSpectrum.ConstructibleSetData.map`\\n \u2022 `ProbabilityTheory.HasGaussianLaw.map`\\n \u2022 `ProbabilityTheory.HasIndepIncrements.map`\\n \u2022 `ProbabilityTheory.Kernel.map`\\n \u2022 `Profinite.IndexFunctor.map`\\n \u2022 `Quandle.Conj.map`\\n \u2022 `Rack.toEnvelGroup.map`\\n \u2022 `Representation.Coinvariants.map`\\n \u2022 `Ring.DirectLimit.map`\\n \u2022 `RingHom.IsIntegralElem.map`\\n \u2022 `SSet.Edge.map`\\n \u2022 `SSet.OneTruncation\u2082.map`\\n \u2022 `SSet.Path.map`\\n \u2022 `SSet.RelativeMorphism.map`\\n \u2022 `SSet.S.map`\\n \u2022 `SemiNormedGrp.explicitCokernel.map`\\n \u2022 `Set.Finite.map`\\n \u2022 `Set.powersetCard.map`\\n \u2022 `SheafOfModules.Presentation.map`\\n \u2022 `SimpleGraph.Colorable.map`\\n \u2022 `SimpleGraph.Connected.map`\\n \u2022 `SimpleGraph.ConnectedComponent.map`\\n \u2022 `SimpleGraph.EdgeDisjointTriangles.map`\\n \u2022 `SimpleGraph.Embedding.map`\\n \u2022 `SimpleGraph.IsClique.map`\\n \u2022 `SimpleGraph.IsNClique.map`\\n \u2022 `SimpleGraph.Iso.map`\\n \u2022 `SimpleGraph.LocallyLinear.map`\\n \u2022 `SimpleGraph.Path.map`\\n \u2022 `SimpleGraph.Preconnected.map`\\n \u2022 `SimpleGraph.Reachable.map`\\n \u2022 `SimpleGraph.Subgraph.map`\\n \u2022 `SimpleGraph.Walk.map`\\n \u2022 `StandardEtalePair.HasMap.map`\\n \u2022 `Std.DHashMap.map`\\n \u2022 `Std.DTreeMap.map`\\n \u2022 `Std.ExtDHashMap.map`\\n \u2022 `Std.ExtDTreeMap.map`\\n \u2022 `Std.ExtHashMap.map`\\n \u2022 `Std.ExtTreeMap.map`\\n \u2022 `Std.HashMap.map`\\n \u2022 `Std.Iter.map`\\n \u2022 `Std.IterM.map`\\n \u2022 `Std.TreeMap.map`\\n \u2022 `Stream'.Seq.map`\\n \u2022 `Stream'.Seq1.map`\\n \u2022 `Stream'.WSeq.map`\\n \u2022 `String.Legacy.map`\\n \u2022 `Subalgebra.FG.map`\\n \u2022 `Subalgebra.LinearDisjoint.map`\\n \u2022 `Subgroup.IsNormalClosureFG.map`\\n \u2022 `Subgroup.IsSubnormal.map`\\n \u2022 `Subgroup.Normal.map`\\n \u2022 `Submodule.FG.map`\\n \u2022 `Submodule.IsOrtho.map`\\n \u2022 `Submodule.IsPrincipal.map`\\n \u2022 `Submodule.LinearDisjoint.map`\\n \u2022 `Submonoid.FG.map`\\n \u2022 `Submonoid.LocalizationMap.map`\\n \u2022 `Sym2.IsDiag.map`\\n \u2022 `TensorProduct.AlgebraTensorModule.map`\\n \u2022 `TensorProduct.LieModule.map`\\n \u2022 `TopCat.continuousFunctions.map`\\n \u2022 `TopologicalSpace.CompactOpens.map`\\n \u2022 `TopologicalSpace.Compacts.map`\\n \u2022 `TopologicalSpace.IrreducibleCloseds.map`\\n \u2022 `TopologicalSpace.NonemptyCompacts.map`\\n \u2022 `TopologicalSpace.OpenNhds.map`\\n \u2022 `TopologicalSpace.Opens.map`\\n \u2022 `TopologicalSpace.PositiveCompacts.map`\\n \u2022 `Topology.CWComplex.map`\\n \u2022 `Topology.RelCWComplex.map`\\n \u2022 `Topology.WithLowerSet.map`\\n \u2022 `Topology.WithUpperSet.map`\\n \u2022 `Turing.ListBlank.map`\\n \u2022 `Turing.Tape.map`\\n \u2022 `TypeVec.prod.map`\\n \u2022 `UniformSpace.Completion.map`\\n \u2022 `Valuation.IsEquiv.map`\\n \u2022 `Vector.mapFinIdxM.map`\\n \u2022 `WeierstrassCurve.VariableChange.map`\\n \u2022 `WittVector.IsPoly.map`\\n \u2022 `WittVector.IsPoly\u2082.map`\\n \u2022 `Algebra.Extension.Cotangent.map`\\n \u2022 `Algebra.Extension.CotangentSpace.map`\\n \u2022 `Algebra.Extension.H1Cotangent.map`\\n \u2022 `AlgebraicGeometry.Scheme.IdealSheafData.map`\\n \u2022 `AlgebraicTopology.DoldKan.\u0393\u2080.map`\\n \u2022 `Batteries.RBNode.All.map`\\n \u2022 `Batteries.RBNode.Balanced.map`\\n \u2022 `Batteries.RBNode.Ordered.map`\\n \u2022 `CategoryTheory.Abelian.SpectralObject.map`\\n \u2022 `CategoryTheory.ComposableArrows.Mk\u2081.map`\\n \u2022 `CategoryTheory.ComposableArrows.Precomp.map`\\n \u2022 `CategoryTheory.Functor.HomObj.map`\\n \u2022 `CategoryTheory.Functor.IsCartesian.map`\\n \u2022 `CategoryTheory.Functor.IsCocartesian.map`\\n \u2022 `CategoryTheory.Functor.IsHomLift.map`\\n \u2022 `CategoryTheory.Functor.IsStronglyCartesian.map`\\n \u2022 `CategoryTheory.Functor.IsStronglyCocartesian.map`\\n \u2022 `CategoryTheory.Functor.OfSequence.map`\\n \u2022 `CategoryTheory.Functor.relativelyRepresentable.map`\\n \u2022 `CategoryTheory.GrothendieckTopology.OneHypercover.map`\\n \u2022 `CategoryTheory.GrothendieckTopology.Point.map`\\n \u2022 `CategoryTheory.Idempotents.FunctorExtension\u2081.map`\\n \u2022 `CategoryTheory.Idempotents.KaroubiFunctorCategoryEmbedding.map`\\n \u2022 `CategoryTheory.Limits.CokernelCofork.map`\\n \u2022 `CategoryTheory.Limits.ColimitPresentation.map`\\n \u2022 `CategoryTheory.Limits.DiagramOfCocones.map`\\n \u2022 `CategoryTheory.Limits.DiagramOfCones.map`\\n \u2022 `CategoryTheory.Limits.ImageMap.map`\\n \u2022 `CategoryTheory.Limits.IsColimit.map`\\n \u2022 `CategoryTheory.Limits.IsIndObject.map`\\n \u2022 `CategoryTheory.Limits.IsLimit.map`\\n \u2022 `CategoryTheory.Limits.IsZero.map`\\n \u2022 `CategoryTheory.Limits.KernelFork.map`\\n \u2022 `CategoryTheory.Limits.LimitPresentation.map`\\n \u2022 `CategoryTheory.Limits.Multicofork.map`\\n \u2022 `CategoryTheory.Limits.MultispanIndex.map`\\n \u2022 `CategoryTheory.Limits.Pi.map`\\n \u2022 `CategoryTheory.Limits.PullbackCone.map`\\n \u2022 `CategoryTheory.Limits.PushoutCocone.map`\\n \u2022 `CategoryTheory.Limits.Sigma.map`\\n \u2022 `CategoryTheory.Limits.biprod.map`\\n \u2022 `CategoryTheory.Limits.biproduct.map`\\n \u2022 `CategoryTheory.Limits.coend.map`\\n \u2022 `CategoryTheory.Limits.cokernel.map`\\n \u2022 `CategoryTheory.Limits.coprod.map`\\n \u2022 `CategoryTheory.Limits.end_.map`\\n \u2022 `CategoryTheory.Limits.image.map`\\n \u2022 `CategoryTheory.Limits.kernel.map`\\n \u2022 `CategoryTheory.Limits.prod.map`\\n \u2022 `CategoryTheory.Limits.pullback.map`\\n \u2022 `CategoryTheory.Limits.pushout.map`\\n \u2022 `CategoryTheory.MonoidalCategory.DayConvolution.map`\\n \u2022 `CategoryTheory.MonoidalCategory.DayConvolutionInternalHom.map`\\n \u2022 `CategoryTheory.MorphismProperty.LeftFraction.map`\\n \u2022 `CategoryTheory.MorphismProperty.Over.map`\\n \u2022 `CategoryTheory.MorphismProperty.RightFraction.map`\\n \u2022 `CategoryTheory.MorphismProperty.TransfiniteCompositionOfShape.map`\\n \u2022 `CategoryTheory.MorphismProperty.strictMap.map`\\n \u2022 `CategoryTheory.Precoverage.ZeroHypercover.map`\\n \u2022 `CategoryTheory.Presieve.CoverByImageStructure.map`\\n \u2022 `CategoryTheory.Presieve.FamilyOfElements.map`\\n \u2022 `CategoryTheory.Pseudofunctor.CoGrothendieck.map`\\n \u2022 `CategoryTheory.Pseudofunctor.Grothendieck.map`\\n \u2022 `CategoryTheory.Pseudofunctor.ObjectProperty.map`\\n \u2022 `CategoryTheory.ShortComplex.Exact.map`\\n \u2022 `CategoryTheory.ShortComplex.HomologyData.map`\\n \u2022 `CategoryTheory.ShortComplex.HomologyMapData.map`\\n \u2022 `CategoryTheory.ShortComplex.LeftHomologyData.map`\\n \u2022 `CategoryTheory.ShortComplex.LeftHomologyMapData.map`\\n \u2022 `CategoryTheory.ShortComplex.RightHomologyData.map`\\n \u2022 `CategoryTheory.ShortComplex.RightHomologyMapData.map`\\n \u2022 `CategoryTheory.ShortComplex.ShortExact.map`\\n \u2022 `CategoryTheory.ShortComplex.Splitting.map`\\n \u2022 `CategoryTheory.Square.IsPullback.map`\\n \u2022 `CategoryTheory.Square.IsPushout.map`\\n \u2022 `CategoryTheory.Triangulated.Octahedron.map`\\n \u2022 `CochainComplex.HomComplex.Cochain.map`\\n \u2022 `CommRingCat.Colimits.Relation.map`\\n \u2022 `ComputeAsymptotics.MultiseriesExpansion.Multiseries.map`\\n \u2022 `FirstOrder.Language.Substructure.map`\\n \u2022 `Lean.Export.Alloc.map`\\n \u2022 `Lean.Language.SnapshotTask.map`\\n \u2022 `Lean.Meta.CustomEliminators.map`\\n \u2022 `Lean.Meta.FVarSubst.map`\\n \u2022 `Lean.Meta.KExprMap.map`\\n \u2022 `Lean.Meta.MVarRenaming.map`\\n \u2022 `Lean.Omega.Coeffs.map`\\n \u2022 `Lean.Omega.Constraint.map`\\n \u2022 `Lean.ScopedEnvExtension.ScopedEntries.map`\\n \u2022 `Lean.Widget.TaggedText.map`\\n \u2022 `MeasureTheory.Measure.AbsolutelyContinuous.map`\\n \u2022 `MeasureTheory.Measure.InnerRegular.map`\\n \u2022 `MeasureTheory.Measure.InnerRegularWRT.map`\\n \u2022 `MeasureTheory.Measure.IsFiniteMeasureOnCompacts.map`\\n \u2022 `MeasureTheory.Measure.OuterRegular.map`\\n \u2022 `MeasureTheory.Measure.Regular.map`\\n \u2022 `MeasureTheory.SimpleFunc.FinMeasSupp.map`\\n \u2022 `MeasureTheory.VectorMeasure.AbsolutelyContinuous.map`\\n \u2022 `ModuleCat.ExtendRestrictScalarsAdj.Counit.map`\\n \u2022 `ModuleCat.ExtendRestrictScalarsAdj.Unit.map`\\n \u2022 `MonCat.Colimits.Relation.map`\\n \u2022 `OmegaCompletePartialOrder.ContinuousHom.\u03c9ScottContinuous.map`\\n \u2022 `Path.Homotopic.Quotient.map`\\n \u2022 `ProbabilityTheory.Kernel.IsFiniteKernel.map`\\n \u2022 `ProbabilityTheory.Kernel.IsMarkovKernel.map`\\n \u2022 `ProbabilityTheory.Kernel.IsSFiniteKernel.map`\\n \u2022 `ProbabilityTheory.Kernel.IsZeroOrMarkovKernel.map`\\n \u2022 `RingCat.Colimits.Relation.map`\\n \u2022 `SSet.Edge.CompStruct.map`\\n \u2022 `SSet.PtSimplex.MulStruct.map`\\n \u2022 `SSet.PtSimplex.RelStruct.map`\\n \u2022 `SSet.Truncated.Edge.map`\\n \u2022 `SSet.Truncated.Path.map`\\n \u2022 `SimpleGraph.Subgraph.Connected.map`\\n \u2022 `SimpleGraph.Subgraph.IsMatching.map`\\n \u2022 `SimpleGraph.Subgraph.Preconnected.map`\\n \u2022 `SimpleGraph.Walk.IsCycle.map`\\n \u2022 `SimpleGraph.Walk.IsHamiltonian.map`\\n \u2022 `SimpleGraph.Walk.IsHamiltonianCycle.map`\\n \u2022 `SimpleGraph.Walk.IsSubwalk.map`\\n \u2022 `Std.DHashMap.Equiv.map`\\n \u2022 `Std.DHashMap.Raw.map`\\n \u2022 `Std.DTreeMap.Equiv.map`\\n \u2022 `Std.DTreeMap.Raw.map`\\n \u2022 `Std.Do.Spec.map`\\n \u2022 `Std.Do.WP.map`\\n \u2022 `Std.HashMap.Equiv.map`\\n \u2022 `Std.HashMap.Raw.map`\\n \u2022 `Std.Internal.Small.map`\\n \u2022 `Std.IterM.Equiv.map`\\n \u2022 `Std.IterM.InternalCombinators.map`\\n \u2022 `Std.Iterators.HetT.map`\\n \u2022 `Std.Iterators.PostconditionT.map`\\n \u2022 `Std.TreeMap.Equiv.map`\\n \u2022 `Std.TreeMap.Raw.map`\\n \u2022 `TopCat.Presheaf.SubmonoidPresheaf.map`\\n \u2022 `Turing.TM0.Cfg.map`\\n \u2022 `Turing.TM0.Machine.map`\\n \u2022 `Turing.TM0.Stmt.map`\\n \u2022 `WeierstrassCurve.Affine.CoordinateRing.map`\\n \u2022 `WeierstrassCurve.Affine.Equation.map`\\n \u2022 `WeierstrassCurve.Affine.Point.map`\\n \u2022 `WeierstrassCurve.Jacobian.Equation.map`\\n \u2022 `WeierstrassCurve.Projective.Equation.map`\\n \u2022 `AlgebraicTopology.DoldKan.\u0393\u2080.Obj.map`\\n \u2022 `CategoryTheory.GrothendieckTopology.Cover.Arrow.map`\\n \u2022 `CategoryTheory.HasLiftingProperty.transfiniteComposition.SqStruct.map`\\n \u2022 `CategoryTheory.Idempotents.KaroubiHomologicalComplexEquivalence.Functor.map`\\n \u2022 `CategoryTheory.Idempotents.KaroubiHomologicalComplexEquivalence.Inverse.map`\\n \u2022 `CategoryTheory.Presieve.FamilyOfElements.Compatible.map`\\n \u2022 `CategoryTheory.Presieve.FamilyOfElements.IsAmalgamation.map`\\n \u2022 `CategoryTheory.ShortComplex.ShortExact.singleTriangle.map`\\n \u2022 `CategoryTheory.SimplicialObject.Augmented.ExtraDegeneracy.map`\\n \u2022 `CategoryTheory.SmallObject.SuccStruct.extendToSucc.map`\\n \u2022 `CategoryTheory.SmallObject.SuccStruct.ofCocone.map`\\n \u2022 `CommRingCat.Colimits.Relation.below.map`\\n \u2022 `FirstOrder.Language.Substructure.CG.map`\\n \u2022 `FirstOrder.Language.Substructure.FG.map`\\n \u2022 `Lean.Compiler.CSimp.State.map`\\n \u2022 `Lean.Compiler.LCNF.Probe.map`\\n \u2022 `Lean.Meta.Grind.SymbolPriorities.map`\\n \u2022 `Lean.Meta.Grind.VarRename.map`\\n \u2022 `Lean.Meta.Match.MatchEqnsExtState.map`\\n \u2022 `Lean.Meta.Match.Overlaps.map`\\n \u2022 `Lean.Meta.Simp.UsedSimps.map`\\n \u2022 `MonCat.Colimits.Relation.below.map`\\n \u2022 `RingCat.Colimits.Relation.below.map`\\n \u2022 `SSet.Truncated.Edge.CompStruct.map`\\n \u2022 `Std.DHashMap.Internal.AssocList.map`\\n \u2022 `Std.DHashMap.Internal.Raw\u2080.map`\\n \u2022 `Std.DHashMap.Raw.Equiv.map`\\n \u2022 `Std.DHashMap.Raw.WF.map`\\n \u2022 `Std.DTreeMap.Internal.Impl.map`\\n \u2022 `Std.DTreeMap.Raw.Equiv.map`\\n \u2022 `Std.HashMap.Raw.Equiv.map`\\n \u2022 `Std.HashMap.Raw.WF.map`\\n \u2022 `Std.Internal.List.DistinctKeys.map`\\n \u2022 `Std.Sat.AIG.RefVec.map`\\n \u2022 `Std.TreeMap.Raw.Equiv.map`\\n \u2022 `CategoryTheory.GrothendieckTopology.Cover.Arrow.Relation.map`\\n \u2022 `CategoryTheory.MorphismProperty.LeftFraction.Localization.Hom.map`\\n \u2022 `Lean.Compiler.LCNF.CSE.State.map`\\n \u2022 `Lean.Compiler.LCNF.NormLevelParam.State.map`\\n \u2022 `Lean.Compiler.LCNF.Simp.FunDeclInfoMap.map`\\n \u2022 `Lean.Meta.Grind.UnitLike.State.map`\\n \u2022 `Lean.Meta.Match.Extension.State.map`\\n \u2022 `Std.DTreeMap.Internal.Impl.Balanced.map`\\n \u2022 `Std.DTreeMap.Internal.Impl.Equiv.map`\\n \u2022 `Std.DTreeMap.Internal.Impl.WF.map`\\n \u2022 `Std.Internal.IO.Async.AsyncTask.map`\\n \u2022 `Std.Internal.IO.Async.BaseAsync.map`\\n \u2022 `Std.Internal.IO.Async.EAsync.map`\\n \u2022 `Std.Internal.IO.Async.ETask.map`\\n \u2022 `Std.Internal.IO.Async.MaybeTask.map`\\n \u2022 `Std.Sat.AIG.RelabelNat.State.map`\\n \u2022 `Std.Tactic.BVDecide.BVExpr.Cache.map`\", pos=Position(line=2, column=4), pos_end=Position(line=2, column=40), severity=, kind='lean.invalidField._namedError'), Message(data=\"Function expected at\\n Spec\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n R\\n\\nHint: The identifier `Spec` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=44), pos_end=Position(line=2, column=50), severity=, kind=None), Message(data='unsolved goals\\nx\u271d : Sort u_1\\nSpec : x\u271d\\n\u22a2 sorry = sorry', pos=Position(line=3, column=3), pos_end=Position(line=3, column=29), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=122, i_end=224, 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=23), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=224, i_end=252, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=252, i_end=285, messages=[Message(data='Function expected at\\n Spec\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n R', pos=Position(line=10, column=18), pos_end=Position(line=10, column=24), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=285, i_end=303, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=303, i_end=561, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=20, column=13), 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": 27044, "declarations_count": 1906, "diagnostics_count": 1, "duplicate_fingerprint": "d9e63bfef9b75a6e", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 10179, "lean_code_chars": 537, "lean_code_ratio": 0.0199, "length_bucket": "long", "line_count": 31, "natural_language_chars": 26507, "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.AlgebraicGeometry.Stalk).", "role": "system"}, {"content": "The following Lean code fails to compile. Fix it.\n\n```lean\nlemma Spec_stalkClosedPointIso :\n Spec.map (stalkClosedPointIso R).inv = (Spec R).fromSpecStalk (closedPoint R)\n:= by thisIsWrongLemmaNameXYZ\nrw [stalkClosedPointIso_inv, Spec.fromSpecStalk_eq']\n\nend stalkClosedPointIso\n\nsection stalkClosedPointTo\n\nvariable {R} (f : Spec R \u27f6 X)\n\nnamespace Scheme\n\n/--\nGiven a local ring `(R, \ud835\udd2a)` and a morphism `f : Spec R \u27f6 X`,\nthey induce a (local) ring homomorphism `\u03c6 : \ud835\udcaa_{X, f \ud835\udd2a} \u27f6 R`.\n\nThis is inverse to `\u03c6 \u21a6 Spec.map \u03c6 \u226b X.fromSpecStalk (f \ud835\udd2a)`. See `SpecToEquivOfLocalRing`.\n-/\nnoncomputable\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=122, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None), Message(data=\"Invalid field notation: Type of\\n Spec\\nis not known; cannot resolve field `map`\\n\\nHint: Consider replacing the field projection with a call to one of the following:\\n \u2022 `Abelianization.map`\\n \u2022 `AbstractCompletion.map`\\n \u2022 `AccPt.map`\\n \u2022 `AddCommute.map`\\n \u2022 `AddCon.map`\\n \u2022 `AddConjClasses.map`\\n \u2022 `AddIrreducible.map`\\n \u2022 `AddMonoidAlgebra.map`\\n \u2022 `AddSemiconjBy.map`\\n \u2022 `AddSubgroup.map`\\n \u2022 `AddSubmonoid.map`\\n \u2022 `AddSubsemigroup.map`\\n \u2022 `AddUnits.map`\\n \u2022 `AddValuation.map`\\n \u2022 `AdicCompletion.map`\\n \u2022 `AdjoinRoot.map`\\n \u2022 `AffineSubspace.map`\\n \u2022 `AlgebraicIndependent.map`\\n \u2022 `Array.map`\\n \u2022 `Associated.map`\\n \u2022 `BaseIO.map`\\n \u2022 `Behrend.map`\\n \u2022 `BooleanSubalgebra.map`\\n \u2022 `ByteArray.map`\\n \u2022 `CStarMatrix.map`\\n \u2022 `Cardinal.map`\\n \u2022 `Cauchy.map`\\n \u2022 `CliffordAlgebra.map`\\n \u2022 `ClosedSubmodule.map`\\n \u2022 `ClusterPt.map`\\n \u2022 `Codisjoint.map`\\n \u2022 `Commute.map`\\n \u2022 `CompleteOrthogonalIdempotents.map`\\n \u2022 `CompleteSublattice.map`\\n \u2022 `Computation.map`\\n \u2022 `Con.map`\\n \u2022 `ConjClasses.map`\\n \u2022 `ContT.map`\\n \u2022 `ConvexCone.map`\\n \u2022 `CoxeterSystem.map`\\n \u2022 `Cubic.map`\\n \u2022 `Cycle.map`\\n \u2022 `DMatrix.map`\\n \u2022 `DirectLimit.map`\\n \u2022 `DirectSum.map`\\n \u2022 `DiscreteQuotient.map`\\n \u2022 `Disjoint.map`\\n \u2022 `EIO.map`\\n \u2022 `ENat.map`\\n \u2022 `EStateM.map`\\n \u2022 `Equiv.map`\\n \u2022 `EquivFunctor.map`\\n \u2022 `Erased.map`\\n \u2022 `Even.map`\\n \u2022 `Except.map`\\n \u2022 `ExceptT.map`\\n \u2022 `ExteriorAlgebra.map`\\n \u2022 `Filter.map`\\n \u2022 `FinVec.map`\\n \u2022 `Finpartition.map`\\n \u2022 `Finset.map`\\n \u2022 `Flag.map`\\n \u2022 `FloatArray.map`\\n \u2022 `FractionalIdeal.map`\\n \u2022 `FreeAbelianGroup.map`\\n \u2022 `FreeAddGroup.map`\\n \u2022 `FreeAddMagma.map`\\n \u2022 `FreeAddMonoid.map`\\n \u2022 `FreeAddSemigroup.map`\\n \u2022 `FreeCommRing.map`\\n \u2022 `FreeGroup.map`\\n \u2022 `FreeGroupBasis.map`\\n \u2022 `FreeMagma.map`\\n \u2022 `FreeMonoid.map`\\n \u2022 `FreeRing.map`\\n \u2022 `FreeSemigroup.map`\\n \u2022 `FunOnFinite.map`\\n \u2022 `Functor.map`\\n \u2022 `FundamentalGroup.map`\\n \u2022 `FundamentalGroupoid.map`\\n \u2022 `HahnSeries.map`\\n \u2022 `HasProd.map`\\n \u2022 `HasSum.map`\\n \u2022 `HomogeneousIdeal.map`\\n \u2022 `HomogeneousLocalization.map`\\n \u2022 `Ideal.map`\\n \u2022 `Inseparable.map`\\n \u2022 `IntermediateField.map`\\n \u2022 `Interval.map`\\n \u2022 `Invertible.map`\\n \u2022 `Irreducible.map`\\n \u2022 `IsAddUnit.map`\\n \u2022 `IsAdjoinRoot.map`\\n \u2022 `IsCompl.map`\\n \u2022 `IsCoprime.map`\\n \u2022 `IsFractionRing.map`\\n \u2022 `IsFractional.map`\\n \u2022 `IsGroupLikeElem.map`\\n \u2022 `IsIdempotentElem.map`\\n \u2022 `IsIntegral.map`\\n \u2022 `IsLocalization.map`\\n \u2022 `IsLocalizedModule.map`\\n \u2022 `IsNilpotent.map`\\n \u2022 `IsPGroup.map`\\n \u2022 `IsQuasiregular.map`\\n \u2022 `IsSMulRegular.map`\\n \u2022 `IsSelfAdjoint.map`\\n \u2022 `IsSeparable.map`\\n \u2022 `IsSquare.map`\\n \u2022 `IsStarNormal.map`\\n \u2022 `IsStarProjection.map`\\n \u2022 `IsTensorProduct.map`\\n \u2022 `IsTopologicallyNilpotent.map`\\n \u2022 `IsUnit.map`\\n \u2022 `JoinedIn.map`\\n \u2022 `KaehlerDifferential.map`\\n \u2022 `LTSeries.map`\\n \u2022 `Language.map`\\n \u2022 `LieIdeal.map`\\n \u2022 `LieSubalgebra.map`\\n \u2022 `LieSubmodule.map`\\n \u2022 `LinearIndependent.map`\\n \u2022 `List.map`\\n \u2022 `LocalSubring.map`\\n \u2022 `LocalizedModule.map`\\n \u2022 `LocallyConstant.map`\\n \u2022 `LowerSet.map`\\n \u2022 `MLList.map`\\n \u2022 `Matrix.map`\\n \u2022 `Matroid.map`\\n \u2022 `MeasurableSpace.map`\\n \u2022 `MonoidAlgebra.map`\\n \u2022 `MultilinearMap.map`\\n \u2022 `Multipliable.map`\\n \u2022 `Multiset.map`\\n \u2022 `MvFunctor.map`\\n \u2022 `MvPFunctor.map`\\n \u2022 `MvPolynomial.map`\\n \u2022 `MvPowerSeries.map`\\n \u2022 `NonUnitalStarSubalgebra.map`\\n \u2022 `NonUnitalSubalgebra.map`\\n \u2022 `NonUnitalSubring.map`\\n \u2022 `NonUnitalSubsemiring.map`\\n \u2022 `Nondet.map`\\n \u2022 `Nonempty.map`\\n \u2022 `NonemptyInterval.map`\\n \u2022 `Odd.map`\\n \u2022 `OnePoint.map`\\n \u2022 `Option.map`\\n \u2022 `Ordnode.map`\\n \u2022 `Ordset.map`\\n \u2022 `Orientation.map`\\n \u2022 `OrthogonalIdempotents.map`\\n \u2022 `OrthonormalBasis.map`\\n \u2022 `PFun.map`\\n \u2022 `PFunctor.map`\\n \u2022 `PLift.map`\\n \u2022 `PMF.map`\\n \u2022 `PSigma.map`\\n \u2022 `Part.map`\\n \u2022 `Partrec.map`\\n \u2022 `Path.map`\\n \u2022 `Perfection.map`\\n \u2022 `PerfectionMap.map`\\n \u2022 `Pi.map`\\n \u2022 `PiTensorProduct.map`\\n \u2022 `PointedCone.map`\\n \u2022 `Poly.map`\\n \u2022 `Polynomial.map`\\n \u2022 `PolynomialModule.map`\\n \u2022 `PontryaginDual.map`\\n \u2022 `PowerBasis.map`\\n \u2022 `PowerSeries.map`\\n \u2022 `PreAbstractSimplicialComplex.map`\\n \u2022 `Prefunctor.map`\\n \u2022 `PresheafOfModules.map`\\n \u2022 `Prod.map`\\n \u2022 `Projectivization.map`\\n \u2022 `ProperCone.map`\\n \u2022 `Quot.map`\\n \u2022 `QuotSMulTop.map`\\n \u2022 `Quotient.map`\\n \u2022 `QuotientAddGroup.map`\\n \u2022 `QuotientGroup.map`\\n \u2022 `RCLike.map`\\n \u2022 `RatFunc.map`\\n \u2022 `RegularExpression.map`\\n \u2022 `RelSeries.map`\\n \u2022 `RestrictedProduct.map`\\n \u2022 `RingCon.map`\\n \u2022 `RootPairing.map`\\n \u2022 `SModEq.map`\\n \u2022 `SameRay.map`\\n \u2022 `SatisfiesM.map`\\n \u2022 `SemiconjBy.map`\\n \u2022 `SemidirectProduct.map`\\n \u2022 `Semiquot.map`\\n \u2022 `SeparationQuotient.map`\\n \u2022 `Setoid.map`\\n \u2022 `Sigma.map`\\n \u2022 `SimpleGraph.map`\\n \u2022 `SingularManifold.map`\\n \u2022 `SlashAction.map`\\n \u2022 `Specialization.map`\\n \u2022 `Specializes.map`\\n \u2022 `StandardEtalePair.map`\\n \u2022 `StarSubalgebra.map`\\n \u2022 `StateT.map`\\n \u2022 `StdSimplex.map`\\n \u2022 `Stream'.map`\\n \u2022 `String.map`\\n \u2022 `Subalgebra.map`\\n \u2022 `Subfield.map`\\n \u2022 `Subgroup.map`\\n \u2022 `Sublattice.map`\\n \u2022 `Submodule.map`\\n \u2022 `Submonoid.map`\\n \u2022 `Subring.map`\\n \u2022 `Subsemigroup.map`\\n \u2022 `Subsemiring.map`\\n \u2022 `Subtype.map`\\n \u2022 `Sum.map`\\n \u2022 `Summable.map`\\n \u2022 `SummationFilter.map`\\n \u2022 `Sym.map`\\n \u2022 `Sym2.map`\\n \u2022 `Task.map`\\n \u2022 `TensorProduct.map`\\n \u2022 `Thunk.map`\\n \u2022 `Tree.map`\\n \u2022 `TrivSqZeroExt.map`\\n \u2022 `Trunc.map`\\n \u2022 `TwoSidedIdeal.map`\\n \u2022 `ULift.map`\\n \u2022 `Ultrafilter.map`\\n \u2022 `Unitary.map`\\n \u2022 `Units.map`\\n \u2022 `UpperSet.map`\\n \u2022 `Valuation.map`\\n \u2022 `Vector.map`\\n \u2022 `Wbtw.map`\\n \u2022 `WeakSpace.map`\\n \u2022 `WeierstrassCurve.map`\\n \u2022 `WithAbs.map`\\n \u2022 `WithBot.map`\\n \u2022 `WithLp.map`\\n \u2022 `WithOne.map`\\n \u2022 `WithTop.map`\\n \u2022 `WithVal.map`\\n \u2022 `WithZero.map`\\n \u2022 `WittVector.map`\\n \u2022 `ZFSet.map`\\n \u2022 `ZSpan.map`\\n \u2022 `bernsteinPolynomial.map`\\n \u2022 `exteriorPower.map`\\n \u2022 `groupCohomology.map`\\n \u2022 `groupHomology.map`\\n \u2022 `lowerCentralSeries.map`\\n \u2022 `stdSimplex.map`\\n \u2022 `unitary.map`\\n \u2022 `upperCentralSeries.map`\\n \u2022 `AddCommGroup.DirectLimit.map`\\n \u2022 `AddCommGroup.ModEq.map`\\n \u2022 `AddMagma.FreeAddSemigroup.map`\\n \u2022 `AddMonoid.Coprod.map`\\n \u2022 `AddSubgroup.IsSubnormal.map`\\n \u2022 `AddSubgroup.Normal.map`\\n \u2022 `AddSubmonoid.FG.map`\\n \u2022 `AddSubmonoid.LocalizationMap.map`\\n \u2022 `AddValuation.IsEquiv.map`\\n \u2022 `AdicCompletion.AdicCauchySequence.map`\\n \u2022 `Aesop.EMap.map`\\n \u2022 `Aesop.FVarIdSubst.map`\\n \u2022 `Aesop.InstMap.map`\\n \u2022 `Aesop.Rule.map`\\n \u2022 `Aesop.RulePatternCache.map`\\n \u2022 `Aesop.VariableMap.map`\\n \u2022 `Affine.Simplex.map`\\n \u2022 `AffineSubspace.WOppSide.map`\\n \u2022 `AffineSubspace.WSameSide.map`\\n \u2022 `Algebra.H1Cotangent.map`\\n \u2022 `Algebra.PreSubmersivePresentation.map`\\n \u2022 `Algebra.TensorProduct.map`\\n \u2022 `AlgebraicGeometry.AffineSpace.map`\\n \u2022 `AlgebraicGeometry.Proj.map`\\n \u2022 `AlgebraicGeometry.Spec.map`\\n \u2022 `AlgebraicGeometry.tilde.map`\\n \u2022 `AlgebraicTopology.AlternatingCofaceMapComplex.map`\\n \u2022 `AlgebraicTopology.AlternatingFaceMapComplex.map`\\n \u2022 `AlgebraicTopology.NormalizedMooreComplex.map`\\n \u2022 `Array.mapFinIdxM.map`\\n \u2022 `Batteries.RBNode.map`\\n \u2022 `Batteries.RBSet.map`\\n \u2022 `Bialgebra.TensorProduct.map`\\n \u2022 `BoxIntegral.BoxAdditiveMap.map`\\n \u2022 `CategoryTheory.Bundled.map`\\n \u2022 `CategoryTheory.CategoryOfElements.map`\\n \u2022 `CategoryTheory.CommSq.map`\\n \u2022 `CategoryTheory.Comma.map`\\n \u2022 `CategoryTheory.CostructuredArrow.map`\\n \u2022 `CategoryTheory.EnrichedFunctor.map`\\n \u2022 `CategoryTheory.FreeGroupoid.map`\\n \u2022 `CategoryTheory.Functor.map`\\n \u2022 `CategoryTheory.map`\\n \u2022 `CategoryTheory.GradedObject.map`\\n \u2022 `CategoryTheory.Grothendieck.map`\\n \u2022 `CategoryTheory.IsHomLift.map`\\n \u2022 `CategoryTheory.IsPullback.map`\\n \u2022 `CategoryTheory.IsPushout.map`\\n \u2022 `CategoryTheory.IsSplitCoequalizer.map`\\n \u2022 `CategoryTheory.IsSplitEqualizer.map`\\n \u2022 `CategoryTheory.LocalizerMorphism.map`\\n \u2022 `CategoryTheory.MonoOver.map`\\n \u2022 `CategoryTheory.MorphismProperty.map`\\n \u2022 `CategoryTheory.ObjectProperty.map`\\n \u2022 `CategoryTheory.Over.map`\\n \u2022 `CategoryTheory.PreOneHypercover.map`\\n \u2022 `CategoryTheory.PreZeroHypercover.map`\\n \u2022 `CategoryTheory.Presieve.map`\\n \u2022 `CategoryTheory.Retract.map`\\n \u2022 `CategoryTheory.RetractArrow.map`\\n \u2022 `CategoryTheory.ShiftedHom.map`\\n \u2022 `CategoryTheory.ShortComplex.map`\\n \u2022 `CategoryTheory.Sigma.map`\\n \u2022 `CategoryTheory.SplitEpi.map`\\n \u2022 `CategoryTheory.SplitMono.map`\\n \u2022 `CategoryTheory.Square.map`\\n \u2022 `CategoryTheory.StrictlyUnitaryLaxFunctorCore.map`\\n \u2022 `CategoryTheory.StrictlyUnitaryPseudofunctorCore.map`\\n \u2022 `CategoryTheory.StructuredArrow.map`\\n \u2022 `CategoryTheory.Subfunctor.map`\\n \u2022 `CategoryTheory.Subgroupoid.map`\\n \u2022 `CategoryTheory.Subobject.map`\\n \u2022 `CategoryTheory.ThinSkeleton.map`\\n \u2022 `CategoryTheory.TransfiniteCompositionOfShape.map`\\n \u2022 `CategoryTheory.Under.map`\\n \u2022 `CategoryTheory.WithInitial.map`\\n \u2022 `CategoryTheory.WithTerminal.map`\\n \u2022 `CategoryTheory.wideSubcategoryInclusion.map`\\n \u2022 `Coalgebra.TensorProduct.map`\\n \u2022 `CochainComplex.ConnectData.map`\\n \u2022 `CochainComplex.mappingCone.map`\\n \u2022 `Combinatorics.Line.map`\\n \u2022 `CommRingCat.KaehlerDifferential.map`\\n \u2022 `DerivedCategory.triangleOfSES.map`\\n \u2022 `EStateM.Result.map`\\n \u2022 `Filter.Germ.map`\\n \u2022 `Filter.HasAntitoneBasis.map`\\n \u2022 `Filter.HasBasis.map`\\n \u2022 `Filter.NeBot.map`\\n \u2022 `Filter.Realizer.map`\\n \u2022 `Filter.Subsingleton.map`\\n \u2022 `Filter.TotallyBounded.map`\\n \u2022 `Finset.Nonempty.map`\\n \u2022 `Function.IsFixedPt.map`\\n \u2022 `Function.IsPeriodicPt.map`\\n \u2022 `Functor.Comp.map`\\n \u2022 `Functor.Const.map`\\n \u2022 `GenContFract.Pair.map`\\n \u2022 `Group.IsPerfect.map`\\n \u2022 `HomogeneousLocalization.Away.map`\\n \u2022 `HomogeneousLocalization.NumDenSameDeg.map`\\n \u2022 `HomologicalComplex\u2082.total.map`\\n \u2022 `Hyperreal.IsSt.map`\\n \u2022 `Ideal.FG.map`\\n \u2022 `Ideal.ResidueField.map`\\n \u2022 `Ideal.primaryComponent.map`\\n \u2022 `IntermediateField.LinearDisjoint.map`\\n \u2022 `IsLocalRing.ResidueField.map`\\n \u2022 `IsLocalization.Away.map`\\n \u2022 `Lean.AttributeExtensionState.map`\\n \u2022 `Lean.ClosedTermCache.map`\\n \u2022 `Lean.PersistentArray.map`\\n \u2022 `Lean.PersistentHashMap.map`\\n \u2022 `Lean.RBNode.map`\\n \u2022 `LieAlgebra.ExtendScalars.map`\\n \u2022 `List.Disjoint.map`\\n \u2022 `List.IsInfix.map`\\n \u2022 `List.IsPrefix.map`\\n \u2022 `List.IsRotated.map`\\n \u2022 `List.IsSuffix.map`\\n \u2022 `List.Nodup.map`\\n \u2022 `List.Pairwise.map`\\n \u2022 `List.Palindrome.map`\\n \u2022 `List.Perm.map`\\n \u2022 `List.Sublist.map`\\n \u2022 `List.Subperm.map`\\n \u2022 `List.Triplewise.map`\\n \u2022 `List.Vector.map`\\n \u2022 `List.Wbtw.map`\\n \u2022 `Magma.AssocQuotient.map`\\n \u2022 `Matrix.BlockTriangular.map`\\n \u2022 `Matrix.GeneralLinearGroup.map`\\n \u2022 `Matrix.IsDiag.map`\\n \u2022 `Matrix.IsHermitian.map`\\n \u2022 `Matrix.IsSymm.map`\\n \u2022 `Matrix.SpecialLinearGroup.map`\\n \u2022 `Matroid.Indep.map`\\n \u2022 `Matroid.IsBase.map`\\n \u2022 `Matroid.IsBasis.map`\\n \u2022 `MeasureTheory.FiniteMeasure.map`\\n \u2022 `MeasureTheory.IsTightMeasureSet.map`\\n \u2022 `MeasureTheory.Measure.map`\\n \u2022 `MeasureTheory.OuterMeasure.map`\\n \u2022 `MeasureTheory.ProbabilityMeasure.map`\\n \u2022 `MeasureTheory.SimpleFunc.map`\\n \u2022 `MeasureTheory.VectorMeasure.map`\\n \u2022 `Module.Basis.map`\\n \u2022 `Module.DirectLimit.map`\\n \u2022 `Module.Finite.map`\\n \u2022 `Module.Ray.map`\\n \u2022 `Module.Relations.map`\\n \u2022 `ModuleCat.exteriorPower.map`\\n \u2022 `Monoid.Coprod.map`\\n \u2022 `Multiset.Nodup.map`\\n \u2022 `MvPolynomial.IsHomogeneous.map`\\n \u2022 `MvPolynomial.IsSymmetric.map`\\n \u2022 `MvPowerSeries.HasEval.map`\\n \u2022 `MvPowerSeries.HasSubst.map`\\n \u2022 `MvQPF.Cofix.map`\\n \u2022 `MvQPF.Comp.map`\\n \u2022 `MvQPF.Const.map`\\n \u2022 `MvQPF.Fix.map`\\n \u2022 `MvQPF.Prj.map`\\n \u2022 `MvQPF.Quot1.map`\\n \u2022 `Nat.Partrec'.map`\\n \u2022 `NormedAddGroupHom.Equalizer.map`\\n \u2022 `OmegaCompletePartialOrder.Chain.map`\\n \u2022 `OmegaCompletePartialOrder.ContinuousHom.map`\\n \u2022 `Path.Homotopic.map`\\n \u2022 `Path.Homotopy.map`\\n \u2022 `Polynomial.IsRoot.map`\\n \u2022 `Polynomial.IsSplittingField.map`\\n \u2022 `Polynomial.IsWeaklyEisensteinAt.map`\\n \u2022 `Polynomial.Monic.map`\\n \u2022 `Polynomial.MonicDegreeEq.map`\\n \u2022 `Polynomial.Separable.map`\\n \u2022 `Polynomial.Splits.map`\\n \u2022 `PowerSeries.HasEval.map`\\n \u2022 `PrimeSpectrum.BasicConstructibleSetData.map`\\n \u2022 `PrimeSpectrum.ConstructibleSetData.map`\\n \u2022 `ProbabilityTheory.HasGaussianLaw.map`\\n \u2022 `ProbabilityTheory.HasIndepIncrements.map`\\n \u2022 `ProbabilityTheory.Kernel.map`\\n \u2022 `Profinite.IndexFunctor.map`\\n \u2022 `Quandle.Conj.map`\\n \u2022 `Rack.toEnvelGroup.map`\\n \u2022 `Representation.Coinvariants.map`\\n \u2022 `Ring.DirectLimit.map`\\n \u2022 `RingHom.IsIntegralElem.map`\\n \u2022 `SSet.Edge.map`\\n \u2022 `SSet.OneTruncation\u2082.map`\\n \u2022 `SSet.Path.map`\\n \u2022 `SSet.RelativeMorphism.map`\\n \u2022 `SSet.S.map`\\n \u2022 `SemiNormedGrp.explicitCokernel.map`\\n \u2022 `Set.Finite.map`\\n \u2022 `Set.powersetCard.map`\\n \u2022 `SheafOfModules.Presentation.map`\\n \u2022 `SimpleGraph.Colorable.map`\\n \u2022 `SimpleGraph.Connected.map`\\n \u2022 `SimpleGraph.ConnectedComponent.map`\\n \u2022 `SimpleGraph.EdgeDisjointTriangles.map`\\n \u2022 `SimpleGraph.Embedding.map`\\n \u2022 `SimpleGraph.IsClique.map`\\n \u2022 `SimpleGraph.IsNClique.map`\\n \u2022 `SimpleGraph.Iso.map`\\n \u2022 `SimpleGraph.LocallyLinear.map`\\n \u2022 `SimpleGraph.Path.map`\\n \u2022 `SimpleGraph.Preconnected.map`\\n \u2022 `SimpleGraph.Reachable.map`\\n \u2022 `SimpleGraph.Subgraph.map`\\n \u2022 `SimpleGraph.Walk.map`\\n \u2022 `StandardEtalePair.HasMap.map`\\n \u2022 `Std.DHashMap.map`\\n \u2022 `Std.DTreeMap.map`\\n \u2022 `Std.ExtDHashMap.map`\\n \u2022 `Std.ExtDTreeMap.map`\\n \u2022 `Std.ExtHashMap.map`\\n \u2022 `Std.ExtTreeMap.map`\\n \u2022 `Std.HashMap.map`\\n \u2022 `Std.Iter.map`\\n \u2022 `Std.IterM.map`\\n \u2022 `Std.TreeMap.map`\\n \u2022 `Stream'.Seq.map`\\n \u2022 `Stream'.Seq1.map`\\n \u2022 `Stream'.WSeq.map`\\n \u2022 `String.Legacy.map`\\n \u2022 `Subalgebra.FG.map`\\n \u2022 `Subalgebra.LinearDisjoint.map`\\n \u2022 `Subgroup.IsNormalClosureFG.map`\\n \u2022 `Subgroup.IsSubnormal.map`\\n \u2022 `Subgroup.Normal.map`\\n \u2022 `Submodule.FG.map`\\n \u2022 `Submodule.IsOrtho.map`\\n \u2022 `Submodule.IsPrincipal.map`\\n \u2022 `Submodule.LinearDisjoint.map`\\n \u2022 `Submonoid.FG.map`\\n \u2022 `Submonoid.LocalizationMap.map`\\n \u2022 `Sym2.IsDiag.map`\\n \u2022 `TensorProduct.AlgebraTensorModule.map`\\n \u2022 `TensorProduct.LieModule.map`\\n \u2022 `TopCat.continuousFunctions.map`\\n \u2022 `TopologicalSpace.CompactOpens.map`\\n \u2022 `TopologicalSpace.Compacts.map`\\n \u2022 `TopologicalSpace.IrreducibleCloseds.map`\\n \u2022 `TopologicalSpace.NonemptyCompacts.map`\\n \u2022 `TopologicalSpace.OpenNhds.map`\\n \u2022 `TopologicalSpace.Opens.map`\\n \u2022 `TopologicalSpace.PositiveCompacts.map`\\n \u2022 `Topology.CWComplex.map`\\n \u2022 `Topology.RelCWComplex.map`\\n \u2022 `Topology.WithLowerSet.map`\\n \u2022 `Topology.WithUpperSet.map`\\n \u2022 `Turing.ListBlank.map`\\n \u2022 `Turing.Tape.map`\\n \u2022 `TypeVec.prod.map`\\n \u2022 `UniformSpace.Completion.map`\\n \u2022 `Valuation.IsEquiv.map`\\n \u2022 `Vector.mapFinIdxM.map`\\n \u2022 `WeierstrassCurve.VariableChange.map`\\n \u2022 `WittVector.IsPoly.map`\\n \u2022 `WittVector.IsPoly\u2082.map`\\n \u2022 `Algebra.Extension.Cotangent.map`\\n \u2022 `Algebra.Extension.CotangentSpace.map`\\n \u2022 `Algebra.Extension.H1Cotangent.map`\\n \u2022 `AlgebraicGeometry.Scheme.IdealSheafData.map`\\n \u2022 `AlgebraicTopology.DoldKan.\u0393\u2080.map`\\n \u2022 `Batteries.RBNode.All.map`\\n \u2022 `Batteries.RBNode.Balanced.map`\\n \u2022 `Batteries.RBNode.Ordered.map`\\n \u2022 `CategoryTheory.Abelian.SpectralObject.map`\\n \u2022 `CategoryTheory.ComposableArrows.Mk\u2081.map`\\n \u2022 `CategoryTheory.ComposableArrows.Precomp.map`\\n \u2022 `CategoryTheory.Functor.HomObj.map`\\n \u2022 `CategoryTheory.Functor.IsCartesian.map`\\n \u2022 `CategoryTheory.Functor.IsCocartesian.map`\\n \u2022 `CategoryTheory.Functor.IsHomLift.map`\\n \u2022 `CategoryTheory.Functor.IsStronglyCartesian.map`\\n \u2022 `CategoryTheory.Functor.IsStronglyCocartesian.map`\\n \u2022 `CategoryTheory.Functor.OfSequence.map`\\n \u2022 `CategoryTheory.Functor.relativelyRepresentable.map`\\n \u2022 `CategoryTheory.GrothendieckTopology.OneHypercover.map`\\n \u2022 `CategoryTheory.GrothendieckTopology.Point.map`\\n \u2022 `CategoryTheory.Idempotents.FunctorExtension\u2081.map`\\n \u2022 `CategoryTheory.Idempotents.KaroubiFunctorCategoryEmbedding.map`\\n \u2022 `CategoryTheory.Limits.CokernelCofork.map`\\n \u2022 `CategoryTheory.Limits.ColimitPresentation.map`\\n \u2022 `CategoryTheory.Limits.DiagramOfCocones.map`\\n \u2022 `CategoryTheory.Limits.DiagramOfCones.map`\\n \u2022 `CategoryTheory.Limits.ImageMap.map`\\n \u2022 `CategoryTheory.Limits.IsColimit.map`\\n \u2022 `CategoryTheory.Limits.IsIndObject.map`\\n \u2022 `CategoryTheory.Limits.IsLimit.map`\\n \u2022 `CategoryTheory.Limits.IsZero.map`\\n \u2022 `CategoryTheory.Limits.KernelFork.map`\\n \u2022 `CategoryTheory.Limits.LimitPresentation.map`\\n \u2022 `CategoryTheory.Limits.Multicofork.map`\\n \u2022 `CategoryTheory.Limits.MultispanIndex.map`\\n \u2022 `CategoryTheory.Limits.Pi.map`\\n \u2022 `CategoryTheory.Limits.PullbackCone.map`\\n \u2022 `CategoryTheory.Limits.PushoutCocone.map`\\n \u2022 `CategoryTheory.Limits.Sigma.map`\\n \u2022 `CategoryTheory.Limits.biprod.map`\\n \u2022 `CategoryTheory.Limits.biproduct.map`\\n \u2022 `CategoryTheory.Limits.coend.map`\\n \u2022 `CategoryTheory.Limits.cokernel.map`\\n \u2022 `CategoryTheory.Limits.coprod.map`\\n \u2022 `CategoryTheory.Limits.end_.map`\\n \u2022 `CategoryTheory.Limits.image.map`\\n \u2022 `CategoryTheory.Limits.kernel.map`\\n \u2022 `CategoryTheory.Limits.prod.map`\\n \u2022 `CategoryTheory.Limits.pullback.map`\\n \u2022 `CategoryTheory.Limits.pushout.map`\\n \u2022 `CategoryTheory.MonoidalCategory.DayConvolution.map`\\n \u2022 `CategoryTheory.MonoidalCategory.DayConvolutionInternalHom.map`\\n \u2022 `CategoryTheory.MorphismProperty.LeftFraction.map`\\n \u2022 `CategoryTheory.MorphismProperty.Over.map`\\n \u2022 `CategoryTheory.MorphismProperty.RightFraction.map`\\n \u2022 `CategoryTheory.MorphismProperty.TransfiniteCompositionOfShape.map`\\n \u2022 `CategoryTheory.MorphismProperty.strictMap.map`\\n \u2022 `CategoryTheory.Precoverage.ZeroHypercover.map`\\n \u2022 `CategoryTheory.Presieve.CoverByImageStructure.map`\\n \u2022 `CategoryTheory.Presieve.FamilyOfElements.map`\\n \u2022 `CategoryTheory.Pseudofunctor.CoGrothendieck.map`\\n \u2022 `CategoryTheory.Pseudofunctor.Grothendieck.map`\\n \u2022 `CategoryTheory.Pseudofunctor.ObjectProperty.map`\\n \u2022 `CategoryTheory.ShortComplex.Exact.map`\\n \u2022 `CategoryTheory.ShortComplex.HomologyData.map`\\n \u2022 `CategoryTheory.ShortComplex.HomologyMapData.map`\\n \u2022 `CategoryTheory.ShortComplex.LeftHomologyData.map`\\n \u2022 `CategoryTheory.ShortComplex.LeftHomologyMapData.map`\\n \u2022 `CategoryTheory.ShortComplex.RightHomologyData.map`\\n \u2022 `CategoryTheory.ShortComplex.RightHomologyMapData.map`\\n \u2022 `CategoryTheory.ShortComplex.ShortExact.map`\\n \u2022 `CategoryTheory.ShortComplex.Splitting.map`\\n \u2022 `CategoryTheory.Square.IsPullback.map`\\n \u2022 `CategoryTheory.Square.IsPushout.map`\\n \u2022 `CategoryTheory.Triangulated.Octahedron.map`\\n \u2022 `CochainComplex.HomComplex.Cochain.map`\\n \u2022 `CommRingCat.Colimits.Relation.map`\\n \u2022 `ComputeAsymptotics.MultiseriesExpansion.Multiseries.map`\\n \u2022 `FirstOrder.Language.Substructure.map`\\n \u2022 `Lean.Export.Alloc.map`\\n \u2022 `Lean.Language.SnapshotTask.map`\\n \u2022 `Lean.Meta.CustomEliminators.map`\\n \u2022 `Lean.Meta.FVarSubst.map`\\n \u2022 `Lean.Meta.KExprMap.map`\\n \u2022 `Lean.Meta.MVarRenaming.map`\\n \u2022 `Lean.Omega.Coeffs.map`\\n \u2022 `Lean.Omega.Constraint.map`\\n \u2022 `Lean.ScopedEnvExtension.ScopedEntries.map`\\n \u2022 `Lean.Widget.TaggedText.map`\\n \u2022 `MeasureTheory.Measure.AbsolutelyContinuous.map`\\n \u2022 `MeasureTheory.Measure.InnerRegular.map`\\n \u2022 `MeasureTheory.Measure.InnerRegularWRT.map`\\n \u2022 `MeasureTheory.Measure.IsFiniteMeasureOnCompacts.map`\\n \u2022 `MeasureTheory.Measure.OuterRegular.map`\\n \u2022 `MeasureTheory.Measure.Regular.map`\\n \u2022 `MeasureTheory.SimpleFunc.FinMeasSupp.map`\\n \u2022 `MeasureTheory.VectorMeasure.AbsolutelyContinuous.map`\\n \u2022 `ModuleCat.ExtendRestrictScalarsAdj.Counit.map`\\n \u2022 `ModuleCat.ExtendRestrictScalarsAdj.Unit.map`\\n \u2022 `MonCat.Colimits.Relation.map`\\n \u2022 `OmegaCompletePartialOrder.ContinuousHom.\u03c9ScottContinuous.map`\\n \u2022 `Path.Homotopic.Quotient.map`\\n \u2022 `ProbabilityTheory.Kernel.IsFiniteKernel.map`\\n \u2022 `ProbabilityTheory.Kernel.IsMarkovKernel.map`\\n \u2022 `ProbabilityTheory.Kernel.IsSFiniteKernel.map`\\n \u2022 `ProbabilityTheory.Kernel.IsZeroOrMarkovKernel.map`\\n \u2022 `RingCat.Colimits.Relation.map`\\n \u2022 `SSet.Edge.CompStruct.map`\\n \u2022 `SSet.PtSimplex.MulStruct.map`\\n \u2022 `SSet.PtSimplex.RelStruct.map`\\n \u2022 `SSet.Truncated.Edge.map`\\n \u2022 `SSet.Truncated.Path.map`\\n \u2022 `SimpleGraph.Subgraph.Connected.map`\\n \u2022 `SimpleGraph.Subgraph.IsMatching.map`\\n \u2022 `SimpleGraph.Subgraph.Preconnected.map`\\n \u2022 `SimpleGraph.Walk.IsCycle.map`\\n \u2022 `SimpleGraph.Walk.IsHamiltonian.map`\\n \u2022 `SimpleGraph.Walk.IsHamiltonianCycle.map`\\n \u2022 `SimpleGraph.Walk.IsSubwalk.map`\\n \u2022 `Std.DHashMap.Equiv.map`\\n \u2022 `Std.DHashMap.Raw.map`\\n \u2022 `Std.DTreeMap.Equiv.map`\\n \u2022 `Std.DTreeMap.Raw.map`\\n \u2022 `Std.Do.Spec.map`\\n \u2022 `Std.Do.WP.map`\\n \u2022 `Std.HashMap.Equiv.map`\\n \u2022 `Std.HashMap.Raw.map`\\n \u2022 `Std.Internal.Small.map`\\n \u2022 `Std.IterM.Equiv.map`\\n \u2022 `Std.IterM.InternalCombinators.map`\\n \u2022 `Std.Iterators.HetT.map`\\n \u2022 `Std.Iterators.PostconditionT.map`\\n \u2022 `Std.TreeMap.Equiv.map`\\n \u2022 `Std.TreeMap.Raw.map`\\n \u2022 `TopCat.Presheaf.SubmonoidPresheaf.map`\\n \u2022 `Turing.TM0.Cfg.map`\\n \u2022 `Turing.TM0.Machine.map`\\n \u2022 `Turing.TM0.Stmt.map`\\n \u2022 `WeierstrassCurve.Affine.CoordinateRing.map`\\n \u2022 `WeierstrassCurve.Affine.Equation.map`\\n \u2022 `WeierstrassCurve.Affine.Point.map`\\n \u2022 `WeierstrassCurve.Jacobian.Equation.map`\\n \u2022 `WeierstrassCurve.Projective.Equation.map`\\n \u2022 `AlgebraicTopology.DoldKan.\u0393\u2080.Obj.map`\\n \u2022 `CategoryTheory.GrothendieckTopology.Cover.Arrow.map`\\n \u2022 `CategoryTheory.HasLiftingProperty.transfiniteComposition.SqStruct.map`\\n \u2022 `CategoryTheory.Idempotents.KaroubiHomologicalComplexEquivalence.Functor.map`\\n \u2022 `CategoryTheory.Idempotents.KaroubiHomologicalComplexEquivalence.Inverse.map`\\n \u2022 `CategoryTheory.Presieve.FamilyOfElements.Compatible.map`\\n \u2022 `CategoryTheory.Presieve.FamilyOfElements.IsAmalgamation.map`\\n \u2022 `CategoryTheory.ShortComplex.ShortExact.singleTriangle.map`\\n \u2022 `CategoryTheory.SimplicialObject.Augmented.ExtraDegeneracy.map`\\n \u2022 `CategoryTheory.SmallObject.SuccStruct.extendToSucc.map`\\n \u2022 `CategoryTheory.SmallObject.SuccStruct.ofCocone.map`\\n \u2022 `CommRingCat.Colimits.Relation.below.map`\\n \u2022 `FirstOrder.Language.Substructure.CG.map`\\n \u2022 `FirstOrder.Language.Substructure.FG.map`\\n \u2022 `Lean.Compiler.CSimp.State.map`\\n \u2022 `Lean.Compiler.LCNF.Probe.map`\\n \u2022 `Lean.Meta.Grind.SymbolPriorities.map`\\n \u2022 `Lean.Meta.Grind.VarRename.map`\\n \u2022 `Lean.Meta.Match.MatchEqnsExtState.map`\\n \u2022 `Lean.Meta.Match.Overlaps.map`\\n \u2022 `Lean.Meta.Simp.UsedSimps.map`\\n \u2022 `MonCat.Colimits.Relation.below.map`\\n \u2022 `RingCat.Colimits.Relation.below.map`\\n \u2022 `SSet.Truncated.Edge.CompStruct.map`\\n \u2022 `Std.DHashMap.Internal.AssocList.map`\\n \u2022 `Std.DHashMap.Internal.Raw\u2080.map`\\n \u2022 `Std.DHashMap.Raw.Equiv.map`\\n \u2022 `Std.DHashMap.Raw.WF.map`\\n \u2022 `Std.DTreeMap.Internal.Impl.map`\\n \u2022 `Std.DTreeMap.Raw.Equiv.map`\\n \u2022 `Std.HashMap.Raw.Equiv.map`\\n \u2022 `Std.HashMap.Raw.WF.map`\\n \u2022 `Std.Internal.List.DistinctKeys.map`\\n \u2022 `Std.Sat.AIG.RefVec.map`\\n \u2022 `Std.TreeMap.Raw.Equiv.map`\\n \u2022 `CategoryTheory.GrothendieckTopology.Cover.Arrow.Relation.map`\\n \u2022 `CategoryTheory.MorphismProperty.LeftFraction.Localization.Hom.map`\\n \u2022 `Lean.Compiler.LCNF.CSE.State.map`\\n \u2022 `Lean.Compiler.LCNF.NormLevelParam.State.map`\\n \u2022 `Lean.Compiler.LCNF.Simp.FunDeclInfoMap.map`\\n \u2022 `Lean.Meta.Grind.UnitLike.State.map`\\n \u2022 `Lean.Meta.Match.Extension.State.map`\\n \u2022 `Std.DTreeMap.Internal.Impl.Balanced.map`\\n \u2022 `Std.DTreeMap.Internal.Impl.Equiv.map`\\n \u2022 `Std.DTreeMap.Internal.Impl.WF.map`\\n \u2022 `Std.Internal.IO.Async.AsyncTask.map`\\n \u2022 `Std.Internal.IO.Async.BaseAsync.map`\\n \u2022 `Std.Internal.IO.Async.EAsync.map`\\n \u2022 `Std.Internal.IO.Async.ETask.map`\\n \u2022 `Std.Internal.IO.Async.MaybeTask.map`\\n \u2022 `Std.Sat.AIG.RelabelNat.State.map`\\n \u2022 `Std.Tactic.BVDecide.BVExpr.Cache.map`\", pos=Position(line=2, column=4), pos_end=Position(line=2, column=40), severity=, kind='lean.invalidField._namedError'), Message(data=\"Function expected at\\n Spec\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n R\\n\\nHint: The identifier `Spec` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=44), pos_end=Position(line=2, column=50), severity=, kind=None), Message(data='unsolved goals\\nx\u271d : Sort u_1\\nSpec : x\u271d\\n\u22a2 sorry = sorry', pos=Position(line=3, column=3), pos_end=Position(line=3, column=29), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=122, i_end=224, 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=23), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=224, i_end=252, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=252, i_end=285, messages=[Message(data='Function expected at\\n Spec\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n R', pos=Position(line=10, column=18), pos_end=Position(line=10, column=24), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=285, i_end=303, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=303, i_end=561, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=20, column=13), 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.AlgebraicGeometry.Stalk).[/SYSTEM_PROMPT][MODEL_SETTINGS]{\"reasoning_effort\": \"none\"}[/MODEL_SETTINGS][INST]The following Lean code fails to compile. Fix it.\n\n```lean\nlemma Spec_stalkClosedPointIso :\n Spec.map (stalkClosedPointIso R).inv = (Spec R).fromSpecStalk (closedPoint R)\n:= by thisIsWrongLemmaNameXYZ\nrw [stalkClosedPointIso_inv, Spec.fromSpecStalk_eq']\n\nend stalkClosedPointIso\n\nsection stalkClosedPointTo\n\nvariable {R} (f : Spec R \u27f6 X)\n\nnamespace Scheme\n\n/--\nGiven a local ring `(R, \ud835\udd2a)` and a morphism `f : Spec R \u27f6 X`,\nthey induce a (local) ring homomorphism `\u03c6 : \ud835\udcaa_{X, f \ud835\udd2a} \u27f6 R`.\n\nThis is inverse to `\u03c6 \u21a6 Spec.map \u03c6 \u226b X.fromSpecStalk (f \ud835\udd2a)`. See `SpecToEquivOfLocalRing`.\n-/\nnoncomputable\n```\n\n## Compiler diagnostic\n```\n[CompilationUnit(i_begin=0, i_end=122, messages=[Message(data='unknown tactic', pos=Position(line=3, column=7), pos_end=None, severity=, kind=None), Message(data=\"Invalid field notation: Type of\\n Spec\\nis not known; cannot resolve field `map`\\n\\nHint: Consider replacing the field projection with a call to one of the following:\\n \u2022 `Abelianization.map`\\n \u2022 `AbstractCompletion.map`\\n \u2022 `AccPt.map`\\n \u2022 `AddCommute.map`\\n \u2022 `AddCon.map`\\n \u2022 `AddConjClasses.map`\\n \u2022 `AddIrreducible.map`\\n \u2022 `AddMonoidAlgebra.map`\\n \u2022 `AddSemiconjBy.map`\\n \u2022 `AddSubgroup.map`\\n \u2022 `AddSubmonoid.map`\\n \u2022 `AddSubsemigroup.map`\\n \u2022 `AddUnits.map`\\n \u2022 `AddValuation.map`\\n \u2022 `AdicCompletion.map`\\n \u2022 `AdjoinRoot.map`\\n \u2022 `AffineSubspace.map`\\n \u2022 `AlgebraicIndependent.map`\\n \u2022 `Array.map`\\n \u2022 `Associated.map`\\n \u2022 `BaseIO.map`\\n \u2022 `Behrend.map`\\n \u2022 `BooleanSubalgebra.map`\\n \u2022 `ByteArray.map`\\n \u2022 `CStarMatrix.map`\\n \u2022 `Cardinal.map`\\n \u2022 `Cauchy.map`\\n \u2022 `CliffordAlgebra.map`\\n \u2022 `ClosedSubmodule.map`\\n \u2022 `ClusterPt.map`\\n \u2022 `Codisjoint.map`\\n \u2022 `Commute.map`\\n \u2022 `CompleteOrthogonalIdempotents.map`\\n \u2022 `CompleteSublattice.map`\\n \u2022 `Computation.map`\\n \u2022 `Con.map`\\n \u2022 `ConjClasses.map`\\n \u2022 `ContT.map`\\n \u2022 `ConvexCone.map`\\n \u2022 `CoxeterSystem.map`\\n \u2022 `Cubic.map`\\n \u2022 `Cycle.map`\\n \u2022 `DMatrix.map`\\n \u2022 `DirectLimit.map`\\n \u2022 `DirectSum.map`\\n \u2022 `DiscreteQuotient.map`\\n \u2022 `Disjoint.map`\\n \u2022 `EIO.map`\\n \u2022 `ENat.map`\\n \u2022 `EStateM.map`\\n \u2022 `Equiv.map`\\n \u2022 `EquivFunctor.map`\\n \u2022 `Erased.map`\\n \u2022 `Even.map`\\n \u2022 `Except.map`\\n \u2022 `ExceptT.map`\\n \u2022 `ExteriorAlgebra.map`\\n \u2022 `Filter.map`\\n \u2022 `FinVec.map`\\n \u2022 `Finpartition.map`\\n \u2022 `Finset.map`\\n \u2022 `Flag.map`\\n \u2022 `FloatArray.map`\\n \u2022 `FractionalIdeal.map`\\n \u2022 `FreeAbelianGroup.map`\\n \u2022 `FreeAddGroup.map`\\n \u2022 `FreeAddMagma.map`\\n \u2022 `FreeAddMonoid.map`\\n \u2022 `FreeAddSemigroup.map`\\n \u2022 `FreeCommRing.map`\\n \u2022 `FreeGroup.map`\\n \u2022 `FreeGroupBasis.map`\\n \u2022 `FreeMagma.map`\\n \u2022 `FreeMonoid.map`\\n \u2022 `FreeRing.map`\\n \u2022 `FreeSemigroup.map`\\n \u2022 `FunOnFinite.map`\\n \u2022 `Functor.map`\\n \u2022 `FundamentalGroup.map`\\n \u2022 `FundamentalGroupoid.map`\\n \u2022 `HahnSeries.map`\\n \u2022 `HasProd.map`\\n \u2022 `HasSum.map`\\n \u2022 `HomogeneousIdeal.map`\\n \u2022 `HomogeneousLocalization.map`\\n \u2022 `Ideal.map`\\n \u2022 `Inseparable.map`\\n \u2022 `IntermediateField.map`\\n \u2022 `Interval.map`\\n \u2022 `Invertible.map`\\n \u2022 `Irreducible.map`\\n \u2022 `IsAddUnit.map`\\n \u2022 `IsAdjoinRoot.map`\\n \u2022 `IsCompl.map`\\n \u2022 `IsCoprime.map`\\n \u2022 `IsFractionRing.map`\\n \u2022 `IsFractional.map`\\n \u2022 `IsGroupLikeElem.map`\\n \u2022 `IsIdempotentElem.map`\\n \u2022 `IsIntegral.map`\\n \u2022 `IsLocalization.map`\\n \u2022 `IsLocalizedModule.map`\\n \u2022 `IsNilpotent.map`\\n \u2022 `IsPGroup.map`\\n \u2022 `IsQuasiregular.map`\\n \u2022 `IsSMulRegular.map`\\n \u2022 `IsSelfAdjoint.map`\\n \u2022 `IsSeparable.map`\\n \u2022 `IsSquare.map`\\n \u2022 `IsStarNormal.map`\\n \u2022 `IsStarProjection.map`\\n \u2022 `IsTensorProduct.map`\\n \u2022 `IsTopologicallyNilpotent.map`\\n \u2022 `IsUnit.map`\\n \u2022 `JoinedIn.map`\\n \u2022 `KaehlerDifferential.map`\\n \u2022 `LTSeries.map`\\n \u2022 `Language.map`\\n \u2022 `LieIdeal.map`\\n \u2022 `LieSubalgebra.map`\\n \u2022 `LieSubmodule.map`\\n \u2022 `LinearIndependent.map`\\n \u2022 `List.map`\\n \u2022 `LocalSubring.map`\\n \u2022 `LocalizedModule.map`\\n \u2022 `LocallyConstant.map`\\n \u2022 `LowerSet.map`\\n \u2022 `MLList.map`\\n \u2022 `Matrix.map`\\n \u2022 `Matroid.map`\\n \u2022 `MeasurableSpace.map`\\n \u2022 `MonoidAlgebra.map`\\n \u2022 `MultilinearMap.map`\\n \u2022 `Multipliable.map`\\n \u2022 `Multiset.map`\\n \u2022 `MvFunctor.map`\\n \u2022 `MvPFunctor.map`\\n \u2022 `MvPolynomial.map`\\n \u2022 `MvPowerSeries.map`\\n \u2022 `NonUnitalStarSubalgebra.map`\\n \u2022 `NonUnitalSubalgebra.map`\\n \u2022 `NonUnitalSubring.map`\\n \u2022 `NonUnitalSubsemiring.map`\\n \u2022 `Nondet.map`\\n \u2022 `Nonempty.map`\\n \u2022 `NonemptyInterval.map`\\n \u2022 `Odd.map`\\n \u2022 `OnePoint.map`\\n \u2022 `Option.map`\\n \u2022 `Ordnode.map`\\n \u2022 `Ordset.map`\\n \u2022 `Orientation.map`\\n \u2022 `OrthogonalIdempotents.map`\\n \u2022 `OrthonormalBasis.map`\\n \u2022 `PFun.map`\\n \u2022 `PFunctor.map`\\n \u2022 `PLift.map`\\n \u2022 `PMF.map`\\n \u2022 `PSigma.map`\\n \u2022 `Part.map`\\n \u2022 `Partrec.map`\\n \u2022 `Path.map`\\n \u2022 `Perfection.map`\\n \u2022 `PerfectionMap.map`\\n \u2022 `Pi.map`\\n \u2022 `PiTensorProduct.map`\\n \u2022 `PointedCone.map`\\n \u2022 `Poly.map`\\n \u2022 `Polynomial.map`\\n \u2022 `PolynomialModule.map`\\n \u2022 `PontryaginDual.map`\\n \u2022 `PowerBasis.map`\\n \u2022 `PowerSeries.map`\\n \u2022 `PreAbstractSimplicialComplex.map`\\n \u2022 `Prefunctor.map`\\n \u2022 `PresheafOfModules.map`\\n \u2022 `Prod.map`\\n \u2022 `Projectivization.map`\\n \u2022 `ProperCone.map`\\n \u2022 `Quot.map`\\n \u2022 `QuotSMulTop.map`\\n \u2022 `Quotient.map`\\n \u2022 `QuotientAddGroup.map`\\n \u2022 `QuotientGroup.map`\\n \u2022 `RCLike.map`\\n \u2022 `RatFunc.map`\\n \u2022 `RegularExpression.map`\\n \u2022 `RelSeries.map`\\n \u2022 `RestrictedProduct.map`\\n \u2022 `RingCon.map`\\n \u2022 `RootPairing.map`\\n \u2022 `SModEq.map`\\n \u2022 `SameRay.map`\\n \u2022 `SatisfiesM.map`\\n \u2022 `SemiconjBy.map`\\n \u2022 `SemidirectProduct.map`\\n \u2022 `Semiquot.map`\\n \u2022 `SeparationQuotient.map`\\n \u2022 `Setoid.map`\\n \u2022 `Sigma.map`\\n \u2022 `SimpleGraph.map`\\n \u2022 `SingularManifold.map`\\n \u2022 `SlashAction.map`\\n \u2022 `Specialization.map`\\n \u2022 `Specializes.map`\\n \u2022 `StandardEtalePair.map`\\n \u2022 `StarSubalgebra.map`\\n \u2022 `StateT.map`\\n \u2022 `StdSimplex.map`\\n \u2022 `Stream'.map`\\n \u2022 `String.map`\\n \u2022 `Subalgebra.map`\\n \u2022 `Subfield.map`\\n \u2022 `Subgroup.map`\\n \u2022 `Sublattice.map`\\n \u2022 `Submodule.map`\\n \u2022 `Submonoid.map`\\n \u2022 `Subring.map`\\n \u2022 `Subsemigroup.map`\\n \u2022 `Subsemiring.map`\\n \u2022 `Subtype.map`\\n \u2022 `Sum.map`\\n \u2022 `Summable.map`\\n \u2022 `SummationFilter.map`\\n \u2022 `Sym.map`\\n \u2022 `Sym2.map`\\n \u2022 `Task.map`\\n \u2022 `TensorProduct.map`\\n \u2022 `Thunk.map`\\n \u2022 `Tree.map`\\n \u2022 `TrivSqZeroExt.map`\\n \u2022 `Trunc.map`\\n \u2022 `TwoSidedIdeal.map`\\n \u2022 `ULift.map`\\n \u2022 `Ultrafilter.map`\\n \u2022 `Unitary.map`\\n \u2022 `Units.map`\\n \u2022 `UpperSet.map`\\n \u2022 `Valuation.map`\\n \u2022 `Vector.map`\\n \u2022 `Wbtw.map`\\n \u2022 `WeakSpace.map`\\n \u2022 `WeierstrassCurve.map`\\n \u2022 `WithAbs.map`\\n \u2022 `WithBot.map`\\n \u2022 `WithLp.map`\\n \u2022 `WithOne.map`\\n \u2022 `WithTop.map`\\n \u2022 `WithVal.map`\\n \u2022 `WithZero.map`\\n \u2022 `WittVector.map`\\n \u2022 `ZFSet.map`\\n \u2022 `ZSpan.map`\\n \u2022 `bernsteinPolynomial.map`\\n \u2022 `exteriorPower.map`\\n \u2022 `groupCohomology.map`\\n \u2022 `groupHomology.map`\\n \u2022 `lowerCentralSeries.map`\\n \u2022 `stdSimplex.map`\\n \u2022 `unitary.map`\\n \u2022 `upperCentralSeries.map`\\n \u2022 `AddCommGroup.DirectLimit.map`\\n \u2022 `AddCommGroup.ModEq.map`\\n \u2022 `AddMagma.FreeAddSemigroup.map`\\n \u2022 `AddMonoid.Coprod.map`\\n \u2022 `AddSubgroup.IsSubnormal.map`\\n \u2022 `AddSubgroup.Normal.map`\\n \u2022 `AddSubmonoid.FG.map`\\n \u2022 `AddSubmonoid.LocalizationMap.map`\\n \u2022 `AddValuation.IsEquiv.map`\\n \u2022 `AdicCompletion.AdicCauchySequence.map`\\n \u2022 `Aesop.EMap.map`\\n \u2022 `Aesop.FVarIdSubst.map`\\n \u2022 `Aesop.InstMap.map`\\n \u2022 `Aesop.Rule.map`\\n \u2022 `Aesop.RulePatternCache.map`\\n \u2022 `Aesop.VariableMap.map`\\n \u2022 `Affine.Simplex.map`\\n \u2022 `AffineSubspace.WOppSide.map`\\n \u2022 `AffineSubspace.WSameSide.map`\\n \u2022 `Algebra.H1Cotangent.map`\\n \u2022 `Algebra.PreSubmersivePresentation.map`\\n \u2022 `Algebra.TensorProduct.map`\\n \u2022 `AlgebraicGeometry.AffineSpace.map`\\n \u2022 `AlgebraicGeometry.Proj.map`\\n \u2022 `AlgebraicGeometry.Spec.map`\\n \u2022 `AlgebraicGeometry.tilde.map`\\n \u2022 `AlgebraicTopology.AlternatingCofaceMapComplex.map`\\n \u2022 `AlgebraicTopology.AlternatingFaceMapComplex.map`\\n \u2022 `AlgebraicTopology.NormalizedMooreComplex.map`\\n \u2022 `Array.mapFinIdxM.map`\\n \u2022 `Batteries.RBNode.map`\\n \u2022 `Batteries.RBSet.map`\\n \u2022 `Bialgebra.TensorProduct.map`\\n \u2022 `BoxIntegral.BoxAdditiveMap.map`\\n \u2022 `CategoryTheory.Bundled.map`\\n \u2022 `CategoryTheory.CategoryOfElements.map`\\n \u2022 `CategoryTheory.CommSq.map`\\n \u2022 `CategoryTheory.Comma.map`\\n \u2022 `CategoryTheory.CostructuredArrow.map`\\n \u2022 `CategoryTheory.EnrichedFunctor.map`\\n \u2022 `CategoryTheory.FreeGroupoid.map`\\n \u2022 `CategoryTheory.Functor.map`\\n \u2022 `CategoryTheory.map`\\n \u2022 `CategoryTheory.GradedObject.map`\\n \u2022 `CategoryTheory.Grothendieck.map`\\n \u2022 `CategoryTheory.IsHomLift.map`\\n \u2022 `CategoryTheory.IsPullback.map`\\n \u2022 `CategoryTheory.IsPushout.map`\\n \u2022 `CategoryTheory.IsSplitCoequalizer.map`\\n \u2022 `CategoryTheory.IsSplitEqualizer.map`\\n \u2022 `CategoryTheory.LocalizerMorphism.map`\\n \u2022 `CategoryTheory.MonoOver.map`\\n \u2022 `CategoryTheory.MorphismProperty.map`\\n \u2022 `CategoryTheory.ObjectProperty.map`\\n \u2022 `CategoryTheory.Over.map`\\n \u2022 `CategoryTheory.PreOneHypercover.map`\\n \u2022 `CategoryTheory.PreZeroHypercover.map`\\n \u2022 `CategoryTheory.Presieve.map`\\n \u2022 `CategoryTheory.Retract.map`\\n \u2022 `CategoryTheory.RetractArrow.map`\\n \u2022 `CategoryTheory.ShiftedHom.map`\\n \u2022 `CategoryTheory.ShortComplex.map`\\n \u2022 `CategoryTheory.Sigma.map`\\n \u2022 `CategoryTheory.SplitEpi.map`\\n \u2022 `CategoryTheory.SplitMono.map`\\n \u2022 `CategoryTheory.Square.map`\\n \u2022 `CategoryTheory.StrictlyUnitaryLaxFunctorCore.map`\\n \u2022 `CategoryTheory.StrictlyUnitaryPseudofunctorCore.map`\\n \u2022 `CategoryTheory.StructuredArrow.map`\\n \u2022 `CategoryTheory.Subfunctor.map`\\n \u2022 `CategoryTheory.Subgroupoid.map`\\n \u2022 `CategoryTheory.Subobject.map`\\n \u2022 `CategoryTheory.ThinSkeleton.map`\\n \u2022 `CategoryTheory.TransfiniteCompositionOfShape.map`\\n \u2022 `CategoryTheory.Under.map`\\n \u2022 `CategoryTheory.WithInitial.map`\\n \u2022 `CategoryTheory.WithTerminal.map`\\n \u2022 `CategoryTheory.wideSubcategoryInclusion.map`\\n \u2022 `Coalgebra.TensorProduct.map`\\n \u2022 `CochainComplex.ConnectData.map`\\n \u2022 `CochainComplex.mappingCone.map`\\n \u2022 `Combinatorics.Line.map`\\n \u2022 `CommRingCat.KaehlerDifferential.map`\\n \u2022 `DerivedCategory.triangleOfSES.map`\\n \u2022 `EStateM.Result.map`\\n \u2022 `Filter.Germ.map`\\n \u2022 `Filter.HasAntitoneBasis.map`\\n \u2022 `Filter.HasBasis.map`\\n \u2022 `Filter.NeBot.map`\\n \u2022 `Filter.Realizer.map`\\n \u2022 `Filter.Subsingleton.map`\\n \u2022 `Filter.TotallyBounded.map`\\n \u2022 `Finset.Nonempty.map`\\n \u2022 `Function.IsFixedPt.map`\\n \u2022 `Function.IsPeriodicPt.map`\\n \u2022 `Functor.Comp.map`\\n \u2022 `Functor.Const.map`\\n \u2022 `GenContFract.Pair.map`\\n \u2022 `Group.IsPerfect.map`\\n \u2022 `HomogeneousLocalization.Away.map`\\n \u2022 `HomogeneousLocalization.NumDenSameDeg.map`\\n \u2022 `HomologicalComplex\u2082.total.map`\\n \u2022 `Hyperreal.IsSt.map`\\n \u2022 `Ideal.FG.map`\\n \u2022 `Ideal.ResidueField.map`\\n \u2022 `Ideal.primaryComponent.map`\\n \u2022 `IntermediateField.LinearDisjoint.map`\\n \u2022 `IsLocalRing.ResidueField.map`\\n \u2022 `IsLocalization.Away.map`\\n \u2022 `Lean.AttributeExtensionState.map`\\n \u2022 `Lean.ClosedTermCache.map`\\n \u2022 `Lean.PersistentArray.map`\\n \u2022 `Lean.PersistentHashMap.map`\\n \u2022 `Lean.RBNode.map`\\n \u2022 `LieAlgebra.ExtendScalars.map`\\n \u2022 `List.Disjoint.map`\\n \u2022 `List.IsInfix.map`\\n \u2022 `List.IsPrefix.map`\\n \u2022 `List.IsRotated.map`\\n \u2022 `List.IsSuffix.map`\\n \u2022 `List.Nodup.map`\\n \u2022 `List.Pairwise.map`\\n \u2022 `List.Palindrome.map`\\n \u2022 `List.Perm.map`\\n \u2022 `List.Sublist.map`\\n \u2022 `List.Subperm.map`\\n \u2022 `List.Triplewise.map`\\n \u2022 `List.Vector.map`\\n \u2022 `List.Wbtw.map`\\n \u2022 `Magma.AssocQuotient.map`\\n \u2022 `Matrix.BlockTriangular.map`\\n \u2022 `Matrix.GeneralLinearGroup.map`\\n \u2022 `Matrix.IsDiag.map`\\n \u2022 `Matrix.IsHermitian.map`\\n \u2022 `Matrix.IsSymm.map`\\n \u2022 `Matrix.SpecialLinearGroup.map`\\n \u2022 `Matroid.Indep.map`\\n \u2022 `Matroid.IsBase.map`\\n \u2022 `Matroid.IsBasis.map`\\n \u2022 `MeasureTheory.FiniteMeasure.map`\\n \u2022 `MeasureTheory.IsTightMeasureSet.map`\\n \u2022 `MeasureTheory.Measure.map`\\n \u2022 `MeasureTheory.OuterMeasure.map`\\n \u2022 `MeasureTheory.ProbabilityMeasure.map`\\n \u2022 `MeasureTheory.SimpleFunc.map`\\n \u2022 `MeasureTheory.VectorMeasure.map`\\n \u2022 `Module.Basis.map`\\n \u2022 `Module.DirectLimit.map`\\n \u2022 `Module.Finite.map`\\n \u2022 `Module.Ray.map`\\n \u2022 `Module.Relations.map`\\n \u2022 `ModuleCat.exteriorPower.map`\\n \u2022 `Monoid.Coprod.map`\\n \u2022 `Multiset.Nodup.map`\\n \u2022 `MvPolynomial.IsHomogeneous.map`\\n \u2022 `MvPolynomial.IsSymmetric.map`\\n \u2022 `MvPowerSeries.HasEval.map`\\n \u2022 `MvPowerSeries.HasSubst.map`\\n \u2022 `MvQPF.Cofix.map`\\n \u2022 `MvQPF.Comp.map`\\n \u2022 `MvQPF.Const.map`\\n \u2022 `MvQPF.Fix.map`\\n \u2022 `MvQPF.Prj.map`\\n \u2022 `MvQPF.Quot1.map`\\n \u2022 `Nat.Partrec'.map`\\n \u2022 `NormedAddGroupHom.Equalizer.map`\\n \u2022 `OmegaCompletePartialOrder.Chain.map`\\n \u2022 `OmegaCompletePartialOrder.ContinuousHom.map`\\n \u2022 `Path.Homotopic.map`\\n \u2022 `Path.Homotopy.map`\\n \u2022 `Polynomial.IsRoot.map`\\n \u2022 `Polynomial.IsSplittingField.map`\\n \u2022 `Polynomial.IsWeaklyEisensteinAt.map`\\n \u2022 `Polynomial.Monic.map`\\n \u2022 `Polynomial.MonicDegreeEq.map`\\n \u2022 `Polynomial.Separable.map`\\n \u2022 `Polynomial.Splits.map`\\n \u2022 `PowerSeries.HasEval.map`\\n \u2022 `PrimeSpectrum.BasicConstructibleSetData.map`\\n \u2022 `PrimeSpectrum.ConstructibleSetData.map`\\n \u2022 `ProbabilityTheory.HasGaussianLaw.map`\\n \u2022 `ProbabilityTheory.HasIndepIncrements.map`\\n \u2022 `ProbabilityTheory.Kernel.map`\\n \u2022 `Profinite.IndexFunctor.map`\\n \u2022 `Quandle.Conj.map`\\n \u2022 `Rack.toEnvelGroup.map`\\n \u2022 `Representation.Coinvariants.map`\\n \u2022 `Ring.DirectLimit.map`\\n \u2022 `RingHom.IsIntegralElem.map`\\n \u2022 `SSet.Edge.map`\\n \u2022 `SSet.OneTruncation\u2082.map`\\n \u2022 `SSet.Path.map`\\n \u2022 `SSet.RelativeMorphism.map`\\n \u2022 `SSet.S.map`\\n \u2022 `SemiNormedGrp.explicitCokernel.map`\\n \u2022 `Set.Finite.map`\\n \u2022 `Set.powersetCard.map`\\n \u2022 `SheafOfModules.Presentation.map`\\n \u2022 `SimpleGraph.Colorable.map`\\n \u2022 `SimpleGraph.Connected.map`\\n \u2022 `SimpleGraph.ConnectedComponent.map`\\n \u2022 `SimpleGraph.EdgeDisjointTriangles.map`\\n \u2022 `SimpleGraph.Embedding.map`\\n \u2022 `SimpleGraph.IsClique.map`\\n \u2022 `SimpleGraph.IsNClique.map`\\n \u2022 `SimpleGraph.Iso.map`\\n \u2022 `SimpleGraph.LocallyLinear.map`\\n \u2022 `SimpleGraph.Path.map`\\n \u2022 `SimpleGraph.Preconnected.map`\\n \u2022 `SimpleGraph.Reachable.map`\\n \u2022 `SimpleGraph.Subgraph.map`\\n \u2022 `SimpleGraph.Walk.map`\\n \u2022 `StandardEtalePair.HasMap.map`\\n \u2022 `Std.DHashMap.map`\\n \u2022 `Std.DTreeMap.map`\\n \u2022 `Std.ExtDHashMap.map`\\n \u2022 `Std.ExtDTreeMap.map`\\n \u2022 `Std.ExtHashMap.map`\\n \u2022 `Std.ExtTreeMap.map`\\n \u2022 `Std.HashMap.map`\\n \u2022 `Std.Iter.map`\\n \u2022 `Std.IterM.map`\\n \u2022 `Std.TreeMap.map`\\n \u2022 `Stream'.Seq.map`\\n \u2022 `Stream'.Seq1.map`\\n \u2022 `Stream'.WSeq.map`\\n \u2022 `String.Legacy.map`\\n \u2022 `Subalgebra.FG.map`\\n \u2022 `Subalgebra.LinearDisjoint.map`\\n \u2022 `Subgroup.IsNormalClosureFG.map`\\n \u2022 `Subgroup.IsSubnormal.map`\\n \u2022 `Subgroup.Normal.map`\\n \u2022 `Submodule.FG.map`\\n \u2022 `Submodule.IsOrtho.map`\\n \u2022 `Submodule.IsPrincipal.map`\\n \u2022 `Submodule.LinearDisjoint.map`\\n \u2022 `Submonoid.FG.map`\\n \u2022 `Submonoid.LocalizationMap.map`\\n \u2022 `Sym2.IsDiag.map`\\n \u2022 `TensorProduct.AlgebraTensorModule.map`\\n \u2022 `TensorProduct.LieModule.map`\\n \u2022 `TopCat.continuousFunctions.map`\\n \u2022 `TopologicalSpace.CompactOpens.map`\\n \u2022 `TopologicalSpace.Compacts.map`\\n \u2022 `TopologicalSpace.IrreducibleCloseds.map`\\n \u2022 `TopologicalSpace.NonemptyCompacts.map`\\n \u2022 `TopologicalSpace.OpenNhds.map`\\n \u2022 `TopologicalSpace.Opens.map`\\n \u2022 `TopologicalSpace.PositiveCompacts.map`\\n \u2022 `Topology.CWComplex.map`\\n \u2022 `Topology.RelCWComplex.map`\\n \u2022 `Topology.WithLowerSet.map`\\n \u2022 `Topology.WithUpperSet.map`\\n \u2022 `Turing.ListBlank.map`\\n \u2022 `Turing.Tape.map`\\n \u2022 `TypeVec.prod.map`\\n \u2022 `UniformSpace.Completion.map`\\n \u2022 `Valuation.IsEquiv.map`\\n \u2022 `Vector.mapFinIdxM.map`\\n \u2022 `WeierstrassCurve.VariableChange.map`\\n \u2022 `WittVector.IsPoly.map`\\n \u2022 `WittVector.IsPoly\u2082.map`\\n \u2022 `Algebra.Extension.Cotangent.map`\\n \u2022 `Algebra.Extension.CotangentSpace.map`\\n \u2022 `Algebra.Extension.H1Cotangent.map`\\n \u2022 `AlgebraicGeometry.Scheme.IdealSheafData.map`\\n \u2022 `AlgebraicTopology.DoldKan.\u0393\u2080.map`\\n \u2022 `Batteries.RBNode.All.map`\\n \u2022 `Batteries.RBNode.Balanced.map`\\n \u2022 `Batteries.RBNode.Ordered.map`\\n \u2022 `CategoryTheory.Abelian.SpectralObject.map`\\n \u2022 `CategoryTheory.ComposableArrows.Mk\u2081.map`\\n \u2022 `CategoryTheory.ComposableArrows.Precomp.map`\\n \u2022 `CategoryTheory.Functor.HomObj.map`\\n \u2022 `CategoryTheory.Functor.IsCartesian.map`\\n \u2022 `CategoryTheory.Functor.IsCocartesian.map`\\n \u2022 `CategoryTheory.Functor.IsHomLift.map`\\n \u2022 `CategoryTheory.Functor.IsStronglyCartesian.map`\\n \u2022 `CategoryTheory.Functor.IsStronglyCocartesian.map`\\n \u2022 `CategoryTheory.Functor.OfSequence.map`\\n \u2022 `CategoryTheory.Functor.relativelyRepresentable.map`\\n \u2022 `CategoryTheory.GrothendieckTopology.OneHypercover.map`\\n \u2022 `CategoryTheory.GrothendieckTopology.Point.map`\\n \u2022 `CategoryTheory.Idempotents.FunctorExtension\u2081.map`\\n \u2022 `CategoryTheory.Idempotents.KaroubiFunctorCategoryEmbedding.map`\\n \u2022 `CategoryTheory.Limits.CokernelCofork.map`\\n \u2022 `CategoryTheory.Limits.ColimitPresentation.map`\\n \u2022 `CategoryTheory.Limits.DiagramOfCocones.map`\\n \u2022 `CategoryTheory.Limits.DiagramOfCones.map`\\n \u2022 `CategoryTheory.Limits.ImageMap.map`\\n \u2022 `CategoryTheory.Limits.IsColimit.map`\\n \u2022 `CategoryTheory.Limits.IsIndObject.map`\\n \u2022 `CategoryTheory.Limits.IsLimit.map`\\n \u2022 `CategoryTheory.Limits.IsZero.map`\\n \u2022 `CategoryTheory.Limits.KernelFork.map`\\n \u2022 `CategoryTheory.Limits.LimitPresentation.map`\\n \u2022 `CategoryTheory.Limits.Multicofork.map`\\n \u2022 `CategoryTheory.Limits.MultispanIndex.map`\\n \u2022 `CategoryTheory.Limits.Pi.map`\\n \u2022 `CategoryTheory.Limits.PullbackCone.map`\\n \u2022 `CategoryTheory.Limits.PushoutCocone.map`\\n \u2022 `CategoryTheory.Limits.Sigma.map`\\n \u2022 `CategoryTheory.Limits.biprod.map`\\n \u2022 `CategoryTheory.Limits.biproduct.map`\\n \u2022 `CategoryTheory.Limits.coend.map`\\n \u2022 `CategoryTheory.Limits.cokernel.map`\\n \u2022 `CategoryTheory.Limits.coprod.map`\\n \u2022 `CategoryTheory.Limits.end_.map`\\n \u2022 `CategoryTheory.Limits.image.map`\\n \u2022 `CategoryTheory.Limits.kernel.map`\\n \u2022 `CategoryTheory.Limits.prod.map`\\n \u2022 `CategoryTheory.Limits.pullback.map`\\n \u2022 `CategoryTheory.Limits.pushout.map`\\n \u2022 `CategoryTheory.MonoidalCategory.DayConvolution.map`\\n \u2022 `CategoryTheory.MonoidalCategory.DayConvolutionInternalHom.map`\\n \u2022 `CategoryTheory.MorphismProperty.LeftFraction.map`\\n \u2022 `CategoryTheory.MorphismProperty.Over.map`\\n \u2022 `CategoryTheory.MorphismProperty.RightFraction.map`\\n \u2022 `CategoryTheory.MorphismProperty.TransfiniteCompositionOfShape.map`\\n \u2022 `CategoryTheory.MorphismProperty.strictMap.map`\\n \u2022 `CategoryTheory.Precoverage.ZeroHypercover.map`\\n \u2022 `CategoryTheory.Presieve.CoverByImageStructure.map`\\n \u2022 `CategoryTheory.Presieve.FamilyOfElements.map`\\n \u2022 `CategoryTheory.Pseudofunctor.CoGrothendieck.map`\\n \u2022 `CategoryTheory.Pseudofunctor.Grothendieck.map`\\n \u2022 `CategoryTheory.Pseudofunctor.ObjectProperty.map`\\n \u2022 `CategoryTheory.ShortComplex.Exact.map`\\n \u2022 `CategoryTheory.ShortComplex.HomologyData.map`\\n \u2022 `CategoryTheory.ShortComplex.HomologyMapData.map`\\n \u2022 `CategoryTheory.ShortComplex.LeftHomologyData.map`\\n \u2022 `CategoryTheory.ShortComplex.LeftHomologyMapData.map`\\n \u2022 `CategoryTheory.ShortComplex.RightHomologyData.map`\\n \u2022 `CategoryTheory.ShortComplex.RightHomologyMapData.map`\\n \u2022 `CategoryTheory.ShortComplex.ShortExact.map`\\n \u2022 `CategoryTheory.ShortComplex.Splitting.map`\\n \u2022 `CategoryTheory.Square.IsPullback.map`\\n \u2022 `CategoryTheory.Square.IsPushout.map`\\n \u2022 `CategoryTheory.Triangulated.Octahedron.map`\\n \u2022 `CochainComplex.HomComplex.Cochain.map`\\n \u2022 `CommRingCat.Colimits.Relation.map`\\n \u2022 `ComputeAsymptotics.MultiseriesExpansion.Multiseries.map`\\n \u2022 `FirstOrder.Language.Substructure.map`\\n \u2022 `Lean.Export.Alloc.map`\\n \u2022 `Lean.Language.SnapshotTask.map`\\n \u2022 `Lean.Meta.CustomEliminators.map`\\n \u2022 `Lean.Meta.FVarSubst.map`\\n \u2022 `Lean.Meta.KExprMap.map`\\n \u2022 `Lean.Meta.MVarRenaming.map`\\n \u2022 `Lean.Omega.Coeffs.map`\\n \u2022 `Lean.Omega.Constraint.map`\\n \u2022 `Lean.ScopedEnvExtension.ScopedEntries.map`\\n \u2022 `Lean.Widget.TaggedText.map`\\n \u2022 `MeasureTheory.Measure.AbsolutelyContinuous.map`\\n \u2022 `MeasureTheory.Measure.InnerRegular.map`\\n \u2022 `MeasureTheory.Measure.InnerRegularWRT.map`\\n \u2022 `MeasureTheory.Measure.IsFiniteMeasureOnCompacts.map`\\n \u2022 `MeasureTheory.Measure.OuterRegular.map`\\n \u2022 `MeasureTheory.Measure.Regular.map`\\n \u2022 `MeasureTheory.SimpleFunc.FinMeasSupp.map`\\n \u2022 `MeasureTheory.VectorMeasure.AbsolutelyContinuous.map`\\n \u2022 `ModuleCat.ExtendRestrictScalarsAdj.Counit.map`\\n \u2022 `ModuleCat.ExtendRestrictScalarsAdj.Unit.map`\\n \u2022 `MonCat.Colimits.Relation.map`\\n \u2022 `OmegaCompletePartialOrder.ContinuousHom.\u03c9ScottContinuous.map`\\n \u2022 `Path.Homotopic.Quotient.map`\\n \u2022 `ProbabilityTheory.Kernel.IsFiniteKernel.map`\\n \u2022 `ProbabilityTheory.Kernel.IsMarkovKernel.map`\\n \u2022 `ProbabilityTheory.Kernel.IsSFiniteKernel.map`\\n \u2022 `ProbabilityTheory.Kernel.IsZeroOrMarkovKernel.map`\\n \u2022 `RingCat.Colimits.Relation.map`\\n \u2022 `SSet.Edge.CompStruct.map`\\n \u2022 `SSet.PtSimplex.MulStruct.map`\\n \u2022 `SSet.PtSimplex.RelStruct.map`\\n \u2022 `SSet.Truncated.Edge.map`\\n \u2022 `SSet.Truncated.Path.map`\\n \u2022 `SimpleGraph.Subgraph.Connected.map`\\n \u2022 `SimpleGraph.Subgraph.IsMatching.map`\\n \u2022 `SimpleGraph.Subgraph.Preconnected.map`\\n \u2022 `SimpleGraph.Walk.IsCycle.map`\\n \u2022 `SimpleGraph.Walk.IsHamiltonian.map`\\n \u2022 `SimpleGraph.Walk.IsHamiltonianCycle.map`\\n \u2022 `SimpleGraph.Walk.IsSubwalk.map`\\n \u2022 `Std.DHashMap.Equiv.map`\\n \u2022 `Std.DHashMap.Raw.map`\\n \u2022 `Std.DTreeMap.Equiv.map`\\n \u2022 `Std.DTreeMap.Raw.map`\\n \u2022 `Std.Do.Spec.map`\\n \u2022 `Std.Do.WP.map`\\n \u2022 `Std.HashMap.Equiv.map`\\n \u2022 `Std.HashMap.Raw.map`\\n \u2022 `Std.Internal.Small.map`\\n \u2022 `Std.IterM.Equiv.map`\\n \u2022 `Std.IterM.InternalCombinators.map`\\n \u2022 `Std.Iterators.HetT.map`\\n \u2022 `Std.Iterators.PostconditionT.map`\\n \u2022 `Std.TreeMap.Equiv.map`\\n \u2022 `Std.TreeMap.Raw.map`\\n \u2022 `TopCat.Presheaf.SubmonoidPresheaf.map`\\n \u2022 `Turing.TM0.Cfg.map`\\n \u2022 `Turing.TM0.Machine.map`\\n \u2022 `Turing.TM0.Stmt.map`\\n \u2022 `WeierstrassCurve.Affine.CoordinateRing.map`\\n \u2022 `WeierstrassCurve.Affine.Equation.map`\\n \u2022 `WeierstrassCurve.Affine.Point.map`\\n \u2022 `WeierstrassCurve.Jacobian.Equation.map`\\n \u2022 `WeierstrassCurve.Projective.Equation.map`\\n \u2022 `AlgebraicTopology.DoldKan.\u0393\u2080.Obj.map`\\n \u2022 `CategoryTheory.GrothendieckTopology.Cover.Arrow.map`\\n \u2022 `CategoryTheory.HasLiftingProperty.transfiniteComposition.SqStruct.map`\\n \u2022 `CategoryTheory.Idempotents.KaroubiHomologicalComplexEquivalence.Functor.map`\\n \u2022 `CategoryTheory.Idempotents.KaroubiHomologicalComplexEquivalence.Inverse.map`\\n \u2022 `CategoryTheory.Presieve.FamilyOfElements.Compatible.map`\\n \u2022 `CategoryTheory.Presieve.FamilyOfElements.IsAmalgamation.map`\\n \u2022 `CategoryTheory.ShortComplex.ShortExact.singleTriangle.map`\\n \u2022 `CategoryTheory.SimplicialObject.Augmented.ExtraDegeneracy.map`\\n \u2022 `CategoryTheory.SmallObject.SuccStruct.extendToSucc.map`\\n \u2022 `CategoryTheory.SmallObject.SuccStruct.ofCocone.map`\\n \u2022 `CommRingCat.Colimits.Relation.below.map`\\n \u2022 `FirstOrder.Language.Substructure.CG.map`\\n \u2022 `FirstOrder.Language.Substructure.FG.map`\\n \u2022 `Lean.Compiler.CSimp.State.map`\\n \u2022 `Lean.Compiler.LCNF.Probe.map`\\n \u2022 `Lean.Meta.Grind.SymbolPriorities.map`\\n \u2022 `Lean.Meta.Grind.VarRename.map`\\n \u2022 `Lean.Meta.Match.MatchEqnsExtState.map`\\n \u2022 `Lean.Meta.Match.Overlaps.map`\\n \u2022 `Lean.Meta.Simp.UsedSimps.map`\\n \u2022 `MonCat.Colimits.Relation.below.map`\\n \u2022 `RingCat.Colimits.Relation.below.map`\\n \u2022 `SSet.Truncated.Edge.CompStruct.map`\\n \u2022 `Std.DHashMap.Internal.AssocList.map`\\n \u2022 `Std.DHashMap.Internal.Raw\u2080.map`\\n \u2022 `Std.DHashMap.Raw.Equiv.map`\\n \u2022 `Std.DHashMap.Raw.WF.map`\\n \u2022 `Std.DTreeMap.Internal.Impl.map`\\n \u2022 `Std.DTreeMap.Raw.Equiv.map`\\n \u2022 `Std.HashMap.Raw.Equiv.map`\\n \u2022 `Std.HashMap.Raw.WF.map`\\n \u2022 `Std.Internal.List.DistinctKeys.map`\\n \u2022 `Std.Sat.AIG.RefVec.map`\\n \u2022 `Std.TreeMap.Raw.Equiv.map`\\n \u2022 `CategoryTheory.GrothendieckTopology.Cover.Arrow.Relation.map`\\n \u2022 `CategoryTheory.MorphismProperty.LeftFraction.Localization.Hom.map`\\n \u2022 `Lean.Compiler.LCNF.CSE.State.map`\\n \u2022 `Lean.Compiler.LCNF.NormLevelParam.State.map`\\n \u2022 `Lean.Compiler.LCNF.Simp.FunDeclInfoMap.map`\\n \u2022 `Lean.Meta.Grind.UnitLike.State.map`\\n \u2022 `Lean.Meta.Match.Extension.State.map`\\n \u2022 `Std.DTreeMap.Internal.Impl.Balanced.map`\\n \u2022 `Std.DTreeMap.Internal.Impl.Equiv.map`\\n \u2022 `Std.DTreeMap.Internal.Impl.WF.map`\\n \u2022 `Std.Internal.IO.Async.AsyncTask.map`\\n \u2022 `Std.Internal.IO.Async.BaseAsync.map`\\n \u2022 `Std.Internal.IO.Async.EAsync.map`\\n \u2022 `Std.Internal.IO.Async.ETask.map`\\n \u2022 `Std.Internal.IO.Async.MaybeTask.map`\\n \u2022 `Std.Sat.AIG.RelabelNat.State.map`\\n \u2022 `Std.Tactic.BVDecide.BVExpr.Cache.map`\", pos=Position(line=2, column=4), pos_end=Position(line=2, column=40), severity=, kind='lean.invalidField._namedError'), Message(data=\"Function expected at\\n Spec\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n R\\n\\nHint: The identifier `Spec` is unknown, and Lean's `autoImplicit` option causes an unknown identifier to be treated as an implicitly bound variable with an unknown type. However, the unknown type cannot be a function, and a function is what Lean expects here. This is often the result of a typo or a missing `import` or `open` statement.\", pos=Position(line=2, column=44), pos_end=Position(line=2, column=50), severity=, kind=None), Message(data='unsolved goals\\nx\u271d : Sort u_1\\nSpec : x\u271d\\n\u22a2 sorry = sorry', pos=Position(line=3, column=3), pos_end=Position(line=3, column=29), severity=, kind='Tactic.unsolvedGoals')], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=122, i_end=224, 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=23), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=224, i_end=252, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=252, i_end=285, messages=[Message(data='Function expected at\\n Spec\\nbut this term has type\\n ?m.1\\n\\nNote: Expected a function because this term is being applied to the argument\\n R', pos=Position(line=10, column=18), pos_end=Position(line=10, column=24), severity=, kind=None)], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=285, i_end=303, messages=[], invocations=None, goal_state=None, goal_src_boundaries=None, new_constants=None), CompilationUnit(i_begin=303, i_end=561, messages=[Message(data=\"unexpected end of input; expected 'lemma'\", pos=Position(line=20, column=13), 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.AlgebraicGeometry.Stalk.Spec_stalkClosedPointIso", "source": {"declaration": "Mathlib.AlgebraicGeometry.Stalk.Spec_stalkClosedPointIso", "file": "Mathlib/AlgebraicGeometry/Stalk.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.AlgebraicGeometry.Stalk", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/AlgebraicGeometry/Stalk.lean#L270", "span": "L270-L288"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "E", "construction": {"source_grounded_context_enriched": false, "trace_states": [{"state": "lemma iIndepFun.process_congr {T : S \u2192 Type*} {\ud835\udce7 : (i : S) \u2192 (j : T i) \u2192 Type*}\n [\u2200 i j, MeasurableSpace (\ud835\udce7 i j)] {X X' : (i : S) \u2192 (j : T i) \u2192 \u03a9 \u2192 \ud835\udce7 i j}\n (h1 : iIndepFun (fun i \u03c9 j \u21a6 X i j \u03c9) \u03ba P) (h2 : \u2200 i j, \u2200\u1d50 a \u2202P, X i j =\u1d50[\u03ba a] X' i j) :\n iIndepFun (fun i \u03c9 j \u21a6 X' i j \u03c9) \u03ba P", "tactic": "intro s f hf"}, {"state": "", "tactic": "choose! g mg hg using hf"}, {"state": "", "tactic": "have h3 : \u22c2 i \u2208 s, f i = \u22c2 i \u2208 s, (fun i \u03c9 j \u21a6 X' i j \u03c9) i \u207b\u00b9' g i := (biInf_congr hg).symm"}, {"state": "", "tactic": "have h3' a : \u220f i \u2208 s, \u03ba a (f i) = \u220f i \u2208 s, \u03ba a ((fun i \u03c9 j \u21a6 X' i j \u03c9) i \u207b\u00b9' g i) := by"}, {"state": "", "tactic": "refine Finset.prod_congr rfl fun i hi \u21a6 ?_"}, {"state": "", "tactic": "rw [hg i hi] simp_rw [h3, h3']"}, {"state": "", "tactic": "choose! I u hI hu using fun i hi \u21a6 (mg i hi).eq_preimage_restrict_countable"}, {"state": "", "tactic": "have h4 (f : (i : S) \u2192 (j : T i) \u2192 \u03a9 \u2192 \ud835\udce7 i j) : \u22c2 i \u2208 s, (fun i \u03c9 j \u21a6 f i j \u03c9) i \u207b\u00b9' g i = \u22c2 i \u2208 s, (fun i \u03c9 j \u21a6 f i j \u03c9) i \u207b\u00b9' ((I i).restrict \u207b\u00b9' u i) := (biInf_congr (fun i hi \u21a6 by rw [hu i hi])).symm"}, {"state": "", "tactic": "have h4' a (f : (i : S) \u2192 (j : T i) \u2192 \u03a9 \u2192 \ud835\udce7 i j) : \u220f i \u2208 s, \u03ba a ((fun i \u03c9 j \u21a6 f i j \u03c9) i \u207b\u00b9' g i) = \u220f i \u2208 s, \u03ba a ((fun i \u03c9 j \u21a6 f i j \u03c9) i \u207b\u00b9' ((I i).restrict \u207b\u00b9' u i)) := by"}, {"state": "", "tactic": "refine Finset.prod_congr rfl fun i hi \u21a6 ?_"}, {"state": "", "tactic": "rw [hu i hi]"}, {"state": "", "tactic": "have h5 := h1 s (fun i hi \u21a6 \u27e8g i, mg i hi, rfl\u27e9) simp_rw [h4, h4'] at h5 \u22a2"}, {"state": "", "tactic": "have h6 i (f : (j : T i) \u2192 \u03a9 \u2192 \ud835\udce7 i j) : (fun \u03c9 j \u21a6 f j \u03c9) \u207b\u00b9' ((I i).restrict \u207b\u00b9' (u i)) = (fun \u03c9 (j : I i) \u21a6 f j \u03c9) \u207b\u00b9' (u i) := rfl simp_rw [h6] at h5 \u22a2"}, {"state": "", "tactic": "have h : \u2200\u1d50 a \u2202P, \u2200 i \u2208 s, (fun \u03c9 (j : I i) \u21a6 X i j \u03c9) =\u1d50[\u03ba a] (fun \u03c9 (j : I i) \u21a6 X' i j \u03c9) := by"}, {"state": "", "tactic": "refine (ae_ball_iff s.countable_toSet).2 fun i hi \u21a6 ?_"}, {"state": "", "tactic": "have := (hI i hi).to_subtype filter_upwards [ae_all_iff.2 fun (j : I i) \u21a6 h2 i j] with a (ha : \u2200 (j : I i), \u2200\u1d50 \u03c9 \u2202\u03ba a, X i j \u03c9 = X' i j \u03c9) filter_upwards [ae_all_iff.2 ha] with \u03c9 h\u03c9 using by simp [h\u03c9] filter_upwards [h5, h] with a ha1 ha2"}, {"state": "", "tactic": "refine .trans (measure_congr (ae_eq_set_biInter s.countable_toSet (fun i hi \u21a6 ((ha2 i hi).preimage _).symm))) (ha1.trans ?_)"}, {"state": "", "tactic": "refine Finset.prod_congr rfl fun i hi \u21a6 ?_"}, {"state": "", "tactic": "rw [measure_congr ((ha2 i hi).preimage _)] /-- Stochastic processes $((X^s_t)_{t \\in T_s})_{s \\in S}$ are mutually independent if for all $s_1, ..., s_n$ and all $t^{s_i}_1, ..., t^{s_i}_{p_i}$ the families $(X^{s_1}_{t^{s_1}_1}, ..., X^{s_1}_{t^{s_1}_{p_1}}), ..., (X^{s_n}_{t^{s_n}_1}, ..., X^{s_n}_{t^{s_n}_{p_n}})$ are mutually independent. -/"}], "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 4376, "declarations_count": 759, "diagnostics_count": 0, "duplicate_fingerprint": "bbabb581ad787f00", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1999, "lean_code_chars": 0, "lean_code_ratio": 0.0, "length_bucket": "short", "line_count": 48, "natural_language_chars": 4376, "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.Probability.Independence.Process.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.Probability.Independence.Process.Basic.iIndepFun`:\nState 0: \u22a2 lemma iIndepFun.process_congr {T : S \u2192 Type*} {\ud835\udce7 : (i : S) \u2192 (j : T i) \u2192 Type*}\n [\u2200 i j, MeasurableSpace (\ud835\udce7 i j)] {X X' : (i : S) \u2192 (j : T i) \u2192 \u03a9 \u2192 \ud835\udce7 i j}\n (h1 : iIndepFun (fun i \u03c9 j \u21a6 X i j \u03c9) \u03ba P) (h2 : \u2200 i j, \u2200\u1d50 a \u2202P, X i j =\u1d50[\u03ba a] X' i j) :\n iIndepFun (fun i \u03c9 j \u21a6 X' i j \u03c9) \u03ba P\nTactic: intro s f hf\nState 1: \u22a2 \nTactic: choose! g mg hg using hf\nState 2: \u22a2 \nTactic: have h3 : \u22c2 i \u2208 s, f i = \u22c2 i \u2208 s, (fun i \u03c9 j \u21a6 X' i j \u03c9) i \u207b\u00b9' g i := (biInf_congr hg).symm\nState 3: \u22a2 \nTactic: have h3' a : \u220f i \u2208 s, \u03ba a (f i) = \u220f i \u2208 s, \u03ba a ((fun i \u03c9 j \u21a6 X' i j \u03c9) i \u207b\u00b9' g i) := by\nState 4: \u22a2 \nTactic: refine Finset.prod_congr rfl fun i hi \u21a6 ?_\nState 5: \u22a2 \nTactic: rw [hg i hi] simp_rw [h3, h3']\nState 6: \u22a2 \nTactic: choose! I u hI hu using fun i hi \u21a6 (mg i hi).eq_preimage_restrict_countable\nState 7: \u22a2 \nTactic: have h4 (f : (i : S) \u2192 (j : T i) \u2192 \u03a9 \u2192 \ud835\udce7 i j) : \u22c2 i \u2208 s, (fun i \u03c9 j \u21a6 f i j \u03c9) i \u207b\u00b9' g i = \u22c2 i \u2208 s, (fun i \u03c9 j \u21a6 f i j \u03c9) i \u207b\u00b9' ((I i).restrict \u207b\u00b9' u i) := (biInf_congr (fun i hi \u21a6 by rw [hu i hi])).symm\nState 8: \u22a2 \nTactic: have h4' a (f : (i : S) \u2192 (j : T i) \u2192 \u03a9 \u2192 \ud835\udce7 i j) : \u220f i \u2208 s, \u03ba a ((fun i \u03c9 j \u21a6 f i j \u03c9) i \u207b\u00b9' g i) = \u220f i \u2208 s, \u03ba a ((fun i \u03c9 j \u21a6 f i j \u03c9) i \u207b\u00b9' ((I i).restrict \u207b\u00b9' u i)) := by\nState 9: \u22a2 \nTactic: refine Finset.prod_congr rfl fun i hi \u21a6 ?_\nState 10: \u22a2 \nTactic: rw [hu i hi]\nState 11: \u22a2 \nTactic: have h5 := h1 s (fun i hi \u21a6 \u27e8g i, mg i hi, rfl\u27e9) simp_rw [h4, h4'] at h5 \u22a2\nState 12: \u22a2 \nTactic: have h6 i (f : (j : T i) \u2192 \u03a9 \u2192 \ud835\udce7 i j) : (fun \u03c9 j \u21a6 f j \u03c9) \u207b\u00b9' ((I i).restrict \u207b\u00b9' (u i)) = (fun \u03c9 (j : I i) \u21a6 f j \u03c9) \u207b\u00b9' (u i) := rfl simp_rw [h6] at h5 \u22a2\nState 13: \u22a2 \nTactic: have h : \u2200\u1d50 a \u2202P, \u2200 i \u2208 s, (fun \u03c9 (j : I i) \u21a6 X i j \u03c9) =\u1d50[\u03ba a] (fun \u03c9 (j : I i) \u21a6 X' i j \u03c9) := by\nState 14: \u22a2 \nTactic: refine (ae_ball_iff s.countable_toSet).2 fun i hi \u21a6 ?_\nState 15: \u22a2 \nTactic: have := (hI i hi).to_subtype filter_upwards [ae_all_iff.2 fun (j : I i) \u21a6 h2 i j] with a (ha : \u2200 (j : I i), \u2200\u1d50 \u03c9 \u2202\u03ba a, X i j \u03c9 = X' i j \u03c9) filter_upwards [ae_all_iff.2 ha] with \u03c9 h\u03c9 using by simp [h\u03c9] filter_upwards [h5, h] with a ha1 ha2\nState 16: \u22a2 \nTactic: refine .trans (measure_congr (ae_eq_set_biInter s.countable_toSet (fun i hi \u21a6 ((ha2 i hi).preimage _).symm))) (ha1.trans ?_)\nState 17: \u22a2 \nTactic: refine Finset.prod_congr rfl fun i hi \u21a6 ?_\nState 18: \u22a2 \nTactic: rw [measure_congr ((ha2 i hi).preimage _)] /-- Stochastic processes $((X^s_t)_{t \\in T_s})_{s \\in S}$ are mutually independent if for all $s_1, ..., s_n$ and all $t^{s_i}_1, ..., t^{s_i}_{p_i}$ the families $(X^{s_1}_{t^{s_1}_1}, ..., X^{s_1}_{t^{s_1}_{p_1}}), ..., (X^{s_n}_{t^{s_n}_1}, ..., X^{s_n}_{t^{s_n}_{p_n}})$ are mutually independent. -/\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.Probability.Independence.Process.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.Probability.Independence.Process.Basic.iIndepFun`:\nState 0: \u22a2 lemma iIndepFun.process_congr {T : S \u2192 Type*} {\ud835\udce7 : (i : S) \u2192 (j : T i) \u2192 Type*}\n [\u2200 i j, MeasurableSpace (\ud835\udce7 i j)] {X X' : (i : S) \u2192 (j : T i) \u2192 \u03a9 \u2192 \ud835\udce7 i j}\n (h1 : iIndepFun (fun i \u03c9 j \u21a6 X i j \u03c9) \u03ba P) (h2 : \u2200 i j, \u2200\u1d50 a \u2202P, X i j =\u1d50[\u03ba a] X' i j) :\n iIndepFun (fun i \u03c9 j \u21a6 X' i j \u03c9) \u03ba P\nTactic: intro s f hf\nState 1: \u22a2 \nTactic: choose! g mg hg using hf\nState 2: \u22a2 \nTactic: have h3 : \u22c2 i \u2208 s, f i = \u22c2 i \u2208 s, (fun i \u03c9 j \u21a6 X' i j \u03c9) i \u207b\u00b9' g i := (biInf_congr hg).symm\nState 3: \u22a2 \nTactic: have h3' a : \u220f i \u2208 s, \u03ba a (f i) = \u220f i \u2208 s, \u03ba a ((fun i \u03c9 j \u21a6 X' i j \u03c9) i \u207b\u00b9' g i) := by\nState 4: \u22a2 \nTactic: refine Finset.prod_congr rfl fun i hi \u21a6 ?_\nState 5: \u22a2 \nTactic: rw [hg i hi] simp_rw [h3, h3']\nState 6: \u22a2 \nTactic: choose! I u hI hu using fun i hi \u21a6 (mg i hi).eq_preimage_restrict_countable\nState 7: \u22a2 \nTactic: have h4 (f : (i : S) \u2192 (j : T i) \u2192 \u03a9 \u2192 \ud835\udce7 i j) : \u22c2 i \u2208 s, (fun i \u03c9 j \u21a6 f i j \u03c9) i \u207b\u00b9' g i = \u22c2 i \u2208 s, (fun i \u03c9 j \u21a6 f i j \u03c9) i \u207b\u00b9' ((I i).restrict \u207b\u00b9' u i) := (biInf_congr (fun i hi \u21a6 by rw [hu i hi])).symm\nState 8: \u22a2 \nTactic: have h4' a (f : (i : S) \u2192 (j : T i) \u2192 \u03a9 \u2192 \ud835\udce7 i j) : \u220f i \u2208 s, \u03ba a ((fun i \u03c9 j \u21a6 f i j \u03c9) i \u207b\u00b9' g i) = \u220f i \u2208 s, \u03ba a ((fun i \u03c9 j \u21a6 f i j \u03c9) i \u207b\u00b9' ((I i).restrict \u207b\u00b9' u i)) := by\nState 9: \u22a2 \nTactic: refine Finset.prod_congr rfl fun i hi \u21a6 ?_\nState 10: \u22a2 \nTactic: rw [hu i hi]\nState 11: \u22a2 \nTactic: have h5 := h1 s (fun i hi \u21a6 \u27e8g i, mg i hi, rfl\u27e9) simp_rw [h4, h4'] at h5 \u22a2\nState 12: \u22a2 \nTactic: have h6 i (f : (j : T i) \u2192 \u03a9 \u2192 \ud835\udce7 i j) : (fun \u03c9 j \u21a6 f j \u03c9) \u207b\u00b9' ((I i).restrict \u207b\u00b9' (u i)) = (fun \u03c9 (j : I i) \u21a6 f j \u03c9) \u207b\u00b9' (u i) := rfl simp_rw [h6] at h5 \u22a2\nState 13: \u22a2 \nTactic: have h : \u2200\u1d50 a \u2202P, \u2200 i \u2208 s, (fun \u03c9 (j : I i) \u21a6 X i j \u03c9) =\u1d50[\u03ba a] (fun \u03c9 (j : I i) \u21a6 X' i j \u03c9) := by\nState 14: \u22a2 \nTactic: refine (ae_ball_iff s.countable_toSet).2 fun i hi \u21a6 ?_\nState 15: \u22a2 \nTactic: have := (hI i hi).to_subtype filter_upwards [ae_all_iff.2 fun (j : I i) \u21a6 h2 i j] with a (ha : \u2200 (j : I i), \u2200\u1d50 \u03c9 \u2202\u03ba a, X i j \u03c9 = X' i j \u03c9) filter_upwards [ae_all_iff.2 ha] with \u03c9 h\u03c9 using by simp [h\u03c9] filter_upwards [h5, h] with a ha1 ha2\nState 16: \u22a2 \nTactic: refine .trans (measure_congr (ae_eq_set_biInter s.countable_toSet (fun i hi \u21a6 ((ha2 i hi).preimage _).symm))) (ha1.trans ?_)\nState 17: \u22a2 \nTactic: refine Finset.prod_congr rfl fun i hi \u21a6 ?_\nState 18: \u22a2 \nTactic: rw [measure_congr ((ha2 i hi).preimage _)] /-- Stochastic processes $((X^s_t)_{t \\in T_s})_{s \\in S}$ are mutually independent if for all $s_1, ..., s_n$ and all $t^{s_i}_1, ..., t^{s_i}_{p_i}$ the families $(X^{s_1}_{t^{s_1}_1}, ..., X^{s_1}_{t^{s_1}_{p_1}}), ..., (X^{s_n}_{t^{s_n}_1}, ..., X^{s_n}_{t^{s_n}_{p_n}})$ are mutually independent. -/\n```\n\nQuestion: what is the next tactic after the last recorded state, and why?[/INST]", "sample_id": "E-Mathlib.Probability.Independence.Process.Basic.iIndepFun", "source": {"declaration": "Mathlib.Probability.Independence.Process.Basic.iIndepFun", "file": "Mathlib/Probability/Independence/Process/Basic.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Probability.Independence.Process.Basic", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Probability/Independence/Process/Basic.lean#L196", "span": "L196-L237"}} {"admission": {"accepted_for_ptq_calibration": true, "decision_layer": "deterministic", "reason_codes": []}, "category": "D", "construction": {"context_enriched": true, "excerpt": "```lean\ntheorem addHaar_frontier (hs : Convex \u211d s) : \u03bc (frontier s) = 0 := by\n/- If `s` is included in a hyperplane, then `frontier s \u2286 closure s` is included in the same\n hyperplane, hence it has measure zero. -/\n rcases ne_or_eq (affineSpan \u211d s) \u22a4 with hspan | hspan\n \u00b7 refine measure_mono_null ?_ (addHaar_affineSubspace _ _ hspan)\n exact frontier_subset_closure.trans\n (closure_minimal (subset_affineSpan _ _) (affineSpan \u211d s).closed_of_finiteDimensional)\n rw [\u2190 hs.interior_nonempty_iff_affineSpan_eq_top] at hspan\n rcases hspan with \u27e8x, hx\u27e9\n /- Without loss of generality, `s` is bounded. Indeed, `\u2202s \u2286 \u22c3 n, \u2202(s \u2229 ball x (n + 1))`, hence it\n suffices to prove that `\u2200 n, \u03bc (s \u2229 ball x (n + 1)) = 0`; the latter set is bounded.\n -/\n suffices H : \u2200 t : Set E, Convex \u211d t \u2192 x \u2208 interior t \u2192 IsBounded t \u2192 \u03bc (frontier t) = 0 by\n let B : \u2115 \u2192 Set E := fun n => ball x (n + 1)\n have : \u03bc (\u22c3 n : \u2115, frontier (s \u2229 B n)) = 0 := by\n refine measure_iUnion_null fun n =>\n H _ (hs.inter (convex_ball _ _)) ?_ (isBounded_ball.subset inter_subset_right)\n rw [interior_inter, isOpen_ball.interior_eq]\n exact \u27e8hx, mem_ball_self (add_pos_of_nonneg_of_pos n.cast_nonneg zero_lt_one)\u27e9\n refine measure_mono_null (fun y hy => ?_) this; clear this\n set N : \u2115 := \u230adist y x\u230b\u208a\n refine mem_iUnion.2 \u27e8N, ?_\u27e9\n have hN : y \u2208 B N := by simp [B, N, Nat.lt_floor_add_one]\n suffices y \u2208 frontier (s \u2229 B N) \u2229 B N from this.1\n rw [frontier_inter_open_inter isOpen_ball]\n exact \u27e8hy, hN\u27e9\n intro s hs hx hb\n /- Since `s` is bounded, we have `\u03bc (interior s) \u2260 \u221e`, hence it suffices to prove\n `\u03bc (closure s) \u2264 \u03bc (interior s)`. -/\n replace hb : \u03bc (interior s) \u2260 \u221e := (hb.subset interior_subset).measure_lt_top.ne\n suffices \u03bc (closure s) \u2264 \u03bc (interior s) by\n rwa [frontier, measure_diff interior_subset_closure isOpen_interior.nullMeasurableSet hb,\n tsub_eq_zero_iff_le]\n /- Due to `Convex.closure_subset_image_homothety_interior_of_one_lt`, for any `r > 1` we have\n `closure s \u2286 homothety x r '' interior s`, hence `\u03bc (closure s) \u2264 r ^ d * \u03bc (interior s)`,\n where `d = finrank \u211d E`. -/\n set d : \u2115 := Module.finrank \u211d E\n have : \u2200 r : \u211d\u22650, 1 < r \u2192 \u03bc (closure s) \u2264 \u2191(r ^ d) * \u03bc (interior s) := fun r hr \u21a6 by\n refine (measure_mono <|\n hs.closure_subset_image_homothety_interior_of_one_lt hx r hr).trans_eq ?_\n rw [addHaar_image_homothety, \u2190 NNReal.coe_pow, NNReal.abs_eq, ENNReal.ofReal_coe_nnreal]\n have : \u2200\u1da0 (r : \u211d\u22650) in \ud835\udcdd[>] 1, \u03bc (closure s) \u2264 \u2191(r ^ d) * \u03bc (interior s) :=\n mem_of_superset self_mem_nhdsWithin this\n -- Taking the limit as `r \u2192 1`, we get `\u03bc (closure s) \u2264 \u03bc (interior s)`.\n refine ge_of_tendsto ?_ this\n refine (((ENNReal.continuous_mul_const hb).comp\n (ENNReal.continuous_coe.comp (continuous_pow d))).tendsto' _ _ ?_).mono_left nhdsWithin_le_nhds\n simp\n\n/-- A convex set in a finite-dimensional real vector space is null measurable with respect to an\nadditive Haar measure on this space. -/\nprotected theorem nullMeasurableSet (hs : Convex \u211d s) : NullMeasurableSet s \u03bc :=\n nullMeasurableSet_of_null_frontier (hs.addHaar_frontier \u03bc)\n\nend Convex\n```", "instruction": "Edit `addHaar_frontier` so it still compiles and the proof is simplified where possible. Return the full updated `addHaar_frontier` block.", "proof_is_oneliner": false, "source_grounded_context_enriched": true, "target_span": "L35-L89", "untouched_role": "context_length_stress"}, "environment": {}, "evaluation_stratum": "context_length_stress", "measurements": {"approximate_tokens": false, "chars": 3847, "declarations_count": 439, "diagnostics_count": 0, "duplicate_fingerprint": "f26becc785ba1d1c", "hidden_proof_leakage": "none", "imports_count": 0, "input_tokens": 1443, "lean_code_chars": 3134, "lean_code_ratio": 0.8147, "length_bucket": "short", "line_count": 64, "natural_language_chars": 713, "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.Analysis.Convex.Measure).", "role": "system"}, {"content": "You are editing a file in `Mathlib/Analysis/Convex/Measure.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Analysis.Convex.Measure.addHaar_frontier`, L35-L89)\nOpen namespaces: MeasureTheory, MeasureTheory.Measure, Set, Metric, Filter, Bornology, Module, (finrank)\n\nRelevant lemmas available in scope: `frontier_subset_closure.trans`, `hN`, `s`\n\n```lean\ntheorem addHaar_frontier (hs : Convex \u211d s) : \u03bc (frontier s) = 0 := by\n/- If `s` is included in a hyperplane, then `frontier s \u2286 closure s` is included in the same\n hyperplane, hence it has measure zero. -/\n rcases ne_or_eq (affineSpan \u211d s) \u22a4 with hspan | hspan\n \u00b7 refine measure_mono_null ?_ (addHaar_affineSubspace _ _ hspan)\n exact frontier_subset_closure.trans\n (closure_minimal (subset_affineSpan _ _) (affineSpan \u211d s).closed_of_finiteDimensional)\n rw [\u2190 hs.interior_nonempty_iff_affineSpan_eq_top] at hspan\n rcases hspan with \u27e8x, hx\u27e9\n /- Without loss of generality, `s` is bounded. Indeed, `\u2202s \u2286 \u22c3 n, \u2202(s \u2229 ball x (n + 1))`, hence it\n suffices to prove that `\u2200 n, \u03bc (s \u2229 ball x (n + 1)) = 0`; the latter set is bounded.\n -/\n suffices H : \u2200 t : Set E, Convex \u211d t \u2192 x \u2208 interior t \u2192 IsBounded t \u2192 \u03bc (frontier t) = 0 by\n let B : \u2115 \u2192 Set E := fun n => ball x (n + 1)\n have : \u03bc (\u22c3 n : \u2115, frontier (s \u2229 B n)) = 0 := by\n refine measure_iUnion_null fun n =>\n H _ (hs.inter (convex_ball _ _)) ?_ (isBounded_ball.subset inter_subset_right)\n rw [interior_inter, isOpen_ball.interior_eq]\n exact \u27e8hx, mem_ball_self (add_pos_of_nonneg_of_pos n.cast_nonneg zero_lt_one)\u27e9\n refine measure_mono_null (fun y hy => ?_) this; clear this\n set N : \u2115 := \u230adist y x\u230b\u208a\n refine mem_iUnion.2 \u27e8N, ?_\u27e9\n have hN : y \u2208 B N := by simp [B, N, Nat.lt_floor_add_one]\n suffices y \u2208 frontier (s \u2229 B N) \u2229 B N from this.1\n rw [frontier_inter_open_inter isOpen_ball]\n exact \u27e8hy, hN\u27e9\n intro s hs hx hb\n /- Since `s` is bounded, we have `\u03bc (interior s) \u2260 \u221e`, hence it suffices to prove\n `\u03bc (closure s) \u2264 \u03bc (interior s)`. -/\n replace hb : \u03bc (interior s) \u2260 \u221e := (hb.subset interior_subset).measure_lt_top.ne\n suffices \u03bc (closure s) \u2264 \u03bc (interior s) by\n rwa [frontier, measure_diff interior_subset_closure isOpen_interior.nullMeasurableSet hb,\n tsub_eq_zero_iff_le]\n /- Due to `Convex.closure_subset_image_homothety_interior_of_one_lt`, for any `r > 1` we have\n `closure s \u2286 homothety x r '' interior s`, hence `\u03bc (closure s) \u2264 r ^ d * \u03bc (interior s)`,\n where `d = finrank \u211d E`. -/\n set d : \u2115 := Module.finrank \u211d E\n have : \u2200 r : \u211d\u22650, 1 < r \u2192 \u03bc (closure s) \u2264 \u2191(r ^ d) * \u03bc (interior s) := fun r hr \u21a6 by\n refine (measure_mono <|\n hs.closure_subset_image_homothety_interior_of_one_lt hx r hr).trans_eq ?_\n rw [addHaar_image_homothety, \u2190 NNReal.coe_pow, NNReal.abs_eq, ENNReal.ofReal_coe_nnreal]\n have : \u2200\u1da0 (r : \u211d\u22650) in \ud835\udcdd[>] 1, \u03bc (closure s) \u2264 \u2191(r ^ d) * \u03bc (interior s) :=\n mem_of_superset self_mem_nhdsWithin this\n -- Taking the limit as `r \u2192 1`, we get `\u03bc (closure s) \u2264 \u03bc (interior s)`.\n refine ge_of_tendsto ?_ this\n refine (((ENNReal.continuous_mul_const hb).comp\n (ENNReal.continuous_coe.comp (continuous_pow d))).tendsto' _ _ ?_).mono_left nhdsWithin_le_nhds\n simp\n\n/-- A convex set in a finite-dimensional real vector space is null measurable with respect to an\nadditive Haar measure on this space. -/\nprotected theorem nullMeasurableSet (hs : Convex \u211d s) : NullMeasurableSet s \u03bc :=\n nullMeasurableSet_of_null_frontier (hs.addHaar_frontier \u03bc)\n\nend Convex\n```\n\n## Edit instruction\nEdit `addHaar_frontier` so it still compiles and the proof is simplified where possible. Return the full updated `addHaar_frontier` 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.Analysis.Convex.Measure).\n\nYou are editing a file in `Mathlib/Analysis/Convex/Measure.lean` (mathlib commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6).\n\n## Current excerpt (around `Mathlib.Analysis.Convex.Measure.addHaar_frontier`, L35-L89)\nOpen namespaces: MeasureTheory, MeasureTheory.Measure, Set, Metric, Filter, Bornology, Module, (finrank)\n\nRelevant lemmas available in scope: `frontier_subset_closure.trans`, `hN`, `s`\n\n```lean\ntheorem addHaar_frontier (hs : Convex \u211d s) : \u03bc (frontier s) = 0 := by\n/- If `s` is included in a hyperplane, then `frontier s \u2286 closure s` is included in the same\n hyperplane, hence it has measure zero. -/\n rcases ne_or_eq (affineSpan \u211d s) \u22a4 with hspan | hspan\n \u00b7 refine measure_mono_null ?_ (addHaar_affineSubspace _ _ hspan)\n exact frontier_subset_closure.trans\n (closure_minimal (subset_affineSpan _ _) (affineSpan \u211d s).closed_of_finiteDimensional)\n rw [\u2190 hs.interior_nonempty_iff_affineSpan_eq_top] at hspan\n rcases hspan with \u27e8x, hx\u27e9\n /- Without loss of generality, `s` is bounded. Indeed, `\u2202s \u2286 \u22c3 n, \u2202(s \u2229 ball x (n + 1))`, hence it\n suffices to prove that `\u2200 n, \u03bc (s \u2229 ball x (n + 1)) = 0`; the latter set is bounded.\n -/\n suffices H : \u2200 t : Set E, Convex \u211d t \u2192 x \u2208 interior t \u2192 IsBounded t \u2192 \u03bc (frontier t) = 0 by\n let B : \u2115 \u2192 Set E := fun n => ball x (n + 1)\n have : \u03bc (\u22c3 n : \u2115, frontier (s \u2229 B n)) = 0 := by\n refine measure_iUnion_null fun n =>\n H _ (hs.inter (convex_ball _ _)) ?_ (isBounded_ball.subset inter_subset_right)\n rw [interior_inter, isOpen_ball.interior_eq]\n exact \u27e8hx, mem_ball_self (add_pos_of_nonneg_of_pos n.cast_nonneg zero_lt_one)\u27e9\n refine measure_mono_null (fun y hy => ?_) this; clear this\n set N : \u2115 := \u230adist y x\u230b\u208a\n refine mem_iUnion.2 \u27e8N, ?_\u27e9\n have hN : y \u2208 B N := by simp [B, N, Nat.lt_floor_add_one]\n suffices y \u2208 frontier (s \u2229 B N) \u2229 B N from this.1\n rw [frontier_inter_open_inter isOpen_ball]\n exact \u27e8hy, hN\u27e9\n intro s hs hx hb\n /- Since `s` is bounded, we have `\u03bc (interior s) \u2260 \u221e`, hence it suffices to prove\n `\u03bc (closure s) \u2264 \u03bc (interior s)`. -/\n replace hb : \u03bc (interior s) \u2260 \u221e := (hb.subset interior_subset).measure_lt_top.ne\n suffices \u03bc (closure s) \u2264 \u03bc (interior s) by\n rwa [frontier, measure_diff interior_subset_closure isOpen_interior.nullMeasurableSet hb,\n tsub_eq_zero_iff_le]\n /- Due to `Convex.closure_subset_image_homothety_interior_of_one_lt`, for any `r > 1` we have\n `closure s \u2286 homothety x r '' interior s`, hence `\u03bc (closure s) \u2264 r ^ d * \u03bc (interior s)`,\n where `d = finrank \u211d E`. -/\n set d : \u2115 := Module.finrank \u211d E\n have : \u2200 r : \u211d\u22650, 1 < r \u2192 \u03bc (closure s) \u2264 \u2191(r ^ d) * \u03bc (interior s) := fun r hr \u21a6 by\n refine (measure_mono <|\n hs.closure_subset_image_homothety_interior_of_one_lt hx r hr).trans_eq ?_\n rw [addHaar_image_homothety, \u2190 NNReal.coe_pow, NNReal.abs_eq, ENNReal.ofReal_coe_nnreal]\n have : \u2200\u1da0 (r : \u211d\u22650) in \ud835\udcdd[>] 1, \u03bc (closure s) \u2264 \u2191(r ^ d) * \u03bc (interior s) :=\n mem_of_superset self_mem_nhdsWithin this\n -- Taking the limit as `r \u2192 1`, we get `\u03bc (closure s) \u2264 \u03bc (interior s)`.\n refine ge_of_tendsto ?_ this\n refine (((ENNReal.continuous_mul_const hb).comp\n (ENNReal.continuous_coe.comp (continuous_pow d))).tendsto' _ _ ?_).mono_left nhdsWithin_le_nhds\n simp\n\n/-- A convex set in a finite-dimensional real vector space is null measurable with respect to an\nadditive Haar measure on this space. -/\nprotected theorem nullMeasurableSet (hs : Convex \u211d s) : NullMeasurableSet s \u03bc :=\n nullMeasurableSet_of_null_frontier (hs.addHaar_frontier \u03bc)\n\nend Convex\n```\n\n## Edit instruction\nEdit `addHaar_frontier` so it still compiles and the proof is simplified where possible. Return the full updated `addHaar_frontier` block.\n", "sample_id": "D-Mathlib.Analysis.Convex.Measure.addHaar_frontier", "source": {"declaration": "Mathlib.Analysis.Convex.Measure.addHaar_frontier", "file": "Mathlib/Analysis/Convex/Measure.lean", "mathlib_commit": "5e932f97dd25535344f80f9dd8da3aab83df0fe6", "module": "Mathlib.Analysis.Convex.Measure", "source_url": "https://github.com/leanprover-community/mathlib4/blob/5e932f97dd25535344f80f9dd8da3aab83df0fe6/Mathlib/Analysis/Convex/Measure.lean#L35", "span": "L35-L89"}}