l3lab/ntp-mathlib huggingface dataset:
/-- A functor to an `R`-linear category lifts to a functor from its `R`-linear completion.
-/
@[simps]
def lift (F : C ⥤ D) : Free R C ⥤ D where
  obj X := F.obj X
  map {X Y} f := f.sum fun f' r => r • F.map f'
  map_id := by dsimp [CategoryTheory.categoryFree]; simp
  map_comp {X Y Z} f g := by
    apply Finsupp.induction_linear f
    · -- Porting note: simp used to be able to close this goal
      dsimp
      rw [Limits.zero_comp, sum_zero_index, Limits.zero_comp]
    · intro f₁ f₂ w₁ w₂
      rw [add_comp]
      dsimp at *
      rw [Finsupp.sum_add_index', Finsupp.sum_add_index']
      · simp only [w₁, w₂, add_comp]
      · 

Proof state:
case hadd.h_zero
R : Type u_1
inst✝⁴ : CommRing R
C : Type u
inst✝³ : Category.{v, u} C
D : Type u
inst✝² : Category.{v, u} D
inst✝¹ : Preadditive D
inst✝ : Linear R D
F : C ⥤ D
X Y Z : Free R C
f : X ⟶ Y
g : Y ⟶ Z
f₁ f₂ : (X ⟶ Y) →₀ R
w₁ : (sum (f₁ ≫ g) fun f' r => r • F.map f') = (sum f₁ fun f' r => r • F.map f') ≫ sum g fun f' r => r • F.map f'
w₂ : (sum (f₂ ≫ g) fun f' r => r • F.map f') = (sum f₂ fun f' r => r • F.map f') ≫ sum g fun f' r => r • F.map f'
⊢ ∀ (a : X ⟶ Y), 0 • F.map a = 0

Next tactic:
intros
/-- A functor to an `R`-linear category lifts to a functor from its `R`-linear completion.
-/
@[simps]
def lift (F : C ⥤ D) : Free R C ⥤ D where
  obj X := F.obj X
  map {X Y} f := f.sum fun f' r => r • F.map f'
  map_id := by dsimp [CategoryTheory.categoryFree]; simp
  map_comp {X Y Z} f g := by
    apply Finsupp.induction_linear f
    · -- Porting note: simp used to be able to close this goal
      dsimp
      rw [Limits.zero_comp, sum_zero_index, Limits.zero_comp]
    · intro f₁ f₂ w₁ w₂
      rw [add_comp]
      dsimp at *
      rw [Finsupp.sum_add_index', Finsupp.sum_add_index']
      · simp only [w₁, w₂, add_comp]
      · intros; 

Proof state:
case hadd.h_zero
R : Type u_1
inst✝⁴ : CommRing R
C : Type u
inst✝³ : Category.{v, u} C
D : Type u
inst✝² : Category.{v, u} D
inst✝¹ : Preadditive D
inst✝ : Linear R D
F : C ⥤ D
X Y Z : Free R C
f : X ⟶ Y
g : Y ⟶ Z
f₁ f₂ : (X ⟶ Y) →₀ R
w₁ : (sum (f₁ ≫ g) fun f' r => r • F.map f') = (sum f₁ fun f' r => r • F.map f') ≫ sum g fun f' r => r • F.map f'
w₂ : (sum (f₂ ≫ g) fun f' r => r • F.map f') = (sum f₂ fun f' r => r • F.map f') ≫ sum g fun f' r => r • F.map f'
a✝ : X ⟶ Y
⊢ 0 • F.map a✝ = 0

Next tactic:
rw [zero_smul]
/-- A functor to an `R`-linear category lifts to a functor from its `R`-linear completion.
-/
@[simps]
def lift (F : C ⥤ D) : Free R C ⥤ D where
  obj X := F.obj X
  map {X Y} f := f.sum fun f' r => r • F.map f'
  map_id := by dsimp [CategoryTheory.categoryFree]; simp
  map_comp {X Y Z} f g := by
    apply Finsupp.induction_linear f
    · -- Porting note: simp used to be able to close this goal
      dsimp
      rw [Limits.zero_comp, sum_zero_index, Limits.zero_comp]
    · intro f₁ f₂ w₁ w₂
      rw [add_comp]
      dsimp at *
      rw [Finsupp.sum_add_index', Finsupp.sum_add_index']
      · simp only [w₁, w₂, add_comp]
      · intros; rw [zero_smul]
      · 

Proof state:
case hadd.h_add
R : Type u_1
inst✝⁴ : CommRing R
C : Type u
inst✝³ : Category.{v, u} C
D : Type u
inst✝² : Category.{v, u} D
inst✝¹ : Preadditive D
inst✝ : Linear R D
F : C ⥤ D
X Y Z : Free R C
f : X ⟶ Y
g : Y ⟶ Z
f₁ f₂ : (X ⟶ Y) →₀ R
w₁ : (sum (f₁ ≫ g) fun f' r => r • F.map f') = (sum f₁ fun f' r => r • F.map f') ≫ sum g fun f' r => r • F.map f'
w₂ : (sum (f₂ ≫ g) fun f' r => r • F.map f') = (sum f₂ fun f' r => r • F.map f') ≫ sum g fun f' r => r • F.map f'
⊢ ∀ (a : X ⟶ Y) (b₁ b₂ : R), (b₁ + b₂) • F.map a = b₁ • F.map a + b₂ • F.map a

Next tactic:
intros
/-- A functor to an `R`-linear category lifts to a functor from its `R`-linear completion.
-/
@[simps]
def lift (F : C ⥤ D) : Free R C ⥤ D where
  obj X := F.obj X
  map {X Y} f := f.sum fun f' r => r • F.map f'
  map_id := by dsimp [CategoryTheory.categoryFree]; simp
  map_comp {X Y Z} f g := by
    apply Finsupp.induction_linear f
    · -- Porting note: simp used to be able to close this goal
      dsimp
      rw [Limits.zero_comp, sum_zero_index, Limits.zero_comp]
    · intro f₁ f₂ w₁ w₂
      rw [add_comp]
      dsimp at *
      rw [Finsupp.sum_add_index', Finsupp.sum_add_index']
      · simp only [w₁, w₂, add_comp]
      · intros; rw [zero_smul]
      · intros; 

Proof state:
case hadd.h_add
R : Type u_1
inst✝⁴ : CommRing R
C : Type u
inst✝³ : Category.{v, u} C
D : Type u
inst✝² : Category.{v, u} D
inst✝¹ : Preadditive D
inst✝ : Linear R D
F : C ⥤ D
X Y Z : Free R C
f : X ⟶ Y
g : Y ⟶ Z
f₁ f₂ : (X ⟶ Y) →₀ R
w₁ : (sum (f₁ ≫ g) fun f' r => r • F.map f') = (sum f₁ fun f' r => r • F.map f') ≫ sum g fun f' r => r • F.map f'
w₂ : (sum (f₂ ≫ g) fun f' r => r • F.map f') = (sum f₂ fun f' r => r • F.map f') ≫ sum g fun f' r => r • F.map f'
a✝ : X ⟶ Y
b₁✝ b₂✝ : R
⊢ (b₁✝ + b₂✝) • F.map a✝ = b₁✝ • F.map a✝ + b₂✝ • F.map a✝

Next tactic:
simp only [add_smul]
/-- A functor to an `R`-linear category lifts to a functor from its `R`-linear completion.
-/
@[simps]
def lift (F : C ⥤ D) : Free R C ⥤ D where
  obj X := F.obj X
  map {X Y} f := f.sum fun f' r => r • F.map f'
  map_id := by dsimp [CategoryTheory.categoryFree]; simp
  map_comp {X Y Z} f g := by
    apply Finsupp.induction_linear f
    · -- Porting note: simp used to be able to close this goal
      dsimp
      rw [Limits.zero_comp, sum_zero_index, Limits.zero_comp]
    · intro f₁ f₂ w₁ w₂
      rw [add_comp]
      dsimp at *
      rw [Finsupp.sum_add_index', Finsupp.sum_add_index']
      · simp only [w₁, w₂, add_comp]
      · intros; rw [zero_smul]
      · intros; simp only [add_smul]
      · 

Proof state:
case hadd.h_zero
R : Type u_1
inst✝⁴ : CommRing R
C : Type u
inst✝³ : Category.{v, u} C
D : Type u
inst✝² : Category.{v, u} D
inst✝¹ : Preadditive D
inst✝ : Linear R D
F : C ⥤ D
X Y Z : Free R C
f : X ⟶ Y
g : Y ⟶ Z
f₁ f₂ : (X ⟶ Y) →₀ R
w₁ : (sum (f₁ ≫ g) fun f' r => r • F.map f') = (sum f₁ fun f' r => r • F.map f') ≫ sum g fun f' r => r • F.map f'
w₂ : (sum (f₂ ≫ g) fun f' r => r • F.map f') = (sum f₂ fun f' r => r • F.map f') ≫ sum g fun f' r => r • F.map f'
⊢ ∀ (a : X ⟶ Z), 0 • F.map a = 0

Next tactic:
intros
/-- A functor to an `R`-linear category lifts to a functor from its `R`-linear completion.
-/
@[simps]
def lift (F : C ⥤ D) : Free R C ⥤ D where
  obj X := F.obj X
  map {X Y} f := f.sum fun f' r => r • F.map f'
  map_id := by dsimp [CategoryTheory.categoryFree]; simp
  map_comp {X Y Z} f g := by
    apply Finsupp.induction_linear f
    · -- Porting note: simp used to be able to close this goal
      dsimp
      rw [Limits.zero_comp, sum_zero_index, Limits.zero_comp]
    · intro f₁ f₂ w₁ w₂
      rw [add_comp]
      dsimp at *
      rw [Finsupp.sum_add_index', Finsupp.sum_add_index']
      · simp only [w₁, w₂, add_comp]
      · intros; rw [zero_smul]
      · intros; simp only [add_smul]
      · intros; 

Proof state:
case hadd.h_zero
R : Type u_1
inst✝⁴ : CommRing R
C : Type u
inst✝³ : Category.{v, u} C
D : Type u
inst✝² : Category.{v, u} D
inst✝¹ : Preadditive D
inst✝ : Linear R D
F : C ⥤ D
X Y Z : Free R C
f : X ⟶ Y
g : Y ⟶ Z
f₁ f₂ : (X ⟶ Y) →₀ R
w₁ : (sum (f₁ ≫ g) fun f' r => r • F.map f') = (sum f₁ fun f' r => r • F.map f') ≫ sum g fun f' r => r • F.map f'
w₂ : (sum (f₂ ≫ g) fun f' r => r • F.map f') = (sum f₂ fun f' r => r • F.map f') ≫ sum g fun f' r => r • F.map f'
a✝ : X ⟶ Z
⊢ 0 • F.map a✝ = 0

Next tactic:
rw [zero_smul]
/-- A functor to an `R`-linear category lifts to a functor from its `R`-linear completion.
-/
@[simps]
def lift (F : C ⥤ D) : Free R C ⥤ D where
  obj X := F.obj X
  map {X Y} f := f.sum fun f' r => r • F.map f'
  map_id := by dsimp [CategoryTheory.categoryFree]; simp
  map_comp {X Y Z} f g := by
    apply Finsupp.induction_linear f
    · -- Porting note: simp used to be able to close this goal
      dsimp
      rw [Limits.zero_comp, sum_zero_index, Limits.zero_comp]
    · intro f₁ f₂ w₁ w₂
      rw [add_comp]
      dsimp at *
      rw [Finsupp.sum_add_index', Finsupp.sum_add_index']
      · simp only [w₁, w₂, add_comp]
      · intros; rw [zero_smul]
      · intros; simp only [add_smul]
      · intros; rw [zero_smul]
      · 

Proof state:
case hadd.h_add
R : Type u_1
inst✝⁴ : CommRing R
C : Type u
inst✝³ : Category.{v, u} C
D : Type u
inst✝² : Category.{v, u} D
inst✝¹ : Preadditive D
inst✝ : Linear R D
F : C ⥤ D
X Y Z : Free R C
f : X ⟶ Y
g : Y ⟶ Z
f₁ f₂ : (X ⟶ Y) →₀ R
w₁ : (sum (f₁ ≫ g) fun f' r => r • F.map f') = (sum f₁ fun f' r => r • F.map f') ≫ sum g fun f' r => r • F.map f'
w₂ : (sum (f₂ ≫ g) fun f' r => r • F.map f') = (sum f₂ fun f' r => r • F.map f') ≫ sum g fun f' r => r • F.map f'
⊢ ∀ (a : X ⟶ Z) (b₁ b₂ : R), (b₁ + b₂) • F.map a = b₁ • F.map a + b₂ • F.map a

Next tactic:
intros
/-- A functor to an `R`-linear category lifts to a functor from its `R`-linear completion.
-/
@[simps]
def lift (F : C ⥤ D) : Free R C ⥤ D where
  obj X := F.obj X
  map {X Y} f := f.sum fun f' r => r • F.map f'
  map_id := by dsimp [CategoryTheory.categoryFree]; simp
  map_comp {X Y Z} f g := by
    apply Finsupp.induction_linear f
    · -- Porting note: simp used to be able to close this goal
      dsimp
      rw [Limits.zero_comp, sum_zero_index, Limits.zero_comp]
    · intro f₁ f₂ w₁ w₂
      rw [add_comp]
      dsimp at *
      rw [Finsupp.sum_add_index', Finsupp.sum_add_index']
      · simp only [w₁, w₂, add_comp]
      · intros; rw [zero_smul]
      · intros; simp only [add_smul]
      · intros; rw [zero_smul]
      · intros; 

Proof state:
case hadd.h_add
R : Type u_1
inst✝⁴ : CommRing R
C : Type u
inst✝³ : Category.{v, u} C
D : Type u
inst✝² : Category.{v, u} D
inst✝¹ : Preadditive D
inst✝ : Linear R D
F : C ⥤ D
X Y Z : Free R C
f : X ⟶ Y
g : Y ⟶ Z
f₁ f₂ : (X ⟶ Y) →₀ R
w₁ : (sum (f₁ ≫ g) fun f' r => r • F.map f') = (sum f₁ fun f' r => r • F.map f') ≫ sum g fun f' r => r • F.map f'
w₂ : (sum (f₂ ≫ g) fun f' r => r • F.map f') = (sum f₂ fun f' r => r • F.map f') ≫ sum g fun f' r => r • F.map f'
a✝ : X ⟶ Z
b₁✝ b₂✝ : R
⊢ (b₁✝ + b₂✝) • F.map a✝ = b₁✝ • F.map a✝ + b₂✝ • F.map a✝

Next tactic:
simp only [add_smul]
/-- A functor to an `R`-linear category lifts to a functor from its `R`-linear completion.
-/
@[simps]
def lift (F : C ⥤ D) : Free R C ⥤ D where
  obj X := F.obj X
  map {X Y} f := f.sum fun f' r => r • F.map f'
  map_id := by dsimp [CategoryTheory.categoryFree]; simp
  map_comp {X Y Z} f g := by
    apply Finsupp.induction_linear f
    · -- Porting note: simp used to be able to close this goal
      dsimp
      rw [Limits.zero_comp, sum_zero_index, Limits.zero_comp]
    · intro f₁ f₂ w₁ w₂
      rw [add_comp]
      dsimp at *
      rw [Finsupp.sum_add_index', Finsupp.sum_add_index']
      · simp only [w₁, w₂, add_comp]
      · intros; rw [zero_smul]
      · intros; simp only [add_smul]
      · intros; rw [zero_smul]
      · intros; simp only [add_smul]
    · 

Proof state:
case hsingle
R : Type u_1
inst✝⁴ : CommRing R
C : Type u
inst✝³ : Category.{v, u} C
D : Type u
inst✝² : Category.{v, u} D
inst✝¹ : Preadditive D
inst✝ : Linear R D
F : C ⥤ D
X Y Z : Free R C
f : X ⟶ Y
g : Y ⟶ Z
⊢ ∀ (a : X ⟶ Y) (b : R),
    { obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map ((fun₀ | a => b) ≫ g) =
      ({ obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map fun₀ | a => b) ≫
        { obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map g

Next tactic:
intro f' r
/-- A functor to an `R`-linear category lifts to a functor from its `R`-linear completion.
-/
@[simps]
def lift (F : C ⥤ D) : Free R C ⥤ D where
  obj X := F.obj X
  map {X Y} f := f.sum fun f' r => r • F.map f'
  map_id := by dsimp [CategoryTheory.categoryFree]; simp
  map_comp {X Y Z} f g := by
    apply Finsupp.induction_linear f
    · -- Porting note: simp used to be able to close this goal
      dsimp
      rw [Limits.zero_comp, sum_zero_index, Limits.zero_comp]
    · intro f₁ f₂ w₁ w₂
      rw [add_comp]
      dsimp at *
      rw [Finsupp.sum_add_index', Finsupp.sum_add_index']
      · simp only [w₁, w₂, add_comp]
      · intros; rw [zero_smul]
      · intros; simp only [add_smul]
      · intros; rw [zero_smul]
      · intros; simp only [add_smul]
    · intro f' r
      

Proof state:
case hsingle
R : Type u_1
inst✝⁴ : CommRing R
C : Type u
inst✝³ : Category.{v, u} C
D : Type u
inst✝² : Category.{v, u} D
inst✝¹ : Preadditive D
inst✝ : Linear R D
F : C ⥤ D
X Y Z : Free R C
f : X ⟶ Y
g : Y ⟶ Z
f' : X ⟶ Y
r : R
⊢ { obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map ((fun₀ | f' => r) ≫ g) =
    ({ obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map fun₀ | f' => r) ≫
      { obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map g

Next tactic:
apply Finsupp.induction_linear g
/-- A functor to an `R`-linear category lifts to a functor from its `R`-linear completion.
-/
@[simps]
def lift (F : C ⥤ D) : Free R C ⥤ D where
  obj X := F.obj X
  map {X Y} f := f.sum fun f' r => r • F.map f'
  map_id := by dsimp [CategoryTheory.categoryFree]; simp
  map_comp {X Y Z} f g := by
    apply Finsupp.induction_linear f
    · -- Porting note: simp used to be able to close this goal
      dsimp
      rw [Limits.zero_comp, sum_zero_index, Limits.zero_comp]
    · intro f₁ f₂ w₁ w₂
      rw [add_comp]
      dsimp at *
      rw [Finsupp.sum_add_index', Finsupp.sum_add_index']
      · simp only [w₁, w₂, add_comp]
      · intros; rw [zero_smul]
      · intros; simp only [add_smul]
      · intros; rw [zero_smul]
      · intros; simp only [add_smul]
    · intro f' r
      apply Finsupp.induction_linear g
      · -- Porting note: simp used to be able to close this goal
        

Proof state:
case hsingle.h0
R : Type u_1
inst✝⁴ : CommRing R
C : Type u
inst✝³ : Category.{v, u} C
D : Type u
inst✝² : Category.{v, u} D
inst✝¹ : Preadditive D
inst✝ : Linear R D
F : C ⥤ D
X Y Z : Free R C
f : X ⟶ Y
g : Y ⟶ Z
f' : X ⟶ Y
r : R
⊢ { obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map ((fun₀ | f' => r) ≫ 0) =
    ({ obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map fun₀ | f' => r) ≫
      { obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map 0

Next tactic:
dsimp
/-- A functor to an `R`-linear category lifts to a functor from its `R`-linear completion.
-/
@[simps]
def lift (F : C ⥤ D) : Free R C ⥤ D where
  obj X := F.obj X
  map {X Y} f := f.sum fun f' r => r • F.map f'
  map_id := by dsimp [CategoryTheory.categoryFree]; simp
  map_comp {X Y Z} f g := by
    apply Finsupp.induction_linear f
    · -- Porting note: simp used to be able to close this goal
      dsimp
      rw [Limits.zero_comp, sum_zero_index, Limits.zero_comp]
    · intro f₁ f₂ w₁ w₂
      rw [add_comp]
      dsimp at *
      rw [Finsupp.sum_add_index', Finsupp.sum_add_index']
      · simp only [w₁, w₂, add_comp]
      · intros; rw [zero_smul]
      · intros; simp only [add_smul]
      · intros; rw [zero_smul]
      · intros; simp only [add_smul]
    · intro f' r
      apply Finsupp.induction_linear g
      · -- Porting note: simp used to be able to close this goal
        dsimp
        

Proof state:
case hsingle.h0
R : Type u_1
inst✝⁴ : CommRing R
C : Type u
inst✝³ : Category.{v, u} C
D : Type u
inst✝² : Category.{v, u} D
inst✝¹ : Preadditive D
inst✝ : Linear R D
F : C ⥤ D
X Y Z : Free R C
f : X ⟶ Y
g : Y ⟶ Z
f' : X ⟶ Y
r : R
⊢ (sum ((fun₀ | f' => r) ≫ 0) fun f' r => r • F.map f') = (sum (fun₀ | f' => r) fun f' r => r • F.map f') ≫ 0

Next tactic:
rw [Limits.comp_zero, sum_zero_index, Limits.comp_zero]
/-- A functor to an `R`-linear category lifts to a functor from its `R`-linear completion.
-/
@[simps]
def lift (F : C ⥤ D) : Free R C ⥤ D where
  obj X := F.obj X
  map {X Y} f := f.sum fun f' r => r • F.map f'
  map_id := by dsimp [CategoryTheory.categoryFree]; simp
  map_comp {X Y Z} f g := by
    apply Finsupp.induction_linear f
    · -- Porting note: simp used to be able to close this goal
      dsimp
      rw [Limits.zero_comp, sum_zero_index, Limits.zero_comp]
    · intro f₁ f₂ w₁ w₂
      rw [add_comp]
      dsimp at *
      rw [Finsupp.sum_add_index', Finsupp.sum_add_index']
      · simp only [w₁, w₂, add_comp]
      · intros; rw [zero_smul]
      · intros; simp only [add_smul]
      · intros; rw [zero_smul]
      · intros; simp only [add_smul]
    · intro f' r
      apply Finsupp.induction_linear g
      · -- Porting note: simp used to be able to close this goal
        dsimp
        rw [Limits.comp_zero, sum_zero_index, Limits.comp_zero]
      · 

Proof state:
case hsingle.hadd
R : Type u_1
inst✝⁴ : CommRing R
C : Type u
inst✝³ : Category.{v, u} C
D : Type u
inst✝² : Category.{v, u} D
inst✝¹ : Preadditive D
inst✝ : Linear R D
F : C ⥤ D
X Y Z : Free R C
f : X ⟶ Y
g : Y ⟶ Z
f' : X ⟶ Y
r : R
⊢ ∀ (f g : (Y ⟶ Z) →₀ R),
    { obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map ((fun₀ | f' => r) ≫ f) =
        ({ obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map fun₀ | f' => r) ≫
          { obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map f →
      { obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map ((fun₀ | f' => r) ≫ g) =
          ({ obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map fun₀ | f' => r) ≫
            { obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map g →
        { obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map
            ((fun₀ | f' => r) ≫ (f + g)) =
          ({ obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map fun₀ | f' => r) ≫
            { obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map (f + g)

Next tactic:
intro f₁ f₂ w₁ w₂
/-- A functor to an `R`-linear category lifts to a functor from its `R`-linear completion.
-/
@[simps]
def lift (F : C ⥤ D) : Free R C ⥤ D where
  obj X := F.obj X
  map {X Y} f := f.sum fun f' r => r • F.map f'
  map_id := by dsimp [CategoryTheory.categoryFree]; simp
  map_comp {X Y Z} f g := by
    apply Finsupp.induction_linear f
    · -- Porting note: simp used to be able to close this goal
      dsimp
      rw [Limits.zero_comp, sum_zero_index, Limits.zero_comp]
    · intro f₁ f₂ w₁ w₂
      rw [add_comp]
      dsimp at *
      rw [Finsupp.sum_add_index', Finsupp.sum_add_index']
      · simp only [w₁, w₂, add_comp]
      · intros; rw [zero_smul]
      · intros; simp only [add_smul]
      · intros; rw [zero_smul]
      · intros; simp only [add_smul]
    · intro f' r
      apply Finsupp.induction_linear g
      · -- Porting note: simp used to be able to close this goal
        dsimp
        rw [Limits.comp_zero, sum_zero_index, Limits.comp_zero]
      · intro f₁ f₂ w₁ w₂
        

Proof state:
case hsingle.hadd
R : Type u_1
inst✝⁴ : CommRing R
C : Type u
inst✝³ : Category.{v, u} C
D : Type u
inst✝² : Category.{v, u} D
inst✝¹ : Preadditive D
inst✝ : Linear R D
F : C ⥤ D
X Y Z : Free R C
f : X ⟶ Y
g : Y ⟶ Z
f' : X ⟶ Y
r : R
f₁ f₂ : (Y ⟶ Z) →₀ R
w₁ :
  { obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map ((fun₀ | f' => r) ≫ f₁) =
    ({ obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map fun₀ | f' => r) ≫
      { obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map f₁
w₂ :
  { obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map ((fun₀ | f' => r) ≫ f₂) =
    ({ obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map fun₀ | f' => r) ≫
      { obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map f₂
⊢ { obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map ((fun₀ | f' => r) ≫ (f₁ + f₂)) =
    ({ obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map fun₀ | f' => r) ≫
      { obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map (f₁ + f₂)

Next tactic:
rw [comp_add]
/-- A functor to an `R`-linear category lifts to a functor from its `R`-linear completion.
-/
@[simps]
def lift (F : C ⥤ D) : Free R C ⥤ D where
  obj X := F.obj X
  map {X Y} f := f.sum fun f' r => r • F.map f'
  map_id := by dsimp [CategoryTheory.categoryFree]; simp
  map_comp {X Y Z} f g := by
    apply Finsupp.induction_linear f
    · -- Porting note: simp used to be able to close this goal
      dsimp
      rw [Limits.zero_comp, sum_zero_index, Limits.zero_comp]
    · intro f₁ f₂ w₁ w₂
      rw [add_comp]
      dsimp at *
      rw [Finsupp.sum_add_index', Finsupp.sum_add_index']
      · simp only [w₁, w₂, add_comp]
      · intros; rw [zero_smul]
      · intros; simp only [add_smul]
      · intros; rw [zero_smul]
      · intros; simp only [add_smul]
    · intro f' r
      apply Finsupp.induction_linear g
      · -- Porting note: simp used to be able to close this goal
        dsimp
        rw [Limits.comp_zero, sum_zero_index, Limits.comp_zero]
      · intro f₁ f₂ w₁ w₂
        rw [comp_add]
        

Proof state:
case hsingle.hadd
R : Type u_1
inst✝⁴ : CommRing R
C : Type u
inst✝³ : Category.{v, u} C
D : Type u
inst✝² : Category.{v, u} D
inst✝¹ : Preadditive D
inst✝ : Linear R D
F : C ⥤ D
X Y Z : Free R C
f : X ⟶ Y
g : Y ⟶ Z
f' : X ⟶ Y
r : R
f₁ f₂ : (Y ⟶ Z) →₀ R
w₁ :
  { obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map ((fun₀ | f' => r) ≫ f₁) =
    ({ obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map fun₀ | f' => r) ≫
      { obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map f₁
w₂ :
  { obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map ((fun₀ | f' => r) ≫ f₂) =
    ({ obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map fun₀ | f' => r) ≫
      { obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map f₂
⊢ { obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map
      ((fun₀ | f' => r) ≫ f₁ + (fun₀ | f' => r) ≫ f₂) =
    ({ obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map fun₀ | f' => r) ≫
      { obj := fun X => F.obj X, map := fun {X Y} f => sum f fun f' r => r • F.map f' }.map (f₁ + f₂)

Next tactic:
dsimp at *
/-- A functor to an `R`-linear category lifts to a functor from its `R`-linear completion.
-/
@[simps]
def lift (F : C ⥤ D) : Free R C ⥤ D where
  obj X := F.obj X
  map {X Y} f := f.sum fun f' r => r • F.map f'
  map_id := by dsimp [CategoryTheory.categoryFree]; simp
  map_comp {X Y Z} f g := by
    apply Finsupp.induction_linear f
    · -- Porting note: simp used to be able to close this goal
      dsimp
      rw [Limits.zero_comp, sum_zero_index, Limits.zero_comp]
    · intro f₁ f₂ w₁ w₂
      rw [add_comp]
      dsimp at *
      rw [Finsupp.sum_add_index', Finsupp.sum_add_index']
      · simp only [w₁, w₂, add_comp]
      · intros; rw [zero_smul]
      · intros; simp only [add_smul]
      · intros; rw [zero_smul]
      · intros; simp only [add_smul]
    · intro f' r
      apply Finsupp.induction_linear g
      · -- Porting note: simp used to be able to close this goal
        dsimp
        rw [Limits.comp_zero, sum_zero_index, Limits.comp_zero]
      · intro f₁ f₂ w₁ w₂
        rw [comp_add]
        dsimp at *
        

Proof state:
case hsingle.hadd
R : Type u_1
inst✝⁴ : CommRing R
C : Type u
inst✝³ : Category.{v, u} C
D : Type u
inst✝² : Category.{v, u} D
inst✝¹ : Preadditive D
inst✝ : Linear R D
F : C ⥤ D
X Y Z : Free R C
f : X ⟶ Y
g : Y ⟶ Z
f' : X ⟶ Y
r : R
f₁ f₂ : (Y ⟶ Z) →₀ R
w₁ :
  (sum ((fun₀ | f' => r) ≫ f₁) fun f' r => r • F.map f') =
    (sum (fun₀ | f' => r) fun f' r => r • F.map f') ≫ sum f₁ fun f' r => r • F.map f'
w₂ :
  (sum ((fun₀ | f' => r) ≫ f₂) fun f' r => r • F.map f') =
    (sum (fun₀ | f' => r) fun f' r => r • F.map f') ≫ sum f₂ fun f' r => r • F.map f'
⊢ (sum ((fun₀ | f' => r) ≫ f₁ + (fun₀ | f' => r) ≫ f₂) fun f' r => r • F.map f') =
    (sum (fun₀ | f' => r) fun f' r => r • F.map f') ≫ sum (f₁ + f₂) fun f' r => r • F.map f'

Next tactic:
rw [Finsupp.sum_add_index', Finsupp.sum_add_index']