Last active
September 24, 2016 16:21
-
-
Save jfdm/24ffd6481309a6569b8e1074108f37dd to your computer and use it in GitHub Desktop.
What pairings in Idris can look like at least.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Pairing | |
||| Model different group types. | |
data GTy = G1 | G2 | GT | |
||| Group element, implementation is incomplete but shows how dependent types can be used to provide more infomation. | |
data Element : GTy -> Type where | |
MkElement : value -> (ty : GT) -> Element ty | |
||| Pairing information, implementation is incomplete. | |
data Pairing | |
||| Perform `c = e(a,b), a\in G1, b\inG2, c\in GT` | |
||| | |
||| @pairing `e` is the pairing to apply | |
||| @a is the first element from G1 | |
||| @b is the second element from G2 | |
||| | |
||| Returns the result, an element of GT. | |
apply : (pairing : Pairing) | |
-> (a : Element G1) | |
-> (b : Element G2) | |
-> Element GT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment