CSE541
EXERCISE 3
SOLUTIONS
Reminder: We dene H semantics operations and as follows a b = maxcfw_a, b, a b = mincfw_a, b.
The Truth Tables for Implication and Negation are: H-Implication F T F T F F T T T T T T
H Negation F T F T F
QUESTION 1 is such that
CSE541
Practice Midterm 2 SOLUTIONS
Spring 2015
QUESTION 1
Remark This problem is taken straight from the BOOK and your exercises solutions! I write the
solution to spare your time!
Let S = (Lcfw_, , A1, A2, A3, M P ) be a proof system with the following
CSE541
Midterm 2
SOLUTIONS
Spring 2015
QUESTION 1
Remark This question is designed to check if you understand the notion of completeness, monotonicity, application of Deduction Theorem and use of some basic tautologies.
Consider any proof system S,
S = (L
1
Finite Automata and Regular Expressions (20 points)
(a) (10 points) Draw a 4-state DFA over the alphabet = cfw_a, b that accepts the language
consisting of strings with an even number of a (this includes zero a), or an odd number of b.
Solution:
(b) Con
CSE541
Practice Midterm 1 SOLUTIONS
Spring 2015
QUESTION 1
Write the following natural language statement:
One likes to play bridge, or from the fact that the weather is good we conclude
the following: one does not like to play bridge or one likes not to
CS 164 Programming Languages and Compilers Handout 21
1. Regular Expressions (20 points)
a Man 0 eratin s stems re uire user asswords conform to certain rules to reduce the odds
y p g y q p
that an attacker can guess a password. Consider the following rul
cfw_b,d,e
cfw_a,b,d,e
cfw_a,b,c,d,e
cfw_b,c,d,e,f
a
c
f
f
:= load 0(b)
:= load 0(d)
:= 2 * a
< c
cfw_b,c,d,e,f
cfw_b,d,e,f
cfw_b,c,d,e
e := e + f
e := e + c
cfw_b,d,e
cfw_b,d,e
cfw_b,d,e
cfw_b,d,e
cfw_b,d,e
cfw_b,d,e
b := b + 4
d := d - 4
b = d
cfw_ e
a
CSE541
EXERCISE 12
Chapters 10, 11, 12 Read and learn all examples and exercises in the chapters as well! QUESTION 1 Let GL be the Gentzen style proof system for classical logic dened in chapter 11. Prove, by constructing a proper decomposition tree that
CSE541
EXERCISE 11 SOLUTIONS
Chapters 10, 11, 12 Read and learn all examples and exercises in the chapters as well! QUESTION 1 Use the (complete) proof system GL from chapter 11 to prove that |= (a b) (a b). Solution By completeness theorem for GL we have
CSE541
Exercise 2
SOLUTIONS
QUESTION 1 Give a denition and an example of a default reasoning. Default reasoning is a reasoning in which it is allowed to draw plausible inferences from less-thenconclusive evidence in the absence of information to the contr
1
Local Optimizations (20 points)
All operations in this question are on integer values. You may ignore arithmetic overow issues.
a) Apply common sub-expression elimination to the basic block below and write the nal version
of the changed instructions in
a-x
4x
e
5 points 1. The following five functions
T
x
lnx
where 1.5
a'
e*
< a 12,
-x
2
I
are plotted at right.
X
Label each function in the graph.
Nrfir
: ax *P
z-'x v'je
-2
rzfl L>fh1s "rt 'c4 o"fu
a-t-t f-Lu q- ^Ytq,
',a'
o'da-*' f^-tfe' fhe^,! t so : e