toward automatic verification of quantum programs
play

Toward Automatic Verification of Quantum Programs Xiaodi Wu QuICS, - PowerPoint PPT Presentation

Toward Automatic Verification of Quantum Programs Xiaodi Wu QuICS, University of Maryland Outline Motivation A Quantum Programming Language Floyd-Hoare Logic for Quantum Programs Invariant Generation Recent Developments Summary My


  1. Toward Automatic Verification of Quantum Programs Xiaodi Wu QuICS, University of Maryland

  2. Outline Motivation A Quantum Programming Language Floyd-Hoare Logic for Quantum Programs Invariant Generation Recent Developments Summary

  3. My Research in Quantum Programming Languages Background ◮ theory of quantum information and computation ◮ work on quantum programming languages since 2016

  4. My Research in Quantum Programming Languages Background ◮ theory of quantum information and computation ◮ work on quantum programming languages since 2016 Research Interests ◮ apply techniques from formal methods and programming languages to tackle practical problems in quantum computing

  5. My Research in Quantum Programming Languages Background ◮ theory of quantum information and computation ◮ work on quantum programming languages since 2016 Research Interests ◮ apply techniques from formal methods and programming languages to tackle practical problems in quantum computing Project Samples ◮ Verification : sequential (POPL 17) & parallel, expressibility & scalability, ......

  6. My Research in Quantum Programming Languages Background ◮ theory of quantum information and computation ◮ work on quantum programming languages since 2016 Research Interests ◮ apply techniques from formal methods and programming languages to tackle practical problems in quantum computing Project Samples ◮ Verification : sequential (POPL 17) & parallel, expressibility & scalability, ...... ◮ Near-term Quantum Applications : e.g., noise (POPL 19), optimization, ......

  7. My Research in Quantum Programming Languages Background ◮ theory of quantum information and computation ◮ work on quantum programming languages since 2016 Research Interests ◮ apply techniques from formal methods and programming languages to tackle practical problems in quantum computing Project Samples ◮ Verification : sequential (POPL 17) & parallel, expressibility & scalability, ...... ◮ Near-term Quantum Applications : e.g., noise (POPL 19), optimization, ...... ◮ Novel Semantic Constructs : e.g., quantum recursion

  8. Verification of Quantum Programs Motivation ◮ quantum programs: less intuitive and error-prone .

  9. Verification of Quantum Programs Motivation ◮ quantum programs: less intuitive and error-prone . ◮ comparing to classical: harder task with less study.

  10. Verification of Quantum Programs Motivation ◮ quantum programs: less intuitive and error-prone . ◮ comparing to classical: harder task with less study. ◮ QPL practice: Quipper, QWIRE, ScaffCC, Q#, qiskit, Forrest, ProjectQ, ...

  11. Verification of Quantum Programs Motivation ◮ quantum programs: less intuitive and error-prone . ◮ comparing to classical: harder task with less study. ◮ QPL practice: Quipper, QWIRE, ScaffCC, Q#, qiskit, Forrest, ProjectQ, ...

  12. Verification of Quantum Programs Motivation ◮ quantum programs: less intuitive and error-prone . ◮ comparing to classical: harder task with less study. ◮ QPL practice: Quipper, QWIRE, ScaffCC, Q#, qiskit, Forrest, ProjectQ, ... Issues with Verifications ◮ The object of verification?

  13. Verification of Quantum Programs Motivation ◮ quantum programs: less intuitive and error-prone . ◮ comparing to classical: harder task with less study. ◮ QPL practice: Quipper, QWIRE, ScaffCC, Q#, qiskit, Forrest, ProjectQ, ... Issues with Verifications ◮ The object of verification? ◮ Traditional, lightweight, and full verification?

  14. Verification of Quantum Programs Motivation ◮ quantum programs: less intuitive and error-prone . ◮ comparing to classical: harder task with less study. ◮ QPL practice: Quipper, QWIRE, ScaffCC, Q#, qiskit, Forrest, ProjectQ, ... Issues with Verifications ◮ The object of verification? ◮ Traditional, lightweight, and full verification?

  15. Verification of Quantum Programs Motivation ◮ quantum programs: less intuitive and error-prone . ◮ comparing to classical: harder task with less study. ◮ QPL practice: Quipper, QWIRE, ScaffCC, Q#, qiskit, Forrest, ProjectQ, ... Issues with Verifications ◮ The object of verification? ◮ Traditional, lightweight, and full verification? Long-term Target ◮ Scalable and Principled Verification of Quantum Programs! ◮ a library of verified quantum programs; automated tools to assist programmer; ...

  16. Outline Motivation A Quantum Programming Language Floyd-Hoare Logic for Quantum Programs Invariant Generation Recent Developments Summary

  17. Quantum While-Language Syntax A core language for imperative quantum programming S :: = skip | q : = | 0 � | S 1 ; S 2 | q : = U [ q ] | if ( � m · M [ q ] = m → S m ) fi | while M [ q ] = 1 do S od

  18. Operational Semantics A configuration : � S , ρ � ◮ S is a quantum program or E (the empty program) ◮ ρ is a partial density operator in � H all = H q all q

  19. Operational Semantics ( Sk ) � skip , ρ � → � E , ρ � ( Ini ) � q : = | 0 � , ρ � → � E , ρ q 0 � ◮ type ( q ) = Boolean : ρ q 0 = | 0 � q � 0 | ρ | 0 � q � 0 | + | 0 � q � 1 | ρ | 1 � q � 0 | ◮ type ( q ) = integer : ∞ ρ q ∑ 0 = | 0 � q � n | ρ | n � q � 0 | n = − ∞

  20. Operational Semantics ( Uni ) � q : = U [ q ] , ρ � → � E , U ρ U † � � S 1 , ρ � → � S ′ 1 , ρ ′ � ( Seq ) � S 1 ; S 2 , ρ � → � S ′ 1 ; S 2 , ρ ′ � Convention : E ; S 2 = S 2 . ( IF ) � if ( � m · M [ q ] = m → S m ) fi , ρ � → � S m , M m ρ M † m � for each outcome m

  21. Operational Semantics ( L 0 ) � while M [ q ] = 1 do S od , ρ � → � E , M 0 ρ M † 0 � ( L 1 ) � while M [ q ] = 1 do S , ρ � → � S ; while M [ q ] = 1 do S , M 1 ρ M † 1

  22. Quantum 1-D Loop Walk QW ≡ c : = | L � ; 1 1 p : = | 0 � ; 0 while M [ p ] = no do c : = H [ c ] ; c , p : = S [ c , p ] od Operator Definition n − 1 n − 1 ∑ ∑ S = | L �� L | ⊗ | i ⊖ 1 �� i | + | R �� R | ⊗ | i ⊕ 1 �� i | . i = 0 i = 0

  23. Denotational Semantics Semantic function of quantum program S : � S � : D ( H all ) → D ( H all ) � S � ( ρ ) = ∑ {| ρ ′ : � S , ρ � → ∗ � E , ρ ′ �|} for all ρ ∈ D ( H all )

  24. Observation: tr ( � S � ( ρ )) ≤ tr ( ρ ) for any quantum program S and all ρ ∈ D ( H all ) . ◮ tr ( ρ ) − tr ( � S � ( ρ )) is the probability that program S diverges from input state ρ .

  25. Outline Motivation A Quantum Programming Language Floyd-Hoare Logic for Quantum Programs Invariant Generation Recent Developments Summary

  26. Definitions ◮ A quantum predicate is a Hermitian operator (obsevable) P such that 0 ⊑ P ⊑ I . [1] E. D’Hondt and P. Panangaden, Quantum weakest preconditions, Mathematical Structures in Computer Science 2006. ◮ A correctness formula is a statement of the form: { P } S { Q } where: ◮ S is a quantum program ◮ P and Q are quantum predicates. ◮ Operator P is called the precondition and Q the postcondition .

  27. Definitions 1. { P } S { Q } is true in the sense of total correctness : | = tot { P } S { Q } if tr ( P ρ ) ≤ tr ( Q � S � ( ρ )) for all ρ . 2. { P } S { Q } is true in the sense of partial correctness : | = par { P } S { Q } , if tr ( P ρ ) ≤ tr ( Q � S � ( ρ )) + [ tr ( ρ ) − tr ( � S � ( ρ ))] for all ρ .

  28. Proof System for Partial Correctness ( Axiom Sk ) { P } Skip { P } ( Axiom Ini ) type ( q ) = Boolean : {| 0 � q � 0 | P | 0 � q � 0 | + | 1 � q � 0 | P | 0 � q � 1 |} q : = | 0 �{ P } type ( q ) = integer : ∞ ∑ { | n � q � 0 | P | 0 � q � n |} q : = | 0 �{ P } n = − ∞ { U † PU } q : = U [ q ] { P } ( Axiom Uni )

  29. Proof System for Partial Correctness { P } S 1 { Q } { Q } S 2 { R } ( Rule Seq ) { P } S 1 ; S 2 { R } { P m } S m { Q } for all m ( Rule IF ) { ∑ m M † m P m M m } if ( � m · M [ q ] = m → S m ) fi { Q } { Q } S { M † 0 PM 0 + M † 1 QM 1 } ( Rule LP ) { M † 0 PM 0 + M † 1 QM 1 } while M [ q ] = 1 do S { P } Q ′ ⊑ Q P ⊑ P ′ { P ′ } S { Q ′ } ( Rule Ord ) { P } S { Q }

  30. Theorem (Soundness and Completeness) For any quantum program S and quantum predicates P , Q , | = par { P } S { Q } if and only if ⊢ PD { P } S { Q } .

  31. Quantum 1-D Loop Walk QW ≡ c : = | L � ; 1 1 p : = | 0 � ; 0 while M [ p ] = no do c : = H [ c ] ; c , p : = S [ c , p ] od Operator Definition n − 1 n − 1 ∑ ∑ S = | L �� L | ⊗ | i ⊖ 1 �� i | + | R �� R | ⊗ | i ⊕ 1 �� i | . i = 0 i = 0

  32. Proof System for Total Correctness Let P be a quantum predicate and ǫ > 0. A function t : D ( H all ) ( density operators ) → N is called a ( P , ǫ ) - ranking function of quantum loop: while M [ q ] = 1 do S od if for all ρ : 1. t ( � S � ( M 1 ρ M † 1 )) ≤ t ( ρ ) ; 2. tr ( P ρ ) ≥ ǫ implies t ( � S � ( M 1 ρ M † 1 )) < t ( ρ )

  33. Proof System for Total Correctness ( 1 ) { Q } S { M † 0 PM 0 + M † 1 QM 1 } ( 2 ) for any ǫ > 0, t ǫ is a ( M † 1 QM 1 , ǫ ) − ranking function of loop ( Rule LT ) { M † 0 PM 0 + M † 1 QM 1 } while M [ q ] = 1 do S od { P }

  34. Theorem (Soundness and Completeness) For any quantum program S and quantum predicates P Q , | = tot { P } S { Q } if and only if ⊢ TD { P } S { Q } . [2] M. S. Ying, Floyd-Hoare logic for quantum programs, ACM Transactions on Programming Languages and Systems 2011

Recommend


More recommend