QuantumKatas icon indicating copy to clipboard operation
QuantumKatas copied to clipboard

Late introduction of `ControlledOnInt` operation

Open remilvus opened this issue 1 year ago • 2 comments

Problem

If someone is flawlessly solving notebooks in order that the "Learning Path" suggests, then they will encounter the ControlledOnInt operation for the first time in Oracles tutorial. This is a quite useful operation, that is used for example in the Superposition workbook (solution to task 1.12).

Proposed solution

If workbooks are supposed to be skipped when someone can solve a task, then I think that this operation can appear earlier. Maybe it can be introduced as a hint in task 1.12, or even as a separate task in which ControlledOnInt needs to be implemented?

remilvus avatar Aug 05 '22 16:08 remilvus

That's a good point, indeed Superposition task 1.12 uses it in the solution (as well as ControlledOnBitString) but doesn't offer a hint for it.

Do you want to open a pull request adding a hint to Superposition task 1.12 mentioning ControlledOnInt and ControlledOnBitString as useful library functions to use? A separate task wouldn't really work in the context of Superposition kata, since all the tasks there say "prepare this state" rather than "implement this unitary transformation".

tcNickolas avatar Aug 09 '22 21:08 tcNickolas

Yes, I would like to do that.

When mentioning adding this as a separate task, I was thinking it could be in one of the katas that come before Superposition. For example, Basic Gates Kata looks like a good candidate, as controlled gates are introduced there. In my opinion, it's good to have both a hint and a task, especially if ControlledOnBitString operation is included. What do you think? Dividing new concepts into separate tasks seems like a good strategy, but at the same time it generates an infinite number of tasks in the limit.

remilvus avatar Aug 10 '22 17:08 remilvus

Exercise 5 of the MultiQubitGates tutorial covers ControlledOnBitString function in quite a lot of detail, so we probably don't need an infinite number of tasks :-) BasicGates can be a good place for a task "Two-qubit gate - 4" (between the current tasks 2.3 and 2.4) introducing a zero-controlled NOT gate, as a simpler version of that exercise, and you can introduce both ControlledOn* functions in the hint/workbook for it. Maybe also point to that exercise for a more detailed version of the discussion.

tcNickolas avatar Aug 12 '22 03:08 tcNickolas

I'm starting to work on adding the task!

remilvus avatar Aug 12 '22 15:08 remilvus