lol-0.1.0.0: A library for lattice cryptography.

Safe HaskellNone
LanguageHaskell2010

Crypto.Lol.Gadget

Description

Interfaces for "gadgets," decomposition, and error correction.

Synopsis

Documentation

class Ring u => Gadget gad u where Source

Gadget vectors, parameterized by an index type.

Minimal complete definition

gadget

Methods

gadget :: Tagged gad [u] Source

The gadget vector over u.

encode :: u -> Tagged gad [u] Source

Yield an error-tolerant encoding of an element with respect to the gadget. (Mathematically, this should just be the product of the input with the gadget, but it is a class method to allow for optimized implementations.)

Instances

(Gadget k gad a, Gadget k gad b) => Gadget k gad (a, b) Source 
(ReflectsTI k q z, Additive z) => Gadget * TrivGad (ZqBasic k q z) Source 
(Gadget k gad zq, Fact m, CElt t zq) => Gadget k gad (UCyc t m zq) Source 
Gadget k gad (UCyc t m a) => Gadget k gad (Cyc t m a) Source 
(ReflectsTI k1 q z, Additive z, Reflects k b z) => Gadget * (BaseBGad k b) (ZqBasic k q z) Source 

class (Gadget gad u, Reduce (DecompOf u) u) => Decompose gad u where Source

Decomposition relative to a gadget.

Associated Types

type DecompOf u Source

The ring that u decomposes over.

Methods

decompose :: u -> Tagged gad [DecompOf u] Source

Yield a short vector x such that <g, x> = u.

Instances

(Decompose k gad a, Decompose k gad b, (~) * (DecompOf a) (DecompOf b)) => Decompose k gad (a, b) Source 
(ReflectsTI k q z, Ring z) => Decompose * TrivGad (ZqBasic k q z) Source 
(Decompose k gad zq, Fact m, CElt t zq, CElt t (DecompOf zq), Reduce (DecompOf zq) zq) => Decompose k gad (UCyc t m zq) Source 
(Decompose k gad (UCyc t m zq), Reduce (Cyc t m (DecompOf zq)) (Cyc t m zq)) => Decompose k gad (Cyc t m zq) Source 
(ReflectsTI k1 q z, Ring z, Reflects k b z) => Decompose * (BaseBGad k b) (ZqBasic k q z) Source 

class Gadget gad u => Correct gad u where Source

Error correction relative to a gadget.

Methods

correct :: Tagged gad [u] -> u Source

Correct a "noisy" encoding of an element (see encode).

Instances

(ReflectsTI k q z, Ring z) => Correct * TrivGad (ZqBasic k q z) Source 
(Correct k gad zq, Fact m, CElt t zq) => Correct k gad (UCyc t m zq) Source 
Correct k gad (UCyc t m a) => Correct k gad (Cyc t m a) Source 

data TrivGad Source

Dummy type representing the gadget [1].

Instances

(ReflectsTI k q z, Ring z) => Correct * TrivGad (ZqBasic k q z) Source 
(ReflectsTI k q z, Ring z) => Decompose * TrivGad (ZqBasic k q z) Source 
(ReflectsTI k q z, Additive z) => Gadget * TrivGad (ZqBasic k q z) Source 

data BaseBGad b Source

Dummy type representing the gadget [1,b,b^2,...].

Instances

(ReflectsTI k1 q z, Ring z, Reflects k b z) => Decompose * (BaseBGad k b) (ZqBasic k q z) Source 
(ReflectsTI k1 q z, Additive z, Reflects k b z) => Gadget * (BaseBGad k b) (ZqBasic k q z) Source