Documentation

GaudisCrypt.Lib.EC.Bigop

EasyCrypt's Bigop (theories/algebra/Bigop.eca) #

The big operator of a commutative monoid over a list: big P F r is the monoid's sum of F x over the x of r that satisfy P. The theory's type t with EC's Monoid cloned as Support (idm, +, addmA, addmC, add0m) is the class Params t; a clone gives the monoid (clone import GaudisCrypt.EC.Bigop as BBS with type t <- word, op idm <- zerow, op add <- xorw). Only what ported developments use is here. Names are EasyCrypt's.

The theory's parameters: a commutative monoid on t (EC's clone export Monoid as Support).

  • idm : t

    Support.idm: the neutral element.

  • add : t → t → t

    Support.(+): the monoid's operation.

  • addmA (x y z : t) : add x (add y z) = add (add x y) z

    axiom addmA : associative (+).

  • addmC (x y : t) : add x y = add y x

    axiom addmC : commutative (+).

  • add0m (x : t) : add idm x = x

    axiom add0m : left_id idm (+).

Instances
    theorem GaudisCrypt.EC.Bigop.addm0 {t : Type} [Params t] (x : t) :

    lemma addm0 : right_id idm (+).

    def GaudisCrypt.EC.Bigop.big {t : Type} [Params t] {α : Type} (P : α → Prop) [DecidablePred P] (F : α → t) (r : List α) :
    t

    op big (P : 'a -> bool) (F : 'a -> t) (r : 'a list) = foldr Support.(+) idm (map F (filter P r)).

    Equations
    Instances For
      theorem GaudisCrypt.EC.Bigop.big_nil {t : Type} [Params t] {α : Type} (P : α → Prop) [DecidablePred P] (F : α → t) :
      big P F [] = idm

      lemma big_nil.

      theorem GaudisCrypt.EC.Bigop.big_cons {t : Type} [Params t] {α : Type} (P : α → Prop) [DecidablePred P] (F : α → t) (x : α) (s : List α) :
      big P F (x :: s) = if P x then Params.add (F x) (big P F s) else big P F s

      lemma big_cons.

      theorem GaudisCrypt.EC.Bigop.big_consT {t : Type} [Params t] {α : Type} (F : α → t) (x : α) (s : List α) :
      big predT F (x :: s) = Params.add (F x) (big predT F s)

      lemma big_consT.

      theorem GaudisCrypt.EC.Bigop.big_cat {t : Type} [Params t] {α : Type} (P : α → Prop) [DecidablePred P] (F : α → t) (s1 s2 : List α) :
      big P F (s1 ++ s2) = Params.add (big P F s1) (big P F s2)

      lemma big_cat.