Multisets of sigma types #
NodupKeys s
means that s
has no duplicate keys.
Equations
- s.NodupKeys = Quot.liftOn s List.NodupKeys ⋯
Instances For
Alias of the reverse direction of Multiset.nodup_keys
.
Finmap #
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.
Instances For
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 #
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) ⋯
Instances For
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.
Instances For
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) ⋯
Instances For
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
Instances For
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
Instances For
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
Instances For
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) ⋯
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
- s.sdiff s' = Finmap.foldl (fun (s : Finmap β) (x : α) (x_1 : β x) => Finmap.erase x s) ⋯ s s'
Instances For
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) ⋯
Instances For
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)) ⋯
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₁
.
Instances For
Equations
- Finmap.instUnion = { union := Finmap.union }
simp
-normal form of mem_lookup_union