Foundations of Quantum Programming

Size: px
Start display at page:

Download "Foundations of Quantum Programming"

Transcription

1 Foundations of Quantum Programming Mingsheng Ying University of Technology Sydney, Australia Institute of Software, Chinese Academy of Sciences Tsinghua University, China

2 Outline Introduction Syntax of Quantum Programs Operational Semantics Denotational Semantics (Floyd-)Hoare Logic for Quantum Programs Research Problems

3 Outline Introduction Syntax of Quantum Programs Operational Semantics Denotational Semantics (Floyd-)Hoare Logic for Quantum Programs Research Problems

4 How to program quantum computers? Quantum algorithms: Deutsch-Josza, Grover, Shor, HHL,... Quantum algorithm zoo (

5 How to program quantum computers? Quantum algorithms: Deutsch-Josza, Grover, Shor, HHL,... Quantum algorithm zoo ( Quantum computers: IBM Q (20 qubits Nov 2017; 50 qubits 2018) Google (49 qubits 2018) Intel (17 qubits Oct 2017)

6 Quantum programming languages

7 Quantum programming languages Open

8 Quantum programming languages Open

9 Quantum programming languages Open

10 Quantum programming languages Open

11 Quantum programming languages Open Project

12 Quantum programming languages Open Project

13 Quantum programming languages Open Project Q

14 This lecture Principles underlying all of the quantum programming languages

15 This lecture Principles underlying all of the quantum programming languages Not the languages themselves.

16 This lecture Principles underlying all of the quantum programming languages Not the languages themselves. Reference: M. S. Ying, Foundations of Quantum Programming, Morgan Kaufmann 2016, Chapters 3 and 4.

17 Programming languages and tools Programming languages are notations used for specifying, organising and reasoning about computations. [R. Sethi, Programming languages: Concepts and Constructs] Semantics

18 Programming languages and tools Programming languages are notations used for specifying, organising and reasoning about computations. [R. Sethi, Programming languages: Concepts and Constructs] Semantics Turing-complete?

19 Programming languages and tools Programming languages are notations used for specifying, organising and reasoning about computations. [R. Sethi, Programming languages: Concepts and Constructs] Semantics Turing-complete? Comiplers

20 Programming languages and tools Programming languages are notations used for specifying, organising and reasoning about computations. [R. Sethi, Programming languages: Concepts and Constructs] Semantics Turing-complete? Comiplers Program analysis: Termination,...

21 Programming languages and tools Programming languages are notations used for specifying, organising and reasoning about computations. [R. Sethi, Programming languages: Concepts and Constructs] Semantics Turing-complete? Comiplers Program analysis: Termination,... How to verify correctness of your programs?

22 Programming languages and tools Programming languages are notations used for specifying, organising and reasoning about computations. [R. Sethi, Programming languages: Concepts and Constructs] Semantics Turing-complete? Comiplers Program analysis: Termination,... How to verify correctness of your programs?...

23 Quantum circuit vs Quantum programs Example: Quantum walk on a circle with an absorbing boundary. H d = span{ L, R } the direction space, L and R indicate directions left and right, respectively.

24 Quantum circuit vs Quantum programs Example: Quantum walk on a circle with an absorbing boundary. H d = span{ L, R } the direction space, L and R indicate directions left and right, respectively. H p = span{ 0, 1,..., n 1 } the position space with orthonormal basis states, the vector i denotes position i for each 0 i n 1.

25 Quantum circuit vs Quantum programs Example: Quantum walk on a circle with an absorbing boundary. H d = span{ L, R } the direction space, L and R indicate directions left and right, respectively. H p = span{ 0, 1,..., n 1 } the position space with orthonormal basis states, the vector i denotes position i for each 0 i n 1. The state space of the walk H = H p H d.

26 Quantum circuit vs Quantum programs Example: Quantum walk on a circle with an absorbing boundary. H d = span{ L, R } the direction space, L and R indicate directions left and right, respectively. H p = span{ 0, 1,..., n 1 } the position space with orthonormal basis states, the vector i denotes position i for each 0 i n 1. The state space of the walk H = H p H d. The initial state 0 p L d.

27 Quantum circuit vs Quantum programs Each step of the walk:

28 Quantum circuit vs Quantum programs Each step of the walk: 1. Measure the system to see whether the current position is 1 (absorbing boundary). If yes, terminates; otherwise, continues: M = {M yes = 1 1 I d, M no = I M yes };

29 Quantum circuit vs Quantum programs Each step of the walk: 1. Measure the system to see whether the current position is 1 (absorbing boundary). If yes, terminates; otherwise, continues: M = {M yes = 1 1 I d, M no = I M yes }; ( 2. A coin-tossing operator C = direction space; ) is applied on the

30 Quantum circuit vs Quantum programs Each step of the walk: 1. Measure the system to see whether the current position is 1 (absorbing boundary). If yes, terminates; otherwise, continues: M = {M yes = 1 1 I d, M no = I M yes }; ( 2. A coin-tossing operator C = direction space; 3. A shift operator S = ) is applied on the n 1 n 1 i 1 i L L + i 1 i R R i=0 i=0 is performed on the state space H.

31 Quantum circuit vs Quantum programs Each step of the walk: 1. Measure the system to see whether the current position is 1 (absorbing boundary). If yes, terminates; otherwise, continues: M = {M yes = 1 1 I d, M no = I M yes }; ( 2. A coin-tossing operator C = direction space; 3. A shift operator S = ) is applied on the n 1 n 1 i 1 i L L + i 1 i R R i=0 i=0 is performed on the state space H. Question: How to specify it in the circuit language?

32 Outline Introduction Syntax of Quantum Programs Operational Semantics Denotational Semantics (Floyd-)Hoare Logic for Quantum Programs Research Problems

33 Classical while-language S ::= skip u := t S 1 ; S 2 if b then S 1 else S 2 fi while b do S od. Conditional statement can be generalised to case statement: or more compactly: if G 1 S 1 G 2 S 2... G n S n fi if ( i G i S i ) fi

34 Quantum while-language Alphabet: a countably infinite set Var of quantum variables q, q, q 0, q 1, q 2,...

35 Quantum while-language Alphabet: a countably infinite set Var of quantum variables q, q, q 0, q 1, q 2,... Each quantum variable q Var has a type H q (a Hilbert space), e.g. Boolean = H 2, integer = H.

36 Quantum while-language Alphabet: a countably infinite set Var of quantum variables q, q, q 0, q 1, q 2,... Each quantum variable q Var has a type H q (a Hilbert space), e.g. Boolean = H 2, integer = H. A quantum register is a finite sequence q = q 1,..., q n of distinct quantum variables. State Hilbert space: H q = n H qi. i=1

37 Syntax of Quantum Programs S ::= skip q := 0 q := U[q] S 1 ; S 2 if ( m M[q] = m S m ) fi while M[q] = 1 do S od.

38 Syntax of Quantum Programs S ::= skip q := 0 q := U[q] S 1 ; S 2 if ( m M[q] = m S m ) fi while M[q] = 1 do S od. Exercise 1 Write quantum walk as a program in quantum while-language.

39 Outline Introduction Syntax of Quantum Programs Operational Semantics Denotational Semantics (Floyd-)Hoare Logic for Quantum Programs Research Problems

40 Notations partial density operator: positive operator ρ, tr(ρ) 1.

41 Notations partial density operator: positive operator ρ, tr(ρ) 1. D(H) the set of partial density operators in H.

42 Notations partial density operator: positive operator ρ, tr(ρ) 1. D(H) the set of partial density operators in H. State Hilbert space of all quantum variables: H all = H q. q Var

43 Notations partial density operator: positive operator ρ, tr(ρ) 1. D(H) the set of partial density operators in H. State Hilbert space of all quantum variables: H all = H q. q Var E empty program; i.e. termination.

44 Notations partial density operator: positive operator ρ, tr(ρ) 1. D(H) the set of partial density operators in H. State Hilbert space of all quantum variables: H all = q Var E empty program; i.e. termination. Configuration: pair S, ρ, where: H q.

45 Notations partial density operator: positive operator ρ, tr(ρ) 1. D(H) the set of partial density operators in H. State Hilbert space of all quantum variables: H all = q Var H q. E empty program; i.e. termination. Configuration: pair S, ρ, where: 1. S is a quantum program or the empty program E;

46 Notations partial density operator: positive operator ρ, tr(ρ) 1. D(H) the set of partial density operators in H. State Hilbert space of all quantum variables: H all = q Var H q. E empty program; i.e. termination. Configuration: pair S, ρ, where: 1. S is a quantum program or the empty program E; 2. ρ D(H all ), denoting the (global) state of quantum variables.

47 Notations partial density operator: positive operator ρ, tr(ρ) 1. D(H) the set of partial density operators in H. State Hilbert space of all quantum variables: H all = q Var H q. E empty program; i.e. termination. Configuration: pair S, ρ, where: 1. S is a quantum program or the empty program E; 2. ρ D(H all ), denoting the (global) state of quantum variables. Transition: S, ρ S, ρ

48 Operational Semantics (SK) skip, ρ E, ρ (IN) q := 0, ρ E, ρ q 0 (UT) where : ρ q 0 = 0 q i ρ i q 0 i q := U[q], ρ E, UρU (SC) S 1, ρ S 1, ρ S 1 ; S 2, ρ S 1 ; S 2, ρ where : E; S 2 = S 2.

49 Operational Semantics (IF) if ( m M[q] = m S m ) fi, ρ S m, M m ρm m for each possible outcome m of measurement M = {M m }. (L0) while M[q] = 1 do S od, ρ E, M 0 ρm 0 (L1) while M[q] = 1 do S od, ρ S; while M[q] = 1 do S od, M1 ρm 1

50 Computation of Programs 1. A (finite or infinite) transition sequence of program S with input ρ D(H all ): S, ρ S 1, ρ 1... S n, ρ n S n+1, ρ n+1... such that ρ n 0 for all n (except the last n in the case of a finite sequence).

51 Computation of Programs 1. A (finite or infinite) transition sequence of program S with input ρ D(H all ): S, ρ S 1, ρ 1... S n, ρ n S n+1, ρ n+1... such that ρ n 0 for all n (except the last n in the case of a finite sequence). 2. If this sequence cannot be extended, it is called a computation.

52 Computation of Programs 1. A (finite or infinite) transition sequence of program S with input ρ D(H all ): S, ρ S 1, ρ 1... S n, ρ n S n+1, ρ n+1... such that ρ n 0 for all n (except the last n in the case of a finite sequence). 2. If this sequence cannot be extended, it is called a computation. If it is finite and its last configuration is E, ρ, we say it terminates in ρ.

53 Computation of Programs 1. A (finite or infinite) transition sequence of program S with input ρ D(H all ): S, ρ S 1, ρ 1... S n, ρ n S n+1, ρ n+1... such that ρ n 0 for all n (except the last n in the case of a finite sequence). 2. If this sequence cannot be extended, it is called a computation. If it is finite and its last configuration is E, ρ, we say it terminates in ρ. If it is infinite, we say it diverges.

54 Notation Write: S, ρ n S, ρ if there are configurations S 1, ρ 1,..., S n 1, ρ n 1 such that S, ρ S 1, ρ 1... S n 1, ρ n 1 S, ρ,

55 Notation Write: S, ρ n S, ρ if there are configurations S 1, ρ 1,..., S n 1, ρ n 1 such that S, ρ S 1, ρ 1... S n 1, ρ n 1 S, ρ, Write for the reflexive and transitive closures of : S, ρ S, ρ if and only if S, ρ n S, ρ for some n 0.

56 Outline Introduction Syntax of Quantum Programs Operational Semantics Denotational Semantics (Floyd-)Hoare Logic for Quantum Programs Research Problems

57 Semantic Function Semantic function of program S: S : D(H all ) D(H all ) S (ρ) = { ρ : S, ρ E, ρ }

58 Semantic Function Semantic function of program S: S : D(H all ) D(H all ) S (ρ) = { ρ : S, ρ E, ρ } Exercise 2 Try to compute semantic function of your quantum walk program.

59 Structural Representation 1. skip (ρ) = ρ.

60 Structural Representation 1. skip (ρ) = ρ. 2. q := 0 (ρ) = i 0 q i ρ i q 0.

61 Structural Representation 1. skip (ρ) = ρ. 2. q := 0 (ρ) = i 0 q i ρ i q q := U[q] (ρ) = UρU.

62 Structural Representation 1. skip (ρ) = ρ. 2. q := 0 (ρ) = i 0 q i ρ i q q := U[q] (ρ) = UρU. 4. S 1 ; S 2 (ρ) = S 2 ( S 1 (ρ)).

63 Structural Representation 1. skip (ρ) = ρ. 2. q := 0 (ρ) = i 0 q i ρ i q q := U[q] (ρ) = UρU. 4. S 1 ; S 2 (ρ) = S 2 ( S 1 (ρ)). 5. if ( m M[q] = m S m ) fi (ρ) = m S m (M m ρm m).

64 Structural Representation 1. skip (ρ) = ρ. 2. q := 0 (ρ) = i 0 q i ρ i q q := U[q] (ρ) = UρU. 4. S 1 ; S 2 (ρ) = S 2 ( S 1 (ρ)). 5. if ( m M[q] = m S m ) fi (ρ) = m S m (M m ρm m). 6. while M[q] = 1 do S od (ρ) =???

65 Basic Lattice Theory A partial order (L, ): L is a nonempty set, is a binary relation on L satisfying:

66 Basic Lattice Theory A partial order (L, ): L is a nonempty set, is a binary relation on L satisfying: 1. Reflexivity: x x for all x L;

67 Basic Lattice Theory A partial order (L, ): L is a nonempty set, is a binary relation on L satisfying: 1. Reflexivity: x x for all x L; 2. Antisymmetry: x y and y x imply x = y for all x, y L;

68 Basic Lattice Theory A partial order (L, ): L is a nonempty set, is a binary relation on L satisfying: 1. Reflexivity: x x for all x L; 2. Antisymmetry: x y and y x imply x = y for all x, y L; 3. Transitivity: x y and y z imply x z for all x, y, z L.

69 Basic Lattice Theory A partial order (L, ): L is a nonempty set, is a binary relation on L satisfying: 1. Reflexivity: x x for all x L; 2. Antisymmetry: x y and y x imply x = y for all x, y L; 3. Transitivity: x y and y z imply x z for all x, y, z L. x L is called the least element when x y for all y L.

70 Basic Lattice Theory A partial order (L, ): L is a nonempty set, is a binary relation on L satisfying: 1. Reflexivity: x x for all x L; 2. Antisymmetry: x y and y x imply x = y for all x, y L; 3. Transitivity: x y and y z imply x z for all x, y, z L. x L is called the least element when x y for all y L. x L is called an upper bound of a subset X L if y x for all x X.

71 Basic Lattice Theory A partial order (L, ): L is a nonempty set, is a binary relation on L satisfying: 1. Reflexivity: x x for all x L; 2. Antisymmetry: x y and y x imply x = y for all x, y L; 3. Transitivity: x y and y z imply x z for all x, y, z L. x L is called the least element when x y for all y L. x L is called an upper bound of a subset X L if y x for all x X. x is called the least upper bound of X, written x = X, if

72 Basic Lattice Theory A partial order (L, ): L is a nonempty set, is a binary relation on L satisfying: 1. Reflexivity: x x for all x L; 2. Antisymmetry: x y and y x imply x = y for all x, y L; 3. Transitivity: x y and y z imply x z for all x, y, z L. x L is called the least element when x y for all y L. x L is called an upper bound of a subset X L if y x for all x X. x is called the least upper bound of X, written x = X, if x is an upper bound of X;

73 Basic Lattice Theory A partial order (L, ): L is a nonempty set, is a binary relation on L satisfying: 1. Reflexivity: x x for all x L; 2. Antisymmetry: x y and y x imply x = y for all x, y L; 3. Transitivity: x y and y z imply x z for all x, y, z L. x L is called the least element when x y for all y L. x L is called an upper bound of a subset X L if y x for all x X. x is called the least upper bound of X, written x = X, if x is an upper bound of X; for any upper bound y of X, x y.

74 Basic Lattice Theory A complete partial order (CPO) is a partial order (L, ):

75 Basic Lattice Theory A complete partial order (CPO) is a partial order (L, ): 1. it has the least element 0;

76 Basic Lattice Theory A complete partial order (CPO) is a partial order (L, ): 1. it has the least element 0; 2. n=0 x n exists for any increasing sequence {x n }: x 0... x n x n+1...

77 Basic Lattice Theory A complete partial order (CPO) is a partial order (L, ): 1. it has the least element 0; 2. n=0 x n exists for any increasing sequence {x n }: x 0... x n x n+1... A function f from L into itself is continuous if ( ) f x n = n n f (x n ) for any increasing sequence {x n } in L.

78 Knaster-Tarski Theorem Let (L, ) be a CPO and function f : L L continuous. Then f has the least fixed point µf = f (n) (0) n=0 where { f (0) (0) = 0, f (n+1) (0) = f (f (n) (0)) for n 0.

79 CPO of Partial Density Operators Löwner order: operators A B B A is positive.

80 CPO of Partial Density Operators Löwner order: operators A B B A is positive. (D(H), ) is a CPO with the zero operator 0 H as its least element. Exercise 3 Prove the above statement for finite-dimensional H.

81 CPO of Super-operators Each super-operator in H is a continuous function from (D(H), ) into itself.

82 CPO of Super-operators Each super-operator in H is a continuous function from (D(H), ) into itself. QO(H) the set of superoperators in Hilbert space H.

83 CPO of Super-operators Each super-operator in H is a continuous function from (D(H), ) into itself. QO(H) the set of superoperators in Hilbert space H. Löwner order between operators can be lifted to a partial order between super-operators: E F E(ρ) F(ρ) for all ρ D(H)

84 CPO of Super-operators Each super-operator in H is a continuous function from (D(H), ) into itself. QO(H) the set of superoperators in Hilbert space H. Löwner order between operators can be lifted to a partial order between super-operators: (QO(H), ) is a CPO. E F E(ρ) F(ρ) for all ρ D(H)

85 Syntactic Approximation abort denotes a program such that abort (ρ) = 0 Hall for all ρ D(H).

86 Syntactic Approximation abort denotes a program such that abort (ρ) = 0 Hall for all ρ D(H). Write: while while M[q] = 1 do S od.

87 Syntactic Approximation abort denotes a program such that abort (ρ) = 0 Hall for all ρ D(H). Write: while while M[q] = 1 do S od. For integer k 0, the kth syntactic approximation while (k) of while: while (0) abort, while (k+1) if M[q] = 0 skip 1 S; while (k) fi

88 Semantic Function of Loops while = while (k), k=0 where stands for the least upper bound in CPO (QO (H all ), ).

89 Semantic Function of Loops while = while (k), k=0 where stands for the least upper bound in CPO (QO (H all ), ). Fixed Point Characterisation For any ρ D(H all ): ( )) while (ρ) = M 0 ρm 0 ( S + while M 1 ρm 1.

90 Semantic Function of Loops while = while (k), k=0 where stands for the least upper bound in CPO (QO (H all ), ). Fixed Point Characterisation For any ρ D(H all ): ( )) while (ρ) = M 0 ρm 0 ( S + while M 1 ρm 1. Exercise 4 Prove the above equality.

91 Termination and Divergence Probabilities For any quantum program S and ρ D(H all ): tr( S (ρ)) tr(ρ).

92 Termination and Divergence Probabilities For any quantum program S and ρ D(H all ): tr( S (ρ)) tr(ρ). tr( S (ρ)) is the probability that program S with input ρ terminates.

93 Outline Introduction Syntax of Quantum Programs Operational Semantics Denotational Semantics (Floyd-)Hoare Logic for Quantum Programs Research Problems

94 Quantum predicates = Quantum effects A quantum effect is a (Hermitian) operator 0 M I; that is, 0 tr(mρ) 1 for all density operators.

95 Quantum predicates = Quantum effects A quantum effect is a (Hermitian) operator 0 M I; that is, 0 tr(mρ) 1 for all density operators. tr(mρ) may be interpreted as the expected degree to which quantum state ρ satisfies quantum predicate M.

96 Correctness Formulas A correctness formula (Hoare triple) is a statement of the form: {P}S{Q} where:

97 Correctness Formulas A correctness formula (Hoare triple) is a statement of the form: {P}S{Q} where: S is a quantum program; Partial Correctness, Total Correctness

98 Correctness Formulas A correctness formula (Hoare triple) is a statement of the form: {P}S{Q} where: S is a quantum program; P, Q are quantum predicates in Hall. Partial Correctness, Total Correctness

99 Correctness Formulas A correctness formula (Hoare triple) is a statement of the form: {P}S{Q} where: S is a quantum program; P, Q are quantum predicates in Hall. P is called the precondition, Q the postcondition. Partial Correctness, Total Correctness

100 Correctness Formulas A correctness formula (Hoare triple) is a statement of the form: {P}S{Q} where: S is a quantum program; P, Q are quantum predicates in Hall. P is called the precondition, Q the postcondition. Partial Correctness, Total Correctness Partial correctness: If an input to program S satisfies precondition P, then either S does not terminate, or it terminates in a state satisfying postcondition Q.

101 Correctness Formulas A correctness formula (Hoare triple) is a statement of the form: {P}S{Q} where: S is a quantum program; P, Q are quantum predicates in Hall. P is called the precondition, Q the postcondition. Partial Correctness, Total Correctness Partial correctness: If an input to program S satisfies precondition P, then either S does not terminate, or it terminates in a state satisfying postcondition Q. Total correctness: If an input to program S satisfies precondition P, then S must terminate and it terminates in a state satisfying postcondition Q.

102 Partial Correctness, Total Correctness (Continued) The correctness formula {P}S{Q} is true in the sense of total correctness, written = tot {P}S{Q}, if: tr(pρ) tr(q S (ρ)) for all ρ D(H all ), where S is the semantic function of S.

103 Partial Correctness, Total Correctness (Continued) The correctness formula {P}S{Q} is true in the sense of total correctness, written = tot {P}S{Q}, if: tr(pρ) tr(q S (ρ)) for all ρ D(H all ), where S is the semantic function of S. The correctness formula {P}S{Q} is true in the sense of partial correctness, written = par {P}S{Q}, if: for all ρ D(H all ). tr(pρ) tr(q S (ρ)) + [tr(ρ) tr( S (ρ))]

104 Proof System for Partial Correctness (Ax Sk) {P}Skip{P} (Ax In) If type(q) = Boolean, then { 0 q 0 P 0 q q 0 P 0 q 1 }q := 0 {P} If type(q) = integer, then { n q 0 P 0 q n n= } q := 0 {P} (Ax UT) {U PU}q := Uq{P}

105 Proof System for Partial Correctness (Continued) (R SC) {P}S 1 {Q} {Q}S 2 {R} {P}S 1 ; S 2 {R} (R IF) {P m }S m {Q} for all m { m M mp m M m } if ( m M[q] = m Sm ) fi{q} (R LP) {Q}S { M 0 PM 0 + M 1 QM } 1 {M 0 PM 0 + M 1 QM 1}while M[q] = 1 do S od{p} (R Or) P P {P }S{Q } Q Q {P}S{Q}

106 Soundness Theorem For any quantum while-program S and quantum predicates P, Q P(H all ): qpd {P}S{Q} implies = par {P}S{Q}.

107 Soundness Theorem For any quantum while-program S and quantum predicates P, Q P(H all ): qpd {P}S{Q} implies = par {P}S{Q}. Exercise 5 Prove soundness theorem.

108 Soundness Theorem For any quantum while-program S and quantum predicates P, Q P(H all ): qpd {P}S{Q} implies = par {P}S{Q}. Exercise 5 Prove soundness theorem. (Relative) Completeness Theorem For any quantum while-program S and quantum predicates P, Q P(H all ): = par {P}S{Q} implies qpd {P}S{Q}.

109 Bound (Ranking) Functions Let P P(H all ) be a quantum predicate, real number ɛ > 0.

110 Bound (Ranking) Functions Let P P(H all ) be a quantum predicate, real number ɛ > 0. A function t : D(H all ) ω is a (P, ɛ)-bound function of quantum loop while M[q] = 1 do S od if for all ρ D(H all ):

111 Bound (Ranking) Functions Let P P(H all ) be a quantum predicate, real number ɛ > 0. A function t : D(H all ) ω is a (P, ɛ)-bound function of quantum loop if for all ρ D(H all ): 1. t ( S ( M 1 ρm 1)) t(ρ); while M[q] = 1 do S od

112 Bound (Ranking) Functions Let P P(H all ) be a quantum predicate, real number ɛ > 0. A function t : D(H all ) ω is a (P, ɛ)-bound function of quantum loop while M[q] = 1 do S od if for all ρ D(H all ): 1. t ( S ( M 1 ρm 1)) t(ρ); 2. tr(pρ) ɛ implies ( ( )) t S M 1 ρm 1 < t(ρ)

113 Proof System for Total Correctness {Q}S{M 0 PM 0 + M 1 QM 1} (R LT) for any ɛ > 0, t ɛ is a (M 1 QM 1, ɛ) bound function of loop while M[q] = 1 do S od {M 0 PM 0 + M 1 QM 1}while M[q] = 1 do S od{p}

114 Soundness Theorem For any quantum program S and quantum predicates P, Q P(H all ): qtd {P}S{Q} implies = tot {P}S{Q}.

115 Soundness Theorem For any quantum program S and quantum predicates P, Q P(H all ): qtd {P}S{Q} implies = tot {P}S{Q}. (Relative) Completeness Theorem For any quantum program S and quantum predicates P, Q P(H all ): = tot {P}S{Q} implies qtd {P}S{Q}.

116 Outline Introduction Syntax of Quantum Programs Operational Semantics Denotational Semantics (Floyd-)Hoare Logic for Quantum Programs Research Problems

117 Research problems 1. Compute the expected running time of the quantum walk.

118 Research problems 1. Compute the expected running time of the quantum walk. 2. Develop a logic for recursive quantum programs. Further reading [1] M. S. Ying, S. G. Ying and X. D. Wu, Invariants of quantum programs: characterisations and generation, POPL [2] Y. J. Li and M. S. Ying, Algorithmic analysis of termination problem for quantum programs, POPL 2018.

119 Research problems 1. Compute the expected running time of the quantum walk. 2. Develop a logic for recursive quantum programs. 3. Parallel or distributed quantum programs? Further reading [1] M. S. Ying, S. G. Ying and X. D. Wu, Invariants of quantum programs: characterisations and generation, POPL [2] Y. J. Li and M. S. Ying, Algorithmic analysis of termination problem for quantum programs, POPL 2018.

120 Research problems 1. Compute the expected running time of the quantum walk. 2. Develop a logic for recursive quantum programs. 3. Parallel or distributed quantum programs? 4. Improve the invariant generation and termination analysis algorithms for quantum programs. Further reading [1] M. S. Ying, S. G. Ying and X. D. Wu, Invariants of quantum programs: characterisations and generation, POPL [2] Y. J. Li and M. S. Ying, Algorithmic analysis of termination problem for quantum programs, POPL 2018.

121 Thank You!

Quantum Recursion and Second Quantisation

Quantum Recursion and Second Quantisation Quantum Recursion and Second Quantisation Mingsheng Ying State Key Laboratory of Computer Science Outline 1. Introduction 2. Recursive Programming 3. Classical Recursion in Quantum Programming 4. Quantum

More information

Quantum Recursion and Second Quantisation

Quantum Recursion and Second Quantisation Quantum Recursion and Second Quantisation Mingsheng Ying University of Technology Sydney, Australia and Tsinghua University, China Outline 1. Introduction 2. Quantum Case Statement 3. Syntax of Quantum

More information

Quantum Recursion and Second Quantisation Basic Ideas and Examples

Quantum Recursion and Second Quantisation Basic Ideas and Examples Quantum Recursion and Second Quantisation Basic Ideas and Examples Mingsheng Ying University of Technology, Sydney, Australia and Tsinghua University, China Happy Birthday Prakash! Happy Birthday Prakash!

More information

arxiv: v1 [cs.pl] 8 Nov 2018

arxiv: v1 [cs.pl] 8 Nov 2018 Quantitative Robustness Analysis of Quantum Programs (Extended Version) arxiv:1811.03585v1 [cs.pl] 8 Nov 2018 SHIH-HAN HUNG, KESHA HIETALA, and SHAOPENG ZHU, University of Maryland, College Park, USA MINGSHENG

More information

Lecture 2: Axiomatic semantics

Lecture 2: Axiomatic semantics Chair of Software Engineering Trusted Components Prof. Dr. Bertrand Meyer Lecture 2: Axiomatic semantics Reading assignment for next week Ariane paper and response (see course page) Axiomatic semantics

More information

Dynamic Semantics. Dynamic Semantics. Operational Semantics Axiomatic Semantics Denotational Semantic. Operational Semantics

Dynamic Semantics. Dynamic Semantics. Operational Semantics Axiomatic Semantics Denotational Semantic. Operational Semantics Dynamic Semantics Operational Semantics Denotational Semantic Dynamic Semantics Operational Semantics Operational Semantics Describe meaning by executing program on machine Machine can be actual or simulated

More information

Verification Logics for Quantum Programs WPE-II

Verification Logics for Quantum Programs WPE-II Verification Logics for Quantum Programs WPE-II Robert Rand Computer and Information Sciences University of Pennsylvania rrand@seas.upenn.edu Abstract We survey the landscape of Hoare logics for quantum

More information

Hoare Logic (I): Axiomatic Semantics and Program Correctness

Hoare Logic (I): Axiomatic Semantics and Program Correctness Hoare Logic (I): Axiomatic Semantics and Program Correctness (Based on [Apt and Olderog 1991; Gries 1981; Hoare 1969; Kleymann 1999; Sethi 199]) Yih-Kuen Tsay Dept. of Information Management National Taiwan

More information

Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions

Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions Chapter 1 Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions 1.1 The IMP Language IMP is a programming language with an extensible syntax that was developed in the late 1960s. We will

More information

Program verification using Hoare Logic¹

Program verification using Hoare Logic¹ Program verification using Hoare Logic¹ Automated Reasoning - Guest Lecture Petros Papapanagiotou Part 2 of 2 ¹Contains material from Mike Gordon s slides: Previously on Hoare Logic A simple while language

More information

Reasoning About Imperative Programs. COS 441 Slides 10b

Reasoning About Imperative Programs. COS 441 Slides 10b Reasoning About Imperative Programs COS 441 Slides 10b Last time Hoare Logic: { P } C { Q } Agenda If P is true in the initial state s. And C in state s evaluates to s. Then Q must be true in s. Program

More information

What happens to the value of the expression x + y every time we execute this loop? while x>0 do ( y := y+z ; x := x:= x z )

What happens to the value of the expression x + y every time we execute this loop? while x>0 do ( y := y+z ; x := x:= x z ) Starter Questions Feel free to discuss these with your neighbour: Consider two states s 1 and s 2 such that s 1, x := x + 1 s 2 If predicate P (x = y + 1) is true for s 2 then what does that tell us about

More information

Verification Frameworks and Hoare Logic

Verification Frameworks and Hoare Logic CMSC 630 February 11, 2015 1 Verification Frameworks and Hoare Logic Sources K. Apt and E.-R. Olderog. Verification of Sequential and Concurrent Programs (Second Edition). Springer-Verlag, Berlin, 1997.

More information

Unifying Theories of Programming

Unifying Theories of Programming 1&2 Unifying Theories of Programming Unifying Theories of Programming 3&4 Theories Unifying Theories of Programming designs predicates relations reactive CSP processes Jim Woodcock University of York May

More information

A Logic for Formal Verification of Quantum Programs

A Logic for Formal Verification of Quantum Programs A Logic for Formal Verification of Quantum Programs Yoshihiko Kakutani Department of Information Science, University of Tokyo kakutani@is.s.u-tokyo.ac.jp Abstract. This paper provides a Hoare-style logic

More information

Loop Convergence. CS 536: Science of Programming, Fall 2018

Loop Convergence. CS 536: Science of Programming, Fall 2018 Solved Loop Convergence CS 536: Science of Programming, Fall 2018 A. Why Diverging programs aren t useful, so it s useful to know how to show that loops terminate. B. Objectives At the end of this lecture

More information

QWIRE Practice: Formal Verification of Quantum Circuits in Coq

QWIRE Practice: Formal Verification of Quantum Circuits in Coq 1 / 29 QWIRE Practice: Formal Verification of Quantum Circuits in Coq Robert Rand, Jennifer Paykin, Steve Zdancewic University of Pennsylvania Quantum Physics and Logic, 2017 2 / 29 QWIRE A high-level

More information

Axiomatic Semantics. Operational semantics. Good for. Not good for automatic reasoning about programs

Axiomatic Semantics. Operational semantics. Good for. Not good for automatic reasoning about programs Review Operational semantics relatively l simple many flavors (small vs. big) not compositional (rule for while) Good for describing language implementation reasoning about properties of the language eg.

More information

Axiomatic Semantics. Lecture 9 CS 565 2/12/08

Axiomatic Semantics. Lecture 9 CS 565 2/12/08 Axiomatic Semantics Lecture 9 CS 565 2/12/08 Axiomatic Semantics Operational semantics describes the meaning of programs in terms of the execution steps taken by an abstract machine Denotational semantics

More information

Axiomatic Semantics. Semantics of Programming Languages course. Joosep Rõõmusaare

Axiomatic Semantics. Semantics of Programming Languages course. Joosep Rõõmusaare Axiomatic Semantics Semantics of Programming Languages course Joosep Rõõmusaare 2014 Direct Proofs of Program Correctness Partial correctness properties are properties expressing that if a given program

More information

Deductive Verification

Deductive Verification Deductive Verification Mooly Sagiv Slides from Zvonimir Rakamaric First-Order Logic A formal notation for mathematics, with expressions involving Propositional symbols Predicates Functions and constant

More information

Programming Languages and Compilers (CS 421)

Programming Languages and Compilers (CS 421) Programming Languages and Compilers (CS 421) Sasa Misailovic 4110 SC, UIUC https://courses.engr.illinois.edu/cs421/fa2017/cs421a Based in part on slides by Mattox Beckman, as updated by Vikram Adve, Gul

More information

Formal Methods for Probabilistic Systems

Formal Methods for Probabilistic Systems Formal Methods for Probabilistic Systems Annabelle McIver Carroll Morgan Source-level program logic Meta-theorems for loops Examples Relational operational model Standard, deterministic, terminating...

More information

Syntax. Notation Throughout, and when not otherwise said, we assume a vocabulary V = C F P.

Syntax. Notation Throughout, and when not otherwise said, we assume a vocabulary V = C F P. First-Order Logic Syntax The alphabet of a first-order language is organised into the following categories. Logical connectives:,,,,, and. Auxiliary symbols:.,,, ( and ). Variables: we assume a countable

More information

Axiomatic Semantics: Verification Conditions. Review of Soundness and Completeness of Axiomatic Semantics. Announcements

Axiomatic Semantics: Verification Conditions. Review of Soundness and Completeness of Axiomatic Semantics. Announcements Axiomatic Semantics: Verification Conditions Meeting 12, CSCI 5535, Spring 2009 Announcements Homework 4 is due tonight Wed forum: papers on automated testing using symbolic execution 2 Questions? Review

More information

Hoare Logic I. Introduction to Deductive Program Verification. Simple Imperative Programming Language. Hoare Logic. Meaning of Hoare Triples

Hoare Logic I. Introduction to Deductive Program Verification. Simple Imperative Programming Language. Hoare Logic. Meaning of Hoare Triples Hoare Logic I Introduction to Deductive Program Verification Işıl Dillig Program Spec Deductive verifier FOL formula Theorem prover valid contingent Example specs: safety (no crashes), absence of arithmetic

More information

The non-logical symbols determine a specific F OL language and consists of the following sets. Σ = {Σ n } n<ω

The non-logical symbols determine a specific F OL language and consists of the following sets. Σ = {Σ n } n<ω 1 Preliminaries In this chapter we first give a summary of the basic notations, terminology and results which will be used in this thesis. The treatment here is reduced to a list of definitions. For the

More information

A Short Introduction to Hoare Logic

A Short Introduction to Hoare Logic A Short Introduction to Hoare Logic Supratik Chakraborty I.I.T. Bombay June 23, 2008 Supratik Chakraborty (I.I.T. Bombay) A Short Introduction to Hoare Logic June 23, 2008 1 / 34 Motivation Assertion checking

More information

What? Correctness? Bugs!

What? Correctness? Bugs! Program Correctness Literatuur Verification of Sequential and Concurrent Programs. Krzysztof R. Apt, Frank S. de Boer, Ernst-Rüdiger Olderog. Series: Texts in Computer Science. Springer. 3rd ed. 2nd Printing.

More information

Turing machines and linear bounded automata

Turing machines and linear bounded automata and linear bounded automata Informatics 2A: Lecture 30 John Longley School of Informatics University of Edinburgh jrl@inf.ed.ac.uk 25 November 2016 1 / 17 The Chomsky hierarchy: summary Level Language

More information

Verifying Properties of Parallel Programs: An Axiomatic Approach

Verifying Properties of Parallel Programs: An Axiomatic Approach Verifying Properties of Parallel Programs: An Axiomatic Approach By Susan Owicki and David Gries (1976) Nathan Wetzler nwetzler@cs.utexas.edu University of Texas, Austin November 3, 2009 Outline Introduction

More information

Introduction to Quantum Computing

Introduction to Quantum Computing Introduction to Quantum Computing Petros Wallden Lecture 3: Basic Quantum Mechanics 26th September 2016 School of Informatics, University of Edinburgh Resources 1. Quantum Computation and Quantum Information

More information

Floyd-Hoare Style Program Verification

Floyd-Hoare Style Program Verification Floyd-Hoare Style Program Verification Deepak D Souza Department of Computer Science and Automation Indian Institute of Science, Bangalore. 9 Feb 2017 Outline of this talk 1 Overview 2 Hoare Triples 3

More information

Probabilistic Guarded Commands Mechanized in HOL

Probabilistic Guarded Commands Mechanized in HOL Probabilistic Guarded Commands Mechanized in HOL Joe Hurd joe.hurd@comlab.ox.ac.uk Oxford University Joint work with Annabelle McIver (Macquarie University) and Carroll Morgan (University of New South

More information

ICS141: Discrete Mathematics for Computer Science I

ICS141: Discrete Mathematics for Computer Science I ICS141: Discrete Mathematics for Computer Science I Dept. Information & Computer Sci., Jan Stelovsky based on slides by Dr. Baek and Dr. Still Originals by Dr. M. P. Frank and Dr. J.L. Gross Provided by

More information

03 Review of First-Order Logic

03 Review of First-Order Logic CAS 734 Winter 2014 03 Review of First-Order Logic William M. Farmer Department of Computing and Software McMaster University 18 January 2014 What is First-Order Logic? First-order logic is the study of

More information

Deterministic Program The While Program

Deterministic Program The While Program Deterministic Program The While Program Shangping Ren Department of Computer Science Illinois Institute of Technology February 24, 2014 Shangping Ren Deterministic Program The While Program February 24,

More information

Spring 2015 Program Analysis and Verification. Lecture 4: Axiomatic Semantics I. Roman Manevich Ben-Gurion University

Spring 2015 Program Analysis and Verification. Lecture 4: Axiomatic Semantics I. Roman Manevich Ben-Gurion University Spring 2015 Program Analysis and Verification Lecture 4: Axiomatic Semantics I Roman Manevich Ben-Gurion University Agenda Basic concepts of correctness Axiomatic semantics (pages 175-183) Hoare Logic

More information

Design of Distributed Systems Melinda Tóth, Zoltán Horváth

Design of Distributed Systems Melinda Tóth, Zoltán Horváth Design of Distributed Systems Melinda Tóth, Zoltán Horváth Design of Distributed Systems Melinda Tóth, Zoltán Horváth Publication date 2014 Copyright 2014 Melinda Tóth, Zoltán Horváth Supported by TÁMOP-412A/1-11/1-2011-0052

More information

An Introduction to Modal Logic III

An Introduction to Modal Logic III An Introduction to Modal Logic III Soundness of Normal Modal Logics Marco Cerami Palacký University in Olomouc Department of Computer Science Olomouc, Czech Republic Olomouc, October 24 th 2013 Marco Cerami

More information

Abstract Semantics for a Simple Quantum Programming Language

Abstract Semantics for a Simple Quantum Programming Language Abstract Semantics for a Simple Quantum Programming Language Martin Churchill, Keble College, Oxford martin.churchill@keble.oxon.org Dissertation for the Degree of Master of Science in Mathematics and

More information

Discrete Mathematics

Discrete Mathematics Discrete Mathematics Yi Li Software School Fudan University March 13, 2017 Yi Li (Fudan University) Discrete Mathematics March 13, 2017 1 / 1 Review of Lattice Ideal Special Lattice Boolean Algebra Yi

More information

Informal Statement Calculus

Informal Statement Calculus FOUNDATIONS OF MATHEMATICS Branches of Logic 1. Theory of Computations (i.e. Recursion Theory). 2. Proof Theory. 3. Model Theory. 4. Set Theory. Informal Statement Calculus STATEMENTS AND CONNECTIVES Example

More information

Hoare Examples & Proof Theory. COS 441 Slides 11

Hoare Examples & Proof Theory. COS 441 Slides 11 Hoare Examples & Proof Theory COS 441 Slides 11 The last several lectures: Agenda Denotational semantics of formulae in Haskell Reasoning using Hoare Logic This lecture: Exercises A further introduction

More information

Coinductive big-step semantics and Hoare logics for nontermination

Coinductive big-step semantics and Hoare logics for nontermination Coinductive big-step semantics and Hoare logics for nontermination Tarmo Uustalu, Inst of Cybernetics, Tallinn joint work with Keiko Nakata COST Rich Models Toolkit meeting, Madrid, 17 18 October 2013

More information

Towards a quantum calculus

Towards a quantum calculus QPL 2006 Preliminary Version Towards a quantum calculus (work in progress, extended abstract) Philippe Jorrand 1 Simon Perdrix 2 Leibniz Laboratory IMAG-INPG Grenoble, France Abstract The aim of this paper

More information

Spring 2016 Program Analysis and Verification. Lecture 3: Axiomatic Semantics I. Roman Manevich Ben-Gurion University

Spring 2016 Program Analysis and Verification. Lecture 3: Axiomatic Semantics I. Roman Manevich Ben-Gurion University Spring 2016 Program Analysis and Verification Lecture 3: Axiomatic Semantics I Roman Manevich Ben-Gurion University Warm-up exercises 1. Define program state: 2. Define structural semantics configurations:

More information

First Order Logic vs Propositional Logic CS477 Formal Software Dev Methods

First Order Logic vs Propositional Logic CS477 Formal Software Dev Methods First Order Logic vs Propositional Logic CS477 Formal Software Dev Methods Elsa L Gunter 2112 SC, UIUC egunter@illinois.edu http://courses.engr.illinois.edu/cs477 Slides based in part on previous lectures

More information

COMP2111 Glossary. Kai Engelhardt. Contents. 1 Symbols. 1 Symbols 1. 2 Hoare Logic 3. 3 Refinement Calculus 5. rational numbers Q, real numbers R.

COMP2111 Glossary. Kai Engelhardt. Contents. 1 Symbols. 1 Symbols 1. 2 Hoare Logic 3. 3 Refinement Calculus 5. rational numbers Q, real numbers R. COMP2111 Glossary Kai Engelhardt Revision: 1.3, May 18, 2018 Contents 1 Symbols 1 2 Hoare Logic 3 3 Refinement Calculus 5 1 Symbols Booleans B = {false, true}, natural numbers N = {0, 1, 2,...}, integers

More information

Proof Rules for Correctness Triples

Proof Rules for Correctness Triples Proof Rules for Correctness Triples CS 536: Science of Programming, Fall 2018 A. Why? We can t generally prove that correctness triples are valid using truth tables. We need proof axioms for atomic statements

More information

Hoare Logic: Part II

Hoare Logic: Part II Hoare Logic: Part II COMP2600 Formal Methods for Software Engineering Jinbo Huang Australian National University COMP 2600 Hoare Logic II 1 Factorial {n 0} fact := 1; i := n; while (i >0) do fact := fact

More information

Hoare Calculus and Predicate Transformers

Hoare Calculus and Predicate Transformers Hoare Calculus and Predicate Transformers Wolfgang Schreiner Wolfgang.Schreiner@risc.uni-linz.ac.at Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria http://www.risc.uni-linz.ac.at

More information

Part II Logic and Set Theory

Part II Logic and Set Theory Part II Logic and Set Theory Theorems Based on lectures by I. B. Leader Notes taken by Dexter Chua Lent 2015 These notes are not endorsed by the lecturers, and I have modified them (often significantly)

More information

A Tutorial Introduction to CSP in Unifying Theories of Programming

A Tutorial Introduction to CSP in Unifying Theories of Programming A Tutorial Introduction to CSP in Unifying Theories of Programming Ana Cavalcanti and Jim Woodcock Department of Computer Science University of York Heslington, York YO10 5DD, UK {Ana.Cavalcanti,Jim.Woodcock}@cs.york.ac.uk

More information

Hoare Logic and Model Checking

Hoare Logic and Model Checking Hoare Logic and Model Checking Kasper Svendsen University of Cambridge CST Part II 2016/17 Acknowledgement: slides heavily based on previous versions by Mike Gordon and Alan Mycroft Introduction In the

More information

Warm-Up Problem. Please fill out your Teaching Evaluation Survey! Please comment on the warm-up problems if you haven t filled in your survey yet.

Warm-Up Problem. Please fill out your Teaching Evaluation Survey! Please comment on the warm-up problems if you haven t filled in your survey yet. Warm-Up Problem Please fill out your Teaching Evaluation Survey! Please comment on the warm-up problems if you haven t filled in your survey yet Warm up: Given a program that accepts input, is there an

More information

CSE 1400 Applied Discrete Mathematics Definitions

CSE 1400 Applied Discrete Mathematics Definitions CSE 1400 Applied Discrete Mathematics Definitions Department of Computer Sciences College of Engineering Florida Tech Fall 2011 Arithmetic 1 Alphabets, Strings, Languages, & Words 2 Number Systems 3 Machine

More information

Axiomatic Semantics: Verification Conditions. Review of Soundness of Axiomatic Semantics. Questions? Announcements

Axiomatic Semantics: Verification Conditions. Review of Soundness of Axiomatic Semantics. Questions? Announcements Axiomatic Semantics: Verification Conditions Meeting 18, CSCI 5535, Spring 2010 Announcements Homework 6 is due tonight Today s forum: papers on automated testing using symbolic execution Anyone looking

More information

1 Introduction. 2 First Order Logic. 3 SPL Syntax. 4 Hoare Logic. 5 Exercises

1 Introduction. 2 First Order Logic. 3 SPL Syntax. 4 Hoare Logic. 5 Exercises Contents 1 Introduction INF5140: Lecture 2 Espen H. Lian Institutt for informatikk, Universitetet i Oslo January 28, 2009 2 Proof System 3 SPL 4 GCD 5 Exercises Institutt for informatikk (UiO) INF5140:

More information

Probabilistic Bisimilarity as Testing Equivalence

Probabilistic Bisimilarity as Testing Equivalence Probabilistic Bisimilarity as Testing Equivalence Yuxin Deng a,, Yuan Feng b a Shanghai Key Laboratory of Trustworthy Computing, MOE International Joint Lab of Trustworthy Software, and International Research

More information

m + q = p + n p + s = r + q m + q + p + s = p + n + r + q. (m + s) + (p + q) = (r + n) + (p + q) m + s = r + n.

m + q = p + n p + s = r + q m + q + p + s = p + n + r + q. (m + s) + (p + q) = (r + n) + (p + q) m + s = r + n. 9 The Basic idea 1 = { 0, 1, 1, 2, 2, 3,..., n, n + 1,...} 5 = { 0, 5, 1, 6, 2, 7,..., n, n + 5,...} Definition 9.1. Let be the binary relation on ω ω defined by m, n p, q iff m + q = p + n. Theorem 9.2.

More information

Přednáška 12. Důkazové kalkuly Kalkul Hilbertova typu. 11/29/2006 Hilbertův kalkul 1

Přednáška 12. Důkazové kalkuly Kalkul Hilbertova typu. 11/29/2006 Hilbertův kalkul 1 Přednáška 12 Důkazové kalkuly Kalkul Hilbertova typu 11/29/2006 Hilbertův kalkul 1 Formal systems, Proof calculi A proof calculus (of a theory) is given by: A. a language B. a set of axioms C. a set of

More information

Introduction to Quantum Information Processing QIC 710 / CS 768 / PH 767 / CO 681 / AM 871

Introduction to Quantum Information Processing QIC 710 / CS 768 / PH 767 / CO 681 / AM 871 Introduction to Quantum Information Processing QIC 710 / CS 768 / PH 767 / CO 681 / AM 871 Lecture 9 (2017) Jon Yard QNC 3126 jyard@uwaterloo.ca http://math.uwaterloo.ca/~jyard/qic710 1 More state distinguishing

More information

CS 336. We use the principle of inclusion and exclusion. Let B. = {five digit decimal numbers ending with a 5}, and

CS 336. We use the principle of inclusion and exclusion. Let B. = {five digit decimal numbers ending with a 5}, and CS 336 1. The important issue is the logic you used to arrive at your answer. 2. Use extra paper to determine your solutions then neatly transcribe them onto these sheets. 3. Do not submit the scratch

More information

Turing machines and linear bounded automata

Turing machines and linear bounded automata and linear bounded automata Informatics 2A: Lecture 29 John Longley School of Informatics University of Edinburgh jrl@inf.ed.ac.uk 27 November 2015 1 / 15 The Chomsky hierarchy: summary Level Language

More information

Last Time. Inference Rules

Last Time. Inference Rules Last Time When program S executes it switches to a different state We need to express assertions on the states of the program S before and after its execution We can do it using a Hoare triple written

More information

Static Program Analysis

Static Program Analysis Static Program Analysis Lecture 16: Abstract Interpretation VI (Counterexample-Guided Abstraction Refinement) Thomas Noll Lehrstuhl für Informatik 2 (Software Modeling and Verification) noll@cs.rwth-aachen.de

More information

CHAPTER 6. Copyright Cengage Learning. All rights reserved.

CHAPTER 6. Copyright Cengage Learning. All rights reserved. CHAPTER 6 SET THEORY Copyright Cengage Learning. All rights reserved. SECTION 6.4 Boolean Algebras, Russell s Paradox, and the Halting Problem Copyright Cengage Learning. All rights reserved. Boolean Algebras,

More information

Strength; Weakest Preconditions

Strength; Weakest Preconditions 12/14: solved Strength; Weakest Preconditions CS 536: Science of Programming, Spring 2018 A. Why To combine correctness triples, we need to weaken and strengthen conditions. A weakest precondition is the

More information

Programming Languages

Programming Languages CSE 230: Winter 2008 Principles of Programming Languages Lecture 6: Axiomatic Semantics Deriv. Rules for Hoare Logic `{A} c {B} Rules for each language construct ` {A} c 1 {B} ` {B} c 2 {C} ` {A} skip

More information

Gerwin Klein, June Andronick, Ramana Kumar S2/2016

Gerwin Klein, June Andronick, Ramana Kumar S2/2016 COMP4161: Advanced Topics in Software Verification {} Gerwin Klein, June Andronick, Ramana Kumar S2/2016 data61.csiro.au Content Intro & motivation, getting started [1] Foundations & Principles Lambda

More information

Soundness and Completeness of Axiomatic Semantics

Soundness and Completeness of Axiomatic Semantics #1 Soundness and Completeness of Axiomatic Semantics #2 One-Slide Summary A system of axiomatic semantics is sound if everything we can prove is also true: if ` { A } c { B } then ² { A } c { B } We prove

More information

Intelligent Agents. Formal Characteristics of Planning. Ute Schmid. Cognitive Systems, Applied Computer Science, Bamberg University

Intelligent Agents. Formal Characteristics of Planning. Ute Schmid. Cognitive Systems, Applied Computer Science, Bamberg University Intelligent Agents Formal Characteristics of Planning Ute Schmid Cognitive Systems, Applied Computer Science, Bamberg University Extensions to the slides for chapter 3 of Dana Nau with contributions by

More information

SEMANTICS OF PROGRAMMING LANGUAGES Course Notes MC 308

SEMANTICS OF PROGRAMMING LANGUAGES Course Notes MC 308 University of Leicester SEMANTICS OF PROGRAMMING LANGUAGES Course Notes for MC 308 Dr. R. L. Crole Department of Mathematics and Computer Science Preface These notes are to accompany the module MC 308.

More information

1 Computational Problems

1 Computational Problems Stanford University CS254: Computational Complexity Handout 2 Luca Trevisan March 31, 2010 Last revised 4/29/2010 In this lecture we define NP, we state the P versus NP problem, we prove that its formulation

More information

Marie Farrell Supervisors: Dr Rosemary Monahan & Dr James Power Principles of Programming Research Group

Marie Farrell Supervisors: Dr Rosemary Monahan & Dr James Power Principles of Programming Research Group EXAMINING REFINEMENT: THEORY, TOOLS AND MATHEMATICS Marie Farrell Supervisors: Dr Rosemary Monahan & Dr James Power Principles of Programming Research Group PROBLEM Different formalisms do not integrate

More information

First-Order Logic. 1 Syntax. Domain of Discourse. FO Vocabulary. Terms

First-Order Logic. 1 Syntax. Domain of Discourse. FO Vocabulary. Terms First-Order Logic 1 Syntax Domain of Discourse The domain of discourse for first order logic is FO structures or models. A FO structure contains Relations Functions Constants (functions of arity 0) FO

More information

CSC 7101: Programming Language Structures 1. Axiomatic Semantics. Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11.

CSC 7101: Programming Language Structures 1. Axiomatic Semantics. Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11. Axiomatic Semantics Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11 1 Overview We ll develop proof rules, such as: { I b } S { I } { I } while b do S end { I b } That allow us to verify

More information

Quantum Computing Lecture 3. Principles of Quantum Mechanics. Anuj Dawar

Quantum Computing Lecture 3. Principles of Quantum Mechanics. Anuj Dawar Quantum Computing Lecture 3 Principles of Quantum Mechanics Anuj Dawar What is Quantum Mechanics? Quantum Mechanics is a framework for the development of physical theories. It is not itself a physical

More information

Notes for Lecture Notes 2

Notes for Lecture Notes 2 Stanford University CS254: Computational Complexity Notes 2 Luca Trevisan January 11, 2012 Notes for Lecture Notes 2 In this lecture we define NP, we state the P versus NP problem, we prove that its formulation

More information

CS156: The Calculus of Computation Zohar Manna Autumn 2008

CS156: The Calculus of Computation Zohar Manna Autumn 2008 Page 3 of 52 Page 4 of 52 CS156: The Calculus of Computation Zohar Manna Autumn 2008 Lecturer: Zohar Manna (manna@cs.stanford.edu) Office Hours: MW 12:30-1:00 at Gates 481 TAs: Boyu Wang (wangboyu@stanford.edu)

More information

6.896 Quantum Complexity Theory November 11, Lecture 20

6.896 Quantum Complexity Theory November 11, Lecture 20 6.896 Quantum Complexity Theory November, 2008 Lecturer: Scott Aaronson Lecture 20 Last Time In the previous lecture, we saw the result of Aaronson and Watrous that showed that in the presence of closed

More information

Program verification. 18 October 2017

Program verification. 18 October 2017 Program verification 18 October 2017 Example revisited // assume(n>2); void partition(int a[], int n) { int pivot = a[0]; int lo = 1, hi = n-1; while (lo

More information

Automata, Logic and Games: Theory and Application

Automata, Logic and Games: Theory and Application Automata, Logic and Games: Theory and Application 1. Büchi Automata and S1S Luke Ong University of Oxford TACL Summer School University of Salerno, 14-19 June 2015 Luke Ong Büchi Automata & S1S 14-19 June

More information

Propositional logic. First order logic. Alexander Clark. Autumn 2014

Propositional logic. First order logic. Alexander Clark. Autumn 2014 Propositional logic First order logic Alexander Clark Autumn 2014 Formal Logic Logical arguments are valid because of their form. Formal languages are devised to express exactly that relevant form and

More information

Program Analysis Part I : Sequential Programs

Program Analysis Part I : Sequential Programs Program Analysis Part I : Sequential Programs IN5170/IN9170 Models of concurrency Program Analysis, lecture 5 Fall 2018 26. 9. 2018 2 / 44 Program correctness Is my program correct? Central question for

More information

Introduction to Axiomatic Semantics

Introduction to Axiomatic Semantics #1 Introduction to Axiomatic Semantics #2 How s The Homework Going? Remember that you can t just define a meaning function in terms of itself you must use some fixed point machinery. #3 Observations A

More information

Weakest Precondition Calculus

Weakest Precondition Calculus Weakest Precondition Calculus COMP2600 Formal Methods for Software Engineering Rajeev Goré Australian National University Semester 2, 2016 (Most lecture slides due to Ranald Clouston) COMP 2600 Weakest

More information

Propositional and Predicate Logic - VII

Propositional and Predicate Logic - VII Propositional and Predicate Logic - VII Petr Gregor KTIML MFF UK WS 2015/2016 Petr Gregor (KTIML MFF UK) Propositional and Predicate Logic - VII WS 2015/2016 1 / 11 Theory Validity in a theory A theory

More information

On Coinduction and Quantum Lambda Calculi

On Coinduction and Quantum Lambda Calculi On Coinduction and Quantum Lambda Calculi Yuxin Deng East China Normal University (Joint work with Yuan Feng and Ugo Dal Lago) To appear at CONCUR 15 1 Outline Motivation A quantum λ-calculus Coinductive

More information

Formal Techniques for Software Engineering: Denotational Semantics

Formal Techniques for Software Engineering: Denotational Semantics Formal Techniques for Software Engineering: Denotational Semantics Rocco De Nicola IMT Institute for Advanced Studies, Lucca rocco.denicola@imtlucca.it May 2013 Lesson 4 R. De Nicola (IMT-Lucca) FoTSE@LMU

More information

CSE 311 Lecture 28: Undecidability of the Halting Problem. Emina Torlak and Kevin Zatloukal

CSE 311 Lecture 28: Undecidability of the Halting Problem. Emina Torlak and Kevin Zatloukal CSE 311 Lecture 28: Undecidability of the Halting Problem Emina Torlak and Kevin Zatloukal 1 Topics Final exam Logistics, format, and topics. Countability and uncomputability A quick recap of Lecture 27.

More information

Calculating axiomatic semantics from program equations by means of functional predicate calculus

Calculating axiomatic semantics from program equations by means of functional predicate calculus Calculating axiomatic semantics from program equations by means of functional predicate calculus (Some initial results of recent work not for dissemination) Raymond Boute INTEC Ghent University 2004/02

More information

CSCI3390-Lecture 6: An Undecidable Problem

CSCI3390-Lecture 6: An Undecidable Problem CSCI3390-Lecture 6: An Undecidable Problem September 21, 2018 1 Summary The language L T M recognized by the universal Turing machine is not decidable. Thus there is no algorithm that determines, yes or

More information

Axiomatic Semantics. Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11 CSE

Axiomatic Semantics. Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11 CSE Axiomatic Semantics Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11 CSE 6341 1 Outline Introduction What are axiomatic semantics? First-order logic & assertions about states Results (triples)

More information

Semantics and Verification of Software

Semantics and Verification of Software Semantics and Verification of Software Thomas Noll Software Modeling and Verification Group RWTH Aachen University http://moves.rwth-aachen.de/teaching/ws-1718/sv-sw/ Recap: The Denotational Approach Semantics

More information

Operational Semantics

Operational Semantics Operational Semantics Semantics and applications to verification Xavier Rival École Normale Supérieure Xavier Rival Operational Semantics 1 / 50 Program of this first lecture Operational semantics Mathematical

More information

Program verification. Hoare triples. Assertional semantics (cont) Example: Semantics of assignment. Assertional semantics of a program

Program verification. Hoare triples. Assertional semantics (cont) Example: Semantics of assignment. Assertional semantics of a program Program verification Assertional semantics of a program Meaning of a program: relation between its inputs and outputs; specified by input assertions (pre-conditions) and output assertions (post-conditions)

More information

Software Engineering

Software Engineering Software Engineering Lecture 07: Design by Contract Peter Thiemann University of Freiburg, Germany 02.06.2014 Table of Contents Design by Contract Contracts for Procedural Programs Contracts for Object-Oriented

More information

QPEL Quantum Program and Effect Language

QPEL Quantum Program and Effect Language QPEL Quantum Program and Effect Language QPL 2014 Kyoto Robin Adams r.adams@cs.ru.nl 5 June 2014 R Adams 5 June 2014 QPEL 1 / 32 Introduction QPEL (Quantum Program and Effect language) is a formal system

More information