Giter VIP home page Giter VIP logo

autoq's Introduction

AutoQ: An automata-based C++ tool for quantum program verification.

AutoQ is a command-line utility written in C++ for verifying partial correctness of quantum programs automatically based on non-deterministic finite tree automata (NFTA) along with the concept of Hoare-style proof systems.

Consider a triple { $P$ } $C$ { $Q$ }, where $P$ and $Q$ are the pre- and post-condition recognizing sets of (pure) quantum states (represented by NFTA) and $C$ is a quantum program. Let $\mathcal L(.)$ denote the mapping from a condition $x$ to the set of all quantum states satisfying $x$ (characterized by $x$). Then AutoQ essentially checks whether all the quantum states in $\mathcal L(P)$ reach some state in $\mathcal L(Q)$ after the program $C$ is executed. If we further let $C(.)$ denote the mapping from a condition $x$ to the evolution of $x$ after a program segment $C$ is executed, then AutoQ simply checks whether $\mathcal L(C(P)) \subseteq \mathcal L(Q)$.

Our program currently supports $X$, $Y$, $Z$, $H$, $T$, $T^\dagger$, $S$, $S^\dagger$, $R_x(\pi/2)$, $R_y(\pi/2)$, $CX$, $CZ$, $CCX$, $SWAP$ quantum gates. The version of OpenQASM should be 2.0.


Installation and Compilation

Currently, for Linux (Ubuntu/Debian) and macOS, the dependency of AutoQ can be built using the command ./configure.sh. After configuration, please run the following command.

make release
make test

The first command compiles the source code with compiler optimizations enabled, while the second command runs several unit tests to verify the correctness of the implementation. If you need to compile the library for debugging, you can replace make release with make debug.


Command-Line

There are 4 modes listed in the following help message, which can be accessed by typing their respective subcommands. Each mode (subcommand) also has its own usage instructions.

$ ./build/cli/autoq -h
AutoQ: An automata-based C++ tool for quantum program verification.
Usage: autoq [OPTIONS] [SUBCOMMAND]

Options:
  -h,--help                   Print this help message and exit.

Subcommands:
  ex                          Execute a quantum circuit with a given precondition.
  ver                         Verify the execution result against a given postcondition.
  eq                          Check equivalence of two given quantum circuits.
  print                       Print the set of quantum states.
$ ./build/cli/autoq ver benchmarks/all/Grover/03/pre.lsta benchmarks/all/Grover/03/circuit.qasm benchmarks/all/Grover/03/post.lsta
The quantum program has [6] qubits and [54] gates.
The verification process [passed] in [0.0s] with [7MB] memory usage.

AutoQ provides two file extensions, *.hsl and *.lsta, for users to indicate the format they use to describe a set of quantum states. The simpler format is *.hsl, which does not require users to have a background in NFTA. However, since our current implementation of *.hsl has not yet been optimized, we strongly recommend using *.lsta as the number of qubits increases. The detailed formats can be found in the following documents.

If you're interested in the internal structures for quantum state representation, see the file internal_structure.md.


autoq's People

Contributors

alan23273850 avatar guluchen avatar johnnyhuang1007 avatar ondrik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

autoq's Issues

Error : make release and debug

Hello,

I've installed the dependencies, but I still get an error during installation.
With make release, I get this error:

/home/debian/AutoQ/src/../include/z3/z3++.h:590:9: warning: ‘z3::ast_vector_tpl<z3::func_decl>::m_vector’ should be initialized in the member initialization list [-Weffc++]
make[3]: Leaving directory '/home/debian/AutoQ/build'
make[2]: *** [CMakeFiles/Makefile2:900: src/CMakeFiles/autoq.dir/all] Error 2
make[2]: Leaving directory '/home/debian/AutoQ/build'
make[1]: *** [Makefile:101: all] Error 2
make[1]: Leaving directory '/home/debian/AutoQ/build'
make: *** [Makefile:15: release] Error 2

And with make debug, I have this one:

/home/debian/AutoQ/src/timbuk_parser-nobison.cc:928:21: error: cannot convert ‘boost::enable_if_c<true, boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<> > >::type’ {aka ‘boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<> >’} to ‘int’ in initialization
make[3]: *** [src/CMakeFiles/autoq.dir/build.make:76: src/CMakeFiles/autoq.dir/timbuk_parser-nobison.cc.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory '/home/debian/AutoQ/build'
make[2]: *** [CMakeFiles/Makefile2:900: src/CMakeFiles/autoq.dir/all] Error 2
make[2]: Leaving directory '/home/debian/AutoQ/build'
make[1]: *** [Makefile:101: all] Error 2
make[1]: Leaving directory '/home/debian/AutoQ/build'
make: *** [Makefile:12: debug] Error 2

Can you help me?

Thanks in advance.

pre.aut is not supported

The error FromFileToAutomata: The filename extension is not supported. comes up when trying to run the example verifications, and the readme is not updated for running with pre.spec

.aut missing ?

Hello,
I'm trying to use AutoQ, and I'm having a problem. Could you help me?
When I run this command:
./build/cli/autoq benchmarks/BernsteinVazirani/02/pre.aut benchmarks/BernsteinVazirani/02/circuit.qasm
I get this error:

Error: Unable to open file.
[ERROR] Unable to open the benchmarks/BernsteinVazirani/02/pre.aut file.

In addition, on Git I have:
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.