Comments (4)
@cgranade I agree, a few lines of clarification are certainly in order (it's getting late here, so I'll be taking care of it tomorrow). Changing the AssertPositive
function name is obviously also necessary, but the question is to what? Perhaps TestPositive
or FailIfNotPositive
?
The clarifying discussion would then also serve as a good place to mention the actual Fact
function in comparison to this to-be-renamed one---namely that this one actually halts the computation, whereas (it appears) Fact
merely prints a message.
from quantum-docs-pr.
@gillenhaalb: Thanks for taking a look! With respect to Fact
, it does actually halt if a particular fact is false (that is, Fact(true, "")
is a tautology while Fact(false, "")
is a contradiction). From that standpoint, AssertPositive
could be renamed to PositivityFact
.
The way I think of it is that a fact is either a tautology or a contradiction as a function only of its value: true
is always true, irrespective of what the state of any control environment or qubit register is, while an assertion could be true or false depending on state external to the values passed.
The two can even be used well together, by representing global state with values that can then be used with facts. For example:
operation AssertQubitsAreAvailable() : Unit {
Fact(GetQubitsAvailableToUse() > 0, "No qubits were actually available");
}
That couldn't be a function, since GetQubitsAvailableToUse
depends on global state of the program and its execution environment (namely, how many qubits are available to use), but it can use that global state to find a value that can be used to formulate a fact.
from quantum-docs-pr.
@cgranade that makes a lot of sense, thanks! I think it may be worth adding that info to the API for Fact then, because it's hardly clear that it halts the computation (a feature which seems important enough to garner a few sentences of discussion on the Testing and Debugging page). It's only implicit in the description of the input string as "Failure message string to be printed ...".
I'll do an additional PR to the libraries to add the sentence in the function description.
from quantum-docs-pr.
Fixed by #695
from quantum-docs-pr.
Related Issues (20)
- Wrong Q# sequence in MeasureY HOT 2
- Troubles with using Length(Qubit[]) function in Jupyter Notebook HOT 2
- [Broken link] the quickstart-guide link needs to be fixed HOT 1
- No documentation available for "within/apply" statements. HOT 3
- There is no way to download the documents HOT 1
- Empty Tuple Code Sample in Entanglement Tutorial HOT 3
- Lenny-QC HOT 1
- `import qsharp` fails or takes too long time HOT 2
- Add a link to the Q# language design repo HOT 1
- Code sample for LocalRotationsLayer? HOT 2
- Add qsharp-language to repo list HOT 1
- Instructions for creating a new Q# project in VS Code are not clear HOT 1
- Z gate error HOT 4
- typo in PE without eigenstates HOT 4
- VS Code and VS Studio Icons/Titles are mixed up. HOT 1
- "This Page" feedback button directs to wrong repo HOT 7
- Examples from Q# Libraries API don't show up in docs HOT 2
- LaTeX formulas won't render in the PDF version HOT 1
- Link HOT 1
- IQ# magic commands don't have a list page HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quantum-docs-pr.