qsharp-lang 1.6.4-dev → 1.6.5-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/katas-content.generated.js +115 -0
- package/dist/katas-content.generated.md.js +115 -0
- 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 +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/ApplyGlobalPhase.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/CCH.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/CCNOT.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/CCY.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/CCZ.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/CH.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/CNOT.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/CRxx.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/CRyy.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/CRz.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/CRzz.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/CS.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/CT.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/CollectControls.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/ControllableGlobalPhase.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/EntangleForJointMeasure.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/Exp.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/GlobalPhase.md +1 -1
- 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 +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/M.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/MapPauli.md +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyActionIfSumOverflows.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyAsSinglyControlled.md +1 -1
- 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 +1 -1
- 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 +1 -1
- package/docs/Microsoft.Quantum.Unstable.TableLookup/MustBeFixed.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.TableLookup/Select.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.TableLookup/Unlookup.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.TableLookup/WriteMemoryContents.md +1 -1
- package/lib/node/qsc_wasm_bg.wasm +0 -0
- package/lib/web/qsc_wasm_bg.wasm +0 -0
- package/package.json +1 -1
|
@@ -7685,6 +7685,113 @@ export default {
|
|
|
7685
7685
|
}
|
|
7686
7686
|
],
|
|
7687
7687
|
"published": true
|
|
7688
|
+
},
|
|
7689
|
+
{
|
|
7690
|
+
"id": "nonlocal_games",
|
|
7691
|
+
"title": "Nonlocal Games",
|
|
7692
|
+
"sections": [
|
|
7693
|
+
{
|
|
7694
|
+
"type": "lesson",
|
|
7695
|
+
"id": "nonlocal_games__overview",
|
|
7696
|
+
"title": "Overview",
|
|
7697
|
+
"items": [
|
|
7698
|
+
{
|
|
7699
|
+
"type": "text-content",
|
|
7700
|
+
"content": "<p>This kata introduces three quantum nonlocal games that display "quantum pseudo-telepathy" -\nthe use of quantum entanglement to eliminate the need for classical communication.\nIn this context, "nonlocal" means that the playing parties are separated by a great distance,\nso they cannot communicate with each other during the game.\nAnother characteristics of these games is that they are "refereed", which means the players try to win against the referee.</p>\n<p><strong>This kata covers the following topics:</strong></p>\n<ul>\n<li>Clauser, Horne, Shimony, and Hold thought experiment (often abbreviated as CHSH game)</li>\n<li>Greenberger-Horne-Zeilinger game (often abbreviated as GHZ game)</li>\n<li>The Mermin-Peres Magic Square game</li>\n</ul>\n<p><strong>What you should know to start working on this kata:</strong></p>\n<ul>\n<li>Basic linear algebra</li>\n<li>Basic knowledge of quantum gates and measurements</li>\n</ul>\n"
|
|
7701
|
+
}
|
|
7702
|
+
]
|
|
7703
|
+
},
|
|
7704
|
+
{
|
|
7705
|
+
"type": "lesson",
|
|
7706
|
+
"id": "nonlocal_games__chsh_game",
|
|
7707
|
+
"title": "CHSH Game",
|
|
7708
|
+
"items": [
|
|
7709
|
+
{
|
|
7710
|
+
"type": "text-content",
|
|
7711
|
+
"content": "<p>In <strong>CHSH Game</strong>, two players (Alice and Bob) try to win the following game:</p>\n<p>Each of them is given a bit (Alice gets X and Bob gets Y), and\nthey have to return new bits (Alice returns A and Bob returns B)\nso that X ∧ Y = A ⊕ B. The trick is, they can not communicate during the game.</p>\n<blockquote>\n<ul>\n<li>∧ is the standard bitwise AND operator.</li>\n<li>⊕ is the exclusive or, or XOR operator, so (P ⊕ Q) is true if exactly one of P and Q is true.</li>\n</ul>\n</blockquote>\n"
|
|
7712
|
+
}
|
|
7713
|
+
]
|
|
7714
|
+
},
|
|
7715
|
+
{
|
|
7716
|
+
"type": "lesson",
|
|
7717
|
+
"id": "nonlocal_games__chsh_game_classical",
|
|
7718
|
+
"title": "Part I. Classical CHSH",
|
|
7719
|
+
"items": [
|
|
7720
|
+
{
|
|
7721
|
+
"type": "text-content",
|
|
7722
|
+
"content": "<p>To start with, let's take a look at how you would play the classical variant of this game without access to any quantum tools.</p>\n"
|
|
7723
|
+
}
|
|
7724
|
+
]
|
|
7725
|
+
},
|
|
7726
|
+
{
|
|
7727
|
+
"type": "exercise",
|
|
7728
|
+
"id": "nonlocal_games__chsh_classical_win_condition",
|
|
7729
|
+
"title": "Win Condition",
|
|
7730
|
+
"description": {
|
|
7731
|
+
"type": "text-content",
|
|
7732
|
+
"content": "<p><strong>Input:</strong></p>\n<ul>\n<li>Alice and Bob's starting bits (X and Y).</li>\n<li>Alice and Bob's output bits (A and B).</li>\n</ul>\n<p><strong>Output:</strong>\nTrue if Alice and Bob won the CHSH game, that is, if X ∧ Y = A ⊕ B, and false otherwise.</p>\n"
|
|
7733
|
+
},
|
|
7734
|
+
"sourceIds": [
|
|
7735
|
+
"nonlocal_games__chsh_classical_win_condition__Verification.qs",
|
|
7736
|
+
"KatasLibrary.qs"
|
|
7737
|
+
],
|
|
7738
|
+
"placeholderCode": "namespace Kata {\n function WinCondition (x : Bool, y : Bool, a : Bool, b : Bool) : Bool {\n // Implement your solution here...\n\n return false;\n }\n}\n",
|
|
7739
|
+
"explainedSolution": {
|
|
7740
|
+
"type": "explained-solution",
|
|
7741
|
+
"items": [
|
|
7742
|
+
{
|
|
7743
|
+
"type": "text-content",
|
|
7744
|
+
"content": "<p>There are four input pairs (X, Y) possible, (0,0), (0,1), (1,0), and (1,1), each with 25% probability.\nIn order to win, Alice and Bob have to output different bits if the input is (1,1), and same bits otherwise.</p>\n<p>To check whether the win condition holds, you need to compute $x ∧ y$ and $a ⊕ b$ and to compare these values: if they are equal, Alice and Bob won. You can compute these values using <a href=\"https://learn.microsoft.com/azure/quantum/user-guide/language/expressions/logicalexpressions\">built-in operators</a>: $x ∧ y$ as <code>x and y</code> and $a ⊕ b$ as <code>a != b</code>.</p>\n"
|
|
7745
|
+
},
|
|
7746
|
+
{
|
|
7747
|
+
"type": "solution",
|
|
7748
|
+
"id": "nonlocal_games__chsh_classical_win_condition_solution",
|
|
7749
|
+
"code": "namespace Kata {\n function WinCondition (x : Bool, y : Bool, a : Bool, b : Bool) : Bool {\n return (x and y) == (a != b);\n }\n}\n"
|
|
7750
|
+
}
|
|
7751
|
+
]
|
|
7752
|
+
}
|
|
7753
|
+
},
|
|
7754
|
+
{
|
|
7755
|
+
"type": "exercise",
|
|
7756
|
+
"id": "nonlocal_games__chsh_classical_strategy",
|
|
7757
|
+
"title": "Alice and Bob's Classical Strategy",
|
|
7758
|
+
"description": {
|
|
7759
|
+
"type": "text-content",
|
|
7760
|
+
"content": "<p>In this task you have to implement two functions, one for Alice's classical strategy and one for Bob's.\nNote that they are covered by one test, so you have to implement both to pass the test.</p>\n<p><strong>Input:</strong>\nAlice and Bob's starting bits (X and Y).</p>\n<p><strong>Output:</strong>\nAlice and Bob's output bits (A and B) to maximize their chance of winning.</p>\n"
|
|
7761
|
+
},
|
|
7762
|
+
"sourceIds": [
|
|
7763
|
+
"nonlocal_games__chsh_classical_strategy__Verification.qs",
|
|
7764
|
+
"KatasLibrary.qs"
|
|
7765
|
+
],
|
|
7766
|
+
"placeholderCode": "namespace Kata {\n function AliceClassical (x : Bool) : Bool {\n // Implement your solution here...\n\n return false;\n }\n\n function BobClassical (y : Bool) : Bool {\n // Implement your solution here...\n\n return true;\n }\n}\n",
|
|
7767
|
+
"explainedSolution": {
|
|
7768
|
+
"type": "explained-solution",
|
|
7769
|
+
"items": [
|
|
7770
|
+
{
|
|
7771
|
+
"type": "text-content",
|
|
7772
|
+
"content": "<p>If Alice and Bob always return TRUE, they will have a 75% win rate, since TRUE ⊕ TRUE = FALSE, and the AND operation on their input bits will be FALSE with 75% probability.\nAlternatively, Alice and Bob could agree to always return FALSE to achieve the same 75% win probability. A classical strategy cannot achieve a higher success probability.</p>\n"
|
|
7773
|
+
},
|
|
7774
|
+
{
|
|
7775
|
+
"type": "solution",
|
|
7776
|
+
"id": "nonlocal_games__chsh_classical_strategy_solution",
|
|
7777
|
+
"code": "namespace Kata {\n function AliceClassical (x : Bool) : Bool {\n return false;\n }\n\n function BobClassical (y : Bool) : Bool {\n return false;\n }\n}\n"
|
|
7778
|
+
}
|
|
7779
|
+
]
|
|
7780
|
+
}
|
|
7781
|
+
},
|
|
7782
|
+
{
|
|
7783
|
+
"type": "lesson",
|
|
7784
|
+
"id": "nonlocal_games__conclusion",
|
|
7785
|
+
"title": "Conclusion",
|
|
7786
|
+
"items": [
|
|
7787
|
+
{
|
|
7788
|
+
"type": "text-content",
|
|
7789
|
+
"content": "<p>Congratulations! In this kata you learned how to use quantum entanglement in nonlocal quantum games to get results that are better than any classical strategy can offer.</p>\n"
|
|
7790
|
+
}
|
|
7791
|
+
]
|
|
7792
|
+
}
|
|
7793
|
+
],
|
|
7794
|
+
"published": false
|
|
7688
7795
|
}
|
|
7689
7796
|
],
|
|
7690
7797
|
"globalCodeSources": [
|
|
@@ -8511,6 +8618,14 @@ export default {
|
|
|
8511
8618
|
{
|
|
8512
8619
|
"id": "qec_shor__shor_detect__Verification.qs",
|
|
8513
8620
|
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Diagnostics;\n open Microsoft.Quantum.Katas;\n open Microsoft.Quantum.Math;\n open Microsoft.Quantum.Random;\n\n operation ShorEncode (qs : Qubit[]) : Unit is Adj + Ctl {\n BitflipEncode(qs[0 .. 3 .. 8]);\n ApplyToEachCA(H, qs[0 .. 3 .. 8]);\n for i in 0 .. 2 {\n BitflipEncode(qs[3 * i .. 3 * i + 2]);\n }\n }\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\n @EntryPoint()\n operation CheckSolution() : Bool {\n for err_ind in -1 .. 8 {\n for err in [PauliX, PauliZ, PauliY] {\n for _ in 1 .. 10 {\n mutable correct = true;\n mutable msg = \"\";\n use qs = Qubit[9];\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 ShorEncode(qs);\n // Introduce the error\n if err_ind > -1 {\n if err == PauliX {\n X(qs[err_ind]);\n } elif err == PauliZ {\n Z(qs[err_ind]);\n } else {\n Y(qs[err_ind]);\n }\n }\n } apply {\n // Call solution to detect error\n let (detected_ind, detected_err) = Kata.ShorDetectError(qs);\n // Check that it is correct\n if err_ind == -1 {\n // No error\n if detected_ind != -1 {\n set correct = false;\n set msg = $\"There was no error, but the solution detected error at qubit {detected_ind}\";\n }\n } else {\n // There was an error\n if detected_err != err {\n set correct = false;\n set msg = $\"There was a {err} error, but the solution detected {detected_err} error\";\n } else {\n if err == PauliX or err == PauliY {\n if detected_ind != err_ind {\n set correct = false;\n set msg = $\"There was a {err} error at qubit {err_ind}, but the solution detected it at qubit {detected_ind}\";\n }\n } else {\n // For PauliZ errors, cannot say for certain in which qubit of the triplet it happened, so identify triplet\n if detected_ind != err_ind / 3 {\n set correct = false;\n set msg = $\"There was a {err} error at qubit {err_ind}, but the solution detected it at qubit triplet {detected_ind}\";\n }\n }\n }\n }\n }\n // Check that the state was not modified by the solution\n if not CheckAllZero(qs) {\n set correct = false;\n set msg = \"The state of the qubits changed after the solution was applied\";\n }\n\n if not correct {\n Message(\"Incorrect.\");\n Message(msg);\n ResetAll(qs);\n return false;\n }\n }\n }\n }\n\n Message(\"Correct!\");\n true\n }\n}\n"
|
|
8621
|
+
},
|
|
8622
|
+
{
|
|
8623
|
+
"id": "nonlocal_games__chsh_classical_win_condition__Verification.qs",
|
|
8624
|
+
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Convert;\n\n function WinCondition_Reference(x : Bool, y : Bool, a : Bool, b : Bool) : Bool {\n return (x and y) == (a != b);\n }\n\n @EntryPoint()\n function CheckSolution() : Bool {\n for i in 0..1 <<< 4 - 1 {\n let bits = IntAsBoolArray(i, 4);\n let expected = WinCondition_Reference(bits[0], bits[1], bits[2], bits[3]);\n let actual = Kata.WinCondition(bits[0], bits[1], bits[2], bits[3]);\n\n if actual != expected {\n Message($\"Win condition '{actual}' isn't as expected for X = {bits[0]}, Y = {bits[1]}, \" + \n\t\t $\"A = {bits[2]}, B = {bits[3]}\");\n return false;\n }\n }\n Message(\"Correct!\");\n true\n }\n}\n"
|
|
8625
|
+
},
|
|
8626
|
+
{
|
|
8627
|
+
"id": "nonlocal_games__chsh_classical_strategy__Verification.qs",
|
|
8628
|
+
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Convert;\n open Microsoft.Quantum.Random;\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n mutable wins = 0;\n for i in 1..1000 {\n let x = DrawRandomInt(0, 1) == 1 ? true | false;\n let y = DrawRandomInt(0, 1) == 1 ? true | false;\n let (a, b) = (Kata.AliceClassical(x), Kata.BobClassical(y));\n if ((x and y) == (a != b)) {\n set wins = wins + 1;\n }\n }\n Message($\"Win rate {IntAsDouble(wins) / 1000.}\");\n if (wins < 700) {\n Message(\"Alice and Bob's classical strategy is not optimal\");\n return false;\n }\n Message(\"Correct!\");\n true\n }\n\n}\n"
|
|
8514
8629
|
}
|
|
8515
8630
|
]
|
|
8516
8631
|
};
|
|
@@ -7685,6 +7685,113 @@ export default {
|
|
|
7685
7685
|
}
|
|
7686
7686
|
],
|
|
7687
7687
|
"published": true
|
|
7688
|
+
},
|
|
7689
|
+
{
|
|
7690
|
+
"id": "nonlocal_games",
|
|
7691
|
+
"title": "Nonlocal Games",
|
|
7692
|
+
"sections": [
|
|
7693
|
+
{
|
|
7694
|
+
"type": "lesson",
|
|
7695
|
+
"id": "nonlocal_games__overview",
|
|
7696
|
+
"title": "Overview",
|
|
7697
|
+
"items": [
|
|
7698
|
+
{
|
|
7699
|
+
"type": "text-content",
|
|
7700
|
+
"content": "\nThis kata introduces three quantum nonlocal games that display \"quantum pseudo-telepathy\" -\nthe use of quantum entanglement to eliminate the need for classical communication.\nIn this context, \"nonlocal\" means that the playing parties are separated by a great distance,\nso they cannot communicate with each other during the game.\nAnother characteristics of these games is that they are \"refereed\", which means the players try to win against the referee.\n\n**This kata covers the following topics:**\n - Clauser, Horne, Shimony, and Hold thought experiment (often abbreviated as CHSH game)\n - Greenberger-Horne-Zeilinger game (often abbreviated as GHZ game)\n - The Mermin-Peres Magic Square game\n\n**What you should know to start working on this kata:**\n - Basic linear algebra\n - Basic knowledge of quantum gates and measurements"
|
|
7701
|
+
}
|
|
7702
|
+
]
|
|
7703
|
+
},
|
|
7704
|
+
{
|
|
7705
|
+
"type": "lesson",
|
|
7706
|
+
"id": "nonlocal_games__chsh_game",
|
|
7707
|
+
"title": "CHSH Game",
|
|
7708
|
+
"items": [
|
|
7709
|
+
{
|
|
7710
|
+
"type": "text-content",
|
|
7711
|
+
"content": "\nIn **CHSH Game**, two players (Alice and Bob) try to win the following game:\n\nEach of them is given a bit (Alice gets X and Bob gets Y), and\nthey have to return new bits (Alice returns A and Bob returns B)\nso that X ∧ Y = A ⊕ B. The trick is, they can not communicate during the game.\n\n> * ∧ is the standard bitwise AND operator.\n> * ⊕ is the exclusive or, or XOR operator, so (P ⊕ Q) is true if exactly one of P and Q is true."
|
|
7712
|
+
}
|
|
7713
|
+
]
|
|
7714
|
+
},
|
|
7715
|
+
{
|
|
7716
|
+
"type": "lesson",
|
|
7717
|
+
"id": "nonlocal_games__chsh_game_classical",
|
|
7718
|
+
"title": "Part I. Classical CHSH",
|
|
7719
|
+
"items": [
|
|
7720
|
+
{
|
|
7721
|
+
"type": "text-content",
|
|
7722
|
+
"content": "\nTo start with, let's take a look at how you would play the classical variant of this game without access to any quantum tools."
|
|
7723
|
+
}
|
|
7724
|
+
]
|
|
7725
|
+
},
|
|
7726
|
+
{
|
|
7727
|
+
"type": "exercise",
|
|
7728
|
+
"id": "nonlocal_games__chsh_classical_win_condition",
|
|
7729
|
+
"title": "Win Condition",
|
|
7730
|
+
"description": {
|
|
7731
|
+
"type": "text-content",
|
|
7732
|
+
"content": "**Input:** \n* Alice and Bob's starting bits (X and Y).\n* Alice and Bob's output bits (A and B).\n\n**Output:**\n True if Alice and Bob won the CHSH game, that is, if X ∧ Y = A ⊕ B, and false otherwise.\n\n"
|
|
7733
|
+
},
|
|
7734
|
+
"sourceIds": [
|
|
7735
|
+
"nonlocal_games__chsh_classical_win_condition__Verification.qs",
|
|
7736
|
+
"KatasLibrary.qs"
|
|
7737
|
+
],
|
|
7738
|
+
"placeholderCode": "namespace Kata {\n function WinCondition (x : Bool, y : Bool, a : Bool, b : Bool) : Bool {\n // Implement your solution here...\n\n return false;\n }\n}\n",
|
|
7739
|
+
"explainedSolution": {
|
|
7740
|
+
"type": "explained-solution",
|
|
7741
|
+
"items": [
|
|
7742
|
+
{
|
|
7743
|
+
"type": "text-content",
|
|
7744
|
+
"content": "\nThere are four input pairs (X, Y) possible, (0,0), (0,1), (1,0), and (1,1), each with 25% probability.\nIn order to win, Alice and Bob have to output different bits if the input is (1,1), and same bits otherwise.\n\nTo check whether the win condition holds, you need to compute $x ∧ y$ and $a ⊕ b$ and to compare these values: if they are equal, Alice and Bob won. You can compute these values using [built-in operators](https://learn.microsoft.com/azure/quantum/user-guide/language/expressions/logicalexpressions): $x ∧ y$ as `x and y` and $a ⊕ b$ as `a != b`."
|
|
7745
|
+
},
|
|
7746
|
+
{
|
|
7747
|
+
"type": "solution",
|
|
7748
|
+
"id": "nonlocal_games__chsh_classical_win_condition_solution",
|
|
7749
|
+
"code": "namespace Kata {\n function WinCondition (x : Bool, y : Bool, a : Bool, b : Bool) : Bool {\n return (x and y) == (a != b);\n }\n}\n"
|
|
7750
|
+
}
|
|
7751
|
+
]
|
|
7752
|
+
}
|
|
7753
|
+
},
|
|
7754
|
+
{
|
|
7755
|
+
"type": "exercise",
|
|
7756
|
+
"id": "nonlocal_games__chsh_classical_strategy",
|
|
7757
|
+
"title": "Alice and Bob's Classical Strategy",
|
|
7758
|
+
"description": {
|
|
7759
|
+
"type": "text-content",
|
|
7760
|
+
"content": "In this task you have to implement two functions, one for Alice's classical strategy and one for Bob's. \nNote that they are covered by one test, so you have to implement both to pass the test.\n\n**Input:** \nAlice and Bob's starting bits (X and Y).\n\n**Output:**\n Alice and Bob's output bits (A and B) to maximize their chance of winning.\n"
|
|
7761
|
+
},
|
|
7762
|
+
"sourceIds": [
|
|
7763
|
+
"nonlocal_games__chsh_classical_strategy__Verification.qs",
|
|
7764
|
+
"KatasLibrary.qs"
|
|
7765
|
+
],
|
|
7766
|
+
"placeholderCode": "namespace Kata {\n function AliceClassical (x : Bool) : Bool {\n // Implement your solution here...\n\n return false;\n }\n\n function BobClassical (y : Bool) : Bool {\n // Implement your solution here...\n\n return true;\n }\n}\n",
|
|
7767
|
+
"explainedSolution": {
|
|
7768
|
+
"type": "explained-solution",
|
|
7769
|
+
"items": [
|
|
7770
|
+
{
|
|
7771
|
+
"type": "text-content",
|
|
7772
|
+
"content": "\nIf Alice and Bob always return TRUE, they will have a 75% win rate, since TRUE ⊕ TRUE = FALSE, and the AND operation on their input bits will be FALSE with 75% probability.\nAlternatively, Alice and Bob could agree to always return FALSE to achieve the same 75% win probability. A classical strategy cannot achieve a higher success probability."
|
|
7773
|
+
},
|
|
7774
|
+
{
|
|
7775
|
+
"type": "solution",
|
|
7776
|
+
"id": "nonlocal_games__chsh_classical_strategy_solution",
|
|
7777
|
+
"code": "namespace Kata {\n function AliceClassical (x : Bool) : Bool {\n return false;\n }\n\n function BobClassical (y : Bool) : Bool {\n return false;\n }\n}\n"
|
|
7778
|
+
}
|
|
7779
|
+
]
|
|
7780
|
+
}
|
|
7781
|
+
},
|
|
7782
|
+
{
|
|
7783
|
+
"type": "lesson",
|
|
7784
|
+
"id": "nonlocal_games__conclusion",
|
|
7785
|
+
"title": "Conclusion",
|
|
7786
|
+
"items": [
|
|
7787
|
+
{
|
|
7788
|
+
"type": "text-content",
|
|
7789
|
+
"content": "\nCongratulations! In this kata you learned how to use quantum entanglement in nonlocal quantum games to get results that are better than any classical strategy can offer."
|
|
7790
|
+
}
|
|
7791
|
+
]
|
|
7792
|
+
}
|
|
7793
|
+
],
|
|
7794
|
+
"published": false
|
|
7688
7795
|
}
|
|
7689
7796
|
],
|
|
7690
7797
|
"globalCodeSources": [
|
|
@@ -8511,6 +8618,14 @@ export default {
|
|
|
8511
8618
|
{
|
|
8512
8619
|
"id": "qec_shor__shor_detect__Verification.qs",
|
|
8513
8620
|
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Diagnostics;\n open Microsoft.Quantum.Katas;\n open Microsoft.Quantum.Math;\n open Microsoft.Quantum.Random;\n\n operation ShorEncode (qs : Qubit[]) : Unit is Adj + Ctl {\n BitflipEncode(qs[0 .. 3 .. 8]);\n ApplyToEachCA(H, qs[0 .. 3 .. 8]);\n for i in 0 .. 2 {\n BitflipEncode(qs[3 * i .. 3 * i + 2]);\n }\n }\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\n @EntryPoint()\n operation CheckSolution() : Bool {\n for err_ind in -1 .. 8 {\n for err in [PauliX, PauliZ, PauliY] {\n for _ in 1 .. 10 {\n mutable correct = true;\n mutable msg = \"\";\n use qs = Qubit[9];\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 ShorEncode(qs);\n // Introduce the error\n if err_ind > -1 {\n if err == PauliX {\n X(qs[err_ind]);\n } elif err == PauliZ {\n Z(qs[err_ind]);\n } else {\n Y(qs[err_ind]);\n }\n }\n } apply {\n // Call solution to detect error\n let (detected_ind, detected_err) = Kata.ShorDetectError(qs);\n // Check that it is correct\n if err_ind == -1 {\n // No error\n if detected_ind != -1 {\n set correct = false;\n set msg = $\"There was no error, but the solution detected error at qubit {detected_ind}\";\n }\n } else {\n // There was an error\n if detected_err != err {\n set correct = false;\n set msg = $\"There was a {err} error, but the solution detected {detected_err} error\";\n } else {\n if err == PauliX or err == PauliY {\n if detected_ind != err_ind {\n set correct = false;\n set msg = $\"There was a {err} error at qubit {err_ind}, but the solution detected it at qubit {detected_ind}\";\n }\n } else {\n // For PauliZ errors, cannot say for certain in which qubit of the triplet it happened, so identify triplet\n if detected_ind != err_ind / 3 {\n set correct = false;\n set msg = $\"There was a {err} error at qubit {err_ind}, but the solution detected it at qubit triplet {detected_ind}\";\n }\n }\n }\n }\n }\n // Check that the state was not modified by the solution\n if not CheckAllZero(qs) {\n set correct = false;\n set msg = \"The state of the qubits changed after the solution was applied\";\n }\n\n if not correct {\n Message(\"Incorrect.\");\n Message(msg);\n ResetAll(qs);\n return false;\n }\n }\n }\n }\n\n Message(\"Correct!\");\n true\n }\n}\n"
|
|
8621
|
+
},
|
|
8622
|
+
{
|
|
8623
|
+
"id": "nonlocal_games__chsh_classical_win_condition__Verification.qs",
|
|
8624
|
+
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Convert;\n\n function WinCondition_Reference(x : Bool, y : Bool, a : Bool, b : Bool) : Bool {\n return (x and y) == (a != b);\n }\n\n @EntryPoint()\n function CheckSolution() : Bool {\n for i in 0..1 <<< 4 - 1 {\n let bits = IntAsBoolArray(i, 4);\n let expected = WinCondition_Reference(bits[0], bits[1], bits[2], bits[3]);\n let actual = Kata.WinCondition(bits[0], bits[1], bits[2], bits[3]);\n\n if actual != expected {\n Message($\"Win condition '{actual}' isn't as expected for X = {bits[0]}, Y = {bits[1]}, \" + \n\t\t $\"A = {bits[2]}, B = {bits[3]}\");\n return false;\n }\n }\n Message(\"Correct!\");\n true\n }\n}\n"
|
|
8625
|
+
},
|
|
8626
|
+
{
|
|
8627
|
+
"id": "nonlocal_games__chsh_classical_strategy__Verification.qs",
|
|
8628
|
+
"code": "namespace Kata.Verification {\n open Microsoft.Quantum.Convert;\n open Microsoft.Quantum.Random;\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n mutable wins = 0;\n for i in 1..1000 {\n let x = DrawRandomInt(0, 1) == 1 ? true | false;\n let y = DrawRandomInt(0, 1) == 1 ? true | false;\n let (a, b) = (Kata.AliceClassical(x), Kata.BobClassical(y));\n if ((x and y) == (a != b)) {\n set wins = wins + 1;\n }\n }\n Message($\"Win rate {IntAsDouble(wins) / 1000.}\");\n if (wins < 700) {\n Message(\"Alice and Bob's classical strategy is not optimal\");\n return false;\n }\n Message(\"Correct!\");\n true\n }\n\n}\n"
|
|
8514
8629
|
}
|
|
8515
8630
|
]
|
|
8516
8631
|
};
|