l3lab/ntp-mathlib huggingface dataset:
theorem small_fullSubcategory_cofilteredClosure :
    Small.{max v w} (FullSubcategory (CofilteredClosure f)) := by
  refine' small_of_injective_of_exists
    (CofilteredClosureSmall.abstractCofilteredClosureRealization f) FullSubcategory.ext _
  rintro ⟨j, h⟩
  induction h with
  | base x => exact ⟨⟨0, ⟨x⟩⟩, rfl⟩
  | min hj₁ hj₂ ih ih' =>
    rcases ih with ⟨⟨n, x⟩, rfl⟩
    rcases ih' with ⟨⟨m, y⟩, rfl⟩
    refine' ⟨⟨(Max.max n m).succ, CofilteredClosureSmall.InductiveStep.min _ _ x y⟩, rfl⟩
    all_goals apply Nat.lt_succ_of_le
    

Proof state:
case mk.min.intro.mk.intro.mk.refine'_1.a
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsCofilteredOrEmpty C
α : Type w
f : α → C
j : C
n : ℕ
x : (CategoryTheory.IsCofiltered.CofilteredClosureSmall.bundledAbstractCofilteredClosure f n).fst
hj₁ :
  CofilteredClosure f
    (CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := n, snd := x })
m : ℕ
y : (CategoryTheory.IsCofiltered.CofilteredClosureSmall.bundledAbstractCofilteredClosure f m).fst
hj₂ :
  CofilteredClosure f
    (CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := m, snd := y })
⊢ n ≤ max n m
case mk.min.intro.mk.intro.mk.refine'_2.a
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsCofilteredOrEmpty C
α : Type w
f : α → C
j : C
n : ℕ
x : (CategoryTheory.IsCofiltered.CofilteredClosureSmall.bundledAbstractCofilteredClosure f n).fst
hj₁ :
  CofilteredClosure f
    (CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := n, snd := x })
m : ℕ
y : (CategoryTheory.IsCofiltered.CofilteredClosureSmall.bundledAbstractCofilteredClosure f m).fst
hj₂ :
  CofilteredClosure f
    (CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := m, snd := y })
⊢ m ≤ max n m

Next tactic:
exacts [Nat.le_max_left _ _, Nat.le_max_right _ _]
theorem small_fullSubcategory_cofilteredClosure :
    Small.{max v w} (FullSubcategory (CofilteredClosure f)) := by
  refine' small_of_injective_of_exists
    (CofilteredClosureSmall.abstractCofilteredClosureRealization f) FullSubcategory.ext _
  rintro ⟨j, h⟩
  induction h with
  | base x => exact ⟨⟨0, ⟨x⟩⟩, rfl⟩
  | min hj₁ hj₂ ih ih' =>
    rcases ih with ⟨⟨n, x⟩, rfl⟩
    rcases ih' with ⟨⟨m, y⟩, rfl⟩
    refine' ⟨⟨(Max.max n m).succ, CofilteredClosureSmall.InductiveStep.min _ _ x y⟩, rfl⟩
    all_goals apply Nat.lt_succ_of_le
    exacts [Nat.le_max_left _ _, Nat.le_max_right _ _]
  

Proof state:
case mk.eq
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsCofilteredOrEmpty C
α : Type w
f : α → C
j j✝ j'✝ : C
hj₁ : CofilteredClosure f j✝
hj₂ : CofilteredClosure f j'✝
g g' : j✝ ⟶ j'✝
ih :
  ∃ a,
    CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f a =
      { obj := j✝, property := hj₁ }.obj
ih' :
  ∃ a,
    CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f a =
      { obj := j'✝, property := hj₂ }.obj
⊢ ∃ a,
    CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f a =
      { obj := eq g g', property := (_ : CofilteredClosure f (eq g g')) }.obj

Next tactic:
| eq hj₁ hj₂ g g' ih ih' =>
    rcases ih with ⟨⟨n, x⟩, rfl⟩
    rcases ih' with ⟨⟨m, y⟩, rfl⟩
    refine' ⟨⟨(Max.max n m).succ, CofilteredClosureSmall.InductiveStep.eq _ _ x y g g'⟩, rfl⟩
    all_goals apply Nat.lt_succ_of_le
    exacts [Nat.le_max_left _ _, Nat.le_max_right _ _]
theorem small_fullSubcategory_cofilteredClosure :
    Small.{max v w} (FullSubcategory (CofilteredClosure f)) := by
  refine' small_of_injective_of_exists
    (CofilteredClosureSmall.abstractCofilteredClosureRealization f) FullSubcategory.ext _
  rintro ⟨j, h⟩
  induction h with
  | base x => exact ⟨⟨0, ⟨x⟩⟩, rfl⟩
  | min hj₁ hj₂ ih ih' =>
    rcases ih with ⟨⟨n, x⟩, rfl⟩
    rcases ih' with ⟨⟨m, y⟩, rfl⟩
    refine' ⟨⟨(Max.max n m).succ, CofilteredClosureSmall.InductiveStep.min _ _ x y⟩, rfl⟩
    all_goals apply Nat.lt_succ_of_le
    exacts [Nat.le_max_left _ _, Nat.le_max_right _ _]
  | eq hj₁ hj₂ g g' ih ih' =>
    

Proof state:
case mk.eq
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsCofilteredOrEmpty C
α : Type w
f : α → C
j j✝ j'✝ : C
hj₁ : CofilteredClosure f j✝
hj₂ : CofilteredClosure f j'✝
g g' : j✝ ⟶ j'✝
ih :
  ∃ a,
    CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f a =
      { obj := j✝, property := hj₁ }.obj
ih' :
  ∃ a,
    CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f a =
      { obj := j'✝, property := hj₂ }.obj
⊢ ∃ a,
    CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f a =
      { obj := eq g g', property := (_ : CofilteredClosure f (eq g g')) }.obj

Next tactic:
rcases ih with ⟨⟨n, x⟩, rfl⟩
theorem small_fullSubcategory_cofilteredClosure :
    Small.{max v w} (FullSubcategory (CofilteredClosure f)) := by
  refine' small_of_injective_of_exists
    (CofilteredClosureSmall.abstractCofilteredClosureRealization f) FullSubcategory.ext _
  rintro ⟨j, h⟩
  induction h with
  | base x => exact ⟨⟨0, ⟨x⟩⟩, rfl⟩
  | min hj₁ hj₂ ih ih' =>
    rcases ih with ⟨⟨n, x⟩, rfl⟩
    rcases ih' with ⟨⟨m, y⟩, rfl⟩
    refine' ⟨⟨(Max.max n m).succ, CofilteredClosureSmall.InductiveStep.min _ _ x y⟩, rfl⟩
    all_goals apply Nat.lt_succ_of_le
    exacts [Nat.le_max_left _ _, Nat.le_max_right _ _]
  | eq hj₁ hj₂ g g' ih ih' =>
    rcases ih with ⟨⟨n, x⟩, rfl⟩
    

Proof state:
case mk.eq.intro.mk
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsCofilteredOrEmpty C
α : Type w
f : α → C
j j'✝ : C
hj₂ : CofilteredClosure f j'✝
ih' :
  ∃ a,
    CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f a =
      { obj := j'✝, property := hj₂ }.obj
n : ℕ
x : (CategoryTheory.IsCofiltered.CofilteredClosureSmall.bundledAbstractCofilteredClosure f n).fst
hj₁ :
  CofilteredClosure f
    (CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := n, snd := x })
g g' :
  CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := n, snd := x } ⟶ j'✝
⊢ ∃ a,
    CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f a =
      { obj := eq g g', property := (_ : CofilteredClosure f (eq g g')) }.obj

Next tactic:
rcases ih' with ⟨⟨m, y⟩, rfl⟩
theorem small_fullSubcategory_cofilteredClosure :
    Small.{max v w} (FullSubcategory (CofilteredClosure f)) := by
  refine' small_of_injective_of_exists
    (CofilteredClosureSmall.abstractCofilteredClosureRealization f) FullSubcategory.ext _
  rintro ⟨j, h⟩
  induction h with
  | base x => exact ⟨⟨0, ⟨x⟩⟩, rfl⟩
  | min hj₁ hj₂ ih ih' =>
    rcases ih with ⟨⟨n, x⟩, rfl⟩
    rcases ih' with ⟨⟨m, y⟩, rfl⟩
    refine' ⟨⟨(Max.max n m).succ, CofilteredClosureSmall.InductiveStep.min _ _ x y⟩, rfl⟩
    all_goals apply Nat.lt_succ_of_le
    exacts [Nat.le_max_left _ _, Nat.le_max_right _ _]
  | eq hj₁ hj₂ g g' ih ih' =>
    rcases ih with ⟨⟨n, x⟩, rfl⟩
    rcases ih' with ⟨⟨m, y⟩, rfl⟩
    

Proof state:
case mk.eq.intro.mk.intro.mk
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsCofilteredOrEmpty C
α : Type w
f : α → C
j : C
n : ℕ
x : (CategoryTheory.IsCofiltered.CofilteredClosureSmall.bundledAbstractCofilteredClosure f n).fst
hj₁ :
  CofilteredClosure f
    (CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := n, snd := x })
m : ℕ
y : (CategoryTheory.IsCofiltered.CofilteredClosureSmall.bundledAbstractCofilteredClosure f m).fst
hj₂ :
  CofilteredClosure f
    (CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := m, snd := y })
g g' :
  CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := n, snd := x } ⟶
    CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := m, snd := y }
⊢ ∃ a,
    CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f a =
      { obj := eq g g', property := (_ : CofilteredClosure f (eq g g')) }.obj

Next tactic:
refine' ⟨⟨(Max.max n m).succ, CofilteredClosureSmall.InductiveStep.eq _ _ x y g g'⟩, rfl⟩
theorem small_fullSubcategory_cofilteredClosure :
    Small.{max v w} (FullSubcategory (CofilteredClosure f)) := by
  refine' small_of_injective_of_exists
    (CofilteredClosureSmall.abstractCofilteredClosureRealization f) FullSubcategory.ext _
  rintro ⟨j, h⟩
  induction h with
  | base x => exact ⟨⟨0, ⟨x⟩⟩, rfl⟩
  | min hj₁ hj₂ ih ih' =>
    rcases ih with ⟨⟨n, x⟩, rfl⟩
    rcases ih' with ⟨⟨m, y⟩, rfl⟩
    refine' ⟨⟨(Max.max n m).succ, CofilteredClosureSmall.InductiveStep.min _ _ x y⟩, rfl⟩
    all_goals apply Nat.lt_succ_of_le
    exacts [Nat.le_max_left _ _, Nat.le_max_right _ _]
  | eq hj₁ hj₂ g g' ih ih' =>
    rcases ih with ⟨⟨n, x⟩, rfl⟩
    rcases ih' with ⟨⟨m, y⟩, rfl⟩
    refine' ⟨⟨(Max.max n m).succ, CofilteredClosureSmall.InductiveStep.eq _ _ x y g g'⟩, rfl⟩
    

Proof state:
case mk.eq.intro.mk.intro.mk.refine'_1
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsCofilteredOrEmpty C
α : Type w
f : α → C
j : C
n : ℕ
x : (CategoryTheory.IsCofiltered.CofilteredClosureSmall.bundledAbstractCofilteredClosure f n).fst
hj₁ :
  CofilteredClosure f
    (CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := n, snd := x })
m : ℕ
y : (CategoryTheory.IsCofiltered.CofilteredClosureSmall.bundledAbstractCofilteredClosure f m).fst
hj₂ :
  CofilteredClosure f
    (CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := m, snd := y })
g g' :
  CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := n, snd := x } ⟶
    CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := m, snd := y }
⊢ n < max n m + 1
case mk.eq.intro.mk.intro.mk.refine'_2
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsCofilteredOrEmpty C
α : Type w
f : α → C
j : C
n : ℕ
x : (CategoryTheory.IsCofiltered.CofilteredClosureSmall.bundledAbstractCofilteredClosure f n).fst
hj₁ :
  CofilteredClosure f
    (CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := n, snd := x })
m : ℕ
y : (CategoryTheory.IsCofiltered.CofilteredClosureSmall.bundledAbstractCofilteredClosure f m).fst
hj₂ :
  CofilteredClosure f
    (CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := m, snd := y })
g g' :
  CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := n, snd := x } ⟶
    CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := m, snd := y }
⊢ m < max n m + 1

Next tactic:
all_goals apply Nat.lt_succ_of_le
theorem small_fullSubcategory_cofilteredClosure :
    Small.{max v w} (FullSubcategory (CofilteredClosure f)) := by
  refine' small_of_injective_of_exists
    (CofilteredClosureSmall.abstractCofilteredClosureRealization f) FullSubcategory.ext _
  rintro ⟨j, h⟩
  induction h with
  | base x => exact ⟨⟨0, ⟨x⟩⟩, rfl⟩
  | min hj₁ hj₂ ih ih' =>
    rcases ih with ⟨⟨n, x⟩, rfl⟩
    rcases ih' with ⟨⟨m, y⟩, rfl⟩
    refine' ⟨⟨(Max.max n m).succ, CofilteredClosureSmall.InductiveStep.min _ _ x y⟩, rfl⟩
    all_goals apply Nat.lt_succ_of_le
    exacts [Nat.le_max_left _ _, Nat.le_max_right _ _]
  | eq hj₁ hj₂ g g' ih ih' =>
    rcases ih with ⟨⟨n, x⟩, rfl⟩
    rcases ih' with ⟨⟨m, y⟩, rfl⟩
    refine' ⟨⟨(Max.max n m).succ, CofilteredClosureSmall.InductiveStep.eq _ _ x y g g'⟩, rfl⟩
    all_goals 

Proof state:
case mk.eq.intro.mk.intro.mk.refine'_1
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsCofilteredOrEmpty C
α : Type w
f : α → C
j : C
n : ℕ
x : (CategoryTheory.IsCofiltered.CofilteredClosureSmall.bundledAbstractCofilteredClosure f n).fst
hj₁ :
  CofilteredClosure f
    (CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := n, snd := x })
m : ℕ
y : (CategoryTheory.IsCofiltered.CofilteredClosureSmall.bundledAbstractCofilteredClosure f m).fst
hj₂ :
  CofilteredClosure f
    (CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := m, snd := y })
g g' :
  CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := n, snd := x } ⟶
    CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := m, snd := y }
⊢ n < max n m + 1

Next tactic:
apply Nat.lt_succ_of_le
theorem small_fullSubcategory_cofilteredClosure :
    Small.{max v w} (FullSubcategory (CofilteredClosure f)) := by
  refine' small_of_injective_of_exists
    (CofilteredClosureSmall.abstractCofilteredClosureRealization f) FullSubcategory.ext _
  rintro ⟨j, h⟩
  induction h with
  | base x => exact ⟨⟨0, ⟨x⟩⟩, rfl⟩
  | min hj₁ hj₂ ih ih' =>
    rcases ih with ⟨⟨n, x⟩, rfl⟩
    rcases ih' with ⟨⟨m, y⟩, rfl⟩
    refine' ⟨⟨(Max.max n m).succ, CofilteredClosureSmall.InductiveStep.min _ _ x y⟩, rfl⟩
    all_goals apply Nat.lt_succ_of_le
    exacts [Nat.le_max_left _ _, Nat.le_max_right _ _]
  | eq hj₁ hj₂ g g' ih ih' =>
    rcases ih with ⟨⟨n, x⟩, rfl⟩
    rcases ih' with ⟨⟨m, y⟩, rfl⟩
    refine' ⟨⟨(Max.max n m).succ, CofilteredClosureSmall.InductiveStep.eq _ _ x y g g'⟩, rfl⟩
    all_goals 

Proof state:
case mk.eq.intro.mk.intro.mk.refine'_2
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsCofilteredOrEmpty C
α : Type w
f : α → C
j : C
n : ℕ
x : (CategoryTheory.IsCofiltered.CofilteredClosureSmall.bundledAbstractCofilteredClosure f n).fst
hj₁ :
  CofilteredClosure f
    (CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := n, snd := x })
m : ℕ
y : (CategoryTheory.IsCofiltered.CofilteredClosureSmall.bundledAbstractCofilteredClosure f m).fst
hj₂ :
  CofilteredClosure f
    (CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := m, snd := y })
g g' :
  CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := n, snd := x } ⟶
    CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := m, snd := y }
⊢ m < max n m + 1

Next tactic:
apply Nat.lt_succ_of_le
theorem small_fullSubcategory_cofilteredClosure :
    Small.{max v w} (FullSubcategory (CofilteredClosure f)) := by
  refine' small_of_injective_of_exists
    (CofilteredClosureSmall.abstractCofilteredClosureRealization f) FullSubcategory.ext _
  rintro ⟨j, h⟩
  induction h with
  | base x => exact ⟨⟨0, ⟨x⟩⟩, rfl⟩
  | min hj₁ hj₂ ih ih' =>
    rcases ih with ⟨⟨n, x⟩, rfl⟩
    rcases ih' with ⟨⟨m, y⟩, rfl⟩
    refine' ⟨⟨(Max.max n m).succ, CofilteredClosureSmall.InductiveStep.min _ _ x y⟩, rfl⟩
    all_goals apply Nat.lt_succ_of_le
    exacts [Nat.le_max_left _ _, Nat.le_max_right _ _]
  | eq hj₁ hj₂ g g' ih ih' =>
    rcases ih with ⟨⟨n, x⟩, rfl⟩
    rcases ih' with ⟨⟨m, y⟩, rfl⟩
    refine' ⟨⟨(Max.max n m).succ, CofilteredClosureSmall.InductiveStep.eq _ _ x y g g'⟩, rfl⟩
    all_goals apply Nat.lt_succ_of_le
    

Proof state:
case mk.eq.intro.mk.intro.mk.refine'_1.a
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsCofilteredOrEmpty C
α : Type w
f : α → C
j : C
n : ℕ
x : (CategoryTheory.IsCofiltered.CofilteredClosureSmall.bundledAbstractCofilteredClosure f n).fst
hj₁ :
  CofilteredClosure f
    (CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := n, snd := x })
m : ℕ
y : (CategoryTheory.IsCofiltered.CofilteredClosureSmall.bundledAbstractCofilteredClosure f m).fst
hj₂ :
  CofilteredClosure f
    (CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := m, snd := y })
g g' :
  CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := n, snd := x } ⟶
    CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := m, snd := y }
⊢ n ≤ max n m
case mk.eq.intro.mk.intro.mk.refine'_2.a
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : IsCofilteredOrEmpty C
α : Type w
f : α → C
j : C
n : ℕ
x : (CategoryTheory.IsCofiltered.CofilteredClosureSmall.bundledAbstractCofilteredClosure f n).fst
hj₁ :
  CofilteredClosure f
    (CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := n, snd := x })
m : ℕ
y : (CategoryTheory.IsCofiltered.CofilteredClosureSmall.bundledAbstractCofilteredClosure f m).fst
hj₂ :
  CofilteredClosure f
    (CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := m, snd := y })
g g' :
  CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := n, snd := x } ⟶
    CategoryTheory.IsCofiltered.CofilteredClosureSmall.abstractCofilteredClosureRealization f { fst := m, snd := y }
⊢ m ≤ max n m

Next tactic:
exacts [Nat.le_max_left _ _, Nat.le_max_right _ _]
/-- A diagonal matrix is positive semidefinite iff its diagonal entries are nonnegative. -/
lemma posSemidef_diagonal_iff [DecidableEq n] {d : n → R} :
    PosSemidef (diagonal d) ↔ (∀ i : n, 0 ≤ d i) := by
  

Proof state:
m : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁶ : Fintype m
inst✝⁵ : Fintype n
inst✝⁴ : CommRing R
inst✝³ : PartialOrder R
inst✝² : StarOrderedRing R
inst✝¹ : IsROrC 𝕜
inst✝ : DecidableEq n
d : n → R
⊢ PosSemidef (diagonal d) ↔ ∀ (i : n), 0 ≤ d i

Next tactic:
refine ⟨fun ⟨_, hP⟩ i ↦ by simpa using hP (Pi.single i 1), ?_⟩
/-- A diagonal matrix is positive semidefinite iff its diagonal entries are nonnegative. -/
lemma posSemidef_diagonal_iff [DecidableEq n] {d : n → R} :
    PosSemidef (diagonal d) ↔ (∀ i : n, 0 ≤ d i) := by
  refine ⟨fun ⟨_, hP⟩ i ↦ by 

Proof state:
m : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁶ : Fintype m
inst✝⁵ : Fintype n
inst✝⁴ : CommRing R
inst✝³ : PartialOrder R
inst✝² : StarOrderedRing R
inst✝¹ : IsROrC 𝕜
inst✝ : DecidableEq n
d : n → R
x✝ : PosSemidef (diagonal d)
i : n
left✝ : IsHermitian (diagonal d)
hP : ∀ (x : n → R), 0 ≤ star x ⬝ᵥ mulVec (diagonal d) x
⊢ 0 ≤ d i

Next tactic:
simpa using hP (Pi.single i 1)
/-- A diagonal matrix is positive semidefinite iff its diagonal entries are nonnegative. -/
lemma posSemidef_diagonal_iff [DecidableEq n] {d : n → R} :
    PosSemidef (diagonal d) ↔ (∀ i : n, 0 ≤ d i) := by
  refine ⟨fun ⟨_, hP⟩ i ↦ by simpa using hP (Pi.single i 1), ?_⟩
  

Proof state:
m : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁶ : Fintype m
inst✝⁵ : Fintype n
inst✝⁴ : CommRing R
inst✝³ : PartialOrder R
inst✝² : StarOrderedRing R
inst✝¹ : IsROrC 𝕜
inst✝ : DecidableEq n
d : n → R
⊢ (∀ (i : n), 0 ≤ d i) → PosSemidef (diagonal d)

Next tactic:
refine fun hd ↦ ⟨isHermitian_diagonal_iff.2 <| fun i ↦ IsSelfAdjoint.of_nonneg (hd i), ?_⟩
/-- A diagonal matrix is positive semidefinite iff its diagonal entries are nonnegative. -/
lemma posSemidef_diagonal_iff [DecidableEq n] {d : n → R} :
    PosSemidef (diagonal d) ↔ (∀ i : n, 0 ≤ d i) := by
  refine ⟨fun ⟨_, hP⟩ i ↦ by simpa using hP (Pi.single i 1), ?_⟩
  refine fun hd ↦ ⟨isHermitian_diagonal_iff.2 <| fun i ↦ IsSelfAdjoint.of_nonneg (hd i), ?_⟩
  

Proof state:
m : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁶ : Fintype m
inst✝⁵ : Fintype n
inst✝⁴ : CommRing R
inst✝³ : PartialOrder R
inst✝² : StarOrderedRing R
inst✝¹ : IsROrC 𝕜
inst✝ : DecidableEq n
d : n → R
hd : ∀ (i : n), 0 ≤ d i
⊢ ∀ (x : n → R), 0 ≤ star x ⬝ᵥ mulVec (diagonal d) x

Next tactic:
refine fun x ↦ Finset.sum_nonneg fun i _ ↦ ?_
/-- A diagonal matrix is positive semidefinite iff its diagonal entries are nonnegative. -/
lemma posSemidef_diagonal_iff [DecidableEq n] {d : n → R} :
    PosSemidef (diagonal d) ↔ (∀ i : n, 0 ≤ d i) := by
  refine ⟨fun ⟨_, hP⟩ i ↦ by simpa using hP (Pi.single i 1), ?_⟩
  refine fun hd ↦ ⟨isHermitian_diagonal_iff.2 <| fun i ↦ IsSelfAdjoint.of_nonneg (hd i), ?_⟩
  refine fun x ↦ Finset.sum_nonneg fun i _ ↦ ?_
  

Proof state:
m : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁶ : Fintype m
inst✝⁵ : Fintype n
inst✝⁴ : CommRing R
inst✝³ : PartialOrder R
inst✝² : StarOrderedRing R
inst✝¹ : IsROrC 𝕜
inst✝ : DecidableEq n
d : n → R
hd : ∀ (i : n), 0 ≤ d i
x : n → R
i : n
x✝ : i ∈ Finset.univ
⊢ 0 ≤ star x i * mulVec (diagonal d) x i

Next tactic:
simpa only [mulVec_diagonal, mul_assoc] using conjugate_nonneg (hd i) _
lemma conjTranspose_mul_mul_same {A : Matrix n n R} (hA : PosSemidef A)
    {m : Type*} [Fintype m] (B : Matrix n m R) :
    PosSemidef (Bᴴ * A * B) := by
  

Proof state:
m✝ : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁶ : Fintype m✝
inst✝⁵ : Fintype n
inst✝⁴ : CommRing R
inst✝³ : PartialOrder R
inst✝² : StarOrderedRing R
inst✝¹ : IsROrC 𝕜
A : Matrix n n R
hA : PosSemidef A
m : Type u_5
inst✝ : Fintype m
B : Matrix n m R
⊢ PosSemidef (Bᴴ * A * B)

Next tactic:
constructor
lemma conjTranspose_mul_mul_same {A : Matrix n n R} (hA : PosSemidef A)
    {m : Type*} [Fintype m] (B : Matrix n m R) :
    PosSemidef (Bᴴ * A * B) := by
  constructor
  · 

Proof state:
case left
m✝ : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁶ : Fintype m✝
inst✝⁵ : Fintype n
inst✝⁴ : CommRing R
inst✝³ : PartialOrder R
inst✝² : StarOrderedRing R
inst✝¹ : IsROrC 𝕜
A : Matrix n n R
hA : PosSemidef A
m : Type u_5
inst✝ : Fintype m
B : Matrix n m R
⊢ IsHermitian (Bᴴ * A * B)

Next tactic:
exact isHermitian_conjTranspose_mul_mul B hA.1
lemma conjTranspose_mul_mul_same {A : Matrix n n R} (hA : PosSemidef A)
    {m : Type*} [Fintype m] (B : Matrix n m R) :
    PosSemidef (Bᴴ * A * B) := by
  constructor
  · exact isHermitian_conjTranspose_mul_mul B hA.1
  · 

Proof state:
case right
m✝ : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁶ : Fintype m✝
inst✝⁵ : Fintype n
inst✝⁴ : CommRing R
inst✝³ : PartialOrder R
inst✝² : StarOrderedRing R
inst✝¹ : IsROrC 𝕜
A : Matrix n n R
hA : PosSemidef A
m : Type u_5
inst✝ : Fintype m
B : Matrix n m R
⊢ ∀ (x : m → R), 0 ≤ star x ⬝ᵥ mulVec (Bᴴ * A * B) x

Next tactic:
intro x
lemma conjTranspose_mul_mul_same {A : Matrix n n R} (hA : PosSemidef A)
    {m : Type*} [Fintype m] (B : Matrix n m R) :
    PosSemidef (Bᴴ * A * B) := by
  constructor
  · exact isHermitian_conjTranspose_mul_mul B hA.1
  · intro x
    

Proof state:
case right
m✝ : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁶ : Fintype m✝
inst✝⁵ : Fintype n
inst✝⁴ : CommRing R
inst✝³ : PartialOrder R
inst✝² : StarOrderedRing R
inst✝¹ : IsROrC 𝕜
A : Matrix n n R
hA : PosSemidef A
m : Type u_5
inst✝ : Fintype m
B : Matrix n m R
x : m → R
⊢ 0 ≤ star x ⬝ᵥ mulVec (Bᴴ * A * B) x

Next tactic:
simpa only [star_mulVec, dotProduct_mulVec, vecMul_vecMul] using hA.2 (mulVec B x)
lemma mul_mul_conjTranspose_same {A : Matrix n n R} (hA : PosSemidef A)
    {m : Type*} [Fintype m] (B : Matrix m n R):
    PosSemidef (B * A * Bᴴ) := by
  

Proof state:
m✝ : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁶ : Fintype m✝
inst✝⁵ : Fintype n
inst✝⁴ : CommRing R
inst✝³ : PartialOrder R
inst✝² : StarOrderedRing R
inst✝¹ : IsROrC 𝕜
A : Matrix n n R
hA : PosSemidef A
m : Type u_5
inst✝ : Fintype m
B : Matrix m n R
⊢ PosSemidef (B * A * Bᴴ)

Next tactic:
simpa only [conjTranspose_conjTranspose] using hA.conjTranspose_mul_mul_same Bᴴ
theorem submatrix {M : Matrix n n R} (hM : M.PosSemidef) (e : m → n) :
    (M.submatrix e e).PosSemidef := by
  

Proof state:
m : Type u_1
n : Type u_2
R : Type u_3
𝕜 : Type u_4
inst✝⁵ : Fintype m
inst✝⁴ : Fintype n
inst✝³ : CommRing R
inst✝² : PartialOrder R
inst✝¹ : StarOrderedRing R
inst✝ : IsROrC 𝕜
M : Matrix n n R
hM : PosSemidef M
e : m → n
⊢ PosSemidef (Matrix.submatrix M e e)

Next tactic:
classical
  rw [(by simp : M = 1 * M * 1), submatrix_mul (he₂ := Function.bijective_id),
    submatrix_mul (he₂ := Function.bijective_id), submatrix_id_id]
  simpa only [conjTranspose_submatrix, conjTranspose_one] using
    conjTranspose_mul_mul_same hM (Matrix.submatrix 1 id e)