Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
Homework (Week 1) Term 2, 2022 Announcements Course Outline Course Schedule Ed Forum Glossary Maths Resources Moodle - Lecture Recordings TeX Guide Assignment 0 Spec Web Submission Java Resources Monitors Video Multithreading Video Semaphores Video Volatile Video Web Tutorials Week 1 Friday Notes Friday Slides Homework Wednesday Code and Notes Wednesday Slides Week 2 Friday Code and Notes Friday Slides Homework More LTL notes Wednesday Code and Notes Homework (Week 1) Table of Contents 1. Circularity (1 mark) 2. Dining Cryptographers (2 marks) 3. Safety and Liveness (5 marks) 3.1. Limit closures 3.2. Alpern and Schneider's theorem 3.3. Bonus Question 4. Temporal Logic (5 marks) 4.1. Examples 4.2. Proof 5. General remark Submission: Due on Friday, 10th of June, 11am Sydney Time. Please submit using the CSE Give System either online or via this command on a CSE terminal: give cs3151 hw1 hw1.pdf Please put all your answers in one PDF file called hw1.pdf. Use of LaTeX is encouraged but not required. Please make your answers as concise as possible. This homework should not be more than two pages. Late submissions are accepted up to five days after the deadline, but at a penalty: 5% off your total mark per day at no penalty. 1 Circularity (1 mark) What is the answer to this question? Hint: You will find the answer to this question on Ed. If you can't access Ed yet, see the Announcements page for instructions. 2 Dining Cryptographers (2 marks) Assume the setting described in the first lecture for the problem of the Dining Cryptographers. Suppose we modify the protocol so that paying cryptographers now tell the truth about whether the coin tosses are different or equal. Instead, they will lie about whether they got head or tails. At the end, do we still know if the NSA paid or not? Is confidentiality still preserved? Briefly explain why or why not. 3 Safety and Liveness (5 marks) 3.1 Limit closures Let \(s\) be a state, and let \(s^\omega\) denote the behaviour \(s s s s s s s s s s s s \dots\) (i.e. infinitely many repetitions of \(s\).) Give an example of a set \(A\) such that \(s^\omega \in \overline{A}\), but \(s^\omega \notin A\). 3.2 Alpern and Schneider's theorem Let \(\Sigma = \{a,b\}\). That is, we assume there are only two states, \(a\) and \(b\). Consider the property \(P = \{\sigma | \sigma \mbox{ contains exactly one } b\}\). Use Alpern and Schneider's theorem to decompose \(P\) into a safety property \(P_S\) and a liveness property \(P_L\). Simplify them; that is, don't just say \(P_L = \Sigma^\omega \backslash (\overline{P} \backslash P)\) but give something that explains what \(P_L\) is. Assume \(P\) is a safety property. Prove that \(\Sigma^\omega \backslash (\overline{P} \backslash P) = \Sigma^\omega\) using the algebraic laws of set operations. Is the empty property \(\emptyset\) a liveness property? Is it a safety property? Explain. 3.3 Bonus Question This question is not for marks, but for a meaningless brownie point Assuming there are at least two distinct states \(a\) and \(b\), prove that any property \(P\) is the intersection of two liveness properties. Hint: It is helpful to note that the union of a dense set and any set is itself dense. 4 Temporal Logic (5 marks) 4.1 Examples Define suitable predicate symbols and give LTL formalisations for the following properties: Once the dragon was slain, the princess lived happily ever after. The dragon was never slain, but the princess lived happily until she didn't. The dragon was slain at least twice. The dragon was slain at most once. Whenever the dragon was slain, the princess did not live happily. 4.2 Proof Prove the following logical statements: \begin{array}{rcl} \Box\Box \varphi & \Leftrightarrow & \Box \varphi \\ \Diamond\bigcirc \varphi & \Leftrightarrow & \bigcirc \Diamond \varphi \\ % \Diamond\Diamond \varphi & \Leftrightarrow & \Diamond \varphi \\ \Box \varphi & \Rightarrow & \Diamond \varphi \\ % \Diamond\Box \varphi & \Rightarrow & \Box\Diamond \varphi \\ % \Diamond\Box\Diamond\varphi & \Leftrightarrow & \Box\Diamond\varphi \\ % \Box\Diamond\Box\varphi & \Leftrightarrow & \Diamond\Box\varphi \\ \end{array} It may help to use these semantic definitions for \(\Box\) and \(\Diamond\) (derivable from the definition in terms of \(\mathcal{U}\)): \begin{array}{rcl} \sigma \models \Diamond\varphi & \text{iff} & \exists i \geq 0.\ (\sigma|_i \models \varphi) \\ \sigma \models \Box\varphi & \text{iff} & \forall i \geq 0.\ (\sigma|_i \models \varphi) \end{array} You may use previously proven identities (both in this question and in lectures) to prove new ones. Note that two temporal logic formulas \(\phi\) and \(\psi\) are logically equivalent, written \(\varphi \Leftrightarrow \psi\), iff for all behaviours \(\sigma\) it holds that: \[ \sigma \models \varphi \mbox{ if and only if } \sigma \models \psi \] 5 General remark For any proofs you submit: feel free to use any well-known laws about propositional logic, predicate logic or set theory without proof (e.g., the de Morgan laws). We're not reinventing that particular wheel in this course. If you do want to reinvent it, you can take COMP2111 :) 2022-06-12 Sun 17:10 Announcements RSS