l3lab/ntp-mathlib huggingface dataset:
/-- If a family is anisotropic then its components must be. The converse is not true. -/
theorem anisotropic_of_pi [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)]
    {Q : ∀ i, QuadraticForm R (Mᵢ i)} (h : (pi Q).Anisotropic) : ∀ i, (Q i).Anisotropic := by
  simp_rw [Anisotropic, pi_apply, Function.funext_iff, Pi.zero_apply] at h
  intro i x hx
  classical
  have := h (Pi.single i x) ?_ i
  · rw [Pi.single_eq_same] at this
    

Proof state:
case refine_2
ι : Type u_1
R✝ : Type u_2
M₁ : Type u_3
M₂ : Type u_4
N₁ : Type u_5
N₂ : Type u_6
Mᵢ : ι → Type u_7
Nᵢ : ι → Type u_8
inst✝⁷ : CommSemiring R✝
inst✝⁶ : (i : ι) → AddCommMonoid (Mᵢ i)
inst✝⁵ : (i : ι) → AddCommMonoid (Nᵢ i)
inst✝⁴ : (i : ι) → Module R✝ (Mᵢ i)
inst✝³ : (i : ι) → Module R✝ (Nᵢ i)
inst✝² : Fintype ι
R : Type u_9
inst✝¹ : OrderedCommRing R
inst✝ : (i : ι) → Module R (Mᵢ i)
Q : (i : ι) → QuadraticForm R (Mᵢ i)
h : ∀ (x : (i : ι) → Mᵢ i), ∑ i : ι, (Q i) (x i) = 0 → ∀ (a : ι), x a = 0
i : ι
x : Mᵢ i
hx : (Q i) x = 0
this : x = 0
⊢ x = 0

Next tactic:
exact this
/-- If a family is anisotropic then its components must be. The converse is not true. -/
theorem anisotropic_of_pi [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)]
    {Q : ∀ i, QuadraticForm R (Mᵢ i)} (h : (pi Q).Anisotropic) : ∀ i, (Q i).Anisotropic := by
  simp_rw [Anisotropic, pi_apply, Function.funext_iff, Pi.zero_apply] at h
  intro i x hx
  classical
  have := h (Pi.single i x) ?_ i
  · rw [Pi.single_eq_same] at this
    exact this
  

Proof state:
case refine_1
ι : Type u_1
R✝ : Type u_2
M₁ : Type u_3
M₂ : Type u_4
N₁ : Type u_5
N₂ : Type u_6
Mᵢ : ι → Type u_7
Nᵢ : ι → Type u_8
inst✝⁷ : CommSemiring R✝
inst✝⁶ : (i : ι) → AddCommMonoid (Mᵢ i)
inst✝⁵ : (i : ι) → AddCommMonoid (Nᵢ i)
inst✝⁴ : (i : ι) → Module R✝ (Mᵢ i)
inst✝³ : (i : ι) → Module R✝ (Nᵢ i)
inst✝² : Fintype ι
R : Type u_9
inst✝¹ : OrderedCommRing R
inst✝ : (i : ι) → Module R (Mᵢ i)
Q : (i : ι) → QuadraticForm R (Mᵢ i)
h : ∀ (x : (i : ι) → Mᵢ i), ∑ i : ι, (Q i) (x i) = 0 → ∀ (a : ι), x a = 0
i : ι
x : Mᵢ i
hx : (Q i) x = 0
⊢ ∑ i_1 : ι, (Q i_1) (Pi.single i x i_1) = 0

Next tactic:
apply Finset.sum_eq_zero
/-- If a family is anisotropic then its components must be. The converse is not true. -/
theorem anisotropic_of_pi [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)]
    {Q : ∀ i, QuadraticForm R (Mᵢ i)} (h : (pi Q).Anisotropic) : ∀ i, (Q i).Anisotropic := by
  simp_rw [Anisotropic, pi_apply, Function.funext_iff, Pi.zero_apply] at h
  intro i x hx
  classical
  have := h (Pi.single i x) ?_ i
  · rw [Pi.single_eq_same] at this
    exact this
  apply Finset.sum_eq_zero
  

Proof state:
case refine_1.h
ι : Type u_1
R✝ : Type u_2
M₁ : Type u_3
M₂ : Type u_4
N₁ : Type u_5
N₂ : Type u_6
Mᵢ : ι → Type u_7
Nᵢ : ι → Type u_8
inst✝⁷ : CommSemiring R✝
inst✝⁶ : (i : ι) → AddCommMonoid (Mᵢ i)
inst✝⁵ : (i : ι) → AddCommMonoid (Nᵢ i)
inst✝⁴ : (i : ι) → Module R✝ (Mᵢ i)
inst✝³ : (i : ι) → Module R✝ (Nᵢ i)
inst✝² : Fintype ι
R : Type u_9
inst✝¹ : OrderedCommRing R
inst✝ : (i : ι) → Module R (Mᵢ i)
Q : (i : ι) → QuadraticForm R (Mᵢ i)
h : ∀ (x : (i : ι) → Mᵢ i), ∑ i : ι, (Q i) (x i) = 0 → ∀ (a : ι), x a = 0
i : ι
x : Mᵢ i
hx : (Q i) x = 0
⊢ ∀ x_1 ∈ Finset.univ, (Q x_1) (Pi.single i x x_1) = 0

Next tactic:
intro j _
/-- If a family is anisotropic then its components must be. The converse is not true. -/
theorem anisotropic_of_pi [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)]
    {Q : ∀ i, QuadraticForm R (Mᵢ i)} (h : (pi Q).Anisotropic) : ∀ i, (Q i).Anisotropic := by
  simp_rw [Anisotropic, pi_apply, Function.funext_iff, Pi.zero_apply] at h
  intro i x hx
  classical
  have := h (Pi.single i x) ?_ i
  · rw [Pi.single_eq_same] at this
    exact this
  apply Finset.sum_eq_zero
  intro j _
  

Proof state:
case refine_1.h
ι : Type u_1
R✝ : Type u_2
M₁ : Type u_3
M₂ : Type u_4
N₁ : Type u_5
N₂ : Type u_6
Mᵢ : ι → Type u_7
Nᵢ : ι → Type u_8
inst✝⁷ : CommSemiring R✝
inst✝⁶ : (i : ι) → AddCommMonoid (Mᵢ i)
inst✝⁵ : (i : ι) → AddCommMonoid (Nᵢ i)
inst✝⁴ : (i : ι) → Module R✝ (Mᵢ i)
inst✝³ : (i : ι) → Module R✝ (Nᵢ i)
inst✝² : Fintype ι
R : Type u_9
inst✝¹ : OrderedCommRing R
inst✝ : (i : ι) → Module R (Mᵢ i)
Q : (i : ι) → QuadraticForm R (Mᵢ i)
h : ∀ (x : (i : ι) → Mᵢ i), ∑ i : ι, (Q i) (x i) = 0 → ∀ (a : ι), x a = 0
i : ι
x : Mᵢ i
hx : (Q i) x = 0
j : ι
a✝ : j ∈ Finset.univ
⊢ (Q j) (Pi.single i x j) = 0

Next tactic:
by_cases hji : j = i
/-- If a family is anisotropic then its components must be. The converse is not true. -/
theorem anisotropic_of_pi [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)]
    {Q : ∀ i, QuadraticForm R (Mᵢ i)} (h : (pi Q).Anisotropic) : ∀ i, (Q i).Anisotropic := by
  simp_rw [Anisotropic, pi_apply, Function.funext_iff, Pi.zero_apply] at h
  intro i x hx
  classical
  have := h (Pi.single i x) ?_ i
  · rw [Pi.single_eq_same] at this
    exact this
  apply Finset.sum_eq_zero
  intro j _
  by_cases hji : j = i
  · 

Proof state:
case pos
ι : Type u_1
R✝ : Type u_2
M₁ : Type u_3
M₂ : Type u_4
N₁ : Type u_5
N₂ : Type u_6
Mᵢ : ι → Type u_7
Nᵢ : ι → Type u_8
inst✝⁷ : CommSemiring R✝
inst✝⁶ : (i : ι) → AddCommMonoid (Mᵢ i)
inst✝⁵ : (i : ι) → AddCommMonoid (Nᵢ i)
inst✝⁴ : (i : ι) → Module R✝ (Mᵢ i)
inst✝³ : (i : ι) → Module R✝ (Nᵢ i)
inst✝² : Fintype ι
R : Type u_9
inst✝¹ : OrderedCommRing R
inst✝ : (i : ι) → Module R (Mᵢ i)
Q : (i : ι) → QuadraticForm R (Mᵢ i)
h : ∀ (x : (i : ι) → Mᵢ i), ∑ i : ι, (Q i) (x i) = 0 → ∀ (a : ι), x a = 0
i : ι
x : Mᵢ i
hx : (Q i) x = 0
j : ι
a✝ : j ∈ Finset.univ
hji : j = i
⊢ (Q j) (Pi.single i x j) = 0

Next tactic:
subst hji
/-- If a family is anisotropic then its components must be. The converse is not true. -/
theorem anisotropic_of_pi [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)]
    {Q : ∀ i, QuadraticForm R (Mᵢ i)} (h : (pi Q).Anisotropic) : ∀ i, (Q i).Anisotropic := by
  simp_rw [Anisotropic, pi_apply, Function.funext_iff, Pi.zero_apply] at h
  intro i x hx
  classical
  have := h (Pi.single i x) ?_ i
  · rw [Pi.single_eq_same] at this
    exact this
  apply Finset.sum_eq_zero
  intro j _
  by_cases hji : j = i
  · subst hji; 

Proof state:
case pos
ι : Type u_1
R✝ : Type u_2
M₁ : Type u_3
M₂ : Type u_4
N₁ : Type u_5
N₂ : Type u_6
Mᵢ : ι → Type u_7
Nᵢ : ι → Type u_8
inst✝⁷ : CommSemiring R✝
inst✝⁶ : (i : ι) → AddCommMonoid (Mᵢ i)
inst✝⁵ : (i : ι) → AddCommMonoid (Nᵢ i)
inst✝⁴ : (i : ι) → Module R✝ (Mᵢ i)
inst✝³ : (i : ι) → Module R✝ (Nᵢ i)
inst✝² : Fintype ι
R : Type u_9
inst✝¹ : OrderedCommRing R
inst✝ : (i : ι) → Module R (Mᵢ i)
Q : (i : ι) → QuadraticForm R (Mᵢ i)
h : ∀ (x : (i : ι) → Mᵢ i), ∑ i : ι, (Q i) (x i) = 0 → ∀ (a : ι), x a = 0
j : ι
a✝ : j ∈ Finset.univ
x : Mᵢ j
hx : (Q j) x = 0
⊢ (Q j) (Pi.single j x j) = 0

Next tactic:
rw [Pi.single_eq_same, hx]
/-- If a family is anisotropic then its components must be. The converse is not true. -/
theorem anisotropic_of_pi [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)]
    {Q : ∀ i, QuadraticForm R (Mᵢ i)} (h : (pi Q).Anisotropic) : ∀ i, (Q i).Anisotropic := by
  simp_rw [Anisotropic, pi_apply, Function.funext_iff, Pi.zero_apply] at h
  intro i x hx
  classical
  have := h (Pi.single i x) ?_ i
  · rw [Pi.single_eq_same] at this
    exact this
  apply Finset.sum_eq_zero
  intro j _
  by_cases hji : j = i
  · subst hji; rw [Pi.single_eq_same, hx]
  · 

Proof state:
case neg
ι : Type u_1
R✝ : Type u_2
M₁ : Type u_3
M₂ : Type u_4
N₁ : Type u_5
N₂ : Type u_6
Mᵢ : ι → Type u_7
Nᵢ : ι → Type u_8
inst✝⁷ : CommSemiring R✝
inst✝⁶ : (i : ι) → AddCommMonoid (Mᵢ i)
inst✝⁵ : (i : ι) → AddCommMonoid (Nᵢ i)
inst✝⁴ : (i : ι) → Module R✝ (Mᵢ i)
inst✝³ : (i : ι) → Module R✝ (Nᵢ i)
inst✝² : Fintype ι
R : Type u_9
inst✝¹ : OrderedCommRing R
inst✝ : (i : ι) → Module R (Mᵢ i)
Q : (i : ι) → QuadraticForm R (Mᵢ i)
h : ∀ (x : (i : ι) → Mᵢ i), ∑ i : ι, (Q i) (x i) = 0 → ∀ (a : ι), x a = 0
i : ι
x : Mᵢ i
hx : (Q i) x = 0
j : ι
a✝ : j ∈ Finset.univ
hji : ¬j = i
⊢ (Q j) (Pi.single i x j) = 0

Next tactic:
rw [Pi.single_eq_of_ne hji, map_zero]
theorem nonneg_pi_iff [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)]
    {Q : ∀ i, QuadraticForm R (Mᵢ i)} : (∀ x, 0 ≤ pi Q x) ↔ ∀ i x, 0 ≤ Q i x := by
  

Proof state:
ι : Type u_1
R✝ : Type u_2
M₁ : Type u_3
M₂ : Type u_4
N₁ : Type u_5
N₂ : Type u_6
Mᵢ : ι → Type u_7
Nᵢ : ι → Type u_8
inst✝⁷ : CommSemiring R✝
inst✝⁶ : (i : ι) → AddCommMonoid (Mᵢ i)
inst✝⁵ : (i : ι) → AddCommMonoid (Nᵢ i)
inst✝⁴ : (i : ι) → Module R✝ (Mᵢ i)
inst✝³ : (i : ι) → Module R✝ (Nᵢ i)
inst✝² : Fintype ι
R : Type u_9
inst✝¹ : OrderedCommRing R
inst✝ : (i : ι) → Module R (Mᵢ i)
Q : (i : ι) → QuadraticForm R (Mᵢ i)
⊢ (∀ (x : (i : ι) → Mᵢ i), 0 ≤ (pi Q) x) ↔ ∀ (i : ι) (x : Mᵢ i), 0 ≤ (Q i) x

Next tactic:
simp_rw [pi, sum_apply, comp_apply, LinearMap.proj_apply]
theorem nonneg_pi_iff [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)]
    {Q : ∀ i, QuadraticForm R (Mᵢ i)} : (∀ x, 0 ≤ pi Q x) ↔ ∀ i x, 0 ≤ Q i x := by
  simp_rw [pi, sum_apply, comp_apply, LinearMap.proj_apply]
  

Proof state:
ι : Type u_1
R✝ : Type u_2
M₁ : Type u_3
M₂ : Type u_4
N₁ : Type u_5
N₂ : Type u_6
Mᵢ : ι → Type u_7
Nᵢ : ι → Type u_8
inst✝⁷ : CommSemiring R✝
inst✝⁶ : (i : ι) → AddCommMonoid (Mᵢ i)
inst✝⁵ : (i : ι) → AddCommMonoid (Nᵢ i)
inst✝⁴ : (i : ι) → Module R✝ (Mᵢ i)
inst✝³ : (i : ι) → Module R✝ (Nᵢ i)
inst✝² : Fintype ι
R : Type u_9
inst✝¹ : OrderedCommRing R
inst✝ : (i : ι) → Module R (Mᵢ i)
Q : (i : ι) → QuadraticForm R (Mᵢ i)
⊢ (∀ (x : (i : ι) → Mᵢ i), 0 ≤ ∑ x_1 : ι, (Q x_1) (x x_1)) ↔ ∀ (i : ι) (x : Mᵢ i), 0 ≤ (Q i) x

Next tactic:
constructor
theorem nonneg_pi_iff [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)]
    {Q : ∀ i, QuadraticForm R (Mᵢ i)} : (∀ x, 0 ≤ pi Q x) ↔ ∀ i x, 0 ≤ Q i x := by
  simp_rw [pi, sum_apply, comp_apply, LinearMap.proj_apply]
  constructor
  -- TODO: does this generalize to a useful lemma independent of `QuadraticForm`?
  · 

Proof state:
case mp
ι : Type u_1
R✝ : Type u_2
M₁ : Type u_3
M₂ : Type u_4
N₁ : Type u_5
N₂ : Type u_6
Mᵢ : ι → Type u_7
Nᵢ : ι → Type u_8
inst✝⁷ : CommSemiring R✝
inst✝⁶ : (i : ι) → AddCommMonoid (Mᵢ i)
inst✝⁵ : (i : ι) → AddCommMonoid (Nᵢ i)
inst✝⁴ : (i : ι) → Module R✝ (Mᵢ i)
inst✝³ : (i : ι) → Module R✝ (Nᵢ i)
inst✝² : Fintype ι
R : Type u_9
inst✝¹ : OrderedCommRing R
inst✝ : (i : ι) → Module R (Mᵢ i)
Q : (i : ι) → QuadraticForm R (Mᵢ i)
⊢ (∀ (x : (i : ι) → Mᵢ i), 0 ≤ ∑ x_1 : ι, (Q x_1) (x x_1)) → ∀ (i : ι) (x : Mᵢ i), 0 ≤ (Q i) x

Next tactic:
intro h i x
theorem nonneg_pi_iff [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)]
    {Q : ∀ i, QuadraticForm R (Mᵢ i)} : (∀ x, 0 ≤ pi Q x) ↔ ∀ i x, 0 ≤ Q i x := by
  simp_rw [pi, sum_apply, comp_apply, LinearMap.proj_apply]
  constructor
  -- TODO: does this generalize to a useful lemma independent of `QuadraticForm`?
  · intro h i x
    

Proof state:
case mp
ι : Type u_1
R✝ : Type u_2
M₁ : Type u_3
M₂ : Type u_4
N₁ : Type u_5
N₂ : Type u_6
Mᵢ : ι → Type u_7
Nᵢ : ι → Type u_8
inst✝⁷ : CommSemiring R✝
inst✝⁶ : (i : ι) → AddCommMonoid (Mᵢ i)
inst✝⁵ : (i : ι) → AddCommMonoid (Nᵢ i)
inst✝⁴ : (i : ι) → Module R✝ (Mᵢ i)
inst✝³ : (i : ι) → Module R✝ (Nᵢ i)
inst✝² : Fintype ι
R : Type u_9
inst✝¹ : OrderedCommRing R
inst✝ : (i : ι) → Module R (Mᵢ i)
Q : (i : ι) → QuadraticForm R (Mᵢ i)
h : ∀ (x : (i : ι) → Mᵢ i), 0 ≤ ∑ x_1 : ι, (Q x_1) (x x_1)
i : ι
x : Mᵢ i
⊢ 0 ≤ (Q i) x

Next tactic:
classical
    convert h (Pi.single i x) using 1
    rw [Finset.sum_eq_single_of_mem i (Finset.mem_univ _) fun j _ hji => ?_, Pi.single_eq_same]
    rw [Pi.single_eq_of_ne hji, map_zero]
theorem nonneg_pi_iff [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)]
    {Q : ∀ i, QuadraticForm R (Mᵢ i)} : (∀ x, 0 ≤ pi Q x) ↔ ∀ i x, 0 ≤ Q i x := by
  simp_rw [pi, sum_apply, comp_apply, LinearMap.proj_apply]
  constructor
  -- TODO: does this generalize to a useful lemma independent of `QuadraticForm`?
  · intro h i x
    classical
    

Proof state:
case mp
ι : Type u_1
R✝ : Type u_2
M₁ : Type u_3
M₂ : Type u_4
N₁ : Type u_5
N₂ : Type u_6
Mᵢ : ι → Type u_7
Nᵢ : ι → Type u_8
inst✝⁷ : CommSemiring R✝
inst✝⁶ : (i : ι) → AddCommMonoid (Mᵢ i)
inst✝⁵ : (i : ι) → AddCommMonoid (Nᵢ i)
inst✝⁴ : (i : ι) → Module R✝ (Mᵢ i)
inst✝³ : (i : ι) → Module R✝ (Nᵢ i)
inst✝² : Fintype ι
R : Type u_9
inst✝¹ : OrderedCommRing R
inst✝ : (i : ι) → Module R (Mᵢ i)
Q : (i : ι) → QuadraticForm R (Mᵢ i)
h : ∀ (x : (i : ι) → Mᵢ i), 0 ≤ ∑ x_1 : ι, (Q x_1) (x x_1)
i : ι
x : Mᵢ i
⊢ 0 ≤ (Q i) x

Next tactic:
convert h (Pi.single i x) using 1
theorem nonneg_pi_iff [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)]
    {Q : ∀ i, QuadraticForm R (Mᵢ i)} : (∀ x, 0 ≤ pi Q x) ↔ ∀ i x, 0 ≤ Q i x := by
  simp_rw [pi, sum_apply, comp_apply, LinearMap.proj_apply]
  constructor
  -- TODO: does this generalize to a useful lemma independent of `QuadraticForm`?
  · intro h i x
    classical
    convert h (Pi.single i x) using 1
    

Proof state:
case h.e'_4
ι : Type u_1
R✝ : Type u_2
M₁ : Type u_3
M₂ : Type u_4
N₁ : Type u_5
N₂ : Type u_6
Mᵢ : ι → Type u_7
Nᵢ : ι → Type u_8
inst✝⁷ : CommSemiring R✝
inst✝⁶ : (i : ι) → AddCommMonoid (Mᵢ i)
inst✝⁵ : (i : ι) → AddCommMonoid (Nᵢ i)
inst✝⁴ : (i : ι) → Module R✝ (Mᵢ i)
inst✝³ : (i : ι) → Module R✝ (Nᵢ i)
inst✝² : Fintype ι
R : Type u_9
inst✝¹ : OrderedCommRing R
inst✝ : (i : ι) → Module R (Mᵢ i)
Q : (i : ι) → QuadraticForm R (Mᵢ i)
h : ∀ (x : (i : ι) → Mᵢ i), 0 ≤ ∑ x_1 : ι, (Q x_1) (x x_1)
i : ι
x : Mᵢ i
⊢ (Q i) x = ∑ x_1 : ι, (Q x_1) (Pi.single i x x_1)

Next tactic:
rw [Finset.sum_eq_single_of_mem i (Finset.mem_univ _) fun j _ hji => ?_, Pi.single_eq_same]
theorem nonneg_pi_iff [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)]
    {Q : ∀ i, QuadraticForm R (Mᵢ i)} : (∀ x, 0 ≤ pi Q x) ↔ ∀ i x, 0 ≤ Q i x := by
  simp_rw [pi, sum_apply, comp_apply, LinearMap.proj_apply]
  constructor
  -- TODO: does this generalize to a useful lemma independent of `QuadraticForm`?
  · intro h i x
    classical
    convert h (Pi.single i x) using 1
    rw [Finset.sum_eq_single_of_mem i (Finset.mem_univ _) fun j _ hji => ?_, Pi.single_eq_same]
    

Proof state:
ι : Type u_1
R✝ : Type u_2
M₁ : Type u_3
M₂ : Type u_4
N₁ : Type u_5
N₂ : Type u_6
Mᵢ : ι → Type u_7
Nᵢ : ι → Type u_8
inst✝⁷ : CommSemiring R✝
inst✝⁶ : (i : ι) → AddCommMonoid (Mᵢ i)
inst✝⁵ : (i : ι) → AddCommMonoid (Nᵢ i)
inst✝⁴ : (i : ι) → Module R✝ (Mᵢ i)
inst✝³ : (i : ι) → Module R✝ (Nᵢ i)
inst✝² : Fintype ι
R : Type u_9
inst✝¹ : OrderedCommRing R
inst✝ : (i : ι) → Module R (Mᵢ i)
Q : (i : ι) → QuadraticForm R (Mᵢ i)
h : ∀ (x : (i : ι) → Mᵢ i), 0 ≤ ∑ x_1 : ι, (Q x_1) (x x_1)
i : ι
x : Mᵢ i
j : ι
x✝ : j ∈ Finset.univ
hji : j ≠ i
⊢ (Q j) (Pi.single i x j) = 0

Next tactic:
rw [Pi.single_eq_of_ne hji, map_zero]
theorem nonneg_pi_iff [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)]
    {Q : ∀ i, QuadraticForm R (Mᵢ i)} : (∀ x, 0 ≤ pi Q x) ↔ ∀ i x, 0 ≤ Q i x := by
  simp_rw [pi, sum_apply, comp_apply, LinearMap.proj_apply]
  constructor
  -- TODO: does this generalize to a useful lemma independent of `QuadraticForm`?
  · intro h i x
    classical
    convert h (Pi.single i x) using 1
    rw [Finset.sum_eq_single_of_mem i (Finset.mem_univ _) fun j _ hji => ?_, Pi.single_eq_same]
    rw [Pi.single_eq_of_ne hji, map_zero]
  · 

Proof state:
case mpr
ι : Type u_1
R✝ : Type u_2
M₁ : Type u_3
M₂ : Type u_4
N₁ : Type u_5
N₂ : Type u_6
Mᵢ : ι → Type u_7
Nᵢ : ι → Type u_8
inst✝⁷ : CommSemiring R✝
inst✝⁶ : (i : ι) → AddCommMonoid (Mᵢ i)
inst✝⁵ : (i : ι) → AddCommMonoid (Nᵢ i)
inst✝⁴ : (i : ι) → Module R✝ (Mᵢ i)
inst✝³ : (i : ι) → Module R✝ (Nᵢ i)
inst✝² : Fintype ι
R : Type u_9
inst✝¹ : OrderedCommRing R
inst✝ : (i : ι) → Module R (Mᵢ i)
Q : (i : ι) → QuadraticForm R (Mᵢ i)
⊢ (∀ (i : ι) (x : Mᵢ i), 0 ≤ (Q i) x) → ∀ (x : (i : ι) → Mᵢ i), 0 ≤ ∑ x_1 : ι, (Q x_1) (x x_1)

Next tactic:
rintro h x
theorem nonneg_pi_iff [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)]
    {Q : ∀ i, QuadraticForm R (Mᵢ i)} : (∀ x, 0 ≤ pi Q x) ↔ ∀ i x, 0 ≤ Q i x := by
  simp_rw [pi, sum_apply, comp_apply, LinearMap.proj_apply]
  constructor
  -- TODO: does this generalize to a useful lemma independent of `QuadraticForm`?
  · intro h i x
    classical
    convert h (Pi.single i x) using 1
    rw [Finset.sum_eq_single_of_mem i (Finset.mem_univ _) fun j _ hji => ?_, Pi.single_eq_same]
    rw [Pi.single_eq_of_ne hji, map_zero]
  · rintro h x
    

Proof state:
case mpr
ι : Type u_1
R✝ : Type u_2
M₁ : Type u_3
M₂ : Type u_4
N₁ : Type u_5
N₂ : Type u_6
Mᵢ : ι → Type u_7
Nᵢ : ι → Type u_8
inst✝⁷ : CommSemiring R✝
inst✝⁶ : (i : ι) → AddCommMonoid (Mᵢ i)
inst✝⁵ : (i : ι) → AddCommMonoid (Nᵢ i)
inst✝⁴ : (i : ι) → Module R✝ (Mᵢ i)
inst✝³ : (i : ι) → Module R✝ (Nᵢ i)
inst✝² : Fintype ι
R : Type u_9
inst✝¹ : OrderedCommRing R
inst✝ : (i : ι) → Module R (Mᵢ i)
Q : (i : ι) → QuadraticForm R (Mᵢ i)
h : ∀ (i : ι) (x : Mᵢ i), 0 ≤ (Q i) x
x : (i : ι) → Mᵢ i
⊢ 0 ≤ ∑ x_1 : ι, (Q x_1) (x x_1)

Next tactic:
exact Finset.sum_nonneg fun i _ => h i (x i)
theorem posDef_pi_iff [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)]
    {Q : ∀ i, QuadraticForm R (Mᵢ i)} : (pi Q).PosDef ↔ ∀ i, (Q i).PosDef := by
  

Proof state:
ι : Type u_1
R✝ : Type u_2
M₁ : Type u_3
M₂ : Type u_4
N₁ : Type u_5
N₂ : Type u_6
Mᵢ : ι → Type u_7
Nᵢ : ι → Type u_8
inst✝⁷ : CommSemiring R✝
inst✝⁶ : (i : ι) → AddCommMonoid (Mᵢ i)
inst✝⁵ : (i : ι) → AddCommMonoid (Nᵢ i)
inst✝⁴ : (i : ι) → Module R✝ (Mᵢ i)
inst✝³ : (i : ι) → Module R✝ (Nᵢ i)
inst✝² : Fintype ι
R : Type u_9
inst✝¹ : OrderedCommRing R
inst✝ : (i : ι) → Module R (Mᵢ i)
Q : (i : ι) → QuadraticForm R (Mᵢ i)
⊢ PosDef (pi Q) ↔ ∀ (i : ι), PosDef (Q i)

Next tactic:
simp_rw [posDef_iff_nonneg, nonneg_pi_iff]
theorem posDef_pi_iff [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)]
    {Q : ∀ i, QuadraticForm R (Mᵢ i)} : (pi Q).PosDef ↔ ∀ i, (Q i).PosDef := by
  simp_rw [posDef_iff_nonneg, nonneg_pi_iff]
  

Proof state:
ι : Type u_1
R✝ : Type u_2
M₁ : Type u_3
M₂ : Type u_4
N₁ : Type u_5
N₂ : Type u_6
Mᵢ : ι → Type u_7
Nᵢ : ι → Type u_8
inst✝⁷ : CommSemiring R✝
inst✝⁶ : (i : ι) → AddCommMonoid (Mᵢ i)
inst✝⁵ : (i : ι) → AddCommMonoid (Nᵢ i)
inst✝⁴ : (i : ι) → Module R✝ (Mᵢ i)
inst✝³ : (i : ι) → Module R✝ (Nᵢ i)
inst✝² : Fintype ι
R : Type u_9
inst✝¹ : OrderedCommRing R
inst✝ : (i : ι) → Module R (Mᵢ i)
Q : (i : ι) → QuadraticForm R (Mᵢ i)
⊢ (∀ (i : ι) (x : Mᵢ i), 0 ≤ (Q i) x) ∧ Anisotropic (pi Q) ↔ ∀ (i : ι), (∀ (x : Mᵢ i), 0 ≤ (Q i) x) ∧ Anisotropic (Q i)

Next tactic:
constructor
theorem posDef_pi_iff [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)]
    {Q : ∀ i, QuadraticForm R (Mᵢ i)} : (pi Q).PosDef ↔ ∀ i, (Q i).PosDef := by
  simp_rw [posDef_iff_nonneg, nonneg_pi_iff]
  constructor
  · 

Proof state:
case mp
ι : Type u_1
R✝ : Type u_2
M₁ : Type u_3
M₂ : Type u_4
N₁ : Type u_5
N₂ : Type u_6
Mᵢ : ι → Type u_7
Nᵢ : ι → Type u_8
inst✝⁷ : CommSemiring R✝
inst✝⁶ : (i : ι) → AddCommMonoid (Mᵢ i)
inst✝⁵ : (i : ι) → AddCommMonoid (Nᵢ i)
inst✝⁴ : (i : ι) → Module R✝ (Mᵢ i)
inst✝³ : (i : ι) → Module R✝ (Nᵢ i)
inst✝² : Fintype ι
R : Type u_9
inst✝¹ : OrderedCommRing R
inst✝ : (i : ι) → Module R (Mᵢ i)
Q : (i : ι) → QuadraticForm R (Mᵢ i)
⊢ (∀ (i : ι) (x : Mᵢ i), 0 ≤ (Q i) x) ∧ Anisotropic (pi Q) → ∀ (i : ι), (∀ (x : Mᵢ i), 0 ≤ (Q i) x) ∧ Anisotropic (Q i)

Next tactic:
rintro ⟨hle, ha⟩
theorem posDef_pi_iff [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)]
    {Q : ∀ i, QuadraticForm R (Mᵢ i)} : (pi Q).PosDef ↔ ∀ i, (Q i).PosDef := by
  simp_rw [posDef_iff_nonneg, nonneg_pi_iff]
  constructor
  · rintro ⟨hle, ha⟩
    

Proof state:
case mp.intro
ι : Type u_1
R✝ : Type u_2
M₁ : Type u_3
M₂ : Type u_4
N₁ : Type u_5
N₂ : Type u_6
Mᵢ : ι → Type u_7
Nᵢ : ι → Type u_8
inst✝⁷ : CommSemiring R✝
inst✝⁶ : (i : ι) → AddCommMonoid (Mᵢ i)
inst✝⁵ : (i : ι) → AddCommMonoid (Nᵢ i)
inst✝⁴ : (i : ι) → Module R✝ (Mᵢ i)
inst✝³ : (i : ι) → Module R✝ (Nᵢ i)
inst✝² : Fintype ι
R : Type u_9
inst✝¹ : OrderedCommRing R
inst✝ : (i : ι) → Module R (Mᵢ i)
Q : (i : ι) → QuadraticForm R (Mᵢ i)
hle : ∀ (i : ι) (x : Mᵢ i), 0 ≤ (Q i) x
ha : Anisotropic (pi Q)
⊢ ∀ (i : ι), (∀ (x : Mᵢ i), 0 ≤ (Q i) x) ∧ Anisotropic (Q i)

Next tactic:
intro i
theorem posDef_pi_iff [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)]
    {Q : ∀ i, QuadraticForm R (Mᵢ i)} : (pi Q).PosDef ↔ ∀ i, (Q i).PosDef := by
  simp_rw [posDef_iff_nonneg, nonneg_pi_iff]
  constructor
  · rintro ⟨hle, ha⟩
    intro i
    

Proof state:
case mp.intro
ι : Type u_1
R✝ : Type u_2
M₁ : Type u_3
M₂ : Type u_4
N₁ : Type u_5
N₂ : Type u_6
Mᵢ : ι → Type u_7
Nᵢ : ι → Type u_8
inst✝⁷ : CommSemiring R✝
inst✝⁶ : (i : ι) → AddCommMonoid (Mᵢ i)
inst✝⁵ : (i : ι) → AddCommMonoid (Nᵢ i)
inst✝⁴ : (i : ι) → Module R✝ (Mᵢ i)
inst✝³ : (i : ι) → Module R✝ (Nᵢ i)
inst✝² : Fintype ι
R : Type u_9
inst✝¹ : OrderedCommRing R
inst✝ : (i : ι) → Module R (Mᵢ i)
Q : (i : ι) → QuadraticForm R (Mᵢ i)
hle : ∀ (i : ι) (x : Mᵢ i), 0 ≤ (Q i) x
ha : Anisotropic (pi Q)
i : ι
⊢ (∀ (x : Mᵢ i), 0 ≤ (Q i) x) ∧ Anisotropic (Q i)

Next tactic:
exact ⟨hle i, anisotropic_of_pi ha i⟩
theorem posDef_pi_iff [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)]
    {Q : ∀ i, QuadraticForm R (Mᵢ i)} : (pi Q).PosDef ↔ ∀ i, (Q i).PosDef := by
  simp_rw [posDef_iff_nonneg, nonneg_pi_iff]
  constructor
  · rintro ⟨hle, ha⟩
    intro i
    exact ⟨hle i, anisotropic_of_pi ha i⟩
  · 

Proof state:
case mpr
ι : Type u_1
R✝ : Type u_2
M₁ : Type u_3
M₂ : Type u_4
N₁ : Type u_5
N₂ : Type u_6
Mᵢ : ι → Type u_7
Nᵢ : ι → Type u_8
inst✝⁷ : CommSemiring R✝
inst✝⁶ : (i : ι) → AddCommMonoid (Mᵢ i)
inst✝⁵ : (i : ι) → AddCommMonoid (Nᵢ i)
inst✝⁴ : (i : ι) → Module R✝ (Mᵢ i)
inst✝³ : (i : ι) → Module R✝ (Nᵢ i)
inst✝² : Fintype ι
R : Type u_9
inst✝¹ : OrderedCommRing R
inst✝ : (i : ι) → Module R (Mᵢ i)
Q : (i : ι) → QuadraticForm R (Mᵢ i)
⊢ (∀ (i : ι), (∀ (x : Mᵢ i), 0 ≤ (Q i) x) ∧ Anisotropic (Q i)) →
    (∀ (i : ι) (x : Mᵢ i), 0 ≤ (Q i) x) ∧ Anisotropic (pi Q)

Next tactic:
intro h
theorem posDef_pi_iff [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)]
    {Q : ∀ i, QuadraticForm R (Mᵢ i)} : (pi Q).PosDef ↔ ∀ i, (Q i).PosDef := by
  simp_rw [posDef_iff_nonneg, nonneg_pi_iff]
  constructor
  · rintro ⟨hle, ha⟩
    intro i
    exact ⟨hle i, anisotropic_of_pi ha i⟩
  · intro h
    

Proof state:
case mpr
ι : Type u_1
R✝ : Type u_2
M₁ : Type u_3
M₂ : Type u_4
N₁ : Type u_5
N₂ : Type u_6
Mᵢ : ι → Type u_7
Nᵢ : ι → Type u_8
inst✝⁷ : CommSemiring R✝
inst✝⁶ : (i : ι) → AddCommMonoid (Mᵢ i)
inst✝⁵ : (i : ι) → AddCommMonoid (Nᵢ i)
inst✝⁴ : (i : ι) → Module R✝ (Mᵢ i)
inst✝³ : (i : ι) → Module R✝ (Nᵢ i)
inst✝² : Fintype ι
R : Type u_9
inst✝¹ : OrderedCommRing R
inst✝ : (i : ι) → Module R (Mᵢ i)
Q : (i : ι) → QuadraticForm R (Mᵢ i)
h : ∀ (i : ι), (∀ (x : Mᵢ i), 0 ≤ (Q i) x) ∧ Anisotropic (Q i)
⊢ (∀ (i : ι) (x : Mᵢ i), 0 ≤ (Q i) x) ∧ Anisotropic (pi Q)

Next tactic:
refine' ⟨fun i => (h i).1, fun x hx => funext fun i => (h i).2 _ _⟩
theorem posDef_pi_iff [Fintype ι] {R} [OrderedCommRing R] [∀ i, Module R (Mᵢ i)]
    {Q : ∀ i, QuadraticForm R (Mᵢ i)} : (pi Q).PosDef ↔ ∀ i, (Q i).PosDef := by
  simp_rw [posDef_iff_nonneg, nonneg_pi_iff]
  constructor
  · rintro ⟨hle, ha⟩
    intro i
    exact ⟨hle i, anisotropic_of_pi ha i⟩
  · intro h
    refine' ⟨fun i => (h i).1, fun x hx => funext fun i => (h i).2 _ _⟩
    

Proof state:
case mpr
ι : Type u_1
R✝ : Type u_2
M₁ : Type u_3
M₂ : Type u_4
N₁ : Type u_5
N₂ : Type u_6
Mᵢ : ι → Type u_7
Nᵢ : ι → Type u_8
inst✝⁷ : CommSemiring R✝
inst✝⁶ : (i : ι) → AddCommMonoid (Mᵢ i)
inst✝⁵ : (i : ι) → AddCommMonoid (Nᵢ i)
inst✝⁴ : (i : ι) → Module R✝ (Mᵢ i)
inst✝³ : (i : ι) → Module R✝ (Nᵢ i)
inst✝² : Fintype ι
R : Type u_9
inst✝¹ : OrderedCommRing R
inst✝ : (i : ι) → Module R (Mᵢ i)
Q : (i : ι) → QuadraticForm R (Mᵢ i)
h : ∀ (i : ι), (∀ (x : Mᵢ i), 0 ≤ (Q i) x) ∧ Anisotropic (Q i)
x : (i : ι) → Mᵢ i
hx : (pi Q) x = 0
i : ι
⊢ (Q i) (x i) = 0

Next tactic:
rw [pi_apply, Finset.sum_eq_zero_iff_of_nonneg fun j _ => ?_] at hx