l3lab/ntp-mathlib huggingface dataset:
@[to_additive]
lemma mul_le_prod {i j : ι} (hf : ∀ i ∈ s, 1 ≤ f i) (hi : i ∈ s) (hj : j ∈ s) (hne : i ≠ j) :
    f i * f j ≤ ∏ k in s, f k :=
  calc
    f i * f j = ∏ k in .cons i {j} (by simpa), f k := by rw [prod_cons, prod_singleton]
    _ ≤ ∏ k in s, f k := by
      refine prod_le_prod_of_subset_of_one_le' ?_ fun k hk _ ↦ hf k hk
      

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝¹ : CommMonoid M
inst✝ : OrderedCommMonoid N
f g : ι → N
s t : Finset ι
i j : ι
hf : ∀ i ∈ s, 1 ≤ f i
hi : i ∈ s
hj : j ∈ s
hne : i ≠ j
⊢ cons i {j} (_ : i ∉ {j}) ⊆ s

Next tactic:
simp [cons_subset, *]
@[to_additive sum_le_card_nsmul]
theorem prod_le_pow_card (s : Finset ι) (f : ι → N) (n : N) (h : ∀ x ∈ s, f x ≤ n) :
    s.prod f ≤ n ^ s.card := by
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝¹ : CommMonoid M
inst✝ : OrderedCommMonoid N
f✝ g : ι → N
s✝ t s : Finset ι
f : ι → N
n : N
h : ∀ x ∈ s, f x ≤ n
⊢ Finset.prod s f ≤ n ^ card s

Next tactic:
refine' (Multiset.prod_le_pow_card (s.val.map f) n _).trans _
@[to_additive sum_le_card_nsmul]
theorem prod_le_pow_card (s : Finset ι) (f : ι → N) (n : N) (h : ∀ x ∈ s, f x ≤ n) :
    s.prod f ≤ n ^ s.card := by
  refine' (Multiset.prod_le_pow_card (s.val.map f) n _).trans _
  · 

Proof state:
case refine'_1
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝¹ : CommMonoid M
inst✝ : OrderedCommMonoid N
f✝ g : ι → N
s✝ t s : Finset ι
f : ι → N
n : N
h : ∀ x ∈ s, f x ≤ n
⊢ ∀ x ∈ Multiset.map f s.val, x ≤ n

Next tactic:
simpa using h
@[to_additive sum_le_card_nsmul]
theorem prod_le_pow_card (s : Finset ι) (f : ι → N) (n : N) (h : ∀ x ∈ s, f x ≤ n) :
    s.prod f ≤ n ^ s.card := by
  refine' (Multiset.prod_le_pow_card (s.val.map f) n _).trans _
  · simpa using h
  · 

Proof state:
case refine'_2
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝¹ : CommMonoid M
inst✝ : OrderedCommMonoid N
f✝ g : ι → N
s✝ t s : Finset ι
f : ι → N
n : N
h : ∀ x ∈ s, f x ≤ n
⊢ n ^ Multiset.card (Multiset.map f s.val) ≤ n ^ card s

Next tactic:
simp
theorem abs_sum_of_nonneg {G : Type*} [LinearOrderedAddCommGroup G] {f : ι → G} {s : Finset ι}
    (hf : ∀ i ∈ s, 0 ≤ f i) : |∑ i : ι in s, f i| = ∑ i : ι in s, f i := by
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G✝ : Type u_6
k : Type u_7
R : Type u_8
G : Type u_9
inst✝ : LinearOrderedAddCommGroup G
f : ι → G
s : Finset ι
hf : ∀ i ∈ s, 0 ≤ f i
⊢ |∑ i in s, f i| = ∑ i in s, f i

Next tactic:
rw [abs_of_nonneg (Finset.sum_nonneg hf)]
theorem abs_sum_of_nonneg' {G : Type*} [LinearOrderedAddCommGroup G] {f : ι → G} {s : Finset ι}
    (hf : ∀ i, 0 ≤ f i) : |∑ i : ι in s, f i| = ∑ i : ι in s, f i := by
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G✝ : Type u_6
k : Type u_7
R : Type u_8
G : Type u_9
inst✝ : LinearOrderedAddCommGroup G
f : ι → G
s : Finset ι
hf : ∀ (i : ι), 0 ≤ f i
⊢ |∑ i in s, f i| = ∑ i in s, f i

Next tactic:
rw [abs_of_nonneg (Finset.sum_nonneg' hf)]
theorem card_le_mul_card_image_of_maps_to {f : α → β} {s : Finset α} {t : Finset β}
    (Hf : ∀ a ∈ s, f a ∈ t) (n : ℕ) (hn : ∀ a ∈ t, (s.filter fun x ↦ f x = a).card ≤ n) :
    s.card ≤ n * t.card :=
  calc
    s.card = ∑ a in t, (s.filter fun x ↦ f x = a).card := card_eq_sum_card_fiberwise Hf
    _ ≤ ∑ _a in t, n := sum_le_sum hn
    _ = _ := by 

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝ : DecidableEq β
f : α → β
s : Finset α
t : Finset β
Hf : ∀ a ∈ s, f a ∈ t
n : ℕ
hn : ∀ a ∈ t, card (filter (fun x => f x = a) s) ≤ n
⊢ ∑ _a in t, n = n * card t

Next tactic:
simp [mul_comm]
theorem mul_card_image_le_card_of_maps_to {f : α → β} {s : Finset α} {t : Finset β}
    (Hf : ∀ a ∈ s, f a ∈ t) (n : ℕ) (hn : ∀ a ∈ t, n ≤ (s.filter fun x ↦ f x = a).card) :
    n * t.card ≤ s.card :=
  calc
    n * t.card = ∑ _a in t, n := by 

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝ : DecidableEq β
f : α → β
s : Finset α
t : Finset β
Hf : ∀ a ∈ s, f a ∈ t
n : ℕ
hn : ∀ a ∈ t, n ≤ card (filter (fun x => f x = a) s)
⊢ n * card t = ∑ _a in t, n

Next tactic:
simp [mul_comm]
theorem mul_card_image_le_card_of_maps_to {f : α → β} {s : Finset α} {t : Finset β}
    (Hf : ∀ a ∈ s, f a ∈ t) (n : ℕ) (hn : ∀ a ∈ t, n ≤ (s.filter fun x ↦ f x = a).card) :
    n * t.card ≤ s.card :=
  calc
    n * t.card = ∑ _a in t, n := by simp [mul_comm]
    _ ≤ ∑ a in t, (s.filter fun x ↦ f x = a).card := sum_le_sum hn
    _ = s.card := by 

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝ : DecidableEq β
f : α → β
s : Finset α
t : Finset β
Hf : ∀ a ∈ s, f a ∈ t
n : ℕ
hn : ∀ a ∈ t, n ≤ card (filter (fun x => f x = a) s)
⊢ ∑ a in t, card (filter (fun x => f x = a) s) = card s

Next tactic:
rw [← card_eq_sum_card_fiberwise Hf]
/-- If every element belongs to at most `n` Finsets, then the sum of their sizes is at most `n`
times how many they are. -/
theorem sum_card_inter_le (h : ∀ a ∈ s, (B.filter (a ∈ ·)).card ≤ n) :
    (∑ t in B, (s ∩ t).card) ≤ s.card * n := by
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝ : DecidableEq α
s : Finset α
B : Finset (Finset α)
n : ℕ
h : ∀ a ∈ s, card (filter (fun x => a ∈ x) B) ≤ n
⊢ ∑ t in B, card (s ∩ t) ≤ card s * n

Next tactic:
refine' le_trans _ (s.sum_le_card_nsmul _ _ h)
/-- If every element belongs to at most `n` Finsets, then the sum of their sizes is at most `n`
times how many they are. -/
theorem sum_card_inter_le (h : ∀ a ∈ s, (B.filter (a ∈ ·)).card ≤ n) :
    (∑ t in B, (s ∩ t).card) ≤ s.card * n := by
  refine' le_trans _ (s.sum_le_card_nsmul _ _ h)
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝ : DecidableEq α
s : Finset α
B : Finset (Finset α)
n : ℕ
h : ∀ a ∈ s, card (filter (fun x => a ∈ x) B) ≤ n
⊢ ∑ t in B, card (s ∩ t) ≤ ∑ x in s, card (filter (fun x_1 => x ∈ x_1) B)

Next tactic:
simp_rw [← filter_mem_eq_inter, card_eq_sum_ones, sum_filter]
/-- If every element belongs to at most `n` Finsets, then the sum of their sizes is at most `n`
times how many they are. -/
theorem sum_card_inter_le (h : ∀ a ∈ s, (B.filter (a ∈ ·)).card ≤ n) :
    (∑ t in B, (s ∩ t).card) ≤ s.card * n := by
  refine' le_trans _ (s.sum_le_card_nsmul _ _ h)
  simp_rw [← filter_mem_eq_inter, card_eq_sum_ones, sum_filter]
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝ : DecidableEq α
s : Finset α
B : Finset (Finset α)
n : ℕ
h : ∀ a ∈ s, card (filter (fun x => a ∈ x) B) ≤ n
⊢ (∑ x in B, ∑ a in s, if a ∈ x then 1 else 0) ≤ ∑ x in s, ∑ a in B, if x ∈ a then 1 else 0

Next tactic:
exact sum_comm.le
/-- If every element belongs to at most `n` Finsets, then the sum of their sizes is at most `n`
times how many they are. -/
theorem sum_card_le [Fintype α] (h : ∀ a, (B.filter (a ∈ ·)).card ≤ n) :
    ∑ s in B, s.card ≤ Fintype.card α * n :=
  calc
    ∑ s in B, s.card = ∑ s in B, (univ ∩ s).card := by 

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝¹ : DecidableEq α
s : Finset α
B : Finset (Finset α)
n : ℕ
inst✝ : Fintype α
h : ∀ (a : α), card (filter (fun x => a ∈ x) B) ≤ n
⊢ ∑ s in B, card s = ∑ s in B, card (univ ∩ s)

Next tactic:
simp_rw [univ_inter]
/-- If every element belongs to at least `n` Finsets, then the sum of their sizes is at least `n`
times how many they are. -/
theorem le_sum_card_inter (h : ∀ a ∈ s, n ≤ (B.filter (a ∈ ·)).card) :
    s.card * n ≤ ∑ t in B, (s ∩ t).card := by
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝ : DecidableEq α
s : Finset α
B : Finset (Finset α)
n : ℕ
h : ∀ a ∈ s, n ≤ card (filter (fun x => a ∈ x) B)
⊢ card s * n ≤ ∑ t in B, card (s ∩ t)

Next tactic:
apply (s.card_nsmul_le_sum _ _ h).trans
/-- If every element belongs to at least `n` Finsets, then the sum of their sizes is at least `n`
times how many they are. -/
theorem le_sum_card_inter (h : ∀ a ∈ s, n ≤ (B.filter (a ∈ ·)).card) :
    s.card * n ≤ ∑ t in B, (s ∩ t).card := by
  apply (s.card_nsmul_le_sum _ _ h).trans
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝ : DecidableEq α
s : Finset α
B : Finset (Finset α)
n : ℕ
h : ∀ a ∈ s, n ≤ card (filter (fun x => a ∈ x) B)
⊢ ∑ x in s, card (filter (fun x_1 => x ∈ x_1) B) ≤ ∑ t in B, card (s ∩ t)

Next tactic:
simp_rw [← filter_mem_eq_inter, card_eq_sum_ones, sum_filter]
/-- If every element belongs to at least `n` Finsets, then the sum of their sizes is at least `n`
times how many they are. -/
theorem le_sum_card_inter (h : ∀ a ∈ s, n ≤ (B.filter (a ∈ ·)).card) :
    s.card * n ≤ ∑ t in B, (s ∩ t).card := by
  apply (s.card_nsmul_le_sum _ _ h).trans
  simp_rw [← filter_mem_eq_inter, card_eq_sum_ones, sum_filter]
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝ : DecidableEq α
s : Finset α
B : Finset (Finset α)
n : ℕ
h : ∀ a ∈ s, n ≤ card (filter (fun x => a ∈ x) B)
⊢ (∑ x in s, ∑ a in B, if x ∈ a then 1 else 0) ≤ ∑ x in B, ∑ a in s, if a ∈ x then 1 else 0

Next tactic:
exact sum_comm.le
/-- If every element belongs to at least `n` Finsets, then the sum of their sizes is at least `n`
times how many they are. -/
theorem le_sum_card [Fintype α] (h : ∀ a, n ≤ (B.filter (a ∈ ·)).card) :
    Fintype.card α * n ≤ ∑ s in B, s.card :=
  calc
    Fintype.card α * n ≤ ∑ s in B, (univ ∩ s).card := le_sum_card_inter fun a _ ↦ h a
    _ = ∑ s in B, s.card := by 

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝¹ : DecidableEq α
s : Finset α
B : Finset (Finset α)
n : ℕ
inst✝ : Fintype α
h : ∀ (a : α), n ≤ card (filter (fun x => a ∈ x) B)
⊢ ∑ s in B, card (univ ∩ s) = ∑ s in B, card s

Next tactic:
simp_rw [univ_inter]
/-- If every element belongs to exactly `n` Finsets, then the sum of their sizes is `n` times how
many they are. -/
theorem sum_card [Fintype α] (h : ∀ a, (B.filter (a ∈ ·)).card = n) :
    ∑ s in B, s.card = Fintype.card α * n := by
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝¹ : DecidableEq α
s : Finset α
B : Finset (Finset α)
n : ℕ
inst✝ : Fintype α
h : ∀ (a : α), card (filter (fun x => a ∈ x) B) = n
⊢ ∑ s in B, card s = Fintype.card α * n

Next tactic:
simp_rw [Fintype.card, ← sum_card_inter fun a _ ↦ h a, univ_inter]
theorem card_le_card_biUnion {s : Finset ι} {f : ι → Finset α} (hs : (s : Set ι).PairwiseDisjoint f)
    (hf : ∀ i ∈ s, (f i).Nonempty) : s.card ≤ (s.biUnion f).card := by
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝ : DecidableEq α
s✝ : Finset α
B : Finset (Finset α)
n : ℕ
s : Finset ι
f : ι → Finset α
hs : Set.PairwiseDisjoint (↑s) f
hf : ∀ i ∈ s, Finset.Nonempty (f i)
⊢ card s ≤ card (Finset.biUnion s f)

Next tactic:
rw [card_biUnion hs, card_eq_sum_ones]
theorem card_le_card_biUnion {s : Finset ι} {f : ι → Finset α} (hs : (s : Set ι).PairwiseDisjoint f)
    (hf : ∀ i ∈ s, (f i).Nonempty) : s.card ≤ (s.biUnion f).card := by
  rw [card_biUnion hs, card_eq_sum_ones]
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝ : DecidableEq α
s✝ : Finset α
B : Finset (Finset α)
n : ℕ
s : Finset ι
f : ι → Finset α
hs : Set.PairwiseDisjoint (↑s) f
hf : ∀ i ∈ s, Finset.Nonempty (f i)
⊢ ∑ x in s, 1 ≤ ∑ u in s, card (f u)

Next tactic:
exact sum_le_sum fun i hi ↦ (hf i hi).card_pos
theorem card_le_card_biUnion_add_card_fiber {s : Finset ι} {f : ι → Finset α}
    (hs : (s : Set ι).PairwiseDisjoint f) :
    s.card ≤ (s.biUnion f).card + (s.filter fun i ↦ f i = ∅).card := by
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝ : DecidableEq α
s✝ : Finset α
B : Finset (Finset α)
n : ℕ
s : Finset ι
f : ι → Finset α
hs : Set.PairwiseDisjoint (↑s) f
⊢ card s ≤ card (Finset.biUnion s f) + card (filter (fun i => f i = ∅) s)

Next tactic:
rw [← Finset.filter_card_add_filter_neg_card_eq_card fun i ↦ f i = ∅, add_comm]
theorem card_le_card_biUnion_add_card_fiber {s : Finset ι} {f : ι → Finset α}
    (hs : (s : Set ι).PairwiseDisjoint f) :
    s.card ≤ (s.biUnion f).card + (s.filter fun i ↦ f i = ∅).card := by
  rw [← Finset.filter_card_add_filter_neg_card_eq_card fun i ↦ f i = ∅, add_comm]
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝ : DecidableEq α
s✝ : Finset α
B : Finset (Finset α)
n : ℕ
s : Finset ι
f : ι → Finset α
hs : Set.PairwiseDisjoint (↑s) f
⊢ card (filter (fun a => ¬f a = ∅) s) + card (filter (fun i => f i = ∅) s) ≤
    card (Finset.biUnion s f) + card (filter (fun i => f i = ∅) s)

Next tactic:
exact
    add_le_add_right
      ((card_le_card_biUnion (hs.subset <| filter_subset _ _) fun i hi ↦
            nonempty_of_ne_empty <| (mem_filter.1 hi).2).trans <|
        card_le_of_subset <| biUnion_subset_biUnion_of_subset_left _ <| filter_subset _ _)
      _
@[to_additive sum_le_sum_of_ne_zero]
theorem prod_le_prod_of_ne_one' (h : ∀ x ∈ s, f x ≠ 1 → x ∈ t) :
    ∏ x in s, f x ≤ ∏ x in t, f x := by
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝ : CanonicallyOrderedCommMonoid M
f : ι → M
s t : Finset ι
h : ∀ x ∈ s, f x ≠ 1 → x ∈ t
⊢ ∏ x in s, f x ≤ ∏ x in t, f x

Next tactic:
classical calc
    ∏ x in s, f x = (∏ x in s.filter fun x ↦ f x = 1, f x) *
        ∏ x in s.filter fun x ↦ f x ≠ 1, f x := by
      rw [← prod_union, filter_union_filter_neg_eq]
      exact disjoint_filter.2 fun _ _ h n_h ↦ n_h h
    _ ≤ ∏ x in t, f x :=
      mul_le_of_le_one_of_le
        (prod_le_one' <| by simp only [mem_filter, and_imp]; exact fun _ _ ↦ le_of_eq)
        (prod_le_prod_of_subset' <| by simpa only [subset_iff, mem_filter, and_imp] )
@[to_additive sum_le_sum_of_ne_zero]
theorem prod_le_prod_of_ne_one' (h : ∀ x ∈ s, f x ≠ 1 → x ∈ t) :
    ∏ x in s, f x ≤ ∏ x in t, f x := by
  classical 

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝ : CanonicallyOrderedCommMonoid M
f : ι → M
s t : Finset ι
h : ∀ x ∈ s, f x ≠ 1 → x ∈ t
⊢ ∏ x in s, f x ≤ ∏ x in t, f x

Next tactic:
calc
    ∏ x in s, f x = (∏ x in s.filter fun x ↦ f x = 1, f x) *
        ∏ x in s.filter fun x ↦ f x ≠ 1, f x := by
      rw [← prod_union, filter_union_filter_neg_eq]
      exact disjoint_filter.2 fun _ _ h n_h ↦ n_h h
    _ ≤ ∏ x in t, f x :=
      mul_le_of_le_one_of_le
        (prod_le_one' <| by simp only [mem_filter, and_imp]; exact fun _ _ ↦ le_of_eq)
        (prod_le_prod_of_subset' <| by simpa only [subset_iff, mem_filter, and_imp] )
@[to_additive sum_le_sum_of_ne_zero]
theorem prod_le_prod_of_ne_one' (h : ∀ x ∈ s, f x ≠ 1 → x ∈ t) :
    ∏ x in s, f x ≤ ∏ x in t, f x := by
  classical calc
    ∏ x in s, f x = (∏ x in s.filter fun x ↦ f x = 1, f x) *
        ∏ x in s.filter fun x ↦ f x ≠ 1, f x := by
      

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝ : CanonicallyOrderedCommMonoid M
f : ι → M
s t : Finset ι
h : ∀ x ∈ s, f x ≠ 1 → x ∈ t
⊢ ∏ x in s, f x = (∏ x in filter (fun x => f x = 1) s, f x) * ∏ x in filter (fun x => f x ≠ 1) s, f x

Next tactic:
rw [← prod_union, filter_union_filter_neg_eq]
@[to_additive sum_le_sum_of_ne_zero]
theorem prod_le_prod_of_ne_one' (h : ∀ x ∈ s, f x ≠ 1 → x ∈ t) :
    ∏ x in s, f x ≤ ∏ x in t, f x := by
  classical calc
    ∏ x in s, f x = (∏ x in s.filter fun x ↦ f x = 1, f x) *
        ∏ x in s.filter fun x ↦ f x ≠ 1, f x := by
      rw [← prod_union, filter_union_filter_neg_eq]
      

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝ : CanonicallyOrderedCommMonoid M
f : ι → M
s t : Finset ι
h : ∀ x ∈ s, f x ≠ 1 → x ∈ t
⊢ Disjoint (filter (fun x => f x = 1) s) (filter (fun x => f x ≠ 1) s)

Next tactic:
exact disjoint_filter.2 fun _ _ h n_h ↦ n_h h
@[to_additive sum_le_sum_of_ne_zero]
theorem prod_le_prod_of_ne_one' (h : ∀ x ∈ s, f x ≠ 1 → x ∈ t) :
    ∏ x in s, f x ≤ ∏ x in t, f x := by
  classical calc
    ∏ x in s, f x = (∏ x in s.filter fun x ↦ f x = 1, f x) *
        ∏ x in s.filter fun x ↦ f x ≠ 1, f x := by
      rw [← prod_union, filter_union_filter_neg_eq]
      exact disjoint_filter.2 fun _ _ h n_h ↦ n_h h
    _ ≤ ∏ x in t, f x :=
      mul_le_of_le_one_of_le
        (prod_le_one' <| by 

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝ : CanonicallyOrderedCommMonoid M
f : ι → M
s t : Finset ι
h : ∀ x ∈ s, f x ≠ 1 → x ∈ t
⊢ ∀ i ∈ filter (fun x => f x = 1) s, f i ≤ 1

Next tactic:
simp only [mem_filter, and_imp]
@[to_additive sum_le_sum_of_ne_zero]
theorem prod_le_prod_of_ne_one' (h : ∀ x ∈ s, f x ≠ 1 → x ∈ t) :
    ∏ x in s, f x ≤ ∏ x in t, f x := by
  classical calc
    ∏ x in s, f x = (∏ x in s.filter fun x ↦ f x = 1, f x) *
        ∏ x in s.filter fun x ↦ f x ≠ 1, f x := by
      rw [← prod_union, filter_union_filter_neg_eq]
      exact disjoint_filter.2 fun _ _ h n_h ↦ n_h h
    _ ≤ ∏ x in t, f x :=
      mul_le_of_le_one_of_le
        (prod_le_one' <| by simp only [mem_filter, and_imp]; 

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝ : CanonicallyOrderedCommMonoid M
f : ι → M
s t : Finset ι
h : ∀ x ∈ s, f x ≠ 1 → x ∈ t
⊢ ∀ i ∈ s, f i = 1 → f i ≤ 1

Next tactic:
exact fun _ _ ↦ le_of_eq
@[to_additive sum_le_sum_of_ne_zero]
theorem prod_le_prod_of_ne_one' (h : ∀ x ∈ s, f x ≠ 1 → x ∈ t) :
    ∏ x in s, f x ≤ ∏ x in t, f x := by
  classical calc
    ∏ x in s, f x = (∏ x in s.filter fun x ↦ f x = 1, f x) *
        ∏ x in s.filter fun x ↦ f x ≠ 1, f x := by
      rw [← prod_union, filter_union_filter_neg_eq]
      exact disjoint_filter.2 fun _ _ h n_h ↦ n_h h
    _ ≤ ∏ x in t, f x :=
      mul_le_of_le_one_of_le
        (prod_le_one' <| by simp only [mem_filter, and_imp]; exact fun _ _ ↦ le_of_eq)
        (prod_le_prod_of_subset' <| by 

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝ : CanonicallyOrderedCommMonoid M
f : ι → M
s t : Finset ι
h : ∀ x ∈ s, f x ≠ 1 → x ∈ t
⊢ filter (fun x => f x ≠ 1) s ⊆ t

Next tactic:
simpa only [subset_iff, mem_filter, and_imp]
@[to_additive sum_lt_sum_of_nonempty]
theorem prod_lt_prod_of_nonempty' (hs : s.Nonempty) (hlt : ∀ i ∈ s, f i < g i) :
    ∏ i in s, f i < ∏ i in s, g i :=
  Multiset.prod_lt_prod_of_nonempty' (by 

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝ : OrderedCancelCommMonoid M
f g : ι → M
s t : Finset ι
hs : Finset.Nonempty s
hlt : ∀ i ∈ s, f i < g i
⊢ s.val ≠ ∅

Next tactic:
aesop
@[to_additive sum_lt_sum_of_subset]
theorem prod_lt_prod_of_subset' (h : s ⊆ t) {i : ι} (ht : i ∈ t) (hs : i ∉ s) (hlt : 1 < f i)
    (hle : ∀ j ∈ t, j ∉ s → 1 ≤ f j) : ∏ j in s, f j < ∏ j in t, f j := by
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝ : OrderedCancelCommMonoid M
f g : ι → M
s t : Finset ι
h : s ⊆ t
i : ι
ht : i ∈ t
hs : i ∉ s
hlt : 1 < f i
hle : ∀ j ∈ t, j ∉ s → 1 ≤ f j
⊢ ∏ j in s, f j < ∏ j in t, f j

Next tactic:
classical calc
    ∏ j in s, f j < ∏ j in insert i s, f j := by
      rw [prod_insert hs]
      exact lt_mul_of_one_lt_left' (∏ j in s, f j) hlt
    _ ≤ ∏ j in t, f j := by
      apply prod_le_prod_of_subset_of_one_le'
      · simp [Finset.insert_subset_iff, h, ht]
      · intro x hx h'x
        simp only [mem_insert, not_or] at h'x
        exact hle x hx h'x.2
@[to_additive sum_lt_sum_of_subset]
theorem prod_lt_prod_of_subset' (h : s ⊆ t) {i : ι} (ht : i ∈ t) (hs : i ∉ s) (hlt : 1 < f i)
    (hle : ∀ j ∈ t, j ∉ s → 1 ≤ f j) : ∏ j in s, f j < ∏ j in t, f j := by
  classical 

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝ : OrderedCancelCommMonoid M
f g : ι → M
s t : Finset ι
h : s ⊆ t
i : ι
ht : i ∈ t
hs : i ∉ s
hlt : 1 < f i
hle : ∀ j ∈ t, j ∉ s → 1 ≤ f j
⊢ ∏ j in s, f j < ∏ j in t, f j

Next tactic:
calc
    ∏ j in s, f j < ∏ j in insert i s, f j := by
      rw [prod_insert hs]
      exact lt_mul_of_one_lt_left' (∏ j in s, f j) hlt
    _ ≤ ∏ j in t, f j := by
      apply prod_le_prod_of_subset_of_one_le'
      · simp [Finset.insert_subset_iff, h, ht]
      · intro x hx h'x
        simp only [mem_insert, not_or] at h'x
        exact hle x hx h'x.2
@[to_additive sum_lt_sum_of_subset]
theorem prod_lt_prod_of_subset' (h : s ⊆ t) {i : ι} (ht : i ∈ t) (hs : i ∉ s) (hlt : 1 < f i)
    (hle : ∀ j ∈ t, j ∉ s → 1 ≤ f j) : ∏ j in s, f j < ∏ j in t, f j := by
  classical calc
    ∏ j in s, f j < ∏ j in insert i s, f j := by
      

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝ : OrderedCancelCommMonoid M
f g : ι → M
s t : Finset ι
h : s ⊆ t
i : ι
ht : i ∈ t
hs : i ∉ s
hlt : 1 < f i
hle : ∀ j ∈ t, j ∉ s → 1 ≤ f j
⊢ ∏ j in s, f j < ∏ j in insert i s, f j

Next tactic:
rw [prod_insert hs]
@[to_additive sum_lt_sum_of_subset]
theorem prod_lt_prod_of_subset' (h : s ⊆ t) {i : ι} (ht : i ∈ t) (hs : i ∉ s) (hlt : 1 < f i)
    (hle : ∀ j ∈ t, j ∉ s → 1 ≤ f j) : ∏ j in s, f j < ∏ j in t, f j := by
  classical calc
    ∏ j in s, f j < ∏ j in insert i s, f j := by
      rw [prod_insert hs]
      

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝ : OrderedCancelCommMonoid M
f g : ι → M
s t : Finset ι
h : s ⊆ t
i : ι
ht : i ∈ t
hs : i ∉ s
hlt : 1 < f i
hle : ∀ j ∈ t, j ∉ s → 1 ≤ f j
⊢ ∏ j in s, f j < f i * ∏ x in s, f x

Next tactic:
exact lt_mul_of_one_lt_left' (∏ j in s, f j) hlt
@[to_additive sum_lt_sum_of_subset]
theorem prod_lt_prod_of_subset' (h : s ⊆ t) {i : ι} (ht : i ∈ t) (hs : i ∉ s) (hlt : 1 < f i)
    (hle : ∀ j ∈ t, j ∉ s → 1 ≤ f j) : ∏ j in s, f j < ∏ j in t, f j := by
  classical calc
    ∏ j in s, f j < ∏ j in insert i s, f j := by
      rw [prod_insert hs]
      exact lt_mul_of_one_lt_left' (∏ j in s, f j) hlt
    _ ≤ ∏ j in t, f j := by
      

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝ : OrderedCancelCommMonoid M
f g : ι → M
s t : Finset ι
h : s ⊆ t
i : ι
ht : i ∈ t
hs : i ∉ s
hlt : 1 < f i
hle : ∀ j ∈ t, j ∉ s → 1 ≤ f j
⊢ ∏ j in insert i s, f j ≤ ∏ j in t, f j

Next tactic:
apply prod_le_prod_of_subset_of_one_le'
@[to_additive sum_lt_sum_of_subset]
theorem prod_lt_prod_of_subset' (h : s ⊆ t) {i : ι} (ht : i ∈ t) (hs : i ∉ s) (hlt : 1 < f i)
    (hle : ∀ j ∈ t, j ∉ s → 1 ≤ f j) : ∏ j in s, f j < ∏ j in t, f j := by
  classical calc
    ∏ j in s, f j < ∏ j in insert i s, f j := by
      rw [prod_insert hs]
      exact lt_mul_of_one_lt_left' (∏ j in s, f j) hlt
    _ ≤ ∏ j in t, f j := by
      apply prod_le_prod_of_subset_of_one_le'
      · 

Proof state:
case h
ι : Type u_1
α : Type u_2
β : Type u_3
M : Type u_4
N : Type u_5
G : Type u_6
k : Type u_7
R : Type u_8
inst✝ : OrderedCancelCommMonoid M
f g : ι → M
s t : Finset ι
h : s ⊆ t
i : ι
ht : i ∈ t
hs : i ∉ s
hlt : 1 < f i
hle : ∀ j ∈ t, j ∉ s → 1 ≤ f j
⊢ insert i s ⊆ t

Next tactic:
simp [Finset.insert_subset_iff, h, ht]