forked from microsoft/QuantumKatas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tasks.qs
86 lines (68 loc) · 2.72 KB
/
Tasks.qs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
//////////////////////////////////////////////////////////////////
// This file is a back end for the tasks in Quantum Oracles tutorial.
// We strongly recommend to use the Notebook version of the tutorial
// to enjoy the full experience.
//////////////////////////////////////////////////////////////////
namespace Quantum.Kata.Oracles {
open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Diagnostics;
open Microsoft.Quantum.Intrinsic;
//////////////////////////////////////////////////////////////////
// Part I. Introduction to Quantum Oracles
//////////////////////////////////////////////////////////////////
// Task 1.1.
function IsSeven (x : Bool[]) : Bool {
// ...
return false;
}
// Task 1.2.
operation IsSeven_PhaseOracle (x : Qubit[]) : Unit is Adj + Ctl {
// ...
}
// Task 1.3.
operation IsSeven_MarkingOracle (x : Qubit[], y : Qubit) : Unit is Adj + Ctl {
// ...
}
//////////////////////////////////////////////////////////////////
// Part II. Phase Kickback
//////////////////////////////////////////////////////////////////
// Task 2.1.
operation ApplyMarkingOracleAsPhaseOracle (markingOracle : ((Qubit[], Qubit) => Unit is Adj + Ctl), qubits : Qubit[]) : Unit is Adj + Ctl {
// ...
}
function Oracle_Converter (markingOracle : ((Qubit[], Qubit) => Unit is Adj + Ctl)) : (Qubit[] => Unit is Adj + Ctl) {
return ApplyMarkingOracleAsPhaseOracle(markingOracle, _);
}
//////////////////////////////////////////////////////////////////
// Part III. Implementing Quantum Oracles
//////////////////////////////////////////////////////////////////
// Task 3.1.
operation Or_Oracle (x : Qubit[], y : Qubit) : Unit is Adj + Ctl {
// ...
}
// Task 3.2.
operation KthBit_Oracle (x : Qubit[], k : Int) : Unit is Adj + Ctl {
// ...
}
// Task 3.3
operation OrOfBitsExceptKth_Oracle (x : Qubit[], k : Int) : Unit is Adj + Ctl {
// ...
}
//////////////////////////////////////////////////////////////////
// Part IV. More Oracles! Implementation and Testing
//////////////////////////////////////////////////////////////////
// Task 4.1.
operation ArbitraryBitPattern_Oracle (x : Qubit[], y : Qubit, pattern : Bool[]) : Unit is Adj + Ctl {
// ...
}
// Task 4.2.
operation ArbitraryBitPattern_Oracle_Challenge (x : Qubit[], pattern : Bool[]) : Unit is Adj + Ctl {
// ...
}
// Task 4.3.
operation Meeting_Oracle (x : Qubit[], jasmine : Qubit[], z : Qubit) : Unit is Adj + Ctl {
// ...
}
}