Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Latest commit

 

History

History
55 lines (40 loc) · 2.14 KB

File metadata and controls

55 lines (40 loc) · 2.14 KB
page_type languages products description urlFragment jupyter
sample
qsharp
qdk
Using facts and assertions to diagnose quantum programs in Q#.
facts-and-assertions
jupytext kernelspec
cell_markers text_representation
region,endregion
extension format_name format_version jupytext_version
.md
markdown
1.2
1.5.2
display_name language name
.NET (PowerShell)
PowerShell
.net-powershell

Using Facts and Assertions

This sample demonstrates:

  • Using facts to check conditions on the values of Q# variables.
  • Using assertions on quantum simulators to check conditions on the state of quantum registers.

In this sample, you can use Q# to check the correctness of quantum programs with both facts (functions that check conditions on the values of their inputs) and assertions (operations that check conditions on the state of their inputs). Both facts and assertions can be used together to help understand bugs in quantum programs, and to write unit tests that help ensure that your Q# programs work correctly.

Prerequisites

Running the Sample

This sample is designed to be run from Jupyter Notebook. To set up your development environment to run Jupyter Notebooks, follow the steps explained in the Q# Quickstart: Jupyter guide.

Once this is set up, from the terminal, you can run the following command:

jupyter notebook

Alternatively, these notebooks can be started and run in the VSCode editor. To get set up with VSCode, please follow the steps laid out in the Q# Quickstart: VSCode guide.

Manifest

Further resources