EasyCrypt's finite maps (theories/datatypes/FMap.ec) #
('a, 'b) fmap is a finite map, here Mathlib's Finmap. Only what ported developments use is
here. Names are EasyCrypt's, with function names for its mixfix operators:
| EasyCrypt | here |
|---|---|
empty | FMap.empty |
m.[x] | FMap.get m x |
m.[x <- y] | FMap.set m x y |
x \in m (dom m x) | FMap.dom m x |
rng m y | FMap.rng m y |
fdom m, frng m | FMap.fdom m, FMap.frng m |
restr f m | FMap.restr f m |
find p m | FMap.find p m |
map f m | FMap.map f m |
noflags m | FMap.noflags m |
m1 + m2 | FMap.add m1 m2 |
in_dom_with m x f | FMap.in_dom_with m x f |
('a, 'b) fmap.
Equations
- GaudisCrypt.EC.FMap α β = Finmap fun (x : α) => β
Instances For
m.[x].
Equations
- m.get x = Finmap.lookup x m
Instances For
m.[x <- y].
Equations
- m.set x y = Finmap.insert x y m
Instances For
rem m x: m without a binding for x.
Equations
- m.rem x = Finmap.erase x m
Instances For
Equations
rng m y: some key is bound to y.
Equations
- m.rng y = ∃ (x : α), Finmap.lookup x m = some y
Instances For
Equations
- m.instDecidablePredRng x✝ = Classical.dec (m.rng x✝)
frng m: the values of m.
Instances For
find p m: some key x bound to y with p x y (EasyCrypt leaves which one unspecified),
None if there is none.
Equations
Instances For
The map binding each x ∈ s with h x = some y to y (how restr and map are built).
Equations
- GaudisCrypt.EC.FMap.ofOpt s h = List.foldl (fun (acc : GaudisCrypt.EC.FMap α β) (x : α) => match h x with | some y => Finmap.insert x y acc | none => acc) ∅ s.toList
Instances For
restr f m (for m : ('a, 'b * 'f) fmap): the bindings of m whose tag is f, without
the tag.
Equations
- GaudisCrypt.EC.FMap.restr f m = GaudisCrypt.EC.FMap.ofOpt (Finmap.keys m) fun (x : α) => (Finmap.lookup x m).bind fun (p : β × φ) => if p.2 = f then some p.1 else none
Instances For
map f m: m with each binding x ↦ y replaced by x ↦ f x y.
Equations
- GaudisCrypt.EC.FMap.map f m = GaudisCrypt.EC.FMap.ofOpt (Finmap.keys m) fun (x : α) => Option.map (f x) (Finmap.lookup x m)
Instances For
noflags m (for m : ('a, 'b * 'f) fmap): m without its tags.
Equations
- m.noflags = GaudisCrypt.EC.FMap.map (fun (x : α) (p : β × φ) => p.1) m
Instances For
m1 + m2: the bindings of both, m2's winning where both bind a key.
Instances For
in_dom_with m x f: x is bound in m, with tag f.
Instances For
eq_except X m1 m2: m1 and m2 agree outside X (EC's eq_exceptP is the definition).
Instances For
Lemmas (EasyCrypt's names) #
findP, with bindings get m x = some y for EasyCrypt's x \in m and oget m.[x]: either
find fails and no binding satisfies p, or it returns a key whose binding satisfies p.
frng0: the empty map's range is empty.
leq_card_rng_dom: a map has at most as many values as keys.
endo_dom_rng: a map from a type to itself that misses a key misses a value.
mapE.
eq_except_setlr-style: writing the same key on both sides keeps eq_except.
eq_except_setl: a write inside X on the left keeps eq_except.
eq_except_setr: a write inside X on the right keeps eq_except.
eq_except_remr: a removal inside X on the right keeps eq_except.
Equal outside x, and bound to b at x on the right: the left with x ↦ b is the right.
in_dom_with after a write.
in_dom_with reads only the binding.
restrP at a map tagging every binding with f: the bindings themselves.
Facts EC's smt() finds on rng, fdom and fresh bindings #
Not in EC's FMap.ec: the facts its proofs leave to smt() (with mem_set, get_setE, remE,
fcardUI_indep). collision is SecureRO's op collision, generic as there.
empty has an empty range.
empty has no collision.