Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Interface] equivalence checker for OpenQASM files #194

Merged
merged 3 commits into from
Dec 21, 2024

Conversation

ScottWe
Copy link
Contributor

@ScottWe ScottWe commented Dec 20, 2024

Summary

A command-line executable for verifying OpenQASM files using verify_equvialences.py.

Purpose

The equivalence checker in Quartz is considered state-of-the-art in the quantum circuit verification community. Inevitably, people will want to use this verifier to build new tools, or to evaluate new parameterized equivalence checking techniques. However, working with verify_equivalences.py can be challenging, since it requires a specialized json input. This pull request introduces a new executable, which allows the verifier to work directly on OpenQASM files.

Details

This pull request introduces a new executable (verify_openqasm) which works as follows:

  • A context is set up with support all gates that Quartz supports from stdgates.inc.
  • This context is used to set up an OpenQASM 3 parser, with support for symbolic multiples of pi.
  • Two OpenQSAM 3 files are taken as command-line arguments, and then parsed using the parser. The same parser is used for both files, to ensure that common symbolic parameters are correlated.
  • The resulting circuit sequences are added to a dataset, to identify possible equivalences and global phase fingerprints.
  • The dataset is dumped to tmp.json, for analysis by verify_equivalences.py.
  • The results from verify_equivalences.py are logged to res.json.

I think this will suffice for simple use cases.

Copy link
Collaborator

@xumingkuan xumingkuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks! I added a commit to allow the executable to run in any directory so we don't need to worry about the relative path when calling verify_equivalence.py.

@xumingkuan xumingkuan merged commit 91c5922 into quantum-compiler:master Dec 21, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants