1
$\begingroup$

Here is my question:


The goal of this problem is to translate some assertions about binary strings into logic notation. The domain of discourse is the set of all finite-length binary strings: λ, 0, 1, 00, 01, 10, 11, 000, 001, .... (Here λ denotes the empty string.) In your translations, you may use all the ordinary logic symbols (including =), variables, and the binary symbols 0, 1 denoting 0, 1. A string like 01x0y of binary symbols and variables denotes the concatenation of the symbols and the binary strings represented by the variables. For example, if the value of x is 011 and the value of y is 1111, then the value of 01x0y is the binary string 0101101111. Here are some examples of formulas and their English translations. Names for these predicates are listed in the third column so that you can reuse them in your solutions (as we do in the definition of the predicate NO -1 S below). Table

(a) x consists of three copies of some string.

(b) x is an even-length string of 0’s.

(c) x does not contain both a 0 and a 1.


So far, this is what I have come up with.

For a, I was able to come up with ∀y (yyy = x) meaning for all y, there is an x where it is equivalent to 3 y's.

For b, my best guess is ∀x (NOT(SUBSTRING(1,x)) * 2) where I think I'm saying for all x, there is a string x that has no 1's and is an even number.

For c, I have ∀x(NO-1s(x) V NO-0s(x)) where its says for all x, it either has no 1's or no 0's.

Please let me know if I'm doing this correct at all

1 Answers 1

1

For a, there is only one $y$ that is a third of $x$, so it should be $\exists$ instead of $\forall$. For b, I doubt $*2$ is part of your language. Also you don't need the quantifier for $x$. You are trying to write a predicate for $x$, so $x$ should not be bound. You should just combine the NOT(SUBSTRING) to get the all zeros with the fact that you can split $x$ into two identical substrings, then use the idea from a. For c see the remark in b about binding $x$