EasyCrypt's list library, on int (theories/datatypes/List.ec) #
EasyCrypt's list operations take and return ints (size, nth, take, drop, nseq,
index, find, mkseq). To keep EasyCrypt statements as they are, they are mirrored here on ℤ,
with EasyCrypt's behaviour on negative arguments: a negative count is 0. The operations that
EasyCrypt shares with Lean (map, rev, flatten, ++, ∈) are Lean's.
Only what ported developments use is here. Names are EasyCrypt's.
nseq n x: n copies of x (none for n ≤ 0).
Equations
- GaudisCrypt.EC.nseq n x = List.replicate n.toNat x
Instances For
last x0 s: the last element, x0 for the empty list.
Equations
- GaudisCrypt.EC.last x0 s = s.getLastD x0
Instances For
index x s: the position of the first x in s, size s if there is none.
Equations
- GaudisCrypt.EC.index x s = ↑(List.idxOf x s)
Instances For
find p s: the position of the first element satisfying p, size s if there is none.
Equations
- GaudisCrypt.EC.find p s = ↑(List.findIdx p s)
Instances For
iota_ i n: [i; i + 1; …; i + n - 1].
Equations
- GaudisCrypt.EC.iota_ i n = List.map (fun (k : ℕ) => i + ↑k) (List.range n.toNat)
Instances For
mkseq f n: [f 0; …; f (n - 1)].
Equations
- GaudisCrypt.EC.mkseq f n = List.map f (GaudisCrypt.EC.iota_ 0 n)
Instances For
range m n: the integers from m (included) to n (excluded).
Equations
- GaudisCrypt.EC.range m n = GaudisCrypt.EC.iota_ m (n - m)
Instances For
Function properties (theories/core and theories/prelude) #
cancel f g: g is a left inverse of f.
Equations
- GaudisCrypt.EC.cancel f g = ∀ (x : α), g (f x) = x