Safe Haskell | None |
---|
This module contains functions for simulating and debugging the Triangle Finding Oracle and its subroutines.
Synopsis
- increment_haskell :: IntM -> IntM
- increment_simulate :: IntM -> IntM
- incrementTF_haskell :: IntTF -> IntTF
- incrementTF_simulate :: IntTF -> IntTF
- doubleTF_haskell :: IntTF -> IntTF
- doubleTF_simulate :: IntTF -> IntTF
- addTF_haskell :: IntTF -> IntTF -> IntTF
- addTF_simulate :: IntTF -> IntTF -> IntTF
- multTF_haskell :: IntTF -> IntTF -> IntTF
- multTF_simulate :: IntTF -> IntTF -> IntTF
- pow17_haskell :: IntTF -> IntTF
- pow17_simulate :: IntTF -> IntTF
- mod3_haskell :: IntTF -> IntTF
- mod3_simulate :: IntTF -> IntTF
- mod3_alt_simulate :: IntTF -> IntTF
- oracle_haskell :: Int -> [Bool] -> [Bool] -> Bool
- oracle_simulate :: Int -> [Bool] -> [Bool] -> Bool
- oracle_aux_haskell :: Int -> [Bool] -> [Bool] -> (([Bool], [Bool]), (IntTF, IntTF, IntTF, IntTF, IntTF, IntTF), (Bool, Bool, Bool, Bool, Bool, Bool, Bool))
- oracle_aux_simulate :: Int -> [Bool] -> [Bool] -> (([Bool], [Bool]), (IntTF, IntTF, IntTF, IntTF, IntTF, IntTF), (Bool, Bool, Bool, Bool, Bool, Bool, Bool))
- show_oracle_details :: Show a => (([Bool], [Bool]), (a, a, a, a, a, a), (Bool, Bool, Bool, Bool, Bool, Bool, Bool)) -> String
- convertNode_haskell :: Int -> [Bool] -> IntTF
- convertNode_simulate :: Int -> [Bool] -> IntTF
- increment_table :: Int -> [String]
- incrementTF_table :: Int -> [String]
- doubleTF_table :: Int -> [String]
- addTF_table :: Int -> [String]
- multTF_table :: Int -> [String]
- pow17_table :: Int -> [String]
- mod3_table :: Int -> [String]
- oracle_table :: Int -> Int -> [String]
- oracle_table_detailed :: Int -> Int -> [String]
- convertNode_table :: Int -> Int -> [String]
- arithmetic_tests :: Int -> IO ()
- oracle_tests :: Int -> Int -> IO ()
Native and simulated arithmetic functions
For each arithmetic routine implemented in the Triangle Finding Oracle, we give two parallel implementations: one using Haskell’s arithmetic, and one by simulating the circuit execution.
These can then be cross-checked against each other for correctness.
increment_haskell :: IntM -> IntM Source #
Increment an m-bit Quipper integer (mod 2m). Native Haskell.
increment_simulate :: IntM -> IntM Source #
Increment an m-bit Quipper integer (mod 2m). Simulated from
increment
.
incrementTF_haskell :: IntTF -> IntTF Source #
Increment an m-bit Triangle Finding integer (mod 2m–1). Native Haskell.
incrementTF_simulate :: IntTF -> IntTF Source #
Increment an m-bit TF integer (mod 2m–1). Simulated from
increment_TF
.
doubleTF_haskell :: IntTF -> IntTF Source #
Double an m-bit TF integer (mod 2m–1). Native Haskell.
doubleTF_simulate :: IntTF -> IntTF Source #
Double an m-bit TF integer (mod 2m–1). Simulated from
double_TF
.
mod3_haskell :: IntTF -> IntTF Source #
Compute the reduction, mod 3, of lower-order bits of an IntTF
.
Native Haskell.
mod3_simulate :: IntTF -> IntTF Source #
mod3_alt_simulate :: IntTF -> IntTF Source #
Compute the reduction, mod 3, of lower-order bits of an IntTF
.
Simulated from o5_MOD3_alt
.
Native and simulated oracle functions
oracle_haskell :: Int -> [Bool] -> [Bool] -> Bool Source #
Oracle: compute the edge information between two nodes. Native Haskell.
oracle_simulate :: Int -> [Bool] -> [Bool] -> Bool Source #
Oracle: compute the edge information between two nodes.
Simulated from o1_ORACLE
.
oracle_aux_haskell :: Int -> [Bool] -> [Bool] -> (([Bool], [Bool]), (IntTF, IntTF, IntTF, IntTF, IntTF, IntTF), (Bool, Bool, Bool, Bool, Bool, Bool, Bool)) Source #
Oracle auxiliary information. Native Haskell.
oracle_aux_simulate :: Int -> [Bool] -> [Bool] -> (([Bool], [Bool]), (IntTF, IntTF, IntTF, IntTF, IntTF, IntTF), (Bool, Bool, Bool, Bool, Bool, Bool, Bool)) Source #
Oracle auxiliary information. Simulated from o1_ORACLE_aux
.
show_oracle_details :: Show a => (([Bool], [Bool]), (a, a, a, a, a, a), (Bool, Bool, Bool, Bool, Bool, Bool, Bool)) -> String Source #
A specialized show
for oracle auxiliary data.
convertNode_haskell :: Int -> [Bool] -> IntTF Source #
Conversion of a node to an integer. Native Haskell.
convertNode_simulate :: Int -> [Bool] -> IntTF Source #
Conversion of a node to an integer. Simulated from o2_ConvertNode
.
Testing functions
Various small test suites, checking the simulated circuit arithmetic functions against their Haskell equivalents.
incrementTF_table :: Int -> [String] Source #
Give full table of values for the increment_TF
functions.
addTF_table :: Int -> [String] Source #
Give full table of values for the TF addition (o7_ADD
)
functions.
multTF_table :: Int -> [String] Source #
Give full table of values for the TF multiplication (o8_MUL
)
functions.
pow17_table :: Int -> [String] Source #
Give full table of values for the 'pow17' functions.
mod3_table :: Int -> [String] Source #
Give full table of values for the 'mod3' functions.
oracle_table_detailed :: Int -> Int -> [String] Source #
Give a full table of values for o1_ORACLE_aux
.
convertNode_table :: Int -> Int -> [String] Source #
Give full table of values for the 'convertNode' functions.