l3lab/ntp-mathlib huggingface dataset:
@[to_additive (attr := simp)]
theorem prod_toMultiset [CommMonoid α] (f : α →₀ ℕ) :
    f.toMultiset.prod = f.prod fun a n => a ^ n := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : CommMonoid α
f : α →₀ ℕ
⊢ Multiset.prod (toMultiset f) = prod f fun a n => a ^ n

Next tactic:
refine' f.induction _ _
@[to_additive (attr := simp)]
theorem prod_toMultiset [CommMonoid α] (f : α →₀ ℕ) :
    f.toMultiset.prod = f.prod fun a n => a ^ n := by
  refine' f.induction _ _
  · 

Proof state:
case refine'_1
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : CommMonoid α
f : α →₀ ℕ
⊢ Multiset.prod (toMultiset 0) = prod 0 fun a n => a ^ n

Next tactic:
rw [toMultiset_zero, Multiset.prod_zero, Finsupp.prod_zero_index]
@[to_additive (attr := simp)]
theorem prod_toMultiset [CommMonoid α] (f : α →₀ ℕ) :
    f.toMultiset.prod = f.prod fun a n => a ^ n := by
  refine' f.induction _ _
  · rw [toMultiset_zero, Multiset.prod_zero, Finsupp.prod_zero_index]
  · 

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : CommMonoid α
f : α →₀ ℕ
⊢ ∀ (a : α) (b : ℕ) (f : α →₀ ℕ),
    a ∉ f.support →
      b ≠ 0 →
        (Multiset.prod (toMultiset f) = prod f fun a n => a ^ n) →
          Multiset.prod (toMultiset ((fun₀ | a => b) + f)) = prod ((fun₀ | a => b) + f) fun a n => a ^ n

Next tactic:
intro a n f _ _ ih
@[to_additive (attr := simp)]
theorem prod_toMultiset [CommMonoid α] (f : α →₀ ℕ) :
    f.toMultiset.prod = f.prod fun a n => a ^ n := by
  refine' f.induction _ _
  · rw [toMultiset_zero, Multiset.prod_zero, Finsupp.prod_zero_index]
  · intro a n f _ _ ih
    

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : CommMonoid α
f✝ : α →₀ ℕ
a : α
n : ℕ
f : α →₀ ℕ
a✝¹ : a ∉ f.support
a✝ : n ≠ 0
ih : Multiset.prod (toMultiset f) = prod f fun a n => a ^ n
⊢ Multiset.prod (toMultiset ((fun₀ | a => n) + f)) = prod ((fun₀ | a => n) + f) fun a n => a ^ n

Next tactic:
rw [toMultiset_add, Multiset.prod_add, ih, toMultiset_single, Multiset.prod_nsmul,
      Finsupp.prod_add_index' pow_zero pow_add, Finsupp.prod_single_index, Multiset.prod_singleton]
@[to_additive (attr := simp)]
theorem prod_toMultiset [CommMonoid α] (f : α →₀ ℕ) :
    f.toMultiset.prod = f.prod fun a n => a ^ n := by
  refine' f.induction _ _
  · rw [toMultiset_zero, Multiset.prod_zero, Finsupp.prod_zero_index]
  · intro a n f _ _ ih
    rw [toMultiset_add, Multiset.prod_add, ih, toMultiset_single, Multiset.prod_nsmul,
      Finsupp.prod_add_index' pow_zero pow_add, Finsupp.prod_single_index, Multiset.prod_singleton]
    · 

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : CommMonoid α
f✝ : α →₀ ℕ
a : α
n : ℕ
f : α →₀ ℕ
a✝¹ : a ∉ f.support
a✝ : n ≠ 0
ih : Multiset.prod (toMultiset f) = prod f fun a n => a ^ n
⊢ a ^ 0 = 1

Next tactic:
exact pow_zero a
@[simp]
theorem toFinset_toMultiset [DecidableEq α] (f : α →₀ ℕ) : f.toMultiset.toFinset = f.support := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : DecidableEq α
f : α →₀ ℕ
⊢ Multiset.toFinset (toMultiset f) = f.support

Next tactic:
refine' f.induction _ _
@[simp]
theorem toFinset_toMultiset [DecidableEq α] (f : α →₀ ℕ) : f.toMultiset.toFinset = f.support := by
  refine' f.induction _ _
  · 

Proof state:
case refine'_1
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : DecidableEq α
f : α →₀ ℕ
⊢ Multiset.toFinset (toMultiset 0) = 0.support

Next tactic:
rw [toMultiset_zero, Multiset.toFinset_zero, support_zero]
@[simp]
theorem toFinset_toMultiset [DecidableEq α] (f : α →₀ ℕ) : f.toMultiset.toFinset = f.support := by
  refine' f.induction _ _
  · rw [toMultiset_zero, Multiset.toFinset_zero, support_zero]
  · 

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : DecidableEq α
f : α →₀ ℕ
⊢ ∀ (a : α) (b : ℕ) (f : α →₀ ℕ),
    a ∉ f.support →
      b ≠ 0 →
        Multiset.toFinset (toMultiset f) = f.support →
          Multiset.toFinset (toMultiset ((fun₀ | a => b) + f)) = ((fun₀ | a => b) + f).support

Next tactic:
intro a n f ha hn ih
@[simp]
theorem toFinset_toMultiset [DecidableEq α] (f : α →₀ ℕ) : f.toMultiset.toFinset = f.support := by
  refine' f.induction _ _
  · rw [toMultiset_zero, Multiset.toFinset_zero, support_zero]
  · intro a n f ha hn ih
    

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : DecidableEq α
f✝ : α →₀ ℕ
a : α
n : ℕ
f : α →₀ ℕ
ha : a ∉ f.support
hn : n ≠ 0
ih : Multiset.toFinset (toMultiset f) = f.support
⊢ Multiset.toFinset (toMultiset ((fun₀ | a => n) + f)) = ((fun₀ | a => n) + f).support

Next tactic:
rw [toMultiset_add, Multiset.toFinset_add, ih, toMultiset_single, support_add_eq,
      support_single_ne_zero _ hn, Multiset.toFinset_nsmul _ _ hn, Multiset.toFinset_singleton]
@[simp]
theorem toFinset_toMultiset [DecidableEq α] (f : α →₀ ℕ) : f.toMultiset.toFinset = f.support := by
  refine' f.induction _ _
  · rw [toMultiset_zero, Multiset.toFinset_zero, support_zero]
  · intro a n f ha hn ih
    rw [toMultiset_add, Multiset.toFinset_add, ih, toMultiset_single, support_add_eq,
      support_single_ne_zero _ hn, Multiset.toFinset_nsmul _ _ hn, Multiset.toFinset_singleton]
    

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : DecidableEq α
f✝ : α →₀ ℕ
a : α
n : ℕ
f : α →₀ ℕ
ha : a ∉ f.support
hn : n ≠ 0
ih : Multiset.toFinset (toMultiset f) = f.support
⊢ Disjoint (fun₀ | a => n).support f.support

Next tactic:
refine' Disjoint.mono_left support_single_subset _
@[simp]
theorem toFinset_toMultiset [DecidableEq α] (f : α →₀ ℕ) : f.toMultiset.toFinset = f.support := by
  refine' f.induction _ _
  · rw [toMultiset_zero, Multiset.toFinset_zero, support_zero]
  · intro a n f ha hn ih
    rw [toMultiset_add, Multiset.toFinset_add, ih, toMultiset_single, support_add_eq,
      support_single_ne_zero _ hn, Multiset.toFinset_nsmul _ _ hn, Multiset.toFinset_singleton]
    refine' Disjoint.mono_left support_single_subset _
    

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : DecidableEq α
f✝ : α →₀ ℕ
a : α
n : ℕ
f : α →₀ ℕ
ha : a ∉ f.support
hn : n ≠ 0
ih : Multiset.toFinset (toMultiset f) = f.support
⊢ Disjoint {a} f.support

Next tactic:
rwa [Finset.disjoint_singleton_left]
@[simp]
theorem count_toMultiset [DecidableEq α] (f : α →₀ ℕ) (a : α) : (toMultiset f).count a = f a :=
  calc
    (toMultiset f).count a = Finsupp.sum f (fun x n => (n • {x} : Multiset α).count a) :=
      by 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : DecidableEq α
f : α →₀ ℕ
a : α
⊢ Multiset.count a (toMultiset f) = sum f fun x n => Multiset.count a (n • {x})

Next tactic:
rw [toMultiset_apply]
@[simp]
theorem count_toMultiset [DecidableEq α] (f : α →₀ ℕ) (a : α) : (toMultiset f).count a = f a :=
  calc
    (toMultiset f).count a = Finsupp.sum f (fun x n => (n • {x} : Multiset α).count a) :=
      by rw [toMultiset_apply]; 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : DecidableEq α
f : α →₀ ℕ
a : α
⊢ Multiset.count a (sum f fun a n => n • {a}) = sum f fun x n => Multiset.count a (n • {x})

Next tactic:
exact map_sum (Multiset.countAddMonoidHom a) _ f.support
@[simp]
theorem count_toMultiset [DecidableEq α] (f : α →₀ ℕ) (a : α) : (toMultiset f).count a = f a :=
  calc
    (toMultiset f).count a = Finsupp.sum f (fun x n => (n • {x} : Multiset α).count a) :=
      by rw [toMultiset_apply]; exact map_sum (Multiset.countAddMonoidHom a) _ f.support
    _ = f.sum fun x n => n * ({x} : Multiset α).count a := by 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : DecidableEq α
f : α →₀ ℕ
a : α
⊢ (sum f fun x n => Multiset.count a (n • {x})) = sum f fun x n => n * Multiset.count a {x}

Next tactic:
simp only [Multiset.count_nsmul]
@[simp]
theorem count_toMultiset [DecidableEq α] (f : α →₀ ℕ) (a : α) : (toMultiset f).count a = f a :=
  calc
    (toMultiset f).count a = Finsupp.sum f (fun x n => (n • {x} : Multiset α).count a) :=
      by rw [toMultiset_apply]; exact map_sum (Multiset.countAddMonoidHom a) _ f.support
    _ = f.sum fun x n => n * ({x} : Multiset α).count a := by simp only [Multiset.count_nsmul]
    _ = f a * ({a} : Multiset α).count a :=
      sum_eq_single _
        (fun a' _ H => by 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : DecidableEq α
f : α →₀ ℕ
a a' : α
x✝ : f a' ≠ 0
H : a' ≠ a
⊢ f a' * Multiset.count a {a'} = 0

Next tactic:
simp only [Multiset.count_singleton, if_false, H.symm, mul_zero]
@[simp]
theorem count_toMultiset [DecidableEq α] (f : α →₀ ℕ) (a : α) : (toMultiset f).count a = f a :=
  calc
    (toMultiset f).count a = Finsupp.sum f (fun x n => (n • {x} : Multiset α).count a) :=
      by rw [toMultiset_apply]; exact map_sum (Multiset.countAddMonoidHom a) _ f.support
    _ = f.sum fun x n => n * ({x} : Multiset α).count a := by simp only [Multiset.count_nsmul]
    _ = f a * ({a} : Multiset α).count a :=
      sum_eq_single _
        (fun a' _ H => by simp only [Multiset.count_singleton, if_false, H.symm, mul_zero])
        (fun _ => zero_mul _)
    _ = f a := by 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : DecidableEq α
f : α →₀ ℕ
a : α
⊢ f a * Multiset.count a {a} = f a

Next tactic:
rw [Multiset.count_singleton_self, mul_one]
theorem toMultiset_sup [DecidableEq α] (f g : α →₀ ℕ) :
    toMultiset (f ⊔ g) = toMultiset f ∪ toMultiset g := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : DecidableEq α
f g : α →₀ ℕ
⊢ toMultiset (f ⊔ g) = toMultiset f ∪ toMultiset g

Next tactic:
ext
theorem toMultiset_sup [DecidableEq α] (f g : α →₀ ℕ) :
    toMultiset (f ⊔ g) = toMultiset f ∪ toMultiset g := by
  ext
  

Proof state:
case a
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : DecidableEq α
f g : α →₀ ℕ
a✝ : α
⊢ Multiset.count a✝ (toMultiset (f ⊔ g)) = Multiset.count a✝ (toMultiset f ∪ toMultiset g)

Next tactic:
simp_rw [Multiset.count_union, Finsupp.count_toMultiset, Finsupp.sup_apply, sup_eq_max]
theorem toMultiset_inf [DecidableEq α] (f g : α →₀ ℕ) :
    toMultiset (f ⊓ g) = toMultiset f ∩ toMultiset g := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : DecidableEq α
f g : α →₀ ℕ
⊢ toMultiset (f ⊓ g) = toMultiset f ∩ toMultiset g

Next tactic:
ext
theorem toMultiset_inf [DecidableEq α] (f g : α →₀ ℕ) :
    toMultiset (f ⊓ g) = toMultiset f ∩ toMultiset g := by
  ext
  

Proof state:
case a
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : DecidableEq α
f g : α →₀ ℕ
a✝ : α
⊢ Multiset.count a✝ (toMultiset (f ⊓ g)) = Multiset.count a✝ (toMultiset f ∩ toMultiset g)

Next tactic:
simp_rw [Multiset.count_inter, Finsupp.count_toMultiset, Finsupp.inf_apply, inf_eq_min]
@[simp]
theorem mem_toMultiset (f : α →₀ ℕ) (i : α) : i ∈ toMultiset f ↔ i ∈ f.support := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
f : α →₀ ℕ
i : α
⊢ i ∈ toMultiset f ↔ i ∈ f.support

Next tactic:
classical
  rw [← Multiset.count_ne_zero, Finsupp.count_toMultiset, Finsupp.mem_support_iff]
@[simp]
theorem mem_toMultiset (f : α →₀ ℕ) (i : α) : i ∈ toMultiset f ↔ i ∈ f.support := by
  classical
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
f : α →₀ ℕ
i : α
⊢ i ∈ toMultiset f ↔ i ∈ f.support

Next tactic:
rw [← Multiset.count_ne_zero, Finsupp.count_toMultiset, Finsupp.mem_support_iff]
/-- Given a multiset `s`, `s.toFinsupp` returns the finitely supported function on `ℕ` given by
the multiplicities of the elements of `s`. -/
@[simps symm_apply]
def toFinsupp : Multiset α ≃+ (α →₀ ℕ) where
  toFun s := ⟨s.toFinset, fun a => s.count a, fun a => by 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : DecidableEq α
s : Multiset α
a : α
⊢ a ∈ toFinset s ↔ (fun a => count a s) a ≠ 0

Next tactic:
simp
/-- Given a multiset `s`, `s.toFinsupp` returns the finitely supported function on `ℕ` given by
the multiplicities of the elements of `s`. -/
@[simps symm_apply]
def toFinsupp : Multiset α ≃+ (α →₀ ℕ) where
  toFun s := ⟨s.toFinset, fun a => s.count a, fun a => by simp⟩
  invFun f := Finsupp.toMultiset f
  map_add' s t := Finsupp.ext <| fun _ => count_add _ _ _
  right_inv f :=
    Finsupp.ext fun a => by
      simp only [Finsupp.toMultiset_apply, Finsupp.sum, Multiset.count_sum',
        Multiset.count_singleton, mul_boole, Finsupp.coe_mk, Finsupp.mem_support_iff,
        Multiset.count_nsmul, Finset.sum_ite_eq, ite_not, ite_eq_right_iff]
      exact Eq.symm
  left_inv s := by 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : DecidableEq α
s : Multiset α
⊢ (fun f => Finsupp.toMultiset f)
      ((fun s =>
          { support := toFinset s, toFun := fun a => count a s,
            mem_support_toFun := (_ : ∀ (a : α), a ∈ toFinset s ↔ ¬count a s = 0) })
        s) =
    s

Next tactic:
simp only [Finsupp.toMultiset_apply, Finsupp.sum, Finsupp.coe_mk,
    Multiset.toFinset_sum_count_nsmul_eq]
/-- Given a multiset `s`, `s.toFinsupp` returns the finitely supported function on `ℕ` given by
the multiplicities of the elements of `s`. -/
@[simps symm_apply]
def toFinsupp : Multiset α ≃+ (α →₀ ℕ) where
  toFun s := ⟨s.toFinset, fun a => s.count a, fun a => by simp⟩
  invFun f := Finsupp.toMultiset f
  map_add' s t := Finsupp.ext <| fun _ => count_add _ _ _
  right_inv f :=
    Finsupp.ext fun a => by
      

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : DecidableEq α
f : α →₀ ℕ
a : α
⊢ ((fun s =>
          { support := toFinset s, toFun := fun a => count a s,
            mem_support_toFun := (_ : ∀ (a : α), a ∈ toFinset s ↔ ¬count a s = 0) })
        ((fun f => Finsupp.toMultiset f) f))
      a =
    f a

Next tactic:
simp only [Finsupp.toMultiset_apply, Finsupp.sum, Multiset.count_sum',
        Multiset.count_singleton, mul_boole, Finsupp.coe_mk, Finsupp.mem_support_iff,
        Multiset.count_nsmul, Finset.sum_ite_eq, ite_not, ite_eq_right_iff]
/-- Given a multiset `s`, `s.toFinsupp` returns the finitely supported function on `ℕ` given by
the multiplicities of the elements of `s`. -/
@[simps symm_apply]
def toFinsupp : Multiset α ≃+ (α →₀ ℕ) where
  toFun s := ⟨s.toFinset, fun a => s.count a, fun a => by simp⟩
  invFun f := Finsupp.toMultiset f
  map_add' s t := Finsupp.ext <| fun _ => count_add _ _ _
  right_inv f :=
    Finsupp.ext fun a => by
      simp only [Finsupp.toMultiset_apply, Finsupp.sum, Multiset.count_sum',
        Multiset.count_singleton, mul_boole, Finsupp.coe_mk, Finsupp.mem_support_iff,
        Multiset.count_nsmul, Finset.sum_ite_eq, ite_not, ite_eq_right_iff]
      

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : DecidableEq α
f : α →₀ ℕ
a : α
⊢ f a = 0 → 0 = f a

Next tactic:
exact Eq.symm
@[simp]
theorem toFinsupp_singleton (a : α) : toFinsupp ({a} : Multiset α) = Finsupp.single a 1 :=
  by 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : DecidableEq α
a : α
⊢ toFinsupp {a} = fun₀ | a => 1

Next tactic:
ext
@[simp]
theorem toFinsupp_singleton (a : α) : toFinsupp ({a} : Multiset α) = Finsupp.single a 1 :=
  by ext; 

Proof state:
case h
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : DecidableEq α
a a✝ : α
⊢ (toFinsupp {a}) a✝ = (fun₀ | a => 1) a✝

Next tactic:
rw [toFinsupp_apply, count_singleton, Finsupp.single_eq_pi_single, Pi.single_apply]
theorem toFinsupp_union (s t : Multiset α) : toFinsupp (s ∪ t) = toFinsupp s ⊔ toFinsupp t := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : DecidableEq α
s t : Multiset α
⊢ toFinsupp (s ∪ t) = toFinsupp s ⊔ toFinsupp t

Next tactic:
ext
theorem toFinsupp_union (s t : Multiset α) : toFinsupp (s ∪ t) = toFinsupp s ⊔ toFinsupp t := by
  ext
  

Proof state:
case h
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : DecidableEq α
s t : Multiset α
a✝ : α
⊢ (toFinsupp (s ∪ t)) a✝ = (toFinsupp s ⊔ toFinsupp t) a✝

Next tactic:
simp [sup_eq_max]
theorem toFinsupp_inter (s t : Multiset α) : toFinsupp (s ∩ t) = toFinsupp s ⊓ toFinsupp t := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : DecidableEq α
s t : Multiset α
⊢ toFinsupp (s ∩ t) = toFinsupp s ⊓ toFinsupp t

Next tactic:
ext
theorem toFinsupp_inter (s t : Multiset α) : toFinsupp (s ∩ t) = toFinsupp s ⊓ toFinsupp t := by
  ext
  

Proof state:
case h
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : DecidableEq α
s t : Multiset α
a✝ : α
⊢ (toFinsupp (s ∩ t)) a✝ = (toFinsupp s ⊓ toFinsupp t) a✝

Next tactic:
simp [inf_eq_min]
/-- `Finsupp.toMultiset` as an order isomorphism. -/
def orderIsoMultiset [DecidableEq ι] : (ι →₀ ℕ) ≃o Multiset ι where
  toEquiv := Multiset.toFinsupp.symm.toEquiv
  map_rel_iff' {f g} := by 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
inst✝ : DecidableEq ι
f g : ι →₀ ℕ
⊢ (AddEquiv.symm Multiset.toFinsupp).toEquiv f ≤ (AddEquiv.symm Multiset.toFinsupp).toEquiv g ↔ f ≤ g

Next tactic:
simp [le_def, Multiset.le_iff_count]
theorem toMultiset_strictMono : StrictMono (@toMultiset ι) :=
  by 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
⊢ StrictMono ⇑toMultiset

Next tactic:
classical exact (@orderIsoMultiset ι _).strictMono
theorem toMultiset_strictMono : StrictMono (@toMultiset ι) :=
  by classical 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
⊢ StrictMono ⇑toMultiset

Next tactic:
exact (@orderIsoMultiset ι _).strictMono
theorem sum_id_lt_of_lt (m n : ι →₀ ℕ) (h : m < n) : (m.sum fun _ => id) < n.sum fun _ => id := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
m n : ι →₀ ℕ
h : m < n
⊢ (sum m fun x => id) < sum n fun x => id

Next tactic:
rw [← card_toMultiset, ← card_toMultiset]
theorem sum_id_lt_of_lt (m n : ι →₀ ℕ) (h : m < n) : (m.sum fun _ => id) < n.sum fun _ => id := by
  rw [← card_toMultiset, ← card_toMultiset]
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
m n : ι →₀ ℕ
h : m < n
⊢ Multiset.card (toMultiset m) < Multiset.card (toMultiset n)

Next tactic:
apply Multiset.card_lt_of_lt
theorem sum_id_lt_of_lt (m n : ι →₀ ℕ) (h : m < n) : (m.sum fun _ => id) < n.sum fun _ => id := by
  rw [← card_toMultiset, ← card_toMultiset]
  apply Multiset.card_lt_of_lt
  

Proof state:
case h
α : Type u_1
β : Type u_2
ι : Type u_3
m n : ι →₀ ℕ
h : m < n
⊢ toMultiset m < toMultiset n

Next tactic:
exact toMultiset_strictMono h
theorem to_affineMap_injective {f g : P →A[R] Q} (h : (f : P →ᵃ[R] Q) = (g : P →ᵃ[R] Q)) :
    f = g := by
  

Proof state:
R : Type u_1
V : Type u_2
W : Type u_3
P : Type u_4
Q : Type u_5
inst✝⁸ : Ring R
inst✝⁷ : AddCommGroup V
inst✝⁶ : Module R V
inst✝⁵ : TopologicalSpace P
inst✝⁴ : AddTorsor V P
inst✝³ : AddCommGroup W
inst✝² : Module R W
inst✝¹ : TopologicalSpace Q
inst✝ : AddTorsor W Q
f g : P →A[R] Q
h : f.toAffineMap = g.toAffineMap
⊢ f = g

Next tactic:
cases f
theorem to_affineMap_injective {f g : P →A[R] Q} (h : (f : P →ᵃ[R] Q) = (g : P →ᵃ[R] Q)) :
    f = g := by
  cases f
  

Proof state:
case mk
R : Type u_1
V : Type u_2
W : Type u_3
P : Type u_4
Q : Type u_5
inst✝⁸ : Ring R
inst✝⁷ : AddCommGroup V
inst✝⁶ : Module R V
inst✝⁵ : TopologicalSpace P
inst✝⁴ : AddTorsor V P
inst✝³ : AddCommGroup W
inst✝² : Module R W
inst✝¹ : TopologicalSpace Q
inst✝ : AddTorsor W Q
g : P →A[R] Q
toAffineMap✝ : P →ᵃ[R] Q
cont✝ : Continuous toAffineMap✝.toFun
h : { toAffineMap := toAffineMap✝, cont := cont✝ }.toAffineMap = g.toAffineMap
⊢ { toAffineMap := toAffineMap✝, cont := cont✝ } = g

Next tactic:
cases g
theorem to_affineMap_injective {f g : P →A[R] Q} (h : (f : P →ᵃ[R] Q) = (g : P →ᵃ[R] Q)) :
    f = g := by
  cases f
  cases g
  

Proof state:
case mk.mk
R : Type u_1
V : Type u_2
W : Type u_3
P : Type u_4
Q : Type u_5
inst✝⁸ : Ring R
inst✝⁷ : AddCommGroup V
inst✝⁶ : Module R V
inst✝⁵ : TopologicalSpace P
inst✝⁴ : AddTorsor V P
inst✝³ : AddCommGroup W
inst✝² : Module R W
inst✝¹ : TopologicalSpace Q
inst✝ : AddTorsor W Q
toAffineMap✝¹ : P →ᵃ[R] Q
cont✝¹ : Continuous toAffineMap✝¹.toFun
toAffineMap✝ : P →ᵃ[R] Q
cont✝ : Continuous toAffineMap✝.toFun
h :
  { toAffineMap := toAffineMap✝¹, cont := cont✝¹ }.toAffineMap =
    { toAffineMap := toAffineMap✝, cont := cont✝ }.toAffineMap
⊢ { toAffineMap := toAffineMap✝¹, cont := cont✝¹ } = { toAffineMap := toAffineMap✝, cont := cont✝ }

Next tactic:
congr
theorem to_continuousMap_injective {f g : P →A[R] Q} (h : (f : C(P, Q)) = (g : C(P, Q))) :
    f = g := by
  

Proof state:
R : Type u_1
V : Type u_2
W : Type u_3
P : Type u_4
Q : Type u_5
inst✝⁸ : Ring R
inst✝⁷ : AddCommGroup V
inst✝⁶ : Module R V
inst✝⁵ : TopologicalSpace P
inst✝⁴ : AddTorsor V P
inst✝³ : AddCommGroup W
inst✝² : Module R W
inst✝¹ : TopologicalSpace Q
inst✝ : AddTorsor W Q
f g : P →A[R] Q
h : ↑f = ↑g
⊢ f = g

Next tactic:
ext a
theorem to_continuousMap_injective {f g : P →A[R] Q} (h : (f : C(P, Q)) = (g : C(P, Q))) :
    f = g := by
  ext a
  

Proof state:
case h
R : Type u_1
V : Type u_2
W : Type u_3
P : Type u_4
Q : Type u_5
inst✝⁸ : Ring R
inst✝⁷ : AddCommGroup V
inst✝⁶ : Module R V
inst✝⁵ : TopologicalSpace P
inst✝⁴ : AddTorsor V P
inst✝³ : AddCommGroup W
inst✝² : Module R W
inst✝¹ : TopologicalSpace Q
inst✝ : AddTorsor W Q
f g : P →A[R] Q
h : ↑f = ↑g
a : P
⊢ f a = g a

Next tactic:
exact ContinuousMap.congr_fun h a
@[simp]
theorem mk_coe (f : P →A[R] Q) (h) : (⟨(f : P →ᵃ[R] Q), h⟩ : P →A[R] Q) = f := by
  

Proof state:
R : Type u_1
V : Type u_2
W : Type u_3
P : Type u_4
Q : Type u_5
inst✝⁸ : Ring R
inst✝⁷ : AddCommGroup V
inst✝⁶ : Module R V
inst✝⁵ : TopologicalSpace P
inst✝⁴ : AddTorsor V P
inst✝³ : AddCommGroup W
inst✝² : Module R W
inst✝¹ : TopologicalSpace Q
inst✝ : AddTorsor W Q
f : P →A[R] Q
h : Continuous f.toFun
⊢ { toAffineMap := f.toAffineMap, cont := h } = f

Next tactic:
ext
@[simp]
theorem mk_coe (f : P →A[R] Q) (h) : (⟨(f : P →ᵃ[R] Q), h⟩ : P →A[R] Q) = f := by
  ext
  

Proof state:
case h
R : Type u_1
V : Type u_2
W : Type u_3
P : Type u_4
Q : Type u_5
inst✝⁸ : Ring R
inst✝⁷ : AddCommGroup V
inst✝⁶ : Module R V
inst✝⁵ : TopologicalSpace P
inst✝⁴ : AddTorsor V P
inst✝³ : AddCommGroup W
inst✝² : Module R W
inst✝¹ : TopologicalSpace Q
inst✝ : AddTorsor W Q
f : P →A[R] Q
h : Continuous f.toFun
x✝ : P
⊢ { toAffineMap := f.toAffineMap, cont := h } x✝ = f x✝

Next tactic:
rfl
noncomputable instance : Inhabited (P →A[R] Q) :=
  ⟨const R P <| Nonempty.some (by 

Proof state:
R : Type u_1
V : Type u_2
W : Type u_3
P : Type u_4
Q : Type u_5
inst✝⁸ : Ring R
inst✝⁷ : AddCommGroup V
inst✝⁶ : Module R V
inst✝⁵ : TopologicalSpace P
inst✝⁴ : AddTorsor V P
inst✝³ : AddCommGroup W
inst✝² : Module R W
inst✝¹ : TopologicalSpace Q
inst✝ : AddTorsor W Q
⊢ Nonempty Q

Next tactic:
infer_instance
/-- A continuous linear map can be regarded as a continuous affine map. -/
def toContinuousAffineMap (f : V →L[R] W) : V →A[R] W where
  toFun := f
  linear := f
  map_vadd' := by 

Proof state:
R : Type u_1
V : Type u_2
W : Type u_3
inst✝⁶ : Ring R
inst✝⁵ : AddCommGroup V
inst✝⁴ : Module R V
inst✝³ : TopologicalSpace V
inst✝² : AddCommGroup W
inst✝¹ : Module R W
inst✝ : TopologicalSpace W
f : V →L[R] W
⊢ ∀ (p v : V), f (v +ᵥ p) = ↑f v +ᵥ f p

Next tactic:
simp
@[simp]
theorem toContinuousAffineMap_map_zero (f : V →L[R] W) : f.toContinuousAffineMap 0 = 0 := by 

Proof state:
R : Type u_1
V : Type u_2
W : Type u_3
inst✝⁶ : Ring R
inst✝⁵ : AddCommGroup V
inst✝⁴ : Module R V
inst✝³ : TopologicalSpace V
inst✝² : AddCommGroup W
inst✝¹ : Module R W
inst✝ : TopologicalSpace W
f : V →L[R] W
⊢ (toContinuousAffineMap f) 0 = 0

Next tactic:
simp
lemma Nat.AtLeastTwo.ne_zero (n : ℕ) [h : n.AtLeastTwo] : n ≠ 0 := by
  

Proof state:
n : ℕ
h : AtLeastTwo n
⊢ n ≠ 0

Next tactic:
rintro rfl
lemma Nat.AtLeastTwo.ne_zero (n : ℕ) [h : n.AtLeastTwo] : n ≠ 0 := by
  rintro rfl; 

Proof state:
h : AtLeastTwo 0
⊢ False

Next tactic:
exact absurd h.1 (by decide)
lemma Nat.AtLeastTwo.ne_zero (n : ℕ) [h : n.AtLeastTwo] : n ≠ 0 := by
  rintro rfl; exact absurd h.1 (by 

Proof state:
h : AtLeastTwo 0
⊢ ¬0 ≥ 2

Next tactic:
decide
lemma Nat.AtLeastTwo.ne_one (n : ℕ) [h : n.AtLeastTwo] : n ≠ 1 := by
  

Proof state:
n : ℕ
h : AtLeastTwo n
⊢ n ≠ 1

Next tactic:
rintro rfl
lemma Nat.AtLeastTwo.ne_one (n : ℕ) [h : n.AtLeastTwo] : n ≠ 1 := by
  rintro rfl; 

Proof state:
h : AtLeastTwo 1
⊢ False

Next tactic:
exact absurd h.1 (by decide)
lemma Nat.AtLeastTwo.ne_one (n : ℕ) [h : n.AtLeastTwo] : n ≠ 1 := by
  rintro rfl; exact absurd h.1 (by 

Proof state:
h : AtLeastTwo 1
⊢ ¬1 ≥ 2

Next tactic:
decide
@[simp, norm_cast]
theorem cast_ite (P : Prop) [Decidable P] (m n : ℕ) :
    ((ite P m n : ℕ) : R) = ite P (m : R) (n : R) := by
  

Proof state:
R : Type u_1
inst✝¹ : AddMonoidWithOne R
P : Prop
inst✝ : Decidable P
m n : ℕ
⊢ ↑(if P then m else n) = if P then ↑m else ↑n

Next tactic:
split_ifs