380 likes | 469 Views
Silq: A High-level Quantum Programming Language. Benjamin Bichsel. Maximilian Baader. Timon Gehr. Martin Vechev. Quantum Programming Languages. Existing languages: Describe circuits. Silq: Describes high-level operations. Qiskit. Quipper. Reduce & simplify code. Static safety /
E N D
Silq: A High-level Quantum Programming Language Benjamin Bichsel Maximilian Baader Timon Gehr Martin Vechev
Quantum Programming Languages Existing languages: Describe circuits Silq: Describes high-level operations Qiskit Quipper Reduce & simplify code Static safety / Prevent errors Q# ProjectQ QWire More intuitive semantics Safe automatic uncomputation LIQ𝑈𝑖|〉 QASM Forest … Downstream applications Physicality Source of icons: https://fontawesome.com
Quantum Programming Languages Comparison on Microsoft’s Q# coding contests, seehttps://silq.ethz.ch/comparison
Goals of this Lecture Discuss & compare languages Learn Silq’s language concepts Try out Silq Report issues Source of icons: https://fontawesome.com
Basic Features of Silq if x { // controlled on x, y:=H(y); // apply H to y } y:=H(x); x:=H(x);
Grover’s Algorithm - Recap for all
Grover’s Algorithm in Silq classical bijection
Grover’s Algorithm in Silq y:=f(x); qfree with
Automatic Uncomputation iff(cand){ phase(); } implicit measurement
Automatic Uncomputation const iff(cand){ phase(); } qfree
Summary of Type Annotations Documentation on http://silq.ethz.ch/documentation#/documentation/1_annotations const mfree qfree classical Source of icons: https://fontawesome.com
Downstream Applications Compilation Simulation Teaching Research Source of icons: https://fontawesome.com
Try Silq Yourself! Install Follow instructions on http://www.silq.ethz.ch/install Try examples Try to solve tasks / run solutions from http://www.silq.ethz.ch/examples Source of icons: https://fontawesome.com
Interested in Silq? Ask & Complain! Contact us! Bachelor/Master thesis Research projects PhD Benjamin Bichsel Max Baader Timon Gehr Prof. Martin Vechev (ETH Zürich) https://www.sri.inf.ethz.ch/ Source of icons: https://fontawesome.com
Invalid Programs From Live Coding • The following slides are here for completeness.
Preventing Errors- Use Consumed defuseConsumed(x:𝔹){ y := H(x); return(x,y); // undefined identifier x } defduplicateConst(constx:𝔹){ y := H(x); return(x,y); // no error }
Preventing Errors- Implicit Measurements defimplicitMeas[n:!ℕ](x:uint[n]){ y := x % 2; returny; } // parameter 'x' is not consumed defunconsumedConst[n:!ℕ](constx:uint[n]){ y := x % 2; returny; } // no error
Preventing Errors- Conditional Measurements defcondMeas(constc:𝔹,x:𝔹){ ifc{ x:= measure(x); } returnx; } // cannot call function 'measure[𝔹]' in 'mfree' context defclassCondMeas(constc:!𝔹,x:𝔹){ ifc{ x:= measure(x):𝔹; } returnx; } // no error
Preventing Errors- Reverse Measurements defrevMeas(){ returnreverse(measure); } // reversed function must be mfree
Preventing Errors- Invalid Uncomputation defnonConst(y:𝔹){ ifX(y) { // X consumes y phase(π); } } // non-'lifted' quantum expression must be consumed defsignFlipOf0(consty:𝔹){ ifX(y) { // X consumes a copy of y phase(π); } } // no error
Preventing Errors- Invalid Uncomputation defnonQfree(consty:𝔹,z:𝔹){ ifH(y) { z := X(z); } returnz; } // non-'lifted' quantum expression must be consumed