# Multisets ```agda module trees.multisets where ``` <details><summary>Imports</summary> ```agda open import foundation.dependent-pair-types open import foundation.empty-types open import foundation.function-types open import foundation.universe-levels open import trees.elementhood-relation-w-types open import trees.w-types ``` </details> ## Idea The type of **multisets** of universe level `l` is the W-type of the universal family over the universe `UU l`. ## Definitions ### The type of small multisets ```agda š : (l : Level) ā UU (lsuc l) š l = š (UU l) (Ī» X ā X) ``` ### The large type of all multisets ```agda data Large-š : UUĻ where tree-Large-š : {l : Level} (X : UU l) ā (X ā Large-š) ā Large-š ``` ### The elementhood relation on multisets ```agda infix 6 _ā-š_ _ā-š_ _ā-š_ : {l : Level} ā š l ā š l ā UU (lsuc l) X ā-š Y = X ā-š Y _ā-š_ : {l : Level} ā š l ā š l ā UU (lsuc l) X ā-š Y = is-empty (X ā-š Y) ``` ### Comprehension for multisets ```agda comprehension-š : {l : Level} (X : š l) (P : shape-š X ā UU l) ā š l comprehension-š X P = tree-š (Ī£ (shape-š X) P) (component-š X ā pr1) ```