1. Homepage
  2. Homework
  3. CS 536: Science of Programming - HW 1: Propositional & Predicate Logic
This question has been solved

CS 536: Science of Programming - HW 1: Propositional & Predicate Logic

Engage in a Conversation
USIITIllinois Institute of Technology States Satisfaction State Updates spPropositional & Predicate Logic

Logic Review CourseNana.COM

CS 536: Science of Programming, Fall 2023 CourseNana.COM

New due date: Fri Jan 27, 11:59 pm Due Wed Jan 25, 11:59 pm CourseNana.COM

ver. Mon 2023-01-23, 19:40; p.3; 01-26: p.2 CourseNana.COM

A. Why? CourseNana.COM

We use propositions and predicates to write program specifications.
Propositions and predicates can be related or manipulated syntactically or semantically.
CourseNana.COM

B. Objectives CourseNana.COM

At the end of this homework, you should be able to
Perform various syntactic operations and checks on propositions and predicates. Describe the difference between syntactic and semantic equivalence.
Form proofs of propositions using some standard proof rules.
Design predicate functions for simple properties on values and arrays.
CourseNana.COM

C. Problems [60 points total] CourseNana.COM

Quantified variables range over Z unless otherwise specified. CourseNana.COM

  1. [8=4*2 points] Which of the following mean(s) p q and which mean q p ?
    1. p is sufficient for q
    2. ponlyifq
    3. pifq
    4. p is necessary for q
  2. [4=2*2 points] Let e1 and e2 be expressions.
    1. In general, does e1 ≠ e2 imply e1 ≢ e2? If yes, briefly justify (a sentence or two is fine); if no,

give a counterexample (specific values for e1 and e2 that show that this implication does not always hold). CourseNana.COM

    1. In general, does e1 = e2 imply e1 ≡ e2,? Again give a brief justification or counterexample.
  1.  [6=3*2 points] For each pair below, characterize the state as well- or ill-formed; if well- formed, is it proper? If proper, does the given expression evaluate successfully or cause a runtime error (and if so, how?)
    1. {v=5, z=6} andv+0*w
    2. {v=–4, w=6} and sqrt(v)*sqrt(w)
    3. {y=18, z=2} and y*y/(z+4)
  2. [6points] Thegoalistoshowthatp¬(qr)qr¬p isatautologybyprovingitisT. To do this, complete the proof of equivalence below using (only) the propositional logic rules (from Class 2). Be sure to include the names of the rules. There's more than one correct answer [just give one of them].

p¬(qr)q r¬p [2023-01-26]
[you fill in] Defn [you fill in] Defn [and so on] CourseNana.COM

  1. [6points] Simplify¬(x.(y.x≤y)∨∀z.x≥z) toapredicatethathasnousesof¬. Presenta proof of equivalence. Use DeMorgan's laws for quantified predicates: ¬ u . r u . ¬ r and ¬u.r u.¬r. [2023-01-12]. Also use rules like "¬(e1≤e2) e1>e2 by negation of comparison".
  2. [4=2*2 points] What is the full parenthesization of
    1. p¬rs¬qr¬p↔¬st ?
    2. m.0<m<n∧∃j.0≤j<mb[0]≤b[j]≤b[m] *
  3. [4=2*2 points] Give the minimal parenthesization of each of the following by showing what remains after removing all redundant parentheses. Hint: To avoid getting confused about which parentheses match each other, try rewriting the given parentheses with subscripts: (1 and )1 versus (2 and )2 and so on.
    1. ((¬(pq)r)(((¬q)r)((p(¬r))(qs))))
    2. (j.(((0≤j)(j<m))(k.(((m≤k)(k<n))(b[j]<b[k]))))). (Thispredicateasks

“Is there a value in b[0..m-1] < every value in b[m..n-1]?) CourseNana.COM

    1. (x.((y.(pq))(z.(p(qr)))))

 [10 points total] Say whether the given propositions or predicates are ≡ or ≢. Briefly justify your answer. CourseNana.COM

    1. [2points] Isx.py.qr≡((x.p)(y.q))r ?
    2. [3points] Isx.p∧∃y.(qr)∨∃z.rs≡x.p(y.qr)(z.rs) ?
    3. [3 points] Is(x.p∨∀y.q)(z.r)s≡x.p(y.q)∨∀z.rs ?
    4. [2points] Ispq¬r¬pq≡((pq)((¬r((¬p)q)))) ?
  1. [6=3*2 points] Say whether each of the following is a tautology, contradiction, or contingency. If it's a contingency, show an instance when the proposition is true and show an instance where it's false.
    a. ((p
    q)r)(p(qr)).

b. (p(qr))((pq)r)
c. (xZ.yZ.f(x,y)>0)(xZ. yZ.f(x,y)>0).
[2023-01-12] Use DeMorgan's laws for quantified predicates: ¬
u.r u.¬r and ¬u.r u.¬r. CourseNana.COM

10. [6 points] Write the definition of a predicate function GT ( b , x , m , k ) that yields true iff x>b[m],... b[k]. E.g., in the state {b=(1,3,-2,8,5)}, GT(b,4,0,2) is true [2023-01-23: 2, not 3]; GT(b,0,1,2) is false. You can assume without testing that the indexes m,... k are all in range. If k<m, the sequence b[m],b[m+1],...,b[k] is empty and GT(b,x,m,k) is true. (It's straightforward to write GT so that this is not a special case.)
Remember, this has to be a predicate function, not a program that calculates a boolean value. Hint: Check the discussion in the Class 2 notes about trying to translate programs to predicates.
CourseNana.COM

  CourseNana.COM

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
US代写,IIT代写,Illinois Institute of Technology 代写, States Satisfaction代写, State Updates代写, sp代写,Propositional & Predicate Logic代写,US代编,IIT代编,Illinois Institute of Technology 代编, States Satisfaction代编, State Updates代编, sp代编,Propositional & Predicate Logic代编,US代考,IIT代考,Illinois Institute of Technology 代考, States Satisfaction代考, State Updates代考, sp代考,Propositional & Predicate Logic代考,UShelp,IIThelp,Illinois Institute of Technology help, States Satisfactionhelp, State Updateshelp, sphelp,Propositional & Predicate Logichelp,US作业代写,IIT作业代写,Illinois Institute of Technology 作业代写, States Satisfaction作业代写, State Updates作业代写, sp作业代写,Propositional & Predicate Logic作业代写,US编程代写,IIT编程代写,Illinois Institute of Technology 编程代写, States Satisfaction编程代写, State Updates编程代写, sp编程代写,Propositional & Predicate Logic编程代写,USprogramming help,IITprogramming help,Illinois Institute of Technology programming help, States Satisfactionprogramming help, State Updatesprogramming help, spprogramming help,Propositional & Predicate Logicprogramming help,USassignment help,IITassignment help,Illinois Institute of Technology assignment help, States Satisfactionassignment help, State Updatesassignment help, spassignment help,Propositional & Predicate Logicassignment help,USsolution,IITsolution,Illinois Institute of Technology solution, States Satisfactionsolution, State Updatessolution, spsolution,Propositional & Predicate Logicsolution,