Multisets of sigma types #
Multiset of keys of an association multiset.
Equations
- s.keys = Multiset.map Sigma.fst s
NodupKeys s
means that s
has no duplicate keys.
Equations
- s.NodupKeys = Quot.liftOn s List.NodupKeys ⋯
Alias of the reverse direction of Multiset.nodup_keys
.
Finmap #
Lifting from AList #
Induction #
extensionality #
mem #
The predicate a ∈ s
means that s
has a value associated to the key a
.
keys #
empty #
The empty map.
Equations
- Finmap.instEmptyCollection = { emptyCollection := { entries := 0, nodupKeys := ⋯ } }
singleton #
The singleton map.
Equations
- Finmap.singleton a b = (AList.singleton a b).toFinmap
Equations
- x✝.decidableEq x = decidable_of_iff (x✝.entries = x.entries) ⋯
lookup #
Look up the value associated to a key in a map.
Equations
- Finmap.lookup a s = s.liftOn (AList.lookup a) ⋯
Equations
- Finmap.instDecidableMem a s = decidable_of_iff ((Finmap.lookup a s).isSome = true) ⋯
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.
replace #
Replace a key with a given value in a finite map. If the key is not present it does nothing.
Equations
- Finmap.replace a b s = s.liftOn (fun (t : AList β) => (AList.replace a b t).toFinmap) ⋯
foldl #
Fold a commutative function over the key-value pairs in the map
Equations
- Finmap.foldl f H d m = Multiset.foldl (fun (d : δ) (s : Sigma β) => f d s.fst s.snd) d m.entries
any f s
returns true
iff there exists a value v
in s
such that f v = true
.
Equations
- Finmap.any f s = Finmap.foldl (fun (x : Bool) (y : α) (z : β y) => x || f y z) ⋯ false s
all f s
returns true
iff f v = true
for all values v
in s
.
Equations
- Finmap.all f s = Finmap.foldl (fun (x : Bool) (y : α) (z : β y) => x && f y z) ⋯ true s
erase #
Erase a key from the map. If the key is not present it does nothing.
Equations
- Finmap.erase a s = s.liftOn (fun (t : AList β) => (AList.erase a t).toFinmap) ⋯
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
- s.sdiff s' = Finmap.foldl (fun (s : Finmap β) (x : α) (x_1 : β x) => Finmap.erase x s) ⋯ s s'
Equations
- Finmap.instSDiff = { sdiff := Finmap.sdiff }
insert #
Insert a key-value pair into a finite map, replacing any existing pair with the same key.
Equations
- Finmap.insert a b s = s.liftOn (fun (t : AList β) => (AList.insert a b t).toFinmap) ⋯
extract #
Erase a key from the map, and return the corresponding value, if found.
Equations
- Finmap.extract a s = s.liftOn (fun (t : AList β) => Prod.map id AList.toFinmap (AList.extract a t)) ⋯
union #
Equations
- Finmap.instUnion = { union := Finmap.union }
simp
-normal form of mem_lookup_union