Multisets of sigma types #
Multiset of keys of an association multiset.
Equations
- Multiset.keys s = Multiset.map Sigma.fst s
Instances For
NodupKeys s
means that s
has no duplicate keys.
Equations
- Multiset.NodupKeys s = Quot.liftOn s List.NodupKeys (_ : ∀ (x x_1 : List (Sigma β)), Setoid.r x x_1 → List.NodupKeys x = List.NodupKeys x_1)
Instances For
Alias of the reverse direction of Multiset.nodup_keys
.
Finmap #
Finmap β
is the type of finite maps over a multiset. It is effectively
a quotient of AList β
by permutation of the underlying list.
- nodupKeys : Multiset.NodupKeys self.entries
There are no duplicate keys in
entries
Instances For
The quotient map from AList
to Finmap
.
Equations
- AList.toFinmap s = { entries := ↑s.entries, nodupKeys := (_ : List.NodupKeys s.entries) }
Instances For
Lifting from AList #
Lift a permutation-respecting function on AList
to Finmap
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Lift a permutation-respecting function on 2 AList
s to 2 Finmap
s.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Induction #
extensionality #
mem #
The predicate a ∈ s
means that s
has a value associated to the key a
.
Equations
- Finmap.instMembershipFinmap = { mem := fun (a : α) (s : Finmap β) => a ∈ Multiset.keys s.entries }
keys #
The set of keys of a finite map.
Equations
- Finmap.keys s = { val := Multiset.keys s.entries, nodup := (_ : Multiset.Nodup (Multiset.keys s.entries)) }
Instances For
empty #
The empty map.
Equations
- Finmap.instEmptyCollectionFinmap = { emptyCollection := { entries := 0, nodupKeys := (_ : List.NodupKeys []) } }
singleton #
Equations
- Finmap.decidableEq x✝ x = match x✝, x with | x, x_1 => decidable_of_iff (x.entries = x_1.entries) (_ : x.entries = x_1.entries ↔ x = x_1)
lookup #
Look up the value associated to a key in a map.
Equations
- Finmap.lookup a s = Finmap.liftOn s (AList.lookup a) (_ : ∀ (x x_1 : AList β), List.Perm x.entries x_1.entries → AList.lookup a x = AList.lookup a x_1)
Instances For
Equations
- Finmap.instDecidableMemFinmapInstMembershipFinmap a s = decidable_of_iff (Option.isSome (Finmap.lookup a s) = true) (_ : Option.isSome (Finmap.lookup a s) = true ↔ a ∈ s)
An equivalence between Finmap β
and pairs (keys : Finset α, lookup : ∀ a, Option (β a))
such
that (lookup a).isSome ↔ a ∈ keys
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
replace #
Replace a key with a given value in a finite map. If the key is not present it does nothing.
Equations
- One or more equations did not get rendered due to their size.
Instances For
foldl #
Fold a commutative function over the key-value pairs in the map
Equations
- One or more equations did not get rendered due to their size.
Instances For
erase #
Erase a key from the map. If the key is not present it does nothing.
Equations
- One or more equations did not get rendered due to their size.
Instances For
sdiff #
sdiff s s'
consists of all key-value pairs from s
and s'
where the keys are in s
or
s'
but not both.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Finmap.instSDiffFinmap = { sdiff := Finmap.sdiff }
insert #
Insert a key-value pair into a finite map, replacing any existing pair with the same key.
Equations
- One or more equations did not get rendered due to their size.
Instances For
extract #
Erase a key from the map, and return the corresponding value, if found.
Equations
- One or more equations did not get rendered due to their size.
Instances For
union #
s₁ ∪ s₂
is the key-based union of two finite maps. It is left-biased: if
there exists an a ∈ s₁
, lookup a (s₁ ∪ s₂) = lookup a s₁
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Finmap.instUnionFinmap = { union := Finmap.union }
Disjoint #
Disjoint s₁ s₂
holds if s₁
and s₂
have no keys in common.
Equations
- Finmap.Disjoint s₁ s₂ = ∀ x ∈ s₁, x ∉ s₂
Instances For
Equations
- Finmap.instDecidableRelFinmapDisjoint x y = id inferInstance