Logical statement limiting number of variables that can be true at the same time

51 Views Asked by At

I am working on a homework assignment where I am forced to take a scenario and convert it into a logical statement.

The scenario I am working on involves 10 variables, where only 5 can be true at a time.

I have learned about both types of quantifiers, universal and existential, but how can I specify a particular number in a logical statement.

I am trying to write the following:

There exists 10 variables in a set, such that only 5 can be true at a given time.

How can I specify 5 in logic terms?

1

There are 1 best solutions below

0
On BEST ANSWER

As Nuclear Wang pointed out, the brute force way would simply be to OR together all 10 choose 5 ways to have 5 true variables and 5 false variables, where each way is expressed by ANDing and NOTing the correct variables together.

If you wish to use predicate logic with quantifiers however, you can make use of the standard expressions for exactly 10 of and exactly 5 of. I have written this below:

Exactly 10 members of in a set X:

\begin{align}\tag{1} \exists x_1,x_2,\dots,x_9,x_{10}\big(&(x_1\neq x_2\land\dots\land x_9\neq x_{10})\\ \land&(x_1\in X\land x_2\in X\land\dots\land x_9\in X\land x_{10}\in X)\\ \land&\forall y(y\in X\implies y=x_1\lor y=x_2\lor\dots\lor y=x_9\lor y=x_{10})\big) \end{align}

Exactly 5 members of in a set Z:

\begin{align}\tag{2} \exists z_1,z_2,\dots,z_4,z_5\big(&(z_1\neq z_2\land\dots\land z_4\neq z_5)\\ \land&(z_1\in Z\land z_2\in Z\land\dots\land z_4\in Z\land z_5\in Z)\\ \land&\forall y(y\in Z\implies y=z_1\lor y=z_2\lor\dots\lor y=z_4\lor y=z_5)\big) \end{align}

Only the members of $Z$ are true:

\begin{align}\tag{3} \forall p\big(T(p)\implies p\in Z\lor p\notin X\big) \end{align}

In $(3)$, $T(p)$ asserts that $p$ satisfies some truth condition. It could be that $p$ has a truth value of $1$, or that $p$ satisfies another condition, like being greater than 2.

You then need only assert that $Z\subset X$, and logical AND (1), (2), & (3) together. The set $Z$ will then consist of the $5$ true variables from the set $X$.

If you language does not support the $\in$ or $\subset$ operators, you can just treat them as a two place predicates, which are true when the operators returns true.