vein icon indicating copy to clipboard operation
vein copied to clipboard

Syntax support for quantum operation

Open 0xF6 opened this issue 3 years ago • 0 comments

EPIC: #20

  • [x] Proposed
  • [x] Triage: Completed
  • [ ] Prototype: not started
  • [ ] Implementation: not started
  • [ ] Specification: not started

define quantum operation in code

#use "mana/lang/quantum"

operation Teleportation(): Unit
{
    body
    {
       auto msg = QPU.AllocCleared();
       auto p1 = QPU.AllocCleared();
       auto p2 = QPU.AllocCleared();
       
       {.H p1};
       {.CNOT p1, p2};
       
       if ({.MRZ msg} == One}
           {.Z p2};
       if ({.MRZ p1} == One)
           {.X p2}

       auto result = QPU.Measure(p2);       
       QPU.Reset(p2);
       return result;
    }
    gc auto;
    sync auto;
    control auto;
}

Ishtar view (transformation result)

TODO

0xF6 avatar May 27 '21 00:05 0xF6