l3lab/ntp-mathlib huggingface dataset:
/-- The `n = 1` case of the Ahlswede-Daykin inequality. Note that we can't just expand everything
out and bound termwise since `c₀ * d₁` appears twice on the RHS of the assumptions while `c₁ * d₀`
does not appear. -/
private lemma ineq {a₀ a₁ b₀ b₁ c₀ c₁ d₀ d₁ : β}
    (ha₀ : 0 ≤ a₀) (ha₁ : 0 ≤ a₁) (hb₀ : 0 ≤ b₀) (hb₁ : 0 ≤ b₁)
    (hc₀ : 0 ≤ c₀) (hc₁ : 0 ≤ c₁) (hd₀ : 0 ≤ d₀) (hd₁ : 0 ≤ d₁)
    (h₀₀ : a₀ * b₀ ≤ c₀ * d₀) (h₁₀ : a₁ * b₀ ≤ c₀ * d₁)
    (h₀₁ : a₀ * b₁ ≤ c₀ * d₁) (h₁₁ : a₁ * b₁ ≤ c₁ * d₁) :
    (a₀ + a₁) * (b₀ + b₁) ≤ (c₀ + c₁) * (d₀ + d₁) := by
  calc
    _ = a₀ * b₀ + (a₀ * b₁ + a₁ * b₀) + a₁ * b₁ := by ring
    _ ≤ c₀ * d₀ + (c₀ * d₁ + c₁ * d₀) + c₁ * d₁ := add_le_add_three h₀₀ ?_ h₁₁
    _ = (c₀ + c₁) * (d₀ + d₁) := by ring
  obtain hcd | hcd := (mul_nonneg hc₀ hd₁).eq_or_gt
  · rw [hcd] at h₀₁ h₁₀
    rw [h₀₁.antisymm, h₁₀.antisymm, add_zero] <;> positivity
  refine' le_of_mul_le_mul_right _ hcd
  calc (a₀ * b₁ + a₁ * b₀) * (c₀ * d₁)
      = a₀ * b₁ * (c₀ * d₁) + c₀ * d₁ * (a₁ * b₀) := by 

Proof state:
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜 ℬ : Finset (Finset α)
a : α
f f₁ f₂ f₃ f₄ g μ : Finset α → β
s t u : Finset α
a₀ a₁ b₀ b₁ c₀ c₁ d₀ d₁ : β
ha₀ : 0 ≤ a₀
ha₁ : 0 ≤ a₁
hb₀ : 0 ≤ b₀
hb₁ : 0 ≤ b₁
hc₀ : 0 ≤ c₀
hc₁ : 0 ≤ c₁
hd₀ : 0 ≤ d₀
hd₁ : 0 ≤ d₁
h₀₀ : a₀ * b₀ ≤ c₀ * d₀
h₁₀ : a₁ * b₀ ≤ c₀ * d₁
h₀₁ : a₀ * b₁ ≤ c₀ * d₁
h₁₁ : a₁ * b₁ ≤ c₁ * d₁
hcd : 0 < c₀ * d₁
⊢ (a₀ * b₁ + a₁ * b₀) * (c₀ * d₁) = a₀ * b₁ * (c₀ * d₁) + c₀ * d₁ * (a₁ * b₀)

Next tactic:
ring
/-- The `n = 1` case of the Ahlswede-Daykin inequality. Note that we can't just expand everything
out and bound termwise since `c₀ * d₁` appears twice on the RHS of the assumptions while `c₁ * d₀`
does not appear. -/
private lemma ineq {a₀ a₁ b₀ b₁ c₀ c₁ d₀ d₁ : β}
    (ha₀ : 0 ≤ a₀) (ha₁ : 0 ≤ a₁) (hb₀ : 0 ≤ b₀) (hb₁ : 0 ≤ b₁)
    (hc₀ : 0 ≤ c₀) (hc₁ : 0 ≤ c₁) (hd₀ : 0 ≤ d₀) (hd₁ : 0 ≤ d₁)
    (h₀₀ : a₀ * b₀ ≤ c₀ * d₀) (h₁₀ : a₁ * b₀ ≤ c₀ * d₁)
    (h₀₁ : a₀ * b₁ ≤ c₀ * d₁) (h₁₁ : a₁ * b₁ ≤ c₁ * d₁) :
    (a₀ + a₁) * (b₀ + b₁) ≤ (c₀ + c₁) * (d₀ + d₁) := by
  calc
    _ = a₀ * b₀ + (a₀ * b₁ + a₁ * b₀) + a₁ * b₁ := by ring
    _ ≤ c₀ * d₀ + (c₀ * d₁ + c₁ * d₀) + c₁ * d₁ := add_le_add_three h₀₀ ?_ h₁₁
    _ = (c₀ + c₁) * (d₀ + d₁) := by ring
  obtain hcd | hcd := (mul_nonneg hc₀ hd₁).eq_or_gt
  · rw [hcd] at h₀₁ h₁₀
    rw [h₀₁.antisymm, h₁₀.antisymm, add_zero] <;> positivity
  refine' le_of_mul_le_mul_right _ hcd
  calc (a₀ * b₁ + a₁ * b₀) * (c₀ * d₁)
      = a₀ * b₁ * (c₀ * d₁) + c₀ * d₁ * (a₁ * b₀) := by ring
    _ ≤ a₀ * b₁ * (a₁ * b₀) + c₀ * d₁ * (c₀ * d₁) := mul_add_mul_le_mul_add_mul h₀₁ h₁₀
    _ = a₀ * b₀ * (a₁ * b₁) + c₀ * d₁ * (c₀ * d₁) := by 

Proof state:
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜 ℬ : Finset (Finset α)
a : α
f f₁ f₂ f₃ f₄ g μ : Finset α → β
s t u : Finset α
a₀ a₁ b₀ b₁ c₀ c₁ d₀ d₁ : β
ha₀ : 0 ≤ a₀
ha₁ : 0 ≤ a₁
hb₀ : 0 ≤ b₀
hb₁ : 0 ≤ b₁
hc₀ : 0 ≤ c₀
hc₁ : 0 ≤ c₁
hd₀ : 0 ≤ d₀
hd₁ : 0 ≤ d₁
h₀₀ : a₀ * b₀ ≤ c₀ * d₀
h₁₀ : a₁ * b₀ ≤ c₀ * d₁
h₀₁ : a₀ * b₁ ≤ c₀ * d₁
h₁₁ : a₁ * b₁ ≤ c₁ * d₁
hcd : 0 < c₀ * d₁
⊢ a₀ * b₁ * (a₁ * b₀) + c₀ * d₁ * (c₀ * d₁) = a₀ * b₀ * (a₁ * b₁) + c₀ * d₁ * (c₀ * d₁)

Next tactic:
ring
/-- The `n = 1` case of the Ahlswede-Daykin inequality. Note that we can't just expand everything
out and bound termwise since `c₀ * d₁` appears twice on the RHS of the assumptions while `c₁ * d₀`
does not appear. -/
private lemma ineq {a₀ a₁ b₀ b₁ c₀ c₁ d₀ d₁ : β}
    (ha₀ : 0 ≤ a₀) (ha₁ : 0 ≤ a₁) (hb₀ : 0 ≤ b₀) (hb₁ : 0 ≤ b₁)
    (hc₀ : 0 ≤ c₀) (hc₁ : 0 ≤ c₁) (hd₀ : 0 ≤ d₀) (hd₁ : 0 ≤ d₁)
    (h₀₀ : a₀ * b₀ ≤ c₀ * d₀) (h₁₀ : a₁ * b₀ ≤ c₀ * d₁)
    (h₀₁ : a₀ * b₁ ≤ c₀ * d₁) (h₁₁ : a₁ * b₁ ≤ c₁ * d₁) :
    (a₀ + a₁) * (b₀ + b₁) ≤ (c₀ + c₁) * (d₀ + d₁) := by
  calc
    _ = a₀ * b₀ + (a₀ * b₁ + a₁ * b₀) + a₁ * b₁ := by ring
    _ ≤ c₀ * d₀ + (c₀ * d₁ + c₁ * d₀) + c₁ * d₁ := add_le_add_three h₀₀ ?_ h₁₁
    _ = (c₀ + c₁) * (d₀ + d₁) := by ring
  obtain hcd | hcd := (mul_nonneg hc₀ hd₁).eq_or_gt
  · rw [hcd] at h₀₁ h₁₀
    rw [h₀₁.antisymm, h₁₀.antisymm, add_zero] <;> positivity
  refine' le_of_mul_le_mul_right _ hcd
  calc (a₀ * b₁ + a₁ * b₀) * (c₀ * d₁)
      = a₀ * b₁ * (c₀ * d₁) + c₀ * d₁ * (a₁ * b₀) := by ring
    _ ≤ a₀ * b₁ * (a₁ * b₀) + c₀ * d₁ * (c₀ * d₁) := mul_add_mul_le_mul_add_mul h₀₁ h₁₀
    _ = a₀ * b₀ * (a₁ * b₁) + c₀ * d₁ * (c₀ * d₁) := by ring
    _ ≤ c₀ * d₀ * (c₁ * d₁) + c₀ * d₁ * (c₀ * d₁) :=
        add_le_add_right (mul_le_mul h₀₀ h₁₁ (by 

Proof state:
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜 ℬ : Finset (Finset α)
a : α
f f₁ f₂ f₃ f₄ g μ : Finset α → β
s t u : Finset α
a₀ a₁ b₀ b₁ c₀ c₁ d₀ d₁ : β
ha₀ : 0 ≤ a₀
ha₁ : 0 ≤ a₁
hb₀ : 0 ≤ b₀
hb₁ : 0 ≤ b₁
hc₀ : 0 ≤ c₀
hc₁ : 0 ≤ c₁
hd₀ : 0 ≤ d₀
hd₁ : 0 ≤ d₁
h₀₀ : a₀ * b₀ ≤ c₀ * d₀
h₁₀ : a₁ * b₀ ≤ c₀ * d₁
h₀₁ : a₀ * b₁ ≤ c₀ * d₁
h₁₁ : a₁ * b₁ ≤ c₁ * d₁
hcd : 0 < c₀ * d₁
⊢ 0 ≤ a₁ * b₁

Next tactic:
positivity
/-- The `n = 1` case of the Ahlswede-Daykin inequality. Note that we can't just expand everything
out and bound termwise since `c₀ * d₁` appears twice on the RHS of the assumptions while `c₁ * d₀`
does not appear. -/
private lemma ineq {a₀ a₁ b₀ b₁ c₀ c₁ d₀ d₁ : β}
    (ha₀ : 0 ≤ a₀) (ha₁ : 0 ≤ a₁) (hb₀ : 0 ≤ b₀) (hb₁ : 0 ≤ b₁)
    (hc₀ : 0 ≤ c₀) (hc₁ : 0 ≤ c₁) (hd₀ : 0 ≤ d₀) (hd₁ : 0 ≤ d₁)
    (h₀₀ : a₀ * b₀ ≤ c₀ * d₀) (h₁₀ : a₁ * b₀ ≤ c₀ * d₁)
    (h₀₁ : a₀ * b₁ ≤ c₀ * d₁) (h₁₁ : a₁ * b₁ ≤ c₁ * d₁) :
    (a₀ + a₁) * (b₀ + b₁) ≤ (c₀ + c₁) * (d₀ + d₁) := by
  calc
    _ = a₀ * b₀ + (a₀ * b₁ + a₁ * b₀) + a₁ * b₁ := by ring
    _ ≤ c₀ * d₀ + (c₀ * d₁ + c₁ * d₀) + c₁ * d₁ := add_le_add_three h₀₀ ?_ h₁₁
    _ = (c₀ + c₁) * (d₀ + d₁) := by ring
  obtain hcd | hcd := (mul_nonneg hc₀ hd₁).eq_or_gt
  · rw [hcd] at h₀₁ h₁₀
    rw [h₀₁.antisymm, h₁₀.antisymm, add_zero] <;> positivity
  refine' le_of_mul_le_mul_right _ hcd
  calc (a₀ * b₁ + a₁ * b₀) * (c₀ * d₁)
      = a₀ * b₁ * (c₀ * d₁) + c₀ * d₁ * (a₁ * b₀) := by ring
    _ ≤ a₀ * b₁ * (a₁ * b₀) + c₀ * d₁ * (c₀ * d₁) := mul_add_mul_le_mul_add_mul h₀₁ h₁₀
    _ = a₀ * b₀ * (a₁ * b₁) + c₀ * d₁ * (c₀ * d₁) := by ring
    _ ≤ c₀ * d₀ * (c₁ * d₁) + c₀ * d₁ * (c₀ * d₁) :=
        add_le_add_right (mul_le_mul h₀₀ h₁₁ (by positivity) $ by 

Proof state:
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜 ℬ : Finset (Finset α)
a : α
f f₁ f₂ f₃ f₄ g μ : Finset α → β
s t u : Finset α
a₀ a₁ b₀ b₁ c₀ c₁ d₀ d₁ : β
ha₀ : 0 ≤ a₀
ha₁ : 0 ≤ a₁
hb₀ : 0 ≤ b₀
hb₁ : 0 ≤ b₁
hc₀ : 0 ≤ c₀
hc₁ : 0 ≤ c₁
hd₀ : 0 ≤ d₀
hd₁ : 0 ≤ d₁
h₀₀ : a₀ * b₀ ≤ c₀ * d₀
h₁₀ : a₁ * b₀ ≤ c₀ * d₁
h₀₁ : a₀ * b₁ ≤ c₀ * d₁
h₁₁ : a₁ * b₁ ≤ c₁ * d₁
hcd : 0 < c₀ * d₁
⊢ 0 ≤ c₀ * d₀

Next tactic:
positivity
/-- The `n = 1` case of the Ahlswede-Daykin inequality. Note that we can't just expand everything
out and bound termwise since `c₀ * d₁` appears twice on the RHS of the assumptions while `c₁ * d₀`
does not appear. -/
private lemma ineq {a₀ a₁ b₀ b₁ c₀ c₁ d₀ d₁ : β}
    (ha₀ : 0 ≤ a₀) (ha₁ : 0 ≤ a₁) (hb₀ : 0 ≤ b₀) (hb₁ : 0 ≤ b₁)
    (hc₀ : 0 ≤ c₀) (hc₁ : 0 ≤ c₁) (hd₀ : 0 ≤ d₀) (hd₁ : 0 ≤ d₁)
    (h₀₀ : a₀ * b₀ ≤ c₀ * d₀) (h₁₀ : a₁ * b₀ ≤ c₀ * d₁)
    (h₀₁ : a₀ * b₁ ≤ c₀ * d₁) (h₁₁ : a₁ * b₁ ≤ c₁ * d₁) :
    (a₀ + a₁) * (b₀ + b₁) ≤ (c₀ + c₁) * (d₀ + d₁) := by
  calc
    _ = a₀ * b₀ + (a₀ * b₁ + a₁ * b₀) + a₁ * b₁ := by ring
    _ ≤ c₀ * d₀ + (c₀ * d₁ + c₁ * d₀) + c₁ * d₁ := add_le_add_three h₀₀ ?_ h₁₁
    _ = (c₀ + c₁) * (d₀ + d₁) := by ring
  obtain hcd | hcd := (mul_nonneg hc₀ hd₁).eq_or_gt
  · rw [hcd] at h₀₁ h₁₀
    rw [h₀₁.antisymm, h₁₀.antisymm, add_zero] <;> positivity
  refine' le_of_mul_le_mul_right _ hcd
  calc (a₀ * b₁ + a₁ * b₀) * (c₀ * d₁)
      = a₀ * b₁ * (c₀ * d₁) + c₀ * d₁ * (a₁ * b₀) := by ring
    _ ≤ a₀ * b₁ * (a₁ * b₀) + c₀ * d₁ * (c₀ * d₁) := mul_add_mul_le_mul_add_mul h₀₁ h₁₀
    _ = a₀ * b₀ * (a₁ * b₁) + c₀ * d₁ * (c₀ * d₁) := by ring
    _ ≤ c₀ * d₀ * (c₁ * d₁) + c₀ * d₁ * (c₀ * d₁) :=
        add_le_add_right (mul_le_mul h₀₀ h₁₁ (by positivity) $ by positivity) _
    _ = (c₀ * d₁ + c₁ * d₀) * (c₀ * d₁) := by 

Proof state:
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜 ℬ : Finset (Finset α)
a : α
f f₁ f₂ f₃ f₄ g μ : Finset α → β
s t u : Finset α
a₀ a₁ b₀ b₁ c₀ c₁ d₀ d₁ : β
ha₀ : 0 ≤ a₀
ha₁ : 0 ≤ a₁
hb₀ : 0 ≤ b₀
hb₁ : 0 ≤ b₁
hc₀ : 0 ≤ c₀
hc₁ : 0 ≤ c₁
hd₀ : 0 ≤ d₀
hd₁ : 0 ≤ d₁
h₀₀ : a₀ * b₀ ≤ c₀ * d₀
h₁₀ : a₁ * b₀ ≤ c₀ * d₁
h₀₁ : a₀ * b₁ ≤ c₀ * d₁
h₁₁ : a₁ * b₁ ≤ c₁ * d₁
hcd : 0 < c₀ * d₁
⊢ c₀ * d₀ * (c₁ * d₁) + c₀ * d₁ * (c₀ * d₁) = (c₀ * d₁ + c₁ * d₀) * (c₀ * d₁)

Next tactic:
ring
private lemma erase_eq_iff (hs : a ∉ s) : t.erase a = s ↔ t = s ∨ t = insert a s := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜 ℬ : Finset (Finset α)
a : α
f f₁ f₂ f₃ f₄ g μ : Finset α → β
s t u : Finset α
hs : a ∉ s
⊢ erase t a = s ↔ t = s ∨ t = insert a s

Next tactic:
by_cases ht : a ∈ t
private lemma erase_eq_iff (hs : a ∉ s) : t.erase a = s ↔ t = s ∨ t = insert a s := by
  by_cases ht : a ∈ t <;>
  · 

Proof state:
case pos
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜 ℬ : Finset (Finset α)
a : α
f f₁ f₂ f₃ f₄ g μ : Finset α → β
s t u : Finset α
hs : a ∉ s
ht : a ∈ t
⊢ erase t a = s ↔ t = s ∨ t = insert a s

Next tactic:
simp [ne_of_mem_of_not_mem', erase_eq_iff_eq_insert, *]
private lemma erase_eq_iff (hs : a ∉ s) : t.erase a = s ↔ t = s ∨ t = insert a s := by
  by_cases ht : a ∈ t <;>
  · simp [ne_of_mem_of_not_mem', erase_eq_iff_eq_insert, *]
    

Proof state:
case pos
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜 ℬ : Finset (Finset α)
a : α
f f₁ f₂ f₃ f₄ g μ : Finset α → β
s t u : Finset α
hs : a ∉ s
ht : a ∈ t
⊢ t = insert a s ↔ t = s ∨ t = insert a s

Next tactic:
aesop
private lemma erase_eq_iff (hs : a ∉ s) : t.erase a = s ↔ t = s ∨ t = insert a s := by
  by_cases ht : a ∈ t <;>
  · 

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜 ℬ : Finset (Finset α)
a : α
f f₁ f₂ f₃ f₄ g μ : Finset α → β
s t u : Finset α
hs : a ∉ s
ht : a ∉ t
⊢ erase t a = s ↔ t = s ∨ t = insert a s

Next tactic:
simp [ne_of_mem_of_not_mem', erase_eq_iff_eq_insert, *]
private lemma erase_eq_iff (hs : a ∉ s) : t.erase a = s ↔ t = s ∨ t = insert a s := by
  by_cases ht : a ∈ t <;>
  · simp [ne_of_mem_of_not_mem', erase_eq_iff_eq_insert, *]
    

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜 ℬ : Finset (Finset α)
a : α
f f₁ f₂ f₃ f₄ g μ : Finset α → β
s t u : Finset α
hs : a ∉ s
ht : a ∉ t
⊢ t = s ↔ t = s ∨ t = insert a s

Next tactic:
aesop
private lemma filter_collapse_eq (ha : a ∉ s) (𝒜 : Finset (Finset α)) :
    (𝒜.filter fun t ↦ t.erase a = s) =
      if s ∈ 𝒜 then
        (if insert a s ∈ 𝒜 then {s, insert a s} else {s})
      else
        (if insert a s ∈ 𝒜 then {insert a s} else ∅) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜✝ ℬ : Finset (Finset α)
a : α
f f₁ f₂ f₃ f₄ g μ : Finset α → β
s t u : Finset α
ha : a ∉ s
𝒜 : Finset (Finset α)
⊢ filter (fun t => erase t a = s) 𝒜 =
    if s ∈ 𝒜 then if insert a s ∈ 𝒜 then {s, insert a s} else {s} else if insert a s ∈ 𝒜 then {insert a s} else ∅

Next tactic:
ext t
private lemma filter_collapse_eq (ha : a ∉ s) (𝒜 : Finset (Finset α)) :
    (𝒜.filter fun t ↦ t.erase a = s) =
      if s ∈ 𝒜 then
        (if insert a s ∈ 𝒜 then {s, insert a s} else {s})
      else
        (if insert a s ∈ 𝒜 then {insert a s} else ∅) := by
  ext t; 

Proof state:
case a
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜✝ ℬ : Finset (Finset α)
a : α
f f₁ f₂ f₃ f₄ g μ : Finset α → β
s t✝ u : Finset α
ha : a ∉ s
𝒜 : Finset (Finset α)
t : Finset α
⊢ t ∈ filter (fun t => erase t a = s) 𝒜 ↔
    t ∈ if s ∈ 𝒜 then if insert a s ∈ 𝒜 then {s, insert a s} else {s} else if insert a s ∈ 𝒜 then {insert a s} else ∅

Next tactic:
split_ifs
private lemma filter_collapse_eq (ha : a ∉ s) (𝒜 : Finset (Finset α)) :
    (𝒜.filter fun t ↦ t.erase a = s) =
      if s ∈ 𝒜 then
        (if insert a s ∈ 𝒜 then {s, insert a s} else {s})
      else
        (if insert a s ∈ 𝒜 then {insert a s} else ∅) := by
  ext t; split_ifs <;> 

Proof state:
case pos
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜✝ ℬ : Finset (Finset α)
a : α
f f₁ f₂ f₃ f₄ g μ : Finset α → β
s t✝ u : Finset α
ha : a ∉ s
𝒜 : Finset (Finset α)
t : Finset α
h✝¹ : s ∈ 𝒜
h✝ : insert a s ∈ 𝒜
⊢ t ∈ filter (fun t => erase t a = s) 𝒜 ↔ t ∈ {s, insert a s}

Next tactic:
simp [erase_eq_iff ha]
private lemma filter_collapse_eq (ha : a ∉ s) (𝒜 : Finset (Finset α)) :
    (𝒜.filter fun t ↦ t.erase a = s) =
      if s ∈ 𝒜 then
        (if insert a s ∈ 𝒜 then {s, insert a s} else {s})
      else
        (if insert a s ∈ 𝒜 then {insert a s} else ∅) := by
  ext t; split_ifs <;> 

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜✝ ℬ : Finset (Finset α)
a : α
f f₁ f₂ f₃ f₄ g μ : Finset α → β
s t✝ u : Finset α
ha : a ∉ s
𝒜 : Finset (Finset α)
t : Finset α
h✝¹ : s ∈ 𝒜
h✝ : insert a s ∉ 𝒜
⊢ t ∈ filter (fun t => erase t a = s) 𝒜 ↔ t ∈ {s}

Next tactic:
simp [erase_eq_iff ha]
private lemma filter_collapse_eq (ha : a ∉ s) (𝒜 : Finset (Finset α)) :
    (𝒜.filter fun t ↦ t.erase a = s) =
      if s ∈ 𝒜 then
        (if insert a s ∈ 𝒜 then {s, insert a s} else {s})
      else
        (if insert a s ∈ 𝒜 then {insert a s} else ∅) := by
  ext t; split_ifs <;> 

Proof state:
case pos
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜✝ ℬ : Finset (Finset α)
a : α
f f₁ f₂ f₃ f₄ g μ : Finset α → β
s t✝ u : Finset α
ha : a ∉ s
𝒜 : Finset (Finset α)
t : Finset α
h✝¹ : s ∉ 𝒜
h✝ : insert a s ∈ 𝒜
⊢ t ∈ filter (fun t => erase t a = s) 𝒜 ↔ t ∈ {insert a s}

Next tactic:
simp [erase_eq_iff ha]
private lemma filter_collapse_eq (ha : a ∉ s) (𝒜 : Finset (Finset α)) :
    (𝒜.filter fun t ↦ t.erase a = s) =
      if s ∈ 𝒜 then
        (if insert a s ∈ 𝒜 then {s, insert a s} else {s})
      else
        (if insert a s ∈ 𝒜 then {insert a s} else ∅) := by
  ext t; split_ifs <;> 

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜✝ ℬ : Finset (Finset α)
a : α
f f₁ f₂ f₃ f₄ g μ : Finset α → β
s t✝ u : Finset α
ha : a ∉ s
𝒜 : Finset (Finset α)
t : Finset α
h✝¹ : s ∉ 𝒜
h✝ : insert a s ∉ 𝒜
⊢ t ∈ filter (fun t => erase t a = s) 𝒜 ↔ t ∈ ∅

Next tactic:
simp [erase_eq_iff ha]
private lemma filter_collapse_eq (ha : a ∉ s) (𝒜 : Finset (Finset α)) :
    (𝒜.filter fun t ↦ t.erase a = s) =
      if s ∈ 𝒜 then
        (if insert a s ∈ 𝒜 then {s, insert a s} else {s})
      else
        (if insert a s ∈ 𝒜 then {insert a s} else ∅) := by
  ext t; split_ifs <;> simp [erase_eq_iff ha] <;> 

Proof state:
case pos
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜✝ ℬ : Finset (Finset α)
a : α
f f₁ f₂ f₃ f₄ g μ : Finset α → β
s t✝ u : Finset α
ha : a ∉ s
𝒜 : Finset (Finset α)
t : Finset α
h✝¹ : s ∈ 𝒜
h✝ : insert a s ∈ 𝒜
⊢ t = s ∨ t = insert a s → t ∈ 𝒜

Next tactic:
aesop
private lemma filter_collapse_eq (ha : a ∉ s) (𝒜 : Finset (Finset α)) :
    (𝒜.filter fun t ↦ t.erase a = s) =
      if s ∈ 𝒜 then
        (if insert a s ∈ 𝒜 then {s, insert a s} else {s})
      else
        (if insert a s ∈ 𝒜 then {insert a s} else ∅) := by
  ext t; split_ifs <;> simp [erase_eq_iff ha] <;> 

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜✝ ℬ : Finset (Finset α)
a : α
f f₁ f₂ f₃ f₄ g μ : Finset α → β
s t✝ u : Finset α
ha : a ∉ s
𝒜 : Finset (Finset α)
t : Finset α
h✝¹ : s ∈ 𝒜
h✝ : insert a s ∉ 𝒜
⊢ t ∈ 𝒜 ∧ (t = s ∨ t = insert a s) ↔ t = s

Next tactic:
aesop
private lemma filter_collapse_eq (ha : a ∉ s) (𝒜 : Finset (Finset α)) :
    (𝒜.filter fun t ↦ t.erase a = s) =
      if s ∈ 𝒜 then
        (if insert a s ∈ 𝒜 then {s, insert a s} else {s})
      else
        (if insert a s ∈ 𝒜 then {insert a s} else ∅) := by
  ext t; split_ifs <;> simp [erase_eq_iff ha] <;> 

Proof state:
case pos
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜✝ ℬ : Finset (Finset α)
a : α
f f₁ f₂ f₃ f₄ g μ : Finset α → β
s t✝ u : Finset α
ha : a ∉ s
𝒜 : Finset (Finset α)
t : Finset α
h✝¹ : s ∉ 𝒜
h✝ : insert a s ∈ 𝒜
⊢ t ∈ 𝒜 ∧ (t = s ∨ t = insert a s) ↔ t = insert a s

Next tactic:
aesop
private lemma filter_collapse_eq (ha : a ∉ s) (𝒜 : Finset (Finset α)) :
    (𝒜.filter fun t ↦ t.erase a = s) =
      if s ∈ 𝒜 then
        (if insert a s ∈ 𝒜 then {s, insert a s} else {s})
      else
        (if insert a s ∈ 𝒜 then {insert a s} else ∅) := by
  ext t; split_ifs <;> simp [erase_eq_iff ha] <;> 

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜✝ ℬ : Finset (Finset α)
a : α
f f₁ f₂ f₃ f₄ g μ : Finset α → β
s t✝ u : Finset α
ha : a ∉ s
𝒜 : Finset (Finset α)
t : Finset α
h✝¹ : s ∉ 𝒜
h✝ : insert a s ∉ 𝒜
⊢ t ∈ 𝒜 → ¬(t = s ∨ t = insert a s)

Next tactic:
aesop
lemma collapse_eq (ha : a ∉ s) (𝒜 : Finset (Finset α)) (f : Finset α → β) :
    collapse 𝒜 a f s = (if s ∈ 𝒜 then f s else 0) +
      if insert a s ∈ 𝒜 then f (insert a s) else 0 := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜✝ ℬ : Finset (Finset α)
a : α
f✝ f₁ f₂ f₃ f₄ g μ : Finset α → β
s t u : Finset α
ha : a ∉ s
𝒜 : Finset (Finset α)
f : Finset α → β
⊢ collapse 𝒜 a f s = (if s ∈ 𝒜 then f s else 0) + if insert a s ∈ 𝒜 then f (insert a s) else 0

Next tactic:
rw [collapse, filter_collapse_eq ha]
lemma collapse_eq (ha : a ∉ s) (𝒜 : Finset (Finset α)) (f : Finset α → β) :
    collapse 𝒜 a f s = (if s ∈ 𝒜 then f s else 0) +
      if insert a s ∈ 𝒜 then f (insert a s) else 0 := by
  rw [collapse, filter_collapse_eq ha]
  

Proof state:
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜✝ ℬ : Finset (Finset α)
a : α
f✝ f₁ f₂ f₃ f₄ g μ : Finset α → β
s t u : Finset α
ha : a ∉ s
𝒜 : Finset (Finset α)
f : Finset α → β
⊢ ∑ t in if s ∈ 𝒜 then if insert a s ∈ 𝒜 then {s, insert a s} else {s} else if insert a s ∈ 𝒜 then {insert a s} else ∅,
      f t =
    (if s ∈ 𝒜 then f s else 0) + if insert a s ∈ 𝒜 then f (insert a s) else 0

Next tactic:
split_ifs
lemma collapse_eq (ha : a ∉ s) (𝒜 : Finset (Finset α)) (f : Finset α → β) :
    collapse 𝒜 a f s = (if s ∈ 𝒜 then f s else 0) +
      if insert a s ∈ 𝒜 then f (insert a s) else 0 := by
  rw [collapse, filter_collapse_eq ha]
  split_ifs <;> 

Proof state:
case pos
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜✝ ℬ : Finset (Finset α)
a : α
f✝ f₁ f₂ f₃ f₄ g μ : Finset α → β
s t u : Finset α
ha : a ∉ s
𝒜 : Finset (Finset α)
f : Finset α → β
h✝¹ : s ∈ 𝒜
h✝ : insert a s ∈ 𝒜
⊢ ∑ x in {s, insert a s}, f x = f s + f (insert a s)

Next tactic:
simp [(ne_of_mem_of_not_mem' (mem_insert_self a s) ha).symm, *]
lemma collapse_eq (ha : a ∉ s) (𝒜 : Finset (Finset α)) (f : Finset α → β) :
    collapse 𝒜 a f s = (if s ∈ 𝒜 then f s else 0) +
      if insert a s ∈ 𝒜 then f (insert a s) else 0 := by
  rw [collapse, filter_collapse_eq ha]
  split_ifs <;> 

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜✝ ℬ : Finset (Finset α)
a : α
f✝ f₁ f₂ f₃ f₄ g μ : Finset α → β
s t u : Finset α
ha : a ∉ s
𝒜 : Finset (Finset α)
f : Finset α → β
h✝¹ : s ∈ 𝒜
h✝ : insert a s ∉ 𝒜
⊢ ∑ x in {s}, f x = f s + 0

Next tactic:
simp [(ne_of_mem_of_not_mem' (mem_insert_self a s) ha).symm, *]
lemma collapse_eq (ha : a ∉ s) (𝒜 : Finset (Finset α)) (f : Finset α → β) :
    collapse 𝒜 a f s = (if s ∈ 𝒜 then f s else 0) +
      if insert a s ∈ 𝒜 then f (insert a s) else 0 := by
  rw [collapse, filter_collapse_eq ha]
  split_ifs <;> 

Proof state:
case pos
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜✝ ℬ : Finset (Finset α)
a : α
f✝ f₁ f₂ f₃ f₄ g μ : Finset α → β
s t u : Finset α
ha : a ∉ s
𝒜 : Finset (Finset α)
f : Finset α → β
h✝¹ : s ∉ 𝒜
h✝ : insert a s ∈ 𝒜
⊢ ∑ x in {insert a s}, f x = 0 + f (insert a s)

Next tactic:
simp [(ne_of_mem_of_not_mem' (mem_insert_self a s) ha).symm, *]
lemma collapse_eq (ha : a ∉ s) (𝒜 : Finset (Finset α)) (f : Finset α → β) :
    collapse 𝒜 a f s = (if s ∈ 𝒜 then f s else 0) +
      if insert a s ∈ 𝒜 then f (insert a s) else 0 := by
  rw [collapse, filter_collapse_eq ha]
  split_ifs <;> 

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜✝ ℬ : Finset (Finset α)
a : α
f✝ f₁ f₂ f₃ f₄ g μ : Finset α → β
s t u : Finset α
ha : a ∉ s
𝒜 : Finset (Finset α)
f : Finset α → β
h✝¹ : s ∉ 𝒜
h✝ : insert a s ∉ 𝒜
⊢ ∑ x in ∅, f x = 0 + 0

Next tactic:
simp [(ne_of_mem_of_not_mem' (mem_insert_self a s) ha).symm, *]
lemma collapse_of_mem (ha : a ∉ s) (ht : t ∈ 𝒜) (hu  : u ∈ 𝒜) (hts : t = s)
    (hus : u = insert a s) : collapse 𝒜 a f s = f t + f u := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜 ℬ : Finset (Finset α)
a : α
f f₁ f₂ f₃ f₄ g μ : Finset α → β
s t u : Finset α
ha : a ∉ s
ht : t ∈ 𝒜
hu : u ∈ 𝒜
hts : t = s
hus : u = insert a s
⊢ collapse 𝒜 a f s = f t + f u

Next tactic:
subst hts
lemma collapse_of_mem (ha : a ∉ s) (ht : t ∈ 𝒜) (hu  : u ∈ 𝒜) (hts : t = s)
    (hus : u = insert a s) : collapse 𝒜 a f s = f t + f u := by
  subst hts; 

Proof state:
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜 ℬ : Finset (Finset α)
a : α
f f₁ f₂ f₃ f₄ g μ : Finset α → β
t u : Finset α
ht : t ∈ 𝒜
hu : u ∈ 𝒜
ha : a ∉ t
hus : u = insert a t
⊢ collapse 𝒜 a f t = f t + f u

Next tactic:
subst hus
lemma collapse_of_mem (ha : a ∉ s) (ht : t ∈ 𝒜) (hu  : u ∈ 𝒜) (hts : t = s)
    (hus : u = insert a s) : collapse 𝒜 a f s = f t + f u := by
  subst hts; subst hus; 

Proof state:
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜 ℬ : Finset (Finset α)
a : α
f f₁ f₂ f₃ f₄ g μ : Finset α → β
t : Finset α
ht : t ∈ 𝒜
ha : a ∉ t
hu : insert a t ∈ 𝒜
⊢ collapse 𝒜 a f t = f t + f (insert a t)

Next tactic:
simp_rw [collapse_eq ha, if_pos ht, if_pos hu]
lemma le_collapse_of_mem (ha : a ∉ s) (hf : 0 ≤ f) (hts : t = s) (ht : t ∈ 𝒜) :
    f t ≤ collapse 𝒜 a f s := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜 ℬ : Finset (Finset α)
a : α
f f₁ f₂ f₃ f₄ g μ : Finset α → β
s t u : Finset α
ha : a ∉ s
hf : 0 ≤ f
hts : t = s
ht : t ∈ 𝒜
⊢ f t ≤ collapse 𝒜 a f s

Next tactic:
subst hts
lemma le_collapse_of_mem (ha : a ∉ s) (hf : 0 ≤ f) (hts : t = s) (ht : t ∈ 𝒜) :
    f t ≤ collapse 𝒜 a f s := by
  subst hts
  

Proof state:
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜 ℬ : Finset (Finset α)
a : α
f f₁ f₂ f₃ f₄ g μ : Finset α → β
t u : Finset α
hf : 0 ≤ f
ht : t ∈ 𝒜
ha : a ∉ t
⊢ f t ≤ collapse 𝒜 a f t

Next tactic:
rw [collapse_eq ha, if_pos ht]
lemma le_collapse_of_mem (ha : a ∉ s) (hf : 0 ≤ f) (hts : t = s) (ht : t ∈ 𝒜) :
    f t ≤ collapse 𝒜 a f s := by
  subst hts
  rw [collapse_eq ha, if_pos ht]
  

Proof state:
α : Type u_1
β : Type u_2
inst✝² : DecidableEq α
inst✝¹ : LinearOrderedCommSemiring β
inst✝ : ExistsAddOfLE β
𝒜 ℬ : Finset (Finset α)
a : α
f f₁ f₂ f₃ f₄ g μ : Finset α → β
t u : Finset α
hf : 0 ≤ f
ht : t ∈ 𝒜
ha : a ∉ t
⊢ f t ≤ f t + if insert a t ∈ 𝒜 then f (insert a t) else 0

Next tactic:
split_ifs