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 ⋯
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 := ⋯ }
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 ALists to 2 Finmaps.
Equations
- Finmap.liftOn₂ s₁ s₂ f H = Finmap.liftOn s₁ (fun (l₁ : AList β) => Finmap.liftOn s₂ (f l₁) ⋯) ⋯
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 := ⋯ }
Instances For
empty #
The empty map.
Equations
- Finmap.instEmptyCollectionFinmap = { emptyCollection := { entries := 0, nodupKeys := ⋯ } }
singleton #
Equations
- Finmap.decidableEq x✝ x = match x✝, x with | x, x_1 => decidable_of_iff (x.entries = x_1.entries) ⋯
lookup #
Look up the value associated to a key in a map.
Equations
- Finmap.lookup a s = Finmap.liftOn s (AList.lookup a) ⋯
Instances For
Equations
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 = Finmap.liftOn s (fun (t : AList β) => AList.toFinmap (AList.replace a b t)) ⋯
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 = Finmap.liftOn s (fun (t : AList β) => AList.toFinmap (AList.erase a t)) ⋯
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
- Finmap.sdiff s s' = Finmap.foldl (fun (s : Finmap β) (x : α) (x_1 : β x) => Finmap.erase x s) ⋯ s s'
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
- Finmap.insert a b s = Finmap.liftOn s (fun (t : AList β) => AList.toFinmap (AList.insert a b t)) ⋯
Instances For
extract #
Erase a key from the map, and return the corresponding value, if found.
Equations
- Finmap.extract a s = Finmap.liftOn s (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₁.
Equations
- Finmap.union s₁ s₂ = Finmap.liftOn₂ s₁ s₂ (fun (s₁ s₂ : AList β) => AList.toFinmap (s₁ ∪ s₂)) ⋯
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