Skip to content

docs: add modifier documentation#182

Open
nicolaassolini-qntm wants to merge 18 commits into
mainfrom
na/modifier-documentation
Open

docs: add modifier documentation#182
nicolaassolini-qntm wants to merge 18 commits into
mainfrom
na/modifier-documentation

Conversation

@nicolaassolini-qntm

Copy link
Copy Markdown
Contributor

closes #98

@nicolaassolini-qntm nicolaassolini-qntm changed the title doc: add modifier documentation docs: add modifier documentation Jul 13, 2026
@nicolaassolini-qntm
nicolaassolini-qntm marked this pull request as ready for review July 14, 2026 09:54
@nicolaassolini-qntm

Copy link
Copy Markdown
Contributor Author

@CalMacCQ I think the page is almost ready, a part of the QFT example (and a section about @compite with flags?) If you want to take a look now before adding the final examples, I think it can be useful.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nicolaassolini-qntm

Copy link
Copy Markdown
Contributor Author

@CalMacCQ, I also added a Grover example. I think it is ready now. We only miss Unitary callable but I would add them when we are sure that they are not going to be experimental anymore

@nicolaassolini-qntm

Copy link
Copy Markdown
Contributor Author

We have to wait for Quantinuum/guppylang#2061 to be merged

@CalMacCQ CalMacCQ left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is a great start. Thanks for this.

I have yet to read this thoroughly but here are some quick comments.

I'll take another look tomorrow.

Comment thread sphinx/language_guide/modifiers.md Outdated
Comment thread sphinx/language_guide/modifiers.md
Comment thread sphinx/language_guide/modifiers.md
Comment thread sphinx/language_guide/modifiers.md
Comment thread sphinx/language_guide/modifiers.md Outdated
Comment thread sphinx/language_guide/modifiers.md Outdated
Comment thread sphinx/language_guide/modifiers.md Outdated
Comment thread sphinx/language_guide/modifiers.md Outdated
@CalMacCQ
CalMacCQ requested a review from dunc-go July 16, 2026 17:03
Co-authored-by: Callum Macpherson <93673602+CalMacCQ@users.noreply.github.com>

# Modifiers

Modifiers transform a block of quantum operations. They make it possible to express controlled and inverse operations without defining a separate function for each variant.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I would prefer more here - I think it's important to highlight that modifiers are capable of changing the typoe signature (e. g U -> ctrl -U). What is the aim of modifiers? Are they there to improve composability? Are they there to defer to the compiler instead of user defns?

Comment thread sphinx/language_guide/modifiers.md
Comment thread sphinx/language_guide/modifiers.md
Comment thread sphinx/language_guide/modifiers.md Outdated
Comment thread sphinx/language_guide/modifiers.md
Comment thread sphinx/language_guide/modifiers.md Outdated
Comment thread sphinx/language_guide/modifiers.md Outdated

## Control flow

When a controlled block contains control flow, the control is pushed to every quantum operation produced by the branch or loop. Evaluating the classical condition and loop bounds is not controlled. For instance, the following two programs are equivalent:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

the guppy logic here is so clean and demonstrative you could maybe reverse this section - 'These are equivalent.. this is because classical conditioning and loops are not part of the with control modification'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I see, but I'm sure how to organize the session 🤔

@dunc-go dunc-go left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Really appreciate the effort here.

Top level comment: I think this page should be split into 3 pages.
One is a top level explanation of the syntax and general properties of modifiers and maybe function flags. Then I think each modifier (control and syntax for now) can have their own pages with their specific properties (forbiddens etc) and then finally a 3rd page with examples such the conjugation box and the grovers.

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.

Language guide page on modifiers (control, power, dagger)

4 participants