qsharp-lang 1.6.2-dev → 1.6.4-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +2 -2
- package/dist/compiler/compiler.d.ts +6 -2
- package/dist/compiler/compiler.js +19 -5
- package/dist/katas-content.generated.js +600 -74
- package/dist/katas-content.generated.md.js +600 -74
- package/dist/language-service/language-service.d.ts +1 -0
- package/dist/language-service/language-service.js +9 -0
- package/dist/samples.generated.js +4 -4
- package/docs/Microsoft.Quantum.Arrays/All.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Any.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Chunks.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/CircularlyShifted.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/ColumnAt.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Count.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Diagonal.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/DrawMany.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Enumerated.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Excluding.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Filtered.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/FlatMapped.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Flattened.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Fold.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/ForEach.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Head.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/HeadAndRest.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/IndexOf.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/IndexRange.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Interleaved.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/IsEmpty.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/IsRectangularArray.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/IsSorted.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/IsSquareArray.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Mapped.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/MappedByIndex.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/MappedOverRange.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Most.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/MostAndTail.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Padded.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Partitioned.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Rest.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Reversed.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/SequenceI.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/SequenceL.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Sorted.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Subarray.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Swapped.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Tail.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Transposed.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Unzipped.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Where.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Windows.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Zipped.md +1 -1
- package/docs/Microsoft.Quantum.Canon/ApplyCNOTChain.md +1 -1
- package/docs/Microsoft.Quantum.Canon/ApplyControlledOnBitString.md +1 -1
- package/docs/Microsoft.Quantum.Canon/ApplyControlledOnInt.md +1 -1
- package/docs/Microsoft.Quantum.Canon/ApplyP.md +1 -1
- package/docs/Microsoft.Quantum.Canon/ApplyPauli.md +1 -1
- package/docs/Microsoft.Quantum.Canon/ApplyPauliFromBitString.md +1 -1
- package/docs/Microsoft.Quantum.Canon/ApplyPauliFromInt.md +1 -1
- package/docs/Microsoft.Quantum.Canon/ApplyQFT.md +1 -1
- package/docs/Microsoft.Quantum.Canon/ApplyToEach.md +1 -1
- package/docs/Microsoft.Quantum.Canon/ApplyToEachA.md +1 -1
- package/docs/Microsoft.Quantum.Canon/ApplyToEachC.md +1 -1
- package/docs/Microsoft.Quantum.Canon/ApplyToEachCA.md +1 -1
- package/docs/Microsoft.Quantum.Canon/ApplyXorInPlace.md +1 -1
- package/docs/Microsoft.Quantum.Canon/ApplyXorInPlaceL.md +1 -1
- package/docs/Microsoft.Quantum.Canon/CX.md +1 -1
- package/docs/Microsoft.Quantum.Canon/CY.md +1 -1
- package/docs/Microsoft.Quantum.Canon/CZ.md +1 -1
- package/docs/Microsoft.Quantum.Canon/Fst.md +1 -1
- package/docs/Microsoft.Quantum.Canon/Snd.md +1 -1
- package/docs/Microsoft.Quantum.Canon/SwapReverseRegister.md +1 -1
- package/docs/Microsoft.Quantum.Convert/BigIntAsBoolArray.md +1 -1
- package/docs/Microsoft.Quantum.Convert/BoolArrayAsBigInt.md +1 -1
- package/docs/Microsoft.Quantum.Convert/BoolArrayAsInt.md +1 -1
- package/docs/Microsoft.Quantum.Convert/BoolArrayAsResultArray.md +1 -1
- package/docs/Microsoft.Quantum.Convert/BoolAsResult.md +1 -1
- package/docs/Microsoft.Quantum.Convert/ComplexAsComplexPolar.md +1 -1
- package/docs/Microsoft.Quantum.Convert/ComplexPolarAsComplex.md +1 -1
- package/docs/Microsoft.Quantum.Convert/IntAsBigInt.md +1 -1
- package/docs/Microsoft.Quantum.Convert/IntAsBoolArray.md +1 -1
- package/docs/Microsoft.Quantum.Convert/IntAsDouble.md +1 -1
- package/docs/Microsoft.Quantum.Convert/ResultArrayAsBoolArray.md +1 -1
- package/docs/Microsoft.Quantum.Convert/ResultArrayAsInt.md +1 -1
- package/docs/Microsoft.Quantum.Convert/ResultAsBool.md +1 -1
- package/docs/Microsoft.Quantum.Core/IsRangeEmpty.md +1 -1
- package/docs/Microsoft.Quantum.Core/Length.md +1 -1
- package/docs/Microsoft.Quantum.Core/RangeEnd.md +1 -1
- package/docs/Microsoft.Quantum.Core/RangeReverse.md +1 -1
- package/docs/Microsoft.Quantum.Core/RangeStart.md +1 -1
- package/docs/Microsoft.Quantum.Core/RangeStep.md +1 -1
- package/docs/Microsoft.Quantum.Core/Repeated.md +1 -1
- package/docs/Microsoft.Quantum.Diagnostics/DumpMachine.md +1 -1
- package/docs/Microsoft.Quantum.Diagnostics/DumpRegister.md +1 -1
- package/docs/Microsoft.Quantum.Diagnostics/Fact.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/AdjustForSingleControl.md +21 -0
- package/docs/Microsoft.Quantum.Intrinsic/ApplyGlobalPhase.md +18 -0
- package/docs/Microsoft.Quantum.Intrinsic/CCH.md +18 -0
- package/docs/Microsoft.Quantum.Intrinsic/CCNOT.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/CCY.md +18 -0
- package/docs/Microsoft.Quantum.Intrinsic/CCZ.md +18 -0
- package/docs/Microsoft.Quantum.Intrinsic/CH.md +18 -0
- package/docs/Microsoft.Quantum.Intrinsic/CNOT.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/CRxx.md +18 -0
- package/docs/Microsoft.Quantum.Intrinsic/CRyy.md +18 -0
- package/docs/Microsoft.Quantum.Intrinsic/CRz.md +18 -0
- package/docs/Microsoft.Quantum.Intrinsic/CRzz.md +18 -0
- package/docs/Microsoft.Quantum.Intrinsic/CS.md +18 -0
- package/docs/Microsoft.Quantum.Intrinsic/CT.md +18 -0
- package/docs/Microsoft.Quantum.Intrinsic/CollectControls.md +27 -0
- package/docs/Microsoft.Quantum.Intrinsic/ControllableGlobalPhase.md +18 -0
- package/docs/Microsoft.Quantum.Intrinsic/EntangleForJointMeasure.md +18 -0
- package/docs/Microsoft.Quantum.Intrinsic/Exp.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/GlobalPhase.md +18 -0
- package/docs/Microsoft.Quantum.Intrinsic/H.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/I.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/IndicesOfNonIdentity.md +18 -0
- package/docs/Microsoft.Quantum.Intrinsic/M.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/MapPauli.md +18 -0
- package/docs/Microsoft.Quantum.Intrinsic/Measure.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/Message.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/PhaseCCX.md +18 -0
- package/docs/Microsoft.Quantum.Intrinsic/R.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/R1.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/R1Frac.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/RFrac.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/RemovePauliI.md +18 -0
- package/docs/Microsoft.Quantum.Intrinsic/Reset.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/ResetAll.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/Rx.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/Rxx.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/Ry.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/Ryy.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/Rz.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/Rzz.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/S.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/SWAP.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/SpreadZ.md +18 -0
- package/docs/Microsoft.Quantum.Intrinsic/T.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/X.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/Y.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/Z.md +1 -1
- package/docs/Microsoft.Quantum.Logical/Xor.md +1 -1
- package/docs/Microsoft.Quantum.Math/AbsComplex.md +1 -1
- package/docs/Microsoft.Quantum.Math/AbsComplexPolar.md +1 -1
- package/docs/Microsoft.Quantum.Math/AbsD.md +1 -1
- package/docs/Microsoft.Quantum.Math/AbsI.md +1 -1
- package/docs/Microsoft.Quantum.Math/AbsL.md +1 -1
- package/docs/Microsoft.Quantum.Math/AbsSquaredComplex.md +1 -1
- package/docs/Microsoft.Quantum.Math/AbsSquaredComplexPolar.md +1 -1
- package/docs/Microsoft.Quantum.Math/ApproximateFactorial.md +1 -1
- package/docs/Microsoft.Quantum.Math/ArcCos.md +1 -1
- package/docs/Microsoft.Quantum.Math/ArcCosh.md +1 -1
- package/docs/Microsoft.Quantum.Math/ArcSin.md +1 -1
- package/docs/Microsoft.Quantum.Math/ArcSinh.md +1 -1
- package/docs/Microsoft.Quantum.Math/ArcTan.md +1 -1
- package/docs/Microsoft.Quantum.Math/ArcTan2.md +1 -1
- package/docs/Microsoft.Quantum.Math/ArcTanh.md +1 -1
- package/docs/Microsoft.Quantum.Math/ArgComplex.md +1 -1
- package/docs/Microsoft.Quantum.Math/ArgComplexPolar.md +1 -1
- package/docs/Microsoft.Quantum.Math/Binom.md +1 -1
- package/docs/Microsoft.Quantum.Math/BitSizeI.md +1 -1
- package/docs/Microsoft.Quantum.Math/BitSizeL.md +1 -1
- package/docs/Microsoft.Quantum.Math/Ceiling.md +1 -1
- package/docs/Microsoft.Quantum.Math/Complex.md +1 -1
- package/docs/Microsoft.Quantum.Math/ComplexPolar.md +1 -1
- package/docs/Microsoft.Quantum.Math/ContinuedFractionConvergentI.md +1 -1
- package/docs/Microsoft.Quantum.Math/ContinuedFractionConvergentL.md +1 -1
- package/docs/Microsoft.Quantum.Math/Cos.md +1 -1
- package/docs/Microsoft.Quantum.Math/Cosh.md +1 -1
- package/docs/Microsoft.Quantum.Math/DivRemI.md +1 -1
- package/docs/Microsoft.Quantum.Math/DivRemL.md +1 -1
- package/docs/Microsoft.Quantum.Math/DividedByC.md +1 -1
- package/docs/Microsoft.Quantum.Math/DividedByCP.md +1 -1
- package/docs/Microsoft.Quantum.Math/E.md +1 -1
- package/docs/Microsoft.Quantum.Math/ExpModI.md +1 -1
- package/docs/Microsoft.Quantum.Math/ExpModL.md +1 -1
- package/docs/Microsoft.Quantum.Math/ExtendedGreatestCommonDivisorI.md +1 -1
- package/docs/Microsoft.Quantum.Math/ExtendedGreatestCommonDivisorL.md +1 -1
- package/docs/Microsoft.Quantum.Math/ExtendedTruncation.md +18 -0
- package/docs/Microsoft.Quantum.Math/FactorialI.md +1 -1
- package/docs/Microsoft.Quantum.Math/FactorialL.md +1 -1
- package/docs/Microsoft.Quantum.Math/Floor.md +1 -1
- package/docs/Microsoft.Quantum.Math/GreatestCommonDivisorI.md +1 -1
- package/docs/Microsoft.Quantum.Math/GreatestCommonDivisorL.md +1 -1
- package/docs/Microsoft.Quantum.Math/HammingWeightI.md +1 -1
- package/docs/Microsoft.Quantum.Math/InverseModI.md +1 -1
- package/docs/Microsoft.Quantum.Math/InverseModL.md +1 -1
- package/docs/Microsoft.Quantum.Math/IsCoprimeI.md +1 -1
- package/docs/Microsoft.Quantum.Math/IsCoprimeL.md +1 -1
- package/docs/Microsoft.Quantum.Math/IsInfinite.md +1 -1
- package/docs/Microsoft.Quantum.Math/IsNaN.md +1 -1
- package/docs/Microsoft.Quantum.Math/LargestFixedPoint.md +1 -1
- package/docs/Microsoft.Quantum.Math/Lg.md +1 -1
- package/docs/Microsoft.Quantum.Math/Log.md +1 -1
- package/docs/Microsoft.Quantum.Math/Log10.md +1 -1
- package/docs/Microsoft.Quantum.Math/LogFactorialD.md +1 -1
- package/docs/Microsoft.Quantum.Math/LogGammaD.md +1 -1
- package/docs/Microsoft.Quantum.Math/LogOf2.md +1 -1
- package/docs/Microsoft.Quantum.Math/Max.md +1 -1
- package/docs/Microsoft.Quantum.Math/MaxD.md +1 -1
- package/docs/Microsoft.Quantum.Math/MaxI.md +1 -1
- package/docs/Microsoft.Quantum.Math/MaxL.md +1 -1
- package/docs/Microsoft.Quantum.Math/Min.md +1 -1
- package/docs/Microsoft.Quantum.Math/MinD.md +1 -1
- package/docs/Microsoft.Quantum.Math/MinI.md +1 -1
- package/docs/Microsoft.Quantum.Math/MinL.md +1 -1
- package/docs/Microsoft.Quantum.Math/MinusC.md +1 -1
- package/docs/Microsoft.Quantum.Math/MinusCP.md +1 -1
- package/docs/Microsoft.Quantum.Math/ModulusI.md +1 -1
- package/docs/Microsoft.Quantum.Math/ModulusL.md +1 -1
- package/docs/Microsoft.Quantum.Math/NegationC.md +1 -1
- package/docs/Microsoft.Quantum.Math/NegationCP.md +1 -1
- package/docs/Microsoft.Quantum.Math/PI.md +1 -1
- package/docs/Microsoft.Quantum.Math/PNorm.md +1 -1
- package/docs/Microsoft.Quantum.Math/PNormalized.md +1 -1
- package/docs/Microsoft.Quantum.Math/PlusC.md +1 -1
- package/docs/Microsoft.Quantum.Math/PlusCP.md +1 -1
- package/docs/Microsoft.Quantum.Math/PowC.md +1 -1
- package/docs/Microsoft.Quantum.Math/PowCAsCP.md +24 -0
- package/docs/Microsoft.Quantum.Math/PowCP.md +1 -1
- package/docs/Microsoft.Quantum.Math/RealMod.md +1 -1
- package/docs/Microsoft.Quantum.Math/Round.md +1 -1
- package/docs/Microsoft.Quantum.Math/SignD.md +1 -1
- package/docs/Microsoft.Quantum.Math/SignI.md +1 -1
- package/docs/Microsoft.Quantum.Math/SignL.md +1 -1
- package/docs/Microsoft.Quantum.Math/Sin.md +1 -1
- package/docs/Microsoft.Quantum.Math/Sinh.md +1 -1
- package/docs/Microsoft.Quantum.Math/SmallestFixedPoint.md +1 -1
- package/docs/Microsoft.Quantum.Math/Sqrt.md +1 -1
- package/docs/Microsoft.Quantum.Math/SquaredNorm.md +1 -1
- package/docs/Microsoft.Quantum.Math/Tan.md +1 -1
- package/docs/Microsoft.Quantum.Math/Tanh.md +1 -1
- package/docs/Microsoft.Quantum.Math/TimesC.md +1 -1
- package/docs/Microsoft.Quantum.Math/TimesCP.md +1 -1
- package/docs/Microsoft.Quantum.Math/TrailingZeroCountI.md +1 -1
- package/docs/Microsoft.Quantum.Math/TrailingZeroCountL.md +1 -1
- package/docs/Microsoft.Quantum.Math/Truncate.md +1 -1
- package/docs/Microsoft.Quantum.Measurement/MResetEachZ.md +1 -1
- package/docs/Microsoft.Quantum.Measurement/MResetX.md +1 -1
- package/docs/Microsoft.Quantum.Measurement/MResetY.md +1 -1
- package/docs/Microsoft.Quantum.Measurement/MResetZ.md +1 -1
- package/docs/Microsoft.Quantum.Measurement/MeasureAllZ.md +1 -1
- package/docs/Microsoft.Quantum.Measurement/MeasureEachZ.md +1 -1
- package/docs/Microsoft.Quantum.Measurement/MeasureInteger.md +1 -1
- package/docs/Microsoft.Quantum.ResourceEstimation/AccountForEstimates.md +1 -1
- package/docs/Microsoft.Quantum.ResourceEstimation/AuxQubitCount.md +1 -1
- package/docs/Microsoft.Quantum.ResourceEstimation/BeginEstimateCaching.md +1 -1
- package/docs/Microsoft.Quantum.ResourceEstimation/BeginRepeatEstimates.md +1 -1
- package/docs/Microsoft.Quantum.ResourceEstimation/CczCount.md +1 -1
- package/docs/Microsoft.Quantum.ResourceEstimation/EndEstimateCaching.md +1 -1
- package/docs/Microsoft.Quantum.ResourceEstimation/EndRepeatEstimates.md +1 -1
- package/docs/Microsoft.Quantum.ResourceEstimation/MeasurementCount.md +1 -1
- package/docs/Microsoft.Quantum.ResourceEstimation/PSSPCLayout.md +1 -1
- package/docs/Microsoft.Quantum.ResourceEstimation/RepeatEstimates.md +1 -1
- package/docs/Microsoft.Quantum.ResourceEstimation/RotationCount.md +1 -1
- package/docs/Microsoft.Quantum.ResourceEstimation/RotationDepth.md +1 -1
- package/docs/Microsoft.Quantum.ResourceEstimation/SingleVariant.md +1 -1
- package/docs/Microsoft.Quantum.ResourceEstimation/TCount.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/AddLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyActionIfGreaterThanOrEqualConstant.md +23 -0
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyActionIfSumOverflows.md +23 -0
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyAsSinglyControlled.md +24 -0
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfEqualL.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfEqualLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfGreaterL.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfGreaterLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfGreaterOrEqualL.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfGreaterOrEqualLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfLessL.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfLessLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfLessOrEqualL.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfLessOrEqualLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/FourierTDIncByLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/IncByI.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/IncByIUsingIncByLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/IncByL.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/IncByLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/IncByLEUsingAddLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/IncByLUsingIncByLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/LookAheadDKRSAddLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/MAJ.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/PhaseGradient.md +18 -0
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ReflectAboutInteger.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/RippleCarryCGAddLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/RippleCarryCGIncByLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/RippleCarryTTKIncByLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.StatePreparation/ApproximatelyPreparePureStateCP.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.StatePreparation/PreparePureStateD.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.TableLookup/EncodeUnary.md +18 -0
- package/docs/Microsoft.Quantum.Unstable.TableLookup/MustBeFixed.md +18 -0
- package/docs/Microsoft.Quantum.Unstable.TableLookup/Select.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.TableLookup/Unlookup.md +22 -0
- package/docs/Microsoft.Quantum.Unstable.TableLookup/WriteMemoryContents.md +18 -0
- package/docs/toc.yml +31 -1
- package/lib/node/qsc_wasm.cjs +55 -32
- package/lib/node/qsc_wasm.d.cts +23 -11
- package/lib/node/qsc_wasm_bg.wasm +0 -0
- package/lib/web/qsc_wasm.d.ts +24 -12
- package/lib/web/qsc_wasm.js +49 -30
- package/lib/web/qsc_wasm_bg.wasm +0 -0
- package/package.json +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/AND.md +0 -33
|
@@ -81,7 +81,9 @@ export default {
|
|
|
81
81
|
"content": "**Input:** An even integer $n$ (can be negative).\n\n**Goal:** Return the $n$-th power of $i$ ($i^n$).\n"
|
|
82
82
|
},
|
|
83
83
|
"sourceIds": [
|
|
84
|
-
"complex_arithmetic__powers_of_i__Verification.qs"
|
|
84
|
+
"complex_arithmetic__powers_of_i__Verification.qs",
|
|
85
|
+
"KatasLibrary.qs",
|
|
86
|
+
"complex_arithmetic__Common.qs"
|
|
85
87
|
],
|
|
86
88
|
"placeholderCode": "namespace Kata {\n function PowersOfI(n : Int) : Int {\n // Replace the return values with correct answers.\n if n % 4 == 0 {\n return 0;\n } else {\n return 0;\n }\n }\n}\n",
|
|
87
89
|
"explainedSolution": {
|
|
@@ -120,6 +122,7 @@ export default {
|
|
|
120
122
|
},
|
|
121
123
|
"sourceIds": [
|
|
122
124
|
"complex_arithmetic__complex_addition__Verification.qs",
|
|
125
|
+
"KatasLibrary.qs",
|
|
123
126
|
"complex_arithmetic__Common.qs"
|
|
124
127
|
],
|
|
125
128
|
"placeholderCode": "namespace Kata { \n open Microsoft.Quantum.Math;\n \n function ComplexAdd(x : Complex, y : Complex) : Complex { \n // Extract real and imaginary components of the inputs.\n let (a, b) = x!;\n let (c, d) = (y::Real, y::Imag);\n // Implement your solution here...\n return Complex(0., 0.);\n }\n}\n",
|
|
@@ -148,6 +151,7 @@ export default {
|
|
|
148
151
|
},
|
|
149
152
|
"sourceIds": [
|
|
150
153
|
"complex_arithmetic__complex_multiplication__Verification.qs",
|
|
154
|
+
"KatasLibrary.qs",
|
|
151
155
|
"complex_arithmetic__Common.qs"
|
|
152
156
|
],
|
|
153
157
|
"placeholderCode": "namespace Kata {\n open Microsoft.Quantum.Math;\n \n function ComplexMult(x : Complex, y: Complex) : Complex {\n // Implement your solution here...\n return Complex(0., 0.);\n }\n}\n",
|
|
@@ -187,6 +191,7 @@ export default {
|
|
|
187
191
|
},
|
|
188
192
|
"sourceIds": [
|
|
189
193
|
"complex_arithmetic__complex_conjugate__Verification.qs",
|
|
194
|
+
"KatasLibrary.qs",
|
|
190
195
|
"complex_arithmetic__Common.qs"
|
|
191
196
|
],
|
|
192
197
|
"placeholderCode": "namespace Kata { \n open Microsoft.Quantum.Math;\n \n function ComplexConjugate(x : Complex) : Complex { \n // Implement your solution here...\n return Complex(0., 0.);\n }\n}\n",
|
|
@@ -226,6 +231,7 @@ export default {
|
|
|
226
231
|
},
|
|
227
232
|
"sourceIds": [
|
|
228
233
|
"complex_arithmetic__complex_division__Verification.qs",
|
|
234
|
+
"KatasLibrary.qs",
|
|
229
235
|
"complex_arithmetic__Common.qs"
|
|
230
236
|
],
|
|
231
237
|
"placeholderCode": "namespace Kata {\n open Microsoft.Quantum.Math; \n \n function ComplexDiv(x : Complex, y : Complex) : Complex {\n // Implement your solution here...\n return Complex(0., 0.);\n }\n}\n",
|
|
@@ -265,6 +271,7 @@ export default {
|
|
|
265
271
|
},
|
|
266
272
|
"sourceIds": [
|
|
267
273
|
"complex_arithmetic__complex_modulus__Verification.qs",
|
|
274
|
+
"KatasLibrary.qs",
|
|
268
275
|
"complex_arithmetic__Common.qs"
|
|
269
276
|
],
|
|
270
277
|
"placeholderCode": "namespace Kata {\n open Microsoft.Quantum.Math;\n \n function ComplexModulus(x : Complex) : Double {\n // Implement your solution here...\n return 0.;\n }\n}\n",
|
|
@@ -304,6 +311,7 @@ export default {
|
|
|
304
311
|
},
|
|
305
312
|
"sourceIds": [
|
|
306
313
|
"complex_arithmetic__complex_exponents__Verification.qs",
|
|
314
|
+
"KatasLibrary.qs",
|
|
307
315
|
"complex_arithmetic__Common.qs"
|
|
308
316
|
],
|
|
309
317
|
"placeholderCode": "namespace Kata {\n open Microsoft.Quantum.Math;\n \n function ComplexExponent(x : Complex) : Complex {\n // Implement your solution here...\n return Complex(0.0, 0.0);\n }\n}\n",
|
|
@@ -332,6 +340,7 @@ export default {
|
|
|
332
340
|
},
|
|
333
341
|
"sourceIds": [
|
|
334
342
|
"complex_arithmetic__complex_powers_real__Verification.qs",
|
|
343
|
+
"KatasLibrary.qs",
|
|
335
344
|
"complex_arithmetic__Common.qs"
|
|
336
345
|
],
|
|
337
346
|
"placeholderCode": "namespace Kata {\n open Microsoft.Quantum.Math;\n\n function ComplexExpReal (r : Double, x : Complex) : Complex {\n // Implement your solution here...\n return Complex(0.0, 0.0);\n }\n}\n",
|
|
@@ -371,6 +380,7 @@ export default {
|
|
|
371
380
|
},
|
|
372
381
|
"sourceIds": [
|
|
373
382
|
"complex_arithmetic__cartesian_to_polar__Verification.qs",
|
|
383
|
+
"KatasLibrary.qs",
|
|
374
384
|
"complex_arithmetic__Common.qs"
|
|
375
385
|
],
|
|
376
386
|
"placeholderCode": "namespace Kata {\n open Microsoft.Quantum.Math;\n \n function ComplexToComplexPolar(x : Complex) : ComplexPolar {\n // Implement your solution here...\n return ComplexPolar(0., 0.);\n }\n}\n",
|
|
@@ -399,6 +409,7 @@ export default {
|
|
|
399
409
|
},
|
|
400
410
|
"sourceIds": [
|
|
401
411
|
"complex_arithmetic__polar_to_cartesian__Verification.qs",
|
|
412
|
+
"KatasLibrary.qs",
|
|
402
413
|
"complex_arithmetic__Common.qs"
|
|
403
414
|
],
|
|
404
415
|
"placeholderCode": "namespace Kata {\n open Microsoft.Quantum.Math;\n \n function ComplexPolarToComplex(x : ComplexPolar) : Complex {\n // Implement your solution here...\n return Complex(0., 0.);\n }\n}\n",
|
|
@@ -427,6 +438,7 @@ export default {
|
|
|
427
438
|
},
|
|
428
439
|
"sourceIds": [
|
|
429
440
|
"complex_arithmetic__polar_multiplication__Verification.qs",
|
|
441
|
+
"KatasLibrary.qs",
|
|
430
442
|
"complex_arithmetic__Common.qs"
|
|
431
443
|
],
|
|
432
444
|
"placeholderCode": "namespace Kata {\n open Microsoft.Quantum.Math;\n \n function ComplexPolarMult(x : ComplexPolar, y: ComplexPolar) : ComplexPolar {\n // Implement your solution here...\n return ComplexPolar(0., 0.);\n }\n}\n",
|
|
@@ -506,6 +518,7 @@ export default {
|
|
|
506
518
|
},
|
|
507
519
|
"sourceIds": [
|
|
508
520
|
"linear_algebra__addition__Verification.qs",
|
|
521
|
+
"KatasLibrary.qs",
|
|
509
522
|
"linear_algebra__Common.qs"
|
|
510
523
|
],
|
|
511
524
|
"placeholderCode": "namespace Kata {\n function Addition() : Double[][] {\n // Replace the return value with correct answer.\n return [[0., 0.],\n [0., 0.]];\n }\n}\n",
|
|
@@ -545,6 +558,7 @@ export default {
|
|
|
545
558
|
},
|
|
546
559
|
"sourceIds": [
|
|
547
560
|
"linear_algebra__scalar_multiplication__Verification.qs",
|
|
561
|
+
"KatasLibrary.qs",
|
|
548
562
|
"linear_algebra__Common.qs"
|
|
549
563
|
],
|
|
550
564
|
"placeholderCode": "namespace Kata {\n function ScalarMultiplication() : Double[][] {\n // Replace the return value with correct answer.\n return [[0., 0.],\n [0., 0.]];\n }\n}\n",
|
|
@@ -584,6 +598,7 @@ export default {
|
|
|
584
598
|
},
|
|
585
599
|
"sourceIds": [
|
|
586
600
|
"linear_algebra__multiplication__Verification.qs",
|
|
601
|
+
"KatasLibrary.qs",
|
|
587
602
|
"linear_algebra__Common.qs"
|
|
588
603
|
],
|
|
589
604
|
"placeholderCode": "namespace Kata {\n function Multiplication() : Double[][] {\n // Replace the return value with correct answer.\n return [[0., 0.],\n [0., 0.]];\n }\n}\n",
|
|
@@ -623,6 +638,7 @@ export default {
|
|
|
623
638
|
},
|
|
624
639
|
"sourceIds": [
|
|
625
640
|
"linear_algebra__inverse__Verification.qs",
|
|
641
|
+
"KatasLibrary.qs",
|
|
626
642
|
"linear_algebra__Common.qs"
|
|
627
643
|
],
|
|
628
644
|
"placeholderCode": "namespace Kata {\n function Inverse() : Double[][] {\n // Replace the return value with correct answer.\n return [[0., 0.],\n [0., 0.]];\n }\n}\n",
|
|
@@ -662,6 +678,7 @@ export default {
|
|
|
662
678
|
},
|
|
663
679
|
"sourceIds": [
|
|
664
680
|
"linear_algebra__transpose__Verification.qs",
|
|
681
|
+
"KatasLibrary.qs",
|
|
665
682
|
"linear_algebra__Common.qs"
|
|
666
683
|
],
|
|
667
684
|
"placeholderCode": "namespace Kata {\n function Transpose() : Double[][] {\n // Replace the return value with correct answer.\n return [[0., 0.],\n [0., 0.]];\n }\n}\n",
|
|
@@ -701,6 +718,7 @@ export default {
|
|
|
701
718
|
},
|
|
702
719
|
"sourceIds": [
|
|
703
720
|
"linear_algebra__conjugate__Verification.qs",
|
|
721
|
+
"KatasLibrary.qs",
|
|
704
722
|
"linear_algebra__Common.qs"
|
|
705
723
|
],
|
|
706
724
|
"placeholderCode": "namespace Kata {\n open Microsoft.Quantum.Math;\n\n function Conjugate() : Complex[][] {\n // Replace the return value with correct answer.\n return [[Complex(0., 0.), Complex(0., 0.)],\n [Complex(0., 0.), Complex(0., 0.)]];\n }\n}\n",
|
|
@@ -740,6 +758,7 @@ export default {
|
|
|
740
758
|
},
|
|
741
759
|
"sourceIds": [
|
|
742
760
|
"linear_algebra__adjoint__Verification.qs",
|
|
761
|
+
"KatasLibrary.qs",
|
|
743
762
|
"linear_algebra__Common.qs"
|
|
744
763
|
],
|
|
745
764
|
"placeholderCode": "namespace Kata {\n open Microsoft.Quantum.Math;\n\n function MatrixAdjoint() : Complex[][] {\n // Replace the return value with correct answer.\n return [[Complex(0., 0.), Complex(0., 0.)],\n [Complex(0., 0.), Complex(0., 0.)]];\n }\n}\n",
|
|
@@ -790,6 +809,7 @@ export default {
|
|
|
790
809
|
},
|
|
791
810
|
"sourceIds": [
|
|
792
811
|
"linear_algebra__inner_product__Verification.qs",
|
|
812
|
+
"KatasLibrary.qs",
|
|
793
813
|
"linear_algebra__Common.qs"
|
|
794
814
|
],
|
|
795
815
|
"placeholderCode": "namespace Kata {\n open Microsoft.Quantum.Math;\n\n function InnerProduct() : Complex {\n // Replace the return value with correct answer.\n return Complex(0., 0.);\n }\n}\n",
|
|
@@ -818,6 +838,7 @@ export default {
|
|
|
818
838
|
},
|
|
819
839
|
"sourceIds": [
|
|
820
840
|
"linear_algebra__normalized_vector__Verification.qs",
|
|
841
|
+
"KatasLibrary.qs",
|
|
821
842
|
"linear_algebra__Common.qs"
|
|
822
843
|
],
|
|
823
844
|
"placeholderCode": "namespace Kata {\n open Microsoft.Quantum.Math;\n\n function NormalizedVector() : Complex[][] {\n // Replace the return value with correct answer.\n return [[Complex(0., 0.)],\n [Complex(0., 0.)]];\n }\n}\n",
|
|
@@ -857,6 +878,7 @@ export default {
|
|
|
857
878
|
},
|
|
858
879
|
"sourceIds": [
|
|
859
880
|
"linear_algebra__outer_product__Verification.qs",
|
|
881
|
+
"KatasLibrary.qs",
|
|
860
882
|
"linear_algebra__Common.qs"
|
|
861
883
|
],
|
|
862
884
|
"placeholderCode": "namespace Kata {\n open Microsoft.Quantum.Math;\n\n function OuterProduct() : Complex[][] {\n // Replace the return value with correct answer.\n return [[Complex(0., 0.), Complex(0., 0.)],\n [Complex(0., 0.), Complex(0., 0.)]];\n }\n}\n",
|
|
@@ -896,6 +918,7 @@ export default {
|
|
|
896
918
|
},
|
|
897
919
|
"sourceIds": [
|
|
898
920
|
"linear_algebra__tensor_product__Verification.qs",
|
|
921
|
+
"KatasLibrary.qs",
|
|
899
922
|
"linear_algebra__Common.qs"
|
|
900
923
|
],
|
|
901
924
|
"placeholderCode": "namespace Kata {\n function TensorProduct() : Double[][] {\n // Replace the return value with correct answer.\n return [[0., 0., 0., 0.],\n [0., 0., 0., 0.],\n [0., 0., 0., 0.],\n [0., 0., 0., 0.]];\n }\n}\n",
|
|
@@ -3018,7 +3041,8 @@ export default {
|
|
|
3018
3041
|
},
|
|
3019
3042
|
"sourceIds": [
|
|
3020
3043
|
"preparing_states__wstate_power_of_two__Verification.qs",
|
|
3021
|
-
"KatasLibrary.qs"
|
|
3044
|
+
"KatasLibrary.qs",
|
|
3045
|
+
"preparing_states__Common.qs"
|
|
3022
3046
|
],
|
|
3023
3047
|
"placeholderCode": "namespace Kata {\n operation WState_PowerOfTwo (qs : Qubit[]) : Unit {\n // Implement your solution here...\n\n }\n}\n",
|
|
3024
3048
|
"explainedSolution": {
|
|
@@ -3055,7 +3079,8 @@ export default {
|
|
|
3055
3079
|
},
|
|
3056
3080
|
"sourceIds": [
|
|
3057
3081
|
"preparing_states__wstate_arbitrary__Verification.qs",
|
|
3058
|
-
"KatasLibrary.qs"
|
|
3082
|
+
"KatasLibrary.qs",
|
|
3083
|
+
"preparing_states__Common.qs"
|
|
3059
3084
|
],
|
|
3060
3085
|
"placeholderCode": "namespace Kata {\n operation WState_Arbitrary (qs : Qubit[]) : Unit {\n // Implement your solution here...\n\n }\n}\n",
|
|
3061
3086
|
"explainedSolution": {
|
|
@@ -3672,7 +3697,8 @@ export default {
|
|
|
3672
3697
|
},
|
|
3673
3698
|
"sourceIds": [
|
|
3674
3699
|
"distinguishing_states__zero_one__Verification.qs",
|
|
3675
|
-
"KatasLibrary.qs"
|
|
3700
|
+
"KatasLibrary.qs",
|
|
3701
|
+
"distinguishing_states__Common.qs"
|
|
3676
3702
|
],
|
|
3677
3703
|
"placeholderCode": "namespace Kata {\n operation IsQubitOne (q : Qubit) : Bool {\n // Implement your solution here...\n\n return false;\n }\n}\n",
|
|
3678
3704
|
"explainedSolution": {
|
|
@@ -3700,7 +3726,8 @@ export default {
|
|
|
3700
3726
|
},
|
|
3701
3727
|
"sourceIds": [
|
|
3702
3728
|
"distinguishing_states__plus_minus__Verification.qs",
|
|
3703
|
-
"KatasLibrary.qs"
|
|
3729
|
+
"KatasLibrary.qs",
|
|
3730
|
+
"distinguishing_states__Common.qs"
|
|
3704
3731
|
],
|
|
3705
3732
|
"placeholderCode": "namespace Kata {\n operation IsQubitPlus(q : Qubit) : Bool {\n // Implement your solution here...\n\n return false;\n }\n}\n",
|
|
3706
3733
|
"explainedSolution": {
|
|
@@ -3737,7 +3764,8 @@ export default {
|
|
|
3737
3764
|
},
|
|
3738
3765
|
"sourceIds": [
|
|
3739
3766
|
"distinguishing_states__a_b__Verification.qs",
|
|
3740
|
-
"KatasLibrary.qs"
|
|
3767
|
+
"KatasLibrary.qs",
|
|
3768
|
+
"distinguishing_states__Common.qs"
|
|
3741
3769
|
],
|
|
3742
3770
|
"placeholderCode": "namespace Kata {\n operation IsQubitA(alpha : Double, q : Qubit) : Bool {\n // Implement your solution here...\n\n return false;\n }\n}\n",
|
|
3743
3771
|
"explainedSolution": {
|
|
@@ -3765,7 +3793,8 @@ export default {
|
|
|
3765
3793
|
},
|
|
3766
3794
|
"sourceIds": [
|
|
3767
3795
|
"distinguishing_states__zerozero_oneone__Verification.qs",
|
|
3768
|
-
"KatasLibrary.qs"
|
|
3796
|
+
"KatasLibrary.qs",
|
|
3797
|
+
"distinguishing_states__Common.qs"
|
|
3769
3798
|
],
|
|
3770
3799
|
"placeholderCode": "namespace Kata {\n operation ZeroZeroOrOneOne(qs : Qubit[]) : Int {\n // Implement your solution here...\n\n return 0;\n }\n}\n",
|
|
3771
3800
|
"explainedSolution": {
|
|
@@ -3976,7 +4005,8 @@ export default {
|
|
|
3976
4005
|
},
|
|
3977
4006
|
"sourceIds": [
|
|
3978
4007
|
"distinguishing_states__four_bell_states__Verification.qs",
|
|
3979
|
-
"KatasLibrary.qs"
|
|
4008
|
+
"KatasLibrary.qs",
|
|
4009
|
+
"distinguishing_states__Common.qs"
|
|
3980
4010
|
],
|
|
3981
4011
|
"placeholderCode": "namespace Kata {\n operation BellState(qs : Qubit[]) : Int {\n // Implement your solution here...\n\n return -1;\n }\n}\n",
|
|
3982
4012
|
"explainedSolution": {
|
|
@@ -4102,7 +4132,8 @@ export default {
|
|
|
4102
4132
|
},
|
|
4103
4133
|
"sourceIds": [
|
|
4104
4134
|
"distinguishing_states__zero_plus__Verification.qs",
|
|
4105
|
-
"KatasLibrary.qs"
|
|
4135
|
+
"KatasLibrary.qs",
|
|
4136
|
+
"distinguishing_states__Common.qs"
|
|
4106
4137
|
],
|
|
4107
4138
|
"placeholderCode": "namespace Kata {\n operation IsQubitZeroOrPlus (q : Qubit) : Bool {\n // Implement your solution here...\n return true;\n }\n}\n",
|
|
4108
4139
|
"explainedSolution": {
|
|
@@ -4130,7 +4161,8 @@ export default {
|
|
|
4130
4161
|
},
|
|
4131
4162
|
"sourceIds": [
|
|
4132
4163
|
"distinguishing_states__zero_plus_inc__Verification.qs",
|
|
4133
|
-
"KatasLibrary.qs"
|
|
4164
|
+
"KatasLibrary.qs",
|
|
4165
|
+
"distinguishing_states__Common.qs"
|
|
4134
4166
|
],
|
|
4135
4167
|
"placeholderCode": "namespace Kata {\n operation IsQubitZeroPlusOrInconclusive(q : Qubit) : Int {\n // Implement your solution here...\n return -2;\n }\n}\n",
|
|
4136
4168
|
"explainedSolution": {
|
|
@@ -4158,7 +4190,8 @@ export default {
|
|
|
4158
4190
|
},
|
|
4159
4191
|
"sourceIds": [
|
|
4160
4192
|
"distinguishing_states__peres_wooters_game__Verification.qs",
|
|
4161
|
-
"KatasLibrary.qs"
|
|
4193
|
+
"KatasLibrary.qs",
|
|
4194
|
+
"distinguishing_states__Common.qs"
|
|
4162
4195
|
],
|
|
4163
4196
|
"placeholderCode": "namespace Kata {\n operation IsQubitNotInABC(q : Qubit) : Int {\n // Implement your solution here...\n return -1;\n }\n}",
|
|
4164
4197
|
"explainedSolution": {
|
|
@@ -4867,7 +4900,9 @@ export default {
|
|
|
4867
4900
|
"content": "**Input:** An integer $N$.\n\n**Output** : A `Bool` array of length N, where each element is chosen at random as `true` or `false` with $50\\%$ probability.\n\n> This will be used by both Alice and Bob to choose either the sequence of bits to send or the sequence of bases \n> to use when encoding/measuring the bits.\n"
|
|
4868
4901
|
},
|
|
4869
4902
|
"sourceIds": [
|
|
4870
|
-
"key_distribution__random_array__Verification.qs"
|
|
4903
|
+
"key_distribution__random_array__Verification.qs",
|
|
4904
|
+
"KatasLibrary.qs",
|
|
4905
|
+
"key_distribution__Common.qs"
|
|
4871
4906
|
],
|
|
4872
4907
|
"placeholderCode": "namespace Kata {\n operation RandomArray(N : Int) : Bool[] {\n // Create a mutable array variable for storing the return value.\n mutable s = [];\n\n // Implement your solution here...\n\n return s;\n }\n}\n",
|
|
4873
4908
|
"explainedSolution": {
|
|
@@ -4895,6 +4930,7 @@ export default {
|
|
|
4895
4930
|
},
|
|
4896
4931
|
"sourceIds": [
|
|
4897
4932
|
"key_distribution__prepare_qubits__Verification.qs",
|
|
4933
|
+
"KatasLibrary.qs",
|
|
4898
4934
|
"key_distribution__Common.qs"
|
|
4899
4935
|
],
|
|
4900
4936
|
"placeholderCode": "namespace Kata {\n operation PrepareQubits(qs : Qubit[], bases : Bool[], bits : Bool[]) : Unit {\n // Implement your solution here...\n\n }\n}\n",
|
|
@@ -4919,10 +4955,11 @@ export default {
|
|
|
4919
4955
|
"title": "Measure Qubits (Bob's Task)",
|
|
4920
4956
|
"description": {
|
|
4921
4957
|
"type": "text-content",
|
|
4922
|
-
"content": "**Inputs:**\n\n1. `qs`: an array of $N$ qubits; \n each qubit is in one of the following states:
|
|
4958
|
+
"content": "**Inputs:**\n\n1. `qs`: an array of $N$ qubits; \n each qubit is in one of the following states: $\\ket{0}$, $\\ket{1}$, $\\ket{+}$, $\\ket{-}$. \n2. `bases`: a `Bool` array of length $N$; \n `bases[i]` indicates the basis that should be used to measure the qubit `i`:\n * `false`: use the basis $\\ket{0}$ / $\\ket{1}$ (computational),\n * `true`: use the basis $\\ket{+}$ / $\\ket{-}$ (Hadamard).\n\n**Goal:** Measure each qubit in the corresponding basis and return an array of results as Boolean values, encoding measurement result `Zero` as `false` and `One` as `true`. \nThe state of the qubits at the end of the operation does not matter.\n"
|
|
4923
4959
|
},
|
|
4924
4960
|
"sourceIds": [
|
|
4925
4961
|
"key_distribution__measure_qubits__Verification.qs",
|
|
4962
|
+
"KatasLibrary.qs",
|
|
4926
4963
|
"key_distribution__Common.qs"
|
|
4927
4964
|
],
|
|
4928
4965
|
"placeholderCode": "namespace Kata {\n operation MeasureQubits(qs : Qubit[], bases : Bool[]) : Bool[] {\n // Implement your solution here...\n return [];\n }\n}\n",
|
|
@@ -4951,6 +4988,7 @@ export default {
|
|
|
4951
4988
|
},
|
|
4952
4989
|
"sourceIds": [
|
|
4953
4990
|
"key_distribution__shared_key__Verification.qs",
|
|
4991
|
+
"KatasLibrary.qs",
|
|
4954
4992
|
"key_distribution__Common.qs"
|
|
4955
4993
|
],
|
|
4956
4994
|
"placeholderCode": "namespace Kata {\n function GenerateSharedKey(basesAlice : Bool[], basesBob : Bool[], bits : Bool[]) : Bool[] {\n // Create a mutable array variable for storing the key.\n mutable key = [];\n \n // Implement your solution here...\n\n return key;\n }\n}\n",
|
|
@@ -5530,6 +5568,7 @@ export default {
|
|
|
5530
5568
|
},
|
|
5531
5569
|
"sourceIds": [
|
|
5532
5570
|
"superdense_coding__alice_sends_message__Verification.qs",
|
|
5571
|
+
"KatasLibrary.qs",
|
|
5533
5572
|
"superdense_coding__Common.qs"
|
|
5534
5573
|
],
|
|
5535
5574
|
"placeholderCode": "namespace Kata {\n operation EncodeMessageInQubit(qAlice : Qubit, message : (Bool, Bool)) : Unit {\n // Get the bits from the message\n let (bit1, bit2) = message;\n\n // Implement your solution here...\n\n }\n}\n",
|
|
@@ -5558,6 +5597,7 @@ export default {
|
|
|
5558
5597
|
},
|
|
5559
5598
|
"sourceIds": [
|
|
5560
5599
|
"superdense_coding__bob_decodes_message__Verification.qs",
|
|
5600
|
+
"KatasLibrary.qs",
|
|
5561
5601
|
"superdense_coding__Common.qs"
|
|
5562
5602
|
],
|
|
5563
5603
|
"placeholderCode": "namespace Kata {\n operation DecodeMessageFromQubits(qAlice : Qubit, qBob : Qubit) : (Bool, Bool) {\n // Implement your solution here...\n\n return (false, false);\n }\n}\n",
|
|
@@ -5586,6 +5626,7 @@ export default {
|
|
|
5586
5626
|
},
|
|
5587
5627
|
"sourceIds": [
|
|
5588
5628
|
"superdense_coding__protocol_e2e__Verification.qs",
|
|
5629
|
+
"KatasLibrary.qs",
|
|
5589
5630
|
"superdense_coding__Common.qs"
|
|
5590
5631
|
],
|
|
5591
5632
|
"placeholderCode": "namespace Kata {\n operation SuperdenseCodingProtocol(message : (Bool, Bool)) : (Bool, Bool) {\n // Implement your solution here...\n\n return (false, false);\n }\n\n // You might find these helper operations from earlier tasks useful.\n operation CreateEntangledPair(qAlice : Qubit, qBob : Qubit) : Unit is Adj {\n H(qAlice);\n CNOT(qAlice, qBob);\n }\n\n operation EncodeMessageInQubit(qAlice : Qubit, message : (Bool, Bool)) : Unit {\n let (bit1, bit2) = message;\n\n if bit2 {\n X(qAlice);\n }\n\n if bit1 {\n Z(qAlice);\n }\n }\n\n operation DecodeMessageFromQubits(qAlice : Qubit, qBob : Qubit) : (Bool, Bool) {\n CNOT(qAlice, qBob);\n H(qAlice);\n return (MResetZ(qAlice) == One, MResetZ(qBob) == One);\n }\n}\n",
|
|
@@ -6533,7 +6574,7 @@ export default {
|
|
|
6533
6574
|
"items": [
|
|
6534
6575
|
{
|
|
6535
6576
|
"type": "text-content",
|
|
6536
|
-
"content": "\nThis kata introduces you to Deutsch algorithm - the single-qubit variant of Deutsch–Jozsa algorithm, one of the most famous educational algorithms in quantum computing.\n\n**This kata covers the following topics:**\n\n- The problem solved by Deutsch algorithm and the classical solution to it\n- Single-qubit phase oracles (for a more detailed introduction to phase oracles, see Oracles kata)\n- Deutsch algorithm\n- Implementing oracles and end-to-end Deutsch algorithm in Q#\n\n**What you should know to start working on this kata:**\n\n- Basic single-qubit gates\n-
|
|
6577
|
+
"content": "\nThis kata introduces you to Deutsch algorithm - the single-qubit variant of Deutsch–Jozsa algorithm, one of the most famous educational algorithms in quantum computing.\n\n**This kata covers the following topics:**\n\n- The problem solved by Deutsch algorithm and the classical solution to it\n- Single-qubit phase oracles (for a more detailed introduction to phase oracles, see Oracles kata)\n- Deutsch algorithm\n- Implementing oracles and end-to-end Deutsch algorithm in Q#\n\n**What you should know to start working on this kata:**\n\n- Basic knowledge of single-qubit gates\n- Basic knowledge of quantum measurements"
|
|
6537
6578
|
}
|
|
6538
6579
|
]
|
|
6539
6580
|
},
|
|
@@ -6544,7 +6585,7 @@ export default {
|
|
|
6544
6585
|
"items": [
|
|
6545
6586
|
{
|
|
6546
6587
|
"type": "text-content",
|
|
6547
|
-
"content": "\nYou are given a classical function that takes one bit as an input and returns one bit: $f(x): \\{0, 1\\} \\to \\{0, 1\\}$. You are guaranteed that the function $f$ is\n\n- either *constant* (returns the same value for all inputs) \n- or *variable* (returns different values for different inputs). \n\nThe task is to figure out whether the function is constant or variable. In other words, you need to decide whether $f(0) = f(1)$ (which is the same as the function being constant for single-bit functions).\n\n**Examples**\n\n- $f(x) \\equiv 0$ or $f(x) \\equiv 1$ are constant functions (and they are actually the only constant functions in existence).\n- $f(x) = x$ and $f(x) = 1 - x$ are the only variable functions (and they are the only variable functions for single-bit functions).\n\nIf
|
|
6588
|
+
"content": "\nYou are given a classical function that takes one bit as an input and returns one bit: $f(x): \\{0, 1\\} \\to \\{0, 1\\}$. You are guaranteed that the function $f$ is\n\n- either *constant* (returns the same value for all inputs) \n- or *variable* (returns different values for different inputs). \n\nThe task is to figure out whether the function is constant or variable. In other words, you need to decide whether $f(0) = f(1)$ (which is the same as the function being constant for single-bit functions).\n\n**Examples**\n\n- $f(x) \\equiv 0$ or $f(x) \\equiv 1$ are constant functions (and they are actually the only constant functions in existence).\n- $f(x) = x$ and $f(x) = 1 - x$ are the only variable functions (and they are the only variable functions for single-bit functions).\n\nIf you solve this problem classically, how many calls to the given function will you need? \n\nThe first function call will give you no information - regardless of whether it returns $0$ or $1$, the function could still be constant or variable.\nYou'll need to call the function a second time to evaluate its return values for both possible inputs to be able to check whether these values are equal.\nThis means that the classical solution requires **2** function calls.\n\nWhat about the quantum scenario?"
|
|
6548
6589
|
}
|
|
6549
6590
|
]
|
|
6550
6591
|
},
|
|
@@ -6555,7 +6596,7 @@ export default {
|
|
|
6555
6596
|
"items": [
|
|
6556
6597
|
{
|
|
6557
6598
|
"type": "text-content",
|
|
6558
|
-
"content": "\nIn the quantum scenario, the classical function
|
|
6599
|
+
"content": "\nIn the quantum scenario, the classical function you're working with is implemented as a quantum oracle - a \"black box\" operation used as input to another algorithm. This operation is implemented in a way which allows to perform calculations not only on individual inputs, but also on superpositions of inputs. \n\nThe oracle has to act on quantum states instead of classical values. \nTo enable this, integer input $x$ is represented as a qubit state $\\ket{x}$.\n\nThe type of oracles used in this tutorial are called *phase oracles*. A phase oracle $U_f$ encodes the value of the classical function $f$ it implements in the phase of the qubit state as follows:\n\n$$U_f \\ket{x} = (-1)^{f(x)} \\ket{x}$$\n\nIn our case $f$ can return only two values, 0 or 1, which result in no phase change or multiplication by a relative phase $-1$, respectively.\n\nThe effect of such an oracle on any single basis state isn't particularly interesting: it just adds a global phase which isn't something you can observe. However, if you apply this oracle to a *superposition* of basis states, its effect becomes noticeable. \nRemember that quantum operations are linear: if you define the effect of an operation on the basis states, you'll be able to deduce its effect on superposition states (which are just linear combinations of the basis states) using its linearity.\n\nThere are only four single-bit functions, so you can see how to implement them all as phase oracles in Q#.\n\n1. $f(x) \\equiv 0$\n\nThis is the easiest function to implement: if $f(x) \\equiv 0$, \n\n$$U_f \\ket{x} \\equiv (-1)^0 \\ket{x} = \\ket{x}$$\n\nThis means that $U_f$ is an identity - a transformation which does absolutely nothing! \n\n2. $f(x) \\equiv 1$\n\nThe second constant function is slightly trickier: if $f(x) \\equiv 1$\n\n$$U_f \\ket{x} \\equiv (-1)^1 \\ket{x} = - \\ket{x}$$\n\nNow $U_f$ is a negative identity, that is, a transformation which applies a global phase of $-1$ to the state. \nA lot of algorithms just ignore the global phase accumulated in them, since it isn't observable. \nHowever, if you want to be really meticulous, you can use the $R$ gate which performs a given rotation around the given axis. \nWhen called with `PauliI` axis, this operation applies a global phase to the given qubit.\n\n3. $f(x) = x$\n\n$$U_f \\ket{x} = (-1)^{f(x)} \\ket{x} = (-1)^{x} \\ket{x}$$\n\nThis means that you don't need to do anything if the qubit is in the $\\ket{0}$ state, and apply a phase of $-1$ if it is in the $\\ket{1}$ state. This is exactly the effect of the $Z$ gate!\n\nIn the following demo, you'll see how to implement the first three one-bit functions as quantum oracles, and their effect on a qubit state.\nAfter that, you'll try to implement the oracle for the fourth function on your own!"
|
|
6559
6600
|
},
|
|
6560
6601
|
{
|
|
6561
6602
|
"type": "example",
|
|
@@ -6570,7 +6611,7 @@ export default {
|
|
|
6570
6611
|
"title": "Oracle for f(x) = 1 - x",
|
|
6571
6612
|
"description": {
|
|
6572
6613
|
"type": "text-content",
|
|
6573
|
-
"content": "**Input:** A qubit in an arbitrary state $\\ket{\\psi} = \\alpha\\ket{0} + \\beta\\ket{1}$.\n\n**Goal:** Apply the phase oracle $U_f$ for $f(x) = 1 - x$ to the qubit.\nThat is, apply a relative phase $(-1)^{f(x)}$ to each basis state $\\ket{x}$.\n\n<details>\n<summary><strong>Need a hint?</strong></summary>\
|
|
6614
|
+
"content": "**Input:** A qubit in an arbitrary state $\\ket{\\psi} = \\alpha\\ket{0} + \\beta\\ket{1}$.\n\n**Goal:** Apply the phase oracle $U_f$ for $f(x) = 1 - x$ to the qubit.\nThat is, apply a relative phase $(-1)^{f(x)}$ to each basis state $\\ket{x}$.\n\n<details>\n<summary><strong>Need a hint?</strong></summary>\nYou can represent the effect of the oracle as\n\n$$U_f \\ket{x} = (-1)^{1-x} \\ket{x} = (-1) \\cdot (-1)^x \\ket{x}$$\n\nCan you get this effect by combining some of the previous oracles implementations?\n</details>\n"
|
|
6574
6615
|
},
|
|
6575
6616
|
"sourceIds": [
|
|
6576
6617
|
"deutsch_algo__one_minus_x_oracle__Verification.qs",
|
|
@@ -6582,7 +6623,7 @@ export default {
|
|
|
6582
6623
|
"items": [
|
|
6583
6624
|
{
|
|
6584
6625
|
"type": "text-content",
|
|
6585
|
-
"content": "\
|
|
6626
|
+
"content": "\nYou can represent the effect of the oracle as\n\n$$U_f \\ket{x} = (-1)^{1-x} \\ket{x} = (-1) \\cdot (-1)^x \\ket{x}$$\n\nThis effect can be achieved as a combination of two oracles you've seen earlier, for functions $f(x) = 1$ and $f(x) = x$, applied consecutively."
|
|
6586
6627
|
},
|
|
6587
6628
|
{
|
|
6588
6629
|
"type": "solution",
|
|
@@ -6599,7 +6640,7 @@ export default {
|
|
|
6599
6640
|
"items": [
|
|
6600
6641
|
{
|
|
6601
6642
|
"type": "text-content",
|
|
6602
|
-
"content": "\nNow let's return to the problem of figuring out whether the given function is constant or variable for single-bit functions.\nWhat can we do if we are given a quantum oracle $U_f$ implementing the function $f(x)$?\n\nThere are two possible inputs to the function, $\\ket{0}$ and $\\ket{1}$. Let's see what happens if
|
|
6643
|
+
"content": "\nNow let's return to the problem of figuring out whether the given function is constant or variable for single-bit functions.\nWhat can we do if we are given a quantum oracle $U_f$ implementing the function $f(x)$?\n\nThere are two possible inputs to the function, $\\ket{0}$ and $\\ket{1}$. Let's see what happens if you apply the oracle to their superposition:\n\n$$U_f \\left( \\frac{1}{\\sqrt2} \\big( \\ket{0} + \\ket{1} \\big) \\right) \n= \\frac{1}{\\sqrt2} \\big( U_f \\ket{0} + U_f \\ket{1} \\big) \n= \\frac{1}{\\sqrt2} \\big( (-1)^{f(0)} \\ket{0} + (-1)^{f(1)} \\ket{1} \\big)$$.\n\n- If $f(0) = f(1)$, the relative phases of the two basis states are the same, and the resulting state is $\\ket{+} = \\frac{1}{\\sqrt2} \\big( \\ket{0} + \\ket{1} \\big)$ (up to a global phase). \n- If $f(0) \\neq f(1)$, the relative phases of the two basis states differ by a factor of $-1$, and the resulting state is $\\ket{-} = \\frac{1}{\\sqrt2} \\big( \\ket{0} - \\ket{1} \\big)$ (up to a global phase). \n\nNow, the states $\\ket{+}$ and $\\ket{-}$ can be distinguished using measurement: if you apply the H gate to each of them, you'll get $H\\ket{+} = \\ket{0}$ if $f(0) = f(1)$, or $H\\ket{-} = \\ket{1}$ if $f(0) \\neq f(1)$. This means that one oracle call doesn't let you calculate both $f(0)$ and $f(1)$, but it allows you to figure out whether $f(0) = f(1)$!\n\nOverall, the algorithm is very straightforward:\n\n1. Start with a qubit in the $\\ket{0}$ state.\n2. Apply the $H$ gate to the qubit.\n3. Apply the oracle.\n4. Apply the $H$ gate to the qubit again.\n5. Measure the qubit: if it's in the $\\ket{0}$ state, the function is constant, otherwise it's variable.\n\nNote that this algorithm requires only **1** oracle call, and always produces the correct result (the algorithm is deterministic)."
|
|
6603
6644
|
}
|
|
6604
6645
|
]
|
|
6605
6646
|
},
|
|
@@ -6610,7 +6651,7 @@ export default {
|
|
|
6610
6651
|
"items": [
|
|
6611
6652
|
{
|
|
6612
6653
|
"type": "text-content",
|
|
6613
|
-
"content": "\nWe can follow the steps of the algorithm for the constant and the balanced scenarios using a neat visualization. Since Deutsch algorithm deals only with states with real amplitudes, we can map all states on the unit circle, and follow the state evolution through the steps.\n\n1. Start with a qubit in the $\\ket{0}$ state and apply the $H$ gate to the qubit.\n <br/>\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg width=\"660\" height=\"334\" fill=\"none\" version=\"1.1\" viewBox=\"0 0 660 334\" xmlns=\"http://www.w3.org/2000/svg\"><g clip-path=\"url(#clip0_4_498)\"><g clip-rule=\"evenodd\" fill-rule=\"evenodd\"><path d=\"m7.1 146c0-76.8 62.3-139 139-139 76.8 0 139 62.3 139 139 0 76.8-62.3 139-139 139-76.8 0-139-62.3-139-139z\" stroke=\"#747474\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"/><g fill=\"#fff\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"><path d=\"m279 147c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\" stroke=\"#0070C0\"/><g stroke=\"#000\"><path d=\"m140 7.4c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9-2.64 5.9-5.9 5.9-5.9-2.64-5.9-5.9z\"/><path d=\"m1.3 147c0-3.26 2.64-5.9 5.9-5.9 3.26 0 5.9 2.64 5.9 5.9s-2.64 5.9-5.9 5.9c-3.26 0-5.9-2.64-5.9-5.9z\"/><path d=\"m140 286c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9-2.64 5.9-5.9 5.9-5.9-2.64-5.9-5.9z\"/></g></g><path d=\"m240 50.1c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9c0 3.26-2.69 5.9-6 5.9s-6-2.64-6-5.9z\" fill=\"#0070C0\"/><g fill=\"#fff\" stroke=\"#000\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"><path d=\"m240 243c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\"/><path d=\"m40.3 50.2c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9c0 3.26-2.69 5.9-6 5.9s-6-2.64-6-5.9z\"/><path d=\"m40.3 243c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\"/></g><path d=\"m358 146c0-76.8 62.2-139 139-139s139 62.3 139 139c0 76.8-62.2 139-139 139s-139-62.3-139-139z\" stroke=\"#747474\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"/><g fill=\"#fff\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"><path d=\"m630 147c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9-2.64 5.9-5.9 5.9-5.9-2.64-5.9-5.9z\" stroke=\"#0070C0\"/><g stroke=\"#000\"><path d=\"m491 7.4c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\"/><path d=\"m352 147c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\"/><path d=\"m491 286c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\"/></g></g><path d=\"m591 50.1c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9c0 3.26-2.64 5.9-5.9 5.9s-5.9-2.64-5.9-5.9z\" fill=\"#0070C0\"/><g fill=\"#fff\" stroke=\"#000\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"><path d=\"m591 243c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9-2.64 5.9-5.9 5.9-5.9-2.64-5.9-5.9z\"/><path d=\"m391 50.2c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9c0 3.26-2.64 5.9-5.9 5.9s-5.9-2.64-5.9-5.9z\"/><path d=\"m391 243c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9-2.64 5.9-5.9 5.9-5.9-2.64-5.9-5.9z\"/></g></g><path d=\"m120 319c-0.941 0.455-2.17 0.683-3.68 0.683-1.98 0-3.53-0.581-4.66-1.74s-1.7-2.71-1.7-4.64c0-2.06 0.635-3.73 1.9-5.01 1.28-1.28 2.93-1.92 4.96-1.92 1.26 0 2.32 0.159 3.18 0.476v2.79c-0.863-0.515-1.84-0.773-2.95-0.773-1.21 0-2.19 0.381-2.93 1.14-0.743 0.761-1.11 1.79-1.11 3.09 0 1.25 0.35 2.24 1.05 2.98 0.701 0.737 1.64 1.1 2.83 1.1 1.13 0 2.17-0.276 3.11-0.827v2.65zm6.35 0.683c-1.53 0-2.74-0.429-3.62-1.28-0.875-0.863-1.31-2.03-1.31-3.5 0-1.52 0.455-2.71 1.37-3.57 0.91-0.862 2.14-1.29 3.69-1.29 1.53 0 2.73 0.432 3.59 1.29 0.869 0.857 1.3 1.99 1.3 3.4 0 1.53-0.449 2.73-1.35 3.62-0.892 0.886-2.12 1.33-3.67 1.33zm0.071-7.48c-0.67 0-1.19 0.23-1.56 0.691-0.371 0.462-0.557 1.11-0.557 1.96 0 1.77 0.713 2.65 2.14 2.65 1.36 0 2.04-0.907 2.04-2.72 0-1.72-0.686-2.58-2.06-2.58zm15.7 7.25h-2.83v-5.11c0-1.43-0.509-2.14-1.53-2.14-0.491 0-0.896 0.188-1.21 0.566-0.318 0.377-0.476 0.856-0.476 1.44v5.25h-2.84v-9.2h2.84v1.46h0.036c0.676-1.12 1.66-1.68 2.96-1.68 2.04 0 3.05 1.26 3.05 3.79v5.63zm1.65-0.243v-2.3c0.468 0.282 0.932 0.492 1.39 0.629 0.467 0.138 0.907 0.207 1.32 0.207 0.503 0 0.898-0.069 1.19-0.207 0.293-0.137 0.44-0.347 0.44-0.629 0-0.179-0.066-0.329-0.198-0.449s-0.302-0.224-0.512-0.314c-0.204-0.09-0.428-0.171-0.674-0.243-0.245-0.072-0.482-0.153-0.71-0.242-0.365-0.138-0.688-0.285-0.97-0.441-0.275-0.161-0.509-0.347-0.701-0.557-0.185-0.209-0.329-0.452-0.431-0.727-0.096-0.276-0.144-0.602-0.144-0.98 0-0.515 0.111-0.958 0.333-1.33 0.227-0.372 0.527-0.674 0.898-0.908 0.378-0.239 0.806-0.413 1.28-0.521 0.485-0.114 0.988-0.171 1.51-0.171 0.408 0 0.821 0.033 1.24 0.099 0.419 0.06 0.833 0.15 1.24 0.27v2.19c-0.359-0.21-0.746-0.365-1.16-0.467-0.407-0.108-0.809-0.162-1.2-0.162-0.186 0-0.362 0.018-0.53 0.054-0.162 0.03-0.305 0.078-0.431 0.144-0.126 0.06-0.225 0.14-0.297 0.242-0.072 0.096-0.107 0.207-0.107 0.333 0 0.167 0.053 0.311 0.161 0.431s0.249 0.225 0.422 0.314c0.174 0.084 0.366 0.162 0.575 0.234 0.216 0.066 0.429 0.135 0.638 0.207 0.378 0.131 0.719 0.275 1.02 0.431 0.305 0.156 0.566 0.338 0.781 0.548 0.222 0.21 0.39 0.455 0.503 0.737 0.12 0.281 0.18 0.617 0.18 1.01 0 0.545-0.12 1.01-0.359 1.4-0.234 0.384-0.548 0.698-0.944 0.944-0.389 0.239-0.841 0.413-1.36 0.521-0.509 0.114-1.04 0.171-1.59 0.171-1.01 0-1.95-0.156-2.81-0.468zm14.3 0.135c-0.42 0.222-1.05 0.333-1.9 0.333-2 0-3-1.04-3-3.12v-4.21h-1.49v-2.09h1.49v-1.99l2.83-0.808v2.79h2.07v2.09h-2.07v3.72c0 0.958 0.38 1.44 1.14 1.44 0.3 0 0.608-0.086 0.926-0.26v2.1zm9.26 0.108h-2.69v-1.32h-0.036c-0.617 1.03-1.53 1.55-2.74 1.55-0.893 0-1.6-0.252-2.11-0.755-0.51-0.509-0.764-1.19-0.764-2.03 0-1.78 1.06-2.82 3.17-3.09l2.5-0.333c0-1.01-0.545-1.51-1.64-1.51-1.1 0-2.14 0.326-3.13 0.979v-2.14c0.396-0.204 0.935-0.383 1.62-0.539 0.688-0.156 1.31-0.234 1.88-0.234 2.62 0 3.94 1.31 3.94 3.93v5.5zm-2.67-3.74v-0.62l-1.67 0.215c-0.922 0.12-1.38 0.536-1.38 1.25 0 0.323 0.111 0.59 0.333 0.8 0.227 0.203 0.533 0.305 0.916 0.305 0.533 0 0.968-0.183 1.3-0.548 0.335-0.371 0.503-0.838 0.503-1.4zm13.8 3.74h-2.83v-5.11c0-1.43-0.509-2.14-1.53-2.14-0.492 0-0.896 0.188-1.21 0.566-0.318 0.377-0.476 0.856-0.476 1.44v5.25h-2.84v-9.2h2.84v1.46h0.036c0.676-1.12 1.66-1.68 2.96-1.68 2.04 0 3.06 1.26 3.06 3.79v5.63zm7.82-0.108c-0.419 0.222-1.05 0.333-1.9 0.333-2 0-3-1.04-3-3.12v-4.21h-1.49v-2.09h1.49v-1.99l2.83-0.808v2.79h2.07v2.09h-2.07v3.72c0 0.958 0.38 1.44 1.14 1.44 0.3 0 0.608-0.086 0.925-0.26v2.1z\" fill=\"#000\"/><path d=\"m476 307-4.44 12.9h-3.29l-4.38-12.9h3.13l2.69 8.97c0.143 0.485 0.23 0.913 0.26 1.28h0.054c0.042-0.402 0.135-0.842 0.279-1.32l2.67-8.93h3.04zm7.54 12.9h-2.69v-1.32h-0.036c-0.617 1.03-1.53 1.55-2.74 1.55-0.892 0-1.6-0.252-2.11-0.755-0.509-0.509-0.764-1.19-0.764-2.03 0-1.78 1.06-2.82 3.17-3.09l2.5-0.333c0-1.01-0.545-1.51-1.64-1.51-1.1 0-2.14 0.326-3.13 0.979v-2.14c0.395-0.204 0.934-0.383 1.62-0.539 0.689-0.156 1.31-0.234 1.88-0.234 2.62 0 3.94 1.31 3.94 3.93v5.5zm-2.67-3.74v-0.62l-1.67 0.215c-0.922 0.12-1.38 0.536-1.38 1.25 0 0.323 0.11 0.59 0.332 0.8 0.228 0.203 0.533 0.305 0.916 0.305 0.533 0 0.968-0.183 1.3-0.548 0.336-0.371 0.503-0.838 0.503-1.4zm10.9-2.9c-0.341-0.186-0.739-0.279-1.2-0.279-0.617 0-1.1 0.228-1.45 0.683-0.348 0.449-0.521 1.06-0.521 1.84v4.39h-2.84v-9.2h2.84v1.71h0.036c0.449-1.25 1.26-1.87 2.42-1.87 0.3 0 0.534 0.036 0.701 0.108v2.62zm2.84-4.02c-0.479 0-0.871-0.141-1.18-0.423-0.305-0.287-0.458-0.638-0.458-1.05 0-0.425 0.153-0.773 0.458-1.04 0.306-0.27 0.698-0.404 1.18-0.404 0.485 0 0.878 0.134 1.18 0.404 0.306 0.269 0.458 0.617 0.458 1.04 0 0.431-0.152 0.785-0.458 1.06-0.299 0.276-0.692 0.414-1.18 0.414zm1.4 10.7h-2.84v-9.2h2.84v9.2zm10 0h-2.69v-1.32h-0.036c-0.617 1.03-1.53 1.55-2.74 1.55-0.893 0-1.6-0.252-2.11-0.755-0.51-0.509-0.764-1.19-0.764-2.03 0-1.78 1.06-2.82 3.17-3.09l2.5-0.333c0-1.01-0.545-1.51-1.64-1.51-1.1 0-2.14 0.326-3.13 0.979v-2.14c0.396-0.204 0.935-0.383 1.62-0.539 0.688-0.156 1.31-0.234 1.88-0.234 2.62 0 3.94 1.31 3.94 3.93v5.5zm-2.67-3.74v-0.62l-1.67 0.215c-0.922 0.12-1.38 0.536-1.38 1.25 0 0.323 0.111 0.59 0.333 0.8 0.227 0.203 0.533 0.305 0.916 0.305 0.533 0 0.968-0.183 1.3-0.548 0.335-0.371 0.503-0.838 0.503-1.4zm7.79 2.67h-0.036v1.07h-2.84v-13.6h2.84v5.8h0.036c0.7-1.07 1.7-1.61 2.99-1.61 1.19 0 2.1 0.408 2.74 1.22 0.64 0.815 0.961 1.93 0.961 3.34 0 1.53-0.374 2.76-1.12 3.69s-1.75 1.39-3 1.39c-1.13 0-1.99-0.432-2.57-1.29zm-0.081-3.88v0.943c0 0.593 0.17 1.08 0.512 1.47 0.341 0.39 0.778 0.584 1.31 0.584 0.647 0 1.15-0.248 1.5-0.745 0.359-0.503 0.539-1.21 0.539-2.13 0-0.76-0.165-1.35-0.494-1.78-0.324-0.431-0.788-0.646-1.39-0.646-0.569 0-1.04 0.212-1.42 0.638-0.372 0.425-0.557 0.979-0.557 1.66zm11.5 4.95h-2.84v-13.6h2.84v13.6zm10.7-3.79h-6c0.095 1.34 0.937 2 2.52 2 1.01 0 1.9-0.239 2.67-0.719v2.05c-0.851 0.455-1.96 0.683-3.32 0.683-1.48 0-2.64-0.411-3.46-1.23-0.82-0.827-1.23-1.98-1.23-3.45 0-1.53 0.443-2.74 1.33-3.63 0.887-0.892 1.98-1.34 3.27-1.34 1.34 0 2.38 0.399 3.11 1.2 0.737 0.797 1.1 1.88 1.1 3.24v1.2zm-2.63-1.74c0-1.32-0.533-1.98-1.6-1.98-0.456 0-0.851 0.189-1.19 0.566-0.33 0.377-0.53 0.848-0.602 1.41h3.39z\" fill=\"#000\"/><path d=\"m291 146h16.5l-0.688 0.688v-96.5l0.688 0.687h-54.6v-1.38h55.3v97.9h-17.2v-1.38zm-33-90.7-6.13-5.11 6.13-5.11c0.292-0.243 0.726-0.204 0.968 0.088 0.244 0.292 0.204 0.725-0.088 0.968l-5.5 4.58v-1.06l5.5 4.58c0.292 0.243 0.332 0.677 0.088 0.968-0.242 0.292-0.676 0.331-0.968 0.088z\" fill=\"#0070C0\"/><path d=\"m642 146h16.5l-0.688 0.688v-96.5l0.688 0.687h-54.6v-1.38h55.3v97.9h-17.2v-1.38zm-33-90.7-6.13-5.11 6.13-5.11c0.292-0.243 0.726-0.204 0.968 0.088 0.244 0.292 0.204 0.725-0.088 0.968l-5.5 4.58v-1.06l5.5 4.58c0.292 0.243 0.332 0.677 0.088 0.968-0.242 0.292-0.676 0.331-0.968 0.088z\" fill=\"#0070C0\"/><g clip-rule=\"evenodd\" fill=\"#000\" fill-rule=\"evenodd\"><path d=\"m242 141h1.25v15.1h-1.25v-15.1z\"/><path d=\"m250 142c-0.374 0-0.686 0.11-0.936 0.332-0.252 0.222-0.454 0.54-0.608 0.956-0.154 0.418-0.264 0.924-0.328 1.52-0.066 0.598-0.098 1.27-0.098 2.02 0 1.76 0.164 3.05 0.49 3.88 0.328 0.824 0.834 1.24 1.52 1.24 0.654 0 1.14-0.388 1.45-1.16 0.316-0.774 0.476-1.98 0.476-3.6 0-1.24-0.082-2.25-0.244-3.02s-0.388-1.32-0.676-1.66c-0.29-0.334-0.64-0.502-1.05-0.502zm0.04-0.688c1.18 0 2.06 0.456 2.64 1.37 0.578 0.912 0.868 2.29 0.868 4.14 0 1.91-0.31 3.36-0.928 4.34-0.62 0.98-1.52 1.47-2.71 1.47-1.17 0-2.04-0.458-2.61-1.38-0.57-0.918-0.854-2.31-0.854-4.18 0-0.994 0.088-1.85 0.262-2.58 0.176-0.724 0.422-1.32 0.738-1.79 0.316-0.474 0.696-0.824 1.14-1.05 0.442-0.228 0.926-0.34 1.45-0.34z\"/><path d=\"m256 140 3.23 7.28v0.6l-3.23 7.29-0.866-0.308 2.6-7.28-2.6-7.29 0.866-0.29z\"/><path d=\"m140 30.2h1.25v15.1h-1.25v-15.1z\"/><path d=\"m148 30.6h0.446c-0.033 0.519-0.049 1.24-0.049 2.16v6.92c0 0.313 0.018 0.55 0.053 0.709s0.097 0.289 0.186 0.389 0.218 0.178 0.385 0.235c0.168 0.0568 0.378 0.1 0.632 0.13 0.254 0.0296 0.589 0.05 1 0.0608v0.592h-5.99v-0.592c0.599-0.0272 1.03-0.0636 1.28-0.11 0.257-0.0458 0.453-0.115 0.588-0.207s0.234-0.222 0.296-0.389c0.062-0.168 0.093-0.44 0.093-0.819v-6.57c0-0.216-0.038-0.374-0.114-0.474-0.075-0.1-0.186-0.15-0.332-0.15-0.173 0-0.419 0.0892-0.737 0.268-0.319 0.178-0.714 0.424-1.18 0.738l-0.356-0.624 3.79-2.26z\"/><path d=\"m154 29.4 3.23 7.28v0.6l-3.23 7.29-0.867-0.308 2.6-7.28-2.6-7.29 0.867-0.292z\"/><path d=\"m208 73h1.25v15.1h-1.25v-15.1z\"/><path d=\"m217 74.6h1.15v4.67h4.42v1.08h-4.42v4.67h-1.15v-4.67h-4.42v-1.08h4.42v-4.67z\"/><path d=\"m226 72.3 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m208 206h1.25v15.1h-1.25v-15.1z\"/><path d=\"m213 212h9.99v1.08h-9.99v-1.08z\"/><path d=\"m226 205 3.23 7.28v0.598l-3.23 7.29-0.866-0.308 2.6-7.28-2.6-7.29 0.866-0.292z\"/><path d=\"m133 250h9.99v1.08h-9.99v-1.08z\"/><path d=\"m146 243h1.25v15.1h-1.25v-15.1z\"/><path d=\"m154 244h0.446c-0.033 0.518-0.049 1.24-0.049 2.16v6.92c0 0.312 0.018 0.55 0.053 0.708 0.035 0.16 0.097 0.29 0.186 0.39s0.218 0.178 0.385 0.234c0.168 0.058 0.378 0.1 0.632 0.13s0.59 0.05 1.01 0.062v0.59h-5.99v-0.59c0.599-0.028 1.03-0.064 1.28-0.11 0.257-0.046 0.453-0.114 0.588-0.206s0.234-0.222 0.296-0.39 0.093-0.44 0.093-0.818v-6.57c0-0.216-0.038-0.374-0.113-0.474-0.076-0.1-0.187-0.15-0.333-0.15-0.173 0-0.419 0.088-0.737 0.268-0.319 0.178-0.714 0.424-1.18 0.736l-0.356-0.624 3.79-2.26z\"/><path d=\"m160 243 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m28.4 147h9.99v1.08h-9.99v-1.08z\"/><path d=\"m41.6 141h1.25v15.1h-1.25v-15.1z\"/><path d=\"m49.5 142c-0.373 0-0.685 0.11-0.936 0.332s-0.454 0.54-0.608 0.956c-0.154 0.418-0.263 0.924-0.328 1.52-0.0648 0.598-0.0972 1.27-0.0972 2.02 0 1.76 0.163 3.05 0.49 3.88 0.327 0.824 0.833 1.24 1.52 1.24 0.654 0 1.14-0.388 1.45-1.16 0.316-0.774 0.474-1.98 0.474-3.6 0-1.24-0.081-2.25-0.243-3.02-0.162-0.77-0.388-1.32-0.677-1.66-0.289-0.334-0.639-0.502-1.05-0.502zm0.0406-0.688c1.18 0 2.06 0.456 2.64 1.37 0.578 0.912 0.867 2.29 0.867 4.14 0 1.91-0.309 3.36-0.928 4.34-0.619 0.98-1.52 1.47-2.71 1.47-1.17 0-2.04-0.458-2.61-1.38-0.57-0.918-0.855-2.31-0.855-4.18 0-0.994 0.0878-1.85 0.263-2.58s0.422-1.32 0.738-1.79c0.316-0.474 0.696-0.824 1.14-1.05 0.443-0.228 0.927-0.34 1.45-0.34z\"/><path d=\"m55.8 140 3.23 7.28v0.6l-3.23 7.29-0.867-0.308 2.6-7.28-2.6-7.29 0.867-0.29z\"/><path d=\"m57.9 212h9.99v1.08h-9.99v-1.08z\"/><path d=\"m71 206h1.25v15.1h-1.25v-15.1z\"/><path d=\"m79.9 207h1.15v4.67h4.42v1.08h-4.42v4.67h-1.15v-4.67h-4.42v-1.08h4.42v-4.67z\"/><path d=\"m88.4 205 3.23 7.28v0.6l-3.23 7.29-0.867-0.308 2.6-7.28-2.6-7.29 0.867-0.29z\"/><path d=\"m57.2 78.8h9.99v1.08h-9.99v-1.08z\"/><path d=\"m70.3 72.5h1.25v15.1h-1.25v-15.1z\"/><path d=\"m74.8 78.8h9.99v1.08h-9.99v-1.08z\"/><path d=\"m87.7 71.8 3.23 7.28v0.6l-3.23 7.29-0.867-0.308 2.6-7.28-2.6-7.29 0.867-0.292z\"/><path d=\"m592 141h1.25v15.1h-1.25v-15.1z\"/><path d=\"m600 142c-0.372 0-0.684 0.11-0.936 0.332-0.25 0.222-0.454 0.54-0.608 0.956-0.154 0.418-0.262 0.924-0.328 1.52-0.064 0.598-0.098 1.27-0.098 2.02 0 1.76 0.164 3.05 0.492 3.88 0.326 0.824 0.832 1.24 1.52 1.24 0.652 0 1.14-0.388 1.45-1.16 0.316-0.774 0.474-1.98 0.474-3.6 0-1.24-0.08-2.25-0.242-3.02-0.164-0.77-0.388-1.32-0.678-1.66-0.288-0.334-0.638-0.502-1.05-0.502zm0.042-0.688c1.18 0 2.06 0.456 2.64 1.37 0.578 0.912 0.866 2.29 0.866 4.14 0 1.91-0.308 3.36-0.928 4.34-0.618 0.98-1.52 1.47-2.71 1.47-1.17 0-2.04-0.458-2.61-1.38-0.57-0.918-0.856-2.31-0.856-4.18 0-0.994 0.088-1.85 0.264-2.58s0.422-1.32 0.738-1.79c0.316-0.474 0.696-0.824 1.14-1.05 0.444-0.228 0.926-0.34 1.45-0.34z\"/><path d=\"m606 140 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.29z\"/><path d=\"m489 30.2h1.25v15.1h-1.25v-15.1z\"/><path d=\"m498 30.6h0.446c-0.032 0.519-0.048 1.24-0.048 2.16v6.92c0 0.313 0.016 0.55 0.052 0.709 0.034 0.159 0.098 0.289 0.186 0.389 0.09 0.1 0.218 0.178 0.386 0.235 0.166 0.0568 0.378 0.1 0.632 0.13 0.254 0.0296 0.588 0.05 1 0.0608v0.592h-5.99v-0.592c0.6-0.0272 1.03-0.0636 1.29-0.11 0.256-0.0458 0.452-0.115 0.588-0.207 0.134-0.0918 0.232-0.222 0.294-0.389 0.064-0.168 0.094-0.44 0.094-0.819v-6.57c0-0.216-0.038-0.374-0.114-0.474s-0.186-0.15-0.332-0.15c-0.172 0-0.418 0.0892-0.738 0.268-0.318 0.178-0.712 0.424-1.18 0.738l-0.358-0.624 3.79-2.26z\"/><path d=\"m504 29.4 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m558 73h1.25v15.1h-1.25v-15.1z\"/><path d=\"m567 74.6h1.15v4.67h4.42v1.08h-4.42v4.67h-1.15v-4.67h-4.42v-1.08h4.42v-4.67z\"/><path d=\"m575 72.3 3.23 7.28v0.6l-3.23 7.29-0.866-0.308 2.6-7.28-2.6-7.29 0.866-0.292z\"/><path d=\"m558 206h1.25v15.1h-1.25v-15.1z\"/><path d=\"m563 212h9.99v1.08h-9.99v-1.08z\"/><path d=\"m575 205 3.23 7.28v0.598l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m483 250h9.99v1.08h-9.99v-1.08z\"/><path d=\"m496 243h1.25v15.1h-1.25v-15.1z\"/><path d=\"m504 244h0.446c-0.032 0.518-0.048 1.24-0.048 2.16v6.92c0 0.312 0.016 0.55 0.052 0.708 0.036 0.16 0.098 0.29 0.186 0.39 0.09 0.1 0.218 0.178 0.386 0.234 0.166 0.058 0.378 0.1 0.632 0.13s0.588 0.05 1 0.062v0.59h-5.99v-0.59c0.6-0.028 1.03-0.064 1.29-0.11 0.256-0.046 0.452-0.114 0.588-0.206 0.134-0.092 0.232-0.222 0.294-0.39 0.064-0.168 0.094-0.44 0.094-0.818v-6.57c0-0.216-0.038-0.374-0.114-0.474-0.074-0.1-0.186-0.15-0.332-0.15-0.172 0-0.418 0.088-0.738 0.268-0.318 0.178-0.712 0.424-1.18 0.736l-0.358-0.624 3.79-2.26z\"/><path d=\"m510 243 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m378 147h9.99v1.08h-9.99v-1.08z\"/><path d=\"m391 141h1.25v15.1h-1.25v-15.1z\"/><path d=\"m399 142c-0.372 0-0.684 0.11-0.936 0.332s-0.454 0.54-0.608 0.956c-0.154 0.418-0.264 0.924-0.328 1.52-0.064 0.598-0.098 1.27-0.098 2.02 0 1.76 0.164 3.05 0.492 3.88 0.326 0.824 0.832 1.24 1.52 1.24 0.654 0 1.14-0.388 1.46-1.16 0.316-0.774 0.474-1.98 0.474-3.6 0-1.24-0.082-2.25-0.244-3.02s-0.386-1.32-0.676-1.66c-0.29-0.334-0.638-0.502-1.05-0.502zm0.04-0.688c1.18 0 2.07 0.456 2.64 1.37 0.578 0.912 0.866 2.29 0.866 4.14 0 1.91-0.308 3.36-0.928 4.34-0.618 0.98-1.52 1.47-2.71 1.47-1.17 0-2.04-0.458-2.61-1.38-0.57-0.918-0.856-2.31-0.856-4.18 0-0.994 0.088-1.85 0.264-2.58s0.422-1.32 0.738-1.79c0.316-0.474 0.694-0.824 1.14-1.05 0.444-0.228 0.926-0.34 1.45-0.34z\"/><path d=\"m406 140 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.29z\"/><path d=\"m408 212h9.99v1.08h-9.99v-1.08z\"/><path d=\"m421 206h1.25v15.1h-1.25v-15.1z\"/><path d=\"m430 207h1.15v4.67h4.42v1.08h-4.42v4.67h-1.15v-4.67h-4.42v-1.08h4.42v-4.67z\"/><path d=\"m438 205 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.29z\"/><path d=\"m407 78.8h9.99v1.08h-9.99v-1.08z\"/><path d=\"m420 72.5h1.25v15.1h-1.25v-15.1z\"/><path d=\"m425 78.8h9.99v1.08h-9.99v-1.08z\"/><path d=\"m438 71.8 3.24 7.28v0.6l-3.24 7.29-0.866-0.308 2.6-7.28-2.6-7.29 0.866-0.292z\"/></g></g><defs><clipPath id=\"clip0_4_498\"><rect transform=\"translate(.6 .8)\" width=\"659\" height=\"332\" fill=\"#fff\"/></clipPath></defs></svg>\n\n2. Apply the oracle. \n Here, the difference between the two scenarios becomes noticeable. In the constant scenario, $\\ket{0}$ and $\\ket{1}$ states get the same phase (either $1$ or $-1$), so the state remains the same or acquires a global phase of $-1$, which is physically the same state. In the variable scenario, zero and one states get different phases, so the state changes!\n <br/>\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg width=\"738\" height=\"374\" fill=\"none\" version=\"1.1\" viewBox=\"0 0 738 374\" xmlns=\"http://www.w3.org/2000/svg\"><g clip-path=\"url(#clip0_5_635)\"><g clip-rule=\"evenodd\" fill-rule=\"evenodd\"><path d=\"m7.3 189c0-76.8 62.3-139 139-139 76.8 0 139 62.3 139 139 0 76.8-62.3 139-139 139-76.8 0-139-62.3-139-139z\" stroke=\"#747474\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"/><g fill=\"#fff\" stroke=\"#000\" stroke-miterlimit=\"8\"><path d=\"m279 189c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\" stroke-width=\"1.15\"/><g stroke-width=\"1.38\"><path d=\"m140 49.4c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9c0 3.26-2.64 5.9-5.9 5.9s-5.9-2.64-5.9-5.9z\"/><path d=\"m1.3 189c0-3.26 2.69-5.9 6-5.9 3.31 0 6 2.64 6 5.9s-2.69 5.9-6 5.9c-3.31 0-6-2.64-6-5.9z\"/><path d=\"m140 328c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9-2.64 5.9-5.9 5.9-5.9-2.64-5.9-5.9z\"/></g></g><path d=\"m240 92.3c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9c0 3.26-2.69 5.9-6 5.9s-6-2.64-6-5.9z\" fill=\"#0070C0\"/><path d=\"m240 285c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\" fill=\"#fff\" stroke=\"#000\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"/><path d=\"m40.5 92.4c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\" fill=\"#fff\" stroke=\"#000\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"/><path d=\"m40.4 285c0-3.26 2.69-5.9 6-5.9 3.31 0 6 2.64 6 5.9s-2.69 5.9-6 5.9c-3.31 0-6-2.64-6-5.9z\" fill=\"#0070C0\"/><path d=\"m358 189c0-76.8 62.2-139 139-139s139 62.3 139 139c0 76.8-62.2 139-139 139s-139-62.3-139-139z\" stroke=\"#747474\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"/><g fill=\"#fff\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"><g stroke=\"#000\"><path d=\"m630 189c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\"/><path d=\"m491 49.4c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9c0 3.26-2.69 5.9-6 5.9s-6-2.64-6-5.9z\"/><path d=\"m352 189c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9-2.64 5.9-5.9 5.9-5.9-2.64-5.9-5.9z\"/><path d=\"m491 328c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\"/></g><path d=\"m591 92.4c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9-2.64 5.9-5.9 5.9-5.9-2.64-5.9-5.9z\" stroke=\"#0070C0\"/></g><path d=\"m591 285c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9-2.64 5.9-5.9 5.9-5.9-2.64-5.9-5.9z\" fill=\"#0070C0\"/><path d=\"m391 92.3c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9c0 3.26-2.64 5.9-5.9 5.9s-5.9-2.64-5.9-5.9z\" fill=\"#0070C0\"/><path d=\"m392 285c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9-2.64 5.9-5.9 5.9-5.9-2.64-5.9-5.9z\" fill=\"#fff\" stroke=\"#000\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"/></g><g fill=\"#0070C0\"><path d=\"m247 85.4v-15.1l-0.688 0.688h22.1l-0.687-0.688v22.1l0.687-0.688h-16.2v1.38h16.9v-23.5h-23.5v15.8h1.38zm-5.8-5.06 5.11 6.13 5.11-6.13c0.244-0.292 0.204-0.725-0.088-0.968-0.291-0.243-0.725-0.204-0.968 0.088l-4.58 5.5h1.06l-4.58-5.5c-0.243-0.292-0.677-0.331-0.968-0.088-0.292 0.243-0.332 0.677-0.088 0.968z\"/><path d=\"m199 136-105 102 0.96 0.985 105-102-0.96-0.984zm-104 95.6-0.826 7.94 7.96-0.619c0.378-0.03 0.661-0.361 0.632-0.739-0.03-0.379-0.36-0.662-0.739-0.632l-7.14 0.555 0.737 0.757 0.741-7.12c0.0392-0.378-0.235-0.716-0.613-0.755-0.378-0.04-0.716 0.235-0.755 0.612z\"/><path d=\"m603 91.6h58.4v194h-56.4v-1.37h55.8l-0.688 0.686v-193l0.688 0.688h-57.8v-1.38zm7.05 199-6.13-5.11 6.13-5.11c0.29-0.244 0.724-0.204 0.968 0.088 0.242 0.29 0.204 0.724-0.088 0.968l-5.5 4.58v-1.06l5.5 4.58c0.292 0.242 0.33 0.676 0.088 0.968-0.244 0.292-0.678 0.332-0.968 0.088z\"/><path d=\"m397 85.7v-56.4h201v56.6h-1.37v-55.9l0.686 0.688h-200l0.688-0.688v55.7h-1.38zm5.8-5.06-5.11 6.13-5.11-6.13c-0.242-0.292-0.204-0.725 0.088-0.968 0.292-0.243 0.726-0.204 0.968 0.0882l4.58 5.5h-1.06l4.58-5.5c0.242-0.292 0.676-0.331 0.968-0.0882 0.292 0.243 0.33 0.677 0.088 0.968z\"/></g><g clip-rule=\"evenodd\" fill=\"#0078D4\" fill-rule=\"evenodd\"><path d=\"m231 48.1c0.516 0 0.962 0.0422 1.34 0.126l-0.308 1.34h-0.696c-0.074-0.301-0.17-0.517-0.288-0.649-0.12-0.132-0.294-0.198-0.526-0.198-0.302 0-0.556 0.083-0.764 0.249s-0.386 0.413-0.534 0.74-0.284 0.767-0.412 1.32l-0.196 0.862h2.03l-0.174 0.799h-2.04l-1.47 6.9c-0.242 1.14-0.614 2-1.12 2.56-0.5 0.562-1.13 0.842-1.89 0.842-0.222 0-0.396-0.0132-0.522-0.0396l0.134-0.696c0.054 0.0158 0.178 0.0236 0.372 0.0236 0.238 0 0.44-0.0606 0.61-0.182 0.168-0.121 0.324-0.332 0.47-0.633 0.144-0.3 0.278-0.717 0.4-1.25l1.7-7.52h-1.34l0.118-0.546c0.354-0.0212 0.608-0.0502 0.764-0.087 0.154-0.037 0.276-0.0924 0.364-0.166 0.086-0.0738 0.16-0.17 0.22-0.289 0.062-0.119 0.138-0.336 0.234-0.653 0.28-0.949 0.71-1.66 1.29-2.14 0.582-0.477 1.32-0.716 2.23-0.716z\"/><path d=\"m250 47.3c1.54 0.406 2.72 1.28 3.55 2.63 0.826 1.35 1.24 2.97 1.24 4.88 0 1.91-0.41 3.53-1.23 4.88-0.822 1.34-2.01 2.22-3.55 2.62l-0.19-0.609c1.22-0.406 2.12-1.21 2.72-2.4 0.594-1.2 0.89-2.72 0.89-4.56 0-1.78-0.296-3.26-0.886-4.44s-1.51-1.97-2.74-2.38l0.214-0.609zm-10.1 0 0.214 0.609c-1.23 0.406-2.15 1.2-2.74 2.38-0.592 1.18-0.89 2.66-0.89 4.44 0 1.85 0.298 3.37 0.89 4.56 0.594 1.2 1.5 2 2.72 2.4l-0.19 0.609c-1.55-0.406-2.73-1.28-3.55-2.62-0.822-1.34-1.23-2.97-1.23-4.88 0-1.9 0.412-3.53 1.24-4.88s2.01-2.22 3.55-2.63z\"/><path d=\"m243 51.7c0.162 0 0.306 0.0184 0.43 0.0554 0.124 0.0368 0.234 0.0936 0.328 0.17 0.096 0.0764 0.18 0.175 0.254 0.297s0.144 0.286 0.214 0.494c0.068 0.208 0.132 0.467 0.194 0.775 0.06 0.308 0.114 0.629 0.162 0.961h0.078c0.506-0.712 0.89-1.23 1.15-1.56 0.26-0.33 0.48-0.575 0.66-0.736s0.352-0.274 0.518-0.34c0.166-0.0658 0.386-0.0988 0.66-0.0988 0.248 0 0.452 0.0316 0.61 0.0948l-0.316 1.43h-0.554c-0.032-0.221-0.124-0.332-0.278-0.332-0.046 0-0.098 0.0078-0.15 0.0238-0.052 0.0158-0.118 0.05-0.194 0.103-0.076 0.0526-0.188 0.156-0.336 0.308-0.148 0.153-0.314 0.34-0.498 0.562-0.184 0.222-0.374 0.454-0.57 0.696l-0.538 0.672c0.096 0.506 0.186 0.944 0.27 1.31s0.158 0.676 0.224 0.922 0.124 0.439 0.174 0.581c0.052 0.142 0.106 0.249 0.164 0.32 0.058 0.0712 0.116 0.121 0.178 0.15 0.06 0.029 0.13 0.0434 0.208 0.0434 0.144 0 0.282-0.0552 0.416-0.166s0.328-0.361 0.582-0.751l0.514 0.34c-0.37 0.548-0.704 0.935-1 1.16-0.298 0.224-0.652 0.336-1.06 0.336-0.226 0-0.418-0.0408-0.576-0.123-0.158-0.0816-0.296-0.212-0.412-0.391-0.116-0.179-0.218-0.459-0.308-0.839-0.164-0.675-0.264-1.19-0.3-1.55h-0.08c-0.558 0.786-0.974 1.35-1.25 1.69s-0.496 0.596-0.672 0.759-0.348 0.278-0.514 0.344c-0.166 0.066-0.386 0.099-0.66 0.099-0.248 0-0.452-0.0316-0.61-0.095l0.316-1.43h0.554c0.032 0.221 0.124 0.332 0.278 0.332 0.072 0 0.15-0.0198 0.232-0.0594s0.2-0.134 0.352-0.285c0.154-0.15 0.364-0.386 0.634-0.708 0.268-0.322 0.658-0.804 1.17-1.45-0.08-0.417-0.16-0.817-0.246-1.2-0.084-0.385-0.17-0.744-0.26-1.08s-0.164-0.55-0.222-0.653-0.12-0.174-0.186-0.214-0.148-0.0592-0.248-0.0592c-0.112 0-0.212 0.025-0.302 0.075-0.09 0.0502-0.186 0.137-0.292 0.261-0.106 0.124-0.246 0.318-0.42 0.581l-0.514-0.34c0.332-0.501 0.652-0.875 0.958-1.12 0.306-0.248 0.666-0.372 1.08-0.372z\"/><path d=\"m262 55.9h9.75v1.05h-9.75v-1.05zm0-3.28h9.75v1.05h-9.75v-1.05z\"/><path d=\"m281 49.2c-0.364 0-0.668 0.108-0.914 0.324-0.244 0.216-0.442 0.527-0.592 0.933-0.15 0.406-0.258 0.901-0.32 1.48-0.064 0.583-0.096 1.24-0.096 1.97 0 1.72 0.16 2.98 0.478 3.78 0.32 0.804 0.814 1.21 1.48 1.21 0.638 0 1.11-0.378 1.42-1.14s0.462-1.93 0.462-3.52c0-1.21-0.078-2.2-0.236-2.95-0.16-0.751-0.38-1.29-0.662-1.62s-0.622-0.49-1.02-0.49zm0.04-0.672c1.15 0 2.01 0.446 2.58 1.34s0.846 2.24 0.846 4.04c0 1.87-0.3 3.28-0.904 4.24s-1.49 1.44-2.65 1.44c-1.14 0-1.99-0.448-2.54-1.34-0.556-0.897-0.834-2.26-0.834-4.08 0-0.97 0.086-1.81 0.256-2.52 0.172-0.707 0.412-1.29 0.72-1.75 0.31-0.461 0.68-0.803 1.11-1.02s0.904-0.332 1.42-0.332z\"/><path d=\"m94.3 164c0.53 0 0.986 0.043 1.37 0.13l-0.316 1.38h-0.713c-0.0756-0.308-0.174-0.53-0.296-0.665s-0.301-0.203-0.539-0.203c-0.308 0-0.569 0.085-0.782 0.256-0.213 0.17-0.396 0.422-0.547 0.758-0.151 0.334-0.292 0.786-0.422 1.35l-0.203 0.882h2.08l-0.178 0.82h-2.09l-1.51 7.07c-0.249 1.17-0.63 2.05-1.14 2.62-0.513 0.574-1.16 0.862-1.94 0.862-0.227 0-0.405-0.012-0.535-0.04l0.138-0.714c0.054 0.016 0.181 0.026 0.381 0.026 0.243 0 0.451-0.064 0.624-0.188s0.334-0.34 0.482-0.648 0.285-0.734 0.409-1.28l1.74-7.71h-1.37l0.122-0.56c0.362-0.022 0.623-0.052 0.782-0.09s0.284-0.094 0.373-0.17c0.0892-0.076 0.165-0.174 0.227-0.296 0.0622-0.12 0.142-0.344 0.239-0.668 0.286-0.972 0.728-1.7 1.33-2.19 0.597-0.489 1.36-0.734 2.28-0.734z\"/><path d=\"m113 163c1.58 0.416 2.79 1.31 3.64 2.7 0.846 1.38 1.27 3.05 1.27 5 0 1.96-0.422 3.62-1.26 5-0.843 1.37-2.06 2.27-3.64 2.69l-0.195-0.624c1.25-0.416 2.18-1.24 2.78-2.46 0.608-1.23 0.911-2.79 0.911-4.68 0-1.83-0.302-3.34-0.907-4.55-0.606-1.21-1.54-2.02-2.81-2.44l0.219-0.624zm-10.3 0 0.219 0.624c-1.26 0.416-2.2 1.23-2.81 2.44-0.608 1.21-0.912 2.73-0.912 4.55 0 1.89 0.304 3.45 0.912 4.68 0.608 1.23 1.54 2.05 2.78 2.46l-0.194 0.624c-1.58-0.416-2.8-1.31-3.64-2.69-0.843-1.38-1.26-3.04-1.26-5 0-1.95 0.423-3.62 1.27-5 0.846-1.38 2.06-2.28 3.64-2.7z\"/><path d=\"m106 168c0.168 0 0.315 0.02 0.442 0.058s0.239 0.096 0.336 0.174c0.098 0.078 0.184 0.18 0.26 0.304 0.075 0.124 0.148 0.292 0.219 0.506 0.07 0.214 0.136 0.478 0.198 0.794s0.118 0.646 0.166 0.986h0.081c0.519-0.73 0.912-1.26 1.18-1.6 0.267-0.338 0.493-0.588 0.677-0.754 0.183-0.164 0.36-0.28 0.53-0.348 0.171-0.068 0.396-0.1 0.677-0.1 0.254 0 0.462 0.032 0.624 0.096l-0.324 1.47h-0.567c-0.033-0.228-0.127-0.342-0.284-0.342-0.049 0-0.1 0.01-0.154 0.026s-0.12 0.05-0.199 0.104c-0.078 0.054-0.193 0.16-0.344 0.316-0.151 0.158-0.322 0.35-0.511 0.576-0.189 0.228-0.383 0.464-0.583 0.714l-0.551 0.688c0.097 0.52 0.189 0.968 0.275 1.35 0.087 0.378 0.164 0.694 0.231 0.944 0.068 0.252 0.127 0.45 0.178 0.596 0.052 0.146 0.107 0.256 0.167 0.328 0.059 0.074 0.12 0.124 0.182 0.154s0.134 0.044 0.215 0.044c0.146 0 0.288-0.056 0.425-0.17 0.138-0.112 0.337-0.37 0.596-0.77l0.527 0.35c-0.378 0.562-0.72 0.956-1.02 1.19-0.306 0.23-0.669 0.346-1.09 0.346-0.232 0-0.429-0.042-0.591-0.126s-0.303-0.218-0.422-0.402-0.224-0.47-0.316-0.858c-0.167-0.692-0.27-1.22-0.308-1.59h-0.081c-0.573 0.806-0.998 1.38-1.28 1.73-0.278 0.352-0.507 0.612-0.689 0.78-0.181 0.166-0.356 0.284-0.526 0.352-0.171 0.068-0.396 0.102-0.677 0.102-0.254 0-0.462-0.034-0.624-0.098l0.324-1.47h0.567c0.033 0.228 0.127 0.342 0.284 0.342 0.076 0 0.155-0.022 0.239-0.062s0.204-0.138 0.361-0.292 0.373-0.396 0.648-0.724c0.276-0.33 0.676-0.824 1.2-1.48-0.081-0.428-0.165-0.838-0.251-1.23-0.087-0.394-0.176-0.762-0.268-1.1-0.092-0.342-0.167-0.564-0.227-0.67-0.059-0.104-0.123-0.178-0.19-0.218-0.068-0.04-0.153-0.06-0.256-0.06-0.113 0-0.216 0.024-0.308 0.076s-0.191 0.14-0.3 0.268c-0.108 0.126-0.251 0.326-0.429 0.596l-0.527-0.35c0.34-0.512 0.667-0.896 0.981-1.15 0.313-0.254 0.683-0.382 1.11-0.382z\"/><path d=\"m125 172h9.99v1.08h-9.99v-1.08zm0-3.36h9.99v1.08h-9.99v-1.08z\"/><path d=\"m146 164h0.446c-0.032 0.519-0.048 1.24-0.048 2.16v6.92c0 0.314 0.018 0.55 0.052 0.71 0.036 0.158 0.098 0.288 0.186 0.388 0.09 0.1 0.218 0.178 0.386 0.236 0.168 0.056 0.378 0.1 0.632 0.128 0.254 0.03 0.588 0.05 1 0.062v0.592h-5.99v-0.592c0.6-0.028 1.03-0.064 1.29-0.11s0.452-0.114 0.588-0.206c0.134-0.092 0.234-0.222 0.296-0.39 0.062-0.166 0.092-0.44 0.092-0.818v-6.57c0-0.216-0.038-0.374-0.114-0.474-0.074-0.1-0.186-0.15-0.332-0.15-0.172 0-0.418 0.09-0.736 0.268-0.32 0.178-0.714 0.424-1.18 0.738l-0.358-0.624 3.79-2.26z\"/><path d=\"m676 183c0.516 0 0.962 0.044 1.34 0.128l-0.308 1.34h-0.696c-0.074-0.3-0.17-0.516-0.288-0.648-0.12-0.132-0.294-0.198-0.528-0.198-0.3 0-0.554 0.082-0.762 0.248-0.208 0.168-0.386 0.414-0.534 0.74-0.148 0.328-0.286 0.768-0.412 1.32l-0.198 0.862h2.03l-0.174 0.798h-2.04l-1.47 6.9c-0.244 1.14-0.614 2-1.12 2.56-0.5 0.56-1.13 0.842-1.89 0.842-0.222 0-0.396-0.014-0.522-0.04l0.134-0.696c0.052 0.016 0.176 0.024 0.372 0.024 0.238 0 0.44-0.06 0.608-0.182 0.17-0.122 0.326-0.332 0.472-0.632 0.144-0.302 0.278-0.718 0.398-1.25l1.7-7.52h-1.34l0.12-0.546c0.352-0.02 0.608-0.05 0.762-0.086 0.156-0.038 0.278-0.092 0.364-0.166 0.088-0.074 0.162-0.17 0.222-0.288 0.06-0.12 0.138-0.338 0.234-0.654 0.278-0.948 0.71-1.66 1.29-2.14 0.584-0.476 1.33-0.716 2.23-0.716z\"/><path d=\"m694 182c1.54 0.406 2.72 1.28 3.55 2.63 0.826 1.35 1.24 2.97 1.24 4.88 0 1.91-0.412 3.53-1.23 4.88s-2.01 2.22-3.55 2.62l-0.19-0.608c1.22-0.406 2.12-1.21 2.72-2.41 0.594-1.2 0.89-2.72 0.89-4.56 0-1.78-0.296-3.26-0.886-4.44-0.59-1.18-1.51-1.97-2.74-2.38l0.212-0.608zm-10.1 0 0.212 0.608c-1.23 0.406-2.15 1.2-2.74 2.38-0.594 1.18-0.89 2.66-0.89 4.44 0 1.85 0.296 3.37 0.89 4.56 0.594 1.2 1.5 2 2.72 2.41l-0.19 0.608c-1.55-0.406-2.73-1.28-3.55-2.62-0.824-1.34-1.23-2.97-1.23-4.88 0-1.9 0.412-3.53 1.24-4.88 0.824-1.35 2.01-2.22 3.55-2.63z\"/><path d=\"m688 187c0.164 0 0.308 0.018 0.432 0.054 0.124 0.038 0.234 0.094 0.328 0.17 0.096 0.078 0.18 0.176 0.254 0.298 0.074 0.12 0.144 0.286 0.212 0.494 0.07 0.208 0.134 0.466 0.194 0.774 0.062 0.31 0.116 0.63 0.162 0.962h0.08c0.506-0.712 0.89-1.23 1.15-1.56 0.262-0.33 0.482-0.576 0.662-0.736 0.178-0.16 0.352-0.274 0.518-0.34s0.386-0.098 0.66-0.098c0.248 0 0.45 0.03 0.61 0.094l-0.318 1.43h-0.554c-0.03-0.222-0.122-0.332-0.276-0.332-0.048 0-0.098 8e-3 -0.15 0.024s-0.118 0.05-0.194 0.102-0.188 0.156-0.336 0.308c-0.148 0.154-0.314 0.34-0.498 0.562-0.186 0.222-0.374 0.454-0.57 0.696l-0.538 0.672c0.094 0.506 0.184 0.944 0.27 1.31 0.084 0.368 0.158 0.676 0.224 0.922 0.066 0.244 0.124 0.438 0.174 0.58 0.05 0.144 0.104 0.25 0.162 0.322 0.058 0.07 0.118 0.12 0.178 0.15 0.062 0.028 0.132 0.042 0.21 0.042 0.142 0 0.282-0.054 0.416-0.166 0.134-0.11 0.328-0.36 0.58-0.75l0.516 0.34c-0.37 0.548-0.704 0.934-1 1.16s-0.652 0.336-1.06 0.336c-0.226 0-0.418-0.04-0.576-0.122-0.16-0.082-0.296-0.212-0.412-0.392s-0.22-0.458-0.308-0.838c-0.164-0.676-0.264-1.19-0.302-1.55h-0.078c-0.56 0.786-0.974 1.35-1.25 1.69s-0.496 0.596-0.672 0.76c-0.178 0.164-0.348 0.278-0.514 0.344s-0.388 0.098-0.662 0.098c-0.248 0-0.45-0.032-0.608-0.094l0.316-1.43h0.554c0.032 0.222 0.124 0.332 0.276 0.332 0.074 0 0.152-0.02 0.234-0.06 0.082-0.038 0.2-0.134 0.352-0.284s0.364-0.386 0.632-0.708c0.27-0.322 0.66-0.804 1.17-1.45-0.08-0.416-0.162-0.816-0.246-1.2-0.084-0.384-0.172-0.744-0.26-1.08-0.09-0.332-0.164-0.55-0.222-0.652-0.058-0.104-0.12-0.174-0.186-0.214s-0.15-0.06-0.25-0.06c-0.11 0-0.21 0.026-0.3 0.076s-0.188 0.138-0.292 0.262c-0.106 0.122-0.246 0.316-0.42 0.58l-0.514-0.34c0.332-0.5 0.652-0.876 0.958-1.12 0.304-0.248 0.666-0.372 1.08-0.372z\"/><path d=\"m706 191h9.75v1.05h-9.75v-1.05zm0-3.28h9.75v1.05h-9.75v-1.05z\"/><path d=\"m725 187c0.162 0 0.306 0.018 0.43 0.054 0.124 0.038 0.234 0.094 0.328 0.17 0.096 0.078 0.18 0.176 0.254 0.298 0.074 0.12 0.144 0.286 0.214 0.494 0.068 0.208 0.132 0.466 0.194 0.774 0.06 0.31 0.114 0.63 0.162 0.962h0.078c0.506-0.712 0.89-1.23 1.15-1.56 0.26-0.33 0.48-0.576 0.66-0.736s0.352-0.274 0.518-0.34 0.386-0.098 0.66-0.098c0.248 0 0.452 0.03 0.61 0.094l-0.316 1.43h-0.554c-0.032-0.222-0.124-0.332-0.278-0.332-0.046 0-0.096 8e-3 -0.15 0.024-0.052 0.016-0.118 0.05-0.194 0.102s-0.188 0.156-0.336 0.308c-0.148 0.154-0.314 0.34-0.498 0.562s-0.374 0.454-0.57 0.696l-0.538 0.672c0.096 0.506 0.186 0.944 0.27 1.31 0.084 0.368 0.16 0.676 0.224 0.922 0.066 0.244 0.124 0.438 0.174 0.58 0.052 0.144 0.106 0.25 0.164 0.322 0.058 0.07 0.116 0.12 0.178 0.15 0.06 0.028 0.13 0.042 0.208 0.042 0.144 0 0.282-0.054 0.416-0.166 0.134-0.11 0.328-0.36 0.582-0.75l0.514 0.34c-0.37 0.548-0.704 0.934-1 1.16s-0.652 0.336-1.06 0.336c-0.228 0-0.42-0.04-0.578-0.122s-0.296-0.212-0.412-0.392-0.218-0.458-0.308-0.838c-0.164-0.676-0.264-1.19-0.3-1.55h-0.08c-0.558 0.786-0.974 1.35-1.25 1.69s-0.496 0.596-0.672 0.76-0.348 0.278-0.514 0.344-0.386 0.098-0.66 0.098c-0.248 0-0.452-0.032-0.61-0.094l0.316-1.43h0.554c0.032 0.222 0.124 0.332 0.278 0.332 0.072 0 0.15-0.02 0.232-0.06 0.082-0.038 0.2-0.134 0.352-0.284 0.154-0.15 0.364-0.386 0.634-0.708 0.268-0.322 0.658-0.804 1.17-1.45-0.08-0.416-0.16-0.816-0.246-1.2-0.084-0.384-0.17-0.744-0.26-1.08s-0.164-0.55-0.222-0.652c-0.058-0.104-0.12-0.174-0.186-0.214s-0.148-0.06-0.248-0.06c-0.112 0-0.212 0.026-0.302 0.076s-0.186 0.138-0.292 0.262c-0.106 0.122-0.246 0.316-0.42 0.58l-0.514-0.34c0.332-0.5 0.652-0.876 0.958-1.12 0.306-0.248 0.666-0.372 1.08-0.372z\"/><path d=\"m463 7.88c0.516 0 0.962 0.0422 1.34 0.127l-0.308 1.34h-0.696c-0.074-0.301-0.17-0.517-0.288-0.649-0.12-0.132-0.294-0.198-0.526-0.198-0.302 0-0.556 0.083-0.764 0.249-0.208 0.166-0.386 0.413-0.534 0.74-0.148 0.327-0.284 0.767-0.412 1.32l-0.198 0.862h2.03l-0.174 0.799h-2.04l-1.47 6.9c-0.244 1.14-0.614 2-1.12 2.56-0.5 0.562-1.13 0.842-1.89 0.842-0.222 0-0.396-0.0132-0.522-0.0394l0.134-0.696c0.052 0.0158 0.176 0.0238 0.372 0.0238 0.238 0 0.44-0.0606 0.608-0.182 0.17-0.121 0.326-0.332 0.472-0.633 0.144-0.301 0.278-0.717 0.4-1.25l1.7-7.52h-1.34l0.12-0.546c0.352-0.021 0.608-0.05 0.762-0.087 0.156-0.0368 0.278-0.0922 0.364-0.166 0.088-0.074 0.162-0.17 0.222-0.289s0.138-0.336 0.234-0.653c0.28-0.949 0.71-1.66 1.29-2.14 0.584-0.477 1.33-0.716 2.23-0.716z\"/><path d=\"m482 7.11c1.54 0.406 2.72 1.28 3.55 2.63 0.826 1.35 1.24 2.97 1.24 4.88 0 1.91-0.41 3.53-1.23 4.88-0.822 1.34-2.01 2.22-3.55 2.62l-0.19-0.609c1.22-0.406 2.12-1.21 2.72-2.4s0.89-2.72 0.89-4.56c0-1.78-0.296-3.26-0.886-4.44-0.59-1.18-1.51-1.97-2.74-2.38l0.212-0.609zm-10.1 0 0.212 0.609c-1.23 0.406-2.15 1.2-2.74 2.38-0.594 1.18-0.89 2.66-0.89 4.44 0 1.85 0.296 3.37 0.89 4.56s1.5 2 2.72 2.4l-0.19 0.609c-1.55-0.406-2.73-1.28-3.55-2.62-0.824-1.34-1.23-2.97-1.23-4.88 0-1.9 0.412-3.53 1.24-4.88 0.824-1.35 2.01-2.22 3.55-2.63z\"/><path d=\"m475 11.5c0.164 0 0.308 0.0184 0.432 0.0554s0.234 0.0936 0.328 0.17c0.096 0.0766 0.18 0.175 0.254 0.297 0.074 0.121 0.144 0.286 0.212 0.494 0.07 0.208 0.134 0.467 0.194 0.775 0.062 0.309 0.116 0.629 0.162 0.961h0.08c0.506-0.712 0.89-1.23 1.15-1.56 0.262-0.33 0.482-0.575 0.662-0.736 0.178-0.161 0.352-0.274 0.518-0.34 0.166-0.066 0.386-0.099 0.66-0.099 0.248 0 0.45 0.0318 0.61 0.095l-0.318 1.43h-0.552c-0.032-0.222-0.124-0.332-0.278-0.332-0.048 0-0.098 8e-3 -0.15 0.0238s-0.118 0.0502-0.194 0.103c-0.076 0.0528-0.188 0.156-0.336 0.309-0.148 0.153-0.314 0.34-0.498 0.562-0.186 0.221-0.374 0.453-0.57 0.696l-0.538 0.672c0.096 0.506 0.184 0.944 0.27 1.31 0.084 0.369 0.158 0.676 0.224 0.921s0.124 0.439 0.174 0.581 0.104 0.249 0.162 0.32 0.118 0.121 0.178 0.15c0.062 0.029 0.132 0.0434 0.21 0.0434 0.142 0 0.282-0.0554 0.416-0.166 0.134-0.111 0.328-0.361 0.58-0.751l0.516 0.34c-0.37 0.548-0.704 0.935-1 1.16s-0.652 0.336-1.06 0.336c-0.226 0-0.418-0.0408-0.576-0.123-0.16-0.0818-0.296-0.212-0.412-0.392-0.116-0.179-0.22-0.459-0.308-0.838-0.164-0.675-0.264-1.19-0.302-1.55h-0.078c-0.56 0.786-0.974 1.35-1.25 1.69s-0.496 0.596-0.672 0.759c-0.178 0.163-0.348 0.278-0.514 0.344s-0.388 0.0988-0.662 0.0988c-0.248 0-0.45-0.0316-0.608-0.0948l0.316-1.43h0.554c0.032 0.222 0.124 0.332 0.276 0.332 0.074 0 0.152-0.0198 0.234-0.0592 0.082-0.0396 0.2-0.135 0.352-0.285 0.152-0.15 0.364-0.386 0.632-0.708 0.27-0.322 0.66-0.804 1.17-1.45-0.08-0.417-0.162-0.817-0.246-1.2-0.084-0.385-0.172-0.743-0.26-1.08-0.09-0.332-0.164-0.55-0.222-0.653-0.058-0.103-0.12-0.174-0.186-0.214-0.066-0.0396-0.15-0.0594-0.25-0.0594-0.11 0-0.21 0.025-0.3 0.0752-0.09 0.05-0.188 0.137-0.292 0.261-0.106 0.124-0.246 0.318-0.42 0.581l-0.514-0.34c0.332-0.501 0.652-0.875 0.958-1.12s0.666-0.372 1.08-0.372z\"/><path d=\"m494 15.7h9.75v1.05h-9.75v-1.05zm0-3.28h9.75v1.05h-9.75v-1.05z\"/><path d=\"m510 14h9.74v5.58h-1.12v-4.54h-8.62v-1.04z\"/><path d=\"m524 11.5c0.164 0 0.308 0.0184 0.432 0.0554s0.234 0.0936 0.328 0.17c0.094 0.0766 0.18 0.175 0.254 0.297 0.072 0.121 0.144 0.286 0.212 0.494 0.07 0.208 0.134 0.467 0.194 0.775 0.062 0.309 0.116 0.629 0.162 0.961h0.08c0.506-0.712 0.89-1.23 1.15-1.56 0.262-0.33 0.482-0.575 0.662-0.736 0.178-0.161 0.352-0.274 0.518-0.34 0.166-0.066 0.386-0.099 0.66-0.099 0.248 0 0.45 0.0318 0.608 0.095l-0.316 1.43h-0.554c-0.03-0.222-0.124-0.332-0.276-0.332-0.048 0-0.098 8e-3 -0.15 0.0238-0.054 0.0158-0.118 0.0502-0.194 0.103-0.076 0.0528-0.188 0.156-0.336 0.309-0.148 0.153-0.314 0.34-0.498 0.562-0.186 0.221-0.376 0.453-0.57 0.696l-0.538 0.672c0.094 0.506 0.184 0.944 0.268 1.31 0.086 0.369 0.16 0.676 0.226 0.921s0.124 0.439 0.174 0.581 0.104 0.249 0.162 0.32 0.118 0.121 0.178 0.15c0.062 0.029 0.13 0.0434 0.21 0.0434 0.142 0 0.28-0.0554 0.416-0.166 0.134-0.111 0.328-0.361 0.58-0.751l0.514 0.34c-0.368 0.548-0.702 0.935-1 1.16s-0.652 0.336-1.06 0.336c-0.226 0-0.418-0.0408-0.578-0.123-0.158-0.0818-0.294-0.212-0.41-0.392-0.116-0.179-0.22-0.459-0.308-0.838-0.164-0.675-0.264-1.19-0.302-1.55h-0.078c-0.56 0.786-0.974 1.35-1.25 1.69s-0.496 0.596-0.672 0.759c-0.178 0.163-0.348 0.278-0.514 0.344-0.168 0.066-0.388 0.0988-0.662 0.0988-0.248 0-0.45-0.0316-0.608-0.0948l0.316-1.43h0.554c0.032 0.222 0.124 0.332 0.276 0.332 0.074 0 0.152-0.0198 0.234-0.0592 0.082-0.0396 0.198-0.135 0.352-0.285 0.152-0.15 0.364-0.386 0.632-0.708 0.27-0.322 0.66-0.804 1.17-1.45-0.08-0.417-0.162-0.817-0.246-1.2-0.084-0.385-0.172-0.743-0.26-1.08-0.09-0.332-0.164-0.55-0.222-0.653-0.058-0.103-0.12-0.174-0.186-0.214-0.066-0.0396-0.15-0.0594-0.25-0.0594-0.11 0-0.21 0.025-0.3 0.0752-0.09 0.05-0.188 0.137-0.292 0.261-0.106 0.124-0.246 0.318-0.42 0.581l-0.514-0.34c0.332-0.501 0.652-0.875 0.956-1.12 0.306-0.248 0.668-0.372 1.08-0.372z\"/></g><path d=\"m121 360c-0.941 0.455-2.17 0.683-3.68 0.683-1.98 0-3.53-0.581-4.66-1.74s-1.7-2.71-1.7-4.64c0-2.06 0.635-3.73 1.9-5.01 1.28-1.28 2.93-1.92 4.96-1.92 1.26 0 2.32 0.159 3.18 0.476v2.79c-0.863-0.515-1.84-0.773-2.95-0.773-1.21 0-2.19 0.381-2.93 1.14-0.743 0.761-1.11 1.79-1.11 3.09 0 1.25 0.35 2.24 1.05 2.98 0.701 0.737 1.64 1.1 2.83 1.1 1.13 0 2.17-0.276 3.11-0.827v2.65zm6.35 0.683c-1.53 0-2.74-0.429-3.62-1.28-0.875-0.863-1.31-2.03-1.31-3.5 0-1.52 0.455-2.71 1.37-3.57 0.91-0.862 2.14-1.29 3.69-1.29 1.53 0 2.73 0.432 3.59 1.29 0.869 0.857 1.3 1.99 1.3 3.4 0 1.53-0.449 2.73-1.35 3.62-0.892 0.886-2.12 1.33-3.67 1.33zm0.071-7.48c-0.67 0-1.19 0.23-1.56 0.691-0.371 0.462-0.557 1.11-0.557 1.96 0 1.77 0.713 2.65 2.14 2.65 1.36 0 2.04-0.907 2.04-2.72 0-1.72-0.686-2.58-2.06-2.58zm15.7 7.25h-2.83v-5.11c0-1.43-0.509-2.14-1.53-2.14-0.491 0-0.896 0.188-1.21 0.566-0.318 0.377-0.476 0.856-0.476 1.44v5.25h-2.84v-9.2h2.84v1.46h0.036c0.676-1.12 1.66-1.68 2.96-1.68 2.04 0 3.06 1.26 3.06 3.79v5.63zm1.65-0.243v-2.3c0.467 0.282 0.932 0.492 1.39 0.629 0.467 0.138 0.907 0.207 1.32 0.207 0.503 0 0.898-0.069 1.19-0.207 0.293-0.137 0.44-0.347 0.44-0.629 0-0.179-0.066-0.329-0.198-0.449s-0.302-0.224-0.512-0.314c-0.204-0.09-0.428-0.171-0.674-0.243-0.245-0.072-0.482-0.153-0.71-0.242-0.365-0.138-0.688-0.285-0.97-0.441-0.275-0.161-0.509-0.347-0.701-0.557-0.185-0.209-0.329-0.452-0.431-0.727-0.096-0.276-0.144-0.602-0.144-0.98 0-0.515 0.111-0.958 0.333-1.33 0.227-0.372 0.527-0.674 0.898-0.908 0.377-0.239 0.806-0.413 1.28-0.521 0.485-0.114 0.988-0.171 1.51-0.171 0.408 0 0.821 0.033 1.24 0.099 0.419 0.06 0.833 0.15 1.24 0.27v2.19c-0.359-0.21-0.746-0.365-1.16-0.467-0.407-0.108-0.809-0.162-1.2-0.162-0.186 0-0.362 0.018-0.53 0.054-0.162 0.03-0.305 0.078-0.431 0.144-0.126 0.06-0.225 0.14-0.297 0.242-0.072 0.096-0.108 0.207-0.108 0.333 0 0.167 0.054 0.311 0.162 0.431s0.249 0.225 0.422 0.314c0.174 0.084 0.366 0.162 0.575 0.234 0.216 0.066 0.429 0.135 0.638 0.207 0.378 0.131 0.719 0.275 1.02 0.431 0.305 0.156 0.566 0.338 0.781 0.548 0.222 0.21 0.39 0.455 0.503 0.737 0.12 0.281 0.18 0.617 0.18 1.01 0 0.545-0.12 1.01-0.359 1.4-0.234 0.384-0.548 0.698-0.944 0.944-0.389 0.239-0.841 0.413-1.36 0.521-0.509 0.114-1.04 0.171-1.59 0.171-1.01 0-1.95-0.156-2.81-0.468zm14.3 0.135c-0.419 0.222-1.05 0.333-1.9 0.333-2 0-3-1.04-3-3.12v-4.21h-1.49v-2.09h1.49v-1.99l2.83-0.808v2.79h2.07v2.09h-2.07v3.72c0 0.958 0.38 1.44 1.14 1.44 0.3 0 0.608-0.086 0.925-0.26v2.1zm9.26 0.108h-2.69v-1.32h-0.036c-0.617 1.03-1.53 1.55-2.74 1.55-0.893 0-1.6-0.252-2.11-0.755-0.51-0.509-0.764-1.19-0.764-2.03 0-1.78 1.06-2.82 3.17-3.09l2.5-0.333c0-1.01-0.545-1.51-1.64-1.51-1.1 0-2.14 0.326-3.13 0.979v-2.14c0.396-0.204 0.935-0.383 1.62-0.539 0.689-0.156 1.32-0.234 1.88-0.234 2.62 0 3.94 1.31 3.94 3.93v5.5zm-2.67-3.74v-0.62l-1.67 0.215c-0.922 0.12-1.38 0.536-1.38 1.25 0 0.323 0.111 0.59 0.333 0.8 0.227 0.203 0.533 0.305 0.916 0.305 0.533 0 0.967-0.183 1.3-0.548 0.335-0.371 0.503-0.838 0.503-1.4zm13.8 3.74h-2.83v-5.11c0-1.43-0.509-2.14-1.53-2.14-0.492 0-0.896 0.188-1.21 0.566-0.318 0.377-0.476 0.856-0.476 1.44v5.25h-2.84v-9.2h2.84v1.46h0.035c0.677-1.12 1.66-1.68 2.96-1.68 2.04 0 3.06 1.26 3.06 3.79v5.63zm7.82-0.108c-0.419 0.222-1.05 0.333-1.9 0.333-2 0-3-1.04-3-3.12v-4.21h-1.49v-2.09h1.49v-1.99l2.83-0.808v2.79h2.07v2.09h-2.07v3.72c0 0.958 0.38 1.44 1.14 1.44 0.3 0 0.608-0.086 0.925-0.26v2.1z\" fill=\"#000\"/><path d=\"m477 347-4.44 12.9h-3.29l-4.38-12.9h3.13l2.69 8.97c0.143 0.485 0.23 0.913 0.26 1.28h0.054c0.042-0.402 0.135-0.842 0.279-1.32l2.67-8.93h3.04zm7.54 12.9h-2.69v-1.32h-0.036c-0.617 1.03-1.53 1.55-2.74 1.55-0.892 0-1.6-0.252-2.11-0.755-0.509-0.509-0.764-1.19-0.764-2.03 0-1.78 1.06-2.82 3.17-3.09l2.5-0.333c0-1.01-0.545-1.51-1.64-1.51-1.1 0-2.14 0.326-3.13 0.979v-2.14c0.395-0.204 0.934-0.383 1.62-0.539 0.689-0.156 1.32-0.234 1.88-0.234 2.62 0 3.94 1.31 3.94 3.93v5.5zm-2.67-3.74v-0.62l-1.67 0.215c-0.922 0.12-1.38 0.536-1.38 1.25 0 0.323 0.11 0.59 0.332 0.8 0.228 0.203 0.533 0.305 0.916 0.305 0.534 0 0.968-0.183 1.3-0.548 0.336-0.371 0.503-0.838 0.503-1.4zm10.9-2.9c-0.341-0.186-0.739-0.279-1.2-0.279-0.617 0-1.1 0.228-1.45 0.683-0.347 0.449-0.521 1.06-0.521 1.84v4.39h-2.84v-9.2h2.84v1.71h0.036c0.449-1.25 1.26-1.87 2.43-1.87 0.299 0 0.533 0.036 0.7 0.108v2.62zm2.84-4.02c-0.479 0-0.871-0.141-1.18-0.423-0.305-0.287-0.458-0.638-0.458-1.05 0-0.425 0.153-0.773 0.458-1.04 0.306-0.27 0.698-0.404 1.18-0.404 0.486 0 0.878 0.134 1.18 0.404 0.306 0.269 0.459 0.617 0.459 1.04 0 0.431-0.153 0.785-0.459 1.06-0.299 0.276-0.691 0.414-1.18 0.414zm1.4 10.7h-2.84v-9.2h2.84v9.2zm10 0h-2.69v-1.32h-0.036c-0.617 1.03-1.53 1.55-2.74 1.55-0.892 0-1.6-0.252-2.11-0.755-0.509-0.509-0.764-1.19-0.764-2.03 0-1.78 1.06-2.82 3.17-3.09l2.5-0.333c0-1.01-0.545-1.51-1.64-1.51-1.1 0-2.14 0.326-3.13 0.979v-2.14c0.396-0.204 0.935-0.383 1.62-0.539 0.688-0.156 1.31-0.234 1.88-0.234 2.62 0 3.94 1.31 3.94 3.93v5.5zm-2.67-3.74v-0.62l-1.67 0.215c-0.922 0.12-1.38 0.536-1.38 1.25 0 0.323 0.111 0.59 0.333 0.8 0.227 0.203 0.533 0.305 0.916 0.305 0.533 0 0.968-0.183 1.3-0.548 0.335-0.371 0.503-0.838 0.503-1.4zm7.79 2.67h-0.036v1.07h-2.84v-13.6h2.84v5.8h0.036c0.7-1.07 1.7-1.61 2.99-1.61 1.19 0 2.1 0.408 2.74 1.22 0.641 0.815 0.961 1.93 0.961 3.34 0 1.53-0.374 2.76-1.12 3.69s-1.75 1.39-3 1.39c-1.13 0-1.99-0.432-2.57-1.29zm-0.081-3.88v0.943c0 0.593 0.17 1.08 0.512 1.47 0.341 0.39 0.778 0.584 1.31 0.584 0.646 0 1.15-0.248 1.5-0.745 0.359-0.503 0.539-1.21 0.539-2.13 0-0.76-0.165-1.35-0.494-1.78-0.324-0.431-0.788-0.646-1.39-0.646-0.569 0-1.04 0.212-1.42 0.638-0.372 0.425-0.557 0.979-0.557 1.66zm11.5 4.95h-2.84v-13.6h2.84v13.6zm10.7-3.79h-6c0.096 1.34 0.937 2 2.52 2 1.01 0 1.9-0.239 2.67-0.719v2.05c-0.851 0.455-1.96 0.683-3.32 0.683-1.48 0-2.64-0.411-3.46-1.23-0.82-0.827-1.23-1.98-1.23-3.45 0-1.53 0.443-2.74 1.33-3.63 0.887-0.892 1.98-1.34 3.27-1.34 1.34 0 2.38 0.399 3.11 1.2 0.737 0.797 1.1 1.88 1.1 3.24v1.2zm-2.63-1.74c0-1.32-0.533-1.98-1.6-1.98-0.456 0-0.851 0.189-1.19 0.566-0.33 0.377-0.53 0.848-0.602 1.41h3.39z\" fill=\"#000\"/><g clip-rule=\"evenodd\" fill=\"#000\" fill-rule=\"evenodd\"><path d=\"m242 183h1.25v15.1h-1.25v-15.1z\"/><path d=\"m250 184c-0.374 0-0.686 0.11-0.936 0.332-0.252 0.222-0.454 0.54-0.608 0.956s-0.264 0.924-0.328 1.52c-0.066 0.598-0.098 1.27-0.098 2.02 0 1.76 0.164 3.05 0.49 3.88 0.328 0.826 0.834 1.24 1.52 1.24 0.654 0 1.14-0.388 1.46-1.16 0.316-0.776 0.474-1.98 0.474-3.6 0-1.24-0.082-2.25-0.244-3.02s-0.388-1.32-0.676-1.66c-0.29-0.334-0.64-0.502-1.05-0.502zm0.04-0.69c1.18 0 2.06 0.458 2.64 1.37 0.578 0.914 0.868 2.29 0.868 4.14 0 1.91-0.31 3.36-0.928 4.34-0.618 0.982-1.52 1.47-2.71 1.47-1.17 0-2.04-0.46-2.61-1.38s-0.854-2.31-0.854-4.18c0-0.994 0.088-1.85 0.262-2.58 0.176-0.724 0.422-1.32 0.738-1.8 0.316-0.472 0.696-0.822 1.14-1.05 0.442-0.228 0.926-0.342 1.45-0.342z\"/><path d=\"m256 182 3.24 7.28v0.6l-3.24 7.29-0.866-0.308 2.6-7.28-2.6-7.29 0.866-0.292z\"/><path d=\"m139 72.2h1.25v15.1h-1.25v-15.1z\"/><path d=\"m148 72.6h0.444c-0.032 0.519-0.048 1.24-0.048 2.16v6.92c0 0.313 0.018 0.55 0.052 0.709 0.036 0.159 0.098 0.289 0.188 0.389 0.088 0.1 0.216 0.178 0.384 0.235 0.168 0.0566 0.378 0.0998 0.632 0.13s0.59 0.05 1.01 0.0608v0.592h-5.99v-0.592c0.6-0.027 1.03-0.0634 1.28-0.109 0.258-0.046 0.454-0.115 0.588-0.207 0.136-0.0918 0.234-0.221 0.296-0.389 0.062-0.167 0.094-0.44 0.094-0.819v-6.57c0-0.216-0.038-0.374-0.114-0.474-0.076-0.0998-0.186-0.15-0.332-0.15-0.174 0-0.42 0.089-0.738 0.267-0.32 0.178-0.714 0.424-1.18 0.738l-0.356-0.624 3.79-2.26z\"/><path d=\"m153 71.5 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m208 115h1.25v15.1h-1.25v-15.1z\"/><path d=\"m217 117h1.15v4.67h4.42v1.08h-4.42v4.67h-1.15v-4.67h-4.42v-1.08h4.42v-4.67z\"/><path d=\"m225 114 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m208 248h1.25v15.1h-1.25v-15.1z\"/><path d=\"m212 255h9.99v1.08h-9.99v-1.08z\"/><path d=\"m225 247 3.23 7.28v0.6l-3.23 7.29-0.866-0.308 2.6-7.28-2.6-7.29 0.866-0.292z\"/><path d=\"m132 292h9.99v1.08h-9.99v-1.08z\"/><path d=\"m145 285h1.25v15.1h-1.25v-15.1z\"/><path d=\"m154 286h0.444c-0.032 0.52-0.048 1.24-0.048 2.16v6.92c0 0.314 0.018 0.55 0.054 0.71 0.034 0.16 0.096 0.29 0.186 0.39 0.088 0.1 0.216 0.178 0.384 0.234 0.168 0.058 0.378 0.1 0.632 0.13s0.59 0.05 1.01 0.06v0.592h-5.99v-0.592c0.6-0.026 1.03-0.062 1.28-0.108 0.258-0.046 0.454-0.116 0.588-0.208 0.136-0.092 0.234-0.22 0.296-0.388s0.094-0.44 0.094-0.82v-6.57c0-0.216-0.038-0.374-0.114-0.474s-0.186-0.15-0.332-0.15c-0.174 0-0.42 0.088-0.738 0.266-0.318 0.18-0.714 0.424-1.18 0.738l-0.356-0.624 3.79-2.26z\"/><path d=\"m159 285 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m27.9 189h9.99v1.08h-9.99v-1.08z\"/><path d=\"m41 183h1.25v15.1h-1.25v-15.1z\"/><path d=\"m48.9 184c-0.373 0-0.685 0.11-0.936 0.332-0.251 0.222-0.454 0.54-0.608 0.956s-0.264 0.924-0.328 1.52c-0.0648 0.598-0.0972 1.27-0.0972 2.02 0 1.76 0.163 3.05 0.49 3.88 0.327 0.826 0.833 1.24 1.52 1.24 0.654 0 1.14-0.388 1.45-1.16 0.316-0.776 0.474-1.98 0.474-3.6 0-1.24-0.081-2.25-0.243-3.02-0.162-0.77-0.388-1.32-0.677-1.66-0.289-0.334-0.639-0.502-1.05-0.502zm0.0406-0.69c1.18 0 2.06 0.458 2.64 1.37 0.578 0.914 0.867 2.29 0.867 4.14 0 1.91-0.309 3.36-0.928 4.34-0.619 0.982-1.52 1.47-2.71 1.47-1.17 0-2.04-0.46-2.61-1.38-0.57-0.918-0.855-2.31-0.855-4.18 0-0.994 0.0878-1.85 0.263-2.58s0.422-1.32 0.738-1.8c0.316-0.472 0.696-0.822 1.14-1.05 0.443-0.228 0.927-0.342 1.45-0.342z\"/><path d=\"m55.2 182 3.23 7.28v0.6l-3.23 7.29-0.867-0.308 2.6-7.28-2.6-7.29 0.867-0.292z\"/><path d=\"m57.3 254h9.99v1.08h-9.99v-1.08z\"/><path d=\"m70.4 248h1.25v15.1h-1.25v-15.1z\"/><path d=\"m79.3 250h1.15v4.67h4.42v1.08h-4.42v4.67h-1.15v-4.67h-4.42v-1.08h4.42v-4.67z\"/><path d=\"m87.8 247 3.23 7.28v0.6l-3.23 7.29-0.867-0.308 2.6-7.28-2.6-7.29 0.867-0.292z\"/><path d=\"m56.6 121h9.99v1.08h-9.99v-1.08z\"/><path d=\"m69.8 115h1.25v15.1h-1.25v-15.1z\"/><path d=\"m74.3 121h9.99v1.08h-9.99v-1.08z\"/><path d=\"m87.1 114 3.23 7.28v0.599l-3.23 7.29-0.867-0.308 2.6-7.28-2.6-7.29 0.867-0.292z\"/><path d=\"m593 183h1.25v15.1h-1.25v-15.1z\"/><path d=\"m601 184c-0.372 0-0.684 0.11-0.936 0.332-0.25 0.222-0.454 0.54-0.608 0.956s-0.262 0.924-0.328 1.52c-0.064 0.598-0.096 1.27-0.096 2.02 0 1.76 0.162 3.05 0.49 3.88 0.326 0.826 0.834 1.24 1.52 1.24 0.654 0 1.14-0.388 1.45-1.16s0.474-1.98 0.474-3.6c0-1.24-0.08-2.25-0.242-3.02s-0.388-1.32-0.678-1.66c-0.288-0.334-0.638-0.502-1.05-0.502zm0.042-0.69c1.18 0 2.06 0.458 2.64 1.37 0.578 0.914 0.868 2.29 0.868 4.14 0 1.91-0.31 3.36-0.93 4.34-0.618 0.982-1.52 1.47-2.71 1.47-1.17 0-2.04-0.46-2.61-1.38s-0.856-2.31-0.856-4.18c0-0.994 0.088-1.85 0.264-2.58s0.422-1.32 0.738-1.8c0.316-0.472 0.696-0.822 1.14-1.05 0.444-0.228 0.928-0.342 1.45-0.342z\"/><path d=\"m607 182 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m490 72.2h1.25v15.1h-1.25v-15.1z\"/><path d=\"m499 72.6h0.446c-0.032 0.519-0.048 1.24-0.048 2.16v6.92c0 0.313 0.018 0.55 0.052 0.709 0.036 0.159 0.098 0.289 0.186 0.389 0.09 0.1 0.218 0.178 0.386 0.235 0.168 0.0566 0.378 0.0998 0.632 0.13s0.588 0.05 1 0.0608v0.592h-5.99v-0.592c0.6-0.027 1.03-0.0634 1.29-0.109 0.256-0.046 0.452-0.115 0.588-0.207 0.134-0.0918 0.234-0.221 0.296-0.389 0.062-0.167 0.092-0.44 0.092-0.819v-6.57c0-0.216-0.038-0.374-0.114-0.474-0.074-0.0998-0.186-0.15-0.332-0.15-0.172 0-0.418 0.089-0.736 0.267-0.32 0.178-0.714 0.424-1.18 0.738l-0.358-0.624 3.79-2.26z\"/><path d=\"m504 71.5 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m559 115h1.25v15.1h-1.25v-15.1z\"/><path d=\"m567 117h1.15v4.67h4.42v1.08h-4.42v4.67h-1.15v-4.67h-4.42v-1.08h4.42v-4.67z\"/><path d=\"m576 114 3.23 7.28v0.6l-3.23 7.29-0.866-0.308 2.6-7.28-2.6-7.29 0.866-0.292z\"/><path d=\"m559 248h1.25v15.1h-1.25v-15.1z\"/><path d=\"m563 255h9.99v1.08h-9.99v-1.08z\"/><path d=\"m576 247 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m483 292h9.99v1.08h-9.99v-1.08z\"/><path d=\"m496 285h1.25v15.1h-1.25v-15.1z\"/><path d=\"m505 286h0.446c-0.032 0.52-0.048 1.24-0.048 2.16v6.92c0 0.314 0.018 0.55 0.052 0.71 0.036 0.16 0.098 0.29 0.186 0.39 0.09 0.1 0.218 0.178 0.386 0.234 0.168 0.058 0.378 0.1 0.632 0.13s0.588 0.05 1 0.06v0.592h-5.99v-0.592c0.598-0.026 1.03-0.062 1.28-0.108s0.452-0.116 0.588-0.208c0.134-0.092 0.234-0.22 0.296-0.388s0.092-0.44 0.092-0.82v-6.57c0-0.216-0.038-0.374-0.114-0.474-0.074-0.1-0.186-0.15-0.332-0.15-0.172 0-0.418 0.088-0.736 0.266-0.32 0.18-0.714 0.424-1.18 0.738l-0.358-0.624 3.79-2.26z\"/><path d=\"m510 285 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m379 189h9.99v1.08h-9.99v-1.08z\"/><path d=\"m392 183h1.25v15.1h-1.25v-15.1z\"/><path d=\"m400 184c-0.372 0-0.684 0.11-0.936 0.332-0.25 0.222-0.454 0.54-0.608 0.956s-0.262 0.924-0.328 1.52c-0.064 0.598-0.098 1.27-0.098 2.02 0 1.76 0.164 3.05 0.492 3.88 0.326 0.826 0.832 1.24 1.52 1.24 0.652 0 1.14-0.388 1.45-1.16s0.474-1.98 0.474-3.6c0-1.24-0.08-2.25-0.242-3.02-0.164-0.77-0.388-1.32-0.678-1.66-0.288-0.334-0.638-0.502-1.05-0.502zm0.042-0.69c1.18 0 2.06 0.458 2.64 1.37 0.578 0.914 0.866 2.29 0.866 4.14 0 1.91-0.308 3.36-0.928 4.34-0.618 0.982-1.52 1.47-2.71 1.47-1.17 0-2.04-0.46-2.61-1.38s-0.856-2.31-0.856-4.18c0-0.994 0.088-1.85 0.264-2.58s0.422-1.32 0.738-1.8c0.316-0.472 0.696-0.822 1.14-1.05 0.444-0.228 0.926-0.342 1.45-0.342z\"/><path d=\"m406 182 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m408 254h9.99v1.08h-9.99v-1.08z\"/><path d=\"m421 248h1.25v15.1h-1.25v-15.1z\"/><path d=\"m430 250h1.15v4.67h4.42v1.08h-4.42v4.67h-1.15v-4.67h-4.42v-1.08h4.42v-4.67z\"/><path d=\"m439 247 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m408 121h9.99v1.08h-9.99v-1.08z\"/><path d=\"m421 115h1.25v15.1h-1.25v-15.1z\"/><path d=\"m425 121h9.99v1.08h-9.99v-1.08z\"/><path d=\"m438 114 3.23 7.28v0.599l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/></g></g><defs><clipPath id=\"clip0_5_635\"><rect transform=\"translate(.6 .2)\" width=\"737\" height=\"374\" fill=\"#fff\"/></clipPath></defs></svg>\n\n3. Apply the $H$ gate to the qubit again.\n Now, we get the $\\ket{0}$ state for both constant scenarios and the $\\ket{1}$ state for both variable scenarios!\n <br/>\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg width=\"679\" height=\"365\" fill=\"none\" version=\"1.1\" viewBox=\"0 0 679 365\" xmlns=\"http://www.w3.org/2000/svg\"><g clip-path=\"url(#clip0_6_812)\"><g clip-rule=\"evenodd\" fill-rule=\"evenodd\"><path d=\"m24.1 163c0-76.8 62.3-139 139-139 76.8 0 139 62.3 139 139 0 76.8-62.3 139-139 139-76.8 0-139-62.3-139-139z\" stroke=\"#747474\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"/><path d=\"m296 163c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9-2.64 5.9-5.9 5.9-5.9-2.64-5.9-5.9z\" fill=\"#0070C0\"/><path d=\"m157 23.8c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9c0 3.26-2.64 5.9-5.9 5.9s-5.9-2.64-5.9-5.9z\" fill=\"#fff\" stroke=\"#000\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"/><path d=\"m18 163c0-3.26 2.69-5.9 6-5.9 3.31 0 6 2.64 6 5.9s-2.69 5.9-6 5.9c-3.31 0-6-2.64-6-5.9z\" fill=\"#0070C0\"/><g fill=\"#fff\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"><path d=\"m157 302c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9-2.64 5.9-5.9 5.9-5.9-2.64-5.9-5.9z\" stroke=\"#000\"/><path d=\"m257 66.6c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9c0 3.26-2.69 5.9-6 5.9s-6-2.64-6-5.9z\" stroke=\"#0070C0\"/><path d=\"m257 260c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\" stroke=\"#000\"/><path d=\"m57.3 66.6c0-3.26 2.69-5.9 6-5.9 3.31 0 6 2.64 6 5.9 0 3.26-2.69 5.9-6 5.9-3.31 0-6-2.64-6-5.9z\" stroke=\"#000\"/><path d=\"m57.3 260c0-3.26 2.69-5.9 6-5.9 3.31 0 6 2.64 6 5.9s-2.69 5.9-6 5.9c-3.31 0-6-2.64-6-5.9z\" stroke=\"#0070C0\"/></g><path d=\"m375 163c0-76.8 62.2-139 139-139s139 62.3 139 139c0 76.8-62.2 139-139 139s-139-62.3-139-139z\" stroke=\"#747474\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"/><path d=\"m647 163c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\" fill=\"#fff\" stroke=\"#000\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"/><path d=\"m508 23.7c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9c0 3.26-2.69 5.9-6 5.9s-6-2.64-6-5.9z\" fill=\"#0070C0\"/><path d=\"m369 163c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9-2.64 5.9-5.9 5.9-5.9-2.64-5.9-5.9z\" fill=\"#fff\" stroke=\"#000\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"/><path d=\"m508 302c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\" fill=\"#0070C0\"/><g fill=\"#fff\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"><path d=\"m608 66.6c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9c0 3.26-2.69 5.9-6 5.9s-6-2.64-6-5.9z\" stroke=\"#000\"/><path d=\"m608 260c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\" stroke=\"#0070C0\"/><path d=\"m408 66.6c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9c0 3.26-2.64 5.9-5.9 5.9s-5.9-2.64-5.9-5.9z\" stroke=\"#0070C0\"/><path d=\"m408 260c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9-2.64 5.9-5.9 5.9-5.9-2.64-5.9-5.9z\" stroke=\"#000\"/></g></g><g fill=\"#0070C0\"><path d=\"m309 162h15.1l-0.688 0.688v-96.5l0.688 0.688h-55.3v-1.38h56v97.9h-15.8v-1.38zm5.06 5.8-6.13-5.11 6.13-5.11c0.292-0.242 0.726-0.202 0.968 0.088 0.244 0.292 0.204 0.726-0.088 0.97l-5.5 4.58v-1.06l5.5 4.58c0.292 0.242 0.332 0.676 0.088 0.968-0.242 0.292-0.676 0.33-0.968 0.088z\"/><path d=\"m17 164h-15.4l0.688-0.688v96.5l-0.688-0.688h55.7v1.38h-56.3v-97.9h16.1v1.38zm-5.06-5.8 6.13 5.11-6.13 5.11c-0.292 0.242-0.725 0.204-0.968-0.088-0.243-0.292-0.204-0.726 0.088-0.968l5.5-4.58v1.06l-5.5-4.58c-0.292-0.242-0.331-0.676-0.088-0.968 0.243-0.292 0.677-0.33 0.968-0.088z\"/><path d=\"m620 259h57.4l-0.688 0.686v-258l0.688 0.687h-163l0.688-0.687v15.4h-1.38v-16.1h165v260h-58.1v-1.37zm-101-247-5.11 6.13-5.11-6.13c-0.242-0.292-0.204-0.725 0.088-0.968 0.292-0.243 0.726-0.204 0.968 0.088l4.58 5.5h-1.06l4.58-5.5c0.242-0.292 0.676-0.331 0.968-0.088 0.292 0.243 0.33 0.677 0.088 0.968z\"/><path d=\"m408 67.4h-51.1l0.686-0.688v258l-0.686-0.688h157l-0.686 0.688v-15.4h1.37v16.1h-158v-259h51.8v1.38zm101 247 5.11-6.13 5.11 6.13c0.244 0.292 0.204 0.726-0.088 0.97-0.292 0.242-0.724 0.202-0.968-0.088l-4.58-5.5h1.06l-4.58 5.5c-0.244 0.29-0.676 0.33-0.968 0.088-0.292-0.244-0.332-0.678-0.088-0.97z\"/></g><path d=\"m135 350c-0.94 0.455-2.17 0.683-3.68 0.683-1.98 0-3.53-0.581-4.66-1.74s-1.7-2.71-1.7-4.64c0-2.06 0.635-3.73 1.9-5.01 1.28-1.28 2.93-1.92 4.96-1.92 1.26 0 2.32 0.159 3.18 0.476v2.79c-0.862-0.515-1.84-0.773-2.95-0.773-1.21 0-2.19 0.381-2.93 1.14-0.743 0.761-1.11 1.79-1.11 3.09 0 1.25 0.35 2.24 1.05 2.98 0.7 0.737 1.64 1.1 2.83 1.1 1.13 0 2.17-0.276 3.11-0.827v2.65zm6.35 0.683c-1.53 0-2.74-0.429-3.62-1.28-0.875-0.863-1.31-2.03-1.31-3.5 0-1.52 0.455-2.71 1.37-3.57 0.91-0.862 2.14-1.29 3.69-1.29 1.53 0 2.72 0.432 3.59 1.29 0.868 0.857 1.3 1.99 1.3 3.4 0 1.53-0.45 2.73-1.35 3.62-0.893 0.886-2.12 1.33-3.68 1.33zm0.072-7.48c-0.671 0-1.19 0.23-1.56 0.691-0.371 0.462-0.557 1.11-0.557 1.96 0 1.77 0.713 2.65 2.14 2.65 1.36 0 2.04-0.907 2.04-2.72 0-1.72-0.686-2.58-2.06-2.58zm15.7 7.25h-2.83v-5.11c0-1.43-0.509-2.14-1.53-2.14-0.492 0-0.896 0.188-1.21 0.566-0.318 0.377-0.477 0.856-0.477 1.44v5.25h-2.84v-9.2h2.84v1.46h0.036c0.677-1.12 1.66-1.68 2.96-1.68 2.04 0 3.06 1.26 3.06 3.79v5.63zm1.65-0.243v-2.3c0.467 0.282 0.931 0.492 1.39 0.629 0.467 0.138 0.907 0.207 1.32 0.207 0.503 0 0.899-0.069 1.19-0.207 0.294-0.137 0.441-0.347 0.441-0.629 0-0.179-0.066-0.329-0.198-0.449s-0.303-0.224-0.512-0.314c-0.204-0.09-0.429-0.171-0.674-0.243-0.246-0.072-0.482-0.153-0.71-0.242-0.365-0.138-0.689-0.285-0.97-0.441-0.276-0.161-0.509-0.347-0.701-0.557-0.186-0.209-0.329-0.452-0.431-0.727-0.096-0.276-0.144-0.602-0.144-0.98 0-0.515 0.111-0.958 0.332-1.33 0.228-0.372 0.528-0.674 0.899-0.908 0.377-0.239 0.806-0.413 1.28-0.521 0.485-0.114 0.988-0.171 1.51-0.171 0.407 0 0.821 0.033 1.24 0.099 0.419 0.06 0.832 0.15 1.24 0.27v2.19c-0.36-0.21-0.746-0.365-1.16-0.467-0.408-0.108-0.809-0.162-1.2-0.162-0.186 0-0.363 0.018-0.53 0.054-0.162 0.03-0.306 0.078-0.431 0.144-0.126 0.06-0.225 0.14-0.297 0.242-0.072 0.096-0.108 0.207-0.108 0.333 0 0.167 0.054 0.311 0.162 0.431s0.249 0.225 0.422 0.314c0.174 0.084 0.366 0.162 0.575 0.234 0.216 0.066 0.428 0.135 0.638 0.207 0.377 0.131 0.719 0.275 1.02 0.431 0.306 0.156 0.566 0.338 0.782 0.548 0.222 0.21 0.389 0.455 0.503 0.737 0.12 0.281 0.18 0.617 0.18 1.01 0 0.545-0.12 1.01-0.36 1.4-0.233 0.384-0.548 0.698-0.943 0.944-0.389 0.239-0.841 0.413-1.36 0.521-0.509 0.114-1.04 0.171-1.59 0.171-1.01 0-1.95-0.156-2.81-0.468zm14.3 0.135c-0.419 0.222-1.05 0.333-1.9 0.333-2 0-3-1.04-3-3.12v-4.21h-1.49v-2.09h1.49v-1.99l2.83-0.808v2.79h2.07v2.09h-2.07v3.72c0 0.958 0.38 1.44 1.14 1.44 0.299 0 0.608-0.086 0.925-0.26v2.1zm9.26 0.108h-2.69v-1.32h-0.036c-0.617 1.03-1.53 1.55-2.74 1.55-0.893 0-1.6-0.252-2.11-0.755-0.509-0.509-0.763-1.19-0.763-2.03 0-1.78 1.06-2.82 3.17-3.09l2.5-0.333c0-1.01-0.545-1.51-1.64-1.51-1.1 0-2.14 0.326-3.13 0.979v-2.14c0.395-0.204 0.934-0.383 1.62-0.539 0.689-0.156 1.32-0.234 1.88-0.234 2.62 0 3.94 1.31 3.94 3.93v5.5zm-2.67-3.74v-0.62l-1.67 0.215c-0.923 0.12-1.38 0.536-1.38 1.25 0 0.323 0.111 0.59 0.333 0.8 0.227 0.203 0.533 0.305 0.916 0.305 0.533 0 0.967-0.183 1.3-0.548 0.335-0.371 0.503-0.838 0.503-1.4zm13.8 3.74h-2.83v-5.11c0-1.43-0.509-2.14-1.53-2.14-0.491 0-0.895 0.188-1.21 0.566-0.317 0.377-0.476 0.856-0.476 1.44v5.25h-2.84v-9.2h2.84v1.46h0.036c0.677-1.12 1.66-1.68 2.96-1.68 2.04 0 3.06 1.26 3.06 3.79v5.63zm7.82-0.108c-0.419 0.222-1.05 0.333-1.9 0.333-2 0-3-1.04-3-3.12v-4.21h-1.49v-2.09h1.49v-1.99l2.83-0.808v2.79h2.07v2.09h-2.07v3.72c0 0.958 0.38 1.44 1.14 1.44 0.299 0 0.608-0.086 0.925-0.26v2.1z\" fill=\"#000\"/><path d=\"m491 338-4.44 12.9h-3.29l-4.38-12.9h3.13l2.69 8.97c0.144 0.485 0.23 0.913 0.26 1.28h0.054c0.042-0.402 0.135-0.842 0.279-1.32l2.67-8.93h3.04zm7.54 12.9h-2.69v-1.32h-0.036c-0.616 1.03-1.53 1.55-2.74 1.55-0.892 0-1.6-0.252-2.11-0.755-0.509-0.509-0.764-1.19-0.764-2.03 0-1.78 1.06-2.82 3.17-3.09l2.5-0.333c0-1.01-0.545-1.51-1.64-1.51-1.1 0-2.14 0.326-3.13 0.979v-2.14c0.395-0.204 0.934-0.383 1.62-0.539 0.689-0.156 1.32-0.234 1.88-0.234 2.62 0 3.94 1.31 3.94 3.93v5.5zm-2.67-3.74v-0.62l-1.67 0.215c-0.922 0.12-1.38 0.536-1.38 1.25 0 0.323 0.11 0.59 0.332 0.8 0.228 0.203 0.533 0.305 0.916 0.305 0.534 0 0.968-0.183 1.3-0.548 0.336-0.371 0.503-0.838 0.503-1.4zm10.9-2.9c-0.341-0.186-0.739-0.279-1.2-0.279-0.616 0-1.1 0.228-1.45 0.683-0.347 0.449-0.521 1.06-0.521 1.84v4.39h-2.84v-9.2h2.84v1.71h0.036c0.449-1.25 1.26-1.87 2.43-1.87 0.299 0 0.533 0.036 0.7 0.108v2.62zm2.84-4.02c-0.479 0-0.871-0.141-1.18-0.423-0.305-0.287-0.458-0.638-0.458-1.05 0-0.425 0.153-0.773 0.458-1.04 0.306-0.27 0.698-0.404 1.18-0.404 0.486 0 0.878 0.134 1.18 0.404 0.306 0.269 0.459 0.617 0.459 1.04 0 0.431-0.153 0.785-0.459 1.06-0.299 0.276-0.691 0.414-1.18 0.414zm1.4 10.7h-2.84v-9.2h2.84v9.2zm10 0h-2.69v-1.32h-0.036c-0.617 1.03-1.53 1.55-2.74 1.55-0.892 0-1.6-0.252-2.11-0.755-0.509-0.509-0.764-1.19-0.764-2.03 0-1.78 1.06-2.82 3.17-3.09l2.5-0.333c0-1.01-0.545-1.51-1.64-1.51-1.1 0-2.14 0.326-3.13 0.979v-2.14c0.396-0.204 0.935-0.383 1.62-0.539 0.688-0.156 1.31-0.234 1.88-0.234 2.62 0 3.94 1.31 3.94 3.93v5.5zm-2.67-3.74v-0.62l-1.67 0.215c-0.922 0.12-1.38 0.536-1.38 1.25 0 0.323 0.111 0.59 0.333 0.8 0.227 0.203 0.533 0.305 0.916 0.305 0.533 0 0.968-0.183 1.3-0.548 0.335-0.371 0.503-0.838 0.503-1.4zm7.79 2.67h-0.036v1.07h-2.84v-13.6h2.84v5.8h0.036c0.7-1.07 1.7-1.61 2.99-1.61 1.19 0 2.1 0.408 2.74 1.22 0.641 0.815 0.961 1.93 0.961 3.34 0 1.53-0.374 2.76-1.12 3.69s-1.75 1.39-3 1.39c-1.13 0-1.99-0.432-2.57-1.29zm-0.081-3.88v0.943c0 0.593 0.17 1.08 0.512 1.47 0.341 0.39 0.779 0.584 1.31 0.584 0.646 0 1.15-0.248 1.5-0.745 0.359-0.503 0.539-1.21 0.539-2.13 0-0.76-0.165-1.35-0.494-1.78-0.324-0.431-0.788-0.646-1.39-0.646-0.569 0-1.04 0.212-1.42 0.638-0.372 0.425-0.557 0.979-0.557 1.66zm11.5 4.95h-2.84v-13.6h2.84v13.6zm10.7-3.79h-6c0.096 1.34 0.937 2 2.52 2 1.01 0 1.9-0.239 2.67-0.719v2.05c-0.851 0.455-1.96 0.683-3.32 0.683-1.48 0-2.64-0.411-3.46-1.23-0.82-0.827-1.23-1.98-1.23-3.45 0-1.53 0.443-2.74 1.33-3.63 0.887-0.892 1.98-1.34 3.27-1.34 1.34 0 2.38 0.399 3.11 1.2 0.737 0.797 1.1 1.88 1.1 3.24v1.2zm-2.63-1.74c0-1.32-0.533-1.98-1.6-1.98-0.456 0-0.851 0.189-1.19 0.566-0.33 0.377-0.53 0.848-0.602 1.41h3.39z\" fill=\"#000\"/><g clip-rule=\"evenodd\" fill=\"#000\" fill-rule=\"evenodd\"><path d=\"m259 156h1.25v15.1h-1.25v-15.1z\"/><path d=\"m266 157c-0.372 0-0.684 0.11-0.936 0.332s-0.454 0.54-0.608 0.956-0.264 0.924-0.328 1.52c-0.064 0.598-0.098 1.27-0.098 2.02 0 1.76 0.164 3.05 0.49 3.88 0.328 0.824 0.834 1.24 1.52 1.24 0.654 0 1.14-0.386 1.46-1.16s0.474-1.98 0.474-3.6c0-1.24-0.082-2.25-0.244-3.02s-0.388-1.32-0.676-1.66c-0.29-0.334-0.64-0.502-1.05-0.502zm0.04-0.69c1.18 0 2.06 0.458 2.64 1.37 0.578 0.914 0.866 2.29 0.866 4.14 0 1.91-0.308 3.36-0.928 4.34-0.618 0.982-1.52 1.47-2.71 1.47-1.17 0-2.04-0.46-2.61-1.38s-0.856-2.31-0.856-4.18c0-0.994 0.088-1.85 0.264-2.58s0.42-1.32 0.738-1.8c0.316-0.472 0.694-0.822 1.14-1.05 0.442-0.228 0.926-0.342 1.45-0.342z\"/><path d=\"m273 156 3.23 7.28v0.598l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m156 45.5h1.25v15.1h-1.25v-15.1z\"/><path d=\"m164 45.9h0.446c-0.032 0.519-0.05 1.24-0.05 2.16v6.92c0 0.313 0.018 0.55 0.054 0.709 0.034 0.159 0.096 0.289 0.186 0.389s0.218 0.178 0.384 0.235c0.168 0.0568 0.38 0.1 0.634 0.13 0.254 0.0298 0.588 0.05 1 0.0608v0.592h-5.99v-0.592c0.6-0.027 1.03-0.0634 1.29-0.109 0.256-0.0458 0.452-0.115 0.586-0.207 0.136-0.0918 0.234-0.222 0.296-0.389 0.062-0.168 0.094-0.44 0.094-0.819v-6.57c0-0.216-0.038-0.374-0.114-0.474s-0.186-0.15-0.332-0.15c-0.172 0-0.418 0.0892-0.738 0.267-0.318 0.178-0.712 0.424-1.18 0.738l-0.356-0.624 3.79-2.26z\"/><path d=\"m170 44.8 3.23 7.28v0.6l-3.23 7.29-0.866-0.308 2.6-7.28-2.6-7.29 0.866-0.292z\"/><path d=\"m224 88.4h1.25v15.1h-1.25v-15.1z\"/><path d=\"m233 90h1.15v4.67h4.42v1.08h-4.42v4.67h-1.15v-4.67h-4.42v-1.08h4.42v-4.67z\"/><path d=\"m242 87.6 3.23 7.28v0.6l-3.23 7.29-0.866-0.308 2.6-7.28-2.6-7.29 0.866-0.292z\"/><path d=\"m224 222h1.25v15.1h-1.25v-15.1z\"/><path d=\"m229 228h9.99v1.08h-9.99v-1.08z\"/><path d=\"m242 221 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m149 265h9.99v1.08h-9.99v-1.08z\"/><path d=\"m162 259h1.25v15.1h-1.25v-15.1z\"/><path d=\"m171 259h0.446c-0.032 0.52-0.05 1.24-0.05 2.16v6.92c0 0.314 0.018 0.55 0.054 0.71 0.034 0.16 0.096 0.29 0.186 0.39s0.218 0.178 0.386 0.234c0.166 0.056 0.378 0.1 0.632 0.13s0.588 0.05 1 0.06v0.592h-5.99v-0.592c0.6-0.026 1.03-0.062 1.29-0.108 0.256-0.046 0.452-0.116 0.586-0.208 0.136-0.092 0.234-0.222 0.296-0.388 0.062-0.168 0.094-0.44 0.094-0.82v-6.57c0-0.216-0.038-0.374-0.114-0.474s-0.186-0.15-0.332-0.15c-0.172 0-0.418 0.088-0.738 0.266-0.318 0.178-0.712 0.424-1.18 0.738l-0.358-0.624 3.79-2.26z\"/><path d=\"m176 258 3.23 7.28v0.6l-3.23 7.29-0.866-0.308 2.6-7.28-2.6-7.29 0.866-0.292z\"/><path d=\"m44.7 163h9.99v1.08h-9.99v-1.08z\"/><path d=\"m57.9 156h1.25v15.1h-1.25v-15.1z\"/><path d=\"m65.7 157c-0.373 0-0.685 0.11-0.936 0.332s-0.454 0.54-0.608 0.956-0.264 0.924-0.328 1.52c-0.0648 0.598-0.0972 1.27-0.0972 2.02 0 1.76 0.163 3.05 0.49 3.88 0.327 0.824 0.833 1.24 1.52 1.24 0.654 0 1.14-0.386 1.45-1.16 0.316-0.776 0.474-1.98 0.474-3.6 0-1.24-0.081-2.25-0.243-3.02-0.162-0.77-0.388-1.32-0.677-1.66-0.289-0.334-0.639-0.502-1.05-0.502zm0.0406-0.69c1.18 0 2.06 0.458 2.64 1.37 0.578 0.914 0.867 2.29 0.867 4.14 0 1.91-0.309 3.36-0.928 4.34-0.619 0.982-1.52 1.47-2.71 1.47-1.17 0-2.04-0.46-2.61-1.38-0.57-0.918-0.855-2.31-0.855-4.18 0-0.994 0.0878-1.85 0.263-2.58s0.422-1.32 0.738-1.8c0.316-0.472 0.696-0.822 1.14-1.05 0.443-0.228 0.927-0.342 1.45-0.342z\"/><path d=\"m72 156 3.23 7.28v0.598l-3.23 7.29-0.867-0.308 2.6-7.28-2.6-7.29 0.867-0.292z\"/><path d=\"m74.1 228h9.99v1.08h-9.99v-1.08z\"/><path d=\"m87.3 221h1.25v15.1h-1.25v-15.1z\"/><path d=\"m96.2 223h1.15v4.67h4.42v1.08h-4.42v4.67h-1.15v-4.67h-4.42v-1.08h4.42v-4.67z\"/><path d=\"m105 220 3.23 7.28v0.598l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m73.4 94.2h9.99v1.08h-9.99v-1.08z\"/><path d=\"m86.6 87.9h1.25v15.1h-1.25v-15.1z\"/><path d=\"m91.1 94.2h9.99v1.08h-9.99v-1.08z\"/><path d=\"m104 87.2 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m608 156h1.25v15.1h-1.25v-15.1z\"/><path d=\"m616 157c-0.374 0-0.686 0.11-0.936 0.332-0.252 0.222-0.454 0.54-0.608 0.956s-0.264 0.924-0.328 1.52c-0.066 0.598-0.098 1.27-0.098 2.02 0 1.76 0.164 3.05 0.49 3.88 0.328 0.824 0.834 1.24 1.52 1.24 0.654 0 1.14-0.386 1.46-1.16s0.474-1.98 0.474-3.6c0-1.24-0.082-2.25-0.244-3.02s-0.388-1.32-0.676-1.66c-0.29-0.334-0.64-0.502-1.05-0.502zm0.04-0.69c1.18 0 2.06 0.458 2.64 1.37 0.578 0.914 0.868 2.29 0.868 4.14 0 1.91-0.31 3.36-0.928 4.34-0.618 0.982-1.52 1.47-2.71 1.47-1.17 0-2.04-0.46-2.61-1.38s-0.854-2.31-0.854-4.18c0-0.994 0.088-1.85 0.262-2.58 0.176-0.724 0.422-1.32 0.738-1.8 0.316-0.472 0.696-0.822 1.14-1.05 0.442-0.228 0.926-0.342 1.45-0.342z\"/><path d=\"m622 156 3.23 7.28v0.598l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m505 45.5h1.25v15.1h-1.25v-15.1z\"/><path d=\"m514 45.9h0.444c-0.032 0.519-0.048 1.24-0.048 2.16v6.92c0 0.313 0.018 0.55 0.054 0.709 0.034 0.159 0.096 0.289 0.186 0.389 0.088 0.1 0.216 0.178 0.384 0.235s0.378 0.1 0.632 0.13c0.254 0.0298 0.59 0.05 1.01 0.0608v0.592h-5.99v-0.592c0.6-0.027 1.03-0.0634 1.28-0.109 0.258-0.0458 0.454-0.115 0.588-0.207 0.136-0.0918 0.234-0.222 0.296-0.389 0.062-0.168 0.094-0.44 0.094-0.819v-6.57c0-0.216-0.038-0.374-0.114-0.474s-0.186-0.15-0.332-0.15c-0.174 0-0.42 0.0892-0.738 0.267-0.318 0.178-0.714 0.424-1.18 0.738l-0.356-0.624 3.79-2.26z\"/><path d=\"m519 44.8 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m574 88.4h1.25v15.1h-1.25v-15.1z\"/><path d=\"m583 90h1.15v4.67h4.42v1.08h-4.42v4.67h-1.15v-4.67h-4.42v-1.08h4.42v-4.67z\"/><path d=\"m591 87.6 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m574 222h1.25v15.1h-1.25v-15.1z\"/><path d=\"m578 228h9.99v1.08h-9.99v-1.08z\"/><path d=\"m591 221 3.23 7.28v0.6l-3.23 7.29-0.866-0.308 2.6-7.28-2.6-7.29 0.866-0.292z\"/><path d=\"m498 265h9.99v1.08h-9.99v-1.08z\"/><path d=\"m511 259h1.25v15.1h-1.25v-15.1z\"/><path d=\"m520 259h0.446c-0.034 0.52-0.05 1.24-0.05 2.16v6.92c0 0.314 0.018 0.55 0.054 0.71 0.034 0.16 0.096 0.29 0.186 0.39 0.088 0.1 0.216 0.178 0.384 0.234s0.378 0.1 0.632 0.13 0.59 0.05 1.01 0.06v0.592h-5.99v-0.592c0.6-0.026 1.03-0.062 1.28-0.108 0.258-0.046 0.454-0.116 0.588-0.208 0.136-0.092 0.234-0.222 0.296-0.388 0.062-0.168 0.094-0.44 0.094-0.82v-6.57c0-0.216-0.038-0.374-0.114-0.474s-0.186-0.15-0.332-0.15c-0.174 0-0.42 0.088-0.738 0.266s-0.714 0.424-1.18 0.738l-0.356-0.624 3.79-2.26z\"/><path d=\"m525 258 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m394 163h9.99v1.08h-9.99v-1.08z\"/><path d=\"m407 156h1.25v15.1h-1.25v-15.1z\"/><path d=\"m415 157c-0.374 0-0.686 0.11-0.936 0.332-0.252 0.222-0.454 0.54-0.608 0.956s-0.264 0.924-0.328 1.52c-0.066 0.598-0.098 1.27-0.098 2.02 0 1.76 0.164 3.05 0.49 3.88 0.328 0.824 0.834 1.24 1.52 1.24 0.654 0 1.14-0.386 1.45-1.16 0.318-0.776 0.476-1.98 0.476-3.6 0-1.24-0.082-2.25-0.244-3.02s-0.388-1.32-0.676-1.66c-0.29-0.334-0.64-0.502-1.05-0.502zm0.04-0.69c1.18 0 2.06 0.458 2.64 1.37 0.578 0.914 0.868 2.29 0.868 4.14 0 1.91-0.31 3.36-0.928 4.34-0.62 0.982-1.52 1.47-2.71 1.47-1.17 0-2.04-0.46-2.61-1.38s-0.854-2.31-0.854-4.18c0-0.994 0.088-1.85 0.262-2.58 0.176-0.724 0.422-1.32 0.738-1.8 0.316-0.472 0.696-0.822 1.14-1.05 0.442-0.228 0.926-0.342 1.45-0.342z\"/><path d=\"m421 156 3.23 7.28v0.598l-3.23 7.29-0.866-0.308 2.6-7.28-2.6-7.29 0.866-0.292z\"/><path d=\"m423 228h9.99v1.08h-9.99v-1.08z\"/><path d=\"m436 221h1.25v15.1h-1.25v-15.1z\"/><path d=\"m445 223h1.15v4.67h4.42v1.08h-4.42v4.67h-1.15v-4.67h-4.42v-1.08h4.42v-4.67z\"/><path d=\"m454 220 3.23 7.28v0.598l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m423 94.2h9.99v1.08h-9.99v-1.08z\"/><path d=\"m436 87.9h1.25v15.1h-1.25v-15.1z\"/><path d=\"m440 94.2h9.99v1.08h-9.99v-1.08z\"/><path d=\"m453 87.2 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/></g></g><defs><clipPath id=\"clip0_6_812\"><rect transform=\"translate(.8 .6)\" width=\"677\" height=\"364\" fill=\"#fff\"/></clipPath></defs></svg>\n"
|
|
6654
|
+
"content": "\nYou can follow the steps of the algorithm for the constant and the balanced scenarios using a neat visualization. Since Deutsch algorithm deals only with states with real amplitudes, you can map all states on the unit circle, and follow the state evolution through the steps.\n\n1. Start with a qubit in the $\\ket{0}$ state and apply the $H$ gate to the qubit.\n <br/>\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg width=\"660\" height=\"334\" fill=\"none\" version=\"1.1\" viewBox=\"0 0 660 334\" xmlns=\"http://www.w3.org/2000/svg\"><g clip-path=\"url(#clip0_4_498)\"><g clip-rule=\"evenodd\" fill-rule=\"evenodd\"><path d=\"m7.1 146c0-76.8 62.3-139 139-139 76.8 0 139 62.3 139 139 0 76.8-62.3 139-139 139-76.8 0-139-62.3-139-139z\" stroke=\"#747474\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"/><g fill=\"#fff\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"><path d=\"m279 147c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\" stroke=\"#0070C0\"/><g stroke=\"#000\"><path d=\"m140 7.4c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9-2.64 5.9-5.9 5.9-5.9-2.64-5.9-5.9z\"/><path d=\"m1.3 147c0-3.26 2.64-5.9 5.9-5.9 3.26 0 5.9 2.64 5.9 5.9s-2.64 5.9-5.9 5.9c-3.26 0-5.9-2.64-5.9-5.9z\"/><path d=\"m140 286c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9-2.64 5.9-5.9 5.9-5.9-2.64-5.9-5.9z\"/></g></g><path d=\"m240 50.1c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9c0 3.26-2.69 5.9-6 5.9s-6-2.64-6-5.9z\" fill=\"#0070C0\"/><g fill=\"#fff\" stroke=\"#000\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"><path d=\"m240 243c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\"/><path d=\"m40.3 50.2c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9c0 3.26-2.69 5.9-6 5.9s-6-2.64-6-5.9z\"/><path d=\"m40.3 243c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\"/></g><path d=\"m358 146c0-76.8 62.2-139 139-139s139 62.3 139 139c0 76.8-62.2 139-139 139s-139-62.3-139-139z\" stroke=\"#747474\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"/><g fill=\"#fff\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"><path d=\"m630 147c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9-2.64 5.9-5.9 5.9-5.9-2.64-5.9-5.9z\" stroke=\"#0070C0\"/><g stroke=\"#000\"><path d=\"m491 7.4c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\"/><path d=\"m352 147c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\"/><path d=\"m491 286c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\"/></g></g><path d=\"m591 50.1c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9c0 3.26-2.64 5.9-5.9 5.9s-5.9-2.64-5.9-5.9z\" fill=\"#0070C0\"/><g fill=\"#fff\" stroke=\"#000\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"><path d=\"m591 243c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9-2.64 5.9-5.9 5.9-5.9-2.64-5.9-5.9z\"/><path d=\"m391 50.2c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9c0 3.26-2.64 5.9-5.9 5.9s-5.9-2.64-5.9-5.9z\"/><path d=\"m391 243c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9-2.64 5.9-5.9 5.9-5.9-2.64-5.9-5.9z\"/></g></g><path d=\"m120 319c-0.941 0.455-2.17 0.683-3.68 0.683-1.98 0-3.53-0.581-4.66-1.74s-1.7-2.71-1.7-4.64c0-2.06 0.635-3.73 1.9-5.01 1.28-1.28 2.93-1.92 4.96-1.92 1.26 0 2.32 0.159 3.18 0.476v2.79c-0.863-0.515-1.84-0.773-2.95-0.773-1.21 0-2.19 0.381-2.93 1.14-0.743 0.761-1.11 1.79-1.11 3.09 0 1.25 0.35 2.24 1.05 2.98 0.701 0.737 1.64 1.1 2.83 1.1 1.13 0 2.17-0.276 3.11-0.827v2.65zm6.35 0.683c-1.53 0-2.74-0.429-3.62-1.28-0.875-0.863-1.31-2.03-1.31-3.5 0-1.52 0.455-2.71 1.37-3.57 0.91-0.862 2.14-1.29 3.69-1.29 1.53 0 2.73 0.432 3.59 1.29 0.869 0.857 1.3 1.99 1.3 3.4 0 1.53-0.449 2.73-1.35 3.62-0.892 0.886-2.12 1.33-3.67 1.33zm0.071-7.48c-0.67 0-1.19 0.23-1.56 0.691-0.371 0.462-0.557 1.11-0.557 1.96 0 1.77 0.713 2.65 2.14 2.65 1.36 0 2.04-0.907 2.04-2.72 0-1.72-0.686-2.58-2.06-2.58zm15.7 7.25h-2.83v-5.11c0-1.43-0.509-2.14-1.53-2.14-0.491 0-0.896 0.188-1.21 0.566-0.318 0.377-0.476 0.856-0.476 1.44v5.25h-2.84v-9.2h2.84v1.46h0.036c0.676-1.12 1.66-1.68 2.96-1.68 2.04 0 3.05 1.26 3.05 3.79v5.63zm1.65-0.243v-2.3c0.468 0.282 0.932 0.492 1.39 0.629 0.467 0.138 0.907 0.207 1.32 0.207 0.503 0 0.898-0.069 1.19-0.207 0.293-0.137 0.44-0.347 0.44-0.629 0-0.179-0.066-0.329-0.198-0.449s-0.302-0.224-0.512-0.314c-0.204-0.09-0.428-0.171-0.674-0.243-0.245-0.072-0.482-0.153-0.71-0.242-0.365-0.138-0.688-0.285-0.97-0.441-0.275-0.161-0.509-0.347-0.701-0.557-0.185-0.209-0.329-0.452-0.431-0.727-0.096-0.276-0.144-0.602-0.144-0.98 0-0.515 0.111-0.958 0.333-1.33 0.227-0.372 0.527-0.674 0.898-0.908 0.378-0.239 0.806-0.413 1.28-0.521 0.485-0.114 0.988-0.171 1.51-0.171 0.408 0 0.821 0.033 1.24 0.099 0.419 0.06 0.833 0.15 1.24 0.27v2.19c-0.359-0.21-0.746-0.365-1.16-0.467-0.407-0.108-0.809-0.162-1.2-0.162-0.186 0-0.362 0.018-0.53 0.054-0.162 0.03-0.305 0.078-0.431 0.144-0.126 0.06-0.225 0.14-0.297 0.242-0.072 0.096-0.107 0.207-0.107 0.333 0 0.167 0.053 0.311 0.161 0.431s0.249 0.225 0.422 0.314c0.174 0.084 0.366 0.162 0.575 0.234 0.216 0.066 0.429 0.135 0.638 0.207 0.378 0.131 0.719 0.275 1.02 0.431 0.305 0.156 0.566 0.338 0.781 0.548 0.222 0.21 0.39 0.455 0.503 0.737 0.12 0.281 0.18 0.617 0.18 1.01 0 0.545-0.12 1.01-0.359 1.4-0.234 0.384-0.548 0.698-0.944 0.944-0.389 0.239-0.841 0.413-1.36 0.521-0.509 0.114-1.04 0.171-1.59 0.171-1.01 0-1.95-0.156-2.81-0.468zm14.3 0.135c-0.42 0.222-1.05 0.333-1.9 0.333-2 0-3-1.04-3-3.12v-4.21h-1.49v-2.09h1.49v-1.99l2.83-0.808v2.79h2.07v2.09h-2.07v3.72c0 0.958 0.38 1.44 1.14 1.44 0.3 0 0.608-0.086 0.926-0.26v2.1zm9.26 0.108h-2.69v-1.32h-0.036c-0.617 1.03-1.53 1.55-2.74 1.55-0.893 0-1.6-0.252-2.11-0.755-0.51-0.509-0.764-1.19-0.764-2.03 0-1.78 1.06-2.82 3.17-3.09l2.5-0.333c0-1.01-0.545-1.51-1.64-1.51-1.1 0-2.14 0.326-3.13 0.979v-2.14c0.396-0.204 0.935-0.383 1.62-0.539 0.688-0.156 1.31-0.234 1.88-0.234 2.62 0 3.94 1.31 3.94 3.93v5.5zm-2.67-3.74v-0.62l-1.67 0.215c-0.922 0.12-1.38 0.536-1.38 1.25 0 0.323 0.111 0.59 0.333 0.8 0.227 0.203 0.533 0.305 0.916 0.305 0.533 0 0.968-0.183 1.3-0.548 0.335-0.371 0.503-0.838 0.503-1.4zm13.8 3.74h-2.83v-5.11c0-1.43-0.509-2.14-1.53-2.14-0.492 0-0.896 0.188-1.21 0.566-0.318 0.377-0.476 0.856-0.476 1.44v5.25h-2.84v-9.2h2.84v1.46h0.036c0.676-1.12 1.66-1.68 2.96-1.68 2.04 0 3.06 1.26 3.06 3.79v5.63zm7.82-0.108c-0.419 0.222-1.05 0.333-1.9 0.333-2 0-3-1.04-3-3.12v-4.21h-1.49v-2.09h1.49v-1.99l2.83-0.808v2.79h2.07v2.09h-2.07v3.72c0 0.958 0.38 1.44 1.14 1.44 0.3 0 0.608-0.086 0.925-0.26v2.1z\" fill=\"#000\"/><path d=\"m476 307-4.44 12.9h-3.29l-4.38-12.9h3.13l2.69 8.97c0.143 0.485 0.23 0.913 0.26 1.28h0.054c0.042-0.402 0.135-0.842 0.279-1.32l2.67-8.93h3.04zm7.54 12.9h-2.69v-1.32h-0.036c-0.617 1.03-1.53 1.55-2.74 1.55-0.892 0-1.6-0.252-2.11-0.755-0.509-0.509-0.764-1.19-0.764-2.03 0-1.78 1.06-2.82 3.17-3.09l2.5-0.333c0-1.01-0.545-1.51-1.64-1.51-1.1 0-2.14 0.326-3.13 0.979v-2.14c0.395-0.204 0.934-0.383 1.62-0.539 0.689-0.156 1.31-0.234 1.88-0.234 2.62 0 3.94 1.31 3.94 3.93v5.5zm-2.67-3.74v-0.62l-1.67 0.215c-0.922 0.12-1.38 0.536-1.38 1.25 0 0.323 0.11 0.59 0.332 0.8 0.228 0.203 0.533 0.305 0.916 0.305 0.533 0 0.968-0.183 1.3-0.548 0.336-0.371 0.503-0.838 0.503-1.4zm10.9-2.9c-0.341-0.186-0.739-0.279-1.2-0.279-0.617 0-1.1 0.228-1.45 0.683-0.348 0.449-0.521 1.06-0.521 1.84v4.39h-2.84v-9.2h2.84v1.71h0.036c0.449-1.25 1.26-1.87 2.42-1.87 0.3 0 0.534 0.036 0.701 0.108v2.62zm2.84-4.02c-0.479 0-0.871-0.141-1.18-0.423-0.305-0.287-0.458-0.638-0.458-1.05 0-0.425 0.153-0.773 0.458-1.04 0.306-0.27 0.698-0.404 1.18-0.404 0.485 0 0.878 0.134 1.18 0.404 0.306 0.269 0.458 0.617 0.458 1.04 0 0.431-0.152 0.785-0.458 1.06-0.299 0.276-0.692 0.414-1.18 0.414zm1.4 10.7h-2.84v-9.2h2.84v9.2zm10 0h-2.69v-1.32h-0.036c-0.617 1.03-1.53 1.55-2.74 1.55-0.893 0-1.6-0.252-2.11-0.755-0.51-0.509-0.764-1.19-0.764-2.03 0-1.78 1.06-2.82 3.17-3.09l2.5-0.333c0-1.01-0.545-1.51-1.64-1.51-1.1 0-2.14 0.326-3.13 0.979v-2.14c0.396-0.204 0.935-0.383 1.62-0.539 0.688-0.156 1.31-0.234 1.88-0.234 2.62 0 3.94 1.31 3.94 3.93v5.5zm-2.67-3.74v-0.62l-1.67 0.215c-0.922 0.12-1.38 0.536-1.38 1.25 0 0.323 0.111 0.59 0.333 0.8 0.227 0.203 0.533 0.305 0.916 0.305 0.533 0 0.968-0.183 1.3-0.548 0.335-0.371 0.503-0.838 0.503-1.4zm7.79 2.67h-0.036v1.07h-2.84v-13.6h2.84v5.8h0.036c0.7-1.07 1.7-1.61 2.99-1.61 1.19 0 2.1 0.408 2.74 1.22 0.64 0.815 0.961 1.93 0.961 3.34 0 1.53-0.374 2.76-1.12 3.69s-1.75 1.39-3 1.39c-1.13 0-1.99-0.432-2.57-1.29zm-0.081-3.88v0.943c0 0.593 0.17 1.08 0.512 1.47 0.341 0.39 0.778 0.584 1.31 0.584 0.647 0 1.15-0.248 1.5-0.745 0.359-0.503 0.539-1.21 0.539-2.13 0-0.76-0.165-1.35-0.494-1.78-0.324-0.431-0.788-0.646-1.39-0.646-0.569 0-1.04 0.212-1.42 0.638-0.372 0.425-0.557 0.979-0.557 1.66zm11.5 4.95h-2.84v-13.6h2.84v13.6zm10.7-3.79h-6c0.095 1.34 0.937 2 2.52 2 1.01 0 1.9-0.239 2.67-0.719v2.05c-0.851 0.455-1.96 0.683-3.32 0.683-1.48 0-2.64-0.411-3.46-1.23-0.82-0.827-1.23-1.98-1.23-3.45 0-1.53 0.443-2.74 1.33-3.63 0.887-0.892 1.98-1.34 3.27-1.34 1.34 0 2.38 0.399 3.11 1.2 0.737 0.797 1.1 1.88 1.1 3.24v1.2zm-2.63-1.74c0-1.32-0.533-1.98-1.6-1.98-0.456 0-0.851 0.189-1.19 0.566-0.33 0.377-0.53 0.848-0.602 1.41h3.39z\" fill=\"#000\"/><path d=\"m291 146h16.5l-0.688 0.688v-96.5l0.688 0.687h-54.6v-1.38h55.3v97.9h-17.2v-1.38zm-33-90.7-6.13-5.11 6.13-5.11c0.292-0.243 0.726-0.204 0.968 0.088 0.244 0.292 0.204 0.725-0.088 0.968l-5.5 4.58v-1.06l5.5 4.58c0.292 0.243 0.332 0.677 0.088 0.968-0.242 0.292-0.676 0.331-0.968 0.088z\" fill=\"#0070C0\"/><path d=\"m642 146h16.5l-0.688 0.688v-96.5l0.688 0.687h-54.6v-1.38h55.3v97.9h-17.2v-1.38zm-33-90.7-6.13-5.11 6.13-5.11c0.292-0.243 0.726-0.204 0.968 0.088 0.244 0.292 0.204 0.725-0.088 0.968l-5.5 4.58v-1.06l5.5 4.58c0.292 0.243 0.332 0.677 0.088 0.968-0.242 0.292-0.676 0.331-0.968 0.088z\" fill=\"#0070C0\"/><g clip-rule=\"evenodd\" fill=\"#000\" fill-rule=\"evenodd\"><path d=\"m242 141h1.25v15.1h-1.25v-15.1z\"/><path d=\"m250 142c-0.374 0-0.686 0.11-0.936 0.332-0.252 0.222-0.454 0.54-0.608 0.956-0.154 0.418-0.264 0.924-0.328 1.52-0.066 0.598-0.098 1.27-0.098 2.02 0 1.76 0.164 3.05 0.49 3.88 0.328 0.824 0.834 1.24 1.52 1.24 0.654 0 1.14-0.388 1.45-1.16 0.316-0.774 0.476-1.98 0.476-3.6 0-1.24-0.082-2.25-0.244-3.02s-0.388-1.32-0.676-1.66c-0.29-0.334-0.64-0.502-1.05-0.502zm0.04-0.688c1.18 0 2.06 0.456 2.64 1.37 0.578 0.912 0.868 2.29 0.868 4.14 0 1.91-0.31 3.36-0.928 4.34-0.62 0.98-1.52 1.47-2.71 1.47-1.17 0-2.04-0.458-2.61-1.38-0.57-0.918-0.854-2.31-0.854-4.18 0-0.994 0.088-1.85 0.262-2.58 0.176-0.724 0.422-1.32 0.738-1.79 0.316-0.474 0.696-0.824 1.14-1.05 0.442-0.228 0.926-0.34 1.45-0.34z\"/><path d=\"m256 140 3.23 7.28v0.6l-3.23 7.29-0.866-0.308 2.6-7.28-2.6-7.29 0.866-0.29z\"/><path d=\"m140 30.2h1.25v15.1h-1.25v-15.1z\"/><path d=\"m148 30.6h0.446c-0.033 0.519-0.049 1.24-0.049 2.16v6.92c0 0.313 0.018 0.55 0.053 0.709s0.097 0.289 0.186 0.389 0.218 0.178 0.385 0.235c0.168 0.0568 0.378 0.1 0.632 0.13 0.254 0.0296 0.589 0.05 1 0.0608v0.592h-5.99v-0.592c0.599-0.0272 1.03-0.0636 1.28-0.11 0.257-0.0458 0.453-0.115 0.588-0.207s0.234-0.222 0.296-0.389c0.062-0.168 0.093-0.44 0.093-0.819v-6.57c0-0.216-0.038-0.374-0.114-0.474-0.075-0.1-0.186-0.15-0.332-0.15-0.173 0-0.419 0.0892-0.737 0.268-0.319 0.178-0.714 0.424-1.18 0.738l-0.356-0.624 3.79-2.26z\"/><path d=\"m154 29.4 3.23 7.28v0.6l-3.23 7.29-0.867-0.308 2.6-7.28-2.6-7.29 0.867-0.292z\"/><path d=\"m208 73h1.25v15.1h-1.25v-15.1z\"/><path d=\"m217 74.6h1.15v4.67h4.42v1.08h-4.42v4.67h-1.15v-4.67h-4.42v-1.08h4.42v-4.67z\"/><path d=\"m226 72.3 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m208 206h1.25v15.1h-1.25v-15.1z\"/><path d=\"m213 212h9.99v1.08h-9.99v-1.08z\"/><path d=\"m226 205 3.23 7.28v0.598l-3.23 7.29-0.866-0.308 2.6-7.28-2.6-7.29 0.866-0.292z\"/><path d=\"m133 250h9.99v1.08h-9.99v-1.08z\"/><path d=\"m146 243h1.25v15.1h-1.25v-15.1z\"/><path d=\"m154 244h0.446c-0.033 0.518-0.049 1.24-0.049 2.16v6.92c0 0.312 0.018 0.55 0.053 0.708 0.035 0.16 0.097 0.29 0.186 0.39s0.218 0.178 0.385 0.234c0.168 0.058 0.378 0.1 0.632 0.13s0.59 0.05 1.01 0.062v0.59h-5.99v-0.59c0.599-0.028 1.03-0.064 1.28-0.11 0.257-0.046 0.453-0.114 0.588-0.206s0.234-0.222 0.296-0.39 0.093-0.44 0.093-0.818v-6.57c0-0.216-0.038-0.374-0.113-0.474-0.076-0.1-0.187-0.15-0.333-0.15-0.173 0-0.419 0.088-0.737 0.268-0.319 0.178-0.714 0.424-1.18 0.736l-0.356-0.624 3.79-2.26z\"/><path d=\"m160 243 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m28.4 147h9.99v1.08h-9.99v-1.08z\"/><path d=\"m41.6 141h1.25v15.1h-1.25v-15.1z\"/><path d=\"m49.5 142c-0.373 0-0.685 0.11-0.936 0.332s-0.454 0.54-0.608 0.956c-0.154 0.418-0.263 0.924-0.328 1.52-0.0648 0.598-0.0972 1.27-0.0972 2.02 0 1.76 0.163 3.05 0.49 3.88 0.327 0.824 0.833 1.24 1.52 1.24 0.654 0 1.14-0.388 1.45-1.16 0.316-0.774 0.474-1.98 0.474-3.6 0-1.24-0.081-2.25-0.243-3.02-0.162-0.77-0.388-1.32-0.677-1.66-0.289-0.334-0.639-0.502-1.05-0.502zm0.0406-0.688c1.18 0 2.06 0.456 2.64 1.37 0.578 0.912 0.867 2.29 0.867 4.14 0 1.91-0.309 3.36-0.928 4.34-0.619 0.98-1.52 1.47-2.71 1.47-1.17 0-2.04-0.458-2.61-1.38-0.57-0.918-0.855-2.31-0.855-4.18 0-0.994 0.0878-1.85 0.263-2.58s0.422-1.32 0.738-1.79c0.316-0.474 0.696-0.824 1.14-1.05 0.443-0.228 0.927-0.34 1.45-0.34z\"/><path d=\"m55.8 140 3.23 7.28v0.6l-3.23 7.29-0.867-0.308 2.6-7.28-2.6-7.29 0.867-0.29z\"/><path d=\"m57.9 212h9.99v1.08h-9.99v-1.08z\"/><path d=\"m71 206h1.25v15.1h-1.25v-15.1z\"/><path d=\"m79.9 207h1.15v4.67h4.42v1.08h-4.42v4.67h-1.15v-4.67h-4.42v-1.08h4.42v-4.67z\"/><path d=\"m88.4 205 3.23 7.28v0.6l-3.23 7.29-0.867-0.308 2.6-7.28-2.6-7.29 0.867-0.29z\"/><path d=\"m57.2 78.8h9.99v1.08h-9.99v-1.08z\"/><path d=\"m70.3 72.5h1.25v15.1h-1.25v-15.1z\"/><path d=\"m74.8 78.8h9.99v1.08h-9.99v-1.08z\"/><path d=\"m87.7 71.8 3.23 7.28v0.6l-3.23 7.29-0.867-0.308 2.6-7.28-2.6-7.29 0.867-0.292z\"/><path d=\"m592 141h1.25v15.1h-1.25v-15.1z\"/><path d=\"m600 142c-0.372 0-0.684 0.11-0.936 0.332-0.25 0.222-0.454 0.54-0.608 0.956-0.154 0.418-0.262 0.924-0.328 1.52-0.064 0.598-0.098 1.27-0.098 2.02 0 1.76 0.164 3.05 0.492 3.88 0.326 0.824 0.832 1.24 1.52 1.24 0.652 0 1.14-0.388 1.45-1.16 0.316-0.774 0.474-1.98 0.474-3.6 0-1.24-0.08-2.25-0.242-3.02-0.164-0.77-0.388-1.32-0.678-1.66-0.288-0.334-0.638-0.502-1.05-0.502zm0.042-0.688c1.18 0 2.06 0.456 2.64 1.37 0.578 0.912 0.866 2.29 0.866 4.14 0 1.91-0.308 3.36-0.928 4.34-0.618 0.98-1.52 1.47-2.71 1.47-1.17 0-2.04-0.458-2.61-1.38-0.57-0.918-0.856-2.31-0.856-4.18 0-0.994 0.088-1.85 0.264-2.58s0.422-1.32 0.738-1.79c0.316-0.474 0.696-0.824 1.14-1.05 0.444-0.228 0.926-0.34 1.45-0.34z\"/><path d=\"m606 140 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.29z\"/><path d=\"m489 30.2h1.25v15.1h-1.25v-15.1z\"/><path d=\"m498 30.6h0.446c-0.032 0.519-0.048 1.24-0.048 2.16v6.92c0 0.313 0.016 0.55 0.052 0.709 0.034 0.159 0.098 0.289 0.186 0.389 0.09 0.1 0.218 0.178 0.386 0.235 0.166 0.0568 0.378 0.1 0.632 0.13 0.254 0.0296 0.588 0.05 1 0.0608v0.592h-5.99v-0.592c0.6-0.0272 1.03-0.0636 1.29-0.11 0.256-0.0458 0.452-0.115 0.588-0.207 0.134-0.0918 0.232-0.222 0.294-0.389 0.064-0.168 0.094-0.44 0.094-0.819v-6.57c0-0.216-0.038-0.374-0.114-0.474s-0.186-0.15-0.332-0.15c-0.172 0-0.418 0.0892-0.738 0.268-0.318 0.178-0.712 0.424-1.18 0.738l-0.358-0.624 3.79-2.26z\"/><path d=\"m504 29.4 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m558 73h1.25v15.1h-1.25v-15.1z\"/><path d=\"m567 74.6h1.15v4.67h4.42v1.08h-4.42v4.67h-1.15v-4.67h-4.42v-1.08h4.42v-4.67z\"/><path d=\"m575 72.3 3.23 7.28v0.6l-3.23 7.29-0.866-0.308 2.6-7.28-2.6-7.29 0.866-0.292z\"/><path d=\"m558 206h1.25v15.1h-1.25v-15.1z\"/><path d=\"m563 212h9.99v1.08h-9.99v-1.08z\"/><path d=\"m575 205 3.23 7.28v0.598l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m483 250h9.99v1.08h-9.99v-1.08z\"/><path d=\"m496 243h1.25v15.1h-1.25v-15.1z\"/><path d=\"m504 244h0.446c-0.032 0.518-0.048 1.24-0.048 2.16v6.92c0 0.312 0.016 0.55 0.052 0.708 0.036 0.16 0.098 0.29 0.186 0.39 0.09 0.1 0.218 0.178 0.386 0.234 0.166 0.058 0.378 0.1 0.632 0.13s0.588 0.05 1 0.062v0.59h-5.99v-0.59c0.6-0.028 1.03-0.064 1.29-0.11 0.256-0.046 0.452-0.114 0.588-0.206 0.134-0.092 0.232-0.222 0.294-0.39 0.064-0.168 0.094-0.44 0.094-0.818v-6.57c0-0.216-0.038-0.374-0.114-0.474-0.074-0.1-0.186-0.15-0.332-0.15-0.172 0-0.418 0.088-0.738 0.268-0.318 0.178-0.712 0.424-1.18 0.736l-0.358-0.624 3.79-2.26z\"/><path d=\"m510 243 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m378 147h9.99v1.08h-9.99v-1.08z\"/><path d=\"m391 141h1.25v15.1h-1.25v-15.1z\"/><path d=\"m399 142c-0.372 0-0.684 0.11-0.936 0.332s-0.454 0.54-0.608 0.956c-0.154 0.418-0.264 0.924-0.328 1.52-0.064 0.598-0.098 1.27-0.098 2.02 0 1.76 0.164 3.05 0.492 3.88 0.326 0.824 0.832 1.24 1.52 1.24 0.654 0 1.14-0.388 1.46-1.16 0.316-0.774 0.474-1.98 0.474-3.6 0-1.24-0.082-2.25-0.244-3.02s-0.386-1.32-0.676-1.66c-0.29-0.334-0.638-0.502-1.05-0.502zm0.04-0.688c1.18 0 2.07 0.456 2.64 1.37 0.578 0.912 0.866 2.29 0.866 4.14 0 1.91-0.308 3.36-0.928 4.34-0.618 0.98-1.52 1.47-2.71 1.47-1.17 0-2.04-0.458-2.61-1.38-0.57-0.918-0.856-2.31-0.856-4.18 0-0.994 0.088-1.85 0.264-2.58s0.422-1.32 0.738-1.79c0.316-0.474 0.694-0.824 1.14-1.05 0.444-0.228 0.926-0.34 1.45-0.34z\"/><path d=\"m406 140 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.29z\"/><path d=\"m408 212h9.99v1.08h-9.99v-1.08z\"/><path d=\"m421 206h1.25v15.1h-1.25v-15.1z\"/><path d=\"m430 207h1.15v4.67h4.42v1.08h-4.42v4.67h-1.15v-4.67h-4.42v-1.08h4.42v-4.67z\"/><path d=\"m438 205 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.29z\"/><path d=\"m407 78.8h9.99v1.08h-9.99v-1.08z\"/><path d=\"m420 72.5h1.25v15.1h-1.25v-15.1z\"/><path d=\"m425 78.8h9.99v1.08h-9.99v-1.08z\"/><path d=\"m438 71.8 3.24 7.28v0.6l-3.24 7.29-0.866-0.308 2.6-7.28-2.6-7.29 0.866-0.292z\"/></g></g><defs><clipPath id=\"clip0_4_498\"><rect transform=\"translate(.6 .8)\" width=\"659\" height=\"332\" fill=\"#fff\"/></clipPath></defs></svg>\n\n2. Apply the oracle. \n Here, the difference between the two scenarios becomes noticeable. In the constant scenario, $\\ket{0}$ and $\\ket{1}$ states get the same phase (either $1$ or $-1$), so the state remains the same or acquires a global phase of $-1$, which is physically the same state. In the variable scenario, zero and one states get different phases, so the state changes!\n <br/>\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg width=\"738\" height=\"374\" fill=\"none\" version=\"1.1\" viewBox=\"0 0 738 374\" xmlns=\"http://www.w3.org/2000/svg\"><g clip-path=\"url(#clip0_5_635)\"><g clip-rule=\"evenodd\" fill-rule=\"evenodd\"><path d=\"m7.3 189c0-76.8 62.3-139 139-139 76.8 0 139 62.3 139 139 0 76.8-62.3 139-139 139-76.8 0-139-62.3-139-139z\" stroke=\"#747474\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"/><g fill=\"#fff\" stroke=\"#000\" stroke-miterlimit=\"8\"><path d=\"m279 189c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\" stroke-width=\"1.15\"/><g stroke-width=\"1.38\"><path d=\"m140 49.4c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9c0 3.26-2.64 5.9-5.9 5.9s-5.9-2.64-5.9-5.9z\"/><path d=\"m1.3 189c0-3.26 2.69-5.9 6-5.9 3.31 0 6 2.64 6 5.9s-2.69 5.9-6 5.9c-3.31 0-6-2.64-6-5.9z\"/><path d=\"m140 328c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9-2.64 5.9-5.9 5.9-5.9-2.64-5.9-5.9z\"/></g></g><path d=\"m240 92.3c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9c0 3.26-2.69 5.9-6 5.9s-6-2.64-6-5.9z\" fill=\"#0070C0\"/><path d=\"m240 285c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\" fill=\"#fff\" stroke=\"#000\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"/><path d=\"m40.5 92.4c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\" fill=\"#fff\" stroke=\"#000\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"/><path d=\"m40.4 285c0-3.26 2.69-5.9 6-5.9 3.31 0 6 2.64 6 5.9s-2.69 5.9-6 5.9c-3.31 0-6-2.64-6-5.9z\" fill=\"#0070C0\"/><path d=\"m358 189c0-76.8 62.2-139 139-139s139 62.3 139 139c0 76.8-62.2 139-139 139s-139-62.3-139-139z\" stroke=\"#747474\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"/><g fill=\"#fff\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"><g stroke=\"#000\"><path d=\"m630 189c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\"/><path d=\"m491 49.4c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9c0 3.26-2.69 5.9-6 5.9s-6-2.64-6-5.9z\"/><path d=\"m352 189c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9-2.64 5.9-5.9 5.9-5.9-2.64-5.9-5.9z\"/><path d=\"m491 328c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\"/></g><path d=\"m591 92.4c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9-2.64 5.9-5.9 5.9-5.9-2.64-5.9-5.9z\" stroke=\"#0070C0\"/></g><path d=\"m591 285c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9-2.64 5.9-5.9 5.9-5.9-2.64-5.9-5.9z\" fill=\"#0070C0\"/><path d=\"m391 92.3c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9c0 3.26-2.64 5.9-5.9 5.9s-5.9-2.64-5.9-5.9z\" fill=\"#0070C0\"/><path d=\"m392 285c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9-2.64 5.9-5.9 5.9-5.9-2.64-5.9-5.9z\" fill=\"#fff\" stroke=\"#000\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"/></g><g fill=\"#0070C0\"><path d=\"m247 85.4v-15.1l-0.688 0.688h22.1l-0.687-0.688v22.1l0.687-0.688h-16.2v1.38h16.9v-23.5h-23.5v15.8h1.38zm-5.8-5.06 5.11 6.13 5.11-6.13c0.244-0.292 0.204-0.725-0.088-0.968-0.291-0.243-0.725-0.204-0.968 0.088l-4.58 5.5h1.06l-4.58-5.5c-0.243-0.292-0.677-0.331-0.968-0.088-0.292 0.243-0.332 0.677-0.088 0.968z\"/><path d=\"m199 136-105 102 0.96 0.985 105-102-0.96-0.984zm-104 95.6-0.826 7.94 7.96-0.619c0.378-0.03 0.661-0.361 0.632-0.739-0.03-0.379-0.36-0.662-0.739-0.632l-7.14 0.555 0.737 0.757 0.741-7.12c0.0392-0.378-0.235-0.716-0.613-0.755-0.378-0.04-0.716 0.235-0.755 0.612z\"/><path d=\"m603 91.6h58.4v194h-56.4v-1.37h55.8l-0.688 0.686v-193l0.688 0.688h-57.8v-1.38zm7.05 199-6.13-5.11 6.13-5.11c0.29-0.244 0.724-0.204 0.968 0.088 0.242 0.29 0.204 0.724-0.088 0.968l-5.5 4.58v-1.06l5.5 4.58c0.292 0.242 0.33 0.676 0.088 0.968-0.244 0.292-0.678 0.332-0.968 0.088z\"/><path d=\"m397 85.7v-56.4h201v56.6h-1.37v-55.9l0.686 0.688h-200l0.688-0.688v55.7h-1.38zm5.8-5.06-5.11 6.13-5.11-6.13c-0.242-0.292-0.204-0.725 0.088-0.968 0.292-0.243 0.726-0.204 0.968 0.0882l4.58 5.5h-1.06l4.58-5.5c0.242-0.292 0.676-0.331 0.968-0.0882 0.292 0.243 0.33 0.677 0.088 0.968z\"/></g><g clip-rule=\"evenodd\" fill=\"#0078D4\" fill-rule=\"evenodd\"><path d=\"m231 48.1c0.516 0 0.962 0.0422 1.34 0.126l-0.308 1.34h-0.696c-0.074-0.301-0.17-0.517-0.288-0.649-0.12-0.132-0.294-0.198-0.526-0.198-0.302 0-0.556 0.083-0.764 0.249s-0.386 0.413-0.534 0.74-0.284 0.767-0.412 1.32l-0.196 0.862h2.03l-0.174 0.799h-2.04l-1.47 6.9c-0.242 1.14-0.614 2-1.12 2.56-0.5 0.562-1.13 0.842-1.89 0.842-0.222 0-0.396-0.0132-0.522-0.0396l0.134-0.696c0.054 0.0158 0.178 0.0236 0.372 0.0236 0.238 0 0.44-0.0606 0.61-0.182 0.168-0.121 0.324-0.332 0.47-0.633 0.144-0.3 0.278-0.717 0.4-1.25l1.7-7.52h-1.34l0.118-0.546c0.354-0.0212 0.608-0.0502 0.764-0.087 0.154-0.037 0.276-0.0924 0.364-0.166 0.086-0.0738 0.16-0.17 0.22-0.289 0.062-0.119 0.138-0.336 0.234-0.653 0.28-0.949 0.71-1.66 1.29-2.14 0.582-0.477 1.32-0.716 2.23-0.716z\"/><path d=\"m250 47.3c1.54 0.406 2.72 1.28 3.55 2.63 0.826 1.35 1.24 2.97 1.24 4.88 0 1.91-0.41 3.53-1.23 4.88-0.822 1.34-2.01 2.22-3.55 2.62l-0.19-0.609c1.22-0.406 2.12-1.21 2.72-2.4 0.594-1.2 0.89-2.72 0.89-4.56 0-1.78-0.296-3.26-0.886-4.44s-1.51-1.97-2.74-2.38l0.214-0.609zm-10.1 0 0.214 0.609c-1.23 0.406-2.15 1.2-2.74 2.38-0.592 1.18-0.89 2.66-0.89 4.44 0 1.85 0.298 3.37 0.89 4.56 0.594 1.2 1.5 2 2.72 2.4l-0.19 0.609c-1.55-0.406-2.73-1.28-3.55-2.62-0.822-1.34-1.23-2.97-1.23-4.88 0-1.9 0.412-3.53 1.24-4.88s2.01-2.22 3.55-2.63z\"/><path d=\"m243 51.7c0.162 0 0.306 0.0184 0.43 0.0554 0.124 0.0368 0.234 0.0936 0.328 0.17 0.096 0.0764 0.18 0.175 0.254 0.297s0.144 0.286 0.214 0.494c0.068 0.208 0.132 0.467 0.194 0.775 0.06 0.308 0.114 0.629 0.162 0.961h0.078c0.506-0.712 0.89-1.23 1.15-1.56 0.26-0.33 0.48-0.575 0.66-0.736s0.352-0.274 0.518-0.34c0.166-0.0658 0.386-0.0988 0.66-0.0988 0.248 0 0.452 0.0316 0.61 0.0948l-0.316 1.43h-0.554c-0.032-0.221-0.124-0.332-0.278-0.332-0.046 0-0.098 0.0078-0.15 0.0238-0.052 0.0158-0.118 0.05-0.194 0.103-0.076 0.0526-0.188 0.156-0.336 0.308-0.148 0.153-0.314 0.34-0.498 0.562-0.184 0.222-0.374 0.454-0.57 0.696l-0.538 0.672c0.096 0.506 0.186 0.944 0.27 1.31s0.158 0.676 0.224 0.922 0.124 0.439 0.174 0.581c0.052 0.142 0.106 0.249 0.164 0.32 0.058 0.0712 0.116 0.121 0.178 0.15 0.06 0.029 0.13 0.0434 0.208 0.0434 0.144 0 0.282-0.0552 0.416-0.166s0.328-0.361 0.582-0.751l0.514 0.34c-0.37 0.548-0.704 0.935-1 1.16-0.298 0.224-0.652 0.336-1.06 0.336-0.226 0-0.418-0.0408-0.576-0.123-0.158-0.0816-0.296-0.212-0.412-0.391-0.116-0.179-0.218-0.459-0.308-0.839-0.164-0.675-0.264-1.19-0.3-1.55h-0.08c-0.558 0.786-0.974 1.35-1.25 1.69s-0.496 0.596-0.672 0.759-0.348 0.278-0.514 0.344c-0.166 0.066-0.386 0.099-0.66 0.099-0.248 0-0.452-0.0316-0.61-0.095l0.316-1.43h0.554c0.032 0.221 0.124 0.332 0.278 0.332 0.072 0 0.15-0.0198 0.232-0.0594s0.2-0.134 0.352-0.285c0.154-0.15 0.364-0.386 0.634-0.708 0.268-0.322 0.658-0.804 1.17-1.45-0.08-0.417-0.16-0.817-0.246-1.2-0.084-0.385-0.17-0.744-0.26-1.08s-0.164-0.55-0.222-0.653-0.12-0.174-0.186-0.214-0.148-0.0592-0.248-0.0592c-0.112 0-0.212 0.025-0.302 0.075-0.09 0.0502-0.186 0.137-0.292 0.261-0.106 0.124-0.246 0.318-0.42 0.581l-0.514-0.34c0.332-0.501 0.652-0.875 0.958-1.12 0.306-0.248 0.666-0.372 1.08-0.372z\"/><path d=\"m262 55.9h9.75v1.05h-9.75v-1.05zm0-3.28h9.75v1.05h-9.75v-1.05z\"/><path d=\"m281 49.2c-0.364 0-0.668 0.108-0.914 0.324-0.244 0.216-0.442 0.527-0.592 0.933-0.15 0.406-0.258 0.901-0.32 1.48-0.064 0.583-0.096 1.24-0.096 1.97 0 1.72 0.16 2.98 0.478 3.78 0.32 0.804 0.814 1.21 1.48 1.21 0.638 0 1.11-0.378 1.42-1.14s0.462-1.93 0.462-3.52c0-1.21-0.078-2.2-0.236-2.95-0.16-0.751-0.38-1.29-0.662-1.62s-0.622-0.49-1.02-0.49zm0.04-0.672c1.15 0 2.01 0.446 2.58 1.34s0.846 2.24 0.846 4.04c0 1.87-0.3 3.28-0.904 4.24s-1.49 1.44-2.65 1.44c-1.14 0-1.99-0.448-2.54-1.34-0.556-0.897-0.834-2.26-0.834-4.08 0-0.97 0.086-1.81 0.256-2.52 0.172-0.707 0.412-1.29 0.72-1.75 0.31-0.461 0.68-0.803 1.11-1.02s0.904-0.332 1.42-0.332z\"/><path d=\"m94.3 164c0.53 0 0.986 0.043 1.37 0.13l-0.316 1.38h-0.713c-0.0756-0.308-0.174-0.53-0.296-0.665s-0.301-0.203-0.539-0.203c-0.308 0-0.569 0.085-0.782 0.256-0.213 0.17-0.396 0.422-0.547 0.758-0.151 0.334-0.292 0.786-0.422 1.35l-0.203 0.882h2.08l-0.178 0.82h-2.09l-1.51 7.07c-0.249 1.17-0.63 2.05-1.14 2.62-0.513 0.574-1.16 0.862-1.94 0.862-0.227 0-0.405-0.012-0.535-0.04l0.138-0.714c0.054 0.016 0.181 0.026 0.381 0.026 0.243 0 0.451-0.064 0.624-0.188s0.334-0.34 0.482-0.648 0.285-0.734 0.409-1.28l1.74-7.71h-1.37l0.122-0.56c0.362-0.022 0.623-0.052 0.782-0.09s0.284-0.094 0.373-0.17c0.0892-0.076 0.165-0.174 0.227-0.296 0.0622-0.12 0.142-0.344 0.239-0.668 0.286-0.972 0.728-1.7 1.33-2.19 0.597-0.489 1.36-0.734 2.28-0.734z\"/><path d=\"m113 163c1.58 0.416 2.79 1.31 3.64 2.7 0.846 1.38 1.27 3.05 1.27 5 0 1.96-0.422 3.62-1.26 5-0.843 1.37-2.06 2.27-3.64 2.69l-0.195-0.624c1.25-0.416 2.18-1.24 2.78-2.46 0.608-1.23 0.911-2.79 0.911-4.68 0-1.83-0.302-3.34-0.907-4.55-0.606-1.21-1.54-2.02-2.81-2.44l0.219-0.624zm-10.3 0 0.219 0.624c-1.26 0.416-2.2 1.23-2.81 2.44-0.608 1.21-0.912 2.73-0.912 4.55 0 1.89 0.304 3.45 0.912 4.68 0.608 1.23 1.54 2.05 2.78 2.46l-0.194 0.624c-1.58-0.416-2.8-1.31-3.64-2.69-0.843-1.38-1.26-3.04-1.26-5 0-1.95 0.423-3.62 1.27-5 0.846-1.38 2.06-2.28 3.64-2.7z\"/><path d=\"m106 168c0.168 0 0.315 0.02 0.442 0.058s0.239 0.096 0.336 0.174c0.098 0.078 0.184 0.18 0.26 0.304 0.075 0.124 0.148 0.292 0.219 0.506 0.07 0.214 0.136 0.478 0.198 0.794s0.118 0.646 0.166 0.986h0.081c0.519-0.73 0.912-1.26 1.18-1.6 0.267-0.338 0.493-0.588 0.677-0.754 0.183-0.164 0.36-0.28 0.53-0.348 0.171-0.068 0.396-0.1 0.677-0.1 0.254 0 0.462 0.032 0.624 0.096l-0.324 1.47h-0.567c-0.033-0.228-0.127-0.342-0.284-0.342-0.049 0-0.1 0.01-0.154 0.026s-0.12 0.05-0.199 0.104c-0.078 0.054-0.193 0.16-0.344 0.316-0.151 0.158-0.322 0.35-0.511 0.576-0.189 0.228-0.383 0.464-0.583 0.714l-0.551 0.688c0.097 0.52 0.189 0.968 0.275 1.35 0.087 0.378 0.164 0.694 0.231 0.944 0.068 0.252 0.127 0.45 0.178 0.596 0.052 0.146 0.107 0.256 0.167 0.328 0.059 0.074 0.12 0.124 0.182 0.154s0.134 0.044 0.215 0.044c0.146 0 0.288-0.056 0.425-0.17 0.138-0.112 0.337-0.37 0.596-0.77l0.527 0.35c-0.378 0.562-0.72 0.956-1.02 1.19-0.306 0.23-0.669 0.346-1.09 0.346-0.232 0-0.429-0.042-0.591-0.126s-0.303-0.218-0.422-0.402-0.224-0.47-0.316-0.858c-0.167-0.692-0.27-1.22-0.308-1.59h-0.081c-0.573 0.806-0.998 1.38-1.28 1.73-0.278 0.352-0.507 0.612-0.689 0.78-0.181 0.166-0.356 0.284-0.526 0.352-0.171 0.068-0.396 0.102-0.677 0.102-0.254 0-0.462-0.034-0.624-0.098l0.324-1.47h0.567c0.033 0.228 0.127 0.342 0.284 0.342 0.076 0 0.155-0.022 0.239-0.062s0.204-0.138 0.361-0.292 0.373-0.396 0.648-0.724c0.276-0.33 0.676-0.824 1.2-1.48-0.081-0.428-0.165-0.838-0.251-1.23-0.087-0.394-0.176-0.762-0.268-1.1-0.092-0.342-0.167-0.564-0.227-0.67-0.059-0.104-0.123-0.178-0.19-0.218-0.068-0.04-0.153-0.06-0.256-0.06-0.113 0-0.216 0.024-0.308 0.076s-0.191 0.14-0.3 0.268c-0.108 0.126-0.251 0.326-0.429 0.596l-0.527-0.35c0.34-0.512 0.667-0.896 0.981-1.15 0.313-0.254 0.683-0.382 1.11-0.382z\"/><path d=\"m125 172h9.99v1.08h-9.99v-1.08zm0-3.36h9.99v1.08h-9.99v-1.08z\"/><path d=\"m146 164h0.446c-0.032 0.519-0.048 1.24-0.048 2.16v6.92c0 0.314 0.018 0.55 0.052 0.71 0.036 0.158 0.098 0.288 0.186 0.388 0.09 0.1 0.218 0.178 0.386 0.236 0.168 0.056 0.378 0.1 0.632 0.128 0.254 0.03 0.588 0.05 1 0.062v0.592h-5.99v-0.592c0.6-0.028 1.03-0.064 1.29-0.11s0.452-0.114 0.588-0.206c0.134-0.092 0.234-0.222 0.296-0.39 0.062-0.166 0.092-0.44 0.092-0.818v-6.57c0-0.216-0.038-0.374-0.114-0.474-0.074-0.1-0.186-0.15-0.332-0.15-0.172 0-0.418 0.09-0.736 0.268-0.32 0.178-0.714 0.424-1.18 0.738l-0.358-0.624 3.79-2.26z\"/><path d=\"m676 183c0.516 0 0.962 0.044 1.34 0.128l-0.308 1.34h-0.696c-0.074-0.3-0.17-0.516-0.288-0.648-0.12-0.132-0.294-0.198-0.528-0.198-0.3 0-0.554 0.082-0.762 0.248-0.208 0.168-0.386 0.414-0.534 0.74-0.148 0.328-0.286 0.768-0.412 1.32l-0.198 0.862h2.03l-0.174 0.798h-2.04l-1.47 6.9c-0.244 1.14-0.614 2-1.12 2.56-0.5 0.56-1.13 0.842-1.89 0.842-0.222 0-0.396-0.014-0.522-0.04l0.134-0.696c0.052 0.016 0.176 0.024 0.372 0.024 0.238 0 0.44-0.06 0.608-0.182 0.17-0.122 0.326-0.332 0.472-0.632 0.144-0.302 0.278-0.718 0.398-1.25l1.7-7.52h-1.34l0.12-0.546c0.352-0.02 0.608-0.05 0.762-0.086 0.156-0.038 0.278-0.092 0.364-0.166 0.088-0.074 0.162-0.17 0.222-0.288 0.06-0.12 0.138-0.338 0.234-0.654 0.278-0.948 0.71-1.66 1.29-2.14 0.584-0.476 1.33-0.716 2.23-0.716z\"/><path d=\"m694 182c1.54 0.406 2.72 1.28 3.55 2.63 0.826 1.35 1.24 2.97 1.24 4.88 0 1.91-0.412 3.53-1.23 4.88s-2.01 2.22-3.55 2.62l-0.19-0.608c1.22-0.406 2.12-1.21 2.72-2.41 0.594-1.2 0.89-2.72 0.89-4.56 0-1.78-0.296-3.26-0.886-4.44-0.59-1.18-1.51-1.97-2.74-2.38l0.212-0.608zm-10.1 0 0.212 0.608c-1.23 0.406-2.15 1.2-2.74 2.38-0.594 1.18-0.89 2.66-0.89 4.44 0 1.85 0.296 3.37 0.89 4.56 0.594 1.2 1.5 2 2.72 2.41l-0.19 0.608c-1.55-0.406-2.73-1.28-3.55-2.62-0.824-1.34-1.23-2.97-1.23-4.88 0-1.9 0.412-3.53 1.24-4.88 0.824-1.35 2.01-2.22 3.55-2.63z\"/><path d=\"m688 187c0.164 0 0.308 0.018 0.432 0.054 0.124 0.038 0.234 0.094 0.328 0.17 0.096 0.078 0.18 0.176 0.254 0.298 0.074 0.12 0.144 0.286 0.212 0.494 0.07 0.208 0.134 0.466 0.194 0.774 0.062 0.31 0.116 0.63 0.162 0.962h0.08c0.506-0.712 0.89-1.23 1.15-1.56 0.262-0.33 0.482-0.576 0.662-0.736 0.178-0.16 0.352-0.274 0.518-0.34s0.386-0.098 0.66-0.098c0.248 0 0.45 0.03 0.61 0.094l-0.318 1.43h-0.554c-0.03-0.222-0.122-0.332-0.276-0.332-0.048 0-0.098 8e-3 -0.15 0.024s-0.118 0.05-0.194 0.102-0.188 0.156-0.336 0.308c-0.148 0.154-0.314 0.34-0.498 0.562-0.186 0.222-0.374 0.454-0.57 0.696l-0.538 0.672c0.094 0.506 0.184 0.944 0.27 1.31 0.084 0.368 0.158 0.676 0.224 0.922 0.066 0.244 0.124 0.438 0.174 0.58 0.05 0.144 0.104 0.25 0.162 0.322 0.058 0.07 0.118 0.12 0.178 0.15 0.062 0.028 0.132 0.042 0.21 0.042 0.142 0 0.282-0.054 0.416-0.166 0.134-0.11 0.328-0.36 0.58-0.75l0.516 0.34c-0.37 0.548-0.704 0.934-1 1.16s-0.652 0.336-1.06 0.336c-0.226 0-0.418-0.04-0.576-0.122-0.16-0.082-0.296-0.212-0.412-0.392s-0.22-0.458-0.308-0.838c-0.164-0.676-0.264-1.19-0.302-1.55h-0.078c-0.56 0.786-0.974 1.35-1.25 1.69s-0.496 0.596-0.672 0.76c-0.178 0.164-0.348 0.278-0.514 0.344s-0.388 0.098-0.662 0.098c-0.248 0-0.45-0.032-0.608-0.094l0.316-1.43h0.554c0.032 0.222 0.124 0.332 0.276 0.332 0.074 0 0.152-0.02 0.234-0.06 0.082-0.038 0.2-0.134 0.352-0.284s0.364-0.386 0.632-0.708c0.27-0.322 0.66-0.804 1.17-1.45-0.08-0.416-0.162-0.816-0.246-1.2-0.084-0.384-0.172-0.744-0.26-1.08-0.09-0.332-0.164-0.55-0.222-0.652-0.058-0.104-0.12-0.174-0.186-0.214s-0.15-0.06-0.25-0.06c-0.11 0-0.21 0.026-0.3 0.076s-0.188 0.138-0.292 0.262c-0.106 0.122-0.246 0.316-0.42 0.58l-0.514-0.34c0.332-0.5 0.652-0.876 0.958-1.12 0.304-0.248 0.666-0.372 1.08-0.372z\"/><path d=\"m706 191h9.75v1.05h-9.75v-1.05zm0-3.28h9.75v1.05h-9.75v-1.05z\"/><path d=\"m725 187c0.162 0 0.306 0.018 0.43 0.054 0.124 0.038 0.234 0.094 0.328 0.17 0.096 0.078 0.18 0.176 0.254 0.298 0.074 0.12 0.144 0.286 0.214 0.494 0.068 0.208 0.132 0.466 0.194 0.774 0.06 0.31 0.114 0.63 0.162 0.962h0.078c0.506-0.712 0.89-1.23 1.15-1.56 0.26-0.33 0.48-0.576 0.66-0.736s0.352-0.274 0.518-0.34 0.386-0.098 0.66-0.098c0.248 0 0.452 0.03 0.61 0.094l-0.316 1.43h-0.554c-0.032-0.222-0.124-0.332-0.278-0.332-0.046 0-0.096 8e-3 -0.15 0.024-0.052 0.016-0.118 0.05-0.194 0.102s-0.188 0.156-0.336 0.308c-0.148 0.154-0.314 0.34-0.498 0.562s-0.374 0.454-0.57 0.696l-0.538 0.672c0.096 0.506 0.186 0.944 0.27 1.31 0.084 0.368 0.16 0.676 0.224 0.922 0.066 0.244 0.124 0.438 0.174 0.58 0.052 0.144 0.106 0.25 0.164 0.322 0.058 0.07 0.116 0.12 0.178 0.15 0.06 0.028 0.13 0.042 0.208 0.042 0.144 0 0.282-0.054 0.416-0.166 0.134-0.11 0.328-0.36 0.582-0.75l0.514 0.34c-0.37 0.548-0.704 0.934-1 1.16s-0.652 0.336-1.06 0.336c-0.228 0-0.42-0.04-0.578-0.122s-0.296-0.212-0.412-0.392-0.218-0.458-0.308-0.838c-0.164-0.676-0.264-1.19-0.3-1.55h-0.08c-0.558 0.786-0.974 1.35-1.25 1.69s-0.496 0.596-0.672 0.76-0.348 0.278-0.514 0.344-0.386 0.098-0.66 0.098c-0.248 0-0.452-0.032-0.61-0.094l0.316-1.43h0.554c0.032 0.222 0.124 0.332 0.278 0.332 0.072 0 0.15-0.02 0.232-0.06 0.082-0.038 0.2-0.134 0.352-0.284 0.154-0.15 0.364-0.386 0.634-0.708 0.268-0.322 0.658-0.804 1.17-1.45-0.08-0.416-0.16-0.816-0.246-1.2-0.084-0.384-0.17-0.744-0.26-1.08s-0.164-0.55-0.222-0.652c-0.058-0.104-0.12-0.174-0.186-0.214s-0.148-0.06-0.248-0.06c-0.112 0-0.212 0.026-0.302 0.076s-0.186 0.138-0.292 0.262c-0.106 0.122-0.246 0.316-0.42 0.58l-0.514-0.34c0.332-0.5 0.652-0.876 0.958-1.12 0.306-0.248 0.666-0.372 1.08-0.372z\"/><path d=\"m463 7.88c0.516 0 0.962 0.0422 1.34 0.127l-0.308 1.34h-0.696c-0.074-0.301-0.17-0.517-0.288-0.649-0.12-0.132-0.294-0.198-0.526-0.198-0.302 0-0.556 0.083-0.764 0.249-0.208 0.166-0.386 0.413-0.534 0.74-0.148 0.327-0.284 0.767-0.412 1.32l-0.198 0.862h2.03l-0.174 0.799h-2.04l-1.47 6.9c-0.244 1.14-0.614 2-1.12 2.56-0.5 0.562-1.13 0.842-1.89 0.842-0.222 0-0.396-0.0132-0.522-0.0394l0.134-0.696c0.052 0.0158 0.176 0.0238 0.372 0.0238 0.238 0 0.44-0.0606 0.608-0.182 0.17-0.121 0.326-0.332 0.472-0.633 0.144-0.301 0.278-0.717 0.4-1.25l1.7-7.52h-1.34l0.12-0.546c0.352-0.021 0.608-0.05 0.762-0.087 0.156-0.0368 0.278-0.0922 0.364-0.166 0.088-0.074 0.162-0.17 0.222-0.289s0.138-0.336 0.234-0.653c0.28-0.949 0.71-1.66 1.29-2.14 0.584-0.477 1.33-0.716 2.23-0.716z\"/><path d=\"m482 7.11c1.54 0.406 2.72 1.28 3.55 2.63 0.826 1.35 1.24 2.97 1.24 4.88 0 1.91-0.41 3.53-1.23 4.88-0.822 1.34-2.01 2.22-3.55 2.62l-0.19-0.609c1.22-0.406 2.12-1.21 2.72-2.4s0.89-2.72 0.89-4.56c0-1.78-0.296-3.26-0.886-4.44-0.59-1.18-1.51-1.97-2.74-2.38l0.212-0.609zm-10.1 0 0.212 0.609c-1.23 0.406-2.15 1.2-2.74 2.38-0.594 1.18-0.89 2.66-0.89 4.44 0 1.85 0.296 3.37 0.89 4.56s1.5 2 2.72 2.4l-0.19 0.609c-1.55-0.406-2.73-1.28-3.55-2.62-0.824-1.34-1.23-2.97-1.23-4.88 0-1.9 0.412-3.53 1.24-4.88 0.824-1.35 2.01-2.22 3.55-2.63z\"/><path d=\"m475 11.5c0.164 0 0.308 0.0184 0.432 0.0554s0.234 0.0936 0.328 0.17c0.096 0.0766 0.18 0.175 0.254 0.297 0.074 0.121 0.144 0.286 0.212 0.494 0.07 0.208 0.134 0.467 0.194 0.775 0.062 0.309 0.116 0.629 0.162 0.961h0.08c0.506-0.712 0.89-1.23 1.15-1.56 0.262-0.33 0.482-0.575 0.662-0.736 0.178-0.161 0.352-0.274 0.518-0.34 0.166-0.066 0.386-0.099 0.66-0.099 0.248 0 0.45 0.0318 0.61 0.095l-0.318 1.43h-0.552c-0.032-0.222-0.124-0.332-0.278-0.332-0.048 0-0.098 8e-3 -0.15 0.0238s-0.118 0.0502-0.194 0.103c-0.076 0.0528-0.188 0.156-0.336 0.309-0.148 0.153-0.314 0.34-0.498 0.562-0.186 0.221-0.374 0.453-0.57 0.696l-0.538 0.672c0.096 0.506 0.184 0.944 0.27 1.31 0.084 0.369 0.158 0.676 0.224 0.921s0.124 0.439 0.174 0.581 0.104 0.249 0.162 0.32 0.118 0.121 0.178 0.15c0.062 0.029 0.132 0.0434 0.21 0.0434 0.142 0 0.282-0.0554 0.416-0.166 0.134-0.111 0.328-0.361 0.58-0.751l0.516 0.34c-0.37 0.548-0.704 0.935-1 1.16s-0.652 0.336-1.06 0.336c-0.226 0-0.418-0.0408-0.576-0.123-0.16-0.0818-0.296-0.212-0.412-0.392-0.116-0.179-0.22-0.459-0.308-0.838-0.164-0.675-0.264-1.19-0.302-1.55h-0.078c-0.56 0.786-0.974 1.35-1.25 1.69s-0.496 0.596-0.672 0.759c-0.178 0.163-0.348 0.278-0.514 0.344s-0.388 0.0988-0.662 0.0988c-0.248 0-0.45-0.0316-0.608-0.0948l0.316-1.43h0.554c0.032 0.222 0.124 0.332 0.276 0.332 0.074 0 0.152-0.0198 0.234-0.0592 0.082-0.0396 0.2-0.135 0.352-0.285 0.152-0.15 0.364-0.386 0.632-0.708 0.27-0.322 0.66-0.804 1.17-1.45-0.08-0.417-0.162-0.817-0.246-1.2-0.084-0.385-0.172-0.743-0.26-1.08-0.09-0.332-0.164-0.55-0.222-0.653-0.058-0.103-0.12-0.174-0.186-0.214-0.066-0.0396-0.15-0.0594-0.25-0.0594-0.11 0-0.21 0.025-0.3 0.0752-0.09 0.05-0.188 0.137-0.292 0.261-0.106 0.124-0.246 0.318-0.42 0.581l-0.514-0.34c0.332-0.501 0.652-0.875 0.958-1.12s0.666-0.372 1.08-0.372z\"/><path d=\"m494 15.7h9.75v1.05h-9.75v-1.05zm0-3.28h9.75v1.05h-9.75v-1.05z\"/><path d=\"m510 14h9.74v5.58h-1.12v-4.54h-8.62v-1.04z\"/><path d=\"m524 11.5c0.164 0 0.308 0.0184 0.432 0.0554s0.234 0.0936 0.328 0.17c0.094 0.0766 0.18 0.175 0.254 0.297 0.072 0.121 0.144 0.286 0.212 0.494 0.07 0.208 0.134 0.467 0.194 0.775 0.062 0.309 0.116 0.629 0.162 0.961h0.08c0.506-0.712 0.89-1.23 1.15-1.56 0.262-0.33 0.482-0.575 0.662-0.736 0.178-0.161 0.352-0.274 0.518-0.34 0.166-0.066 0.386-0.099 0.66-0.099 0.248 0 0.45 0.0318 0.608 0.095l-0.316 1.43h-0.554c-0.03-0.222-0.124-0.332-0.276-0.332-0.048 0-0.098 8e-3 -0.15 0.0238-0.054 0.0158-0.118 0.0502-0.194 0.103-0.076 0.0528-0.188 0.156-0.336 0.309-0.148 0.153-0.314 0.34-0.498 0.562-0.186 0.221-0.376 0.453-0.57 0.696l-0.538 0.672c0.094 0.506 0.184 0.944 0.268 1.31 0.086 0.369 0.16 0.676 0.226 0.921s0.124 0.439 0.174 0.581 0.104 0.249 0.162 0.32 0.118 0.121 0.178 0.15c0.062 0.029 0.13 0.0434 0.21 0.0434 0.142 0 0.28-0.0554 0.416-0.166 0.134-0.111 0.328-0.361 0.58-0.751l0.514 0.34c-0.368 0.548-0.702 0.935-1 1.16s-0.652 0.336-1.06 0.336c-0.226 0-0.418-0.0408-0.578-0.123-0.158-0.0818-0.294-0.212-0.41-0.392-0.116-0.179-0.22-0.459-0.308-0.838-0.164-0.675-0.264-1.19-0.302-1.55h-0.078c-0.56 0.786-0.974 1.35-1.25 1.69s-0.496 0.596-0.672 0.759c-0.178 0.163-0.348 0.278-0.514 0.344-0.168 0.066-0.388 0.0988-0.662 0.0988-0.248 0-0.45-0.0316-0.608-0.0948l0.316-1.43h0.554c0.032 0.222 0.124 0.332 0.276 0.332 0.074 0 0.152-0.0198 0.234-0.0592 0.082-0.0396 0.198-0.135 0.352-0.285 0.152-0.15 0.364-0.386 0.632-0.708 0.27-0.322 0.66-0.804 1.17-1.45-0.08-0.417-0.162-0.817-0.246-1.2-0.084-0.385-0.172-0.743-0.26-1.08-0.09-0.332-0.164-0.55-0.222-0.653-0.058-0.103-0.12-0.174-0.186-0.214-0.066-0.0396-0.15-0.0594-0.25-0.0594-0.11 0-0.21 0.025-0.3 0.0752-0.09 0.05-0.188 0.137-0.292 0.261-0.106 0.124-0.246 0.318-0.42 0.581l-0.514-0.34c0.332-0.501 0.652-0.875 0.956-1.12 0.306-0.248 0.668-0.372 1.08-0.372z\"/></g><path d=\"m121 360c-0.941 0.455-2.17 0.683-3.68 0.683-1.98 0-3.53-0.581-4.66-1.74s-1.7-2.71-1.7-4.64c0-2.06 0.635-3.73 1.9-5.01 1.28-1.28 2.93-1.92 4.96-1.92 1.26 0 2.32 0.159 3.18 0.476v2.79c-0.863-0.515-1.84-0.773-2.95-0.773-1.21 0-2.19 0.381-2.93 1.14-0.743 0.761-1.11 1.79-1.11 3.09 0 1.25 0.35 2.24 1.05 2.98 0.701 0.737 1.64 1.1 2.83 1.1 1.13 0 2.17-0.276 3.11-0.827v2.65zm6.35 0.683c-1.53 0-2.74-0.429-3.62-1.28-0.875-0.863-1.31-2.03-1.31-3.5 0-1.52 0.455-2.71 1.37-3.57 0.91-0.862 2.14-1.29 3.69-1.29 1.53 0 2.73 0.432 3.59 1.29 0.869 0.857 1.3 1.99 1.3 3.4 0 1.53-0.449 2.73-1.35 3.62-0.892 0.886-2.12 1.33-3.67 1.33zm0.071-7.48c-0.67 0-1.19 0.23-1.56 0.691-0.371 0.462-0.557 1.11-0.557 1.96 0 1.77 0.713 2.65 2.14 2.65 1.36 0 2.04-0.907 2.04-2.72 0-1.72-0.686-2.58-2.06-2.58zm15.7 7.25h-2.83v-5.11c0-1.43-0.509-2.14-1.53-2.14-0.491 0-0.896 0.188-1.21 0.566-0.318 0.377-0.476 0.856-0.476 1.44v5.25h-2.84v-9.2h2.84v1.46h0.036c0.676-1.12 1.66-1.68 2.96-1.68 2.04 0 3.06 1.26 3.06 3.79v5.63zm1.65-0.243v-2.3c0.467 0.282 0.932 0.492 1.39 0.629 0.467 0.138 0.907 0.207 1.32 0.207 0.503 0 0.898-0.069 1.19-0.207 0.293-0.137 0.44-0.347 0.44-0.629 0-0.179-0.066-0.329-0.198-0.449s-0.302-0.224-0.512-0.314c-0.204-0.09-0.428-0.171-0.674-0.243-0.245-0.072-0.482-0.153-0.71-0.242-0.365-0.138-0.688-0.285-0.97-0.441-0.275-0.161-0.509-0.347-0.701-0.557-0.185-0.209-0.329-0.452-0.431-0.727-0.096-0.276-0.144-0.602-0.144-0.98 0-0.515 0.111-0.958 0.333-1.33 0.227-0.372 0.527-0.674 0.898-0.908 0.377-0.239 0.806-0.413 1.28-0.521 0.485-0.114 0.988-0.171 1.51-0.171 0.408 0 0.821 0.033 1.24 0.099 0.419 0.06 0.833 0.15 1.24 0.27v2.19c-0.359-0.21-0.746-0.365-1.16-0.467-0.407-0.108-0.809-0.162-1.2-0.162-0.186 0-0.362 0.018-0.53 0.054-0.162 0.03-0.305 0.078-0.431 0.144-0.126 0.06-0.225 0.14-0.297 0.242-0.072 0.096-0.108 0.207-0.108 0.333 0 0.167 0.054 0.311 0.162 0.431s0.249 0.225 0.422 0.314c0.174 0.084 0.366 0.162 0.575 0.234 0.216 0.066 0.429 0.135 0.638 0.207 0.378 0.131 0.719 0.275 1.02 0.431 0.305 0.156 0.566 0.338 0.781 0.548 0.222 0.21 0.39 0.455 0.503 0.737 0.12 0.281 0.18 0.617 0.18 1.01 0 0.545-0.12 1.01-0.359 1.4-0.234 0.384-0.548 0.698-0.944 0.944-0.389 0.239-0.841 0.413-1.36 0.521-0.509 0.114-1.04 0.171-1.59 0.171-1.01 0-1.95-0.156-2.81-0.468zm14.3 0.135c-0.419 0.222-1.05 0.333-1.9 0.333-2 0-3-1.04-3-3.12v-4.21h-1.49v-2.09h1.49v-1.99l2.83-0.808v2.79h2.07v2.09h-2.07v3.72c0 0.958 0.38 1.44 1.14 1.44 0.3 0 0.608-0.086 0.925-0.26v2.1zm9.26 0.108h-2.69v-1.32h-0.036c-0.617 1.03-1.53 1.55-2.74 1.55-0.893 0-1.6-0.252-2.11-0.755-0.51-0.509-0.764-1.19-0.764-2.03 0-1.78 1.06-2.82 3.17-3.09l2.5-0.333c0-1.01-0.545-1.51-1.64-1.51-1.1 0-2.14 0.326-3.13 0.979v-2.14c0.396-0.204 0.935-0.383 1.62-0.539 0.689-0.156 1.32-0.234 1.88-0.234 2.62 0 3.94 1.31 3.94 3.93v5.5zm-2.67-3.74v-0.62l-1.67 0.215c-0.922 0.12-1.38 0.536-1.38 1.25 0 0.323 0.111 0.59 0.333 0.8 0.227 0.203 0.533 0.305 0.916 0.305 0.533 0 0.967-0.183 1.3-0.548 0.335-0.371 0.503-0.838 0.503-1.4zm13.8 3.74h-2.83v-5.11c0-1.43-0.509-2.14-1.53-2.14-0.492 0-0.896 0.188-1.21 0.566-0.318 0.377-0.476 0.856-0.476 1.44v5.25h-2.84v-9.2h2.84v1.46h0.035c0.677-1.12 1.66-1.68 2.96-1.68 2.04 0 3.06 1.26 3.06 3.79v5.63zm7.82-0.108c-0.419 0.222-1.05 0.333-1.9 0.333-2 0-3-1.04-3-3.12v-4.21h-1.49v-2.09h1.49v-1.99l2.83-0.808v2.79h2.07v2.09h-2.07v3.72c0 0.958 0.38 1.44 1.14 1.44 0.3 0 0.608-0.086 0.925-0.26v2.1z\" fill=\"#000\"/><path d=\"m477 347-4.44 12.9h-3.29l-4.38-12.9h3.13l2.69 8.97c0.143 0.485 0.23 0.913 0.26 1.28h0.054c0.042-0.402 0.135-0.842 0.279-1.32l2.67-8.93h3.04zm7.54 12.9h-2.69v-1.32h-0.036c-0.617 1.03-1.53 1.55-2.74 1.55-0.892 0-1.6-0.252-2.11-0.755-0.509-0.509-0.764-1.19-0.764-2.03 0-1.78 1.06-2.82 3.17-3.09l2.5-0.333c0-1.01-0.545-1.51-1.64-1.51-1.1 0-2.14 0.326-3.13 0.979v-2.14c0.395-0.204 0.934-0.383 1.62-0.539 0.689-0.156 1.32-0.234 1.88-0.234 2.62 0 3.94 1.31 3.94 3.93v5.5zm-2.67-3.74v-0.62l-1.67 0.215c-0.922 0.12-1.38 0.536-1.38 1.25 0 0.323 0.11 0.59 0.332 0.8 0.228 0.203 0.533 0.305 0.916 0.305 0.534 0 0.968-0.183 1.3-0.548 0.336-0.371 0.503-0.838 0.503-1.4zm10.9-2.9c-0.341-0.186-0.739-0.279-1.2-0.279-0.617 0-1.1 0.228-1.45 0.683-0.347 0.449-0.521 1.06-0.521 1.84v4.39h-2.84v-9.2h2.84v1.71h0.036c0.449-1.25 1.26-1.87 2.43-1.87 0.299 0 0.533 0.036 0.7 0.108v2.62zm2.84-4.02c-0.479 0-0.871-0.141-1.18-0.423-0.305-0.287-0.458-0.638-0.458-1.05 0-0.425 0.153-0.773 0.458-1.04 0.306-0.27 0.698-0.404 1.18-0.404 0.486 0 0.878 0.134 1.18 0.404 0.306 0.269 0.459 0.617 0.459 1.04 0 0.431-0.153 0.785-0.459 1.06-0.299 0.276-0.691 0.414-1.18 0.414zm1.4 10.7h-2.84v-9.2h2.84v9.2zm10 0h-2.69v-1.32h-0.036c-0.617 1.03-1.53 1.55-2.74 1.55-0.892 0-1.6-0.252-2.11-0.755-0.509-0.509-0.764-1.19-0.764-2.03 0-1.78 1.06-2.82 3.17-3.09l2.5-0.333c0-1.01-0.545-1.51-1.64-1.51-1.1 0-2.14 0.326-3.13 0.979v-2.14c0.396-0.204 0.935-0.383 1.62-0.539 0.688-0.156 1.31-0.234 1.88-0.234 2.62 0 3.94 1.31 3.94 3.93v5.5zm-2.67-3.74v-0.62l-1.67 0.215c-0.922 0.12-1.38 0.536-1.38 1.25 0 0.323 0.111 0.59 0.333 0.8 0.227 0.203 0.533 0.305 0.916 0.305 0.533 0 0.968-0.183 1.3-0.548 0.335-0.371 0.503-0.838 0.503-1.4zm7.79 2.67h-0.036v1.07h-2.84v-13.6h2.84v5.8h0.036c0.7-1.07 1.7-1.61 2.99-1.61 1.19 0 2.1 0.408 2.74 1.22 0.641 0.815 0.961 1.93 0.961 3.34 0 1.53-0.374 2.76-1.12 3.69s-1.75 1.39-3 1.39c-1.13 0-1.99-0.432-2.57-1.29zm-0.081-3.88v0.943c0 0.593 0.17 1.08 0.512 1.47 0.341 0.39 0.778 0.584 1.31 0.584 0.646 0 1.15-0.248 1.5-0.745 0.359-0.503 0.539-1.21 0.539-2.13 0-0.76-0.165-1.35-0.494-1.78-0.324-0.431-0.788-0.646-1.39-0.646-0.569 0-1.04 0.212-1.42 0.638-0.372 0.425-0.557 0.979-0.557 1.66zm11.5 4.95h-2.84v-13.6h2.84v13.6zm10.7-3.79h-6c0.096 1.34 0.937 2 2.52 2 1.01 0 1.9-0.239 2.67-0.719v2.05c-0.851 0.455-1.96 0.683-3.32 0.683-1.48 0-2.64-0.411-3.46-1.23-0.82-0.827-1.23-1.98-1.23-3.45 0-1.53 0.443-2.74 1.33-3.63 0.887-0.892 1.98-1.34 3.27-1.34 1.34 0 2.38 0.399 3.11 1.2 0.737 0.797 1.1 1.88 1.1 3.24v1.2zm-2.63-1.74c0-1.32-0.533-1.98-1.6-1.98-0.456 0-0.851 0.189-1.19 0.566-0.33 0.377-0.53 0.848-0.602 1.41h3.39z\" fill=\"#000\"/><g clip-rule=\"evenodd\" fill=\"#000\" fill-rule=\"evenodd\"><path d=\"m242 183h1.25v15.1h-1.25v-15.1z\"/><path d=\"m250 184c-0.374 0-0.686 0.11-0.936 0.332-0.252 0.222-0.454 0.54-0.608 0.956s-0.264 0.924-0.328 1.52c-0.066 0.598-0.098 1.27-0.098 2.02 0 1.76 0.164 3.05 0.49 3.88 0.328 0.826 0.834 1.24 1.52 1.24 0.654 0 1.14-0.388 1.46-1.16 0.316-0.776 0.474-1.98 0.474-3.6 0-1.24-0.082-2.25-0.244-3.02s-0.388-1.32-0.676-1.66c-0.29-0.334-0.64-0.502-1.05-0.502zm0.04-0.69c1.18 0 2.06 0.458 2.64 1.37 0.578 0.914 0.868 2.29 0.868 4.14 0 1.91-0.31 3.36-0.928 4.34-0.618 0.982-1.52 1.47-2.71 1.47-1.17 0-2.04-0.46-2.61-1.38s-0.854-2.31-0.854-4.18c0-0.994 0.088-1.85 0.262-2.58 0.176-0.724 0.422-1.32 0.738-1.8 0.316-0.472 0.696-0.822 1.14-1.05 0.442-0.228 0.926-0.342 1.45-0.342z\"/><path d=\"m256 182 3.24 7.28v0.6l-3.24 7.29-0.866-0.308 2.6-7.28-2.6-7.29 0.866-0.292z\"/><path d=\"m139 72.2h1.25v15.1h-1.25v-15.1z\"/><path d=\"m148 72.6h0.444c-0.032 0.519-0.048 1.24-0.048 2.16v6.92c0 0.313 0.018 0.55 0.052 0.709 0.036 0.159 0.098 0.289 0.188 0.389 0.088 0.1 0.216 0.178 0.384 0.235 0.168 0.0566 0.378 0.0998 0.632 0.13s0.59 0.05 1.01 0.0608v0.592h-5.99v-0.592c0.6-0.027 1.03-0.0634 1.28-0.109 0.258-0.046 0.454-0.115 0.588-0.207 0.136-0.0918 0.234-0.221 0.296-0.389 0.062-0.167 0.094-0.44 0.094-0.819v-6.57c0-0.216-0.038-0.374-0.114-0.474-0.076-0.0998-0.186-0.15-0.332-0.15-0.174 0-0.42 0.089-0.738 0.267-0.32 0.178-0.714 0.424-1.18 0.738l-0.356-0.624 3.79-2.26z\"/><path d=\"m153 71.5 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m208 115h1.25v15.1h-1.25v-15.1z\"/><path d=\"m217 117h1.15v4.67h4.42v1.08h-4.42v4.67h-1.15v-4.67h-4.42v-1.08h4.42v-4.67z\"/><path d=\"m225 114 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m208 248h1.25v15.1h-1.25v-15.1z\"/><path d=\"m212 255h9.99v1.08h-9.99v-1.08z\"/><path d=\"m225 247 3.23 7.28v0.6l-3.23 7.29-0.866-0.308 2.6-7.28-2.6-7.29 0.866-0.292z\"/><path d=\"m132 292h9.99v1.08h-9.99v-1.08z\"/><path d=\"m145 285h1.25v15.1h-1.25v-15.1z\"/><path d=\"m154 286h0.444c-0.032 0.52-0.048 1.24-0.048 2.16v6.92c0 0.314 0.018 0.55 0.054 0.71 0.034 0.16 0.096 0.29 0.186 0.39 0.088 0.1 0.216 0.178 0.384 0.234 0.168 0.058 0.378 0.1 0.632 0.13s0.59 0.05 1.01 0.06v0.592h-5.99v-0.592c0.6-0.026 1.03-0.062 1.28-0.108 0.258-0.046 0.454-0.116 0.588-0.208 0.136-0.092 0.234-0.22 0.296-0.388s0.094-0.44 0.094-0.82v-6.57c0-0.216-0.038-0.374-0.114-0.474s-0.186-0.15-0.332-0.15c-0.174 0-0.42 0.088-0.738 0.266-0.318 0.18-0.714 0.424-1.18 0.738l-0.356-0.624 3.79-2.26z\"/><path d=\"m159 285 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m27.9 189h9.99v1.08h-9.99v-1.08z\"/><path d=\"m41 183h1.25v15.1h-1.25v-15.1z\"/><path d=\"m48.9 184c-0.373 0-0.685 0.11-0.936 0.332-0.251 0.222-0.454 0.54-0.608 0.956s-0.264 0.924-0.328 1.52c-0.0648 0.598-0.0972 1.27-0.0972 2.02 0 1.76 0.163 3.05 0.49 3.88 0.327 0.826 0.833 1.24 1.52 1.24 0.654 0 1.14-0.388 1.45-1.16 0.316-0.776 0.474-1.98 0.474-3.6 0-1.24-0.081-2.25-0.243-3.02-0.162-0.77-0.388-1.32-0.677-1.66-0.289-0.334-0.639-0.502-1.05-0.502zm0.0406-0.69c1.18 0 2.06 0.458 2.64 1.37 0.578 0.914 0.867 2.29 0.867 4.14 0 1.91-0.309 3.36-0.928 4.34-0.619 0.982-1.52 1.47-2.71 1.47-1.17 0-2.04-0.46-2.61-1.38-0.57-0.918-0.855-2.31-0.855-4.18 0-0.994 0.0878-1.85 0.263-2.58s0.422-1.32 0.738-1.8c0.316-0.472 0.696-0.822 1.14-1.05 0.443-0.228 0.927-0.342 1.45-0.342z\"/><path d=\"m55.2 182 3.23 7.28v0.6l-3.23 7.29-0.867-0.308 2.6-7.28-2.6-7.29 0.867-0.292z\"/><path d=\"m57.3 254h9.99v1.08h-9.99v-1.08z\"/><path d=\"m70.4 248h1.25v15.1h-1.25v-15.1z\"/><path d=\"m79.3 250h1.15v4.67h4.42v1.08h-4.42v4.67h-1.15v-4.67h-4.42v-1.08h4.42v-4.67z\"/><path d=\"m87.8 247 3.23 7.28v0.6l-3.23 7.29-0.867-0.308 2.6-7.28-2.6-7.29 0.867-0.292z\"/><path d=\"m56.6 121h9.99v1.08h-9.99v-1.08z\"/><path d=\"m69.8 115h1.25v15.1h-1.25v-15.1z\"/><path d=\"m74.3 121h9.99v1.08h-9.99v-1.08z\"/><path d=\"m87.1 114 3.23 7.28v0.599l-3.23 7.29-0.867-0.308 2.6-7.28-2.6-7.29 0.867-0.292z\"/><path d=\"m593 183h1.25v15.1h-1.25v-15.1z\"/><path d=\"m601 184c-0.372 0-0.684 0.11-0.936 0.332-0.25 0.222-0.454 0.54-0.608 0.956s-0.262 0.924-0.328 1.52c-0.064 0.598-0.096 1.27-0.096 2.02 0 1.76 0.162 3.05 0.49 3.88 0.326 0.826 0.834 1.24 1.52 1.24 0.654 0 1.14-0.388 1.45-1.16s0.474-1.98 0.474-3.6c0-1.24-0.08-2.25-0.242-3.02s-0.388-1.32-0.678-1.66c-0.288-0.334-0.638-0.502-1.05-0.502zm0.042-0.69c1.18 0 2.06 0.458 2.64 1.37 0.578 0.914 0.868 2.29 0.868 4.14 0 1.91-0.31 3.36-0.93 4.34-0.618 0.982-1.52 1.47-2.71 1.47-1.17 0-2.04-0.46-2.61-1.38s-0.856-2.31-0.856-4.18c0-0.994 0.088-1.85 0.264-2.58s0.422-1.32 0.738-1.8c0.316-0.472 0.696-0.822 1.14-1.05 0.444-0.228 0.928-0.342 1.45-0.342z\"/><path d=\"m607 182 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m490 72.2h1.25v15.1h-1.25v-15.1z\"/><path d=\"m499 72.6h0.446c-0.032 0.519-0.048 1.24-0.048 2.16v6.92c0 0.313 0.018 0.55 0.052 0.709 0.036 0.159 0.098 0.289 0.186 0.389 0.09 0.1 0.218 0.178 0.386 0.235 0.168 0.0566 0.378 0.0998 0.632 0.13s0.588 0.05 1 0.0608v0.592h-5.99v-0.592c0.6-0.027 1.03-0.0634 1.29-0.109 0.256-0.046 0.452-0.115 0.588-0.207 0.134-0.0918 0.234-0.221 0.296-0.389 0.062-0.167 0.092-0.44 0.092-0.819v-6.57c0-0.216-0.038-0.374-0.114-0.474-0.074-0.0998-0.186-0.15-0.332-0.15-0.172 0-0.418 0.089-0.736 0.267-0.32 0.178-0.714 0.424-1.18 0.738l-0.358-0.624 3.79-2.26z\"/><path d=\"m504 71.5 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m559 115h1.25v15.1h-1.25v-15.1z\"/><path d=\"m567 117h1.15v4.67h4.42v1.08h-4.42v4.67h-1.15v-4.67h-4.42v-1.08h4.42v-4.67z\"/><path d=\"m576 114 3.23 7.28v0.6l-3.23 7.29-0.866-0.308 2.6-7.28-2.6-7.29 0.866-0.292z\"/><path d=\"m559 248h1.25v15.1h-1.25v-15.1z\"/><path d=\"m563 255h9.99v1.08h-9.99v-1.08z\"/><path d=\"m576 247 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m483 292h9.99v1.08h-9.99v-1.08z\"/><path d=\"m496 285h1.25v15.1h-1.25v-15.1z\"/><path d=\"m505 286h0.446c-0.032 0.52-0.048 1.24-0.048 2.16v6.92c0 0.314 0.018 0.55 0.052 0.71 0.036 0.16 0.098 0.29 0.186 0.39 0.09 0.1 0.218 0.178 0.386 0.234 0.168 0.058 0.378 0.1 0.632 0.13s0.588 0.05 1 0.06v0.592h-5.99v-0.592c0.598-0.026 1.03-0.062 1.28-0.108s0.452-0.116 0.588-0.208c0.134-0.092 0.234-0.22 0.296-0.388s0.092-0.44 0.092-0.82v-6.57c0-0.216-0.038-0.374-0.114-0.474-0.074-0.1-0.186-0.15-0.332-0.15-0.172 0-0.418 0.088-0.736 0.266-0.32 0.18-0.714 0.424-1.18 0.738l-0.358-0.624 3.79-2.26z\"/><path d=\"m510 285 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m379 189h9.99v1.08h-9.99v-1.08z\"/><path d=\"m392 183h1.25v15.1h-1.25v-15.1z\"/><path d=\"m400 184c-0.372 0-0.684 0.11-0.936 0.332-0.25 0.222-0.454 0.54-0.608 0.956s-0.262 0.924-0.328 1.52c-0.064 0.598-0.098 1.27-0.098 2.02 0 1.76 0.164 3.05 0.492 3.88 0.326 0.826 0.832 1.24 1.52 1.24 0.652 0 1.14-0.388 1.45-1.16s0.474-1.98 0.474-3.6c0-1.24-0.08-2.25-0.242-3.02-0.164-0.77-0.388-1.32-0.678-1.66-0.288-0.334-0.638-0.502-1.05-0.502zm0.042-0.69c1.18 0 2.06 0.458 2.64 1.37 0.578 0.914 0.866 2.29 0.866 4.14 0 1.91-0.308 3.36-0.928 4.34-0.618 0.982-1.52 1.47-2.71 1.47-1.17 0-2.04-0.46-2.61-1.38s-0.856-2.31-0.856-4.18c0-0.994 0.088-1.85 0.264-2.58s0.422-1.32 0.738-1.8c0.316-0.472 0.696-0.822 1.14-1.05 0.444-0.228 0.926-0.342 1.45-0.342z\"/><path d=\"m406 182 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m408 254h9.99v1.08h-9.99v-1.08z\"/><path d=\"m421 248h1.25v15.1h-1.25v-15.1z\"/><path d=\"m430 250h1.15v4.67h4.42v1.08h-4.42v4.67h-1.15v-4.67h-4.42v-1.08h4.42v-4.67z\"/><path d=\"m439 247 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m408 121h9.99v1.08h-9.99v-1.08z\"/><path d=\"m421 115h1.25v15.1h-1.25v-15.1z\"/><path d=\"m425 121h9.99v1.08h-9.99v-1.08z\"/><path d=\"m438 114 3.23 7.28v0.599l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/></g></g><defs><clipPath id=\"clip0_5_635\"><rect transform=\"translate(.6 .2)\" width=\"737\" height=\"374\" fill=\"#fff\"/></clipPath></defs></svg>\n\n3. Apply the $H$ gate to the qubit again.\n Now, you get the $\\ket{0}$ state for both constant scenarios and the $\\ket{1}$ state for both variable scenarios!\n <br/>\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg width=\"679\" height=\"365\" fill=\"none\" version=\"1.1\" viewBox=\"0 0 679 365\" xmlns=\"http://www.w3.org/2000/svg\"><g clip-path=\"url(#clip0_6_812)\"><g clip-rule=\"evenodd\" fill-rule=\"evenodd\"><path d=\"m24.1 163c0-76.8 62.3-139 139-139 76.8 0 139 62.3 139 139 0 76.8-62.3 139-139 139-76.8 0-139-62.3-139-139z\" stroke=\"#747474\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"/><path d=\"m296 163c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9-2.64 5.9-5.9 5.9-5.9-2.64-5.9-5.9z\" fill=\"#0070C0\"/><path d=\"m157 23.8c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9c0 3.26-2.64 5.9-5.9 5.9s-5.9-2.64-5.9-5.9z\" fill=\"#fff\" stroke=\"#000\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"/><path d=\"m18 163c0-3.26 2.69-5.9 6-5.9 3.31 0 6 2.64 6 5.9s-2.69 5.9-6 5.9c-3.31 0-6-2.64-6-5.9z\" fill=\"#0070C0\"/><g fill=\"#fff\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"><path d=\"m157 302c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9-2.64 5.9-5.9 5.9-5.9-2.64-5.9-5.9z\" stroke=\"#000\"/><path d=\"m257 66.6c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9c0 3.26-2.69 5.9-6 5.9s-6-2.64-6-5.9z\" stroke=\"#0070C0\"/><path d=\"m257 260c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\" stroke=\"#000\"/><path d=\"m57.3 66.6c0-3.26 2.69-5.9 6-5.9 3.31 0 6 2.64 6 5.9 0 3.26-2.69 5.9-6 5.9-3.31 0-6-2.64-6-5.9z\" stroke=\"#000\"/><path d=\"m57.3 260c0-3.26 2.69-5.9 6-5.9 3.31 0 6 2.64 6 5.9s-2.69 5.9-6 5.9c-3.31 0-6-2.64-6-5.9z\" stroke=\"#0070C0\"/></g><path d=\"m375 163c0-76.8 62.2-139 139-139s139 62.3 139 139c0 76.8-62.2 139-139 139s-139-62.3-139-139z\" stroke=\"#747474\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"/><path d=\"m647 163c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\" fill=\"#fff\" stroke=\"#000\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"/><path d=\"m508 23.7c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9c0 3.26-2.69 5.9-6 5.9s-6-2.64-6-5.9z\" fill=\"#0070C0\"/><path d=\"m369 163c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9-2.64 5.9-5.9 5.9-5.9-2.64-5.9-5.9z\" fill=\"#fff\" stroke=\"#000\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"/><path d=\"m508 302c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\" fill=\"#0070C0\"/><g fill=\"#fff\" stroke-miterlimit=\"8\" stroke-width=\"1.38\"><path d=\"m608 66.6c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9c0 3.26-2.69 5.9-6 5.9s-6-2.64-6-5.9z\" stroke=\"#000\"/><path d=\"m608 260c0-3.26 2.69-5.9 6-5.9s6 2.64 6 5.9-2.69 5.9-6 5.9-6-2.64-6-5.9z\" stroke=\"#0070C0\"/><path d=\"m408 66.6c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9c0 3.26-2.64 5.9-5.9 5.9s-5.9-2.64-5.9-5.9z\" stroke=\"#0070C0\"/><path d=\"m408 260c0-3.26 2.64-5.9 5.9-5.9s5.9 2.64 5.9 5.9-2.64 5.9-5.9 5.9-5.9-2.64-5.9-5.9z\" stroke=\"#000\"/></g></g><g fill=\"#0070C0\"><path d=\"m309 162h15.1l-0.688 0.688v-96.5l0.688 0.688h-55.3v-1.38h56v97.9h-15.8v-1.38zm5.06 5.8-6.13-5.11 6.13-5.11c0.292-0.242 0.726-0.202 0.968 0.088 0.244 0.292 0.204 0.726-0.088 0.97l-5.5 4.58v-1.06l5.5 4.58c0.292 0.242 0.332 0.676 0.088 0.968-0.242 0.292-0.676 0.33-0.968 0.088z\"/><path d=\"m17 164h-15.4l0.688-0.688v96.5l-0.688-0.688h55.7v1.38h-56.3v-97.9h16.1v1.38zm-5.06-5.8 6.13 5.11-6.13 5.11c-0.292 0.242-0.725 0.204-0.968-0.088-0.243-0.292-0.204-0.726 0.088-0.968l5.5-4.58v1.06l-5.5-4.58c-0.292-0.242-0.331-0.676-0.088-0.968 0.243-0.292 0.677-0.33 0.968-0.088z\"/><path d=\"m620 259h57.4l-0.688 0.686v-258l0.688 0.687h-163l0.688-0.687v15.4h-1.38v-16.1h165v260h-58.1v-1.37zm-101-247-5.11 6.13-5.11-6.13c-0.242-0.292-0.204-0.725 0.088-0.968 0.292-0.243 0.726-0.204 0.968 0.088l4.58 5.5h-1.06l4.58-5.5c0.242-0.292 0.676-0.331 0.968-0.088 0.292 0.243 0.33 0.677 0.088 0.968z\"/><path d=\"m408 67.4h-51.1l0.686-0.688v258l-0.686-0.688h157l-0.686 0.688v-15.4h1.37v16.1h-158v-259h51.8v1.38zm101 247 5.11-6.13 5.11 6.13c0.244 0.292 0.204 0.726-0.088 0.97-0.292 0.242-0.724 0.202-0.968-0.088l-4.58-5.5h1.06l-4.58 5.5c-0.244 0.29-0.676 0.33-0.968 0.088-0.292-0.244-0.332-0.678-0.088-0.97z\"/></g><path d=\"m135 350c-0.94 0.455-2.17 0.683-3.68 0.683-1.98 0-3.53-0.581-4.66-1.74s-1.7-2.71-1.7-4.64c0-2.06 0.635-3.73 1.9-5.01 1.28-1.28 2.93-1.92 4.96-1.92 1.26 0 2.32 0.159 3.18 0.476v2.79c-0.862-0.515-1.84-0.773-2.95-0.773-1.21 0-2.19 0.381-2.93 1.14-0.743 0.761-1.11 1.79-1.11 3.09 0 1.25 0.35 2.24 1.05 2.98 0.7 0.737 1.64 1.1 2.83 1.1 1.13 0 2.17-0.276 3.11-0.827v2.65zm6.35 0.683c-1.53 0-2.74-0.429-3.62-1.28-0.875-0.863-1.31-2.03-1.31-3.5 0-1.52 0.455-2.71 1.37-3.57 0.91-0.862 2.14-1.29 3.69-1.29 1.53 0 2.72 0.432 3.59 1.29 0.868 0.857 1.3 1.99 1.3 3.4 0 1.53-0.45 2.73-1.35 3.62-0.893 0.886-2.12 1.33-3.68 1.33zm0.072-7.48c-0.671 0-1.19 0.23-1.56 0.691-0.371 0.462-0.557 1.11-0.557 1.96 0 1.77 0.713 2.65 2.14 2.65 1.36 0 2.04-0.907 2.04-2.72 0-1.72-0.686-2.58-2.06-2.58zm15.7 7.25h-2.83v-5.11c0-1.43-0.509-2.14-1.53-2.14-0.492 0-0.896 0.188-1.21 0.566-0.318 0.377-0.477 0.856-0.477 1.44v5.25h-2.84v-9.2h2.84v1.46h0.036c0.677-1.12 1.66-1.68 2.96-1.68 2.04 0 3.06 1.26 3.06 3.79v5.63zm1.65-0.243v-2.3c0.467 0.282 0.931 0.492 1.39 0.629 0.467 0.138 0.907 0.207 1.32 0.207 0.503 0 0.899-0.069 1.19-0.207 0.294-0.137 0.441-0.347 0.441-0.629 0-0.179-0.066-0.329-0.198-0.449s-0.303-0.224-0.512-0.314c-0.204-0.09-0.429-0.171-0.674-0.243-0.246-0.072-0.482-0.153-0.71-0.242-0.365-0.138-0.689-0.285-0.97-0.441-0.276-0.161-0.509-0.347-0.701-0.557-0.186-0.209-0.329-0.452-0.431-0.727-0.096-0.276-0.144-0.602-0.144-0.98 0-0.515 0.111-0.958 0.332-1.33 0.228-0.372 0.528-0.674 0.899-0.908 0.377-0.239 0.806-0.413 1.28-0.521 0.485-0.114 0.988-0.171 1.51-0.171 0.407 0 0.821 0.033 1.24 0.099 0.419 0.06 0.832 0.15 1.24 0.27v2.19c-0.36-0.21-0.746-0.365-1.16-0.467-0.408-0.108-0.809-0.162-1.2-0.162-0.186 0-0.363 0.018-0.53 0.054-0.162 0.03-0.306 0.078-0.431 0.144-0.126 0.06-0.225 0.14-0.297 0.242-0.072 0.096-0.108 0.207-0.108 0.333 0 0.167 0.054 0.311 0.162 0.431s0.249 0.225 0.422 0.314c0.174 0.084 0.366 0.162 0.575 0.234 0.216 0.066 0.428 0.135 0.638 0.207 0.377 0.131 0.719 0.275 1.02 0.431 0.306 0.156 0.566 0.338 0.782 0.548 0.222 0.21 0.389 0.455 0.503 0.737 0.12 0.281 0.18 0.617 0.18 1.01 0 0.545-0.12 1.01-0.36 1.4-0.233 0.384-0.548 0.698-0.943 0.944-0.389 0.239-0.841 0.413-1.36 0.521-0.509 0.114-1.04 0.171-1.59 0.171-1.01 0-1.95-0.156-2.81-0.468zm14.3 0.135c-0.419 0.222-1.05 0.333-1.9 0.333-2 0-3-1.04-3-3.12v-4.21h-1.49v-2.09h1.49v-1.99l2.83-0.808v2.79h2.07v2.09h-2.07v3.72c0 0.958 0.38 1.44 1.14 1.44 0.299 0 0.608-0.086 0.925-0.26v2.1zm9.26 0.108h-2.69v-1.32h-0.036c-0.617 1.03-1.53 1.55-2.74 1.55-0.893 0-1.6-0.252-2.11-0.755-0.509-0.509-0.763-1.19-0.763-2.03 0-1.78 1.06-2.82 3.17-3.09l2.5-0.333c0-1.01-0.545-1.51-1.64-1.51-1.1 0-2.14 0.326-3.13 0.979v-2.14c0.395-0.204 0.934-0.383 1.62-0.539 0.689-0.156 1.32-0.234 1.88-0.234 2.62 0 3.94 1.31 3.94 3.93v5.5zm-2.67-3.74v-0.62l-1.67 0.215c-0.923 0.12-1.38 0.536-1.38 1.25 0 0.323 0.111 0.59 0.333 0.8 0.227 0.203 0.533 0.305 0.916 0.305 0.533 0 0.967-0.183 1.3-0.548 0.335-0.371 0.503-0.838 0.503-1.4zm13.8 3.74h-2.83v-5.11c0-1.43-0.509-2.14-1.53-2.14-0.491 0-0.895 0.188-1.21 0.566-0.317 0.377-0.476 0.856-0.476 1.44v5.25h-2.84v-9.2h2.84v1.46h0.036c0.677-1.12 1.66-1.68 2.96-1.68 2.04 0 3.06 1.26 3.06 3.79v5.63zm7.82-0.108c-0.419 0.222-1.05 0.333-1.9 0.333-2 0-3-1.04-3-3.12v-4.21h-1.49v-2.09h1.49v-1.99l2.83-0.808v2.79h2.07v2.09h-2.07v3.72c0 0.958 0.38 1.44 1.14 1.44 0.299 0 0.608-0.086 0.925-0.26v2.1z\" fill=\"#000\"/><path d=\"m491 338-4.44 12.9h-3.29l-4.38-12.9h3.13l2.69 8.97c0.144 0.485 0.23 0.913 0.26 1.28h0.054c0.042-0.402 0.135-0.842 0.279-1.32l2.67-8.93h3.04zm7.54 12.9h-2.69v-1.32h-0.036c-0.616 1.03-1.53 1.55-2.74 1.55-0.892 0-1.6-0.252-2.11-0.755-0.509-0.509-0.764-1.19-0.764-2.03 0-1.78 1.06-2.82 3.17-3.09l2.5-0.333c0-1.01-0.545-1.51-1.64-1.51-1.1 0-2.14 0.326-3.13 0.979v-2.14c0.395-0.204 0.934-0.383 1.62-0.539 0.689-0.156 1.32-0.234 1.88-0.234 2.62 0 3.94 1.31 3.94 3.93v5.5zm-2.67-3.74v-0.62l-1.67 0.215c-0.922 0.12-1.38 0.536-1.38 1.25 0 0.323 0.11 0.59 0.332 0.8 0.228 0.203 0.533 0.305 0.916 0.305 0.534 0 0.968-0.183 1.3-0.548 0.336-0.371 0.503-0.838 0.503-1.4zm10.9-2.9c-0.341-0.186-0.739-0.279-1.2-0.279-0.616 0-1.1 0.228-1.45 0.683-0.347 0.449-0.521 1.06-0.521 1.84v4.39h-2.84v-9.2h2.84v1.71h0.036c0.449-1.25 1.26-1.87 2.43-1.87 0.299 0 0.533 0.036 0.7 0.108v2.62zm2.84-4.02c-0.479 0-0.871-0.141-1.18-0.423-0.305-0.287-0.458-0.638-0.458-1.05 0-0.425 0.153-0.773 0.458-1.04 0.306-0.27 0.698-0.404 1.18-0.404 0.486 0 0.878 0.134 1.18 0.404 0.306 0.269 0.459 0.617 0.459 1.04 0 0.431-0.153 0.785-0.459 1.06-0.299 0.276-0.691 0.414-1.18 0.414zm1.4 10.7h-2.84v-9.2h2.84v9.2zm10 0h-2.69v-1.32h-0.036c-0.617 1.03-1.53 1.55-2.74 1.55-0.892 0-1.6-0.252-2.11-0.755-0.509-0.509-0.764-1.19-0.764-2.03 0-1.78 1.06-2.82 3.17-3.09l2.5-0.333c0-1.01-0.545-1.51-1.64-1.51-1.1 0-2.14 0.326-3.13 0.979v-2.14c0.396-0.204 0.935-0.383 1.62-0.539 0.688-0.156 1.31-0.234 1.88-0.234 2.62 0 3.94 1.31 3.94 3.93v5.5zm-2.67-3.74v-0.62l-1.67 0.215c-0.922 0.12-1.38 0.536-1.38 1.25 0 0.323 0.111 0.59 0.333 0.8 0.227 0.203 0.533 0.305 0.916 0.305 0.533 0 0.968-0.183 1.3-0.548 0.335-0.371 0.503-0.838 0.503-1.4zm7.79 2.67h-0.036v1.07h-2.84v-13.6h2.84v5.8h0.036c0.7-1.07 1.7-1.61 2.99-1.61 1.19 0 2.1 0.408 2.74 1.22 0.641 0.815 0.961 1.93 0.961 3.34 0 1.53-0.374 2.76-1.12 3.69s-1.75 1.39-3 1.39c-1.13 0-1.99-0.432-2.57-1.29zm-0.081-3.88v0.943c0 0.593 0.17 1.08 0.512 1.47 0.341 0.39 0.779 0.584 1.31 0.584 0.646 0 1.15-0.248 1.5-0.745 0.359-0.503 0.539-1.21 0.539-2.13 0-0.76-0.165-1.35-0.494-1.78-0.324-0.431-0.788-0.646-1.39-0.646-0.569 0-1.04 0.212-1.42 0.638-0.372 0.425-0.557 0.979-0.557 1.66zm11.5 4.95h-2.84v-13.6h2.84v13.6zm10.7-3.79h-6c0.096 1.34 0.937 2 2.52 2 1.01 0 1.9-0.239 2.67-0.719v2.05c-0.851 0.455-1.96 0.683-3.32 0.683-1.48 0-2.64-0.411-3.46-1.23-0.82-0.827-1.23-1.98-1.23-3.45 0-1.53 0.443-2.74 1.33-3.63 0.887-0.892 1.98-1.34 3.27-1.34 1.34 0 2.38 0.399 3.11 1.2 0.737 0.797 1.1 1.88 1.1 3.24v1.2zm-2.63-1.74c0-1.32-0.533-1.98-1.6-1.98-0.456 0-0.851 0.189-1.19 0.566-0.33 0.377-0.53 0.848-0.602 1.41h3.39z\" fill=\"#000\"/><g clip-rule=\"evenodd\" fill=\"#000\" fill-rule=\"evenodd\"><path d=\"m259 156h1.25v15.1h-1.25v-15.1z\"/><path d=\"m266 157c-0.372 0-0.684 0.11-0.936 0.332s-0.454 0.54-0.608 0.956-0.264 0.924-0.328 1.52c-0.064 0.598-0.098 1.27-0.098 2.02 0 1.76 0.164 3.05 0.49 3.88 0.328 0.824 0.834 1.24 1.52 1.24 0.654 0 1.14-0.386 1.46-1.16s0.474-1.98 0.474-3.6c0-1.24-0.082-2.25-0.244-3.02s-0.388-1.32-0.676-1.66c-0.29-0.334-0.64-0.502-1.05-0.502zm0.04-0.69c1.18 0 2.06 0.458 2.64 1.37 0.578 0.914 0.866 2.29 0.866 4.14 0 1.91-0.308 3.36-0.928 4.34-0.618 0.982-1.52 1.47-2.71 1.47-1.17 0-2.04-0.46-2.61-1.38s-0.856-2.31-0.856-4.18c0-0.994 0.088-1.85 0.264-2.58s0.42-1.32 0.738-1.8c0.316-0.472 0.694-0.822 1.14-1.05 0.442-0.228 0.926-0.342 1.45-0.342z\"/><path d=\"m273 156 3.23 7.28v0.598l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m156 45.5h1.25v15.1h-1.25v-15.1z\"/><path d=\"m164 45.9h0.446c-0.032 0.519-0.05 1.24-0.05 2.16v6.92c0 0.313 0.018 0.55 0.054 0.709 0.034 0.159 0.096 0.289 0.186 0.389s0.218 0.178 0.384 0.235c0.168 0.0568 0.38 0.1 0.634 0.13 0.254 0.0298 0.588 0.05 1 0.0608v0.592h-5.99v-0.592c0.6-0.027 1.03-0.0634 1.29-0.109 0.256-0.0458 0.452-0.115 0.586-0.207 0.136-0.0918 0.234-0.222 0.296-0.389 0.062-0.168 0.094-0.44 0.094-0.819v-6.57c0-0.216-0.038-0.374-0.114-0.474s-0.186-0.15-0.332-0.15c-0.172 0-0.418 0.0892-0.738 0.267-0.318 0.178-0.712 0.424-1.18 0.738l-0.356-0.624 3.79-2.26z\"/><path d=\"m170 44.8 3.23 7.28v0.6l-3.23 7.29-0.866-0.308 2.6-7.28-2.6-7.29 0.866-0.292z\"/><path d=\"m224 88.4h1.25v15.1h-1.25v-15.1z\"/><path d=\"m233 90h1.15v4.67h4.42v1.08h-4.42v4.67h-1.15v-4.67h-4.42v-1.08h4.42v-4.67z\"/><path d=\"m242 87.6 3.23 7.28v0.6l-3.23 7.29-0.866-0.308 2.6-7.28-2.6-7.29 0.866-0.292z\"/><path d=\"m224 222h1.25v15.1h-1.25v-15.1z\"/><path d=\"m229 228h9.99v1.08h-9.99v-1.08z\"/><path d=\"m242 221 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m149 265h9.99v1.08h-9.99v-1.08z\"/><path d=\"m162 259h1.25v15.1h-1.25v-15.1z\"/><path d=\"m171 259h0.446c-0.032 0.52-0.05 1.24-0.05 2.16v6.92c0 0.314 0.018 0.55 0.054 0.71 0.034 0.16 0.096 0.29 0.186 0.39s0.218 0.178 0.386 0.234c0.166 0.056 0.378 0.1 0.632 0.13s0.588 0.05 1 0.06v0.592h-5.99v-0.592c0.6-0.026 1.03-0.062 1.29-0.108 0.256-0.046 0.452-0.116 0.586-0.208 0.136-0.092 0.234-0.222 0.296-0.388 0.062-0.168 0.094-0.44 0.094-0.82v-6.57c0-0.216-0.038-0.374-0.114-0.474s-0.186-0.15-0.332-0.15c-0.172 0-0.418 0.088-0.738 0.266-0.318 0.178-0.712 0.424-1.18 0.738l-0.358-0.624 3.79-2.26z\"/><path d=\"m176 258 3.23 7.28v0.6l-3.23 7.29-0.866-0.308 2.6-7.28-2.6-7.29 0.866-0.292z\"/><path d=\"m44.7 163h9.99v1.08h-9.99v-1.08z\"/><path d=\"m57.9 156h1.25v15.1h-1.25v-15.1z\"/><path d=\"m65.7 157c-0.373 0-0.685 0.11-0.936 0.332s-0.454 0.54-0.608 0.956-0.264 0.924-0.328 1.52c-0.0648 0.598-0.0972 1.27-0.0972 2.02 0 1.76 0.163 3.05 0.49 3.88 0.327 0.824 0.833 1.24 1.52 1.24 0.654 0 1.14-0.386 1.45-1.16 0.316-0.776 0.474-1.98 0.474-3.6 0-1.24-0.081-2.25-0.243-3.02-0.162-0.77-0.388-1.32-0.677-1.66-0.289-0.334-0.639-0.502-1.05-0.502zm0.0406-0.69c1.18 0 2.06 0.458 2.64 1.37 0.578 0.914 0.867 2.29 0.867 4.14 0 1.91-0.309 3.36-0.928 4.34-0.619 0.982-1.52 1.47-2.71 1.47-1.17 0-2.04-0.46-2.61-1.38-0.57-0.918-0.855-2.31-0.855-4.18 0-0.994 0.0878-1.85 0.263-2.58s0.422-1.32 0.738-1.8c0.316-0.472 0.696-0.822 1.14-1.05 0.443-0.228 0.927-0.342 1.45-0.342z\"/><path d=\"m72 156 3.23 7.28v0.598l-3.23 7.29-0.867-0.308 2.6-7.28-2.6-7.29 0.867-0.292z\"/><path d=\"m74.1 228h9.99v1.08h-9.99v-1.08z\"/><path d=\"m87.3 221h1.25v15.1h-1.25v-15.1z\"/><path d=\"m96.2 223h1.15v4.67h4.42v1.08h-4.42v4.67h-1.15v-4.67h-4.42v-1.08h4.42v-4.67z\"/><path d=\"m105 220 3.23 7.28v0.598l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m73.4 94.2h9.99v1.08h-9.99v-1.08z\"/><path d=\"m86.6 87.9h1.25v15.1h-1.25v-15.1z\"/><path d=\"m91.1 94.2h9.99v1.08h-9.99v-1.08z\"/><path d=\"m104 87.2 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m608 156h1.25v15.1h-1.25v-15.1z\"/><path d=\"m616 157c-0.374 0-0.686 0.11-0.936 0.332-0.252 0.222-0.454 0.54-0.608 0.956s-0.264 0.924-0.328 1.52c-0.066 0.598-0.098 1.27-0.098 2.02 0 1.76 0.164 3.05 0.49 3.88 0.328 0.824 0.834 1.24 1.52 1.24 0.654 0 1.14-0.386 1.46-1.16s0.474-1.98 0.474-3.6c0-1.24-0.082-2.25-0.244-3.02s-0.388-1.32-0.676-1.66c-0.29-0.334-0.64-0.502-1.05-0.502zm0.04-0.69c1.18 0 2.06 0.458 2.64 1.37 0.578 0.914 0.868 2.29 0.868 4.14 0 1.91-0.31 3.36-0.928 4.34-0.618 0.982-1.52 1.47-2.71 1.47-1.17 0-2.04-0.46-2.61-1.38s-0.854-2.31-0.854-4.18c0-0.994 0.088-1.85 0.262-2.58 0.176-0.724 0.422-1.32 0.738-1.8 0.316-0.472 0.696-0.822 1.14-1.05 0.442-0.228 0.926-0.342 1.45-0.342z\"/><path d=\"m622 156 3.23 7.28v0.598l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m505 45.5h1.25v15.1h-1.25v-15.1z\"/><path d=\"m514 45.9h0.444c-0.032 0.519-0.048 1.24-0.048 2.16v6.92c0 0.313 0.018 0.55 0.054 0.709 0.034 0.159 0.096 0.289 0.186 0.389 0.088 0.1 0.216 0.178 0.384 0.235s0.378 0.1 0.632 0.13c0.254 0.0298 0.59 0.05 1.01 0.0608v0.592h-5.99v-0.592c0.6-0.027 1.03-0.0634 1.28-0.109 0.258-0.0458 0.454-0.115 0.588-0.207 0.136-0.0918 0.234-0.222 0.296-0.389 0.062-0.168 0.094-0.44 0.094-0.819v-6.57c0-0.216-0.038-0.374-0.114-0.474s-0.186-0.15-0.332-0.15c-0.174 0-0.42 0.0892-0.738 0.267-0.318 0.178-0.714 0.424-1.18 0.738l-0.356-0.624 3.79-2.26z\"/><path d=\"m519 44.8 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m574 88.4h1.25v15.1h-1.25v-15.1z\"/><path d=\"m583 90h1.15v4.67h4.42v1.08h-4.42v4.67h-1.15v-4.67h-4.42v-1.08h4.42v-4.67z\"/><path d=\"m591 87.6 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m574 222h1.25v15.1h-1.25v-15.1z\"/><path d=\"m578 228h9.99v1.08h-9.99v-1.08z\"/><path d=\"m591 221 3.23 7.28v0.6l-3.23 7.29-0.866-0.308 2.6-7.28-2.6-7.29 0.866-0.292z\"/><path d=\"m498 265h9.99v1.08h-9.99v-1.08z\"/><path d=\"m511 259h1.25v15.1h-1.25v-15.1z\"/><path d=\"m520 259h0.446c-0.034 0.52-0.05 1.24-0.05 2.16v6.92c0 0.314 0.018 0.55 0.054 0.71 0.034 0.16 0.096 0.29 0.186 0.39 0.088 0.1 0.216 0.178 0.384 0.234s0.378 0.1 0.632 0.13 0.59 0.05 1.01 0.06v0.592h-5.99v-0.592c0.6-0.026 1.03-0.062 1.28-0.108 0.258-0.046 0.454-0.116 0.588-0.208 0.136-0.092 0.234-0.222 0.296-0.388 0.062-0.168 0.094-0.44 0.094-0.82v-6.57c0-0.216-0.038-0.374-0.114-0.474s-0.186-0.15-0.332-0.15c-0.174 0-0.42 0.088-0.738 0.266s-0.714 0.424-1.18 0.738l-0.356-0.624 3.79-2.26z\"/><path d=\"m525 258 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m394 163h9.99v1.08h-9.99v-1.08z\"/><path d=\"m407 156h1.25v15.1h-1.25v-15.1z\"/><path d=\"m415 157c-0.374 0-0.686 0.11-0.936 0.332-0.252 0.222-0.454 0.54-0.608 0.956s-0.264 0.924-0.328 1.52c-0.066 0.598-0.098 1.27-0.098 2.02 0 1.76 0.164 3.05 0.49 3.88 0.328 0.824 0.834 1.24 1.52 1.24 0.654 0 1.14-0.386 1.45-1.16 0.318-0.776 0.476-1.98 0.476-3.6 0-1.24-0.082-2.25-0.244-3.02s-0.388-1.32-0.676-1.66c-0.29-0.334-0.64-0.502-1.05-0.502zm0.04-0.69c1.18 0 2.06 0.458 2.64 1.37 0.578 0.914 0.868 2.29 0.868 4.14 0 1.91-0.31 3.36-0.928 4.34-0.62 0.982-1.52 1.47-2.71 1.47-1.17 0-2.04-0.46-2.61-1.38s-0.854-2.31-0.854-4.18c0-0.994 0.088-1.85 0.262-2.58 0.176-0.724 0.422-1.32 0.738-1.8 0.316-0.472 0.696-0.822 1.14-1.05 0.442-0.228 0.926-0.342 1.45-0.342z\"/><path d=\"m421 156 3.23 7.28v0.598l-3.23 7.29-0.866-0.308 2.6-7.28-2.6-7.29 0.866-0.292z\"/><path d=\"m423 228h9.99v1.08h-9.99v-1.08z\"/><path d=\"m436 221h1.25v15.1h-1.25v-15.1z\"/><path d=\"m445 223h1.15v4.67h4.42v1.08h-4.42v4.67h-1.15v-4.67h-4.42v-1.08h4.42v-4.67z\"/><path d=\"m454 220 3.23 7.28v0.598l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/><path d=\"m423 94.2h9.99v1.08h-9.99v-1.08z\"/><path d=\"m436 87.9h1.25v15.1h-1.25v-15.1z\"/><path d=\"m440 94.2h9.99v1.08h-9.99v-1.08z\"/><path d=\"m453 87.2 3.23 7.28v0.6l-3.23 7.29-0.868-0.308 2.6-7.28-2.6-7.29 0.868-0.292z\"/></g></g><defs><clipPath id=\"clip0_6_812\"><rect transform=\"translate(.8 .6)\" width=\"677\" height=\"364\" fill=\"#fff\"/></clipPath></defs></svg>\n"
|
|
6614
6655
|
}
|
|
6615
6656
|
]
|
|
6616
6657
|
},
|
|
@@ -6632,7 +6673,7 @@ export default {
|
|
|
6632
6673
|
"items": [
|
|
6633
6674
|
{
|
|
6634
6675
|
"type": "text-content",
|
|
6635
|
-
"content": "\nFollow the algorithm as outlined in the previous section:\n\n1. Allocate a qubit - it starts in the $\\ket{0}$ state.\n2. Apply the $H$ gate to the qubit.\n3. Apply the oracle. The syntax for applying the oracle is the same as for applying any other gate or operation.\n4. Apply the $H$ gate to the qubit again.\n5. Measure the qubit: if the measurement result is `Zero`, the function is constant, otherwise it
|
|
6676
|
+
"content": "\nFollow the algorithm as outlined in the previous section:\n\n1. Allocate a qubit - it starts in the $\\ket{0}$ state.\n2. Apply the $H$ gate to the qubit.\n3. Apply the oracle. The syntax for applying the oracle is the same as for applying any other gate or operation.\n4. Apply the $H$ gate to the qubit again.\n5. Measure the qubit: if the measurement result is `Zero`, the function is constant, otherwise it's variable.\nSince you need to return `true` if the function is constant, you can just return the result of comparing the measurement result with `Zero`."
|
|
6636
6677
|
},
|
|
6637
6678
|
{
|
|
6638
6679
|
"type": "solution",
|
|
@@ -6665,7 +6706,7 @@ export default {
|
|
|
6665
6706
|
"items": [
|
|
6666
6707
|
{
|
|
6667
6708
|
"type": "text-content",
|
|
6668
|
-
"content": "\nCongratulations! In this kata you
|
|
6709
|
+
"content": "\nCongratulations! In this kata you learned Deutsch algorithm.\n\n- Deutsch algorithm is the smallest example of a quantum algorithm that allows to answer a question about a function in fewer queries than its classical counterpart: one query to a quantum oracle versus two queries to a classical function.\n- Quantum oracles don't allow you to evaluate the function on all inputs at once! Instead, Deutsch algorithm finds a clever way to aggregate information about both function values into a single bit that indicates whether they are equal or not.\n\nNext, you will learn about the more general case of this problem and the algorithm to solve it in the Deutsch-Jozsa Algorithm kata."
|
|
6669
6710
|
}
|
|
6670
6711
|
]
|
|
6671
6712
|
}
|
|
@@ -6683,7 +6724,7 @@ export default {
|
|
|
6683
6724
|
"items": [
|
|
6684
6725
|
{
|
|
6685
6726
|
"type": "text-content",
|
|
6686
|
-
"content": "\nThis kata introduces you to Deutsch-Jozsa algorithm - one of the most famous algorithms in quantum computing. The problem it solves has little practical value, but the algorithm itself is one of the earliest examples of a quantum algorithm that is exponentially faster than any possible deterministic algorithm for the same problem. It is also relatively simple to explain and illustrates several very important concepts (such as quantum oracles). As such, Deutsch–Jozsa algorithm is part of almost every introductory course on quantum computing.\n\n**This kata covers the following topics:**\n\n- The problem solved by Deutsch-Jozsa algorithm and the classical solution to it\n- Multi-qubit phase oracles (for a more detailed introduction to phase oracles, see Oracles kata)\n- Deutsch-Jozsa algorithm\n- Implementing oracles and end-to-end Deutsch-Jozsa algorithm in Q#\n- Bernstein-Vazirani algorithm and the problem solved by it\n\n**What you should know to start working on this kata:**\n\n- Basic single-qubit gates\n-
|
|
6727
|
+
"content": "\nThis kata introduces you to Deutsch-Jozsa algorithm - one of the most famous algorithms in quantum computing. The problem it solves has little practical value, but the algorithm itself is one of the earliest examples of a quantum algorithm that is exponentially faster than any possible deterministic algorithm for the same problem. It is also relatively simple to explain and illustrates several very important concepts (such as quantum oracles). As such, Deutsch–Jozsa algorithm is part of almost every introductory course on quantum computing.\n\n**This kata covers the following topics:**\n\n- The problem solved by Deutsch-Jozsa algorithm and the classical solution to it\n- Multi-qubit phase oracles (for a more detailed introduction to phase oracles, see Oracles kata)\n- Deutsch-Jozsa algorithm\n- Implementing oracles and end-to-end Deutsch-Jozsa algorithm in Q#\n- Bernstein-Vazirani algorithm and the problem solved by it\n\n**What you should know to start working on this kata:**\n\n- Basic knowledge of single-qubit gates\n- Basic knowledge of quantum measurements\n- Deutsch algorithm - the single-qubit variant of Deutsch-Jozsa algorithm. If you're not familiar with it, you can find it in the Deutsch algorithm kata."
|
|
6687
6728
|
}
|
|
6688
6729
|
]
|
|
6689
6730
|
},
|
|
@@ -6694,7 +6735,7 @@ export default {
|
|
|
6694
6735
|
"items": [
|
|
6695
6736
|
{
|
|
6696
6737
|
"type": "text-content",
|
|
6697
|
-
"content": "\nYou are given a classical function that takes an $N$-bit string as an input and returns one bit: $f(x): \\{0, 1\\}^N \\to \\{0, 1\\}$. You are guaranteed that the function $f$ is\n\n- either *constant* (returns the same value for all inputs) \n- or *balanced* (returns value $0$ for half of the inputs and $1$ for the other half of the inputs). \n\nThe task is to figure out whether the function is constant or balanced.\n\n**Examples**\n\n- $f(x) \\equiv 0$ or $f(x) \\equiv 1$ are constant functions (and they
|
|
6738
|
+
"content": "\nYou are given a classical function that takes an $N$-bit string as an input and returns one bit: $f(x): \\{0, 1\\}^N \\to \\{0, 1\\}$. You are guaranteed that the function $f$ is\n\n- either *constant* (returns the same value for all inputs) \n- or *balanced* (returns value $0$ for half of the inputs and $1$ for the other half of the inputs). \n\nThe task is to figure out whether the function is constant or balanced.\n\n**Examples**\n\n- $f(x) \\equiv 0$ or $f(x) \\equiv 1$ are constant functions (and they're actually the only constant functions in existence).\n- $f(x) = x \\bmod 2$ (the least significant bit of $x$) or $f(x) = 1 \\text{ if the binary notation of }x \\text{ has odd number of 1s and 0 otherwise}$ are examples of multi-bit balanced functions. Indeed, for both these functions you can check that for every possible input $x$ for which $f(x) = 0$ there exists an input $x^\\prime$ (equal to $x$ with the least significant bit flipped) such that $f(x^\\prime) = 1$, and vice versa, which means that the function is balanced.\n\nIf you solve this problem classically, how many calls to the given function will you need? \n\nThe first call will give you no information - regardless of whether it returns $0$ or $1$, the function could still be constant or balanced.\nIn the best case scenario, the second call will return a different value. You'll be able to conclude that the function is balanced in just $2$ calls. \nHowever, if you get the same value for the first two calls, you'll have to keep querying the function until either the function returns a different value, or until you perform $2^{N-1}+1$ queries that return the same value - only in this case will you know with certainty that the function is constant.\n\nWhat about the quantum scenario?"
|
|
6698
6739
|
}
|
|
6699
6740
|
]
|
|
6700
6741
|
},
|
|
@@ -6705,7 +6746,7 @@ export default {
|
|
|
6705
6746
|
"items": [
|
|
6706
6747
|
{
|
|
6707
6748
|
"type": "text-content",
|
|
6708
|
-
"content": "\nIn the quantum scenario, the classical function
|
|
6749
|
+
"content": "\nIn the quantum scenario, the classical function you're working with is implemented as a quantum oracle - a \"black box\" operation used as input to another algorithm. This operation is implemented in a way which allows you to perform calculations not only on individual inputs, but also on superpositions of inputs. \n\nTo enable the oracle to act on quantum states instead of classical values, the integer input $x$ is represented in binary $x = (x_{0}, x_{1}, \\dots, x_{N-1})$, \nand encoded into an $N$-qubit register: $\\ket{\\vec{x} } = \\ket{x_{0} } \\otimes \\ket{x_{1} } \\otimes \\cdots \\otimes \\ket{x_{N-1} }$.\nThe phase oracle $U_f$ for this function is defined as follows:\n\n$$U_f \\ket{\\vec{x} } = (-1)^{f(x)} \\ket{\\vec{x} }$$\n\nThe function $f$ can return only two values, 0 or 1, which result in no phase change or multiplication by a relative phase $-1$, respectively.\n\nThe effect of such an oracle on any single basis state isn't particularly interesting: it just adds a global phase which isn't something you can observe. However, if you apply this oracle to a *superposition* of basis states, its effect becomes noticeable. \nRemember that quantum operations are linear: if you define the effect of an operation on the basis states, you'll be able to deduce its effect on superposition states (which are just linear combinations of the basis states) using its linearity.\n\nLet's see how to implement several examples of multi-bit constant and balanced functions as phase oracles in Q#.\n\n1. $f(x) \\equiv 0$\n\nThis is the easiest function to implement: if $f(x) \\equiv 0$, \n\n$$U_f \\ket{x} \\equiv (-1)^0 \\ket{x} = \\ket{x}$$\n\nThis means that $U_f$ is an identity - a transformation which does absolutely nothing! \n\n2. $f(x) \\equiv 1$\n\nThe second constant function is slightly trickier: if $f(x) \\equiv 1$\n\n$$U_f \\ket{x} \\equiv (-1)^1 \\ket{x} = - \\ket{x}$$\n\nNow $U_f$ is a negative identity, that is, a transformation which applies a global phase of $-1$ to the state. \nA lot of algorithms just ignore the global phase accumulated in them, since it isn't observable. \nHowever, if you want to be meticulous, you can use the $R$ gate which performs a given rotation around the given axis. \nWhen called with `PauliI` axis, this operation applies a global phase to the given qubit. \nYou can use any qubit to apply this gate, for example, `qs[0]`.\n\n3. $f(x) = x \\bmod 2$\n\nThe binary representation of $x$ is $x = (x_{0}, x_{1}, \\dots, x_{N-1})$, with the least significant bit encoded in the last bit (stored in the last qubit of the input array). Then you can rewrite the function as\n\n$$f(x) = x_{N-1}$$\n\nLet's use this in the oracle effect expression:\n\n$$U_f \\ket{x} = (-1)^{f(x)} \\ket{x} = (-1)^{x_{N-1}} \\ket{x} = \\ket{x_{0} } \\otimes \\cdots \\otimes \\ket{x_{N-2} } \\otimes (-1)^{x_{N-1}} \\ket{x_{N-1}}$$\n\nThis means that you only need to use the last qubit in the implementation: do nothing if it's $\\ket{0}$ and apply a phase of $-1$ if it's $\\ket{1}$. This is exactly the effect of the $Z$ gate!\n\nYou can write out the oracle unitary as follows:\n\n$$U_f = \\mathbb{1} \\otimes \\cdots \\otimes \\mathbb{1} \\otimes Z$$\n\nIn the following demo you'll see how to implement three multi-bit functions as quantum oracles, and their effect on a quantum state.\nAfter that, you'll try to implement the oracles for two more functions on your own!"
|
|
6709
6750
|
},
|
|
6710
6751
|
{
|
|
6711
6752
|
"type": "example",
|
|
@@ -6732,7 +6773,7 @@ export default {
|
|
|
6732
6773
|
"items": [
|
|
6733
6774
|
{
|
|
6734
6775
|
"type": "text-content",
|
|
6735
|
-
"content": "\nThe binary representation of $x$ is $x = (x_{0}, x_{1}, \\dots, x_{N-1})$, with the most significant bit encoded in the first bit (stored in the first qubit of the input array). Then
|
|
6776
|
+
"content": "\nThe binary representation of $x$ is $x = (x_{0}, x_{1}, \\dots, x_{N-1})$, with the most significant bit encoded in the first bit (stored in the first qubit of the input array). Then, you can rewrite the function as\n\n$$f(x) = x_0$$\n\nand its effect on the quantum state as \n\n$$U_f \\ket{x} = (-1)^{f(x)} \\ket{x} = (-1)^{x_0} \\ket{x} = (-1)^{x_0} \\ket{x_{0} } \\otimes \\ket{x_1} \\otimes \\cdots \\otimes \\ket{x_{N-1}}$$\n\nAs you've seen in the previous exercise, this can be achieved by applying a $Z$ gate to the first qubit."
|
|
6736
6777
|
},
|
|
6737
6778
|
{
|
|
6738
6779
|
"type": "solution",
|
|
@@ -6760,7 +6801,7 @@ export default {
|
|
|
6760
6801
|
"items": [
|
|
6761
6802
|
{
|
|
6762
6803
|
"type": "text-content",
|
|
6763
|
-
"content": "\nIn this oracle the answer depends on all bits of the input.
|
|
6804
|
+
"content": "\nIn this oracle the answer depends on all bits of the input. You can write $f(x)$ as follows (here $\\bigoplus$ denotes sum modulo $2$):\n\n$$f(x) = \\bigoplus_{k=0}^{N-1} x_k$$ \n\nLet's substitute this expression in the expression for the oracle effect on the quantum state:\n\n$$U_f \\ket{x} = (-1)^{f(x)} \\ket{x} = (-1)^{\\bigoplus_{k=0}^{N-1} x_k} \\ket{x}$$\n\nSince $(-1)^2 = 1$, you can replace sum modulo $2$ with a regular sum in the exponent. Then you'll be able to rewrite it as a product of individual exponents for each bit:\n\n$$U_f \\ket{x} = (-1)^{\\sum_{k=0}^{N-1} x_k} \\ket{x} = \\prod_{k=0}^{N-1} {(-1)^{x_k}} \\ket{x}$$\n\nNow let's spell out the system state as a tensor product of individual qubit states:\n\n$$U_f \\ket{x} = \\prod_{k=0}^{N-1} {(-1)^{x_k}} \\cdot \\ket{x_{0} } \\otimes \\cdots \\otimes \\ket{x_{N-1}}$$\n\nTensor product is a linear operation, so you can bring each $(-1)^{x_k}$ scalar factor in next to the corresponding $\\ket{x_k}$:\n\n$$U_f \\ket{x} = (-1)^{x_0} \\ket{x_{k}} \\otimes \\dots \\otimes (-1)^{x_{N-1}} \\ket{x_{N-1}} = \\bigotimes_{k=0}^{N-1} (-1)^{x_k} \\ket{x_{k}}$$\n\nAs you've seen in the previous oracle, this can be achieved by applying a $Z$ gate to each qubit."
|
|
6764
6805
|
},
|
|
6765
6806
|
{
|
|
6766
6807
|
"type": "solution",
|
|
@@ -6777,7 +6818,7 @@ export default {
|
|
|
6777
6818
|
"items": [
|
|
6778
6819
|
{
|
|
6779
6820
|
"type": "text-content",
|
|
6780
|
-
"content": "\nNow let's return to the problem of figuring out whether the given function is constant or balanced.\
|
|
6821
|
+
"content": "\nNow let's return to the problem of figuring out whether the given function is constant or balanced.\nThe following sections present the algorithm in detail step-by-step.\n\n### Inputs\n\nYou are given the number of bits in the oracle input $N$ and the oracle itself - a \"black box\" operation $U_f$ that implements a classical function $f(x)$. You are guaranteed that the function implemented by the oracle is either constant or balanced.\n\n### The starting state\n\nThe algorithm starts with $N$ qubits in the $\\ket{0...0} = \\ket{0}^{\\otimes N}$ state.\n\n### Step 1. Apply Hadamard transform to each qubit\n\nApplying the $H$ gate to one qubit in the $\\ket{0}$ state converts it to the $\\frac{1}{\\sqrt2} \\big(\\ket{0} + \\ket{1} \\big)$ state, which is an equal superposition of both basis states on one qubit. \n\nIf you apply the $H$ gate to each of the two qubits in the $\\ket{00}$ state, you get \n\n$$(H \\otimes H) \\ket{00} = \\big(H \\ket{0} \\big) \\otimes \\big(H \\ket{0}\\big) = \\left(\\frac{1}{\\sqrt2} \\big(\\ket{0} + \\ket{1} \\big)\\right) \\otimes \\left(\\frac{1}{\\sqrt2} \\big(\\ket{0} + \\ket{1} \\big)\\right) = \\frac{1}{2} \\big(\\ket{00} + \\ket{01} + \\ket{10} + \\ket{11} \\big)$$\n\nThis is just an equal superposition of all basis states on two qubits! \nYou can extend the same thinking to applying the $H$ gate to each of the $N$ qubits in the $\\ket{0...0}$ state to conclude that this transforms them into a state that is an equal superposition of all basis states on $N$ qubits.\n\nMathematically, the transformation \"apply $H$ gate to each of the $N$ qubits\" can be denoted as $H^{\\otimes N}$. After applying this transformation, you get the following state:\n\n$$H^{\\otimes N} \\ket{0}^{\\otimes N} = \\big( H\\ket{0} \\big)^{\\otimes N} = \\left( \\frac{1}{\\sqrt2} \\big(\\ket{0} + \\ket{1} \\big) \\right)^{\\otimes N} = \\frac{1}{\\sqrt{2^N}} \\sum_{x=0}^{2^N-1} \\ket{x}$$\n\n\n### Step 2. Apply the oracle\n\nThis step is the only step in which you use the knowledge of the classical function, given as the quantum oracle. \nThis step keep the amplitudes of the basis states for which $f(x) = 0$ unchanged, and multiply the amplitudes of the basis states for which $f(x) = 1$ by $-1$.\n\nMathematically, the results of oracle application can be written as follows:\n\n$$U_f \\left(\\frac{1}{\\sqrt{2^N}} \\sum_{x=0}^{2^N-1} \\ket{x} \\right) = \\frac{1}{\\sqrt{2^N}} \\sum_{x=0}^{2^N-1} U_f\\ket{x} = \\frac{1}{\\sqrt{2^N}} \\sum_{x=0}^{2^N-1} (-1)^{f(x)} \\ket{x}$$\n\n### Step 3. Apply Hadamard transform to each qubit again\n\nIn this step, you don't need to worry about the whole expression for the state of the qubits after applying the $H$ gates to them; it's enough to calculate only the resulting amplitude of the basis state $\\ket{0}^{\\otimes N}$.\n\nConsider one of the basis states $\\ket{x}$ in the expression $\\sum_{x=0}^{2^N-1} (-1)^{f(x)} \\ket{x}$. \nIt can be written as $\\ket{x} = \\ket{x_{0} } \\otimes \\cdots \\otimes \\ket{x_{N-1}}$, where each $\\ket{x_k}$ is either $\\ket{0}$ or $\\ket{1}$. \nWhen you apply the $H$ gates to $\\ket{x}$, we'll get $H^{\\otimes N} \\ket{x} = H\\ket{x_{0} } \\otimes \\cdots \\otimes H\\ket{x_{N-1}}$, where each term of the tensor product is either $H\\ket{0} = \\frac{1}{\\sqrt2}\\big(\\ket{0} + \\ket{1} \\big) = \\ket{+}$ or $H\\ket{1} = \\frac{1}{\\sqrt2}\\big(\\ket{0} - \\ket{1} \\big) = \\ket{-}$. \nIf you open the brackets in this tensor product, you get a superposition of all $N$-qubit basis states, each of them with amplitude $\\frac{1}{\\sqrt{2^N}}$ or $-\\frac{1}{\\sqrt{2^N}}$ — and, since the amplitude of the $\\ket{0}$ state in both $\\ket{+}$ and $\\ket{-}$ is positive, you know that the amplitude of the basis state $\\ket{0}^{\\otimes N}$ ends up positive, that is, $\\frac{1}{\\sqrt{2^N}}$.\n\nNow you can calculate the amplitude of the $\\ket{0}^{\\otimes N}$ state in the expression $H^{\\otimes N} \\left( \\frac{1}{\\sqrt{2^N}} \\sum_{x=0}^{2^N-1} (-1)^{f(x)} \\ket{x} \\right)$: in each of the $2^N$ terms of the sum its amplitude is $\\frac{1}{\\sqrt{2^N}}$. Therefore, you get the total amplitude\n\n$$\\frac{1}{\\sqrt{2^N}} \\sum_{x=0}^{2^N-1} (-1)^{f(x)} \\frac{1}{\\sqrt{2^N}} = \\frac{1}{2^N} \\sum_{x=0}^{2^N-1} (-1)^{f(x)}$$\n\n### Step 4. Perform measurements and interpret the result\n\nSo far, you didn't use the fact that the function you are given is constant or balanced. Let's see how this affects the amplitude of the $\\ket{0}^{\\otimes N}$ state.\n\n* If the function is constant, $f(x) = C$ (either always $0$ or always $1$), you get \n $$\\frac{1}{2^N} \\sum_{x=0}^{2^N-1} (-1)^{f(x)} = \\frac{1}{2^N} \\sum_{x=0}^{2^N-1} (-1)^{C} = \\frac{1}{2^N} \\cdot 2^N (-1)^C = (-1)^C$$\n Since the sum of squares of amplitudes of all basis states always equals $1$, the amplitudes of the rest of the basis states have to be 0 - this means that the state of the qubits after step 3 *is* $\\ket{0}^{\\otimes N}$.\n\n* If the function is balanced, that is, returns $0$ for exactly half of the inputs and $1$ for the other half of the inputs, exactly half of the terms in the sum $\\frac{1}{2^N} \\sum_{x=0}^{2^N-1} (-1)^{f(x)}$ will be $1$ and the other half of the terms will be $-1$, and they will all cancel out, leaving the amplitude of $\\ket{0}^{\\otimes N}$ equal to $0$.\n\nNow, what happens when you measure all qubits? (Remember that the probability of getting a certain state as a result of measurement equals to the square of the amplitude of this state.)\n\nIf the function is constant, the only measurement result you can get is all zeros - the probability of getting any other result is $0$. If the function is balanced, the probability of getting all zeros is $0$, so you'll get any measurement result except this.\n\nThis is exactly the last step of the algorithm: **measure all qubits, if all measurement results are 0, the function is constant, otherwise it's balanced**.\n\n### Summary\n\nIn the end, the algorithm is very straightforward:\n\n1. Apply the $H$ gate to each qubit.\n2. Apply the oracle.\n3. Apply the $H$ gate to each qubit again.\n4. Measure all qubits.\n5. If all qubits are measured in $\\ket{0}$ state, the function is constant, otherwise it's balanced.\n\nNote that this algorithm requires only $1$ oracle call, and always produces the correct result!"
|
|
6781
6822
|
}
|
|
6782
6823
|
]
|
|
6783
6824
|
},
|
|
@@ -6799,7 +6840,7 @@ export default {
|
|
|
6799
6840
|
"items": [
|
|
6800
6841
|
{
|
|
6801
6842
|
"type": "text-content",
|
|
6802
|
-
"content": "\nFollow the algorithm as outlined in the previous section:\n\n1. Allocate $N$ qubits - they start in the $\\ket{0}$ state.\n2. Apply the $H$ gate to each qubit. You can use `ApplyToEach` operation for this, or a `for` loop.\n3. Apply the oracle. The syntax for applying the oracle is the same as for applying any other gate or operation.\n4. Apply the $H$ gate to each qubit again.\n5. Measure each of the qubits. If any of the measurement results is `One`, the function is balanced.\
|
|
6843
|
+
"content": "\nFollow the algorithm as outlined in the previous section:\n\n1. Allocate $N$ qubits - they start in the $\\ket{0}$ state.\n2. Apply the $H$ gate to each qubit. You can use `ApplyToEach` operation for this, or a `for` loop.\n3. Apply the oracle. The syntax for applying the oracle is the same as for applying any other gate or operation.\n4. Apply the $H$ gate to each qubit again.\n5. Measure each of the qubits. If any of the measurement results is `One`, the function is balanced.\nYou can't return `false` as soon as you encounter a `One` result, though, since you need to return all qubits to $\\ket{0}$ state first.\nInstead, you update the mutable variable that stores your result and continue through the rest of the loop."
|
|
6803
6844
|
},
|
|
6804
6845
|
{
|
|
6805
6846
|
"type": "solution",
|
|
@@ -6832,7 +6873,7 @@ export default {
|
|
|
6832
6873
|
"items": [
|
|
6833
6874
|
{
|
|
6834
6875
|
"type": "text-content",
|
|
6835
|
-
"content": "\nTo wrap up our discussion in this kata, let's take a look at a problem solved using a similar approach - the Bernstein-Vazirani algorithm.\nIn this problem, you are also given an oracle implementing an $N$-bit function $f(x): \\{0, 1\\}^N \\to \\{0, 1\\}$.\nHowever, this time the function is guaranteed to be a *scalar product function*, that is, there exists an $N$-bit string $s$\nthat allows the following representation ($\\cdot$ is bitwise inner product of integers modulo $2$):\n\n$$f(x) = x \\cdot s = \\sum_{k=0}^{N-1} x_k s_k \\bmod 2$$\n\nThe task is to recover the hidden bit string $s$.\n\n**Examples**\n\n- $f(x) \\equiv 0$ is an example of such a function with $s = 0, \\dots, 0$.\n- $f(x) = 1 \\text{ if x has odd number of 1s, and } 0 \\text{ otherwise }$ is another example of such a function, with $s = 1, \\dots, 1$.\n\nIf
|
|
6876
|
+
"content": "\nTo wrap up our discussion in this kata, let's take a look at a problem solved using a similar approach - the Bernstein-Vazirani algorithm.\nIn this problem, you are also given an oracle implementing an $N$-bit function $f(x): \\{0, 1\\}^N \\to \\{0, 1\\}$.\nHowever, this time the function is guaranteed to be a *scalar product function*, that is, there exists an $N$-bit string $s$\nthat allows the following representation ($\\cdot$ is bitwise inner product of integers modulo $2$):\n\n$$f(x) = x \\cdot s = \\sum_{k=0}^{N-1} x_k s_k \\bmod 2$$\n\nThe task is to recover the hidden bit string $s$.\n\n**Examples**\n\n- $f(x) \\equiv 0$ is an example of such a function with $s = 0, \\dots, 0$.\n- $f(x) = 1 \\text{ if x has odd number of 1s, and } 0 \\text{ otherwise }$ is another example of such a function, with $s = 1, \\dots, 1$.\n\nIf you solve this problem classically, how many calls to the given function will you need? \nYou'd need to use one query to recover each bit of $s$ (the query for $k$-th bit can be a bit string with $1$ in the $k$-th bit and zeros in all other positions), for a total of $N$ queries.\n\nWhat about the quantum scenario?\nIt turns out that the algorithm that allows you to solve this problem looks just like Deutsch-Jozsa algorithm, \nexcept for the way you interpret the measurement results on the last step. To see this, you'll need to take another look \nat the math involved in applying Hadamard gates to multiple qubits.\n\n### Apply Hadamard transform to each qubit: a different view\n\nWhen you apply an $H$ gate to a single qubit in the basis state $\\ket{x}$, you can write the result as the following sum:\n\n$$H\\ket{x} = \\frac1{\\sqrt2} (\\ket{0} + (-1)^{x} \\ket{1}) = \\frac1{\\sqrt2} \\sum_{z \\in {0, 1}} (-1)^{x \\cdot z} \\ket{z}$$\n\nIf you use this representation to spell out the result of applying an $H$ gate to each qubit of an $N$-qubit basis state \n$\\ket{x} = \\ket{x_0}\\ket{x_1} \\dots \\ket{x_{N-1}}$, you get:\n\n$$H\\ket{x} = \\frac1{\\sqrt{2^N}} \\sum_{z_k \\in {0, 1}} (-1)^{x_0z_0 + \\dots + x_{N-1}z_{N-1}} \\ket{z_0}\\ket{z_1} \\dots \\ket{z_{N-1}} =$$\n\n$$= \\frac1{\\sqrt{2^N}} \\sum_{z = 0}^{2^N-1} (-1)^{x \\cdot z} \\ket{z}$$\n\nWith this in mind, let's revisit the algorithm and see how you can write the exact quantum state after it.\n\n### Bernstein-Vazirani algorithm\n\nBernstein-Vazirani algorithm follows the same outline as Deutsch-Jozsa algorithm:\n\n1. Apply the $H$ gate to each qubit.\n2. Apply the oracle.\n3. Apply the $H$ gate to each qubit again.\n4. Measure all qubits.\n\nYou know that after the second step the qubits end up in the following state:\n\n$$\\frac{1}{\\sqrt{2^N}} \\sum_{x=0}^{2^N-1} (-1)^{f(x)} \\ket{x}$$\n\nNow, once you apply the Hadamard gates to each qubit, the system state becomes:\n\n$$\\frac{1}{\\sqrt{2^N}} \\sum_{x=0}^{2^N-1} \\sum_{z=0}^{2^N-1} (-1)^{f(x) + x \\cdot z} \\ket{z}$$\n\n> In Deutsch-Jozsa algorithm, you looked at the amplitude of the $\\ket{0}$ state in this expression, which was \n> $\\frac{1}{\\sqrt{2^N}} \\sum_{x=0}^{2^N-1} (-1)^{f(x)}$.\n\nNow, let's take a look at the amplitude of the $\\ket{s}$ state - the state that encodes the hidden bit string you're looking for.\nThis amplitude is \n\n$$\\frac{1}{\\sqrt{2^N}} \\sum_{x=0}^{2^N-1} (-1)^{f(x) + x \\cdot s}$$\n\nSince $f(x) = x \\cdot s$, for all values of $x$ $f(x) + x \\cdot s = 2 x \\cdot s$, and $(-1)^{f(x) + x \\cdot s} = 1$.\nOverall the amplitude of $\\ket{s}$ is \n\n$$\\frac{1}{\\sqrt{2^N}} \\sum_{x=0}^{2^N-1} 1 = \\frac{1}{\\sqrt{2^N}} 2^N = 1$$\n\nThis means that the state after applying the Hadamard gates is just $\\ket{s}$, and measuring it gives you the bit string $s$!\nAnd, same as Deutsch-Jozsa algorithm, Bernstein-Vazirani algorithm takes only one oracle call."
|
|
6836
6877
|
}
|
|
6837
6878
|
]
|
|
6838
6879
|
},
|
|
@@ -6871,7 +6912,442 @@ export default {
|
|
|
6871
6912
|
"items": [
|
|
6872
6913
|
{
|
|
6873
6914
|
"type": "text-content",
|
|
6874
|
-
"content": "\nCongratulations! In this kata you
|
|
6915
|
+
"content": "\nCongratulations! In this kata you learned Deutsch-Jozsa and Bernstein-Vazirani algorithms.\n\n- Deutsch-Jozsa algorithm is the simplest example of a quantum algorithm that is exponentially faster than any possible deterministic algorithm for the same problem.\n- Bernstein-Vazirani algorithm is a similar algorithm that extracts information about the hidden bit string of the given function that is known to be a scalar product function. It offers a linear speedup compared to a classical algorithm for the same problem.\n- Quantum oracles don't allow you to evaluate the function on all inputs at once! Instead, Deutsch-Jozsa algorithm finds a clever way to aggregate information about all function values into a few bits that indicate whether they are all the same or not. Bernstein-Vazirani algorithm uses a similar approach to encode the information about the hidden bit string into the state of the qubits at the end of the algorithm."
|
|
6916
|
+
}
|
|
6917
|
+
]
|
|
6918
|
+
}
|
|
6919
|
+
],
|
|
6920
|
+
"published": true
|
|
6921
|
+
},
|
|
6922
|
+
{
|
|
6923
|
+
"id": "grovers_search",
|
|
6924
|
+
"title": "Grover's Search Algorithm",
|
|
6925
|
+
"sections": [
|
|
6926
|
+
{
|
|
6927
|
+
"type": "lesson",
|
|
6928
|
+
"id": "grovers_search__overview",
|
|
6929
|
+
"title": "Overview",
|
|
6930
|
+
"items": [
|
|
6931
|
+
{
|
|
6932
|
+
"type": "text-content",
|
|
6933
|
+
"content": "\nThis kata introduces you to Grover's search algorithm - one of the fundamental algorithms in quantum computing.\n\n**This kata covers the following topics:**\n\n- The general problem solved by Grover's search algorithm - the search problem\n- Implementing Grover's algorithm in Q# for a problem provided as a quantum oracle\n- Some of the practical aspects of this algorithm\n\nNote that this tutorial does not cover implementing specific classical functions as quantum oracles in detail. To get familiar with that topic, check out the earlier Oracles and Marking Oracles katas.\n\n**What you should know to start working on this kata:**\n\n- Basic knowledge of quantum gates and measurements\n- Basic understanding of quantum oracles"
|
|
6934
|
+
}
|
|
6935
|
+
]
|
|
6936
|
+
},
|
|
6937
|
+
{
|
|
6938
|
+
"type": "lesson",
|
|
6939
|
+
"id": "grovers_search__search_problem",
|
|
6940
|
+
"title": "The Search Problem",
|
|
6941
|
+
"items": [
|
|
6942
|
+
{
|
|
6943
|
+
"type": "text-content",
|
|
6944
|
+
"content": "\nThe problem solved by Grover's search algorithm is called the *search problem* and can be formulated as follows.\nYou are given a classical function that takes an $n$-bit input and returns a one-bit output $f(x): \\{0, 1\\}^n \\to \\{0, 1\\}$. \nThe task is to find an input $x_0$ for which $f(x_0) = 1$.\n\nImportantly, you don't have any information about the internal structure of the function $f$! It is given to you as a \"black box\" that allows you to evaluate the value of the function for any input you want, but not to learn anything about how it works.\n\n> This problem is sometimes described as *function inversion*, since it tries to evaluate the inverse of the function $f$.\n\n### Classical solution\n\nIf you solve the search problem classically, how many calls to the given function will you need? \n\nSince you don't know anything about the internal structure of the function, you can't do better than the brute force approach. \nYou need to try evaluating the function on different inputs until you either hit the input which produces the desired output or run out of inputs to try and conclude that the desired input doesn't exist. \nThis requires $O(2^n)$ function evaluations, since in the worst case scenario you'll need to try all inputs.\n\n### Example problems\n\nAny problem that allows you to check whether a given value of $x$ is a solution to it can be formulated as a search problem,\nif you define $f(x)$ as \"$1$ if $x$ is a solution to the problem, and $0$ otherwise\".\n\nSome of the problems can be formulated as a search problem more naturally than the others.\nFor example:\n\n- The Boolean satisfiability problem aims to find an assignment of variables in the given Boolean formula \nfor which the formula evaluates to true (or to decide that such assignment doesn't exist). \nThis is exactly the definition of the search problem, with the input $x$ defined as the set of variables used in the formula and $f(x)$ - as the formula itself.\n- Vertex coloring problem aims to find an assignment of colors to the vertices of a given graph that would satisfy the given constraints. In this case, $x$ describes the colors assigned to the vertices, and $f(x)$ is $1$ if the constraints are satisfied or $0$ otherwise.\n\nYou will learn more about appliyng Grover's search to solving specific problems in later katas.\nThis kata focuses on Grover's search algorithm itself rather than on applying it to a specific problem, so \nit uses a very simple function definition as an example.\n\nLet's define a fixed bit string $p$ of length $P$. The function $f(x)$ is $1$ if the bit string $x$ starts with $p$, and $0$ otherwise.\n\nThis function has a very simple implementation and will allow you to experiment with instances of the search problem with different parameters easily.\nFor example, if the length of the bit string $p$ equals the length of the input, the function $f(x) = 1$ if $x = p$, and $0$ otherwise. In this case, the equation $f(x) = 1$ has exactly one solution, the bit string $p$ itself."
|
|
6945
|
+
}
|
|
6946
|
+
]
|
|
6947
|
+
},
|
|
6948
|
+
{
|
|
6949
|
+
"type": "exercise",
|
|
6950
|
+
"id": "grovers_search__prefix_oracle",
|
|
6951
|
+
"title": "Marking Oracle for Prefix Function",
|
|
6952
|
+
"description": {
|
|
6953
|
+
"type": "text-content",
|
|
6954
|
+
"content": "**Inputs:** \n\n1. $N$ qubits in an arbitrary state $\\ket{x}$ (input/query register).\n2. A qubit in an arbitrary state $\\ket{y}$ (output/target qubit).\n3. A bit pattern $p$ of length $P$ represented as a `Bool[]` ($1 ≤ P ≤ N$).\n\n**Goal:** \nImplement a marking oracle which flips the state of $\\ket{y}$ if the pattern $p$ is the prefix of the input register $\\ket{x}$, that is, for all $j$ between $0$ and $P - 1$, inclusive, $p_j = x_j$. (`false` and `true` values represent states $\\ket{0}$ and $\\ket{1}$, respectively).\n\nFor example, for $N = 3$ two bit strings start with the prefix `[true, false]`: `[true, false, false]` and `[true, false, true]`.\n\nLeave the qubits in the input register in the same state they started in.\nYour solution should work on inputs in superposition, and not use any measurements."
|
|
6955
|
+
},
|
|
6956
|
+
"sourceIds": [
|
|
6957
|
+
"grovers_search__prefix_oracle__Verification.qs",
|
|
6958
|
+
"KatasLibrary.qs"
|
|
6959
|
+
],
|
|
6960
|
+
"placeholderCode": "namespace Kata {\n operation Oracle_StartsWith(x : Qubit[], y : Qubit, p : Bool[]) : Unit is Adj + Ctl {\n // Implement your solution here...\n\n } \n}\n",
|
|
6961
|
+
"explainedSolution": {
|
|
6962
|
+
"type": "explained-solution",
|
|
6963
|
+
"items": [
|
|
6964
|
+
{
|
|
6965
|
+
"type": "text-content",
|
|
6966
|
+
"content": "\nIn this problem, the value of the function we're evaluating does not depend on the state of the qubits after qubit $P$. This means that we can just ignore them and consider only the qubits that matter - `x[... Length(p) - 1]`.\n\nOnce we do that, the problem becomes much simpler: flip the state of the target qubit if the input qubits are in the given state. That's the definition of a controlled gate with arbitrary controls, and we can apply that easily using the library operation `ApplyControlledOnBitString`."
|
|
6967
|
+
},
|
|
6968
|
+
{
|
|
6969
|
+
"type": "solution",
|
|
6970
|
+
"id": "grovers_search__prefix_oracle_solution",
|
|
6971
|
+
"code": "namespace Kata {\n operation Oracle_StartsWith(x : Qubit[], y : Qubit, p : Bool[]) : Unit is Adj + Ctl {\n ApplyControlledOnBitString(p, X, x[... Length(p) - 1], y);\n }\n}\n"
|
|
6972
|
+
}
|
|
6973
|
+
]
|
|
6974
|
+
}
|
|
6975
|
+
},
|
|
6976
|
+
{
|
|
6977
|
+
"type": "lesson",
|
|
6978
|
+
"id": "grovers_search__algorithm",
|
|
6979
|
+
"title": "Grover's Search Algorithm",
|
|
6980
|
+
"items": [
|
|
6981
|
+
{
|
|
6982
|
+
"type": "text-content",
|
|
6983
|
+
"content": "\n### Inputs\n\nYou are given the number of bits in the function input $n$ and the phase oracle for the problem we're solving - a \"black box\" quantum operation $U_f$ that implements a classical function $f(x)$. \n\nAs usual, the phase oracle $U_f$ is defined by its effect on the individual values $x$ (represented as basis states $\\ket{x}$). \nIf the value of the function on the input $x$ $f(x) = 1$, the corresponding basis state $\\ket{x}$ is multiplied by $-1$; otherwise, the basis state is not changed.\nFormally, this can be written as follows:\n\n$$U_f \\ket{x} = (-1)^{f(x)} \\ket{x}$$\n\n> Typically the oracle for Grover's search is implemented as a marking oracle and then converted into a phase oracle using the phase kickback trick.\n\n\n### Algorithm outline\n\nThe high-level outline of the algorithm is very simple:\n\n1. Initialize the quantum system to a well-known starting state.\n2. Apply a fixed sequence of \"Grover iterations\" several times. Each iteration is implemented as pair of operations that includes one call of the oracle \"black box\".\n3. Finally, measuring all qubits will produce the desired output with high probability.\n\nLet's take a closer look at the algorithm.\n\n> We will use a convenient visualization of the algorithm steps rather than mathematical derivation.\n> They are equivalent, but the visual representation is much easier to follow.\n\n\n### Initial state and definitions\n\nGrover's search algorithm begins with a uniform superposition of all the states in the search space.\nTypically, the search space is defined as all $n$-bit bit strings, so this superposition is just an even superposition \nof all $N = 2^n$ basis states on $n$ qubits:\n$$\\ket{\\text{all}} = \\frac{1}{\\sqrt{N}}\\sum_{x=0}^{N-1}{\\ket{x}} $$\n\nWhen this superposition is considered in the context of the equation $f(x) = 1$, \nall the basis states can be split in two groups: \"good\" (solutions) and \"bad\" (non-solutions).\nIf the number of states for which $f(x)=1$ (the number of equation solutions) is $M$, \ntwo uniform superpositions of \"good\" and \"bad\" states can be defined as follows:\n\n$$\\ket{\\text{good}} = \\frac{1}{\\sqrt{M}}\\sum_{x,f(x)=1}{\\ket{x}}$$\n$$\\ket{\\text{bad}} = \\frac{1}{\\sqrt{N-M}}\\sum_{x,f(x)=0}{\\ket{x}}$$\n\nNow, the even superposition of all basis states can be rewritten as follows:\n$$\\ket{\\text{all}} = \\sqrt{\\frac{M}{N}}\\ket{\\text{good}} + \\sqrt{\\frac{N-M}{N}}\\ket{\\text{bad}}$$\n\nThe amplutudes $\\sqrt{\\frac{M}{N}}$ and $\\sqrt{\\frac{N-M}{N}}$ can then be written in a trigonometric representation,\nas a sine and cosine of the angle $\\theta$:\n\n$$\\sin \\theta = \\sqrt{\\frac{M}{N}}, \\cos \\theta = \\sqrt{\\frac{N-M}{N}}$$\n\nWith this replacement, the initial state can be written as \n\n$$\\ket{\\text{all}} = \\sin \\theta \\ket{\\text{good}} + \\cos \\theta \\ket{\\text{bad}}$$\n\nThe states involved in the algorithm can be represented on a plane on which $\\ket{\\text{good}}$ and $\\ket{\\text{bad}}$ vectors correspond to vertical and horizontal axes, respectively.\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg width=\"447\" height=\"366\" overflow=\"hidden\" version=\"1.1\" xml:space=\"preserve\" xmlns=\"http://www.w3.org/2000/svg\"><defs><linearGradient id=\"fill0\" x1=\"2824\" x2=\"2824\" y1=\"1084\" y2=\"1211\" gradientUnits=\"userSpaceOnUse\" spreadMethod=\"reflect\"><stop offset=\"0\"/><stop offset=\".0292\"/><stop offset=\".3\"/><stop offset=\"1\"/></linearGradient><linearGradient id=\"fill3\" x1=\"2026\" x2=\"2026\" y1=\"516\" y2=\"642\" gradientUnits=\"userSpaceOnUse\" spreadMethod=\"reflect\"><stop offset=\"0\"/><stop offset=\".0292\"/><stop offset=\".3\"/><stop offset=\"1\"/></linearGradient><linearGradient id=\"fill6\" x1=\"2877\" x2=\"2877\" y1=\"1261\" y2=\"1388\" gradientUnits=\"userSpaceOnUse\" spreadMethod=\"reflect\"><stop offset=\"0\"/><stop offset=\".0292\"/><stop offset=\".3\"/><stop offset=\"1\"/></linearGradient></defs><g transform=\"matrix(.25 0 0 .25 -333 -132)\"><path d=\"m1336 1325c0-368 308-666 689-666s689 298 689 666c0 368-308 666-689 666s-689-298-689-666z\" fill=\"none\" fill-rule=\"evenodd\" stroke=\"#000\" stroke-miterlimit=\"8\" stroke-width=\"6.88\"/><path d=\"m1336 1322h1373v6.88h-1373zm1348-22.1 30.7 25.6-30.7 25.6c-1.46 1.21-3.62 1.02-4.84-0.44s-1.02-3.63 0.44-4.84l27.5-22.9v5.28l-27.5-22.9c-1.46-1.21-1.66-3.38-0.44-4.84s3.38-1.65 4.84-0.44z\"/><path d=\"m2028 664v1328h-6.88v-1328zm-29 25.3 25.6-30.7 25.6 30.7c1.21 1.46 1.02 3.63-0.44 4.84-1.46 1.22-3.63 1.02-4.84-0.44l-22.9-27.5h5.28l-22.9 27.5c-1.21 1.46-3.38 1.66-4.84 0.44-1.46-1.22-1.65-3.38-0.44-4.84z\"/><path d=\"m2735 1098h6.92v83.6h-6.92z\" fill=\"url(#fill0)\" fill-rule=\"evenodd\"/><text x=\"2735.3799\" y=\"1171.12\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"83.6px\">|</text><path d=\"m2782 1122c-3.09 0-5.86 1.25-8.31 3.73-2.46 2.49-4.37 5.82-5.75 10s-2.07 8.35-2.07 12.5c0 3.11 0.43 5.44 1.28 6.98 0.86 1.55 2.29 2.32 4.29 2.32 1.98 0 3.92-0.86 5.82-2.56 1.9-1.71 3.86-4.14 5.88-7.3 2.03-3.16 3.46-6.81 4.29-10.9l0.41-1.93c0.27-1.23 0.45-2.29 0.54-3.19s0.13-1.87 0.13-2.92c0-2.31-0.49-4-1.48-5.08s-2.66-1.62-5.03-1.62zm-0.9-3.54c1.95 0 3.77 0.21 5.46 0.65 1.69 0.43 3.44 1.2 5.23 2.31l4.14-2.96 2.87 0.71-6.6 28.5c-0.66 2.85-0.99 5.07-0.99 6.65 0 1.2 0.19 2.07 0.58 2.61s1.01 0.81 1.84 0.81c0.9 0 1.86-0.37 2.88-1.1 1.02-0.74 2.45-2.14 4.31-4.2l2.56 2.51c-2.69 2.88-4.99 4.92-6.89 6.13-1.9 1.22-3.96 1.82-6.18 1.82-1.86 0-3.34-0.61-4.45-1.84s-1.66-2.86-1.66-4.9c0-1.64 0.34-3.39 1.03-5.25l-0.58-0.18c-2.88 4.19-5.6 7.26-8.18 9.21-2.57 1.94-5.3 2.92-8.17 2.92-3.3 0-5.85-1.24-7.66-3.73s-2.72-5.98-2.72-10.5c0-5.15 1.01-10.1 3.03-14.8 2.02-4.75 4.8-8.49 8.34-11.2 3.53-2.74 7.47-4.11 11.8-4.11zm75.2-20.5h2.65l-11 49.7c-0.66 2.97-0.99 5.19-0.99 6.65 0 1.2 0.2 2.07 0.58 2.61 0.39 0.54 1.01 0.81 1.85 0.81 0.89 0 1.85-0.37 2.87-1.1 1.02-0.74 2.46-2.14 4.31-4.2l2.56 2.51c-2.9 3.06-5.27 5.15-7.12 6.27-1.84 1.12-3.9 1.68-6.17 1.68-1.95 0-3.51-0.71-4.67-2.13-1.17-1.42-1.76-3.24-1.76-5.46 0-2.01 0.42-4.91 1.26-8.71l8.04-36c0.36-1.58 0.62-2.85 0.77-3.79 0.15-0.95 0.22-1.82 0.22-2.63 0-0.9-0.16-1.58-0.49-2.04-0.33-0.47-0.8-0.81-1.42-1.01-0.61-0.21-1.71-0.36-3.3-0.45l0.54-2.34zm-29 0h2.65l-11 49.7c-0.66 2.97-0.99 5.19-0.99 6.65 0 1.2 0.2 2.07 0.58 2.61 0.39 0.54 1.01 0.81 1.85 0.81 0.89 0 1.85-0.37 2.87-1.1 1.02-0.74 2.46-2.14 4.31-4.2l2.56 2.51c-2.9 3.06-5.27 5.15-7.12 6.27-1.84 1.12-3.9 1.68-6.17 1.68-1.95 0-3.51-0.71-4.67-2.13-1.17-1.42-1.76-3.24-1.76-5.46 0-2.01 0.42-4.91 1.26-8.71l8.04-36c0.36-1.58 0.62-2.85 0.77-3.79 0.15-0.95 0.22-1.82 0.22-2.63 0-0.9-0.16-1.58-0.49-2.04-0.33-0.47-0.8-0.81-1.42-1.01-0.61-0.21-1.71-0.36-3.3-0.45l0.54-2.34z\" fill=\"url(#fill0)\" fill-rule=\"evenodd\"/><text x=\"2758.22\" y=\"1154.85\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"65px\">𝑎𝑙𝑙</text><path d=\"m2875 1098 17.9 40.3v3.32l-17.9 40.4-4.81-1.71 14.4-40.3-14.4-40.4z\" fill=\"url(#fill0)\" fill-rule=\"evenodd\"/><text x=\"2870.6001\" y=\"1171.29\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"84px\">〉</text><path d=\"m1889 530h6.91v83.6h-6.91z\" fill=\"url(#fill3)\" fill-rule=\"evenodd\"/><text x=\"1888.67\" y=\"602.83099\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"83.6px\">|</text><path d=\"m2040 554c-3.11 0-5.83 1.3-8.15 3.91-2.32 2.6-4.15 6.33-5.48 11.2-1.33 4.85-2 9.03-2 12.5 0 3.29 0.68 5.73 2.05 7.3 1.36 1.57 3.42 2.36 6.17 2.36 2.94 0 5.54-1.32 7.82-3.95 2.28-2.64 4.07-6.33 5.39-11.1 1.32-4.75 1.98-8.92 1.98-12.5 0-3.24-0.63-5.67-1.89-7.3s-3.22-2.45-5.89-2.45zm-49 0c-3.11 0-5.83 1.3-8.15 3.91-2.32 2.6-4.15 6.33-5.48 11.2-1.33 4.85-2 9.03-2 12.5 0 3.29 0.68 5.73 2.05 7.3 1.36 1.57 3.42 2.36 6.17 2.36 2.94 0 5.54-1.32 7.82-3.95 2.28-2.64 4.07-6.33 5.39-11.1 1.32-4.75 1.98-8.92 1.98-12.5 0-3.24-0.63-5.67-1.89-7.3s-3.22-2.45-5.89-2.45zm98.3-0.09c-3.05 0-5.79 1.24-8.22 3.71-2.42 2.47-4.33 5.8-5.72 10-1.4 4.19-2.09 8.37-2.09 12.5 0 3.12 0.42 5.44 1.28 6.99 0.85 1.54 2.28 2.31 4.29 2.31 0.93 0 1.87-0.202 2.83-0.606 0.96-0.405 1.95-1.06 2.99-1.96 1.03-0.898 2.05-1.99 3.05-3.28s1.92-2.58 2.76-3.89c0.84-1.3 1.62-2.84 2.34-4.63 0.72-1.78 1.33-3.93 1.84-6.45l0.4-1.93c0.45-2.16 0.68-4.19 0.68-6.11 0-2.34-0.5-4.04-1.48-5.1-0.99-1.06-2.64-1.6-4.95-1.6zm-148 0c-3.05 0-5.79 1.24-8.22 3.71-2.42 2.47-4.33 5.8-5.72 10-1.4 4.19-2.09 8.37-2.09 12.5 0 3.12 0.45 5.44 1.35 6.99 0.89 1.54 2.3 2.31 4.22 2.31 1.53 0 3.05-0.524 4.56-1.57s3.13-2.71 4.85-4.99 3.06-4.45 4.02-6.51c0.96-2.07 1.77-4.64 2.45-7.73 0.67-3.08 1.01-5.76 1.01-8.04 0-2.34-0.5-4.04-1.48-5.1-0.99-1.06-2.64-1.6-4.95-1.6zm100-3.5c4.8 0 8.45 1.31 11 3.93 2.52 2.62 3.78 6.37 3.78 11.3 0 3.47-0.61 7.19-1.82 11.1s-2.88 7.28-4.99 9.97c-2.11 2.7-4.63 4.72-7.57 6.09-2.93 1.36-6.3 2.04-10.1 2.04-4.65 0-8.25-1.3-10.8-3.91-2.56-2.6-3.84-6.35-3.84-11.2 0-2.4 0.36-5.17 1.08-8.31 0.93-4.25 2.48-7.97 4.67-11.1 2.19-3.18 4.88-5.61 8.09-7.3 3.2-1.69 6.72-2.54 10.6-2.54zm-49 0c4.8 0 8.45 1.31 11 3.93 2.52 2.62 3.78 6.37 3.78 11.3 0 3.47-0.61 7.19-1.82 11.1s-2.88 7.28-4.99 9.97c-2.11 2.7-4.63 4.72-7.57 6.09-2.93 1.36-6.3 2.04-10.1 2.04-4.65 0-8.25-1.3-10.8-3.91-2.56-2.6-3.84-6.35-3.84-11.2 0-2.4 0.36-5.17 1.08-8.31 0.93-4.25 2.48-7.97 4.67-11.1 2.19-3.18 4.88-5.61 8.09-7.3 3.2-1.69 6.72-2.54 10.6-2.54zm-51.7-0.045c1.88 0 3.66 0.225 5.34 0.674s3.37 1.21 5.08 2.29l4.13-2.96 2.88 0.719-4.63 20.9c-0.33 1.47-1.08 5.17-2.25 11.1-1.23 6.29-2.22 10.7-2.98 13.3-0.77 2.6-1.72 4.98-2.86 7.12s-2.6 4-4.4 5.59c-1.8 1.59-3.98 2.82-6.54 3.68-2.56 0.869-5.59 1.3-9.09 1.3-11.3 0-17-3.29-17-9.88 0-1.68 0.51-3.2 1.52-4.58 1.02-1.38 2.65-2.83 4.9-4.36l3.24 2.6c-0.57 0.689-1.05 1.37-1.44 2.04s-0.67 1.32-0.83 1.95c-0.17 0.629-0.25 1.38-0.25 2.25 0 2.25 0.81 3.89 2.43 4.92 1.61 1.03 4.05 1.55 7.32 1.55 3.68 0 6.64-0.831 8.87-2.49s4.14-4.34 5.73-8.02c1.58-3.68 3.13-9.25 4.62-16.7l-0.62-0.134c-2.91 3.98-5.6 6.89-8.09 8.72-2.49 1.83-5.17 2.74-8.04 2.74-3.27 0-5.8-1.23-7.62-3.68-1.81-2.46-2.71-5.96-2.71-10.5 0-5.12 1-10 3.01-14.8 2-4.72 4.79-8.47 8.35-11.3 3.57-2.78 7.53-4.18 11.9-4.18zm168-20.5h2.65l-11.2 49.7c-0.66 2.94-0.99 5.15-0.99 6.65 0 1.2 0.2 2.07 0.59 2.6s1 0.809 1.84 0.809c0.9 0 1.86-0.367 2.87-1.1 1.02-0.734 2.46-2.13 4.32-4.2l2.56 2.52c-2.76 2.9-5.08 4.96-6.97 6.15-1.88 1.2-3.92 1.8-6.1 1.8-1.86 0-3.34-0.614-4.45-1.84s-1.66-2.86-1.66-4.9c0-1.65 0.34-3.4 1.03-5.26l-0.59-0.18c-2.87 4.19-5.6 7.26-8.17 9.21-2.58 1.95-5.3 2.92-8.18 2.92-3.29 0-5.84-1.24-7.66-3.73-1.81-2.48-2.71-5.97-2.71-10.5 0-5.15 1.01-10.1 3.03-14.8s4.8-8.49 8.33-11.2c3.54-2.74 7.47-4.11 11.8-4.11 1.82 0 3.51 0.187 5.05 0.562 1.54 0.374 3.12 1.02 4.74 1.95l2.33-10.4c0.24-0.989 0.45-2.08 0.63-3.28s0.27-2.25 0.27-3.14c0-0.899-0.16-1.58-0.49-2.04s-0.8-0.801-1.42-1.01c-0.61-0.209-1.71-0.359-3.3-0.449l0.54-2.34z\" fill=\"url(#fill3)\" fill-rule=\"evenodd\"/><text x=\"1908.14\" y=\"603.505\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"84.3px\">𝑔𝑜𝑜𝑑</text><path d=\"m2126 529 17.9 40.3v3.32l-17.9 40.4-4.81-1.71 14.4-40.3-14.4-40.4z\" fill=\"url(#fill3)\" fill-rule=\"evenodd\"/><text x=\"2121.28\" y=\"603\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"84px\">〉</text><path transform=\"matrix(1 0 0 -1 2024 1326)\" d=\"m0.823-3.34 660 163-1.64 6.68-660-163zm641 135 23.7 32.2-35.9 17.5c-1.71 0.831-3.76 0.121-4.6-1.59s-0.121-3.76 1.59-4.6l32.2-15.7-1.26 5.13-21.2-28.8c-1.12-1.53-0.798-3.68 0.731-4.81s3.68-0.798 4.81 0.731z\"/><path d=\"m2766 1275h6.92v83.6h-6.92z\" fill=\"url(#fill6)\" fill-rule=\"evenodd\"/><text x=\"2766.3201\" y=\"1348.14\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"83.6px\">|</text><path d=\"m2816 1301c-1.43 0-2.85 0.46-4.24 1.37s-2.94 2.43-4.65 4.54-3.1 4.27-4.18 6.49-1.99 5.05-2.74 8.49l-0.4 1.89c-0.45 2.09-0.68 4.13-0.68 6.11 0 2.36 0.52 4.07 1.55 5.12 1.04 1.05 2.75 1.57 5.15 1.57 1.22 0 2.39-0.2 3.5-0.61 1.11-0.4 2.24-1.07 3.39-2 1.15-0.92 2.25-2.14 3.28-3.66 1.03-1.51 1.99-3.37 2.85-5.59 0.87-2.22 1.55-4.59 2.03-7.12 0.47-2.53 0.71-4.95 0.71-7.25 0-3.12-0.44-5.46-1.32-7.01-0.88-1.56-2.3-2.34-4.25-2.34zm97.4-1.75c-3.06 0-5.8 1.23-8.22 3.71-2.43 2.47-4.34 5.8-5.73 9.99s-2.09 8.37-2.09 12.5c0 3.12 0.43 5.45 1.28 6.99s2.29 2.31 4.29 2.31c0.93 0 1.87-0.2 2.83-0.6 0.96-0.41 1.96-1.06 2.99-1.96s2.05-1.99 3.05-3.28c1.01-1.29 1.93-2.58 2.77-3.88 0.83-1.31 1.61-2.85 2.33-4.63s1.33-3.93 1.84-6.45l0.41-1.93c0.45-2.15 0.67-4.19 0.67-6.11 0-2.33-0.49-4.03-1.48-5.1-0.99-1.06-2.64-1.59-4.94-1.59zm-50.9 0c-3.09 0-5.86 1.24-8.31 3.73-2.46 2.48-4.37 5.82-5.75 9.99-1.38 4.18-2.07 8.35-2.07 12.5 0 3.12 0.43 5.45 1.28 6.99s2.29 2.31 4.29 2.31c1.98 0 3.92-0.85 5.82-2.56 1.9-1.7 3.86-4.14 5.88-7.3 2.03-3.16 3.46-6.8 4.29-10.9l0.41-1.93c0.27-1.23 0.45-2.29 0.54-3.19s0.13-1.87 0.13-2.92c0-2.3-0.49-4-1.48-5.07-0.99-1.08-2.67-1.62-5.03-1.62zm-0.9-3.55c1.95 0 3.77 0.22 5.46 0.65 1.69 0.44 3.43 1.21 5.23 2.32l4.13-2.97 2.88 0.72-6.6 28.5c-0.66 2.84-0.99 5.06-0.99 6.65 0 1.2 0.19 2.06 0.58 2.6s1 0.81 1.84 0.81c0.9 0 1.86-0.36 2.88-1.1 1.02-0.73 2.45-2.13 4.31-4.2l2.56 2.52c-2.69 2.87-4.99 4.92-6.89 6.13-1.91 1.21-3.97 1.82-6.18 1.82-1.86 0-3.34-0.62-4.45-1.84-1.11-1.23-1.66-2.86-1.66-4.9 0-1.65 0.34-3.4 1.03-5.26l-0.58-0.18c-2.88 4.2-5.6 7.27-8.18 9.21-2.57 1.95-5.3 2.92-8.17 2.92-3.3 0-5.85-1.24-7.66-3.73-1.81-2.48-2.72-5.97-2.72-10.5 0-5.15 1.01-10.1 3.03-14.8s4.8-8.49 8.34-11.2c3.53-2.74 7.47-4.11 11.8-4.11zm70.6-20.5h2.65l-11.2 49.7c-0.66 2.93-0.99 5.15-0.99 6.65 0 1.2 0.19 2.06 0.58 2.6s1 0.81 1.84 0.81c0.9 0 1.86-0.36 2.88-1.1 1.02-0.73 2.45-2.13 4.31-4.2l2.56 2.52c-2.75 2.9-5.08 4.95-6.96 6.15-1.89 1.2-3.93 1.8-6.11 1.8-1.86 0-3.34-0.62-4.45-1.84-1.11-1.23-1.66-2.86-1.66-4.9 0-1.65 0.34-3.4 1.03-5.26l-0.58-0.18c-2.88 4.2-5.6 7.27-8.18 9.21-2.57 1.95-5.3 2.92-8.17 2.92-3.3 0-5.85-1.24-7.66-3.73-1.81-2.48-2.72-5.97-2.72-10.5 0-5.15 1.01-10.1 3.03-14.8s4.8-8.49 8.34-11.2c3.53-2.74 7.47-4.11 11.8-4.11 1.83 0 3.51 0.19 5.05 0.56 1.55 0.38 3.13 1.03 4.74 1.96l2.34-10.4c0.24-0.99 0.45-2.08 0.63-3.28s0.27-2.25 0.27-3.14c0-0.9-0.17-1.58-0.5-2.05-0.33-0.46-0.8-0.8-1.41-1.01-0.62-0.21-1.72-0.36-3.3-0.45l0.54-2.33zm-124 0h2.61l-7.91 31.4 0.59 0.18c2.9-3.9 5.63-6.71 8.17-8.45 2.55-1.74 5.09-2.6 7.64-2.6 3.26 0 5.8 1.24 7.61 3.72 1.81 2.49 2.72 5.99 2.72 10.5 0 4.94-1 9.8-2.99 14.6-1.99 4.78-4.75 8.57-8.29 11.4-3.53 2.8-7.48 4.2-11.8 4.2-3.99 0-7.52-0.98-10.6-2.92l-4.13 2.92-2.87-0.72 11.6-51.4c0.69-3.05 1.03-5.27 1.03-6.64 0-1.26-0.38-2.15-1.14-2.66-0.77-0.5-2.14-0.79-4.11-0.85l0.54-2.33z\" fill=\"url(#fill6)\" fill-rule=\"evenodd\"/><text x=\"2788.5801\" y=\"1331.87\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"65px\">𝑏𝑎𝑑</text><path d=\"m2950 1275 17.9 40.3v3.33l-17.9 40.4-4.8-1.71 14.4-40.3-14.4-40.4z\" fill=\"url(#fill6)\" fill-rule=\"evenodd\"/><text x=\"2945.6599\" y=\"1348.3\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"84px\">〉</text><path d=\"m2414 1269c-1.4 6.49-2.11 12-2.11 16.4 0 3.36 0.51 5.82 1.53 7.39s2.67 2.36 4.94 2.36c3.36 0 6.54-2.25 9.55-6.76s5.56-11 7.66-19.4zm18.4-30.3c-3.5 0-6.74 2.22-9.72 6.65s-5.52 10.8-7.62 19h21.5c1.41-6.31 2.11-11.8 2.11-16.3 0-3.15-0.51-5.5-1.53-7.06-1.01-1.55-2.6-2.33-4.76-2.33zm0.54-3.64c8.69 0 13 5.51 13 16.5 0 3.12-0.35 6.84-1.06 11.2-0.7 4.33-1.82 8.74-3.34 13.2-1.53 4.5-3.46 8.47-5.8 11.9-2.33 3.46-5.03 6.13-8.08 8.02-3.06 1.89-6.35 2.83-9.89 2.83-4.46 0-7.78-1.36-9.97-4.09-2.19-2.72-3.28-6.81-3.28-12.3 0-2.97 0.33-6.62 0.99-11 0.66-4.35 1.74-8.79 3.26-13.3 1.51-4.54 3.45-8.57 5.84-12.1 2.38-3.52 5.12-6.23 8.22-8.13s6.46-2.85 10.1-2.85z\" fill-rule=\"evenodd\"/><text x=\"2404.45\" y=\"1290.41\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"63.7px\">𝜃</text><path d=\"m2357 1240c6.73 27 10.1 54.7 10.1 82.5\" fill=\"none\" fill-rule=\"evenodd\" stroke=\"#000\" stroke-miterlimit=\"8\" stroke-width=\"6.88\"/><path d=\"m2722 1082v-49h89v-49 49h89v49\" fill=\"none\" fill-rule=\"evenodd\" stroke=\"#0070c0\" stroke-miterlimit=\"8\" stroke-width=\"6.88\"/><text transform=\"translate(2634 952)\" fill=\"#0070c0\" font-family=\"'Segoe UI', 'Segoe UI_MSFontService', sans-serif\" font-size=\"64px\" font-weight=\"400\">The starting state</text></g></svg>\n\n### Grover's iteration\n\nEach Grover's iteration consists of two operations.\n\n1. The phase oracle $U_f$.\n2. An operation called \"reflection about the mean\".\n\nApplying the phase oracle to the state will flip the sign of all basis states in $\\ket{\\text{good}}$ \nand leave all basis states in $\\ket{\\text{bad}}$ unchanged:\n\n$$U_f\\ket{\\text{good}} = -\\ket{\\text{good}}$$\n$$U_f\\ket{\\text{bad}} = \\ket{\\text{bad}}$$\n\nOn the circle plot, this transformation leaves the horizontal component of the state vector unchanged and reverses its vertical component. In other words, this operation is a reflection along the horizontal axis.\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg width=\"475\" height=\"368\" overflow=\"hidden\" version=\"1.1\" xml:space=\"preserve\" xmlns=\"http://www.w3.org/2000/svg\"><defs><linearGradient id=\"fill0\" x1=\"2830\" x2=\"2830\" y1=\"1062\" y2=\"1188\" gradientUnits=\"userSpaceOnUse\" spreadMethod=\"reflect\"><stop offset=\"0\"/><stop offset=\".0292\"/><stop offset=\".3\"/><stop offset=\"1\"/></linearGradient><linearGradient id=\"fill3\" x1=\"2031\" x2=\"2031\" y1=\"494\" y2=\"621\" gradientUnits=\"userSpaceOnUse\" spreadMethod=\"reflect\"><stop offset=\"0\"/><stop offset=\".0292\"/><stop offset=\".3\"/><stop offset=\"1\"/></linearGradient><linearGradient id=\"fill6\" x1=\"2876\" x2=\"2876\" y1=\"1238\" y2=\"1365\" gradientUnits=\"userSpaceOnUse\" spreadMethod=\"reflect\"><stop offset=\"0\"/><stop offset=\".0292\"/><stop offset=\".3\"/><stop offset=\"1\"/></linearGradient></defs><g transform=\"matrix(.25 0 0 .25 -332 -127)\"><path d=\"m2423 1245c-1.41 6.5-2.11 12-2.11 16.4 0 3.35 0.51 5.81 1.53 7.39 1.01 1.57 2.66 2.35 4.94 2.35 3.35 0 6.53-2.25 9.54-6.76 3.01-4.5 5.57-11 7.66-19.4zm18.4-30.3c-3.51 0-6.75 2.22-9.73 6.65s-5.52 10.8-7.61 19h21.5c1.4-6.32 2.11-11.8 2.11-16.3 0-3.14-0.51-5.49-1.53-7.05s-2.61-2.34-4.76-2.34zm0.54-3.64c8.68 0 13 5.51 13 16.5 0 3.11-0.35 6.83-1.05 11.2-0.71 4.33-1.82 8.74-3.35 13.2s-3.46 8.47-5.79 11.9c-2.34 3.45-5.03 6.13-8.09 8.01-3.05 1.89-6.35 2.83-9.88 2.83-4.46 0-7.79-1.36-9.97-4.08-2.19-2.73-3.28-6.82-3.28-12.3 0-2.96 0.33-6.62 0.98-11 0.66-4.34 1.75-8.78 3.26-13.3s3.46-8.56 5.84-12.1 5.12-6.23 8.22-8.13 6.46-2.86 10.1-2.86z\" fill=\"#243a5e\" fill-rule=\"evenodd\"/><text x=\"2413.1399\" y=\"1267.03\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"63.7px\">𝜃</text><path d=\"m2423 1344c-1.41 6.5-2.11 12-2.11 16.4 0 3.35 0.51 5.82 1.52 7.39 1.02 1.57 2.67 2.36 4.95 2.36 3.35 0 6.53-2.26 9.54-6.76 3.01-4.51 5.56-11 7.66-19.4zm18.4-30.3c-3.51 0-6.75 2.21-9.73 6.64-2.98 4.44-5.52 10.8-7.61 19h21.5c1.41-6.32 2.12-11.8 2.12-16.3 0-3.14-0.51-5.49-1.53-7.05s-2.61-2.33-4.76-2.33zm0.54-3.64c8.68 0 13 5.51 13 16.5 0 3.11-0.35 6.83-1.05 11.2-0.71 4.33-1.82 8.74-3.35 13.2s-3.46 8.47-5.79 11.9c-2.34 3.46-5.04 6.13-8.09 8.02-3.06 1.88-6.35 2.83-9.88 2.83-4.47 0-7.79-1.37-9.98-4.09-2.18-2.73-3.28-6.82-3.28-12.3 0-2.96 0.33-6.61 0.99-11 0.66-4.34 1.75-8.78 3.26-13.3 1.51-4.53 3.46-8.56 5.84-12.1s5.12-6.23 8.22-8.13 6.46-2.85 10.1-2.85z\" fill=\"#0070c0\" fill-rule=\"evenodd\"/><text x=\"2413.0701\" y=\"1366.24\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"63.7px\">𝜃</text><path d=\"m1332 1302c0-373 313-675 698-675s698 302 698 675c0 373-313 675-698 675s-698-302-698-675z\" fill=\"none\" fill-rule=\"evenodd\" stroke=\"#000\" stroke-miterlimit=\"8\" stroke-width=\"6.88\"/><path d=\"m2033 633v1345h-6.88v-1345zm-29 25.3 25.6-30.7 25.6 30.7c1.21 1.46 1.02 3.63-0.44 4.84s-3.63 1.02-4.84-0.44l-22.9-27.5h5.28l-22.9 27.5c-1.21 1.46-3.38 1.66-4.84 0.44s-1.65-3.38-0.44-4.84z\"/><path d=\"m2741 1075h6.92v83.6h-6.92z\" fill=\"url(#fill0)\" fill-rule=\"evenodd\"/><text x=\"2740.6201\" y=\"1148.61\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"83.6px\">|</text><path d=\"m2788 1100c-3.08 0-5.85 1.24-8.31 3.73-2.46 2.48-4.37 5.82-5.75 9.99-1.38 4.18-2.07 8.35-2.07 12.5 0 3.12 0.43 5.45 1.28 6.99 0.86 1.54 2.29 2.31 4.29 2.31 1.98 0 3.92-0.85 5.82-2.56 1.9-1.7 3.86-4.14 5.89-7.3 2.02-3.16 3.45-6.8 4.29-10.9l0.4-1.93c0.27-1.23 0.45-2.29 0.54-3.19s0.13-1.87 0.13-2.92c0-2.3-0.49-4-1.48-5.07-0.99-1.08-2.66-1.62-5.03-1.62zm-0.9-3.55c1.95 0 3.77 0.22 5.46 0.65 1.69 0.44 3.44 1.21 5.23 2.32l4.14-2.97 2.87 0.72-6.6 28.5c-0.66 2.85-0.99 5.06-0.99 6.65 0 1.2 0.19 2.06 0.58 2.6s1.01 0.81 1.85 0.81c0.89 0 1.85-0.36 2.87-1.1 1.02-0.73 2.46-2.13 4.31-4.2l2.56 2.52c-2.69 2.87-4.99 4.92-6.89 6.13s-3.96 1.82-6.18 1.82c-1.86 0-3.34-0.62-4.45-1.84-1.1-1.23-1.66-2.86-1.66-4.9 0-1.65 0.35-3.4 1.03-5.26l-0.58-0.18c-2.87 4.2-5.6 7.27-8.17 9.21-2.58 1.95-5.31 2.92-8.18 2.92-3.29 0-5.85-1.24-7.66-3.72-1.81-2.49-2.72-5.98-2.72-10.5 0-5.15 1.01-10.1 3.03-14.8 2.03-4.75 4.8-8.49 8.34-11.2 3.53-2.74 7.47-4.11 11.8-4.11zm75.2-20.5h2.65l-11 49.7c-0.66 2.96-0.99 5.18-0.99 6.65 0 1.2 0.2 2.06 0.59 2.6s1 0.81 1.84 0.81c0.9 0 1.85-0.36 2.87-1.1 1.02-0.73 2.46-2.13 4.31-4.2l2.57 2.52c-2.91 3.05-5.28 5.14-7.12 6.26-1.85 1.13-3.91 1.69-6.18 1.69-1.95 0-3.51-0.71-4.67-2.14-1.17-1.42-1.76-3.24-1.76-5.45 0-2.01 0.42-4.91 1.26-8.72l8.04-36c0.36-1.59 0.62-2.85 0.77-3.8 0.15-0.94 0.22-1.82 0.22-2.62 0-0.9-0.16-1.58-0.49-2.05-0.33-0.46-0.8-0.8-1.42-1.01-0.61-0.21-1.71-0.36-3.3-0.45l0.54-2.33zm-29 0h2.65l-11 49.7c-0.66 2.96-0.99 5.18-0.99 6.65 0 1.2 0.2 2.06 0.59 2.6s1 0.81 1.84 0.81c0.9 0 1.85-0.36 2.87-1.1 1.02-0.73 2.46-2.13 4.31-4.2l2.57 2.52c-2.91 3.05-5.28 5.14-7.12 6.26-1.85 1.13-3.91 1.69-6.18 1.69-1.95 0-3.51-0.71-4.67-2.14-1.17-1.42-1.76-3.24-1.76-5.45 0-2.01 0.42-4.91 1.26-8.72l8.04-36c0.36-1.59 0.62-2.85 0.77-3.8 0.15-0.94 0.22-1.82 0.22-2.62 0-0.9-0.16-1.58-0.49-2.05-0.33-0.46-0.8-0.8-1.42-1.01-0.61-0.21-1.71-0.36-3.3-0.45l0.54-2.33z\" fill=\"url(#fill0)\" fill-rule=\"evenodd\"/><text x=\"2763.46\" y=\"1132.34\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"65px\">𝑎𝑙𝑙</text><path d=\"m2881 1075 17.9 40.3v3.33l-17.9 40.4-4.81-1.71 14.4-40.3-14.4-40.4z\" fill=\"url(#fill0)\" fill-rule=\"evenodd\"/><text x=\"2875.8401\" y=\"1148.77\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"84px\">〉</text><path d=\"m1893 508h6.92v83.6h-6.92z\" fill=\"url(#fill3)\" fill-rule=\"evenodd\"/><text x=\"1893.42\" y=\"580.99402\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"83.6px\">|</text><path d=\"m2045 532c-3.11 0-5.83 1.3-8.15 3.91-2.32 2.6-4.15 6.33-5.48 11.2-1.34 4.85-2 9.03-2 12.5 0 3.29 0.68 5.73 2.04 7.3 1.36 1.57 3.42 2.36 6.18 2.36 2.93 0 5.54-1.32 7.81-3.95 2.28-2.64 4.08-6.33 5.39-11.1 1.32-4.75 1.98-8.92 1.98-12.5 0-3.24-0.63-5.67-1.89-7.3-1.25-1.63-3.21-2.45-5.88-2.45zm-49 0c-3.11 0-5.83 1.3-8.15 3.91-2.32 2.6-4.15 6.33-5.48 11.2-1.34 4.85-2 9.03-2 12.5 0 3.29 0.68 5.73 2.04 7.3 1.36 1.57 3.42 2.36 6.18 2.36 2.93 0 5.54-1.32 7.81-3.95 2.28-2.64 4.08-6.33 5.4-11.1 1.31-4.75 1.97-8.92 1.97-12.5 0-3.24-0.63-5.67-1.89-7.3-1.25-1.63-3.21-2.45-5.88-2.45zm98.3-0.09c-3.06 0-5.8 1.24-8.22 3.71-2.43 2.47-4.34 5.8-5.73 10s-2.09 8.37-2.09 12.5c0 3.12 0.43 5.44 1.28 6.99 0.86 1.54 2.29 2.31 4.29 2.31 0.93 0 1.87-0.202 2.83-0.606 0.96-0.405 1.96-1.06 2.99-1.96 1.03-0.898 2.05-1.99 3.05-3.28 1.01-1.29 1.93-2.58 2.77-3.89 0.84-1.3 1.61-2.84 2.33-4.63 0.72-1.78 1.34-3.93 1.85-6.45l0.4-1.93c0.45-2.16 0.67-4.19 0.67-6.11 0-2.34-0.49-4.04-1.48-5.1-0.99-1.06-2.63-1.59-4.94-1.59zm-148 0c-3.05 0-5.8 1.24-8.22 3.71-2.43 2.47-4.34 5.8-5.73 10s-2.09 8.37-2.09 12.5c0 3.12 0.45 5.44 1.35 6.99 0.9 1.54 2.31 2.31 4.22 2.31 1.53 0 3.05-0.524 4.56-1.57 1.51-1.05 3.13-2.71 4.85-4.99 1.73-2.28 3.07-4.45 4.02-6.51 0.96-2.07 1.78-4.64 2.45-7.73 0.68-3.08 1.01-5.76 1.01-8.04 0-2.34-0.49-4.04-1.48-5.1-0.99-1.06-2.63-1.59-4.94-1.59zm100-3.5c4.79 0 8.44 1.31 11 3.93 2.51 2.62 3.77 6.37 3.77 11.3 0 3.47-0.6 7.19-1.82 11.1-1.21 3.95-2.87 7.28-4.98 9.97-2.11 2.7-4.64 4.72-7.57 6.09-2.94 1.36-6.31 2.04-10.1 2.04-4.64 0-8.24-1.3-10.8-3.91-2.56-2.6-3.84-6.35-3.84-11.2 0-2.4 0.36-5.17 1.07-8.31 0.93-4.25 2.49-7.97 4.68-11.1 2.18-3.18 4.88-5.61 8.08-7.3 3.21-1.69 6.73-2.54 10.6-2.54zm-49 0c4.79 0 8.44 1.31 11 3.93 2.52 2.62 3.77 6.37 3.77 11.3 0 3.47-0.6 7.19-1.82 11.1-1.21 3.95-2.87 7.28-4.98 9.97-2.11 2.7-4.64 4.72-7.57 6.09-2.94 1.36-6.31 2.04-10.1 2.04-4.64 0-8.24-1.3-10.8-3.91-2.56-2.6-3.84-6.35-3.84-11.2 0-2.4 0.36-5.17 1.07-8.31 0.93-4.25 2.49-7.97 4.68-11.1 2.18-3.18 4.88-5.61 8.08-7.3 3.21-1.69 6.73-2.54 10.6-2.54zm-51.7-0.045c1.89 0 3.67 0.225 5.35 0.674 1.67 0.449 3.37 1.21 5.07 2.29l4.14-2.96 2.87 0.719-4.63 20.9c-0.33 1.47-1.07 5.17-2.24 11.1-1.23 6.29-2.23 10.7-2.99 13.3-0.76 2.6-1.71 4.98-2.85 7.12s-2.61 4-4.4 5.59c-1.8 1.59-3.98 2.82-6.54 3.68-2.56 0.869-5.59 1.3-9.1 1.3-11.3 0-17-3.29-17-9.88 0-1.68 0.51-3.2 1.53-4.58 1.02-1.38 2.65-2.83 4.9-4.36l3.23 2.6c-0.57 0.689-1.05 1.37-1.44 2.04s-0.66 1.32-0.83 1.95c-0.16 0.629-0.25 1.38-0.25 2.25 0 2.25 0.81 3.89 2.43 4.92 1.62 1.03 4.06 1.55 7.32 1.55 3.69 0 6.64-0.831 8.87-2.49 2.24-1.66 4.15-4.34 5.73-8.02 1.59-3.68 3.13-9.25 4.63-16.7l-0.63-0.134c-2.9 3.98-5.6 6.89-8.09 8.72-2.48 1.83-5.16 2.74-8.04 2.74-3.26 0-5.8-1.23-7.61-3.68s-2.72-5.96-2.72-10.5c0-5.12 1-10 3.01-14.8 2.01-4.72 4.79-8.47 8.36-11.3 3.56-2.78 7.53-4.18 11.9-4.18zm168-20.5h2.65l-11.2 49.7c-0.66 2.94-0.99 5.15-0.99 6.65 0 1.2 0.19 2.07 0.58 2.6s1.01 0.809 1.84 0.809c0.9 0 1.86-0.367 2.88-1.1s2.45-2.13 4.31-4.2l2.56 2.52c-2.75 2.9-5.07 4.96-6.96 6.15s-3.92 1.8-6.11 1.8c-1.86 0-3.34-0.614-4.45-1.84s-1.66-2.86-1.66-4.9c0-1.65 0.35-3.4 1.03-5.26l-0.58-0.18c-2.88 4.19-5.6 7.26-8.18 9.21-2.57 1.95-5.3 2.92-8.17 2.92-3.3 0-5.85-1.24-7.66-3.73-1.81-2.48-2.72-5.97-2.72-10.5 0-5.15 1.01-10.1 3.03-14.8s4.8-8.49 8.34-11.2c3.53-2.74 7.47-4.11 11.8-4.11 1.83 0 3.51 0.187 5.05 0.561 1.55 0.375 3.13 1.03 4.74 1.96l2.34-10.4c0.24-0.989 0.45-2.08 0.63-3.28s0.27-2.25 0.27-3.14c0-0.899-0.17-1.58-0.5-2.04s-0.8-0.801-1.41-1.01-1.72-0.359-3.3-0.449l0.54-2.34z\" fill=\"url(#fill3)\" fill-rule=\"evenodd\"/><text x=\"1912.89\" y=\"581.66803\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"84.3px\">𝑔𝑜𝑜𝑑</text><path d=\"m2131 508 17.9 40.3v3.32l-17.9 40.4-4.81-1.71 14.4-40.3-14.4-40.4z\" fill=\"url(#fill3)\" fill-rule=\"evenodd\"/><text x=\"2126.04\" y=\"581.16302\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"84px\">〉</text><path transform=\"matrix(1 0 0 -1 2030 1303)\" d=\"m0.823-3.34 669 165-1.65 6.68-669-165zm649 137 23.7 32.2-35.9 17.5c-1.71 0.831-3.76 0.121-4.6-1.59s-0.121-3.76 1.59-4.6l32.2-15.7-1.26 5.13-21.2-28.8c-1.12-1.53-0.798-3.68 0.731-4.81 1.53-1.12 3.68-0.798 4.81 0.731z\"/><path d=\"m2765 1252h6.92v83.6h-6.92z\" fill=\"url(#fill6)\" fill-rule=\"evenodd\"/><text x=\"2765.25\" y=\"1324.91\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"83.6px\">|</text><path d=\"m2815 1278c-1.43 0-2.85 0.45-4.24 1.37-1.39 0.91-2.94 2.42-4.65 4.53-1.71 2.12-3.1 4.28-4.18 6.5-1.08 2.21-1.99 5.04-2.74 8.49l-0.4 1.88c-0.45 2.1-0.68 4.14-0.68 6.11 0 2.37 0.52 4.07 1.55 5.12 1.04 1.05 2.75 1.58 5.15 1.58 1.22 0 2.39-0.21 3.5-0.61 1.11-0.41 2.24-1.07 3.39-2 1.16-0.93 2.25-2.15 3.28-3.66s1.99-3.38 2.85-5.59c0.87-2.22 1.55-4.59 2.03-7.12 0.47-2.53 0.71-4.95 0.71-7.26 0-3.11-0.44-5.45-1.32-7.01-0.88-1.55-2.3-2.33-4.25-2.33zm97.4-1.75c-3.06 0-5.8 1.23-8.22 3.7-2.43 2.47-4.34 5.8-5.73 10-1.39 4.19-2.09 8.37-2.09 12.5 0 3.11 0.43 5.44 1.28 6.98 0.86 1.55 2.29 2.32 4.29 2.32 0.93 0 1.87-0.2 2.83-0.61 0.96-0.4 1.96-1.05 2.99-1.95s2.05-1.99 3.05-3.28c1.01-1.29 1.93-2.58 2.77-3.89 0.84-1.3 1.61-2.84 2.33-4.62 0.72-1.79 1.34-3.93 1.84-6.45l0.41-1.93c0.45-2.16 0.67-4.19 0.67-6.11 0-2.34-0.49-4.04-1.48-5.1s-2.64-1.59-4.94-1.59zm-50.9 0c-3.09 0-5.86 1.24-8.31 3.72-2.46 2.49-4.37 5.82-5.75 10s-2.07 8.35-2.07 12.5c0 3.11 0.43 5.44 1.28 6.98 0.86 1.55 2.29 2.32 4.29 2.32 1.98 0 3.92-0.86 5.82-2.56 1.9-1.71 3.86-4.14 5.88-7.3 2.03-3.16 3.46-6.81 4.29-10.9l0.41-1.93c0.27-1.23 0.45-2.29 0.54-3.19s0.13-1.87 0.13-2.92c0-2.31-0.49-4-1.48-5.08s-2.67-1.61-5.03-1.61zm-0.9-3.55c1.95 0 3.77 0.21 5.46 0.65 1.69 0.43 3.43 1.2 5.23 2.31l4.13-2.96 2.88 0.72-6.6 28.5c-0.66 2.84-0.99 5.06-0.99 6.64 0 1.2 0.19 2.07 0.58 2.61s1 0.81 1.84 0.81c0.9 0 1.86-0.37 2.88-1.1 1.02-0.74 2.45-2.14 4.31-4.2l2.56 2.51c-2.69 2.88-4.99 4.92-6.89 6.13-1.91 1.22-3.96 1.82-6.18 1.82-1.86 0-3.34-0.61-4.45-1.84s-1.66-2.86-1.66-4.89c0-1.65 0.34-3.4 1.03-5.26l-0.58-0.18c-2.88 4.19-5.6 7.26-8.18 9.21-2.57 1.95-5.3 2.92-8.17 2.92-3.3 0-5.85-1.24-7.66-3.73-1.81-2.48-2.72-5.97-2.72-10.5 0-5.15 1.01-10.1 3.03-14.8 2.02-4.75 4.8-8.49 8.34-11.2 3.53-2.74 7.47-4.11 11.8-4.11zm70.6-20.5h2.65l-11.2 49.7c-0.66 2.93-0.99 5.15-0.99 6.64 0 1.2 0.19 2.07 0.58 2.61s1 0.81 1.84 0.81c0.9 0 1.86-0.37 2.88-1.1 1.02-0.74 2.45-2.14 4.31-4.2l2.56 2.51c-2.75 2.91-5.07 4.96-6.96 6.16s-3.92 1.79-6.11 1.79c-1.86 0-3.34-0.61-4.45-1.84s-1.66-2.86-1.66-4.89c0-1.65 0.34-3.4 1.03-5.26l-0.58-0.18c-2.88 4.19-5.6 7.26-8.18 9.21-2.57 1.95-5.3 2.92-8.17 2.92-3.3 0-5.85-1.24-7.66-3.73-1.81-2.48-2.72-5.97-2.72-10.5 0-5.15 1.01-10.1 3.03-14.8 2.02-4.75 4.8-8.49 8.34-11.2 3.53-2.74 7.47-4.11 11.8-4.11 1.83 0 3.51 0.18 5.05 0.56 1.55 0.37 3.13 1.02 4.74 1.95l2.34-10.4c0.24-0.99 0.45-2.09 0.63-3.28 0.18-1.2 0.27-2.25 0.27-3.15s-0.17-1.58-0.5-2.04c-0.33-0.47-0.8-0.8-1.41-1.01-0.62-0.21-1.72-0.36-3.3-0.45l0.54-2.34zm-124 0h2.61l-7.91 31.4 0.59 0.18c2.9-3.89 5.63-6.71 8.17-8.44 2.55-1.74 5.09-2.61 7.64-2.61 3.26 0 5.8 1.24 7.61 3.73s2.72 5.99 2.72 10.5c0 4.94-1 9.8-2.99 14.6s-4.75 8.56-8.28 11.4c-3.54 2.8-7.49 4.2-11.9 4.2-3.99 0-7.52-0.97-10.6-2.92l-4.13 2.92-2.87-0.71 11.6-51.4c0.69-3.05 1.03-5.27 1.03-6.65 0-1.26-0.38-2.14-1.14-2.65s-2.13-0.79-4.11-0.85l0.54-2.34z\" fill=\"url(#fill6)\" fill-rule=\"evenodd\"/><text x=\"2787.51\" y=\"1308.64\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"65px\">𝑏𝑎𝑑</text><path d=\"m2949 1252 17.9 40.3v3.32l-17.9 40.4-4.8-1.71 14.4-40.3-14.4-40.4z\" fill=\"url(#fill6)\" fill-rule=\"evenodd\"/><text x=\"2944.5901\" y=\"1325.08\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"84px\">〉</text><path d=\"m2032 1298 675 161-1.59 6.69-675-161zm656 133 23.9 32-35.8 17.8c-1.7 0.85-3.76 0.15-4.61-1.55-0.84-1.7-0.15-3.76 1.55-4.61l32.1-15.9-1.22 5.14-21.4-28.7c-1.14-1.52-0.83-3.67 0.69-4.81s3.68-0.83 4.81 0.69z\" fill=\"#0070c0\"/><path d=\"m2367 1219c6.27 26.2 9.43 53.1 9.43 80.1\" fill=\"none\" fill-rule=\"evenodd\" stroke=\"#000\" stroke-miterlimit=\"8\" stroke-width=\"6.88\"/><path transform=\"matrix(1 0 0 -1 1686 1644)\" d=\"m679 259c7.22 28.1 10.9 56.9 10.9 85.9\" fill=\"none\" fill-rule=\"evenodd\" stroke=\"#0070c0\" stroke-miterlimit=\"8\" stroke-width=\"6.88\"/><path d=\"m1332 1299h1390v6.88h-1390zm1365-22.1 30.7 25.6-30.7 25.6c-1.46 1.21-3.63 1.02-4.84-0.44-1.22-1.46-1.02-3.63 0.44-4.84l27.5-22.9v5.28l-27.5-22.9c-1.46-1.21-1.66-3.38-0.44-4.84 1.21-1.46 3.38-1.65 4.84-0.44z\"/><g fill=\"#0070c0\" font-family=\"'Segoe UI', 'Segoe UI_MSFontService', sans-serif\" font-size=\"64px\" font-weight=\"400\"><text transform=\"translate(2734 1521)\">State after</text><text transform=\"translate(2734 1598)\">the first </text><text transform=\"translate(2969 1598)\">reflection</text></g></g></svg>\n\n\"Reflection about the mean\" is an operation for which the visual definition is much more intuitive than the mathematical one.\nIt is literally a reflection about the state $\\ket{\\text{all}}$ - the uniform superposition of all basis states in the search space. \n\nMathematically, this operation is described as $2\\ket{\\text{all}}\\bra{\\text{all}} - I$: it leaves the component of the input state parallel to the state $\\ket{\\text{all}}$ unchanged and multiplies the component orthogonal to it by $-1$.\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg width=\"428\" height=\"374\" overflow=\"hidden\" version=\"1.1\" xml:space=\"preserve\" xmlns=\"http://www.w3.org/2000/svg\"><defs><linearGradient id=\"fill0\" x1=\"2874\" x2=\"2874\" y1=\"1061\" y2=\"1188\" gradientUnits=\"userSpaceOnUse\" spreadMethod=\"reflect\"><stop offset=\"0\"/><stop offset=\".0292\"/><stop offset=\".3\"/><stop offset=\"1\"/></linearGradient><linearGradient id=\"fill3\" x1=\"2065\" x2=\"2065\" y1=\"482\" y2=\"609\" gradientUnits=\"userSpaceOnUse\" spreadMethod=\"reflect\"><stop offset=\"0\"/><stop offset=\".0292\"/><stop offset=\".3\"/><stop offset=\"1\"/></linearGradient><linearGradient id=\"fill6\" x1=\"2922\" x2=\"2922\" y1=\"1241\" y2=\"1368\" gradientUnits=\"userSpaceOnUse\" spreadMethod=\"reflect\"><stop offset=\"0\"/><stop offset=\".0292\"/><stop offset=\".3\"/><stop offset=\"1\"/></linearGradient></defs><g transform=\"matrix(.25 0 0 .25 -338 -124)\"><path d=\"m2319 1062c42.5 44.9 72.4 100 86.6 160\" fill=\"none\" fill-rule=\"evenodd\" stroke=\"#0070c0\" stroke-miterlimit=\"8\" stroke-width=\"6.88\"/><path d=\"m1356 1305c0-378 317-684 708-684s708 306 708 684c0 378-317 684-708 684s-708-306-708-684z\" fill=\"none\" fill-rule=\"evenodd\" stroke=\"#000\" stroke-miterlimit=\"8\" stroke-width=\"6.88\"/><path d=\"m1356 1302h1410v6.88h-1410zm1385-22.1 30.7 25.6-30.7 25.6c-1.46 1.21-3.63 1.02-4.84-0.44-1.22-1.46-1.02-3.63 0.44-4.84l27.5-22.9v5.28l-27.5-22.9c-1.46-1.21-1.66-3.38-0.44-4.84 1.21-1.46 3.38-1.65 4.84-0.44z\"/><path d=\"m2067 626v1364h-6.88v-1364zm-29 25.3 25.6-30.7 25.6 30.7c1.21 1.46 1.02 3.63-0.44 4.84-1.46 1.22-3.63 1.02-4.84-0.44l-22.9-27.5h5.28l-22.9 27.5c-1.21 1.46-3.38 1.66-4.84 0.44-1.46-1.22-1.65-3.38-0.44-4.84z\"/><path d=\"m2785 1075h6.92v83.6h-6.92z\" fill=\"url(#fill0)\" fill-rule=\"evenodd\"/><text x=\"2784.6899\" y=\"1148.25\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"83.6px\">|</text><path d=\"m2832 1099c-3.09 0-5.86 1.25-8.32 3.73-2.45 2.49-4.37 5.82-5.75 10-1.37 4.17-2.06 8.35-2.06 12.5 0 3.11 0.43 5.44 1.28 6.98 0.85 1.55 2.28 2.32 4.29 2.32 1.98 0 3.91-0.86 5.82-2.56 1.9-1.71 3.86-4.14 5.88-7.3s3.45-6.81 4.29-10.9l0.41-1.93c0.26-1.23 0.44-2.29 0.53-3.19s0.14-1.88 0.14-2.92c0-2.31-0.5-4-1.48-5.08-0.99-1.08-2.67-1.62-5.03-1.62zm-0.9-3.55c1.94 0 3.76 0.22 5.46 0.66 1.69 0.43 3.43 1.2 5.23 2.31l4.13-2.97 2.88 0.72-6.61 28.5c-0.66 2.85-0.99 5.07-0.99 6.65 0 1.2 0.2 2.07 0.59 2.61s1 0.81 1.84 0.81c0.9 0 1.86-0.37 2.88-1.1 1.01-0.74 2.45-2.14 4.31-4.2l2.56 2.51c-2.7 2.88-5 4.92-6.9 6.13-1.9 1.22-3.96 1.82-6.17 1.82-1.86 0-3.34-0.61-4.45-1.84s-1.66-2.86-1.66-4.9c0-1.64 0.34-3.4 1.03-5.25l-0.58-0.18c-2.88 4.19-5.6 7.26-8.18 9.21-2.58 1.94-5.3 2.92-8.18 2.92-3.29 0-5.84-1.25-7.65-3.73-1.82-2.49-2.72-5.98-2.72-10.5 0-5.15 1.01-10.1 3.03-14.8 2.02-4.75 4.8-8.49 8.33-11.2 3.54-2.74 7.47-4.11 11.8-4.11zm75.2-20.5h2.65l-11.1 49.7c-0.65 2.97-0.98 5.18-0.98 6.65 0 1.2 0.19 2.07 0.58 2.61s1 0.81 1.84 0.81c0.9 0 1.86-0.37 2.88-1.1 1.02-0.74 2.45-2.14 4.31-4.2l2.56 2.51c-2.9 3.06-5.28 5.14-7.12 6.27-1.84 1.12-3.9 1.68-6.18 1.68-1.94 0-3.5-0.71-4.67-2.13s-1.75-3.24-1.75-5.46c0-2.01 0.42-4.91 1.26-8.71l8.04-36c0.36-1.58 0.61-2.85 0.76-3.79 0.15-0.95 0.23-1.82 0.23-2.63 0-0.9-0.17-1.58-0.5-2.04-0.33-0.47-0.8-0.81-1.41-1.02-0.62-0.2-1.72-0.35-3.3-0.44l0.53-2.34zm-29 0h2.65l-11.1 49.7c-0.65 2.97-0.98 5.18-0.98 6.65 0 1.2 0.19 2.07 0.58 2.61s1 0.81 1.84 0.81c0.9 0 1.86-0.37 2.88-1.1 1.02-0.74 2.45-2.14 4.31-4.2l2.56 2.51c-2.9 3.06-5.28 5.14-7.12 6.27-1.84 1.12-3.9 1.68-6.18 1.68-1.94 0-3.5-0.71-4.67-2.13s-1.75-3.24-1.75-5.46c0-2.01 0.42-4.91 1.26-8.71l8.04-36c0.36-1.58 0.61-2.85 0.76-3.79 0.15-0.95 0.23-1.82 0.23-2.63 0-0.9-0.17-1.58-0.5-2.04-0.33-0.47-0.8-0.81-1.41-1.02-0.62-0.2-1.72-0.35-3.3-0.44l0.53-2.34z\" fill=\"url(#fill0)\" fill-rule=\"evenodd\"/><text x=\"2807.53\" y=\"1131.98\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"65px\">𝑎𝑙𝑙</text><path d=\"m2925 1075 17.9 40.3v3.32l-17.9 40.4-4.81-1.7 14.4-40.3-14.4-40.4z\" fill=\"url(#fill0)\" fill-rule=\"evenodd\"/><text x=\"2919.9099\" y=\"1148.42\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"84px\">〉</text><path d=\"m1927 496h6.91v83.6h-6.91z\" fill=\"url(#fill3)\" fill-rule=\"evenodd\"/><text x=\"1927.0699\" y=\"569.07397\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"83.6px\">|</text><path d=\"m2079 520c-3.11 0-5.83 1.3-8.15 3.91-2.32 2.6-4.15 6.33-5.48 11.2-1.33 4.85-2 9.03-2 12.5 0 3.29 0.68 5.73 2.05 7.3 1.36 1.57 3.42 2.36 6.17 2.36 2.94 0 5.54-1.32 7.82-3.95 2.28-2.64 4.07-6.33 5.39-11.1 1.32-4.75 1.98-8.92 1.98-12.5 0-3.24-0.63-5.67-1.89-7.3s-3.22-2.45-5.89-2.45zm-49 0c-3.11 0-5.83 1.3-8.15 3.91-2.32 2.6-4.15 6.33-5.48 11.2-1.33 4.85-2 9.03-2 12.5 0 3.29 0.68 5.73 2.05 7.3 1.36 1.57 3.42 2.36 6.17 2.36 2.94 0 5.54-1.32 7.82-3.95 2.28-2.64 4.07-6.33 5.39-11.1 1.32-4.75 1.98-8.92 1.98-12.5 0-3.24-0.63-5.67-1.89-7.3s-3.22-2.45-5.89-2.45zm98.3-0.09c-3.05 0-5.79 1.24-8.22 3.71-2.42 2.47-4.33 5.8-5.72 10-1.4 4.19-2.09 8.37-2.09 12.5 0 3.12 0.42 5.44 1.28 6.99 0.85 1.54 2.28 2.31 4.29 2.31 0.93 0 1.87-0.202 2.83-0.606 0.96-0.405 1.95-1.06 2.98-1.95 1.04-0.899 2.06-1.99 3.06-3.28s1.92-2.58 2.76-3.89c0.84-1.3 1.62-2.84 2.34-4.63 0.72-1.78 1.33-3.93 1.84-6.45l0.4-1.93c0.45-2.16 0.68-4.19 0.68-6.11 0-2.34-0.5-4.04-1.48-5.1-0.99-1.06-2.64-1.6-4.95-1.6zm-148 0c-3.05 0-5.79 1.24-8.22 3.71-2.42 2.47-4.33 5.8-5.72 10-1.4 4.19-2.09 8.37-2.09 12.5 0 3.12 0.45 5.44 1.34 6.99 0.9 1.54 2.31 2.31 4.23 2.31 1.52 0 3.04-0.524 4.56-1.57 1.51-1.05 3.13-2.71 4.85-4.99s3.06-4.45 4.02-6.51c0.96-2.07 1.77-4.64 2.45-7.73 0.67-3.08 1.01-5.76 1.01-8.04 0-2.34-0.5-4.04-1.48-5.1-0.99-1.06-2.64-1.6-4.95-1.6zm100-3.5c4.79 0 8.45 1.31 11 3.93 2.52 2.62 3.78 6.37 3.78 11.3 0 3.47-0.61 7.19-1.82 11.1s-2.88 7.28-4.99 9.97-4.63 4.72-7.57 6.09c-2.93 1.36-6.3 2.04-10.1 2.04-4.65 0-8.25-1.3-10.8-3.91-2.56-2.6-3.84-6.35-3.84-11.2 0-2.4 0.36-5.17 1.08-8.31 0.93-4.25 2.48-7.97 4.67-11.1 2.19-3.18 4.88-5.61 8.09-7.3 3.2-1.69 6.72-2.54 10.6-2.54zm-49 0c4.79 0 8.45 1.31 11 3.93 2.52 2.62 3.78 6.37 3.78 11.3 0 3.47-0.61 7.19-1.82 11.1s-2.88 7.28-4.99 9.97-4.63 4.72-7.57 6.09c-2.93 1.36-6.3 2.04-10.1 2.04-4.65 0-8.25-1.3-10.8-3.91-2.56-2.6-3.84-6.35-3.84-11.2 0-2.4 0.36-5.17 1.08-8.31 0.93-4.25 2.48-7.97 4.67-11.1 2.19-3.18 4.88-5.61 8.09-7.3 3.2-1.69 6.72-2.54 10.6-2.54zm-51.7-0.045c1.88 0 3.66 0.225 5.34 0.674s3.37 1.21 5.08 2.29l4.13-2.96 2.88 0.719-4.63 20.9c-0.33 1.47-1.08 5.17-2.25 11.1-1.23 6.29-2.22 10.7-2.98 13.3-0.77 2.6-1.72 4.98-2.86 7.12s-2.6 4-4.4 5.59c-1.8 1.59-3.98 2.82-6.54 3.68-2.56 0.869-5.59 1.3-9.09 1.3-11.3 0-17-3.29-17-9.88 0-1.68 0.51-3.2 1.52-4.58 1.02-1.38 2.65-2.83 4.9-4.36l3.24 2.6c-0.57 0.689-1.05 1.37-1.44 2.04s-0.67 1.32-0.83 1.95c-0.17 0.629-0.25 1.38-0.25 2.25 0 2.25 0.81 3.89 2.43 4.92 1.61 1.03 4.05 1.55 7.32 1.55 3.68 0 6.64-0.831 8.87-2.49s4.14-4.34 5.73-8.02c1.58-3.68 3.13-9.25 4.62-16.7l-0.62-0.135c-2.91 3.98-5.61 6.89-8.09 8.72-2.49 1.83-5.17 2.74-8.04 2.74-3.27 0-5.8-1.23-7.62-3.68-1.81-2.46-2.71-5.96-2.71-10.5 0-5.12 1-10 3.01-14.8 2-4.72 4.79-8.47 8.35-11.3 3.57-2.78 7.53-4.18 11.9-4.18zm168-20.5h2.65l-11.2 49.7c-0.66 2.94-0.99 5.15-0.99 6.65 0 1.2 0.2 2.07 0.59 2.6s1 0.809 1.84 0.809c0.9 0 1.86-0.367 2.87-1.1 1.02-0.734 2.46-2.13 4.32-4.2l2.56 2.52c-2.76 2.9-5.08 4.96-6.97 6.15-1.88 1.2-3.92 1.8-6.11 1.8-1.85 0-3.33-0.614-4.44-1.84s-1.66-2.86-1.66-4.9c0-1.65 0.34-3.4 1.03-5.26l-0.59-0.18c-2.87 4.19-5.6 7.26-8.17 9.21-2.58 1.95-5.3 2.92-8.18 2.92-3.29 0-5.84-1.24-7.66-3.73-1.81-2.48-2.71-5.97-2.71-10.5 0-5.15 1.01-10.1 3.03-14.8s4.8-8.49 8.33-11.2c3.54-2.74 7.47-4.11 11.8-4.11 1.82 0 3.51 0.187 5.05 0.562 1.54 0.374 3.12 1.02 4.74 1.95l2.33-10.4c0.24-0.989 0.45-2.08 0.63-3.28s0.27-2.25 0.27-3.14c0-0.899-0.16-1.58-0.49-2.04s-0.8-0.801-1.42-1.01c-0.61-0.209-1.71-0.359-3.3-0.449l0.54-2.34z\" fill=\"url(#fill3)\" fill-rule=\"evenodd\"/><text x=\"1946.54\" y=\"569.74799\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"84.3px\">𝑔𝑜𝑜𝑑</text><path d=\"m2164 496 17.9 40.3v3.32l-17.9 40.4-4.81-1.71 14.4-40.3-14.4-40.4z\" fill=\"url(#fill3)\" fill-rule=\"evenodd\"/><text x=\"2159.6799\" y=\"569.24298\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"84px\">〉</text><path transform=\"matrix(1 0 0 -1 2064 1305)\" d=\"m0.823-3.34 678 167-1.64 6.68-678-167zm659 140 23.7 32.2-35.9 17.5c-1.71 0.831-3.76 0.121-4.6-1.58-0.831-1.71-0.121-3.76 1.59-4.6l32.2-15.7-1.26 5.13-21.2-28.8c-1.13-1.53-0.798-3.68 0.731-4.81 1.53-1.12 3.68-0.798 4.81 0.731z\"/><path d=\"m2811 1255h6.92v83.6h-6.92z\" fill=\"url(#fill6)\" fill-rule=\"evenodd\"/><text x=\"2811.4199\" y=\"1328.05\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"83.6px\">|</text><path d=\"m2861 1281c-1.44 0-2.86 0.46-4.25 1.37-1.39 0.92-2.94 2.43-4.65 4.54-1.7 2.11-3.1 4.27-4.18 6.49-1.07 2.22-1.99 5.05-2.74 8.49l-0.4 1.89c-0.45 2.09-0.67 4.13-0.67 6.11 0 2.36 0.51 4.07 1.55 5.12 1.03 1.05 2.74 1.57 5.14 1.57 1.23 0 2.4-0.2 3.5-0.61 1.11-0.4 2.24-1.07 3.4-2 1.15-0.92 2.24-2.14 3.27-3.66 1.04-1.51 1.99-3.37 2.86-5.59s1.54-4.59 2.02-7.12 0.72-4.95 0.72-7.25c0-3.12-0.44-5.46-1.33-7.01-0.88-1.56-2.3-2.34-4.24-2.34zm97.4-1.75c-3.05 0-5.79 1.24-8.22 3.71s-4.33 5.8-5.73 9.99c-1.39 4.19-2.09 8.37-2.09 12.5 0 3.12 0.43 5.45 1.28 6.99 0.86 1.54 2.29 2.31 4.29 2.31 0.93 0 1.88-0.2 2.83-0.6 0.96-0.41 1.96-1.06 2.99-1.96 1.04-0.9 2.05-1.99 3.06-3.28 1-1.28 1.92-2.58 2.76-3.88 0.84-1.31 1.62-2.85 2.34-4.63 0.71-1.78 1.33-3.93 1.84-6.45l0.4-1.93c0.45-2.15 0.68-4.19 0.68-6.11 0-2.33-0.5-4.03-1.49-5.1-0.99-1.06-2.63-1.59-4.94-1.59zm-50.9 0c-3.08 0-5.85 1.24-8.31 3.73-2.46 2.48-4.37 5.82-5.75 9.99-1.38 4.18-2.07 8.35-2.07 12.5 0 3.12 0.43 5.45 1.28 6.99 0.86 1.54 2.29 2.31 4.29 2.31 1.98 0 3.92-0.85 5.82-2.56 1.9-1.7 3.87-4.14 5.89-7.3s3.45-6.8 4.29-10.9l0.4-1.93c0.27-1.23 0.45-2.29 0.54-3.19s0.13-1.87 0.13-2.92c0-2.3-0.49-4-1.48-5.07-0.99-1.08-2.66-1.62-5.03-1.62zm-0.9-3.55c1.95 0 3.77 0.22 5.46 0.65 1.69 0.44 3.44 1.21 5.23 2.32l4.14-2.97 2.87 0.72-6.6 28.5c-0.66 2.85-0.99 5.06-0.99 6.65 0 1.2 0.19 2.06 0.58 2.6s1.01 0.81 1.85 0.81c0.89 0 1.85-0.36 2.87-1.1 1.02-0.73 2.46-2.13 4.31-4.2l2.56 2.52c-2.69 2.87-4.99 4.92-6.89 6.13s-3.96 1.82-6.18 1.82c-1.85 0-3.34-0.62-4.45-1.84-1.1-1.23-1.66-2.86-1.66-4.9 0-1.65 0.35-3.4 1.04-5.26l-0.59-0.18c-2.87 4.2-5.6 7.27-8.17 9.21-2.58 1.95-5.3 2.92-8.18 2.92-3.29 0-5.85-1.24-7.66-3.72-1.81-2.49-2.72-5.98-2.72-10.5 0-5.15 1.01-10.1 3.04-14.8 2.02-4.75 4.79-8.49 8.33-11.2 3.53-2.74 7.47-4.11 11.8-4.11zm70.6-20.5h2.65l-11.2 49.7c-0.66 2.93-0.99 5.15-0.99 6.65 0 1.2 0.19 2.06 0.58 2.6s1.01 0.81 1.85 0.81c0.89 0 1.85-0.36 2.87-1.1 1.02-0.73 2.46-2.13 4.31-4.2l2.56 2.52c-2.75 2.9-5.07 4.95-6.96 6.15s-3.92 1.8-6.11 1.8c-1.85 0-3.34-0.62-4.45-1.84-1.1-1.23-1.66-2.86-1.66-4.9 0-1.65 0.35-3.4 1.04-5.26l-0.59-0.18c-2.87 4.2-5.6 7.27-8.17 9.21-2.58 1.95-5.3 2.92-8.18 2.92-3.29 0-5.85-1.24-7.66-3.72-1.81-2.49-2.72-5.98-2.72-10.5 0-5.15 1.01-10.1 3.04-14.8 2.02-4.75 4.79-8.49 8.33-11.2 3.53-2.74 7.47-4.11 11.8-4.11 1.83 0 3.51 0.19 5.06 0.56 1.54 0.38 3.12 1.03 4.74 1.96l2.33-10.4c0.24-0.99 0.45-2.08 0.63-3.28s0.27-2.25 0.27-3.14c0-0.9-0.16-1.58-0.49-2.05-0.33-0.46-0.8-0.8-1.42-1.01-0.61-0.21-1.71-0.36-3.3-0.45l0.54-2.33zm-124 0h2.6l-7.91 31.4 0.59 0.18c2.9-3.9 5.63-6.71 8.17-8.45 2.55-1.74 5.1-2.6 7.64-2.6 3.27 0 5.8 1.24 7.62 3.72 1.81 2.49 2.71 5.99 2.71 10.5 0 4.94-0.99 9.8-2.98 14.6-2 4.78-4.76 8.57-8.29 11.4-3.54 2.8-7.49 4.2-11.9 4.2-3.98 0-7.52-0.97-10.6-2.92l-4.14 2.92-2.87-0.72 11.6-51.4c0.69-3.05 1.04-5.27 1.04-6.64 0-1.26-0.38-2.15-1.15-2.65-0.76-0.51-2.13-0.8-4.11-0.86l0.54-2.33z\" fill=\"url(#fill6)\" fill-rule=\"evenodd\"/><text x=\"2833.6799\" y=\"1311.78\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"65px\">𝑏𝑎𝑑</text><path d=\"m3e3 1255 17.9 40.3v3.33l-17.9 40.4-4.81-1.71 14.4-40.3-14.4-40.4z\" fill=\"url(#fill6)\" fill-rule=\"evenodd\"/><text x=\"2990.76\" y=\"1328.21\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"84px\">〉</text><path d=\"m2449 1254c-1.12 5.16-1.67 9.49-1.67 13 0 2.66 0.4 4.62 1.21 5.87 0.81 1.24 2.11 1.87 3.92 1.87 2.66 0 5.19-1.79 7.57-5.37 2.39-3.57 4.42-8.7 6.08-15.4zm14.6-24c-2.78 0-5.36 1.76-7.72 5.27-2.37 3.52-4.38 8.56-6.04 15.1h17.1c1.12-5.02 1.68-9.33 1.68-12.9 0-2.5-0.41-4.36-1.22-5.6-0.8-1.24-2.06-1.85-3.77-1.85zm0.42-2.89c6.89 0 10.3 4.37 10.3 13.1 0 2.47-0.28 5.42-0.84 8.85-0.56 3.44-1.44 6.94-2.65 10.5-1.21 3.57-2.75 6.72-4.6 9.47-1.85 2.74-3.99 4.86-6.42 6.36-2.42 1.5-5.03 2.24-7.84 2.24-3.54 0-6.18-1.08-7.91-3.24-1.74-2.16-2.6-5.41-2.6-9.73 0-2.35 0.26-5.25 0.78-8.7 0.52-3.44 1.38-6.97 2.58-10.6s2.75-6.79 4.64-9.59c1.89-2.79 4.06-4.94 6.52-6.45s5.13-2.26 8-2.26z\" fill-rule=\"evenodd\"/><text x=\"2441.72\" y=\"1271.74\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"50.5px\">𝜃</text><path d=\"m2067 1301 685 163-1.59 6.69-685-163zm666 136 23.9 32-35.8 17.8c-1.7 0.84-3.76 0.15-4.61-1.55-0.84-1.7-0.15-3.76 1.55-4.61l32.1-15.9-1.22 5.13-21.4-28.7c-1.14-1.52-0.83-3.67 0.69-4.81s3.68-0.83 4.82 0.69z\"/><path d=\"m2449 1350c-1.12 5.15-1.68 9.49-1.68 13 0 2.66 0.41 4.61 1.22 5.86 0.8 1.25 2.11 1.87 3.92 1.87 2.66 0 5.18-1.79 7.57-5.36 2.39-3.58 4.41-8.71 6.08-15.4zm14.6-24c-2.78 0-5.35 1.76-7.71 5.28-2.37 3.51-4.38 8.55-6.05 15.1h17.1c1.12-5.01 1.67-9.33 1.67-12.9 0-2.49-0.4-4.36-1.21-5.6-0.81-1.23-2.07-1.85-3.78-1.85zm0.43-2.89c6.89 0 10.3 4.38 10.3 13.1 0 2.47-0.28 5.42-0.84 8.86-0.56 3.43-1.44 6.93-2.66 10.5-1.21 3.56-2.74 6.71-4.59 9.46-1.86 2.74-4 4.86-6.42 6.36s-5.04 2.25-7.84 2.25c-3.54 0-6.18-1.08-7.91-3.25-1.74-2.16-2.61-5.4-2.61-9.73 0-2.35 0.27-5.25 0.79-8.69 0.52-3.45 1.38-6.97 2.58-10.6s2.75-6.8 4.64-9.59c1.88-2.79 4.06-4.94 6.52-6.45s5.13-2.27 8-2.27z\" fill-rule=\"evenodd\"/><text x=\"2441.6499\" y=\"1367.58\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"50.5px\">𝜃</text><path transform=\"matrix(1 0 0 -1 2062 1310)\" d=\"m2.4-2.46 498 484-4.79 4.93-498-484zm495 451 4.16 39.7-39.8-3.07c-1.89-0.146-3.31-1.8-3.16-3.69 0.145-1.89 1.8-3.31 3.69-3.16l35.7 2.75-3.68 3.79-3.73-35.6c-0.198-1.89 1.17-3.58 3.06-3.78 1.89-0.197 3.58 1.17 3.78 3.06z\" fill=\"#0070c0\"/><path d=\"m2443 1093c-1.12 5.16-1.68 9.5-1.68 13 0 2.66 0.41 4.61 1.22 5.86 0.8 1.25 2.11 1.87 3.92 1.87 2.66 0 5.18-1.79 7.57-5.36 2.39-3.58 4.42-8.71 6.08-15.4zm14.6-24c-2.78 0-5.35 1.76-7.71 5.28-2.37 3.51-4.38 8.55-6.04 15.1h17.1c1.12-5.01 1.67-9.33 1.67-12.9 0-2.49-0.4-4.36-1.21-5.6-0.81-1.23-2.07-1.85-3.78-1.85zm-46.7-2.14c4.42 0 7.76 0.97 10 2.91 2.25 1.93 3.38 4.74 3.38 8.43 0 1.26-0.12 2.41-0.37 3.47s-0.64 2.11-1.18 3.14c-0.53 1.03-1.25 2.14-2.15 3.33-0.91 1.19-1.9 2.4-3 3.62-1.09 1.22-2.98 3.26-5.67 6.11-4.51 4.78-7.83 8.95-9.94 12.5h13.4c1.16 0 2.1-0.07 2.81-0.21 0.72-0.14 1.29-0.38 1.71-0.71 0.43-0.34 0.77-0.77 1.02-1.3 0.25-0.54 0.56-1.36 0.95-2.48h3.02l-0.6 10.4h-29.3v-1.71c1.03-2.5 2.4-5.05 4.14-7.67 1.73-2.61 4.19-5.69 7.38-9.23 2.75-3.04 4.74-5.35 5.95-6.91 1.33-1.72 2.32-3.19 2.98-4.44 0.65-1.25 1.12-2.43 1.4-3.53 0.29-1.11 0.43-2.22 0.43-3.33 0-1.79-0.28-3.36-0.85-4.73-0.57-1.36-1.45-2.44-2.62-3.22-1.18-0.79-2.66-1.18-4.44-1.18-4.45 0-7.44 2.47-8.98 7.42h-4.32v-6.85c2.88-1.35 5.57-2.33 8.08-2.94 2.5-0.61 4.75-0.91 6.75-0.91zm47.1-0.75c6.89 0 10.3 4.38 10.3 13.1 0 2.47-0.28 5.42-0.84 8.86-0.56 3.43-1.44 6.93-2.65 10.5-1.22 3.56-2.75 6.71-4.6 9.46-1.86 2.74-3.99 4.86-6.42 6.36-2.42 1.5-5.04 2.25-7.84 2.25-3.54 0-6.18-1.08-7.91-3.25-1.74-2.16-2.61-5.4-2.61-9.73 0-2.35 0.27-5.25 0.79-8.69 0.52-3.45 1.38-6.97 2.58-10.6s2.75-6.8 4.64-9.59 4.06-4.94 6.52-6.45 5.13-2.27 8-2.27z\" fill=\"#0070c0\" fill-rule=\"evenodd\"/><text x=\"2395.01\" y=\"1110.6801\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"50.5px\">2𝜃</text><path d=\"m2406 1221c6.32 26.6 9.52 53.8 9.52 81.1\" fill=\"none\" fill-rule=\"evenodd\" stroke=\"#000\" stroke-miterlimit=\"8\" stroke-width=\"6.88\"/><path transform=\"matrix(1 0 0 -1 1716 1652)\" d=\"m688 263c7.29 28.4 11 57.7 11 87\" fill=\"none\" fill-rule=\"evenodd\" stroke=\"#000\" stroke-miterlimit=\"8\" stroke-width=\"6.88\"/><g fill=\"#0070c0\" font-family=\"'Segoe UI', 'Segoe UI_MSFontService', sans-serif\" font-size=\"64px\" font-weight=\"400\"><text transform=\"translate(2582 724)\">State after the</text><text transform=\"translate(2582 801)\">second </text><text transform=\"translate(2803 801)\">reflection</text></g></g></svg>\n\nAs we can see, the pair of these reflections combined amount to a counterclockwise rotation by an angle $2\\theta$. \nIf we repeat the Grover's iteration, reflecting the new state first along the horizontal axis and then along the $\\ket{\\text{all}}$ vector, it performs a rotation by $2\\theta$ again. The angle of this rotation depends only on the angle between the reflection axes and not on the state we reflect!\n\nEach iteration of Grover's search adds $2\\theta$ to the current angle in the expression of the system state as a superposition of $\\ket{\\text{good}}$ and $\\ket{\\text{bad}}$.\nAfter applying $R$ iterations of Grover's search the state of the system will become\n\n$$\\sin{(2R+1)\\theta}\\ket{\\text{good}} + \\cos{(2R+1)\\theta}\\ket{\\text{bad}}$$\n\nAt firat, each iteration brings the state of the system closer to the vertical axis, increasing the probability of measuring one of the basis states that are part of $\\ket{\\text{good}}$ - the states that are solutions to the problem."
|
|
6984
|
+
}
|
|
6985
|
+
]
|
|
6986
|
+
},
|
|
6987
|
+
{
|
|
6988
|
+
"type": "exercise",
|
|
6989
|
+
"id": "grovers_search__phase_oracle",
|
|
6990
|
+
"title": "Phase Oracle from Marking Oracle",
|
|
6991
|
+
"description": {
|
|
6992
|
+
"type": "text-content",
|
|
6993
|
+
"content": "**Inputs:**\n\n 1. A marking oracle implementing an unknown $N$-bit function $f(x)$.\n 2. $N$ qubits in an arbitrary state (input/query register).\n \n**Goal:**\n\nFlip the phase of each basis state $\\ket{x}$ for which $f(x) = 1$. You can only access $f(x)$ via the marking oracle you are given.\n\nThe operation you implement is the phase oracle for the same function.\n\n<br/>\n<details>\n <summary><b>Need a hint?</b></summary>\n Recall that you can allocate extra qubits to assist in this operation. Is there a state that you could prepare with an auxiliary qubit which would help you to convert the marking oracle to a phase oracle?\n</details>\n"
|
|
6994
|
+
},
|
|
6995
|
+
"sourceIds": [
|
|
6996
|
+
"grovers_search__phase_oracle__Verification.qs",
|
|
6997
|
+
"KatasLibrary.qs"
|
|
6998
|
+
],
|
|
6999
|
+
"placeholderCode": "namespace Kata {\n operation ApplyMarkingOracleAsPhaseOracle(\n markingOracle : (Qubit[], Qubit) => Unit is Adj + Ctl,\n qubits : Qubit[])\n : Unit is Adj + Ctl {\n // Implement your solution here...\n\n }\n}\n",
|
|
7000
|
+
"explainedSolution": {
|
|
7001
|
+
"type": "explained-solution",
|
|
7002
|
+
"items": [
|
|
7003
|
+
{
|
|
7004
|
+
"type": "text-content",
|
|
7005
|
+
"content": "\nAs we saw in the Oracles kata, we can allocate an additional qubit in the $\\ket{-}$ state and use it as the target for our marking oracle.\nThis will kick back the $-1$ relative phase for the basis states $\\ket{x}$ of the input register for which $f(x) = 1$."
|
|
7006
|
+
},
|
|
7007
|
+
{
|
|
7008
|
+
"type": "solution",
|
|
7009
|
+
"id": "grovers_search__phase_oracle_solution",
|
|
7010
|
+
"code": "namespace Kata {\n operation ApplyMarkingOracleAsPhaseOracle(\n markingOracle : (Qubit[], Qubit) => Unit is Adj + Ctl,\n qubits : Qubit[])\n : Unit is Adj + Ctl {\n use minus = Qubit();\n within {\n X(minus);\n H(minus);\n } apply {\n markingOracle(qubits, minus);\n }\n }\n}\n"
|
|
7011
|
+
}
|
|
7012
|
+
]
|
|
7013
|
+
}
|
|
7014
|
+
},
|
|
7015
|
+
{
|
|
7016
|
+
"type": "exercise",
|
|
7017
|
+
"id": "grovers_search__conditional_phase_flip",
|
|
7018
|
+
"title": "Conditional Phase Flip",
|
|
7019
|
+
"description": {
|
|
7020
|
+
"type": "text-content",
|
|
7021
|
+
"content": "**Input:** A register of $N$ qubits in an arbitrary state.\n\n**Goal:** Flip the sign of the state of the register if it is *not* in the $\\ket{0...0}$ state.\nThat is, if the register is in state $\\ket{0...0}$, leave it unchanged,\nbut if it is in any other basis state, multiply its phase by $-1$.\n\n> This operation implements operator \n> $$2\\ket{0...0}\\bra{0...0} - I = \n\\begin{bmatrix}\n 1 & 0 & ... & 0 \\\\\n 0 &-1 & ... & 0 \\\\\n \\vdots & \\vdots & \\ddots & \\vdots \\\\ \n 0 & 0 & ... & -1\n\\end{bmatrix}$$\n"
|
|
7022
|
+
},
|
|
7023
|
+
"sourceIds": [
|
|
7024
|
+
"grovers_search__conditional_phase_flip__Verification.qs",
|
|
7025
|
+
"KatasLibrary.qs"
|
|
7026
|
+
],
|
|
7027
|
+
"placeholderCode": "namespace Kata {\n operation ConditionalPhaseFlip(qs : Qubit[]) : Unit is Adj + Ctl {\n // Implement your solution here...\n\n }\n}\n",
|
|
7028
|
+
"explainedSolution": {
|
|
7029
|
+
"type": "explained-solution",
|
|
7030
|
+
"items": [
|
|
7031
|
+
{
|
|
7032
|
+
"type": "text-content",
|
|
7033
|
+
"content": "\nThis operation is equivalent to the operation of flipping the sign of only the $\\ket{0...0}$ basis state, with an additional global phase $-1$.\nThis means that you can implement it in two steps:\n\n1. Flip the sign of the $\\ket{0...0}$ basis state.\n You can do this by applying $X$ gates to all qubits, then using the Controlled $Z$ gate to flip the sign of $\\ket{1...1}$, and then applying $X$ gates to all qubits again.\n2. Apply a global phase $-1$ to the whole state using an `R1` gate."
|
|
7034
|
+
},
|
|
7035
|
+
{
|
|
7036
|
+
"type": "solution",
|
|
7037
|
+
"id": "grovers_search__conditional_phase_flip_solution",
|
|
7038
|
+
"code": "namespace Kata {\n open Microsoft.Quantum.Math;\n operation ConditionalPhaseFlip(qs : Qubit[]) : Unit is Adj + Ctl {\n within {\n ApplyToEachA(X, qs);\n } apply {\n Controlled Z(qs[1 ...], qs[0]);\n }\n R(PauliI, 2.0 * PI(), qs[0]);\n }\n}\n"
|
|
7039
|
+
}
|
|
7040
|
+
]
|
|
7041
|
+
}
|
|
7042
|
+
},
|
|
7043
|
+
{
|
|
7044
|
+
"type": "exercise",
|
|
7045
|
+
"id": "grovers_search__reflection_about_state",
|
|
7046
|
+
"title": "Reflection about Arbitrary State",
|
|
7047
|
+
"description": {
|
|
7048
|
+
"type": "text-content",
|
|
7049
|
+
"content": "**Inputs:**\n\n1. $N$ qubits in an arbitrary state.\n2. An operation $P$ that prepares an $N$-qubit state $\\ket{\\psi}$ from the state $\\ket{0...0}$.\n \n**Goal:**\n\nReflect the state of the given qubits about the state $\\ket{\\psi}$.\nIn other words, implement an operation $2\\ket{\\psi}\\bra{\\psi} - I$.\n\nThis operation allows you to implement the \"reflection about the mean\" operation, if you use the operation that prepares the mean as the input.\n"
|
|
7050
|
+
},
|
|
7051
|
+
"sourceIds": [
|
|
7052
|
+
"grovers_search__reflection_about_state__Verification.qs",
|
|
7053
|
+
"KatasLibrary.qs"
|
|
7054
|
+
],
|
|
7055
|
+
"placeholderCode": "namespace Kata {\n open Microsoft.Quantum.Math;\n\n operation ReflectionAboutState(\n qs : Qubit[],\n statePrep : Qubit[] => Unit is Adj + Ctl)\n : Unit is Adj + Ctl {\n // Implement your solution here...\n\n }\n\n // You might find this helper operation from an earlier task useful.\n operation ConditionalPhaseFlip(qs : Qubit[]) : Unit is Adj + Ctl {\n within {\n ApplyToEachA(X, qs);\n } apply {\n Controlled Z(qs[1 ...], qs[0]);\n }\n R(PauliI, 2.0 * PI(), qs[0]);\n }\n}\n",
|
|
7056
|
+
"explainedSolution": {
|
|
7057
|
+
"type": "explained-solution",
|
|
7058
|
+
"items": [
|
|
7059
|
+
{
|
|
7060
|
+
"type": "text-content",
|
|
7061
|
+
"content": "\nYou know that $P\\ket{0...0} = \\ket{\\psi}$.\nYou can use this and the fact that $I = PP^\\dagger$ to write the following representation of the operation you need to implement:\n\n$$2\\ket{\\psi}\\bra{\\psi} - I = 2P\\ket{0...0}\\bra{0...}P^\\dagger - I =$$\n$$= 2P\\ket{0...0}\\bra{0...0}P^\\dagger - PP^\\dagger = P(2\\ket{0...0}\\bra{0...0} - I)P^\\dagger$$\n\nThe middle operation is exactly the conditional phase flip you implemented in the previous exercise.\nThe overall solution is:\n\n1. Apply adjoint of the given operation $P$.\n2. Apply the conditional phase flip from the previous exercise.\n3. Apply the given operation $P$."
|
|
7062
|
+
},
|
|
7063
|
+
{
|
|
7064
|
+
"type": "solution",
|
|
7065
|
+
"id": "grovers_search__reflection_about_state_solution",
|
|
7066
|
+
"code": "namespace Kata {\n open Microsoft.Quantum.Math;\n\n operation ReflectionAboutState(\n qs : Qubit[],\n statePrep : Qubit[] => Unit is Adj + Ctl)\n : Unit is Adj + Ctl {\n within {\n Adjoint statePrep(qs);\n } apply {\n ConditionalPhaseFlip(qs);\n }\n }\n\n operation ConditionalPhaseFlip(qs : Qubit[]) : Unit is Adj + Ctl {\n within {\n ApplyToEachA(X, qs);\n } apply {\n Controlled Z(qs[1 ...], qs[0]);\n }\n R(PauliI, 2.0 * PI(), qs[0]);\n }\n}\n"
|
|
7067
|
+
}
|
|
7068
|
+
]
|
|
7069
|
+
}
|
|
7070
|
+
},
|
|
7071
|
+
{
|
|
7072
|
+
"type": "lesson",
|
|
7073
|
+
"id": "grovers_search__iterations",
|
|
7074
|
+
"title": "Optimal Number of Iterations",
|
|
7075
|
+
"items": [
|
|
7076
|
+
{
|
|
7077
|
+
"type": "text-content",
|
|
7078
|
+
"content": "\nThe optimal number of iterations to use in Grover's search algorithm is typically defined as the number of iterations \nafter which the success probability of the algorithm - the probability of measuring one of the \"good\" states - is maximized.\n\nGeometrically, this means that the state vector should be rotated to be as close to the vertical axis as possible.\nMathematically, this means maximizing the ampitude $\\sin{(2R+1)\\theta}$ of the state $\\ket{\\text{good}}$ \nin the superposition.\nWith either definition, the goal is to have the angle $(2R+1)\\theta$ that describes the system after $R$ rotations\nas close to $\\frac{\\pi}{2}$ as possible:\n\n$$(2R+1)\\theta \\approx \\frac{\\pi}{2}$$\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg width=\"421\" height=\"383\" overflow=\"hidden\" version=\"1.1\" xml:space=\"preserve\" xmlns=\"http://www.w3.org/2000/svg\"><defs><linearGradient id=\"fill3\" x1=\"2073\" x2=\"2073\" y1=\"475\" y2=\"601\" gradientUnits=\"userSpaceOnUse\" spreadMethod=\"reflect\"><stop offset=\"0\"/><stop offset=\".0292\"/><stop offset=\".3\"/><stop offset=\"1\"/></linearGradient><linearGradient id=\"fill6\" x1=\"2933\" x2=\"2933\" y1=\"1228\" y2=\"1354\" gradientUnits=\"userSpaceOnUse\" spreadMethod=\"reflect\"><stop offset=\"0\"/><stop offset=\".0292\"/><stop offset=\".3\"/><stop offset=\"1\"/></linearGradient></defs><g transform=\"matrix(.25 0 0 .25 -335 -117)\"><path d=\"m1344 1304c0-384 321-694 718-694s718 311 718 694c0 384-321 694-718 694s-718-311-718-694z\" fill=\"none\" fill-rule=\"evenodd\" stroke=\"#000\" stroke-miterlimit=\"8\" stroke-width=\"6.88\"/><path d=\"m1344 1300h1430v6.88h-1430zm1405-22.1 30.7 25.6-30.7 25.6c-1.46 1.21-3.63 1.02-4.84-0.44-1.22-1.46-1.02-3.63 0.44-4.84l27.5-22.9v5.28l-27.5-22.9c-1.46-1.21-1.66-3.38-0.44-4.84 1.21-1.46 3.38-1.65 4.84-0.44z\"/><path d=\"m2065 615v1383h-6.88v-1383zm-29 25.3 25.6-30.7 25.6 30.7c1.21 1.46 1.02 3.63-0.44 4.84-1.46 1.22-3.63 1.02-4.84-0.44l-22.9-27.5h5.28l-22.9 27.5c-1.21 1.46-3.38 1.66-4.84 0.44s-1.65-3.38-0.44-4.84z\"/><path transform=\"matrix(1 0 0 -1 2062 1304)\" d=\"m0.823-3.34 688 170-1.65 6.68-688-170zm669 142 23.7 32.2-35.9 17.5c-1.71 0.831-3.76 0.121-4.6-1.58-0.832-1.71-0.121-3.76 1.58-4.6l32.2-15.7-1.26 5.13-21.2-28.8c-1.12-1.53-0.798-3.68 0.731-4.81 1.53-1.12 3.68-0.798 4.81 0.732z\"/><path d=\"m2464 1246c-1.41 6.5-2.11 12-2.11 16.4 0 3.35 0.5 5.81 1.52 7.39 1.02 1.57 2.67 2.35 4.94 2.35 3.36 0 6.54-2.25 9.55-6.76 3.01-4.5 5.56-11 7.66-19.4zm18.4-30.3c-3.51 0-6.75 2.22-9.73 6.65s-5.52 10.8-7.61 19h21.5c1.41-6.32 2.11-11.8 2.11-16.3 0-3.14-0.5-5.5-1.52-7.05-1.02-1.56-2.61-2.34-4.76-2.34zm0.53-3.64c8.69 0 13 5.51 13 16.5 0 3.12-0.35 6.84-1.05 11.2-0.71 4.32-1.82 8.73-3.35 13.2-1.53 4.49-3.46 8.46-5.8 11.9-2.33 3.46-5.03 6.14-8.08 8.02-3.06 1.89-6.35 2.83-9.88 2.83-4.47 0-7.79-1.36-9.98-4.09-2.18-2.72-3.28-6.81-3.28-12.3 0-2.96 0.33-6.62 0.99-11s1.75-8.78 3.26-13.3 3.46-8.56 5.84-12.1 5.12-6.23 8.22-8.13c3.1-1.91 6.46-2.86 10.1-2.86z\" fill-rule=\"evenodd\"/><text x=\"2454.7\" y=\"1369.71\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"63.7px\"/><path d=\"m2463 1095c-1.41 6.5-2.11 12-2.11 16.4 0 3.35 0.51 5.82 1.52 7.39 1.02 1.57 2.67 2.36 4.95 2.36 3.35 0 6.53-2.26 9.54-6.76 3.01-4.51 5.56-11 7.66-19.4zm18.4-30.3c-3.51 0-6.75 2.21-9.73 6.64-2.98 4.44-5.52 10.8-7.61 19h21.5c1.41-6.32 2.12-11.8 2.12-16.3 0-3.14-0.51-5.49-1.53-7.05s-2.61-2.33-4.76-2.33zm-58.2-2.7c5.57 0 9.78 1.22 12.6 3.66 2.85 2.44 4.27 5.98 4.27 10.6 0 1.58-0.16 3.04-0.47 4.38-0.32 1.33-0.81 2.65-1.48 3.95-0.68 1.3-1.58 2.7-2.72 4.2s-2.4 3.02-3.78 4.56c-1.37 1.54-3.75 4.11-7.14 7.7-5.69 6.02-9.87 11.3-12.5 15.8h16.9c1.47 0 2.65-0.09 3.55-0.27s1.62-0.48 2.16-0.9 0.96-0.96 1.28-1.64c0.31-0.67 0.71-1.71 1.19-3.12h3.82l-0.77 13.1h-37v-2.16c1.29-3.14 3.03-6.36 5.21-9.66 2.19-3.29 5.29-7.17 9.3-11.6 3.48-3.83 5.98-6.74 7.51-8.72 1.67-2.15 2.92-4.02 3.75-5.59 0.82-1.57 1.41-3.05 1.77-4.45 0.36-1.39 0.54-2.79 0.54-4.2 0-2.24-0.36-4.23-1.08-5.95s-1.82-3.08-3.3-4.06c-1.48-0.99-3.35-1.49-5.59-1.49-5.6 0-9.38 3.12-11.3 9.35h-5.44v-8.63c3.62-1.7 7.02-2.94 10.2-3.7 3.16-0.77 5.99-1.15 8.51-1.15zm58.7-0.94c8.68 0 13 5.51 13 16.5 0 3.11-0.35 6.83-1.05 11.2-0.71 4.33-1.82 8.74-3.35 13.2s-3.46 8.47-5.79 11.9c-2.34 3.46-5.04 6.13-8.09 8.02-3.06 1.88-6.35 2.83-9.88 2.83-4.47 0-7.79-1.37-9.98-4.09-2.18-2.73-3.28-6.81-3.28-12.3 0-2.97 0.33-6.62 0.99-11 0.66-4.34 1.75-8.78 3.26-13.3 1.51-4.53 3.46-8.56 5.84-12.1s5.12-6.23 8.22-8.13 6.46-2.85 10.1-2.85z\" fill-rule=\"evenodd\"/><text x=\"2403.0801\" y=\"1117.16\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"63.7px\">2𝜃</text><path transform=\"matrix(1 0 0 -1 2062 1308)\" d=\"m3.34-0.795 161 676-6.69 1.59-161-676zm176 646-17.8 35.7-32-23.9c-1.52-1.14-1.83-3.29-0.691-4.81 1.14-1.52 3.29-1.83 4.81-0.69l28.7 21.5-5.14 1.22 15.9-32.1c0.845-1.7 2.91-2.39 4.61-1.55 1.7 0.845 2.39 2.91 1.55 4.61z\" fill=\"#0070c0\"/><g fill=\"none\" fill-rule=\"evenodd\" stroke-miterlimit=\"8\" stroke-width=\"6.88\"><path d=\"m2320 1057c43.2 45.4 73.5 102 88 163\" stroke=\"#000\"/><path d=\"m2145 956c67.8 16 129 51.7 177 103\" stroke=\"#0070c0\"/><path d=\"m2409 1219c6.43 27 9.68 54.6 9.68 82.3\" stroke=\"#000\"/></g><path d=\"m2291 924c-1.41 6.5-2.12 12-2.12 16.4 0 3.35 0.51 5.82 1.53 7.39s2.67 2.36 4.94 2.36c3.36 0 6.54-2.25 9.55-6.76s5.56-11 7.66-19.4zm18.4-30.3c-3.5 0-6.74 2.22-9.72 6.65s-5.52 10.8-7.62 19h21.5c1.41-6.32 2.11-11.8 2.11-16.3 0-3.14-0.51-5.5-1.52-7.05-1.02-1.56-2.61-2.34-4.77-2.34zm-58.2-2.7c5.57 0 9.77 1.22 12.6 3.66 2.84 2.44 4.27 5.98 4.27 10.6 0 1.59-0.16 3.05-0.48 4.38-0.31 1.33-0.8 2.65-1.48 3.95-0.67 1.3-1.58 2.7-2.72 4.2-1.13 1.5-2.39 3.02-3.77 4.56s-3.76 4.11-7.14 7.7c-5.69 6.02-9.87 11.3-12.5 15.8h16.9c1.47 0 2.65-0.09 3.55-0.27s1.62-0.479 2.16-0.898c0.54-0.42 0.96-0.966 1.28-1.64 0.31-0.674 0.71-1.72 1.19-3.12h3.82l-0.77 13.1h-37v-2.16c1.29-3.14 3.03-6.36 5.21-9.66 2.19-3.3 5.29-7.17 9.3-11.6 3.47-3.83 5.98-6.74 7.5-8.72 1.68-2.16 2.93-4.02 3.75-5.59 0.83-1.57 1.42-3.06 1.78-4.45s0.54-2.79 0.54-4.2c0-2.25-0.36-4.23-1.08-5.95s-1.82-3.08-3.3-4.07c-1.49-0.988-3.35-1.48-5.6-1.48-5.6 0-9.37 3.11-11.3 9.34h-5.43v-8.62c3.62-1.71 7.01-2.94 10.2-3.71 3.16-0.763 6-1.14 8.52-1.14zm58.7-0.943c8.69 0 13 5.51 13 16.5 0 3.11-0.35 6.84-1.06 11.2-0.7 4.33-1.82 8.74-3.34 13.2-1.53 4.49-3.46 8.47-5.8 11.9-2.33 3.46-5.03 6.13-8.08 8.02-3.06 1.89-6.35 2.83-9.89 2.83-4.46 0-7.78-1.36-9.97-4.09s-3.28-6.81-3.28-12.3c0-2.96 0.33-6.62 0.99-11 0.66-4.34 1.74-8.78 3.26-13.3 1.51-4.54 3.46-8.56 5.84-12.1s5.12-6.23 8.22-8.13 6.46-2.85 10.1-2.85z\" fill=\"#0070c0\" fill-rule=\"evenodd\"/><text x=\"2231.1599\" y=\"945.87799\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"63.7px\">2𝜃</text><text x=\"2825.96\" y=\"1131.05\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"65px\">𝑎𝑙𝑙</text><path d=\"m1935 488h6.92v83.6h-6.92z\" fill=\"url(#fill3)\" fill-rule=\"evenodd\"/><text x=\"1935.1801\" y=\"561.573\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"83.6px\">|</text><path d=\"m2087 513c-3.12 0-5.83 1.3-8.16 3.91-2.32 2.61-4.14 6.33-5.48 11.2-1.33 4.85-2 9.03-2 12.5 0 3.29 0.69 5.73 2.05 7.3s3.42 2.36 6.18 2.36c2.93 0 5.54-1.32 7.81-3.95 2.28-2.64 4.08-6.33 5.39-11.1 1.32-4.75 1.98-8.92 1.98-12.5 0-3.23-0.63-5.67-1.89-7.3s-3.22-2.45-5.88-2.45zm-49 0c-3.12 0-5.83 1.3-8.16 3.91-2.32 2.61-4.14 6.33-5.48 11.2-1.33 4.85-1.99 9.03-1.99 12.5 0 3.29 0.68 5.73 2.04 7.3s3.42 2.36 6.18 2.36c2.93 0 5.54-1.32 7.81-3.95 2.28-2.64 4.08-6.33 5.39-11.1 1.32-4.75 1.98-8.92 1.98-12.5 0-3.23-0.63-5.67-1.89-7.3s-3.22-2.45-5.88-2.45zm98.3-0.09c-3.06 0-5.8 1.24-8.22 3.71-2.43 2.47-4.34 5.8-5.73 10-1.39 4.19-2.09 8.37-2.09 12.5 0 3.11 0.43 5.44 1.28 6.98s2.28 2.31 4.29 2.31c0.93 0 1.87-0.203 2.83-0.607s1.95-1.06 2.99-1.95c1.03-0.898 2.05-1.99 3.05-3.28 1.01-1.29 1.93-2.58 2.77-3.89 0.83-1.3 1.61-2.84 2.33-4.63s1.33-3.93 1.84-6.45l0.41-1.93c0.45-2.16 0.67-4.19 0.67-6.11 0-2.34-0.49-4.04-1.48-5.1s-2.64-1.6-4.94-1.6zm-148 0c-3.06 0-5.8 1.24-8.22 3.71-2.43 2.47-4.34 5.8-5.73 10-1.39 4.19-2.09 8.37-2.09 12.5 0 3.11 0.45 5.44 1.35 6.98s2.3 2.31 4.22 2.31c1.53 0 3.05-0.525 4.56-1.57s3.13-2.71 4.85-4.99 3.06-4.45 4.02-6.51c0.96-2.07 1.78-4.64 2.45-7.73 0.67-3.08 1.01-5.76 1.01-8.04 0-2.34-0.49-4.04-1.48-5.1s-2.64-1.6-4.94-1.6zm100-3.5c4.79 0 8.44 1.31 11 3.93 2.51 2.62 3.77 6.37 3.77 11.3 0 3.47-0.61 7.19-1.82 11.1s-2.87 7.28-4.99 9.97c-2.11 2.7-4.63 4.72-7.56 6.09-2.94 1.36-6.31 2.04-10.1 2.04-4.64 0-8.24-1.3-10.8-3.91s-3.84-6.35-3.84-11.2c0-2.4 0.36-5.17 1.08-8.31 0.93-4.25 2.49-7.97 4.67-11.1 2.19-3.17 4.89-5.61 8.09-7.3s6.72-2.54 10.6-2.54zm-49 0c4.79 0 8.44 1.31 11 3.93 2.51 2.62 3.77 6.37 3.77 11.3 0 3.47-0.61 7.19-1.82 11.1s-2.87 7.28-4.98 9.97c-2.12 2.7-4.64 4.72-7.57 6.09-2.94 1.36-6.31 2.04-10.1 2.04-4.64 0-8.24-1.3-10.8-3.91s-3.84-6.35-3.84-11.2c0-2.4 0.36-5.17 1.08-8.31 0.93-4.25 2.49-7.97 4.67-11.1 2.19-3.17 4.89-5.61 8.09-7.3s6.72-2.54 10.6-2.54zm-51.7-0.045c1.89 0 3.67 0.225 5.34 0.674 1.68 0.45 3.37 1.21 5.08 2.29l4.13-2.96 2.88 0.719-4.63 20.9c-0.33 1.47-1.08 5.17-2.24 11.1-1.23 6.29-2.23 10.7-2.99 13.3-0.77 2.61-1.72 4.98-2.85 7.12-1.14 2.14-2.61 4.01-4.41 5.59-1.79 1.59-3.97 2.82-6.53 3.68-2.56 0.868-5.6 1.3-9.1 1.3-11.3 0-17-3.3-17-9.88 0-1.68 0.51-3.2 1.53-4.58s2.65-2.83 4.89-4.36l3.24 2.61c-0.57 0.689-1.05 1.37-1.44 2.04s-0.67 1.32-0.83 1.95c-0.17 0.629-0.25 1.38-0.25 2.25 0 2.25 0.81 3.89 2.43 4.92s4.06 1.55 7.32 1.55c3.68 0 6.64-0.831 8.87-2.49 2.23-1.66 4.14-4.33 5.73-8.02s3.13-9.25 4.63-16.7l-0.63-0.135c-2.91 3.98-5.6 6.89-8.09 8.72-2.48 1.83-5.16 2.74-8.04 2.74-3.26 0-5.8-1.23-7.61-3.68-1.81-2.46-2.72-5.96-2.72-10.5 0-5.12 1-10 3.01-14.8s4.79-8.47 8.35-11.3c3.57-2.78 7.54-4.18 11.9-4.18zm168-20.5h2.65l-11.2 49.7c-0.65 2.94-0.98 5.15-0.98 6.65 0 1.2 0.19 2.07 0.58 2.61s1 0.808 1.84 0.808c0.9 0 1.86-0.367 2.88-1.1 1.02-0.734 2.45-2.13 4.31-4.2l2.56 2.52c-2.76 2.9-5.08 4.96-6.96 6.15-1.89 1.2-3.93 1.8-6.11 1.8-1.86 0-3.34-0.614-4.45-1.84-1.11-1.23-1.66-2.86-1.66-4.9 0-1.65 0.34-3.4 1.03-5.26l-0.58-0.18c-2.88 4.19-5.6 7.26-8.18 9.21-2.57 1.95-5.3 2.92-8.17 2.92-3.3 0-5.85-1.24-7.66-3.73s-2.72-5.98-2.72-10.5c0-5.15 1.01-10.1 3.03-14.8 2.02-4.75 4.8-8.49 8.33-11.2 3.54-2.74 7.48-4.11 11.8-4.11 1.83 0 3.51 0.188 5.05 0.562s3.12 1.03 4.74 1.95l2.34-10.4c0.24-0.988 0.45-2.08 0.63-3.28s0.27-2.25 0.27-3.14c0-0.898-0.17-1.58-0.5-2.04-0.33-0.464-0.8-0.801-1.41-1.01-0.62-0.21-1.72-0.36-3.3-0.45l0.53-2.34z\" fill=\"url(#fill3)\" fill-rule=\"evenodd\"/><text x=\"1954.65\" y=\"562.24701\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"84.3px\">𝑔𝑜𝑜𝑑</text><path d=\"m2173 488 17.9 40.3v3.32l-17.9 40.4-4.8-1.71 14.4-40.3-14.4-40.4z\" fill=\"url(#fill3)\" fill-rule=\"evenodd\"/><text x=\"2167.8\" y=\"561.74103\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"84px\">〉</text><path d=\"m2822 1242h6.92v83.6h-6.92z\" fill=\"url(#fill6)\" fill-rule=\"evenodd\"/><text x=\"2821.6101\" y=\"1314.8199\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"83.6px\">|</text><path d=\"m2871 1268c-1.44 0-2.85 0.46-4.24 1.37-1.4 0.91-2.95 2.43-4.65 4.54-1.71 2.11-3.1 4.27-4.18 6.49-1.08 2.21-1.99 5.04-2.74 8.49l-0.4 1.89c-0.45 2.09-0.68 4.13-0.68 6.11 0 2.36 0.52 4.07 1.55 5.12 1.03 1.04 2.75 1.57 5.15 1.57 1.22 0 2.39-0.2 3.5-0.61 1.11-0.4 2.24-1.07 3.39-2s2.25-2.15 3.28-3.66 1.98-3.37 2.85-5.59 1.54-4.59 2.02-7.12 0.72-4.95 0.72-7.26c0-3.11-0.44-5.45-1.32-7-0.89-1.56-2.3-2.34-4.25-2.34zm97.4-1.75c-3.06 0-5.8 1.23-8.22 3.7-2.43 2.48-4.34 5.81-5.73 10s-2.09 8.37-2.09 12.5c0 3.12 0.43 5.45 1.28 6.99s2.28 2.31 4.29 2.31c0.93 0 1.87-0.2 2.83-0.6 0.96-0.41 1.95-1.06 2.99-1.96 1.03-0.9 2.05-1.99 3.05-3.28 1.01-1.29 1.93-2.58 2.76-3.88 0.84-1.31 1.62-2.85 2.34-4.63s1.33-3.93 1.84-6.45l0.41-1.93c0.45-2.16 0.67-4.19 0.67-6.11 0-2.33-0.49-4.03-1.48-5.1-0.99-1.06-2.64-1.59-4.94-1.59zm-50.9 0c-3.09 0-5.86 1.24-8.31 3.73-2.46 2.48-4.38 5.81-5.75 9.99-1.38 4.18-2.07 8.35-2.07 12.5 0 3.12 0.43 5.45 1.28 6.99s2.28 2.31 4.29 2.31c1.98 0 3.92-0.85 5.82-2.56s3.86-4.14 5.88-7.3 3.45-6.8 4.29-10.9l0.41-1.93c0.27-1.23 0.45-2.29 0.54-3.19s0.13-1.87 0.13-2.92c0-2.3-0.49-4-1.48-5.07-0.99-1.08-2.67-1.62-5.03-1.62zm-0.9-3.55c1.94 0 3.76 0.22 5.46 0.65 1.69 0.44 3.43 1.21 5.23 2.31l4.13-2.96 2.88 0.72-6.61 28.5c-0.65 2.84-0.98 5.06-0.98 6.65 0 1.2 0.19 2.06 0.58 2.6s1 0.81 1.84 0.81c0.9 0 1.86-0.37 2.88-1.1 1.01-0.73 2.45-2.13 4.31-4.2l2.56 2.52c-2.7 2.87-4.99 4.92-6.9 6.13-1.9 1.21-3.96 1.82-6.17 1.82-1.86 0-3.34-0.62-4.45-1.84-1.11-1.23-1.66-2.86-1.66-4.9 0-1.65 0.34-3.4 1.03-5.26l-0.58-0.18c-2.88 4.2-5.6 7.27-8.18 9.21-2.57 1.95-5.3 2.92-8.17 2.92-3.3 0-5.85-1.24-7.66-3.73-1.82-2.48-2.72-5.97-2.72-10.5 0-5.15 1.01-10.1 3.03-14.8s4.8-8.49 8.33-11.2c3.54-2.74 7.48-4.11 11.8-4.11zm70.6-20.5h2.65l-11.2 49.7c-0.65 2.93-0.98 5.15-0.98 6.65 0 1.2 0.19 2.06 0.58 2.6s1 0.81 1.84 0.81c0.9 0 1.86-0.37 2.88-1.1 1.01-0.73 2.45-2.13 4.31-4.2l2.56 2.52c-2.76 2.9-5.08 4.95-6.96 6.15-1.89 1.2-3.93 1.8-6.11 1.8-1.86 0-3.34-0.62-4.45-1.84-1.11-1.23-1.66-2.86-1.66-4.9 0-1.65 0.34-3.4 1.03-5.26l-0.58-0.18c-2.88 4.2-5.6 7.27-8.18 9.21-2.57 1.95-5.3 2.92-8.17 2.92-3.3 0-5.85-1.24-7.66-3.73-1.82-2.48-2.72-5.97-2.72-10.5 0-5.15 1.01-10.1 3.03-14.8s4.8-8.49 8.33-11.2c3.54-2.74 7.48-4.11 11.8-4.11 1.83 0 3.51 0.19 5.05 0.56 1.54 0.38 3.12 1.03 4.74 1.96l2.34-10.4c0.24-0.99 0.45-2.08 0.63-3.28s0.27-2.25 0.27-3.15c0-0.89-0.17-1.58-0.5-2.04s-0.8-0.8-1.41-1.01c-0.62-0.21-1.72-0.36-3.31-0.45l0.54-2.34zm-124 0h2.61l-7.91 31.4 0.58 0.18c2.91-3.9 5.63-6.71 8.18-8.45s5.09-2.61 7.64-2.61c3.26 0 5.8 1.25 7.61 3.73 1.81 2.49 2.72 5.99 2.72 10.5 0 4.95-1 9.81-2.99 14.6-1.99 4.78-4.75 8.57-8.29 11.4-3.53 2.8-7.48 4.2-11.9 4.2-3.98 0-7.51-0.98-10.6-2.92l-4.13 2.92-2.88-0.72 11.6-51.4c0.69-3.05 1.03-5.27 1.03-6.65 0-1.25-0.38-2.14-1.14-2.65-0.77-0.51-2.14-0.79-4.11-0.85l0.54-2.34z\" fill=\"url(#fill6)\" fill-rule=\"evenodd\"/><text x=\"2843.8601\" y=\"1298.5601\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"65px\">𝑏𝑎𝑑</text><path d=\"m3006 1241 17.9 40.3v3.32l-17.9 40.4-4.8-1.71 14.4-40.3-14.4-40.4z\" fill=\"url(#fill6)\" fill-rule=\"evenodd\"/><text x=\"3000.95\" y=\"1314.99\" fill=\"#000000\" fill-opacity=\"0\" font-family=\"Arial, Arial_MSFontService, sans-serif\" font-size=\"84px\">〉</text><path transform=\"matrix(1 0 0 -1 2060 1308)\" d=\"m2.4-2.46 505 491-4.79 4.93-505-491zm502 458 4.16 39.7-39.8-3.07c-1.89-0.146-3.31-1.8-3.16-3.69 0.146-1.89 1.8-3.31 3.69-3.16l35.7 2.75-3.68 3.79-3.73-35.6c-0.198-1.89 1.17-3.58 3.06-3.78 1.89-0.198 3.58 1.17 3.78 3.06z\"/><text transform=\"translate(2240 517)\" fill=\"#0070c0\" font-family=\"'Segoe UI', 'Segoe UI_MSFontService', sans-serif\" font-size=\"64px\" font-weight=\"400\">Close enough</text><text transform=\"translate(2240 594)\" fill=\"#0070c0\" font-family=\"'Segoe UI', 'Segoe UI_MSFontService', sans-serif\" font-size=\"64px\" font-weight=\"400\">to measure</text></g></svg>\n\nNow, recall that $\\theta = \\arcsin \\sqrt{\\frac{M}{N}}$. When $M$ is much smaller than $N$, $\\frac{M}{N}$ is close to 0, and $\\theta$ is a small angle that can approximated as $\\theta \\approx \\sqrt{\\frac{M}{N}}$. This gives the following equation for $R_{opt}$\n\n$$ 2R_{opt}+1 \\approx \\frac{\\pi}{2\\theta} = \\frac{\\pi}{2}\\sqrt{\\frac{N}{M}}$$\nSince $\\theta$ is small, $R_{opt}$ is large, and the $+1$ term next to $2R_{opt}$ can be ignored, giving the final formula:\n$$ R_{opt} \\approx \\frac{\\pi}{4}\\sqrt{\\frac{N}{M}}$$\n\nWhat happens if you use more iterations than is optimal? Each iteration will keep rotating the state $2\\theta$ counterclockwise,\ngetting it further away from the vertical axis and thus reducing the probability of measuring the correct answer.\n\nIn this demo you will see how success probability of Grover's algorithm changes when it uses different numbers of iterations\nbefore the final measurements."
|
|
7079
|
+
},
|
|
7080
|
+
{
|
|
7081
|
+
"type": "example",
|
|
7082
|
+
"id": "grovers_search__e2edemo",
|
|
7083
|
+
"code": "namespace Kata {\n open Microsoft.Quantum.Convert;\n open Microsoft.Quantum.Diagnostics;\n open Microsoft.Quantum.Math;\n\n @EntryPoint()\n operation GroversSearchAlgorithmDemo() : Unit {\n // Experiment with the parameters to explore algorithm behavior in different conditions!\n let n = 3;\n let prefix = [false, true, false];\n let markingOracle = Oracle_StartsWith(_, _, prefix);\n for iterations in 0 .. 9 {\n mutable success = 0;\n for _ in 1 .. 100 {\n let res = GroversSearch(n, markingOracle, iterations);\n if BoolArrayAsInt(prefix) == BoolArrayAsInt(res) {\n set success += 1;\n }\n }\n Message($\"{iterations} iterations - {success}% success rate\");\n }\n }\n\n operation GroversSearch(\n n : Int,\n markingOracle : (Qubit[], Qubit) => Unit is Adj + Ctl, \n iterations : Int\n ) : Bool[] {\n use qs = Qubit[n];\n\n // Operation that prepares the state |all⟩.\n let meanStatePrep = ApplyToEachCA(H, _);\n\n // The phase oracle.\n let phaseOracle = ApplyMarkingOracleAsPhaseOracle(markingOracle, _);\n\n // Prepare the system in the state |all⟩.\n meanStatePrep(qs);\n\n // Do Grover's iterations.\n for _ in 1 .. iterations {\n // Apply the phase oracle.\n phaseOracle(qs);\n\n // Apply \"reflection about the mean\".\n ReflectionAboutState(qs, meanStatePrep);\n }\n\n // Measure to get the result.\n return ResultArrayAsBoolArray(MResetEachZ(qs));\n }\n\n operation Oracle_StartsWith(x : Qubit[], y : Qubit, p : Bool[]) : Unit is Adj + Ctl {\n ApplyControlledOnBitString(p, X, x[... Length(p) - 1], y);\n }\n\n operation ApplyMarkingOracleAsPhaseOracle(\n markingOracle : (Qubit[], Qubit) => Unit is Adj + Ctl,\n qubits : Qubit[])\n : Unit is Adj + Ctl {\n use minus = Qubit();\n within {\n X(minus);\n H(minus);\n } apply {\n markingOracle(qubits, minus);\n }\n }\n\n operation ReflectionAboutState(\n qs : Qubit[],\n statePrep : Qubit[] => Unit is Adj + Ctl)\n : Unit is Adj + Ctl {\n within {\n Adjoint statePrep(qs);\n } apply {\n ConditionalPhaseFlip(qs);\n }\n }\n\n operation ConditionalPhaseFlip(qs : Qubit[]) : Unit is Adj + Ctl {\n within {\n ApplyToEachA(X, qs);\n } apply {\n Controlled Z(qs[1 ...], qs[0]);\n }\n R(PauliI, 2.0 * PI(), qs[0]);\n }\n}"
|
|
7084
|
+
},
|
|
7085
|
+
{
|
|
7086
|
+
"type": "text-content",
|
|
7087
|
+
"content": "\n### Verifying that algorithm output is correct\n\nNotice that even when using the optimal number of iterations, you are not guaranteed a $100\\%$ success probability.\nGrover's search is a probabilistic algorithm, which means that even in the best case it has a non-zero failure probability.\nWhen you use it to solve a problem, you need to check that the output is correct before using it for any purpose.\n\nThis can be done classically, if you have access to the classical description of the problem\n(in the example used in this kata, you would check that the prefix of the returned state matches the given one.)\n\nIn general, the algorithm only gets the marking oracle as an input and doesn't have the information about the classical problem structure. \nHowever, all information necessary to verify the output is already contained in the oracle itself! \nThe effect of the marking oracle on an input, encoded as a basis states of the qubit register, is defined as \n$$U_f \\ket{x} \\ket{y} = \\ket{x} \\ket{y \\oplus f(x)}$$\n\nThis means that if you encode the return of the algorithm $x_0$ as a basis state of the qubit register, \nallocate an extra qubit in the $\\ket{0}$ state, and apply the oracle $U_f$ to these qubits, you'll get \n$$U_f \\ket{x} \\ket{0} = \\ket{x} \\ket{f(x)}$$\n\nIf you measure the last qubit now, you'll get exactly $f(x)$: if it is 1, the algorithm produced a correct answer, otherwise it didn't. If the algorithm failed, you can re-run it from scratch and hopefully get a correct answer on the next attempt!\n\n\n### Special cases\n\nThis calculation for the optimal number of iterations is done under the assumption that $M$ is much smaller than $N$ but greater than $0$. In other words, the algorithm works if solutions to the search problem exist, but there are very few of them.\n\nWhat happens if these assumptions are not valid?\n\n#### No solutions ($M = 0$)\n\nIn this case the starting system state $\\ket{\\psi} = \\ket{\\text{bad}}$, and $\\theta = \\arcsin \\sqrt{\\frac{M}{N}} = 0$.\nNo matter how many iterations we do, the probability of our measurement yielding a marked state is $0$.\n\nIn practice this means that Grover's search will yield a random non-solution every time. \nTo detect that this is the case, we need to run the algorithm multiple times and note the results. If none of them are problem solutions, we can conclude that the problem doesn't have a solution.\n\n#### Solutions make up half of the search space\n\nIf $M = \\frac{N}{2}$, then $\\theta = \\arcsin \\sqrt\\frac{N/2}{N} = \\arcsin \\sqrt\\frac{1}{2} = \\frac{\\pi}{4}$. \nThis means that after an arbitrary number of iterations $R$ the amplitude of the basis state $\\ket{\\text{good}}$ in the system will be:\n\n$$\\sin{(2R+1)\\theta} = \\sin\\frac{(2R+1)\\pi}{4} = \\pm \\frac{1}{\\sqrt{2}}$$\n\nThe probability of the measurement yielding a solution is then $P(\\ket{\\text{good}}) = \\sin^2\\frac{(2R+1)\\theta}{2} = (\\pm \\frac{1}{\\sqrt{2}})^2 = \\frac{1}{2}$\n\nYou can see that the probability of measuring a state that is a solution remains constant regardless of the number of iterations.\n\n#### Solutions make up more than half of the search space\n\nIf $\\frac{N}{2} < M \\leq N$, then $\\frac{\\pi}{4} < \\theta \\leq \\frac{\\pi}{4}$. \nNow using even one iteration doesn't always increase $P(\\ket{\\text{good}}) = \\sin^2{(2R+1)\\theta}$.\nIn fact, the first iteration is likely to decrease the probability of success!\n\n> Have you ever wondered why all tutorials on Grover's search start with two-bit functions? \n> That's the reason why: if you have only one bit, you only have functions for which $M=0$, $M=\\frac{N}{2}$, or $M=N$, and none of these make for a good illustration of the algorithm!\n\nThe last two scenarios are a lot easier to handle classically. \nIndeed, a randomly selected classical value has a probability of being a problem solution $p = \\frac{M}{N} > \\frac{1}{2}$! \nIf we repeat the random selection of the variable $k$ times, the probability of success grows to $1-(1-p)^k$, thus by increasing $k$ we can get this probabilty as close to $1$ as we need.\nFor example, For $p=0.5$ and $k=10$ the probality of success is about $99.9\\%$.\n\n#### Unknown number of solutions\n\nIn practical applications you don't usually know how many solutions your problem has before you start solving it. \nIn this case, you can pick the number of iterations as a random number between 1 and $\\frac{\\pi}{4} \\sqrt{N}$, \nand if the search did not yield the result on the first run, re-run it with a different number of iterations. \nSince Grover's algorithm is probabilistic, you don't nee to get the exact number of iterations to get a correct answer!"
|
|
7088
|
+
}
|
|
7089
|
+
]
|
|
7090
|
+
},
|
|
7091
|
+
{
|
|
7092
|
+
"type": "lesson",
|
|
7093
|
+
"id": "grovers_search__practicality",
|
|
7094
|
+
"title": "Practicality of Grover's Search Algorithm",
|
|
7095
|
+
"items": [
|
|
7096
|
+
{
|
|
7097
|
+
"type": "text-content",
|
|
7098
|
+
"content": "\nYou saw that Grover's search algorithm offers a theoretical advantage over the classical brute force approach.\nDoes this mean that it is an algorithm that will offer us a practical advantage for search problems?\n\nUnfortunately, there are several reasons why the answer is \"no\".\n\nFirst, Grover's algorithm uses no information about problem structure, and demonstrates the advantage over the classical algorithm under the assumption that the classical algorithm doesn't use this information either. \nHowever, the best classical algorithms exploit problem structure, allowing solutions that are much better than brute force search. \nCompared to these algorithms, Grover's algorithm often doesn't offer even a theoretical advantage.\nAdditionally, classical algorithms can use parallel processing and benefit from getting multiple computation results at once.\n\nImplementing the quantum oracle which encodes a problem instance on a quantum computer can be hard - both in terms of coming up with the code that does that and in terms of the execution time of a single oracle call. The advantage offered by Grover's algorithm is described in terms of the number of queries to the oracle and classical function evaluations. But, if a single oracle call takes many orders of magnitude longer to run than a single classical function evaluation, this overhead can easily negate the advantage in the number of calls. This limitation comes into play even for problems which don't have efficient classical algorithms, such as hash inversion.\n\nThis means that Grover's search is unlikely to offer us a practical advantage over the best classical algorithms for any problems. \nHowever, it remains one of the several fundamental quantum computing algorithms, and a great educational algorithm.\nBesides, a technique that generalizes the idea behind Grover's algorithm called *amplitude amplification* can be used \nas a building block for other quantum algorithms."
|
|
7099
|
+
}
|
|
7100
|
+
]
|
|
7101
|
+
},
|
|
7102
|
+
{
|
|
7103
|
+
"type": "lesson",
|
|
7104
|
+
"id": "grovers_search__conclusion",
|
|
7105
|
+
"title": "Conclusion",
|
|
7106
|
+
"items": [
|
|
7107
|
+
{
|
|
7108
|
+
"type": "text-content",
|
|
7109
|
+
"content": "\nCongratulations! In this kata you learned Grover's search algorithm - one of the fundamental algorithms in quantum computing.\nHere are a few key concepts to keep in mind:\n\n- Grover's search algorithm is an algorithm for unstructured search, also known as function inversion.\n- This algorithm offers a theoretical advantage over classical brute force search algorithm.\n- Grover's algorithm is unlikely to offer practical advantage for any problems, since classical algorithms typically rely on the knowledge of problem structure and thus do much better than brute force search.\n\nNext, you will practice applying Grover's algorithm to several more interesting problems."
|
|
7110
|
+
}
|
|
7111
|
+
]
|
|
7112
|
+
}
|
|
7113
|
+
],
|
|
7114
|
+
"published": true
|
|
7115
|
+
},
|
|
7116
|
+
{
|
|
7117
|
+
"id": "solving_sat",
|
|
7118
|
+
"title": "Solving SAT Problem Using Grover's Algorithm",
|
|
7119
|
+
"sections": [
|
|
7120
|
+
{
|
|
7121
|
+
"type": "lesson",
|
|
7122
|
+
"id": "solving_sat__overview",
|
|
7123
|
+
"title": "Overview",
|
|
7124
|
+
"items": [
|
|
7125
|
+
{
|
|
7126
|
+
"type": "text-content",
|
|
7127
|
+
"content": "\nThe key part of solving a classical problem using Grover's search algorithm is implementing the quantum oracle for that problem.\nIn practice, implementing a quantum oracle for a specific problem can be quite challenging.\n\nThis kata walks you through implementing the quantum oracles for Boolean satisfiability problems, abbreviated as SAT problems,\nand using these oracles to solve these problems with Grover's search.\n\n**This kata covers the following topics:**\n\n- Implementation of marking oracles for Boolean logic operators and Boolean expressions\n- Implementation of marking oracles for several versions of SAT problems\n\n**What you should know to start working on this kata:**\n\n- Fundamental quantum concepts\n- Controlled gates\n- Oracles, in particular marking oracles\n- Grover's search algorithm"
|
|
7128
|
+
}
|
|
7129
|
+
]
|
|
7130
|
+
},
|
|
7131
|
+
{
|
|
7132
|
+
"type": "lesson",
|
|
7133
|
+
"id": "solving_sat__cnf",
|
|
7134
|
+
"title": "Canonical Satisfiability Problem",
|
|
7135
|
+
"items": [
|
|
7136
|
+
{
|
|
7137
|
+
"type": "text-content",
|
|
7138
|
+
"content": "\nThe Boolean satisfiability problem is the problem of determining whether there exists an assignment of Boolean variables $x_j$\nfor which the given Boolean formula evaluates to true.\n\nThe canonical representation for SAT problems is based on the conjunctive normal form of Boolean formulas.\nTo define this form, we'll need several definitions:\n\n- The Boolean variables $x_0, ..., x_{n-1}$ are the inputs to the formula.\n- A _literal_ is either a variable $x_j$ (a positive literal) or the negation of a variable $\\neg x_j$ (called a negative literal).\n- A _clause_ is a disjunction (an OR operation) of one or several literals, for example, $x_0 \\vee \\neg x_1$.\n Generally, \n $$clause(x) = \\bigvee_k y_{k},\\text{ where }y_{k} =\\text{ either }x_j\\text{ or }\\neg x_j\\text{ for some }j \\in \\{0, \\dots, n-1\\}$$\n\n- Finally, the _conjunctive normal form_ of a formula is a conjunction (an AND operation) of several clauses:\n $$f(x) = \\bigwedge_i \\big(\\bigvee_k y_{ik} \\big),\\text{ where }y_{ik} =\\text{ either }x_j\\text{ or }\\neg x_j\\text{ for some }j \\in \\{0, \\dots, n-1\\}$$\n\nIn this lesson, you will learn to implement marking oracles for SAT problems given as their conjunctive normal form descriptions."
|
|
7139
|
+
}
|
|
7140
|
+
]
|
|
7141
|
+
},
|
|
7142
|
+
{
|
|
7143
|
+
"type": "exercise",
|
|
7144
|
+
"id": "solving_sat__and",
|
|
7145
|
+
"title": "Evaluate AND Operator",
|
|
7146
|
+
"description": {
|
|
7147
|
+
"type": "text-content",
|
|
7148
|
+
"content": "**Inputs:**\n\n1. $N$ qubits in an arbitrary state $\\ket{x}$ (input/query register).\n2. A qubit in an arbitrary state $\\ket{y}$ (output/target qubit).\n\n**Goal:**\nImplement a quantum oracle which calculates the AND of the inputs, i.e., $f(x) = x_0 \\wedge x_1 \\wedge ... \\wedge x_{N-1}$.\n \nLeave the qubits in the input register in the same state they started in.\nYour solution should work on inputs in superposition, and not use any measurements."
|
|
7149
|
+
},
|
|
7150
|
+
"sourceIds": [
|
|
7151
|
+
"solving_sat__and__Verification.qs",
|
|
7152
|
+
"KatasLibrary.qs",
|
|
7153
|
+
"solving_sat__Common.qs"
|
|
7154
|
+
],
|
|
7155
|
+
"placeholderCode": "namespace Kata {\n operation Oracle_And(x : Qubit[], y : Qubit) : Unit is Adj + Ctl {\n // Implement your solution here...\n\n }\n}\n",
|
|
7156
|
+
"explainedSolution": {
|
|
7157
|
+
"type": "explained-solution",
|
|
7158
|
+
"items": [
|
|
7159
|
+
{
|
|
7160
|
+
"type": "text-content",
|
|
7161
|
+
"content": "\nThe goal is to flip the qubit $\\ket{y}$ if and only if all qubits in the register $\\ket{x}$ are in the state $\\ket{1}$.\n\nThe required unitary $U_{and}$ is such that:\n$$U_{and}\\ket{x}\\ket{y} = \\begin{cases} \n \\ket{x}\\ket{y} & \\text{if }x \\neq 1...1 \\\\\n \\ket{x}X\\ket{y} & \\text{if }x = 1...1 \n \\end{cases}$$\n\nThis transformation can be implemented as a `Controlled X` gate, with the input register $\\ket{x}$ as control and the target qubit $\\ket{y}$ as target."
|
|
7162
|
+
},
|
|
7163
|
+
{
|
|
7164
|
+
"type": "solution",
|
|
7165
|
+
"id": "solving_sat__and_solution",
|
|
7166
|
+
"code": "namespace Kata {\n operation Oracle_And(x : Qubit[], y : Qubit) : Unit is Adj + Ctl {\n Controlled X(x, y);\n } \n}\n"
|
|
7167
|
+
}
|
|
7168
|
+
]
|
|
7169
|
+
}
|
|
7170
|
+
},
|
|
7171
|
+
{
|
|
7172
|
+
"type": "exercise",
|
|
7173
|
+
"id": "solving_sat__or",
|
|
7174
|
+
"title": "Evaluate OR Operator",
|
|
7175
|
+
"description": {
|
|
7176
|
+
"type": "text-content",
|
|
7177
|
+
"content": "**Inputs:**\n\n1. $N$ qubits in an arbitrary state $\\ket{x}$ (input/query register).\n2. A qubit in an arbitrary state $\\ket{y}$ (output/target qubit).\n\n**Goal:**\nImplement a quantum oracle which calculates the OR of the inputs, i.e., $f(x) = x_0 \\vee x_1 \\vee ... \\vee x_{N-1}$.\n \nLeave the qubits in the input register in the same state they started in.\nYour solution should work on inputs in superposition, and not use any measurements."
|
|
7178
|
+
},
|
|
7179
|
+
"sourceIds": [
|
|
7180
|
+
"solving_sat__or__Verification.qs",
|
|
7181
|
+
"KatasLibrary.qs",
|
|
7182
|
+
"solving_sat__Common.qs"
|
|
7183
|
+
],
|
|
7184
|
+
"placeholderCode": "namespace Kata {\n operation Oracle_Or(x : Qubit[], y : Qubit) : Unit is Adj + Ctl {\n // Implement your solution here...\n\n }\n}\n",
|
|
7185
|
+
"explainedSolution": {
|
|
7186
|
+
"type": "explained-solution",
|
|
7187
|
+
"items": [
|
|
7188
|
+
{
|
|
7189
|
+
"type": "text-content",
|
|
7190
|
+
"content": "\nThe goal is to flip the qubit $\\ket{y}$ if and only if at least one of the qubits in the register $\\ket{x}$ is in the state $\\ket{1}$.\n\nThe required unitary $U_{or}$ is such that:\n$$U_{or}\\ket{x}\\ket{y} = \\begin{cases} \n \\ket{x}\\ket{y} & \\text{if }x = 0...0 \\\\\n \\ket{x}X\\ket{y} & \\text{if }x \\neq 0...0\n \\end{cases}$$\n\nThis transformation can be implemented as a sequence of two steps:\n\n1. Flip the state of the target qubit if $x = 0...0$ using a controlled-on-zero $X$ gate.\n2. Flip the state of the target qubit using an $X$ gate. This will negate the results of the previous step,\n making sure that overall the state of the target qubit is flipped if $x \\neq 0...0$."
|
|
7191
|
+
},
|
|
7192
|
+
{
|
|
7193
|
+
"type": "solution",
|
|
7194
|
+
"id": "solving_sat__or_solution",
|
|
7195
|
+
"code": "namespace Kata {\n operation Oracle_Or(x : Qubit[], y : Qubit) : Unit is Adj + Ctl {\n ApplyControlledOnInt(0, X, x, y);\n X(y);\n } \n}\n"
|
|
7196
|
+
}
|
|
7197
|
+
]
|
|
7198
|
+
}
|
|
7199
|
+
},
|
|
7200
|
+
{
|
|
7201
|
+
"type": "exercise",
|
|
7202
|
+
"id": "solving_sat__sat_clause",
|
|
7203
|
+
"title": "Evaluate One Clause",
|
|
7204
|
+
"description": {
|
|
7205
|
+
"type": "text-content",
|
|
7206
|
+
"content": "**Inputs:**\n\n1. $N$ qubits in an arbitrary state $\\ket{x}$ (input/query register).\n2. A qubit in an arbitrary state $\\ket{y}$ (output/target qubit).\n3. An array of tuples `clause` which describes one clause of a SAT problem instance $clause(x)$.\n Each tuple is an `(Int, Bool)` pair describing one component of the clause:\n - the first element is the index $j$ of the variable $x_j$, \n - the second element is `true` if the variable is included as itself ($x_j$) and `false` if it is included as a negation ($\\neg x_j$).\n\nFor example, clause $x_0 \\vee \\neg x_1$ can be represented as `[(0, true), (1, false)]`.\n\n**Goal:**\nImplement a quantum oracle which evaluates the clause $clause(x)$.\n \nLeave the qubits in the input register in the same state they started in.\nYour solution should work on inputs in superposition, and not use any measurements."
|
|
7207
|
+
},
|
|
7208
|
+
"sourceIds": [
|
|
7209
|
+
"solving_sat__sat_clause__Verification.qs",
|
|
7210
|
+
"KatasLibrary.qs",
|
|
7211
|
+
"solving_sat__Common.qs"
|
|
7212
|
+
],
|
|
7213
|
+
"placeholderCode": "namespace Kata {\n operation Oracle_SATClause(x : Qubit[], y : Qubit, clause : (Int, Bool)[]) : Unit is Adj + Ctl {\n // Implement your solution here...\n\n }\n\n // You might find this helper operation from an earlier task useful.\n operation Oracle_Or(x : Qubit[], y : Qubit) : Unit is Adj + Ctl {\n ApplyControlledOnInt(0, X, x, y);\n X(y);\n } \n}\n",
|
|
7214
|
+
"explainedSolution": {
|
|
7215
|
+
"type": "explained-solution",
|
|
7216
|
+
"items": [
|
|
7217
|
+
{
|
|
7218
|
+
"type": "text-content",
|
|
7219
|
+
"content": "\nThis task involves evaluating a clause which is a disjunction (OR) of negated and non-negated variables encoded in the input $x$. \nThis can be done in two steps:\n\n1. First, flip the qubits which are negated in `clause` (and later undo this operation). \n To do this, apply an $X$ gate to qubit $j$ if and only if the clause has a term of the form `(j, false)`.\n2. Use the $U_{or}$ unitary (implemented by the operation `Oracle_Or`) to calculate the clause. \n To do this, you need to first construct an array `clauseQubits` - all qubits which are included as a negated or non-negated variable in the clause. Then, you can apply the `Oracle_Or` operation to qubits `clauseQubits` and `y`.\n\nNote that the implementation of `Oracle_SATClause` should be adjointable, and it's nice to be able to rely on Q# compiler to generate the adjoint variant of this operation.\nThat's why the solution uses the library function `Mapped` instead of classical computations that involve manipulating mutable variables - those would have to be moved to a separate function, making the code bulkier."
|
|
7220
|
+
},
|
|
7221
|
+
{
|
|
7222
|
+
"type": "solution",
|
|
7223
|
+
"id": "solving_sat__sat_clause_solution",
|
|
7224
|
+
"code": "namespace Kata {\n open Microsoft.Quantum.Arrays;\n operation Oracle_SATClause(x : Qubit[], y : Qubit, clause : (Int, Bool)[]) : Unit is Adj + Ctl {\n let clauseQubits = Mapped((ind, _) -> x[ind], clause);\n within {\n for (ind, positive) in clause {\n if not positive {\n X(x[ind]);\n }\n }\n } apply {\n Oracle_Or(clauseQubits, y);\n }\n }\n\n operation Oracle_Or(x : Qubit[], y : Qubit) : Unit is Adj + Ctl {\n ApplyControlledOnInt(0, X, x, y);\n X(y);\n } \n}\n"
|
|
7225
|
+
}
|
|
7226
|
+
]
|
|
7227
|
+
}
|
|
7228
|
+
},
|
|
7229
|
+
{
|
|
7230
|
+
"type": "exercise",
|
|
7231
|
+
"id": "solving_sat__sat_formula",
|
|
7232
|
+
"title": "Evaluate SAT Formula",
|
|
7233
|
+
"description": {
|
|
7234
|
+
"type": "text-content",
|
|
7235
|
+
"content": "**Inputs:**\n\n1. $N$ qubits in an arbitrary state $\\ket{x}$ (input/query register).\n2. A qubit in an arbitrary state $\\ket{y}$ (output/target qubit).\n3. A two-dimensional array of tuples `formula` which describes a SAT problem instance $f(x)$.\n $i$-th element of `formula` is an array of tuples that describes the $i$-th clause of $f(x)$ using the same format as the previous exercise. \n\nFor example, a two-variable SAT formula that evaluates the XOR of two inputs $f(x) = (x_0 \\vee x_1) \\wedge (\\neg x_0 \\vee \\neg x_1)$ can be represented as `[[(0, true), (1, true)], [(0, false), (1, false)]]`.\n\n**Goal:**\nImplement a quantum oracle which evaluates the formula $f(x)$.\n \nLeave the qubits in the input register in the same state they started in.\nYour solution should work on inputs in superposition, and not use any measurements."
|
|
7236
|
+
},
|
|
7237
|
+
"sourceIds": [
|
|
7238
|
+
"solving_sat__sat_formula__Verification.qs",
|
|
7239
|
+
"KatasLibrary.qs",
|
|
7240
|
+
"solving_sat__Common.qs"
|
|
7241
|
+
],
|
|
7242
|
+
"placeholderCode": "namespace Kata {\n open Microsoft.Quantum.Arrays;\n\n operation Oracle_SATFormula(x : Qubit[], y : Qubit, formula : (Int, Bool)[][]) : Unit is Adj + Ctl {\n // Implement your solution here...\n\n }\n\n // You might find these helper operations from earlier tasks useful.\n operation Oracle_SATClause(x : Qubit[], y : Qubit, clause : (Int, Bool)[]) : Unit is Adj + Ctl {\n let clauseQubits = Mapped((ind, _) -> x[ind], clause);\n within {\n for (ind, positive) in clause {\n if not positive {\n X(x[ind]);\n }\n }\n } apply {\n Oracle_Or(clauseQubits, y);\n }\n }\n\n operation Oracle_Or(x : Qubit[], y : Qubit) : Unit is Adj + Ctl {\n ApplyControlledOnInt(0, X, x, y);\n X(y);\n } \n\n operation Oracle_And(x : Qubit[], y : Qubit) : Unit is Adj + Ctl {\n Controlled X(x, y);\n } \n}\n",
|
|
7243
|
+
"explainedSolution": {
|
|
7244
|
+
"type": "explained-solution",
|
|
7245
|
+
"items": [
|
|
7246
|
+
{
|
|
7247
|
+
"type": "text-content",
|
|
7248
|
+
"content": "\nThis task consists of a conjunction (AND) of results of multiple clause evaluations. Each clause individually can be evaluated using the code you've written in the previous exercise. The computation results of these clauses must be stored temporarily in freshly allocated qubits. Then the conjunction of these results can be computed using `Oracle_And` from the first exercise.\n\nLet's denote the number of clauses in the formula as $m$. The steps for implementing the SAT oracle will be:\n\n1. Allocate an array of $m$ qubits `aux` in the state $\\ket{0}$.\n2. Evaluate each clause using `Oracle_SATClause` from the previous exercise, with the corresponding element of `aux` as the target qubit.\n3. Evaluate the SAT formula using `Oracle_And` implemented in the first task with `aux` as the input register and `target` as the target qubit.\n4. Undo step 2 to restore the auxiliary qubits back into the $\\ket{0}$ state before releasing them.\n\nYou can again use the within-apply Q# language construct to perform steps 2, 3 and 4 with the last step generated automatically."
|
|
7249
|
+
},
|
|
7250
|
+
{
|
|
7251
|
+
"type": "solution",
|
|
7252
|
+
"id": "solving_sat__sat_formula_solution",
|
|
7253
|
+
"code": "namespace Kata {\n open Microsoft.Quantum.Arrays;\n\n operation Oracle_SATFormula(x : Qubit[], y : Qubit, formula : (Int, Bool)[][]) : Unit is Adj + Ctl {\n use aux = Qubit[Length(formula)];\n within {\n for i in 0 .. Length(formula) - 1 {\n Oracle_SATClause(x, aux[i], formula[i]);\n }\n } apply {\n Oracle_And(aux, y);\n }\n }\n\n operation Oracle_SATClause(x : Qubit[], y : Qubit, clause : (Int, Bool)[]) : Unit is Adj + Ctl {\n let clauseQubits = Mapped((ind, _) -> x[ind], clause);\n within {\n for (ind, positive) in clause {\n if not positive {\n X(x[ind]);\n }\n }\n } apply {\n Oracle_Or(clauseQubits, y);\n }\n }\n\n operation Oracle_Or(x : Qubit[], y : Qubit) : Unit is Adj + Ctl {\n ApplyControlledOnInt(0, X, x, y);\n X(y);\n } \n\n operation Oracle_And(x : Qubit[], y : Qubit) : Unit is Adj + Ctl {\n Controlled X(x, y);\n } \n}\n"
|
|
7254
|
+
}
|
|
7255
|
+
]
|
|
7256
|
+
}
|
|
7257
|
+
},
|
|
7258
|
+
{
|
|
7259
|
+
"type": "lesson",
|
|
7260
|
+
"id": "solving_sat__exactly_one_3sat",
|
|
7261
|
+
"title": "Exactly-1 3-SAT Problem",
|
|
7262
|
+
"items": [
|
|
7263
|
+
{
|
|
7264
|
+
"type": "text-content",
|
|
7265
|
+
"content": "\nExactly-1 3-SAT problem (also known as \"one-in-three 3-SAT\") is a variant of a general SAT problem.\nThe structure of the formula that describes an instance of an exactly-1 3-SAT problem is exactly the same as that of the canonical SAT problem, with each clause consisting of exactly three literals.\nHowever, the problem is to find an assignment of the variables that makes each clause have *exactly one* true literal, \nwhile in a normal SAT problem each clause can have one or more true literal to satisfy the formula.\n\nFormally, the clauses of exactly-1 3-SAT problem can be defined via the use of a ternary operator that is `true` if and only if exactly one of the arguments is `true`. However, this kata uses the same formula notation for these clauses as the canonical SAT problem."
|
|
7266
|
+
}
|
|
7267
|
+
]
|
|
7268
|
+
},
|
|
7269
|
+
{
|
|
7270
|
+
"type": "exercise",
|
|
7271
|
+
"id": "solving_sat__exactly_one_one",
|
|
7272
|
+
"title": "Evaluate \"Exactly 1 One\" Operator",
|
|
7273
|
+
"description": {
|
|
7274
|
+
"type": "text-content",
|
|
7275
|
+
"content": "**Inputs:**\n\n1. Three qubits in an arbitrary state $\\ket{x}$ (input/query register).\n2. A qubit in an arbitrary state $\\ket{y}$ (output/target qubit).\n\n**Goal:**\nImplement a quantum oracle which calculates the function that checks whether exactly one of the inputs is $1$, i.e., $f(x) = 1$ if exactly one bit of $x$ is $1$, and $0$ otherwise.\n \nLeave the qubits in the input register in the same state they started in.\nYour solution should work on inputs in superposition, and not use any measurements."
|
|
7276
|
+
},
|
|
7277
|
+
"sourceIds": [
|
|
7278
|
+
"solving_sat__exactly_one_one__Verification.qs",
|
|
7279
|
+
"KatasLibrary.qs",
|
|
7280
|
+
"solving_sat__Common.qs"
|
|
7281
|
+
],
|
|
7282
|
+
"placeholderCode": "namespace Kata {\n operation Oracle_Exactly1One(x : Qubit[], y : Qubit) : Unit is Adj + Ctl {\n // Implement your solution here...\n\n }\n}\n",
|
|
7283
|
+
"explainedSolution": {
|
|
7284
|
+
"type": "explained-solution",
|
|
7285
|
+
"items": [
|
|
7286
|
+
{
|
|
7287
|
+
"type": "text-content",
|
|
7288
|
+
"content": "\nConsider the set of all bit strings $x$ of length $n$ which have only one bit of $x$ equal to $1$. \nThis set of bit strings is $S=\\{00...01, 00...10, ..., 00..1..00, ..., 01...00, 10...00\\}$, \nor, if we convert the bit strings to integers, \n$$S=\\{1,2,4,..2^i,..,2^{n-1}\\} = \\{2^k: 0 \\le k \\le n-1\\}$$\n\nYou need to implement an oracle that flips $\\ket{y}$ if the input basis state $\\ket{x}$ corresponds to one of the bit strings in $S$.\nThe easiest way to do this is to use $n$ controlled $X$ gates, with `x` as control and the qubit `y` flipped if and only if the control register is in a particular state of the form $2^k$.\nYou can use the library operation `ApplyControlledOnInt` for this with integers $1, 2, 4, ...$ as controls.\nNotice that this operation uses little endian notation to convert integers to bit strings, but it doesn't matter for this exercise.\nYou need to iterate through all bit strings that have exactly one $1$ in their notation, and the order in which you iterate is not important."
|
|
7289
|
+
},
|
|
7290
|
+
{
|
|
7291
|
+
"type": "solution",
|
|
7292
|
+
"id": "solving_sat__exactly_one_one_solution",
|
|
7293
|
+
"code": "namespace Kata {\n operation Oracle_Exactly1One(x : Qubit[], y : Qubit) : Unit is Adj + Ctl {\n for i in 0 .. Length(x) - 1 {\n ApplyControlledOnInt(2 ^ i, X, x, y);\n }\n } \n}\n"
|
|
7294
|
+
}
|
|
7295
|
+
]
|
|
7296
|
+
}
|
|
7297
|
+
},
|
|
7298
|
+
{
|
|
7299
|
+
"type": "exercise",
|
|
7300
|
+
"id": "solving_sat__exactly_one_one_formula",
|
|
7301
|
+
"title": "Evaluate Exactly-1 3-SAT Formula",
|
|
7302
|
+
"description": {
|
|
7303
|
+
"type": "text-content",
|
|
7304
|
+
"content": "**Inputs:**\n\n1. $N$ qubits in an arbitrary state $\\ket{x}$ (input/query register).\n2. A qubit in an arbitrary state $\\ket{y}$ (output/target qubit).\n3. A two-dimensional array of tuples `formula` which describes a SAT problem instance $f(x)$.\n $i$-th element of `formula` is an array of tuples that describes the $i$-th clause of $f(x)$ using the same format as the previous exercise. Each clause of the formula is guaranteed to have exactly three literals.\n\nFor example, a three-variable SAT formula with one clause $f(x) = (x_0 \\vee x_1 \\vee x_2)$ can be represented as `[[(0, true), (1, true), (2, true)]]`,\nand its solutions will be `(true, false, false)`, `(false, true, false)` and `(false, false, true)`.\n\n**Goal:**\nImplement a quantum oracle which evaluates the exactly-1 3-SAT formula $f(x)$.\n \nLeave the qubits in the input register in the same state they started in.\nYour solution should work on inputs in superposition, and not use any measurements."
|
|
7305
|
+
},
|
|
7306
|
+
"sourceIds": [
|
|
7307
|
+
"solving_sat__exactly_one_one_formula__Verification.qs",
|
|
7308
|
+
"KatasLibrary.qs",
|
|
7309
|
+
"solving_sat__Common.qs"
|
|
7310
|
+
],
|
|
7311
|
+
"placeholderCode": "namespace Kata {\n open Microsoft.Quantum.Arrays;\n\n operation Oracle_Exactly13SATFormula(x : Qubit[], y : Qubit, formula : (Int, Bool)[][]) : Unit is Adj + Ctl {\n // Implement your solution here...\n\n }\n\n // You might want to implement this helper operation that evaluates a single clause and use it in your solution.\n operation Oracle_Exactly13SATClause(x : Qubit[], y : Qubit, clause : (Int, Bool)[]) : Unit is Adj + Ctl {\n // Implement your solution here...\n\n }\n\n // You might find these helper operations from earlier tasks useful.\n operation Oracle_Exactly1One(x : Qubit[], y : Qubit) : Unit is Adj + Ctl {\n for i in 0 .. Length(x) - 1 {\n ApplyControlledOnInt(2 ^ i, X, x, y);\n }\n } \n\n operation Oracle_And(x : Qubit[], y : Qubit) : Unit is Adj + Ctl {\n Controlled X(x, y);\n } \n}\n",
|
|
7312
|
+
"explainedSolution": {
|
|
7313
|
+
"type": "explained-solution",
|
|
7314
|
+
"items": [
|
|
7315
|
+
{
|
|
7316
|
+
"type": "text-content",
|
|
7317
|
+
"content": "\nThis exercise is similar to the task of evaluating a SAT formula from the first lesson: it consists of a conjunction (AND) of results of multiple clause evaluations. This time, though, each clause has to be evaluated using the \"Exactly One 1\" policy you've implemented in the previous exercise instead of the `Oracle_Or` you used in the first lesson.\n\nWith this replacement, the code that evaluates a single clause is very similar to that from the exercise \"Evaluate One Clause\",\nand the code that evaluates the whole formula - to that from the exercise \"Evaluate SAT Formula\"."
|
|
7318
|
+
},
|
|
7319
|
+
{
|
|
7320
|
+
"type": "solution",
|
|
7321
|
+
"id": "solving_sat__exactly_one_one_formula_solution",
|
|
7322
|
+
"code": "namespace Kata {\n open Microsoft.Quantum.Arrays;\n\n operation Oracle_Exactly13SATFormula(x : Qubit[], y : Qubit, formula : (Int, Bool)[][]) : Unit is Adj + Ctl {\n use aux = Qubit[Length(formula)];\n within {\n for i in 0 .. Length(formula) - 1 {\n Oracle_Exactly13SATClause(x, aux[i], formula[i]);\n }\n } apply {\n Oracle_And(aux, y);\n }\n }\n\n // You might want to implement this helper operation that evaluates a single clause and use it in your solution.\n operation Oracle_Exactly13SATClause(x : Qubit[], y : Qubit, clause : (Int, Bool)[]) : Unit is Adj + Ctl {\n let clauseQubits = Mapped((ind, _) -> x[ind], clause);\n within {\n for (ind, positive) in clause {\n if not positive {\n X(x[ind]);\n }\n }\n } apply {\n Oracle_Exactly1One(clauseQubits, y);\n }\n }\n\n // You might find these helper operations from earlier tasks useful.\n operation Oracle_Exactly1One(x : Qubit[], y : Qubit) : Unit is Adj + Ctl {\n for i in 0 .. Length(x) - 1 {\n ApplyControlledOnInt(2 ^ i, X, x, y);\n }\n } \n\n operation Oracle_And(x : Qubit[], y : Qubit) : Unit is Adj + Ctl {\n Controlled X(x, y);\n } \n}\n"
|
|
7323
|
+
}
|
|
7324
|
+
]
|
|
7325
|
+
}
|
|
7326
|
+
},
|
|
7327
|
+
{
|
|
7328
|
+
"type": "lesson",
|
|
7329
|
+
"id": "solving_sat__using_grover",
|
|
7330
|
+
"title": "Using Grover's Algorithm to Solve SAT Problems",
|
|
7331
|
+
"items": [
|
|
7332
|
+
{
|
|
7333
|
+
"type": "text-content",
|
|
7334
|
+
"content": "\nIn this lesson, you will experiment with using Grover's algorithm to solve SAT problems.\n\nNotice that in this case, it's not as easy to know the number of solutions to the problem upfront as it was for the prefix function used in the \"Grover's Search Algorithm\" kata.\nExperiment with choosing the number of iterations at random. How does this affect the success probability?"
|
|
7335
|
+
},
|
|
7336
|
+
{
|
|
7337
|
+
"type": "example",
|
|
7338
|
+
"id": "solving_sat__e2edemo",
|
|
7339
|
+
"code": "namespace Kata {\n open Microsoft.Quantum.Arrays;\n open Microsoft.Quantum.Convert;\n open Microsoft.Quantum.Diagnostics;\n open Microsoft.Quantum.Math;\n\n @EntryPoint()\n operation SolvingSATWithGroverDemo() : Unit {\n // Experiment with the parameters to explore algorithm behavior in different conditions!\n let n = 3;\n // (x₀ ∨ x₁) ∧ (¬x₀ ∨ ¬x₁) ∧ ¬x₂\n let formula = [[(0, true), (1, true)], [(0, false), (1, false)], [(2, false)]];\n let markingOracle = Oracle_SATFormula(_, _, formula);\n for iterations in 0 .. 9 {\n mutable success = 0;\n for _ in 1 .. 100 {\n let res = GroversSearch(n, markingOracle, iterations);\n if F_SATFormula(res, formula) {\n set success += 1;\n }\n }\n Message($\"{iterations} iterations - {success}% success rate\");\n }\n }\n\n operation GroversSearch(\n n : Int,\n markingOracle : (Qubit[], Qubit) => Unit is Adj + Ctl, \n iterations : Int\n ) : Bool[] {\n use qs = Qubit[n];\n\n // Operation that prepares the state |all⟩.\n let meanStatePrep = ApplyToEachCA(H, _);\n\n // The phase oracle.\n let phaseOracle = ApplyMarkingOracleAsPhaseOracle(markingOracle, _);\n\n // Prepare the system in the state |all⟩.\n meanStatePrep(qs);\n\n // Do Grover's iterations.\n for _ in 1 .. iterations {\n // Apply the phase oracle.\n phaseOracle(qs);\n\n // Apply \"reflection about the mean\".\n ReflectionAboutState(qs, meanStatePrep);\n }\n\n // Measure to get the result.\n return ResultArrayAsBoolArray(MResetEachZ(qs));\n }\n\n operation ApplyMarkingOracleAsPhaseOracle(\n markingOracle : (Qubit[], Qubit) => Unit is Adj + Ctl,\n qubits : Qubit[])\n : Unit is Adj + Ctl {\n use minus = Qubit();\n within {\n X(minus);\n H(minus);\n } apply {\n markingOracle(qubits, minus);\n }\n }\n\n operation ReflectionAboutState(\n qs : Qubit[],\n statePrep : Qubit[] => Unit is Adj + Ctl)\n : Unit is Adj + Ctl {\n within {\n Adjoint statePrep(qs);\n } apply {\n ConditionalPhaseFlip(qs);\n }\n }\n\n operation ConditionalPhaseFlip(qs : Qubit[]) : Unit is Adj + Ctl {\n within {\n ApplyToEachA(X, qs);\n } apply {\n Controlled Z(qs[1 ...], qs[0]);\n }\n R(PauliI, 2.0 * PI(), qs[0]);\n }\n\n operation Oracle_SATFormula(x : Qubit[], y : Qubit, formula : (Int, Bool)[][]) : Unit is Adj + Ctl {\n use aux = Qubit[Length(formula)];\n within {\n for i in 0 .. Length(formula) - 1 {\n Oracle_SATClause(x, aux[i], formula[i]);\n }\n } apply {\n Oracle_And(aux, y);\n }\n }\n\n operation Oracle_SATClause(x : Qubit[], y : Qubit, clause : (Int, Bool)[]) : Unit is Adj + Ctl {\n let clauseQubits = Mapped((ind, _) -> x[ind], clause);\n within {\n for (ind, positive) in clause {\n if not positive {\n X(x[ind]);\n }\n }\n } apply {\n Oracle_Or(clauseQubits, y);\n }\n }\n\n operation Oracle_Or(x : Qubit[], y : Qubit) : Unit is Adj + Ctl {\n ApplyControlledOnInt(0, X, x, y);\n X(y);\n } \n\n operation Oracle_And(x : Qubit[], y : Qubit) : Unit is Adj + Ctl {\n Controlled X(x, y);\n }\n\n function F_SATClause(args : Bool[], clause : (Int, Bool)[]) : Bool {\n for (index, positive) in clause {\n if positive == args[index] {\n // one true literal is sufficient for the clause to be true\n return true;\n }\n }\n // none of the literals is true - the whole clause is false\n return false;\n }\n\n function F_SATFormula(args : Bool[], formula : (Int, Bool)[][]) : Bool {\n for clause in formula {\n // one false clause invalidates the whole formula\n if not F_SATClause(args, clause) {\n return false\n }\n }\n return true;\n }\n}"
|
|
7340
|
+
}
|
|
7341
|
+
]
|
|
7342
|
+
},
|
|
7343
|
+
{
|
|
7344
|
+
"type": "lesson",
|
|
7345
|
+
"id": "solving_sat__conclusion",
|
|
7346
|
+
"title": "Conclusion",
|
|
7347
|
+
"items": [
|
|
7348
|
+
{
|
|
7349
|
+
"type": "text-content",
|
|
7350
|
+
"content": "\nCongratulations! In this kata you learned to solve Boolean satisfiability problems using Grover's search."
|
|
6875
7351
|
}
|
|
6876
7352
|
]
|
|
6877
7353
|
}
|
|
@@ -6889,7 +7365,7 @@ export default {
|
|
|
6889
7365
|
"items": [
|
|
6890
7366
|
{
|
|
6891
7367
|
"type": "text-content",
|
|
6892
|
-
"content": "\nThis kata introduces you to the basic concepts of quantum error correction using several simple error correction codes.\n\n**This kata covers the following topics:**\n\n- Simple models of noise in quantum systems\n- Parity measurements in Z and X bases\n- Bit flip code - the simplest code that protects qubits from the effects of bit flip noise\n- Phase flip code - the simplest code that protects qubits from the effects of phase flip noise\n- Shor code - the simplest code that can protect from an arbitrary error on a single qubit\n\n**What you should know to start working on this kata:**\n\n- Basic single-qubit and multi-qubit gates\n-
|
|
7368
|
+
"content": "\nThis kata introduces you to the basic concepts of quantum error correction using several simple error correction codes.\n\n**This kata covers the following topics:**\n\n- Simple models of noise in quantum systems\n- Parity measurements in Z and X bases\n- Bit flip code - the simplest code that protects qubits from the effects of bit flip noise\n- Phase flip code - the simplest code that protects qubits from the effects of phase flip noise\n- Shor code - the simplest code that can protect from an arbitrary error on a single qubit\n\n**What you should know to start working on this kata:**\n\n- Basic knowledge of single-qubit and multi-qubit gates\n- Basic knowledge of single-qubit and multi-qubit quantum measurements and their effect on quantum systems"
|
|
6893
7369
|
}
|
|
6894
7370
|
]
|
|
6895
7371
|
},
|
|
@@ -6900,7 +7376,7 @@ export default {
|
|
|
6900
7376
|
"items": [
|
|
6901
7377
|
{
|
|
6902
7378
|
"type": "text-content",
|
|
6903
|
-
"content": "\nAny quantum system we can use to carry out quantum computation is inherently noisy. \nQuantum noise can be caused by different physical processes, depending on the type of
|
|
7379
|
+
"content": "\nAny quantum system we can use to carry out quantum computation is inherently noisy. \nQuantum noise can be caused by different physical processes, depending on the type of particle or device used as a qubit.\nFrom the computation point of view, the presence of noise in the quantum system means that its state can suffer from random errors, and thus end up in a different state from the state you're relying on to do your computations. \nThis makes computations unreliable very fast, since the effects of noise accumulate quickly to make computation results effectively random.\n\nBefore diving into how to deal with noise in quantum systems, let's take a quick look at how to do that for classical systems.\n\nThe model used for analyzing classical noise is called a *binary symmetric channel*. In this model, the classical bits sent through the channel are transmitted correctly with probability $1-p$ and flipped with probability $p$. The error introduced if the bit is flipped is called a *bit flip error*.\nIn this scenario, the information sent through the channel can be protected against the effects of the noise, that is, bit flip errors, using the *repetition code*:\n\n- On the sender side, for each bit you want to send, you create and send three copies of it:\n$$0 \\rightarrow 000, 1 \\rightarrow 111$$\n- On the receiver side, you decode the original bit by majority vote:\n$$000, 100, 010, 001 \\rightarrow 0$$\n$$111, 011, 101, 110 \\rightarrow 1$$\n\nWhat is the probability of this scheme failure, that is, getting an incorrect value for the message bit after it was sent through the channel? \nA majority vote allows for one error on any of the three bits to happen without affecting the decoding outcome, so it would take two or three errors happening on individual bits for decoding to produce an incorrect result. The probability of this happening is $3p^2(1-p) + p^3 = 3p^2 - 2p^3$. If you compare this with the probability of an individual bit transmission failing $p$, you can see that using the repetition code yields higher success probability, as long as $p < \\frac12$. You can improve success probability further by increasing the number of repetitions you use to encode each bit: $5$ repetitions allow us to detect and correct $2$ errors, $7$ repetitions can correct $3$ errors, and so on.\n\n> This noise model is useful not only for describing noisy communication channels, but also for memory - any classical system that introduces errors in information when it is left on its own, as opposed to systems that introduce errors during information manipulation. Indeed, we assume that no errors are introduced as we copy the bits during encoding or read and compare their values during decoding.\n\nThe main idea of quantum error correction is the same as that for classical error correction: encode information with enough redundancy that we can recover the message even from the noisy transmission results.\nDealing with the noise in quantum systems is more challenging than in classical systems, though, due to the limitations imposed by their nature:\n\n- **No cloning**: It's not possible to replicate the repetition code for quantum systems in a straightforward manner, by duplicating the quantum state several times, since the no-cloning theorem prohibits that.\n- **Observing the system damages information**: Even if the no-cloning theorem didn't prohibit producing several copies of a quantum state, it wouldn't be possible to compare the states of the copies afterwards without damaging their state.\n- **Errors are continuous**: Errors in quantum computing are much more complicated than bit flip errors in classical systems.\n\nThe simplest model used to analyze quantum noise is *quantum depolarizing channel*. \nThis model assumes that the channel transmits the qubit unchanged with probability $1-p$, and applies one of the Pauli gates $X$, $Y$, and $Z$ with probability $\\frac{p}{3}$ each. The effects of the noise on each qubit transmitted are independent.\n\nAt first glance, this model seems to be limited, and not representative of the full spectrum of errors that can occur in a quantum system. Fortunately, it turns out that any errors on encoded states can be corrected by correcting only a discrete subset of errors - exactly the Pauli $X$, $Y$, and $Z$ errors! This is called *discretization of quantum errors*, and you'll see how it works later in this kata.\n\n> For now, we assume that all errors are introduced by the channel, and the gates and measurements used for encoding and decoding procedures of a quantum error correction code are perfect and don't introduce any errors themselves. This is a useful assumption to get started with error correction, but in real life all gates and measurements are noisy, so eventually we'll need to modify this approach.\n> *Fault-tolerant quantum computation* handles the more general scenario of performing computations on encoded states in a way that tolerates errors introduced by noisy gates and measurements."
|
|
6904
7380
|
}
|
|
6905
7381
|
]
|
|
6906
7382
|
},
|
|
@@ -6911,7 +7387,7 @@ export default {
|
|
|
6911
7387
|
"items": [
|
|
6912
7388
|
{
|
|
6913
7389
|
"type": "text-content",
|
|
6914
|
-
"content": "\nQuantum error correction is based on the use of a special kind of measurements - joint measurements in Pauli bases.\
|
|
7390
|
+
"content": "\nQuantum error correction is based on the use of a special kind of measurements - joint measurements in Pauli bases.\nYou can learn more about the single-qubit measurements in different Pauli bases in the Measurements in Single-Qubit Systems kata,\nand the general case of joint measurements in the Measurements in Multi-Qubit Systems kata.\nLet's take a closer look at the kinds of joint measurements you'll use in this kata.\n\nA multi-qubit Pauli measurement on $n$ qubits corresponds to an operator $M_1 \\otimes \\dotsc \\otimes M_n$, with each $M_j$ being from the set of gates $\\{X,Y,Z,I\\}$, and at least one of the $M_j$ is not the identity matrix. (If $M_j = I$, you can think of it as qubit $j$ not being involved in the measurement.) The measurement can produce one of the two outcomes: `Zero` corresponding to eigenvalue $+1$ of this operator, or `One` corresponding to the eigenvalue $-1$. The corresponding projection operators are the projections onto the corresponding eigenspaces. The operator $M_1 \\otimes \\dotsc \\otimes M_n$ is referred to as the _measurement basis_.\n\nFor example, the first two joint measurements you'll encounter later in this kata are two-qubit measurements in $ZZ$ and $XX$ bases. They can be described as follows:\n\n<table>\n <tr>\n <th>Pauli Operator</th>\n <th>Eigenvalue</th>\n <th>Eigenvectors</th>\n <th>Measurement Projector</th>\n <th>Measurement Result in Q#</th>\n </tr>\n <tr>\n <td rowspan=\"2\">$ZZ$</td>\n <td>$+1$</td>\n <td>$\\ket{00}$, $\\ket{11}$</td>\n <td>$\\ket{00}\\bra{00} + \\ket{11}\\bra{11}$</td>\n <td>Zero</td>\n </tr><tr>\n <td>$-1$</td>\n <td>$\\ket{01}$, $\\ket{10}$</td>\n <td>$\\ket{01}\\bra{01} + \\ket{10}\\bra{10}$</td>\n <td>One</td>\n </tr>\n <tr>\n <td rowspan=\"2\">$XX$</td>\n <td>$+1$</td>\n <td>$\\ket{++}$, $\\ket{--}$</td>\n <td>$\\ket{++}\\bra{++} + \\ket{--}\\bra{--}$</td>\n <td>Zero</td>\n </tr><tr>\n <td>$-1$</td>\n <td>$\\ket{+-}$, $\\ket{-+}$</td>\n <td>$\\ket{+-}\\bra{+-} + \\ket{-+}\\bra{-+}$</td>\n <td>One</td>\n </tr>\n</table>\n\nIn Q#, joint measurements in Pauli bases are implemented using the `Measure` operation.\nThe `Measure` operation takes two parameters: the array of `Pauli` constants (`PauliI`, `PauliX`, `PauliY`, or `PauliZ`) that define the basis for measurement, and the array of qubits to be measured."
|
|
6915
7391
|
}
|
|
6916
7392
|
]
|
|
6917
7393
|
},
|
|
@@ -6925,7 +7401,8 @@ export default {
|
|
|
6925
7401
|
},
|
|
6926
7402
|
"sourceIds": [
|
|
6927
7403
|
"qec_shor__zz_measurement__Verification.qs",
|
|
6928
|
-
"KatasLibrary.qs"
|
|
7404
|
+
"KatasLibrary.qs",
|
|
7405
|
+
"qec_shor__Common.qs"
|
|
6929
7406
|
],
|
|
6930
7407
|
"placeholderCode": "namespace Kata {\n operation ZZMeasurement(qs : Qubit[]) : Int {\n // Implement your solution here...\n\n return -1;\n }\n}\n",
|
|
6931
7408
|
"explainedSolution": {
|
|
@@ -6933,7 +7410,7 @@ export default {
|
|
|
6933
7410
|
"items": [
|
|
6934
7411
|
{
|
|
6935
7412
|
"type": "text-content",
|
|
6936
|
-
"content": "\
|
|
7413
|
+
"content": "\nYou need to measure the *parity* of the state without collapsing it all the way to the basis states. This means that you need to do the $Z \\otimes Z$ measurement on both qubits.\n\nA joint measurement using $Z \\otimes Z$ operator can be thought of as projecting the measured state to one of the two eigenspaces of $Z \\otimes Z$ with $+1$ and $-1$ as the corresponding eigenvalues. The measurement returns `Zero` if the measured state is projected to the space with an eigenvalue of $+1$, and a result of `One` if projected to the space with an eigenvalue of $-1$.\n\nYou can see that the state $\\alpha \\ket{00} + \\beta \\ket{11}$ is an eigenstate of the $Z \\otimes Z$ operator with the eigenvalue $+1$, and the state $\\alpha \\ket{01} + \\beta \\ket{10}$ is an eigenstate with the eigenvalue $-1$.\nHence, you can use this joint measurement to recognize which of the superposition states you were given while preserving the initial superposition state."
|
|
6937
7414
|
},
|
|
6938
7415
|
{
|
|
6939
7416
|
"type": "solution",
|
|
@@ -6953,7 +7430,8 @@ export default {
|
|
|
6953
7430
|
},
|
|
6954
7431
|
"sourceIds": [
|
|
6955
7432
|
"qec_shor__xx_measurement__Verification.qs",
|
|
6956
|
-
"KatasLibrary.qs"
|
|
7433
|
+
"KatasLibrary.qs",
|
|
7434
|
+
"qec_shor__Common.qs"
|
|
6957
7435
|
],
|
|
6958
7436
|
"placeholderCode": "namespace Kata {\n operation XXMeasurement(qs : Qubit[]) : Int {\n // Implement your solution here...\n\n return -1;\n }\n}\n",
|
|
6959
7437
|
"explainedSolution": {
|
|
@@ -6961,7 +7439,7 @@ export default {
|
|
|
6961
7439
|
"items": [
|
|
6962
7440
|
{
|
|
6963
7441
|
"type": "text-content",
|
|
6964
|
-
"content": "\nThis time,
|
|
7442
|
+
"content": "\nThis time, you need to do the $X \\otimes X$ measurement on both qubits.\n\nThe state $\\alpha \\ket{++} + \\beta \\ket{--}$ is an eigenstate of the $X \\otimes X$ operator with the eigenvalue $+1$, and the state $\\alpha \\ket{+-} + \\beta \\ket{-+}$ is an eigenstate with the eigenvalue $-1$.\nHence, you can use this joint measurement to recognize which of the superposition states you were given while preserving the initial superposition state."
|
|
6965
7443
|
},
|
|
6966
7444
|
{
|
|
6967
7445
|
"type": "solution",
|
|
@@ -6978,7 +7456,7 @@ export default {
|
|
|
6978
7456
|
"items": [
|
|
6979
7457
|
{
|
|
6980
7458
|
"type": "text-content",
|
|
6981
|
-
"content": "\nCan we reuse the ideas of a classical repetition code for a quantum error correction code? \n\nThe naive approach to it would be to try and encode a quantum state $\\ket{\\psi}$ as several copies of itself: \n$\\ket{\\psi} \\rightarrow \\ket{\\psi} \\otimes \\ket{\\psi} \\otimes \\ket{\\psi}$.\nUnfortunately, the no-cloning theorem and the inability to reconstruct a state accurately after measuring it
|
|
7459
|
+
"content": "\nCan we reuse the ideas of a classical repetition code for a quantum error correction code? \n\nThe naive approach to it would be to try and encode a quantum state $\\ket{\\psi}$ as several copies of itself: \n$\\ket{\\psi} \\rightarrow \\ket{\\psi} \\otimes \\ket{\\psi} \\otimes \\ket{\\psi}$.\nUnfortunately, the no-cloning theorem and the inability to reconstruct a state accurately after measuring it make this approach impossible.\n\nYou can, however, take a slightly different approach: encode the *basis states* $\\ket{0}$ and $\\ket{1}$ in repetition code using a unitary transformation, and deduce the effects of this transformation on superposition states based on its linearity:\n\n$$\\ket{0} \\rightarrow \\ket{000}, \\ket{1} \\rightarrow \\ket{111}$$\n\n$$\\alpha \\ket{0} + \\beta \\ket{1} \\rightarrow \\alpha \\ket{000} + \\beta \\ket{111}$$\n\nThis encoding is called **bit flip code**, and the states $\\ket{000}$, $\\ket{111}$, and their linear combinations are called **code words** in this code. The bit flip code allows us to detect and correct some errors that can occur on qubits in the depolarizing channel, though not all of them.\n\nLet's see what happens if an $X$ error happens on one of the qubits, and how you can detect it using two parity measurements (measurements in the $ZZ$ basis).\n\n<table>\n<tr>\n<th>Error</th>\n<th>State after the error</th>\n<th>Parity of qubits 0 and 1</th>\n<th>Parity of qubits 1 and 2</th>\n</tr>\n<tr>\n<td>No error</td>\n<td>$\\alpha \\ket{000} + \\beta \\ket{111}$</td>\n<td>$0$</td>\n<td>$0$</td>\n</tr>\n<tr>\n<td>$X_0$ (error on qubit $0$)</td>\n<td>$\\alpha \\ket{100} + \\beta \\ket{011}$</td>\n<td>$1$</td>\n<td>$0$</td>\n</tr>\n<tr>\n<td>$X_1$ (error on qubit $1$)</td>\n<td>$\\alpha \\ket{010} + \\beta \\ket{101}$</td>\n<td>$1$</td>\n<td>$1$</td>\n</tr>\n<tr>\n<td>$X_2$ (error on qubit $2$)</td>\n<td>$\\alpha \\ket{001} + \\beta \\ket{110}$</td>\n<td>$0$</td>\n<td>$1$</td>\n</tr>\n</table>\n\nYou can see that these two parity measurements give us different pairs of results depending on whether the $X$ error happened and on which qubit. This means that you can use them to detect the error, and then correct it by applying an $X$ gate to the qubit that was affected by it.\n\nHowever, if a $Z$ error happens on any one of these qubits, you won't be able to detect it: it will convert the state $\\alpha \\ket{000} + \\beta \\ket{111}$ to the state $\\alpha \\ket{000} - \\beta \\ket{111}$ which is a valid code word in this code - it's an encoding of the quantum state $\\alpha \\ket{0} - \\beta \\ket{1}$. You need to come up with a different way to detect $Z$ errors."
|
|
6982
7460
|
}
|
|
6983
7461
|
]
|
|
6984
7462
|
},
|
|
@@ -6992,7 +7470,8 @@ export default {
|
|
|
6992
7470
|
},
|
|
6993
7471
|
"sourceIds": [
|
|
6994
7472
|
"qec_shor__bitflip_encode__Verification.qs",
|
|
6995
|
-
"KatasLibrary.qs"
|
|
7473
|
+
"KatasLibrary.qs",
|
|
7474
|
+
"qec_shor__Common.qs"
|
|
6996
7475
|
],
|
|
6997
7476
|
"placeholderCode": "namespace Kata {\n operation BitflipEncode (qs : Qubit[]) : Unit is Adj + Ctl {\n // Implement your solution here...\n \n }\n}",
|
|
6998
7477
|
"explainedSolution": {
|
|
@@ -7000,7 +7479,7 @@ export default {
|
|
|
7000
7479
|
"items": [
|
|
7001
7480
|
{
|
|
7002
7481
|
"type": "text-content",
|
|
7003
|
-
"content": "\
|
|
7482
|
+
"content": "\nYou can do this using $CNOT$ gates with the first qubit as control. This will keep the term $\\alpha \\ket{000}$ unchanged and flip $\\beta \\ket{100}$ to $\\beta \\ket{111}$."
|
|
7004
7483
|
},
|
|
7005
7484
|
{
|
|
7006
7485
|
"type": "solution",
|
|
@@ -7016,7 +7495,7 @@ export default {
|
|
|
7016
7495
|
"title": "Bit Flip Code: Detect X Error",
|
|
7017
7496
|
"description": {
|
|
7018
7497
|
"type": "text-content",
|
|
7019
|
-
"content": "**Input**: three qubits that are either in the state $\\ket{\\psi_L} = \\alpha \\ket{000} + \\beta \\ket{111}$\nor in one of the states $(X \\otimes I \\otimes I)\\ket{\\psi_L}$, $(I \\otimes X \\otimes I)\\ket{\\psi_L}$, or $(I \\otimes I \\otimes X)\\ket{\\psi_L}$ (that is, either in a valid code word of the bit flip code or a code word with an $X$ error occurring on one of the qubits).\n\n**Goal**: determine whether an $X$ error has occurred, and if so, on which qubit. \nThe return value should be the index of the qubit on which the error occurred, or $-1$ if no error occurred.\nThe state of the qubits after your operation is applied
|
|
7498
|
+
"content": "**Input**: three qubits that are either in the state $\\ket{\\psi_L} = \\alpha \\ket{000} + \\beta \\ket{111}$\nor in one of the states $(X \\otimes I \\otimes I)\\ket{\\psi_L}$, $(I \\otimes X \\otimes I)\\ket{\\psi_L}$, or $(I \\otimes I \\otimes X)\\ket{\\psi_L}$ (that is, either in a valid code word of the bit flip code or a code word with an $X$ error occurring on one of the qubits).\n\n**Goal**: determine whether an $X$ error has occurred, and if so, on which qubit. \nThe return value should be the index of the qubit on which the error occurred, or $-1$ if no error occurred.\nThe state of the qubits after your operation is applied shouldn't change.\n"
|
|
7020
7499
|
},
|
|
7021
7500
|
"sourceIds": [
|
|
7022
7501
|
"qec_shor__bitflip_detect__Verification.qs",
|
|
@@ -7029,7 +7508,7 @@ export default {
|
|
|
7029
7508
|
"items": [
|
|
7030
7509
|
{
|
|
7031
7510
|
"type": "text-content",
|
|
7032
|
-
"content": "\nTo identify the qubit on which the error happened,
|
|
7511
|
+
"content": "\nTo identify the qubit on which the error happened, you need to do two parity measurements in the $ZZ$ basis on any two different pairs of qubits and analyze their outcomes: \n\n- If both parity measurements yield $0$, no error occurred.\n- If both parity measurements yield $1$, the error occurred on the qubit that is shared between the measured pairs of qubits.\n- If one of the parity measurements yields $1$ and the other $0$, the error occurred on the qubit that was part of only the pair of qubits involved in the measurement that yields $1$ but not the other pair.\n\nThe code below implements this logic using $ZZ$ parity measurements on pairs of qubits $0, 1$ and $1, 2$."
|
|
7033
7512
|
},
|
|
7034
7513
|
{
|
|
7035
7514
|
"type": "solution",
|
|
@@ -7046,7 +7525,7 @@ export default {
|
|
|
7046
7525
|
"items": [
|
|
7047
7526
|
{
|
|
7048
7527
|
"type": "text-content",
|
|
7049
|
-
"content": "\nWhat kind of code could detect and correct a $Z$ error?
|
|
7528
|
+
"content": "\nWhat kind of code could detect and correct a $Z$ error? You detected an $X$ error using the fact that in the $\\{\\ket{0}, \\ket{1}\\}$ basis the error changed the basis state. Similarly, you can detect a $Z$ error using the $\\{\\ket{+}, \\ket{-}\\}$ basis, in which the $Z$ gate converts $\\ket{+}$ to $\\ket{-}$ and vice versa, acting as a basis change operation.\n\nBased on this idea, you can construct the **phase flip code** that uses the following encoding:\n\n$$\\ket{0} \\rightarrow \\ket{+++}, \\ket{1} \\rightarrow \\ket{---}$$\n\n$$\\alpha \\ket{0} + \\beta \\ket{1} \\rightarrow \\alpha \\ket{+++} + \\beta \\ket{---}$$\n\nLet's see what happens if a $Z$ error happens on one of the qubits, and how you can detect it using two parity measurements. \nThis time you do the parity measurements in the $X$ basis to distinguish the cases of $\\ket{++}$ and $\\ket{--}$ (parity $0$) from $\\ket{+-}$ and $\\ket{-+}$ (parity $1$).\n\n<table>\n<tr>\n<th>Error</th>\n<th>State after the error</th>\n<th>$XX$ parity of qubits 0 and 1</th>\n<th>$XX$ parity of qubits 1 and 2</th>\n</tr>\n<tr>\n<td>No error</td>\n<td>$\\alpha \\ket{+++} + \\beta \\ket{---}$</td>\n<td>$0$</td>\n<td>$0$</td>\n</tr>\n<tr>\n<td>$Z_0$ (error on qubit $0$)</td>\n<td>$\\alpha \\ket{-++} + \\beta \\ket{+--}$</td>\n<td>$1$</td>\n<td>$0$</td>\n</tr>\n<tr>\n<td>$Z_1$ (error on qubit $1$)</td>\n<td>$\\alpha \\ket{+-+} + \\beta \\ket{-+-}$</td>\n<td>$1$</td>\n<td>$1$</td>\n</tr>\n<tr>\n<td>$Z_2$ (error on qubit $2$)</td>\n<td>$\\alpha \\ket{++-} + \\beta \\ket{--+}$</td>\n<td>$0$</td>\n<td>$1$</td>\n</tr>\n</table>\n\nYou can see that these two parity measurements give different pairs of results depending on whether the $Z$ error happened and on which qubit. This means that you can use them to detect the error, and then correct it by applying a $Z$ gate to the qubit that was affected by it.\n\nHowever, if an $X$ error happens on any one of these qubits, you won't be able to detect it: it will convert the state $\\alpha \\ket{+++} + \\beta \\ket{---}$ to the state $\\alpha \\ket{+++} - \\beta \\ket{---}$ which is a valid code word in this code - it's an encoding of the quantum state $\\alpha \\ket{0} - \\beta \\ket{1}$. You need to come up with a different way to detect **both** $X$ and $Z$ errors in the same encoding."
|
|
7050
7529
|
}
|
|
7051
7530
|
]
|
|
7052
7531
|
},
|
|
@@ -7056,11 +7535,12 @@ export default {
|
|
|
7056
7535
|
"title": "Phase Flip Code: Encode Codewords",
|
|
7057
7536
|
"description": {
|
|
7058
7537
|
"type": "text-content",
|
|
7059
|
-
"content": "**Input**: three qubits in the state $\\ket{\\psi} \\otimes \\ket{00}$, where $\\ket{\\psi} = \\alpha \\ket{0} + \\beta \\ket{1}$ is the state of the first qubit,
|
|
7538
|
+
"content": "**Input**: three qubits in the state $\\ket{\\psi} \\otimes \\ket{00}$, where $\\ket{\\psi} = \\alpha \\ket{0} + \\beta \\ket{1}$ is the state of the first qubit, that is, `qs[0]`.\n\n**Goal**: prepare a state $\\alpha \\ket{+++} + \\beta \\ket{---}$ on these qubits.\n"
|
|
7060
7539
|
},
|
|
7061
7540
|
"sourceIds": [
|
|
7062
7541
|
"qec_shor__phaseflip_encode__Verification.qs",
|
|
7063
|
-
"KatasLibrary.qs"
|
|
7542
|
+
"KatasLibrary.qs",
|
|
7543
|
+
"qec_shor__Common.qs"
|
|
7064
7544
|
],
|
|
7065
7545
|
"placeholderCode": "namespace Kata {\n operation PhaseflipEncode (qs : Qubit[]) : Unit is Adj + Ctl {\n // Implement your solution here...\n \n }\n}",
|
|
7066
7546
|
"explainedSolution": {
|
|
@@ -7068,7 +7548,7 @@ export default {
|
|
|
7068
7548
|
"items": [
|
|
7069
7549
|
{
|
|
7070
7550
|
"type": "text-content",
|
|
7071
|
-
"content": "\
|
|
7551
|
+
"content": "\nYou can implement this encoding in two steps:\n\n1. Use bit flip encoding to convert $\\alpha \\ket{000} + \\beta \\ket{100}$ into $\\alpha \\ket{000} + \\beta \\ket{111}$.\n2. Apply a Hadamard gate to each qubit to convert each of the $\\ket{0}$ states into $\\ket{+}$ and each of the $\\ket{1}$ states into $\\ket{-}$."
|
|
7072
7552
|
},
|
|
7073
7553
|
{
|
|
7074
7554
|
"type": "solution",
|
|
@@ -7084,7 +7564,7 @@ export default {
|
|
|
7084
7564
|
"title": "Phase Flip Code: Detect Z Error",
|
|
7085
7565
|
"description": {
|
|
7086
7566
|
"type": "text-content",
|
|
7087
|
-
"content": "**Input**: three qubits that are either in the state $\\ket{\\psi_L} = \\alpha \\ket{+++} + \\beta \\ket{---}$\nor in one of the states $(Z \\otimes I \\otimes I)\\ket{\\psi_L}$, $(I \\otimes Z \\otimes I)\\ket{\\psi_L}$, or $(I \\otimes I \\otimes Z)\\ket{\\psi_L}$ (that is, either in a valid code word of the phase flip code or a code word with a $Z$ error occurring on one of the qubits).\n\n**Goal**: determine whether a $Z$ error has occurred, and if so, on which qubit. \nThe return value should be the index of the qubit on which the error occurred, or $-1$ if no error occurred.\nThe state of the qubits after your operation is applied
|
|
7567
|
+
"content": "**Input**: three qubits that are either in the state $\\ket{\\psi_L} = \\alpha \\ket{+++} + \\beta \\ket{---}$\nor in one of the states $(Z \\otimes I \\otimes I)\\ket{\\psi_L}$, $(I \\otimes Z \\otimes I)\\ket{\\psi_L}$, or $(I \\otimes I \\otimes Z)\\ket{\\psi_L}$ (that is, either in a valid code word of the phase flip code or a code word with a $Z$ error occurring on one of the qubits).\n\n**Goal**: determine whether a $Z$ error has occurred, and if so, on which qubit. \nThe return value should be the index of the qubit on which the error occurred, or $-1$ if no error occurred.\nThe state of the qubits after your operation is applied shouldn't change.\n"
|
|
7088
7568
|
},
|
|
7089
7569
|
"sourceIds": [
|
|
7090
7570
|
"qec_shor__phaseflip_detect__Verification.qs",
|
|
@@ -7097,7 +7577,7 @@ export default {
|
|
|
7097
7577
|
"items": [
|
|
7098
7578
|
{
|
|
7099
7579
|
"type": "text-content",
|
|
7100
|
-
"content": "\nTo identify the qubit on which the error happened,
|
|
7580
|
+
"content": "\nTo identify the qubit on which the error happened, you can use the same logic as you did for the error detection for the bit flip code. You need to do two parity measurements, this time in the $XX$ basis, on any two different pairs of qubits and analyze their outcomes.\nThe code below implements this logic using $XX$ parity measurements on pairs of qubits $0, 1$ and $1, 2$."
|
|
7101
7581
|
},
|
|
7102
7582
|
{
|
|
7103
7583
|
"type": "solution",
|
|
@@ -7114,7 +7594,7 @@ export default {
|
|
|
7114
7594
|
"items": [
|
|
7115
7595
|
{
|
|
7116
7596
|
"type": "text-content",
|
|
7117
|
-
"content": "\nCan we combine the lessons learned from the bit flip and phase flip error correction codes to be able to detect and correct both $X$ and $Z$ errors? In that case, we'd also be able to handle $Y$ errors as a combination of $X$ and $Z$ errors happening at the same time, and, as a result, we'll be able to detect and correct
|
|
7597
|
+
"content": "\nCan we combine the lessons learned from the bit flip and phase flip error correction codes to be able to detect and correct both $X$ and $Z$ errors? In that case, we'd also be able to handle $Y$ errors as a combination of $X$ and $Z$ errors happening at the same time, and, as a result, we'll be able to detect and correct any arbitrary **single-qubit** error.\n\nThe Shor code, published in 1995, combines the approaches of the bit flip and phase flip codes.\nIt uses the following 9-qubit encoding for logical states:\n\n$$\\ket{0} \\rightarrow \\ket{0_L} = \\frac1{2\\sqrt2} (\\ket{000} + \\ket{111}) \\otimes (\\ket{000} + \\ket{111}) \\otimes (\\ket{000} + \\ket{111})$$\n$$\\ket{1} \\rightarrow \\ket{1_L} = \\frac1{2\\sqrt2} (\\ket{000} - \\ket{111}) \\otimes (\\ket{000} - \\ket{111}) \\otimes (\\ket{000} - \\ket{111})$$\n$$\\alpha \\ket{0} + \\beta \\ket{1} \\rightarrow \\alpha \\ket{0_L} + \\beta \\ket{1_L}$$\n\n> Shor code was created as a *concatenation* of bit flip and phase flip codes. Encoding a qubit into its 9-qubit representation happens in two steps:\n>\n> 1. A qubit is encoded in three qubits using the phase flip code.\n> 2. After that, each of those three qubits is encoded again using the bit flip code.\n>\n> Concatenation is a commonly used method of combining several error correction codes by encoding the qubit state using the first code, followed by encoding each qubit of the resulting state using the second code, and so on.\n\nHow can you detect and correct errors using Shor code?\n\n### Detect and Correct X Errors\n\n$X$ errors happening on any qubit manifest very similarly to the way they do in the bit flip code.\nLet's consider the first triplet of qubits and an error that happens on any of the first three qubits.\nSame as in the bit flip code, measuring the parity of pairs of qubits always returns $0$ if there is no error (since all bits in each basis state of the code words are the same), so a parity measurement returning $1$ on one or two pairs indicates an error, and the measurements which returned $1$ allow us to track down the qubit on which it happened.\n\nTo correct an $X$ error, you simply apply an $X$ gate to the affected qubit.\n\n### Detect and Correct Z Errors\n\n$Z$ errors in Shor code behave similarly to the way they do in the phase flip code, but the error detection and correction procedure has to be modified.\n\nA $Z$ error happening on any qubit of a triplet flips the relative sign between the basis states $\\ket{000}$ and $\\ket{111}$ on those qubits. This means that you need a measurement that would compare relative signs of whole triplets, rather than individual qubits, allowing us to distinguish $(\\ket{000} + \\ket{111}) \\otimes (\\ket{000} + \\ket{111})$ and $(\\ket{000} - \\ket{111}) \\otimes (\\ket{000} - \\ket{111})$ (parts of valid code words) from $(\\ket{000} + \\ket{111}) \\otimes (\\ket{000} - \\ket{111})$ and $(\\ket{000} - \\ket{111}) \\otimes (\\ket{000} + \\ket{111})$ (parts of code words with a $Z$ error applied).\n\nThe measurement that allows you to do this is a 6-qubit measurement in the $X$ basis.\n\n> How can you check this? Remember that doing a measurement in the $X$ basis is the same as applying Hadamard gates to each qubit and then doing a measurement in the $Z$ basis (and then applying Hadamard gates again). \n> \n> - If you apply Hadamard gates to each qubit of the state $\\frac1{\\sqrt2}(\\ket{000} + \\ket{111})$, you get the state \n> $\\frac12(\\ket{000} + \\ket{011} + \\ket{101} + \\ket{110})$. The parity of each basis state in it is $0$.\n> - If you apply Hadamard gates to each qubit of the state $\\frac1{\\sqrt2}(\\ket{000} - \\ket{111})$, you get the state \n> $\\frac12(\\ket{001} + \\ket{010} + \\ket{100} + \\ket{111})$. The parity of each basis state in it is $1$.\n>\n> Thus, a 6-qubit measurement in the $X$ basis of two triplets, each either in the state $\\frac1{\\sqrt2}(\\ket{000} + \\ket{111})$ or $\\frac1{\\sqrt2}(\\ket{000} - \\ket{111})$, would produce parity $0$ if both triplets have the same relative sign between the basis states and $1$ if the relative sign is different.\n\nTo correct a $Z$ error, you can no longer simply apply a $Z$ gate to the affected qubit, since you can only figure out the triplet of qubits where the error happened, not the exact qubit. To work around this, you correct a $Z$ error by applying a $Z$ gate to each qubit of the affected triplet - and $Z$ gates applied to unaffected qubits just cancel each other out."
|
|
7118
7598
|
}
|
|
7119
7599
|
]
|
|
7120
7600
|
},
|
|
@@ -7124,11 +7604,12 @@ export default {
|
|
|
7124
7604
|
"title": "Shor Code: Encode Codewords",
|
|
7125
7605
|
"description": {
|
|
7126
7606
|
"type": "text-content",
|
|
7127
|
-
"content": "**Input**: nine qubits in the state $\\ket{\\psi} \\otimes \\ket{0 \\ldots 0}$, where $\\ket{\\psi} = \\alpha \\ket{0} + \\beta \\ket{1}$ is the state of the first qubit,
|
|
7607
|
+
"content": "**Input**: nine qubits in the state $\\ket{\\psi} \\otimes \\ket{0 \\ldots 0}$, where $\\ket{\\psi} = \\alpha \\ket{0} + \\beta \\ket{1}$ is the state of the first qubit, that is, `qs[0]`.\n\n**Goal**: prepare a state $\\alpha \\ket{0_L} + \\beta \\ket{1_L}$ on these qubits, where\n$$\\ket{0_L} = \\frac1{2\\sqrt2} (\\ket{000} + \\ket{111}) \\otimes (\\ket{000} + \\ket{111}) \\otimes (\\ket{000} + \\ket{111})$$\nand \n$$\\ket{1_L} = \\frac1{2\\sqrt2} (\\ket{000} - \\ket{111}) \\otimes (\\ket{000} - \\ket{111}) \\otimes (\\ket{000} - \\ket{111})$$\n"
|
|
7128
7608
|
},
|
|
7129
7609
|
"sourceIds": [
|
|
7130
7610
|
"qec_shor__shor_encode__Verification.qs",
|
|
7131
|
-
"KatasLibrary.qs"
|
|
7611
|
+
"KatasLibrary.qs",
|
|
7612
|
+
"qec_shor__Common.qs"
|
|
7132
7613
|
],
|
|
7133
7614
|
"placeholderCode": "namespace Kata {\n operation ShorEncode (qs : Qubit[]) : Unit is Adj + Ctl {\n // Implement your solution here...\n \n }\n\n // You might find this helper operation from an earlier task useful.\n operation BitflipEncode (qs : Qubit[]) : Unit is Adj + Ctl {\n CNOT(qs[0], qs[1]);\n CNOT(qs[0], qs[2]);\n }\n}",
|
|
7134
7615
|
"explainedSolution": {
|
|
@@ -7136,7 +7617,7 @@ export default {
|
|
|
7136
7617
|
"items": [
|
|
7137
7618
|
{
|
|
7138
7619
|
"type": "text-content",
|
|
7139
|
-
"content": "\
|
|
7620
|
+
"content": "\nYou can implement this encoding in two steps.\n\nFirst, you use phase flip encoding on qubits with indices $0, 3, 6$ to convert $\\alpha \\ket{000} + \\beta \\ket{100}$ into $\\alpha \\ket{+++} + \\beta \\ket{---}$.\nAfter this, the state of the system is \n\n$$\\alpha \\ket{+00} \\otimes \\ket{+00} \\otimes \\ket{+00} + \\beta \\ket{-00} \\otimes \\ket{-00} \\otimes \\ket{-00}$$\n\nThen, you use bit flip encoding on each triplet of qubits $0 \\ldots 2, 3 \\ldots 5, 6 \\ldots 8$ to convert each $\\ket{+00}$ into $\\frac1{\\sqrt2} (\\ket{000} + \\ket{111})$ and each $\\ket{-00}$ into $\\frac1{\\sqrt2} (\\ket{000} - \\ket{111})$. After this, the nine-qubit system will be exactly in the state you're looking for."
|
|
7140
7621
|
},
|
|
7141
7622
|
{
|
|
7142
7623
|
"type": "solution",
|
|
@@ -7152,11 +7633,12 @@ export default {
|
|
|
7152
7633
|
"title": "Shor Code: Detect X, Y, and Z Errors",
|
|
7153
7634
|
"description": {
|
|
7154
7635
|
"type": "text-content",
|
|
7155
|
-
"content": "**Input**: nine qubits that are either in the state $\\ket{\\psi_L} = \\alpha \\ket{0_L} + \\beta \\ket{0_L}$ (a valid code word of the Shor code) or the state that is a code word with $X$, $Y$, or $Z$ error occurring on one of the qubits.\n\n**Goal**: determine whether an error has occurred, and if so, what type and on which qubit. \nThe return value is a tuple of two elements, describing the detected error as follows:\n\n- The first element of the return is an `Int` - the index of the qubit on which the error occurred, or $-1$ if no error occurred.\n- The second element of the return is a `Pauli` indicating the type of the error (`PauliX`, `PauliY`, or `PauliZ`).\nIf no error occurred, the second element of the return can be any value, it
|
|
7636
|
+
"content": "**Input**: nine qubits that are either in the state $\\ket{\\psi_L} = \\alpha \\ket{0_L} + \\beta \\ket{0_L}$ (a valid code word of the Shor code) or the state that is a code word with $X$, $Y$, or $Z$ error occurring on one of the qubits.\n\n**Goal**: determine whether an error has occurred, and if so, what type and on which qubit. \nThe return value is a tuple of two elements, describing the detected error as follows:\n\n- The first element of the return is an `Int` - the index of the qubit on which the error occurred, or $-1$ if no error occurred.\n- The second element of the return is a `Pauli` indicating the type of the error (`PauliX`, `PauliY`, or `PauliZ`).\nIf no error occurred, the second element of the return can be any value, it isn't validated.\n- In case of a single $Z$ error, the qubit on which it occurred cannot be identified uniquely. \nIn this case, the return value should be the index of the triplet of qubits in which the error occurred ($0$ for qubits $0 \\ldots 2$, $1$ for qubits $3 \\ldots 5$, and $2$ for qubits $6 \\ldots 8$).\n\nExample return values:\n\n<table>\n<tr>\n<th>Error</th>\n<th>Return value</th>\n</tr>\n<tr>\n<td>No error</td>\n<td>(-1, PauliI)</td>\n</tr>\n<tr>\n<td>$X$ error on qubit $0$</td>\n<td>(0, PauliX)</td>\n</tr>\n<tr>\n<td>$Y$ error on qubit $4$</td>\n<td>(4, PauliY)</td>\n</tr>\n<tr>\n<td>$Z$ error on qubit $8$ (last triplet)</td>\n<td>(2, PauliZ)</td>\n</tr>\n</table>\n\nThe state of the qubits after your operation is applied shouldn't change.\n"
|
|
7156
7637
|
},
|
|
7157
7638
|
"sourceIds": [
|
|
7158
7639
|
"qec_shor__shor_detect__Verification.qs",
|
|
7159
|
-
"KatasLibrary.qs"
|
|
7640
|
+
"KatasLibrary.qs",
|
|
7641
|
+
"qec_shor__Common.qs"
|
|
7160
7642
|
],
|
|
7161
7643
|
"placeholderCode": "namespace Kata {\n operation ShorDetectError (qs : Qubit[]) : (Int, Pauli) {\n // Implement your solution here...\n\n return (-2, PauliI);\n }\n\n // You might find this helper operation from an earlier task useful.\n operation BitflipDetectError (qs : Qubit[]) : Int {\n let m1 = Measure([PauliZ, PauliZ], qs[0 .. 1]);\n let m2 = Measure([PauliZ, PauliZ], qs[1 .. 2]);\n \n if m1 == One and m2 == Zero {\n return 0;\n } elif m1 == One and m2 == One {\n return 1;\n } elif m1 == Zero and m2 == One {\n return 2;\n } else {\n return -1;\n }\n }\n}",
|
|
7162
7644
|
"explainedSolution": {
|
|
@@ -7164,7 +7646,7 @@ export default {
|
|
|
7164
7646
|
"items": [
|
|
7165
7647
|
{
|
|
7166
7648
|
"type": "text-content",
|
|
7167
|
-
"content": "\nFor this code,
|
|
7649
|
+
"content": "\nFor this code, you'll detect $X$ and $Z$ errors separately, similarly to how you did it for bit flip code and phase flip code, and then combine the results into the final answer. A $Y$ error will be signaled by both $X$ and $Z$ errors occurring, since the problem states that at most one error happened.\n\n1. To detect $X$ errors, recall that in Shor code, each triplet of qubits $0 \\ldots 2, 3 \\ldots 5, 6 \\ldots 8$ is an encoding of a $\\ket{+}$ state in the bit flip code. This means that you can detect an $X$ error by applying the bit flip error detection logic to each triplet of qubits separately. \n\n2. To detect $Z$ errors, recall that 6-qubit joint measurements in $X$ basis can detect the parity of the relative phase of the first three qubits and the last three qubits in the measurement, that is, distinguish\n\n $$\\frac12 \\left( (\\ket{000} + \\ket{111}) \\otimes (\\ket{000} + \\ket{111}) + (\\ket{000} - \\ket{111}) \\otimes (\\ket{000} - \\ket{111}) \\right)$$\n\n from \n\n $$\\frac12 \\left( (\\ket{000} + \\ket{111}) \\otimes (\\ket{000} - \\ket{111}) + (\\ket{000} - \\ket{111}) \\otimes (\\ket{000} + \\ket{111}) \\right)$$\n\n This means that you can detect a $Z$ error by doing two 6-qubit joint measurements on qubit triplets $0 \\ldots 2$ & $3 \\ldots 5$ and on $3 \\ldots 5$ & $6 \\ldots 8$ and interpret their results in the same way as you did for bit flip and phase flip codes.\n\n3. To combine the results, you check which of the results occurred: \n\n- if neither $X$ nor $Z$ error was detected, return \"no error\";\n- if both were detected, return the $Y$ error and use the index of the qubit where the $X$ error was detected (remember that you can tract the $Z$ error only to the triplet in which it occurred, not to the exact qubit);\n- if only one error was detected, return that error."
|
|
7168
7650
|
},
|
|
7169
7651
|
{
|
|
7170
7652
|
"type": "solution",
|
|
@@ -7181,7 +7663,7 @@ export default {
|
|
|
7181
7663
|
"items": [
|
|
7182
7664
|
{
|
|
7183
7665
|
"type": "text-content",
|
|
7184
|
-
"content": "\nThe key idea that enables quantum error correction is discretization of quantum errors: being able to correct any kind of error using a code that explicitly allows us to correct only a discrete set of Pauli errors.\n\n> The high-level mathematical reasoning behind our ability to discretize quantum errors is as follows.\n>\n> Let's consider a single-qubit error acting on one of the qubits of the encoded state, converting the entire state from $\\ket{\\psi_L}$ to $E\\ket{\\psi_L}$.\n>
|
|
7666
|
+
"content": "\nThe key idea that enables quantum error correction is discretization of quantum errors: being able to correct any kind of error using a code that explicitly allows us to correct only a discrete set of Pauli errors.\n\n> The high-level mathematical reasoning behind our ability to discretize quantum errors is as follows.\n>\n> Let's consider a single-qubit error acting on one of the qubits of the encoded state, converting the entire state from $\\ket{\\psi_L}$ to $E\\ket{\\psi_L}$.\n> You can represent the state with this error as some superposition of four orthogonal states: $\\ket{\\psi_L}$, $X\\ket{\\psi_L}$, $Z\\ket{\\psi_L}$, and $XZ\\ket{\\psi_L}$ (this is possible because the Pauli matrices $I, X, Y, Z$ form a basis for $2 \\times 2$ Hermitian matrices, so the operator representing the error can be decomposed as their linear combination).\n> \n> Doing the set of parity measurements to detect $X$ and $Z$ errors will collapse the state $E\\ket{\\psi_L}$ into other of these four states, yielding measurement results that match that state. For example, if parity measurements yield a set of results indicating that an $X$ error happened, the state $E\\ket{\\psi_L}$ will collapse to $X\\ket{\\psi_L}$. \n>\n> Then, you can use the results of parity measurements to correct the error that they indicate, bringing our state back to the error-free state $\\ket{\\psi_L}$.\n\n\nDoes Shor code indeed correct all errors, and not just the set of Pauli errors $X$, $Y$, and $Z$? \nLet's try it out!\n\nThe following demo puts together the steps of error correction using Shor code: it encodes a given logical state into multiple qubits, introduces an arbitrary error, runs the error detection code and applies error correction if necessary, and checks that the result is an accurate encoding of the starting logical state. Experiment with applying different errors to different qubits of the code - and not just the Pauli errors but any single-qubit rotations too. You can even use a measurement!"
|
|
7185
7667
|
},
|
|
7186
7668
|
{
|
|
7187
7669
|
"type": "example",
|
|
@@ -7212,20 +7694,20 @@ export default {
|
|
|
7212
7694
|
},
|
|
7213
7695
|
{
|
|
7214
7696
|
"id": "KatasLibrary.qs",
|
|
7215
|
-
"code": "// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nnamespace Microsoft.Quantum.Katas {\n open Microsoft.Quantum.Arrays;\n open Microsoft.Quantum.Convert;\n open Microsoft.Quantum.Diagnostics;\n open Microsoft.Quantum.Math;\n open Microsoft.Quantum.Random;\n\n /// # Summary\n /// Given two operations, checks whether they act identically (including global phase) for all input states.\n /// This is done through controlled versions of the operations instead of plain ones which convert the global phase\n /// into a relative phase that can be detected.\n operation CheckOperationsAreEqualStrict(\n inputSize : Int,\n op : (Qubit[] => Unit is Adj + Ctl),\n reference : (Qubit[] => Unit is Adj + Ctl))\n : Bool {\n Fact(inputSize > 0, \"`inputSize` must be positive\");\n let controlledOp = register => Controlled op(register[...0], register[1...]);\n let controlledReference = register => Controlled reference(register[...0], register[1...]);\n let areEquivalent = CheckOperationsAreEqual(inputSize + 1, controlledOp, controlledReference);\n areEquivalent\n }\n\n /// # Summary\n /// Given two operations, checks whether they act identically on the zero state |0〉 ⊗ |0〉 ⊗ ... ⊗ |0〉 composed of\n /// `inputSize` qubits.\n operation CheckOperationsEquivalenceOnZeroState(\n op : (Qubit[] => Unit),\n reference : (Qubit[] => Unit is Adj),\n inputSize : Int)\n : Bool {\n Fact(inputSize > 0, \"`inputSize` must be positive\");\n use target = Qubit[inputSize];\n op(target);\n Adjoint reference(target);\n let isCorrect = CheckAllZero(target);\n ResetAll(target);\n isCorrect\n }\n\n\n /// # Summary\n /// Given two operations, checks whether they act identically on the given initial state composed of `inputSize` qubits.\n /// The initial state is prepared by applying the `initialState` operation to the state |0〉 ⊗ |0〉 ⊗ ... ⊗ |0〉.\n /// This operation introduces a control qubit to convert a global phase into a relative phase to be able to detect it.\n /// `initialState` operation should be deterministic.\n operation CheckOperationsEquivalenceOnInitialStateStrict(\n initialState : Qubit[] => Unit is Adj,\n op : (Qubit[] => Unit is Adj + Ctl),\n reference : (Qubit[] => Unit is Adj + Ctl),\n inputSize : Int\n ) : Bool {\n use (control, target) = (Qubit(), Qubit[inputSize]);\n within {\n H(control);\n initialState(target);\n }\n apply {\n Controlled op([control], target);\n Adjoint Controlled reference([control], target);\n }\n\n let isCorrect = CheckAllZero([control] + target);\n ResetAll([control] + target);\n isCorrect\n }\n\n\n /// # Summary\n /// Given two operations, checks whether they act identically on the zero state |0〉 ⊗ |0〉 ⊗ ... ⊗ |0〉 composed of\n /// `inputSize` qubits.\n /// This operation introduces a control qubit to convert a global phase into a relative phase to be able to detect\n /// it.\n operation CheckOperationsEquivalenceOnZeroStateStrict(\n op : (Qubit[] => Unit is Adj + Ctl),\n reference : (Qubit[] => Unit is Adj + Ctl),\n inputSize : Int)\n : Bool {\n Fact(inputSize > 0, \"`inputSize` must be positive\");\n CheckOperationsEquivalenceOnInitialStateStrict(qs => (), op, reference, inputSize)\n }\n\n\n /// # Summary\n /// Shows the comparison of the quantum states produced by a specific operation and a reference operation\n /// when applied to the state prepared using deterministic operation `initialState`.\n operation ShowQuantumStateComparison(\n registerSize : Int,\n initialState : Qubit[] => Unit,\n op : Qubit[] => Unit,\n reference : Qubit[] => Unit)\n : Unit {\n {\n use register = Qubit[registerSize];\n initialState(register);\n\n Message(\"Initial quantum state:\");\n DumpMachine();\n\n // Apply the reference operation and dump the simulator state\n reference(register);\n Message(\"Expected quantum state after applying the operation:\");\n DumpMachine();\n ResetAll(register);\n }\n\n {\n use register = Qubit[registerSize];\n initialState(register);\n // Apply the comparison operation and dump the simulator state\n op(register);\n Message(\"Actual quantum state after applying the operation:\");\n DumpMachine();\n ResetAll(register);\n }\n }\n\n /// # Summary\n /// Given two operations, checks whether they act identically on the zero state |0〉 ⊗ |0〉 ⊗ ... ⊗ |0〉 composed of\n /// `inputSize` qubits. If they don't, prints user feedback.\n operation CheckOperationsEquivalenceOnZeroStateWithFeedback(\n testImpl : (Qubit[] => Unit),\n refImpl : (Qubit[] => Unit is Adj),\n inputSize : Int\n ) : Bool {\n\n let isCorrect = CheckOperationsEquivalenceOnZeroState(testImpl, refImpl, inputSize);\n\n // Output different feedback to the user depending on whether the exercise was correct.\n if isCorrect {\n Message(\"Correct!\");\n } else {\n Message(\"Incorrect.\");\n ShowQuantumStateComparison(inputSize, (qs => ()), testImpl, refImpl);\n }\n isCorrect\n }\n\n\n internal operation EntangleRegisters(\n control : Qubit[],\n target : Qubit[]) : Unit is Adj + Ctl {\n Fact(\n Length(control) == Length(target),\n $\"The length of qubit registers must be the same.\");\n\n for index in IndexRange(control) {\n H(control[index]);\n CNOT(control[index], target[index]);\n }\n }\n\n\n /// # Summary\n /// Prepare a random uneven superposition state on the given qubit array.\n operation PrepDemoState(qs : Qubit[]) : Unit {\n Fact(Length(qs) <= 4, \"States with 5 qubits or more are not supported.\");\n let probs = [0.36, 0.25, 1. / 3., 1. / 5.][... Length(qs) - 1];\n for (q, prob) in Zipped(qs, probs) {\n Ry(ArcCos(Sqrt(prob)) * 2.0, q);\n }\n }\n\n\n // \"Framework\" operation for testing single-qubit tasks for distinguishing states of one qubit\n // with Bool return\n operation DistinguishTwoStates_SingleQubit(\n statePrep : ((Qubit, Int) => Unit is Adj),\n testImpl : (Qubit => Bool),\n stateNames : String[],\n preserveState : Bool) : Bool {\n\n let nTotal = 100;\n let nStates = 2;\n mutable misclassifications = [0, size=nStates];\n\n use q = Qubit();\n for _ in 1 .. nTotal {\n // get a random bit to define whether qubit will be in a state corresponding to true return (1) or to false one (0)\n // state = 0 false return\n // state = 1 true return\n let state = DrawRandomInt(0, 1);\n\n // do state prep: convert |0⟩ to outcome with false return or to outcome with true return depending on state\n statePrep(q, state);\n\n // get the solution's answer and verify if NOT a match, then differentiate what kind of mismatch\n let ans = testImpl(q);\n if ans != (state == 1) {\n set misclassifications w/= state <- misclassifications[state] + 1;\n }\n\n // If the final state is to be preserved, check if it was not modified\n if preserveState {\n Adjoint statePrep(q, state);\n if not CheckZero(q) {\n Message($\"Input quantum state {stateNames[state]} was not preserved during the measurement.\");\n Reset(q);\n return false;\n }\n } else {\n Reset(q);\n }\n }\n\n mutable totalMisclassifications = 0;\n for i in 0 .. nStates - 1 {\n if misclassifications[i] != 0 {\n set totalMisclassifications += misclassifications[i];\n Message($\"Misclassified {stateNames[i]} as {stateNames[1 - i]} in {misclassifications[i]} test runs.\");\n }\n }\n\n totalMisclassifications == 0\n }\n\n\n // \"Framework\" operation for testing multi-qubit tasks for distinguishing states of an array of qubits\n // with Int return\n operation DistinguishStates_MultiQubit(\n nQubits : Int,\n nStates : Int,\n statePrep : ((Qubit[], Int, Double) => Unit is Adj),\n testImpl : (Qubit[] => Int),\n preserveState : Bool,\n stateNames : String[]) : Bool {\n\n let nTotal = 100;\n // misclassifications will store the number of times state i has been classified as state j (dimension nStates^2)\n mutable misclassifications = [0, size = nStates * nStates];\n // unknownClassifications will store the number of times state i has been classified as some invalid state (index < 0 or >= nStates)\n mutable unknownClassifications = [0, size = nStates];\n\n use qs = Qubit[nQubits];\n for _ in 1 .. nTotal {\n // get a random integer to define the state of the qubits\n let state = DrawRandomInt(0, nStates - 1);\n // get a random rotation angle to define the exact state of the qubits\n // for some exercises, this value might be a dummy variable which does not matter\n let alpha = DrawRandomDouble(0.0, 1.0) * PI();\n\n // do state prep: convert |0...0⟩ to outcome with return equal to state\n statePrep(qs, state, alpha);\n\n // get the solution's answer and verify that it's a match, if not, increase the exact mismatch count\n let ans = testImpl(qs);\n if ans >= 0 and ans < nStates {\n // classification result is a valid state index - check if is it correct\n if ans != state {\n set misclassifications w/= ((state * nStates) + ans) <- (misclassifications[(state * nStates) + ans] + 1);\n }\n }\n else {\n // classification result is an invalid state index - file it separately\n set unknownClassifications w/= state <- (unknownClassifications[state] + 1);\n }\n\n if preserveState {\n // check that the state of the qubit after the operation is unchanged\n Adjoint statePrep(qs, state, alpha);\n if not CheckAllZero(qs) {\n Message($\"Input quantum state {stateNames[state]} was not preserved during the measurement.\");\n ResetAll(qs);\n return false;\n }\n } else {\n // we're not checking the state of the qubit after the operation\n ResetAll(qs);\n }\n }\n\n mutable totalMisclassifications = 0;\n for i in 0 .. nStates - 1 {\n for j in 0 .. nStates - 1 {\n if misclassifications[(i * nStates) + j] != 0 {\n set totalMisclassifications += misclassifications[i * nStates + j];\n Message($\"Misclassified {stateNames[i]} as {stateNames[j]} in {misclassifications[(i * nStates) + j]} test runs.\");\n }\n }\n if unknownClassifications[i] != 0 {\n set totalMisclassifications += unknownClassifications[i];\n Message($\"Misclassified {stateNames[i]} as Unknown State in {unknownClassifications[i]} test runs.\");\n }\n }\n totalMisclassifications == 0\n }\n\n\n /// # Summary\n /// Given a marking oracle acting on N inputs, and a classical function acting on N bits, \n /// checks whether the oracle effect matches that of the function on every classical input.\n operation CheckOracleImplementsFunction (\n N : Int, \n oracle : (Qubit[], Qubit) => Unit, \n f : Bool[] -> Bool\n ) : Bool {\n let size = 1 <<< N;\n use (input, target) = (Qubit[N], Qubit());\n for k in 0 .. size - 1 {\n // Prepare k-th bit vector\n let binaryLE = IntAsBoolArray(k, N);\n \n // \"binary\" is little-endian notation, so the second vector tried has qubit 0 in state 1 and the rest in state 0\n ApplyPauliFromBitString(PauliX, true, binaryLE, input);\n \n // Apply the operation\n oracle(input, target);\n \n // Calculate the expected classical result\n let val = f(binaryLE);\n\n // Apply operations that will revert the qubits to the 0 state if the oracle acted correctly.\n if val {\n X(target);\n }\n ApplyPauliFromBitString(PauliX, true, binaryLE, input);\n\n if not CheckAllZero(input + [target]) {\n Message($\"Unexpected result on input {binaryLE}.\");\n if not CheckAllZero(input) {\n Message(\"The state of the input qubits changed, or they ended up entangled with the target qubit.\");\n Message(\"The state of the system after oracle application:\");\n DumpMachine();\n } else {\n Message($\"Expected result `{val}`, got `{not val}`.\");\n }\n ResetAll(input + [target]);\n return false;\n }\n }\n return true;\n } \n}\n"
|
|
7697
|
+
"code": "// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nnamespace Microsoft.Quantum.Katas {\n open Microsoft.Quantum.Arrays;\n open Microsoft.Quantum.Convert;\n open Microsoft.Quantum.Diagnostics;\n open Microsoft.Quantum.Math;\n open Microsoft.Quantum.Random;\n\n /// # Summary\n /// Given two operations, checks whether they act identically (including global phase) for all input states.\n /// This is done through controlled versions of the operations instead of plain ones which convert the global phase\n /// into a relative phase that can be detected.\n operation CheckOperationsAreEqualStrict(\n inputSize : Int,\n op : (Qubit[] => Unit is Adj + Ctl),\n reference : (Qubit[] => Unit is Adj + Ctl))\n : Bool {\n Fact(inputSize > 0, \"`inputSize` must be positive\");\n let controlledOp = register => Controlled op(register[...0], register[1...]);\n let controlledReference = register => Controlled reference(register[...0], register[1...]);\n let areEquivalent = CheckOperationsAreEqual(inputSize + 1, controlledOp, controlledReference);\n areEquivalent\n }\n\n /// # Summary\n /// Given two operations, checks whether they act identically on the zero state |0〉 ⊗ |0〉 ⊗ ... ⊗ |0〉 composed of\n /// `inputSize` qubits.\n operation CheckOperationsEquivalenceOnZeroState(\n op : (Qubit[] => Unit),\n reference : (Qubit[] => Unit is Adj),\n inputSize : Int)\n : Bool {\n Fact(inputSize > 0, \"`inputSize` must be positive\");\n use target = Qubit[inputSize];\n op(target);\n Adjoint reference(target);\n let isCorrect = CheckAllZero(target);\n ResetAll(target);\n isCorrect\n }\n\n\n /// # Summary\n /// Given two operations, checks whether they act identically on the given initial state composed of `inputSize` qubits.\n /// The initial state is prepared by applying the `initialState` operation to the state |0〉 ⊗ |0〉 ⊗ ... ⊗ |0〉.\n /// This operation introduces a control qubit to convert a global phase into a relative phase to be able to detect it.\n /// `initialState` operation should be deterministic.\n operation CheckOperationsEquivalenceOnInitialStateStrict(\n initialState : Qubit[] => Unit is Adj,\n op : (Qubit[] => Unit is Adj + Ctl),\n reference : (Qubit[] => Unit is Adj + Ctl),\n inputSize : Int\n ) : Bool {\n use (control, target) = (Qubit(), Qubit[inputSize]);\n within {\n H(control);\n initialState(target);\n }\n apply {\n Controlled op([control], target);\n Adjoint Controlled reference([control], target);\n }\n\n let isCorrect = CheckAllZero([control] + target);\n ResetAll([control] + target);\n isCorrect\n }\n\n\n /// # Summary\n /// Given two operations, checks whether they act identically on the zero state |0〉 ⊗ |0〉 ⊗ ... ⊗ |0〉 composed of\n /// `inputSize` qubits.\n /// This operation introduces a control qubit to convert a global phase into a relative phase to be able to detect\n /// it.\n operation CheckOperationsEquivalenceOnZeroStateStrict(\n op : (Qubit[] => Unit is Adj + Ctl),\n reference : (Qubit[] => Unit is Adj + Ctl),\n inputSize : Int)\n : Bool {\n Fact(inputSize > 0, \"`inputSize` must be positive\");\n CheckOperationsEquivalenceOnInitialStateStrict(qs => (), op, reference, inputSize)\n }\n\n\n /// # Summary\n /// Shows the comparison of the quantum states produced by a specific operation and a reference operation\n /// when applied to the state prepared using deterministic operation `initialState`.\n operation ShowQuantumStateComparison(\n registerSize : Int,\n initialState : Qubit[] => Unit,\n op : Qubit[] => Unit,\n reference : Qubit[] => Unit)\n : Unit {\n {\n use register = Qubit[registerSize];\n initialState(register);\n\n Message(\"Initial quantum state:\");\n DumpMachine();\n\n // Apply the reference operation and dump the simulator state\n reference(register);\n Message(\"Expected quantum state after applying the operation:\");\n DumpMachine();\n ResetAll(register);\n }\n\n {\n use register = Qubit[registerSize];\n initialState(register);\n // Apply the comparison operation and dump the simulator state\n op(register);\n Message(\"Actual quantum state after applying the operation:\");\n DumpMachine();\n ResetAll(register);\n }\n }\n\n /// # Summary\n /// Given two operations, checks whether they act identically on the zero state |0〉 ⊗ |0〉 ⊗ ... ⊗ |0〉 composed of\n /// `inputSize` qubits. If they don't, prints user feedback.\n operation CheckOperationsEquivalenceOnZeroStateWithFeedback(\n testImpl : (Qubit[] => Unit),\n refImpl : (Qubit[] => Unit is Adj),\n inputSize : Int\n ) : Bool {\n\n let isCorrect = CheckOperationsEquivalenceOnZeroState(testImpl, refImpl, inputSize);\n\n // Output different feedback to the user depending on whether the exercise was correct.\n if isCorrect {\n Message(\"Correct!\");\n } else {\n Message(\"Incorrect.\");\n ShowQuantumStateComparison(inputSize, (qs => ()), testImpl, refImpl);\n }\n isCorrect\n }\n\n\n internal operation EntangleRegisters(\n control : Qubit[],\n target : Qubit[]) : Unit is Adj + Ctl {\n Fact(\n Length(control) == Length(target),\n $\"The length of qubit registers must be the same.\");\n\n for index in IndexRange(control) {\n H(control[index]);\n CNOT(control[index], target[index]);\n }\n }\n\n\n /// # Summary\n /// Prepare a random uneven superposition state on the given qubit array.\n operation PrepDemoState(qs : Qubit[]) : Unit {\n Fact(Length(qs) <= 4, \"States with 5 qubits or more are not supported.\");\n let probs = [0.36, 0.25, 1. / 3., 1. / 5.][... Length(qs) - 1];\n for (q, prob) in Zipped(qs, probs) {\n Ry(ArcCos(Sqrt(prob)) * 2.0, q);\n }\n }\n\n\n // \"Framework\" operation for testing single-qubit tasks for distinguishing states of one qubit\n // with Bool return\n operation DistinguishTwoStates_SingleQubit(\n statePrep : ((Qubit, Int) => Unit is Adj),\n testImpl : (Qubit => Bool),\n stateNames : String[],\n preserveState : Bool) : Bool {\n\n let nTotal = 100;\n let nStates = 2;\n mutable misclassifications = [0, size=nStates];\n\n use q = Qubit();\n for _ in 1 .. nTotal {\n // get a random bit to define whether qubit will be in a state corresponding to true return (1) or to false one (0)\n // state = 0 false return\n // state = 1 true return\n let state = DrawRandomInt(0, 1);\n\n // do state prep: convert |0⟩ to outcome with false return or to outcome with true return depending on state\n statePrep(q, state);\n\n // get the solution's answer and verify if NOT a match, then differentiate what kind of mismatch\n let ans = testImpl(q);\n if ans != (state == 1) {\n set misclassifications w/= state <- misclassifications[state] + 1;\n }\n\n // If the final state is to be preserved, check if it was not modified\n if preserveState {\n Adjoint statePrep(q, state);\n if not CheckZero(q) {\n Message($\"Input quantum state {stateNames[state]} was not preserved during the measurement.\");\n Reset(q);\n return false;\n }\n } else {\n Reset(q);\n }\n }\n\n mutable totalMisclassifications = 0;\n for i in 0 .. nStates - 1 {\n if misclassifications[i] != 0 {\n set totalMisclassifications += misclassifications[i];\n Message($\"Misclassified {stateNames[i]} as {stateNames[1 - i]} in {misclassifications[i]} test runs.\");\n }\n }\n\n totalMisclassifications == 0\n }\n\n\n // \"Framework\" operation for testing multi-qubit tasks for distinguishing states of an array of qubits\n // with Int return\n operation DistinguishStates_MultiQubit(\n nQubits : Int,\n nStates : Int,\n statePrep : ((Qubit[], Int, Double) => Unit is Adj),\n testImpl : (Qubit[] => Int),\n preserveState : Bool,\n stateNames : String[]) : Bool {\n\n let nTotal = 100;\n // misclassifications will store the number of times state i has been classified as state j (dimension nStates^2)\n mutable misclassifications = [0, size = nStates * nStates];\n // unknownClassifications will store the number of times state i has been classified as some invalid state (index < 0 or >= nStates)\n mutable unknownClassifications = [0, size = nStates];\n\n use qs = Qubit[nQubits];\n for _ in 1 .. nTotal {\n // get a random integer to define the state of the qubits\n let state = DrawRandomInt(0, nStates - 1);\n // get a random rotation angle to define the exact state of the qubits\n // for some exercises, this value might be a dummy variable which does not matter\n let alpha = DrawRandomDouble(0.0, 1.0) * PI();\n\n // do state prep: convert |0...0⟩ to outcome with return equal to state\n statePrep(qs, state, alpha);\n\n // get the solution's answer and verify that it's a match, if not, increase the exact mismatch count\n let ans = testImpl(qs);\n if ans >= 0 and ans < nStates {\n // classification result is a valid state index - check if is it correct\n if ans != state {\n set misclassifications w/= ((state * nStates) + ans) <- (misclassifications[(state * nStates) + ans] + 1);\n }\n }\n else {\n // classification result is an invalid state index - file it separately\n set unknownClassifications w/= state <- (unknownClassifications[state] + 1);\n }\n\n if preserveState {\n // check that the state of the qubit after the operation is unchanged\n Adjoint statePrep(qs, state, alpha);\n if not CheckAllZero(qs) {\n Message($\"Input quantum state {stateNames[state]} was not preserved during the measurement.\");\n ResetAll(qs);\n return false;\n }\n } else {\n // we're not checking the state of the qubit after the operation\n ResetAll(qs);\n }\n }\n\n mutable totalMisclassifications = 0;\n for i in 0 .. nStates - 1 {\n for j in 0 .. nStates - 1 {\n if misclassifications[(i * nStates) + j] != 0 {\n set totalMisclassifications += misclassifications[i * nStates + j];\n Message($\"Misclassified {stateNames[i]} as {stateNames[j]} in {misclassifications[(i * nStates) + j]} test runs.\");\n }\n }\n if unknownClassifications[i] != 0 {\n set totalMisclassifications += unknownClassifications[i];\n Message($\"Misclassified {stateNames[i]} as Unknown State in {unknownClassifications[i]} test runs.\");\n }\n }\n totalMisclassifications == 0\n }\n\n // Helper function to convert a boolean array to its ket state representation\n function BoolArrayAsKetState (bits : Bool[]) : String {\n mutable stateName = \"|\";\n for i in 0 .. Length(bits) - 1 {\n set stateName += (bits[i] ? \"1\" | \"0\");\n }\n\n return stateName + \"⟩\";\n }\n\n // Helper function to convert an array of bit strings to its ket state representation\n function IntArrayAsStateName (\n qubits : Int,\n bitStrings : Bool[][]\n ) : String {\n mutable statename = \"\";\n for i in 0 .. Length(bitStrings) - 1 {\n if i > 0 {\n set statename += \" + \";\n }\n set statename += BoolArrayAsKetState(bitStrings[i]);\n }\n\n return statename;\n }\n\n /// # Summary\n /// Given a marking oracle acting on N inputs, and a classical function acting on N bits, \n /// checks whether the oracle effect matches that of the function on every classical input.\n operation CheckOracleImplementsFunction (\n N : Int, \n oracle : (Qubit[], Qubit) => Unit, \n f : Bool[] -> Bool\n ) : Bool {\n let size = 1 <<< N;\n use (input, target) = (Qubit[N], Qubit());\n for k in 0 .. size - 1 {\n // Prepare k-th bit vector\n let binaryLE = IntAsBoolArray(k, N);\n \n // \"binary\" is little-endian notation, so the second vector tried has qubit 0 in state 1 and the rest in state 0\n ApplyPauliFromBitString(PauliX, true, binaryLE, input);\n \n // Apply the operation\n oracle(input, target);\n \n // Calculate the expected classical result\n let val = f(binaryLE);\n\n // Apply operations that will revert the qubits to the 0 state if the oracle acted correctly.\n if val {\n X(target);\n }\n ApplyPauliFromBitString(PauliX, true, binaryLE, input);\n\n if not CheckAllZero(input + [target]) {\n Message($\"Unexpected result on input {BoolArrayAsKetState(binaryLE)}.\");\n if not CheckAllZero(input) {\n Message(\"The state of the input qubits changed, or they ended up entangled with the target qubit.\");\n Message(\"The state of the system after oracle application:\");\n DumpMachine();\n } else {\n Message($\"Expected result `{val}`, got `{not val}`.\");\n }\n ResetAll(input + [target]);\n return false;\n }\n }\n return true;\n } \n}\n"
|
|
7216
7698
|
},
|
|
7217
7699
|
{
|
|
7218
7700
|
"id": "complex_arithmetic__powers_of_i__Verification.qs",
|
|
7219
7701
|
"code": "namespace Kata.Verification {\n \n operation PowersOfI_Reference(n : Int) : Int{\n // If n is divisible by 4\n if n % 4 == 0 { \n return 1;\n } else {\n return -1;\n }\n }\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n for n in -20 .. 2 .. 20 { \n let expected = PowersOfI_Reference(n);\n let actual = Kata.PowersOfI(n);\n if expected != actual {\n Message(\"Incorrect.\");\n Message($\"Result of exponentiation doesn't match expected value: expected i^({n}) = {expected}, got {actual}\");\n return false; \n }\n }\n Message(\"Correct!\");\n return true; \n }\n}\n"
|
|
7220
7702
|
},
|
|
7221
|
-
{
|
|
7222
|
-
"id": "complex_arithmetic__complex_addition__Verification.qs",
|
|
7223
|
-
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Math;\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n CheckTwoComplexOpsAreSame(Kata.ComplexAdd, PlusC)\n }\n}\n"
|
|
7224
|
-
},
|
|
7225
7703
|
{
|
|
7226
7704
|
"id": "complex_arithmetic__Common.qs",
|
|
7227
7705
|
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Math;\n open Microsoft.Quantum.Random; \n open Microsoft.Quantum.Convert;\n\n operation DrawRandomComplex() : Complex {\n // Generates a random complex number. \n let real = DrawRandomDouble(-10., 10.);\n let imag = DrawRandomDouble(-10., 10.);\n return Complex(real, imag);\n }\n\n function ComplexAsString(x : Complex) : String {\n if x::Imag < 0.0 {\n $\"{x::Real} - {AbsD(x::Imag)}i\"\n } else {\n $\"{x::Real} + {x::Imag}i\"\n }\n }\n\n function ComplexPolarAsString(x : ComplexPolar) : String {\n $\"{x::Magnitude} * exp({x::Argument}i)\"\n }\n\n operation CheckTwoComplexOpsAreSame(sol : (Complex, Complex) -> Complex, ref : (Complex, Complex) -> Complex) : Bool {\n for _ in 0 .. 24 {\n let x = DrawRandomComplex();\n let y = DrawRandomComplex();\n\n let expected = ref(x, y);\n let actual = sol(x, y);\n \n if not ComplexEqual(expected, actual) {\n Message(\"Incorrect\");\n Message($\"For x = {ComplexAsString(x)}, y = {ComplexAsString(y)} expected return {ComplexAsString(expected)}, actual return {ComplexAsString(actual)}.\");\n return false;\n }\n }\n\n Message(\"Correct!\");\n return true;\n }\n\n function ComplexEqual(x : Complex, y : Complex) : Bool { \n // Tests two complex numbers for equality.\n AbsD(x::Real - y::Real) <= 0.001 and AbsD(x::Imag - y::Imag) <= 0.001\n }\n\n function ComplexPolarEqual(x : ComplexPolar, y : ComplexPolar) : Bool { \n // Tests two complex polar numbers for equality.\n AbsD(x::Magnitude - y::Magnitude) <= 0.001 and AbsD(x::Argument - y::Argument) <= 0.001\n }\n}\n"
|
|
7228
7706
|
},
|
|
7707
|
+
{
|
|
7708
|
+
"id": "complex_arithmetic__complex_addition__Verification.qs",
|
|
7709
|
+
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Math;\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n CheckTwoComplexOpsAreSame(Kata.ComplexAdd, PlusC)\n }\n}\n"
|
|
7710
|
+
},
|
|
7229
7711
|
{
|
|
7230
7712
|
"id": "complex_arithmetic__complex_multiplication__Verification.qs",
|
|
7231
7713
|
"code": "namespace Kata.Verification { \n open Microsoft.Quantum.Math;\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n CheckTwoComplexOpsAreSame(Kata.ComplexMult, TimesC)\n }\n}"
|
|
@@ -7574,6 +8056,10 @@ export default {
|
|
|
7574
8056
|
"id": "distinguishing_states__zero_one__Verification.qs",
|
|
7575
8057
|
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Diagnostics;\n open Microsoft.Quantum.Katas;\n\n operation StatePrep_IsQubitOne (q : Qubit, state : Int) : Unit is Adj {\n if state == 1 {\n // convert |0⟩ to |1⟩\n X(q);\n }\n }\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n let isCorrect = DistinguishTwoStates_SingleQubit(\n StatePrep_IsQubitOne,\n Kata.IsQubitOne,\n [\"|0⟩\", \"|1⟩\"],\n false);\n if isCorrect {\n Message(\"Correct!\");\n } else {\n Message(\"Incorrect.\");\n }\n isCorrect\n }\n\n}\n"
|
|
7576
8058
|
},
|
|
8059
|
+
{
|
|
8060
|
+
"id": "distinguishing_states__Common.qs",
|
|
8061
|
+
"code": "namespace Kata.Verification{\n open Microsoft.Quantum.Arrays;\n open Microsoft.Quantum.Convert;\n open Microsoft.Quantum.Diagnostics;\n open Microsoft.Quantum.Intrinsic;\n open Microsoft.Quantum.Math;\n\n operation StatePrep_BasisStateMeasurement(\n qs : Qubit[],\n state : Int,\n dummyVar : Double\n ) : Unit is Adj {\n if state / 2 == 1 {\n // |10⟩ or |11⟩\n X(qs[0]);\n }\n\n if state % 2 == 1 {\n // |01⟩ or |11⟩\n X(qs[1]);\n }\n }\n\n operation WState_Arbitrary_Reference(qs : Qubit[]) : Unit is Adj + Ctl {\n let N = Length(qs);\n\n if N == 1 {\n // base case of recursion: |1⟩\n X(qs[0]);\n } else {\n // |W_N⟩ = |0⟩|W_(N-1)⟩ + |1⟩|0...0⟩\n // do a rotation on the first qubit to split it into |0⟩ and |1⟩ with proper weights\n // |0⟩ -> sqrt((N-1)/N) |0⟩ + 1/sqrt(N) |1⟩\n let theta = ArcSin(1.0 / Sqrt(IntAsDouble(N)));\n Ry(2.0 * theta, qs[0]);\n\n // do a zero-controlled W-state generation for qubits 1..N-1\n X(qs[0]);\n Controlled WState_Arbitrary_Reference(qs[0..0], qs[1..N - 1]);\n X(qs[0]);\n }\n }\n\n function StatePrep_FindFirstDiff (\n bits1 : Bool[],\n bits2 : Bool[]\n ) : Int {\n for i in 0 .. Length(bits1) - 1 {\n if bits1[i] != bits2[i] {\n return i;\n }\n }\n\n return -1;\n }\n\n operation StatePrep_SuperpositionMeasurement (\n qs : Qubit[],\n bits1 : Bool[][],\n bits2 : Bool[][],\n state : Int,\n dummyVar: Double\n ) : Unit is Adj {\n let bits = state == 0 ? bits1 | bits2;\n StatePrep_BitstringSuperposition(qs, bits);\n }\n\n // A combination of tasks 14 and 15 from the Superposition kata\n operation StatePrep_BitstringSuperposition (\n qs : Qubit[],\n bits : Bool[][]\n ) : Unit is Adj + Ctl {\n let L = Length(bits);\n Fact(L == 1 or L == 2 or L == 4, \"State preparation only supports arrays of 1, 2 or 4 bit strings.\");\n if L == 1 {\n for i in 0 .. Length(qs) - 1 {\n if bits[0][i] {\n X(qs[i]);\n }\n }\n }\n if L == 2 {\n // find the index of the first bit at which the bit strings are different\n let firstDiff = StatePrep_FindFirstDiff(bits[0], bits[1]);\n\n // Hadamard corresponding qubit to create superposition\n H(qs[firstDiff]);\n\n // iterate through the bit strings again setting the final state of qubits\n for i in 0 .. Length(qs) - 1 {\n if bits[0][i] == bits[1][i] {\n // if two bits are the same, apply X or nothing\n if bits[0][i] {\n X(qs[i]);\n }\n } else {\n // if two bits are different, set their difference using CNOT\n if i > firstDiff {\n CNOT(qs[firstDiff], qs[i]);\n if bits[0][i] != bits[0][firstDiff] {\n X(qs[i]);\n }\n }\n }\n }\n }\n if L == 4 {\n let N = Length(qs);\n\n use anc = Qubit[2];\n // Put two ancillas into equal superposition of 2-qubit basis states\n ApplyToEachCA(H, anc);\n\n // Set up the right pattern on the main qubits with control on ancillas\n for i in 0 .. 3 {\n for j in 0 .. N - 1 {\n if bits[i][j] {\n ApplyControlledOnInt(i, X, anc, qs[j]);\n }\n }\n }\n\n // Uncompute the ancillas, using patterns on main qubits as control\n for i in 0 .. 3 {\n if i % 2 == 1 {\n ApplyControlledOnBitString(bits[i], X, qs, anc[0]);\n }\n if i / 2 == 1 {\n ApplyControlledOnBitString(bits[i], X, qs, anc[1]);\n }\n }\n }\n }\n}\n"
|
|
8062
|
+
},
|
|
7577
8063
|
{
|
|
7578
8064
|
"id": "distinguishing_states__plus_minus__Verification.qs",
|
|
7579
8065
|
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Katas;\n\n operation StatePrep_IsQubitPlus(q : Qubit, state : Int) : Unit is Adj {\n if state == 1 {\n // convert |0⟩ to |+⟩\n H(q);\n } else {\n // convert |0⟩ to |-⟩\n X(q);\n H(q);\n }\n }\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n let isCorrect = DistinguishTwoStates_SingleQubit(\n StatePrep_IsQubitPlus,\n Kata.IsQubitPlus,\n [\"|-⟩\", \"|+⟩\"],\n false\n );\n if isCorrect {\n Message(\"Correct!\");\n } else {\n Message(\"Incorrect.\");\n }\n isCorrect\n }\n}\n"
|
|
@@ -7590,10 +8076,6 @@ export default {
|
|
|
7590
8076
|
"id": "distinguishing_states__four_basis_states__Verification.qs",
|
|
7591
8077
|
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Convert;\n open Microsoft.Quantum.Math;\n open Microsoft.Quantum.Katas;\n\n operation CheckSolution() : Bool {\n let isCorrect = DistinguishStates_MultiQubit(2, 4, StatePrep_BasisStateMeasurement, Kata.BasisStateMeasurement, false, [\"|00⟩\", \"|01⟩\", \"|10⟩\", \"|11⟩\"]);\n if (isCorrect) {\n Message(\"Correct!\");\n } else {\n Message(\"Incorrect.\");\n }\n\n isCorrect\n }\n}\n"
|
|
7592
8078
|
},
|
|
7593
|
-
{
|
|
7594
|
-
"id": "distinguishing_states__Common.qs",
|
|
7595
|
-
"code": "namespace Kata.Verification{\n open Microsoft.Quantum.Arrays;\n open Microsoft.Quantum.Convert;\n open Microsoft.Quantum.Diagnostics;\n open Microsoft.Quantum.Intrinsic;\n open Microsoft.Quantum.Math;\n\n operation StatePrep_BasisStateMeasurement(\n qs : Qubit[],\n state : Int,\n dummyVar : Double\n ) : Unit is Adj {\n if state / 2 == 1 {\n // |10⟩ or |11⟩\n X(qs[0]);\n }\n\n if state % 2 == 1 {\n // |01⟩ or |11⟩\n X(qs[1]);\n }\n }\n\n operation WState_Arbitrary_Reference(qs : Qubit[]) : Unit is Adj + Ctl {\n let N = Length(qs);\n\n if N == 1 {\n // base case of recursion: |1⟩\n X(qs[0]);\n } else {\n // |W_N⟩ = |0⟩|W_(N-1)⟩ + |1⟩|0...0⟩\n // do a rotation on the first qubit to split it into |0⟩ and |1⟩ with proper weights\n // |0⟩ -> sqrt((N-1)/N) |0⟩ + 1/sqrt(N) |1⟩\n let theta = ArcSin(1.0 / Sqrt(IntAsDouble(N)));\n Ry(2.0 * theta, qs[0]);\n\n // do a zero-controlled W-state generation for qubits 1..N-1\n X(qs[0]);\n Controlled WState_Arbitrary_Reference(qs[0..0], qs[1..N - 1]);\n X(qs[0]);\n }\n }\n\n // Helper function to convert a boolean array to its ket state representation\n function BoolArrayAsKetState (bits : Bool[]) : String {\n mutable stateName = \"|\";\n for i in 0 .. Length(bits) - 1 {\n set stateName += (bits[i] ? \"1\" | \"0\");\n }\n\n return stateName + \"⟩\";\n }\n\n // Helper function to convert an array of bit strings to its ket state representation\n function IntArrayAsStateName (\n qubits : Int,\n bitStrings : Bool[][]\n ) : String {\n mutable statename = \"\";\n for i in 0 .. Length(bitStrings) - 1 {\n if i > 0 {\n set statename += \" + \";\n }\n set statename += BoolArrayAsKetState(bitStrings[i]);\n }\n\n return statename;\n }\n\n function StatePrep_FindFirstDiff (\n bits1 : Bool[],\n bits2 : Bool[]\n ) : Int {\n for i in 0 .. Length(bits1) - 1 {\n if bits1[i] != bits2[i] {\n return i;\n }\n }\n\n return -1;\n }\n\n operation StatePrep_SuperpositionMeasurement (\n qs : Qubit[],\n bits1 : Bool[][],\n bits2 : Bool[][],\n state : Int,\n dummyVar: Double\n ) : Unit is Adj {\n let bits = state == 0 ? bits1 | bits2;\n StatePrep_BitstringSuperposition(qs, bits);\n }\n\n // A combination of tasks 14 and 15 from the Superposition kata\n operation StatePrep_BitstringSuperposition (\n qs : Qubit[],\n bits : Bool[][]\n ) : Unit is Adj + Ctl {\n let L = Length(bits);\n Fact(L == 1 or L == 2 or L == 4, \"State preparation only supports arrays of 1, 2 or 4 bit strings.\");\n if L == 1 {\n for i in 0 .. Length(qs) - 1 {\n if bits[0][i] {\n X(qs[i]);\n }\n }\n }\n if L == 2 {\n // find the index of the first bit at which the bit strings are different\n let firstDiff = StatePrep_FindFirstDiff(bits[0], bits[1]);\n\n // Hadamard corresponding qubit to create superposition\n H(qs[firstDiff]);\n\n // iterate through the bit strings again setting the final state of qubits\n for i in 0 .. Length(qs) - 1 {\n if bits[0][i] == bits[1][i] {\n // if two bits are the same, apply X or nothing\n if bits[0][i] {\n X(qs[i]);\n }\n } else {\n // if two bits are different, set their difference using CNOT\n if i > firstDiff {\n CNOT(qs[firstDiff], qs[i]);\n if bits[0][i] != bits[0][firstDiff] {\n X(qs[i]);\n }\n }\n }\n }\n }\n if L == 4 {\n let N = Length(qs);\n\n use anc = Qubit[2];\n // Put two ancillas into equal superposition of 2-qubit basis states\n ApplyToEachCA(H, anc);\n\n // Set up the right pattern on the main qubits with control on ancillas\n for i in 0 .. 3 {\n for j in 0 .. N - 1 {\n if bits[i][j] {\n ApplyControlledOnInt(i, X, anc, qs[j]);\n }\n }\n }\n\n // Uncompute the ancillas, using patterns on main qubits as control\n for i in 0 .. 3 {\n if i % 2 == 1 {\n ApplyControlledOnBitString(bits[i], X, qs, anc[0]);\n }\n if i / 2 == 1 {\n ApplyControlledOnBitString(bits[i], X, qs, anc[1]);\n }\n }\n }\n }\n}\n"
|
|
7596
|
-
},
|
|
7597
8079
|
{
|
|
7598
8080
|
"id": "distinguishing_states__two_basis_states_bit_strings__Verification.qs",
|
|
7599
8081
|
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Katas;\n\n operation StatePrep_Bitstring(\n qs : Qubit[],\n bits : Bool[]\n ) : Unit is Adj {\n for i in 0 .. Length(qs) - 1 {\n if bits[i] {\n X(qs[i]);\n }\n }\n }\n\n operation StatePrep_TwoBitstringsMeasurement(\n qs : Qubit[],\n bits1 : Bool[],\n bits2 : Bool[],\n state : Int,\n dummyVar : Double\n ) : Unit is Adj {\n let bits = state == 0 ? bits1 | bits2;\n StatePrep_Bitstring(qs, bits);\n }\n\n operation CheckTwoBitstringsMeasurement(b1 : Bool[], b2 : Bool[]) : Bool {\n let stateNames = [BoolArrayAsKetState(b1), BoolArrayAsKetState(b2)];\n let isCorrect = DistinguishStates_MultiQubit(\n Length(b1),\n 2,\n StatePrep_TwoBitstringsMeasurement(_, b1, b2, _, _),\n Kata.TwoBitstringsMeasurement(_, b1, b2),\n false,\n stateNames\n );\n\n if not isCorrect {\n Message($\"Incorrect for [{stateNames[0]}, {stateNames[1]}].\");\n }\n\n return isCorrect;\n }\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n for (b1, b2) in [\n ([false, true], [true, false]),\n ([true, true, false], [false, true, true]),\n ([false, true, true, false], [false, true, true, true]),\n ([true, false, false, false], [true, false, true, true])\n ] {\n if not CheckTwoBitstringsMeasurement(b1, b2) {\n return false;\n }\n }\n\n Message(\"Correct!\");\n true\n }\n}\n"
|
|
@@ -7730,14 +8212,14 @@ export default {
|
|
|
7730
8212
|
"id": "key_distribution__random_array__Verification.qs",
|
|
7731
8213
|
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Arrays;\n open Microsoft.Quantum.Convert;\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n // The test only checks that the operation returns an array of correct length\n // and that it's not always the same. It doesn't analyze the distribution of true and false elements.\n let N = 20;\n let randomArrays = ForEach(Kata.RandomArray, [N, size = 10]);\n\n for array in randomArrays {\n if Length(array) != N {\n Message($\"Returned array should have length {N}, and it had length {Length(array)}.\");\n return false;\n }\n }\n\n let randomInts = Mapped(BoolArrayAsInt, randomArrays);\n mutable allSame = true;\n for int in randomInts {\n if int != randomInts[0] {\n set allSame = false;\n }\n }\n if allSame {\n Message($\"Random generation should not return a fixed array.\");\n return false;\n }\n\n Message(\"Correct!\");\n true\n }\n}\n"
|
|
7732
8214
|
},
|
|
7733
|
-
{
|
|
7734
|
-
"id": "key_distribution__prepare_qubits__Verification.qs",
|
|
7735
|
-
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Diagnostics;\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n for N in 2 .. 10 {\n let (bases, bits) = (RandomArray(N), RandomArray(N));\n use qs = Qubit[N];\n Kata.PrepareQubits(qs, bases, bits);\n Adjoint PrepareQubits_Reference(qs, bases, bits);\n for i in 0 .. N - 1 {\n if not CheckZero(qs[i]) {\n Message($\"Qubit qs[{i}] prepared in incorrect state.\");\n Message($\"Expected state {StateToString(bases[i], bits[i])}; actual state\");\n PrepareQubits_Reference([qs[i]], [bases[i]], [bits[i]]);\n DumpRegister([qs[i]]);\n ResetAll(qs);\n return false;\n }\n }\n }\n\n Message(\"Correct!\");\n true\n }\n}\n"
|
|
7736
|
-
},
|
|
7737
8215
|
{
|
|
7738
8216
|
"id": "key_distribution__Common.qs",
|
|
7739
8217
|
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Arrays;\n open Microsoft.Quantum.Random;\n\n operation RandomArray(N : Int) : Bool[] {\n ForEach(x => DrawRandomInt(0, 1) == 0, [0, size = N])\n }\n\n operation BasisToString(base : Bool) : String {\n base ? \"Hadamard\" | \"computational\"\n }\n\n operation StateToString(base : Bool, bit : Bool) : String {\n if base { // ∣+⟩ / ∣-⟩\n return bit ? \"|-⟩\" | \"|+⟩\";\n } else { // ∣0⟩ / ∣1⟩\n return bit ? \"|1⟩\" | \"|0⟩\";\n }\n }\n\n operation PrepareQubits_Reference(qs : Qubit[], bases : Bool[], bits : Bool[]) : Unit is Adj {\n for i in 0 .. Length(qs) - 1 {\n if bits[i] {\n X(qs[i]);\n }\n if bases[i] {\n H(qs[i]);\n }\n }\n }\n}\n"
|
|
7740
8218
|
},
|
|
8219
|
+
{
|
|
8220
|
+
"id": "key_distribution__prepare_qubits__Verification.qs",
|
|
8221
|
+
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Diagnostics;\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n for N in 2 .. 10 {\n let (bases, bits) = (RandomArray(N), RandomArray(N));\n use qs = Qubit[N];\n Kata.PrepareQubits(qs, bases, bits);\n Adjoint PrepareQubits_Reference(qs, bases, bits);\n for i in 0 .. N - 1 {\n if not CheckZero(qs[i]) {\n Message($\"Qubit qs[{i}] prepared in incorrect state.\");\n Message($\"Expected state {StateToString(bases[i], bits[i])}; actual state\");\n PrepareQubits_Reference([qs[i]], [bases[i]], [bits[i]]);\n DumpRegister([qs[i]]);\n ResetAll(qs);\n return false;\n }\n }\n }\n\n Message(\"Correct!\");\n true\n }\n}\n"
|
|
8222
|
+
},
|
|
7741
8223
|
{
|
|
7742
8224
|
"id": "key_distribution__measure_qubits__Verification.qs",
|
|
7743
8225
|
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Diagnostics;\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n for N in 2 .. 10 {\n let (bases, bits) = (RandomArray(N), RandomArray(N));\n use qs = Qubit[N];\n PrepareQubits_Reference(qs, bases, bits);\n let res = Kata.MeasureQubits(qs, bases);\n ResetAll(qs);\n\n if Length(res) != N {\n Message($\"The returned array should have length {N}, same as the inputs, and it had length {Length(res)}.\");\n return false;\n }\n\n for i in 0 .. N - 1 {\n if res[i] != bits[i] {\n Message($\"Qubit qs[{i}] measured in incorrect basis.\");\n Message($\"When measuring state {StateToString(bases[i], bits[i])} in the {BasisToString(bases[i])} basis, \" +\n $\"expected result is {bits[i]}, got {res[i]}.\");\n return false;\n }\n }\n }\n\n Message(\"Correct!\");\n true\n }\n}\n"
|
|
@@ -7950,10 +8432,58 @@ export default {
|
|
|
7950
8432
|
"id": "deutsch_jozsa__implement_bv__Verification.qs",
|
|
7951
8433
|
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Katas;\n open Microsoft.Quantum.Math;\n\n operation CheckSolution() : Bool {\n for (n, oracle, expected, name) in [(2, qs => (), [0, 0], \"f(x) = 0\"), \n (3, qs => (), [0, 0, 0], \"f(x) = 0\"), \n (2, ApplyToEach(Z, _), [1, 1], \"f(x) = parity of x\"), \n (3, ApplyToEach(Z, _), [1, 1, 1], \"f(x) = parity of x\"), \n (2, qs => Z(qs[0]), [1, 0], \"f(x) = most significant bit of x\"), \n (3, qs => Z(qs[2]), [0, 0, 1], \"f(x) = least significant bit of x\"), \n (3, qs => Z(qs[1]), [0, 1, 0], \"f(x) = middle bit of x\")\n ] {\n let actual = Kata.BernsteinVaziraniAlgorithm(n, oracle);\n if actual != expected {\n Message(\"Incorrect.\");\n Message($\"The bit string for {name} for {n} bits identified as {actual} but it is {expected}.\");\n return false;\n }\n }\n\n Message(\"Correct!\");\n true\n }\n}\n"
|
|
7952
8434
|
},
|
|
8435
|
+
{
|
|
8436
|
+
"id": "grovers_search__prefix_oracle__Verification.qs",
|
|
8437
|
+
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Katas;\n\n function F_StartsWith(args : Bool[], p : Bool[]) : Bool {\n for i in 0 .. Length(p) - 1 {\n if p[i] != args[i] {\n return false;\n }\n }\n return true;\n } \n\n @EntryPoint()\n operation CheckSolution() : Bool {\n for (n, p) in [\n (2, []),\n (2, [true]),\n (2, [true, false]),\n (3, [false, true]),\n (4, [true, true, false]),\n (5, [false])\n ] {\n if not CheckOracleImplementsFunction(n, Kata.Oracle_StartsWith(_, _, p), F_StartsWith(_, p)) {\n Message($\"Test failed for N = {n}, p = {p}\");\n return false; \n }\n }\n\n Message(\"Correct!\");\n true \n } \n}\n"
|
|
8438
|
+
},
|
|
8439
|
+
{
|
|
8440
|
+
"id": "grovers_search__phase_oracle__Verification.qs",
|
|
8441
|
+
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Convert;\n open Microsoft.Quantum.Katas;\n open Microsoft.Quantum.Random;\n\n operation ApplyMarkingOracleAsPhaseOracle_Reference(\n markingOracle : ((Qubit[], Qubit) => Unit is Adj + Ctl),\n qubits : Qubit[]) : Unit is Adj + Ctl {\n\n use minus = Qubit();\n within {\n X(minus);\n H(minus);\n } apply {\n markingOracle(qubits, minus);\n }\n }\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n for N in 1 .. 3 {\n for k in 0 .. 2^N - 1 {\n let pattern = IntAsBoolArray(k, N);\n let marking = ApplyControlledOnBitString(pattern, X, _, _);\n let sol = Kata.ApplyMarkingOracleAsPhaseOracle(marking, _);\n let ref = ApplyMarkingOracleAsPhaseOracle_Reference(marking, _);\n\n let isCorrect = CheckOperationsAreEqualStrict(N, sol, ref);\n\n if not isCorrect {\n Message(\"Incorrect.\");\n Message(\"Hint: examine how your solution transforms the given state and compare it with the expected \" +\n $\"transformation for the {N}-bit oracle that marks the bit string {pattern}\");\n ShowQuantumStateComparison(N, PrepDemoState, sol, ref);\n return false;\n }\n }\n }\n Message(\"Correct!\");\n true\n }\n\n}\n"
|
|
8442
|
+
},
|
|
8443
|
+
{
|
|
8444
|
+
"id": "grovers_search__conditional_phase_flip__Verification.qs",
|
|
8445
|
+
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Katas;\n open Microsoft.Quantum.Math;\n operation ConditionalPhaseFlip(qs : Qubit[]) : Unit is Adj + Ctl {\n within {\n ApplyToEachA(X, qs);\n } apply {\n Controlled Z(qs[1 ...], qs[0]);\n }\n R(PauliI, 2.0 * PI(), qs[0]);\n }\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n for N in 2 .. 4 {\n if not CheckOperationsAreEqualStrict(N, Kata.ConditionalPhaseFlip, ConditionalPhaseFlip) {\n Message(\"Incorrect.\");\n Message(\"Hint: examine how your solution transforms the given state and compare it with the expected \" +\n $\"transformation for the {N}-bit inputs\");\n ShowQuantumStateComparison(N, PrepDemoState, Kata.ConditionalPhaseFlip, ConditionalPhaseFlip);\n return false;\n }\n }\n Message(\"Correct!\");\n true\n }\n\n}\n"
|
|
8446
|
+
},
|
|
8447
|
+
{
|
|
8448
|
+
"id": "grovers_search__reflection_about_state__Verification.qs",
|
|
8449
|
+
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Math;\n open Microsoft.Quantum.Katas;\n\n operation ReflectionAboutState(\n qs : Qubit[],\n statePrep : Qubit[] => Unit is Adj + Ctl)\n : Unit is Adj + Ctl {\n within {\n Adjoint statePrep(qs);\n } apply {\n ConditionalPhaseFlip(qs);\n }\n }\n\n // You might find this helper operation from an earlier task useful.\n operation ConditionalPhaseFlip(qs : Qubit[]) : Unit is Adj + Ctl {\n within {\n ApplyToEachA(X, qs);\n } apply {\n Controlled Z(qs[1 ...], qs[0]);\n }\n R(PauliI, 2.0 * PI(), qs[0]);\n }\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n for (N, statePrep) in [(2, qs => I(qs[0])), (3, ApplyToEachCA(H, _)), (1, qs => Ry(0.5, qs[0]))] {\n let sol = Kata.ReflectionAboutState(_, statePrep);\n let ref = ReflectionAboutState(_, statePrep);\n if not CheckOperationsAreEqualStrict(N, sol, ref) {\n Message(\"Incorrect.\");\n return false;\n }\n }\n Message(\"Correct!\");\n true\n }\n}\n"
|
|
8450
|
+
},
|
|
8451
|
+
{
|
|
8452
|
+
"id": "solving_sat__and__Verification.qs",
|
|
8453
|
+
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Katas;\n open Microsoft.Quantum.Arrays;\n\n function F_And(args : Bool[]) : Bool {\n return Count(x -> not x, args) == 0;\n }\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n for n in 1..5 {\n if not CheckOracleImplementsFunction(n, Kata.Oracle_And, F_And) {\n Message($\"Test failed for n = {n}\");\n return false;\n }\n }\n\n Message(\"Correct!\");\n true\n }\n}\n"
|
|
8454
|
+
},
|
|
8455
|
+
{
|
|
8456
|
+
"id": "solving_sat__Common.qs",
|
|
8457
|
+
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Random;\n\n // Helper functions to pretty-print SAT formulas\n function SATVariableAsString (var : (Int, Bool)) : String {\n let (index, positive) = var;\n return (positive ? \"\" | \"¬\") + $\"x{index}\";\n }\n\n function SATClauseAsString (clause : (Int, Bool)[]) : String {\n mutable ret = SATVariableAsString(clause[0]);\n for ind in 1 .. Length(clause) - 1 {\n set ret = ret + \" ∨ \" + SATVariableAsString(clause[ind]);\n }\n return ret;\n }\n\n function SATFormulaAsString (formula : (Int, Bool)[][]) : String {\n mutable ret = \"(\" + SATClauseAsString(formula[0]) + \")\";\n for ind in 1 .. Length(formula) - 1 {\n set ret = ret + \" ∧ (\" + SATClauseAsString(formula[ind]) + \")\";\n }\n return ret;\n }\n\n // Helper operations to generate random SAT formulas\n operation Generate_SAT_Clause (nVar : Int, nTerms : Int) : (Int, Bool)[] {\n // number of terms in clause is either given or (if nTerms <= 0) chosen randomly\n mutable nVarInClause = (nTerms > 0) ? nTerms | DrawRandomInt(1, 4);\n if nVarInClause > nVar {\n set nVarInClause = nVar;\n }\n \n mutable clause = [(0, false), size = nVarInClause];\n mutable usedVariables = [false, size = nVar];\n // Make sure variables in the clause are distinct\n for k in 0 .. nVarInClause - 1 {\n mutable nextInd = -1;\n repeat { \n set nextInd = DrawRandomInt(0, nVar - 1);\n } until (not usedVariables[nextInd])\n fixup {}\n set clause w/= k <- (nextInd, DrawRandomBool(0.5));\n set usedVariables w/= nextInd <- true;\n }\n return clause;\n }\n\n operation GenerateSATInstance (nVar : Int, nClause : Int, nTerms : Int) : (Int, Bool)[][] {\n mutable problem = [[(0, false), size = 0], size = nClause];\n\n for j in 0 .. nClause - 1 {\n set problem w/= j <- Generate_SAT_Clause(nVar, nTerms);\n }\n return problem;\n }\n}"
|
|
8458
|
+
},
|
|
8459
|
+
{
|
|
8460
|
+
"id": "solving_sat__or__Verification.qs",
|
|
8461
|
+
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Katas;\n open Microsoft.Quantum.Arrays;\n\n function F_Or(args : Bool[]) : Bool {\n return Count(x -> x, args) > 0;\n }\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n for n in 1..5 {\n if not CheckOracleImplementsFunction(n, Kata.Oracle_Or, F_Or) {\n Message($\"Test failed for n = {n}\");\n return false;\n }\n }\n\n Message(\"Correct!\");\n true\n }\n}\n"
|
|
8462
|
+
},
|
|
8463
|
+
{
|
|
8464
|
+
"id": "solving_sat__sat_clause__Verification.qs",
|
|
8465
|
+
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Katas;\n open Microsoft.Quantum.Random;\n\n function F_SATClause(args : Bool[], clause : (Int, Bool)[]) : Bool {\n for (index, positive) in clause {\n if positive == args[index] {\n // one true literal is sufficient for the clause to be true\n return true;\n }\n }\n // none of the literals is true - the whole clause is false\n return false;\n }\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n for i in 1 .. 6 {\n let nVar = DrawRandomInt(3, 7);\n let clause = Generate_SAT_Clause(nVar, i);\n \n if not CheckOracleImplementsFunction(nVar, Kata.Oracle_SATClause(_, _, clause), F_SATClause(_, clause)) {\n Message($\"Test failed for SAT clause {SATClauseAsString(clause)}\");\n return false;\n }\n }\n\n Message(\"Correct!\");\n true\n }\n}\n"
|
|
8466
|
+
},
|
|
8467
|
+
{
|
|
8468
|
+
"id": "solving_sat__sat_formula__Verification.qs",
|
|
8469
|
+
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Katas;\n open Microsoft.Quantum.Random;\n\n function F_SATClause(args : Bool[], clause : (Int, Bool)[]) : Bool {\n for (index, positive) in clause {\n if positive == args[index] {\n // one true literal is sufficient for the clause to be true\n return true;\n }\n }\n // none of the literals is true - the whole clause is false\n return false;\n }\n\n function F_SATFormula(args : Bool[], formula : (Int, Bool)[][]) : Bool {\n for clause in formula {\n // one false clause invalidates the whole formula\n if not F_SATClause(args, clause) {\n return false\n }\n }\n return true;\n }\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n for nVar in 2 .. 6 {\n for _ in 1 .. 3 {\n let formula = GenerateSATInstance(nVar, nVar - 1, -1);\n \n if not CheckOracleImplementsFunction(nVar, Kata.Oracle_SATFormula(_, _, formula), F_SATFormula(_, formula)) {\n Message($\"Test failed for SAT formula {SATFormulaAsString(formula)}\");\n return false;\n }\n }\n }\n\n Message(\"Correct!\");\n true\n }\n}\n"
|
|
8470
|
+
},
|
|
8471
|
+
{
|
|
8472
|
+
"id": "solving_sat__exactly_one_one__Verification.qs",
|
|
8473
|
+
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Arrays;\n open Microsoft.Quantum.Katas;\n\n function F_Exactly1One (args : Bool[]) : Bool {\n return Count(x -> x, args) == 1;\n }\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n if not CheckOracleImplementsFunction(3, Kata.Oracle_Exactly1One, F_Exactly1One) {\n return false;\n }\n\n Message(\"Correct!\");\n true\n }\n}\n"
|
|
8474
|
+
},
|
|
8475
|
+
{
|
|
8476
|
+
"id": "solving_sat__exactly_one_one_formula__Verification.qs",
|
|
8477
|
+
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Katas;\n open Microsoft.Quantum.Random;\n\n function F_Exactly1SATClause (args : Bool[], clause : (Int, Bool)[]) : Bool {\n mutable nOnes = 0;\n for (index, isTrue) in clause {\n if isTrue == args[index] {\n set nOnes += 1;\n }\n }\n return nOnes == 1;\n }\n\n function F_Exactly1SATFormula (args : Bool[], formula : (Int, Bool)[][]) : Bool {\n for clause in formula {\n if not F_Exactly1SATClause(args, clause) {\n return false;\n }\n }\n return true;\n }\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n for nVar in 3 .. 6 {\n for _ in 1 .. 3 {\n let formula = GenerateSATInstance(nVar, nVar - 1, 3);\n \n if not CheckOracleImplementsFunction(nVar, Kata.Oracle_Exactly13SATFormula(_, _, formula), F_Exactly1SATFormula(_, formula)) {\n Message($\"Test failed for SAT formula {SATFormulaAsString(formula)}\");\n return false;\n }\n }\n }\n\n Message(\"Correct!\");\n true\n }\n}\n"
|
|
8478
|
+
},
|
|
7953
8479
|
{
|
|
7954
8480
|
"id": "qec_shor__zz_measurement__Verification.qs",
|
|
7955
8481
|
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Katas;\n\n operation StatePrep_ZZMeasurement(qs : Qubit[], state : Int, alpha : Double) : Unit is Adj {\n // prep cos(alpha) * |0..0⟩ + sin(alpha) * |1..1⟩\n Ry(2.0 * alpha, qs[0]);\n CNOT(qs[0], qs[1]);\n\n if state == 1 {\n X(qs[0]);\n }\n }\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n let isCorrect = DistinguishStates_MultiQubit(\n 2,\n 2,\n StatePrep_ZZMeasurement,\n Kata.ZZMeasurement,\n true,\n [\"α|00⟩ + β|11⟩\", \"α|01⟩ + β|10⟩\"]);\n\n if (isCorrect) {\n Message(\"Correct!\");\n } else {\n Message(\"Incorrect.\");\n }\n\n isCorrect\n }\n}\n"
|
|
7956
8482
|
},
|
|
8483
|
+
{
|
|
8484
|
+
"id": "qec_shor__Common.qs",
|
|
8485
|
+
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Diagnostics;\n open Microsoft.Quantum.Math;\n open Microsoft.Quantum.Random;\n\n operation CheckErrorDetection(\n n : Int,\n encode : (Qubit[] => Unit is Adj),\n error : (Qubit => Unit is Adj),\n detect : (Qubit[] => Int)\n ) : Bool {\n for err_ind in -1 .. n - 1 {\n for _ in 1 .. 10 {\n use qs = Qubit[n];\n let theta = DrawRandomDouble(0.0, 1.0);\n within {\n // Prepare logical state on first qubit\n Ry(2.0 * theta * PI(), qs[0]);\n // Encode the state in multiple qubits\n encode(qs);\n // Introduce X error\n if err_ind > -1 {\n error(qs[err_ind]);\n }\n } apply {\n // Call solution to detect index\n let detected = detect(qs);\n // Check that it is correct\n if detected != err_ind {\n Message(\"Incorrect.\");\n let actual = err_ind == -1 ? \"No error happened\" | $\"Error happened on qubit {err_ind}\";\n Message($\"{actual}, but solution returned {detected}\");\n ResetAll(qs);\n return false;\n }\n }\n // Check that the state was not modified by the solution\n if not CheckAllZero(qs) {\n Message(\"Incorrect.\");\n Message(\"The state of the qubits changed after the solution was applied\");\n ResetAll(qs);\n return false;\n }\n }\n }\n\n Message(\"Correct!\");\n true\n }\n}\n"
|
|
8486
|
+
},
|
|
7957
8487
|
{
|
|
7958
8488
|
"id": "qec_shor__xx_measurement__Verification.qs",
|
|
7959
8489
|
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Katas;\n\n operation StatePrep_XXMeasurement(qs : Qubit[], state : Int, alpha : Double) : Unit is Adj {\n // prep cos(alpha) * |0..0⟩ + sin(alpha) * |1..1⟩\n Ry(2.0 * alpha, qs[0]);\n CNOT(qs[0], qs[1]);\n\n if state == 1 {\n X(qs[0]);\n }\n\n ApplyToEachA(H, qs);\n }\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n let isCorrect = DistinguishStates_MultiQubit(\n 2,\n 2,\n StatePrep_XXMeasurement,\n Kata.XXMeasurement,\n true,\n [\"α|++⟩ + β|--⟩\", \"α|+-⟩ + β|-+⟩\"]);\n\n if (isCorrect) {\n Message(\"Correct!\");\n } else {\n Message(\"Incorrect.\");\n }\n\n isCorrect\n }\n}\n"
|
|
@@ -7966,10 +8496,6 @@ export default {
|
|
|
7966
8496
|
"id": "qec_shor__bitflip_detect__Verification.qs",
|
|
7967
8497
|
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Katas;\n\n operation BitflipEncode (qs : Qubit[]) : Unit is Adj + Ctl {\n CNOT(qs[0], qs[1]);\n CNOT(qs[0], qs[2]);\n }\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n CheckErrorDetection(3, BitflipEncode, X, Kata.BitflipDetectError)\n }\n}\n"
|
|
7968
8498
|
},
|
|
7969
|
-
{
|
|
7970
|
-
"id": "qec_shor__Common.qs",
|
|
7971
|
-
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Diagnostics;\n open Microsoft.Quantum.Math;\n open Microsoft.Quantum.Random;\n\n operation CheckErrorDetection(\n n : Int,\n encode : (Qubit[] => Unit is Adj),\n error : (Qubit => Unit is Adj),\n detect : (Qubit[] => Int)\n ) : Bool {\n for err_ind in -1 .. n - 1 {\n for _ in 1 .. 10 {\n use qs = Qubit[n];\n let theta = DrawRandomDouble(0.0, 1.0);\n within {\n // Prepare logical state on first qubit\n Ry(2.0 * theta * PI(), qs[0]);\n // Encode the state in multiple qubits\n encode(qs);\n // Introduce X error\n if err_ind > -1 {\n error(qs[err_ind]);\n }\n } apply {\n // Call solution to detect index\n let detected = detect(qs);\n // Check that it is correct\n if detected != err_ind {\n Message(\"Incorrect.\");\n let actual = err_ind == -1 ? \"No error happened\" | $\"Error happened on qubit {err_ind}\";\n Message($\"{actual}, but solution returned {detected}\");\n ResetAll(qs);\n return false;\n }\n }\n // Check that the state was not modified by the solution\n if not CheckAllZero(qs) {\n Message(\"Incorrect.\");\n Message(\"The state of the qubits changed after the solution was applied\");\n ResetAll(qs);\n return false;\n }\n }\n }\n\n Message(\"Correct!\");\n true\n }\n}\n"
|
|
7972
|
-
},
|
|
7973
8499
|
{
|
|
7974
8500
|
"id": "qec_shor__phaseflip_encode__Verification.qs",
|
|
7975
8501
|
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Convert;\n open Microsoft.Quantum.Diagnostics;\n open Microsoft.Quantum.Katas;\n open Microsoft.Quantum.Math;\n\n operation PhaseflipEncode_Reference (qs : Qubit[]) : Unit is Adj + Ctl {\n CNOT(qs[0], qs[1]);\n CNOT(qs[0], qs[2]);\n ApplyToEachCA(H, qs);\n }\n\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n let range = 10;\n for i in 0 .. range - 1 {\n let angle = 2.0 * PI() * IntAsDouble(i) / IntAsDouble(range);\n let initialState = qs => Ry(2.0 * angle, qs[0]);\n let isCorrect = CheckOperationsEquivalenceOnInitialStateStrict(\n initialState,\n Kata.PhaseflipEncode, \n PhaseflipEncode_Reference, \n 3);\n if not isCorrect {\n Message(\"Incorrect\");\n Message($\"Test fails for alpha = {Cos(angle)}, beta = {Sin(angle)}.\");\n ShowQuantumStateComparison(3, initialState, Kata.PhaseflipEncode, PhaseflipEncode_Reference);\n return false;\n }\n }\n\n Message(\"Correct!\");\n true\n }\n}\n"
|