Definition of 0 and ::ₘ #
This file defines constructors for multisets:
Zero (Multiset α)instance: the empty multisetMultiset.cons: add one element to a multisetSingleton α (Multiset α)instance: multiset with one element
It also defines the following predicates on multisets:
Multiset.Rel:Rel r s tlifts the relationrbetween two elements to a relation betweensandt, s.t. there is a one-to-one mapping between elements insandtfollowingr.
Notation #
0: The empty multiset.{a}: The multiset containing a single occurrence ofa.a ::ₘ s: The multiset containing one more occurrence ofathansdoes.
Main results #
Multiset.rec: recursion on adding one element to a multiset at a time.
Empty multiset #
Equations
- Multiset.instZero = { zero := Multiset.zero }
Equations
- Multiset.instEmptyCollection = { emptyCollection := 0 }
Equations
- Multiset.inhabitedMultiset = { default := 0 }
Equations
- Multiset.instUniqueOfIsEmpty = { default := 0, uniq := ⋯ }
cons a s is the multiset which contains s plus one more instance of a.
Equations
- Multiset.«term_::ₘ_» = Lean.ParserDescr.trailingNode `Multiset.«term_::ₘ_» 67 68 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ::ₘ ") (Lean.ParserDescr.cat `term 67))
Instances For
Equations
- Multiset.instInsert = { insert := Multiset.cons }
def
Multiset.rec
{α : Type u_1}
{C : Multiset α → Sort u_3}
(C_0 : C 0)
(C_cons : (a : α) → (m : Multiset α) → C m → C (a ::ₘ m))
(C_cons_heq :
∀ (a a' : α) (m : Multiset α) (b : C m), C_cons a (a' ::ₘ m) (C_cons a' m b) ≍ C_cons a' (a ::ₘ m) (C_cons a m b))
(m : Multiset α)
:
C m
Dependent recursor on multisets.
TODO: should be @[recursor 6], but then the definition of Multiset.pi fails with a stack
overflow in whnf.
Equations
- Multiset.rec C_0 C_cons C_cons_heq m = Quotient.hrecOn m (List.rec C_0 fun (a : α) (l : List α) (b : C ⟦l⟧) => C_cons a ⟦l⟧ b) ⋯
Instances For
def
Multiset.recOn
{α : Type u_1}
{C : Multiset α → Sort u_3}
(m : Multiset α)
(C_0 : C 0)
(C_cons : (a : α) → (m : Multiset α) → C m → C (a ::ₘ m))
(C_cons_heq :
∀ (a a' : α) (m : Multiset α) (b : C m), C_cons a (a' ::ₘ m) (C_cons a' m b) ≍ C_cons a' (a ::ₘ m) (C_cons a m b))
:
C m
Companion to Multiset.rec with more convenient argument order.
Equations
- m.recOn C_0 C_cons C_cons_heq = Multiset.rec C_0 C_cons C_cons_heq m
Instances For
@[simp]
@[deprecated Multiset.notMem_zero (since := "2025-05-23")]
Alias of Multiset.notMem_zero.
@[deprecated Multiset.eq_zero_of_forall_notMem (since := "2025-05-23")]
Alias of Multiset.eq_zero_of_forall_notMem.
@[deprecated Multiset.eq_zero_iff_forall_notMem (since := "2025-05-23")]
Alias of Multiset.eq_zero_iff_forall_notMem.
Singleton #
Equations
- Multiset.instSingleton = { singleton := fun (a : α) => a ::ₘ 0 }
Equations
- Multiset.instOrderBot = { bot := 0, bot_le := ⋯ }
@[simp]
This is a rfl and simp version of bot_eq_zero.
Cardinality #
Map for partial functions #
Rel r s t -- lift the relation r between two elements to a relation between s and t,
s.t. there is a one-to-one mapping between elements in s and t following r.
- zero {α : Type u_1} {β : Type v} {r : α → β → Prop} : Rel r 0 0
- cons {α : Type u_1} {β : Type v} {r : α → β → Prop} {a : α} {b : β} {as : Multiset α} {bs : Multiset β} : r a b → Rel r as bs → Rel r (a ::ₘ as) (b ::ₘ bs)
Instances For
@[deprecated Multiset.Nodup.notMem (since := "2025-05-23")]
Alias of Multiset.Nodup.notMem.