Git Product home page Git Product logo

Comments (4)

gillenhaalb avatar gillenhaalb commented on July 29, 2024

@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.

cgranade avatar cgranade commented on July 29, 2024

@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.

gillenhaalb avatar gillenhaalb commented on July 29, 2024

@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.

gillenhaalb avatar gillenhaalb commented on July 29, 2024

Fixed by #695

from quantum-docs-pr.

Related Issues (20)

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.