# Logic involving knowing when a form is ready to be submitted

#### find_the_fun

##### Active member
I am creating a form using IBM Form Experience Builder. I want to create a survey as follows (content in [] denotes possible answers)

1. Do you still require a specified asset? [yes/no/I'm not the owner]
2. Do you know who the owner is? [yes/no]
3. Specify: []

Survey is complete

The questions are dynamic in the sense not all of them are shown, for example if the answer to 1. is yes 2. and 3. are hidden. The problem is creating a rule for displaying “Survey complete”. I can have an arbitrary number of rules but the relationship between them has to be all “logical or” or all “logical and”. I can specify if the message is hidden if conditions to 1., 2., 3. are met or are not met. I can't think of a way to do this but I remember learning in a math course that all logical operations can be derived from “and and not” or “or and not” which leads me to believe there is a way. Each rule can apply if a particular answer to a given question is given, or if no answer to a particular question is given (e.g. the user hasn't answered 1. yet so the rule to hide the message should apply)

#### Ackbach

##### Indicium Physicus
Staff member
Re: logic involving knowing when a form is ready to be submited

Evgeny is your man here, but I'll just say that you have to have a method of negation, or you cannot express everything. AND and OR together are incomplete. As you mentioned, NAND and NOR are complete. It looks like you have the ability to negate, since whether your "Survey Complete" message appears can be dependent on whether a condition is or is not met.

So it seems to me that your question is this: given that from one question to the next, you have to use only AND and OR, how do you express the logic that either displays or does not display the "Survey Complete" message. Am I right?

If so, could you give us the logical expression that seems natural to you? Then maybe we can translate it into something that IBM Form Experience Builder recognizes.

#### find_the_fun

##### Active member
Re: logic involving knowing when a form is ready to be submited

So it seems to me that your question is this: given that from one question to the next, you have to use only AND and OR, how do you express the logic that either displays or does not display the "Survey Complete" message. Am I right?
My interpretation of the situation is only (AND and NOT) or (OR and NOT) can be used. I say this because a rule is matched if a given condition is met or is not met, so that's negation. There can be either an AND or OR relation between all rules (e.g. a AND b AND c or a OR b OR c but not a OR b AND c). But the rest of your understanding is correct.

This is what I'd like to do but Forms Experience Builder only lets me use all $$\displaystyle \vee$$ or $$\displaystyle \wedge$$.

if
(1. matches yes $$\displaystyle \vee$$ 1. matches no) $$\displaystyle \vee$$ (1. matches I'm not owner $$\displaystyle \wedge$$ 2. matches no) $$\displaystyle \vee$$ (1. matches I'm not owner $$\displaystyle \wedge$$ 2. matches yes $$\displaystyle \wedge$$ 3. [user filled in name])
then display message

#### Evgeny.Makarov

##### Well-known member
MHB Math Scholar
Re: logic involving knowing when a form is ready to be submited

It is true that OR and AND alone are incomplete, but at least in the case of yes/no questions we have negation at the atomic level. That is, the rule that checks whether an answer to some question is "no" is the negation of the rule that checks whether an answer to that question is "yes". Every Boolean function can be expressed by a formula where negations apply to variables only (not to compound formulas built from OR or AND).

There can be either an AND or OR relation between all rules (e.g. a AND b AND c or a OR b OR c but not a OR b AND c).
This seems to be a more serious restriction. If atomic rules (the answer to some question matches, or possibly does not match, a certain answer) can be combined either only by ORs or only by ANDs, then not all Boolean functions can be expressed. Out of two-argument functions, it seems that only $p\leftrightarrow q$ and $p\oplus q$ (which are true iff the truth values of $p$ and $q$ are equal and, respectively, not equal) cannot be expressed. E.g., $p\leftrightarrow q=(p\land q)\lor(\neg p\land\neg q)$, so there are conjunctions under a disjunction. I would expect that the share of functions that cannot be expressed rises with the number of arguments.

if
(1. matches yes $$\displaystyle \vee$$ 1. matches no) $$\displaystyle \vee$$ (1. matches I'm not owner $$\displaystyle \wedge$$ 2. matches no) $$\displaystyle \vee$$ (1. matches I'm not owner $$\displaystyle \wedge$$ 2. matches yes $$\displaystyle \wedge$$ 3. [user filled in name])
then display message
I don't see how this can be expressed without nesting AND inside OR.

#### find_the_fun

##### Active member
Re: logic involving knowing when a form is ready to be submited

It is true that OR and AND alone are incomplete, but at least in the case of yes/no questions we have negation at the atomic level. That is, the rule that checks whether an answer to some question is "no" is the negation of the rule that checks whether an answer to that question is "yes". Every Boolean function can be expressed by a formula where negations apply to variables only (not to compound formulas built from OR or AND).

This seems to be a more serious restriction. If atomic rules (the answer to some question matches, or possibly does not match, a certain answer) can be combined either only by ORs or only by ANDs, then not all Boolean functions can be expressed. Out of two-argument functions, it seems that only $p\leftrightarrow q$ and $p\oplus q$ (which are true iff the truth values of $p$ and $q$ are equal and, respectively, not equal) cannot be expressed. E.g., $p\leftrightarrow q=(p\land q)\lor(\neg p\land\neg q)$, so there are conjunctions under a disjunction. I would expect that the share of functions that cannot be expressed rises with the number of arguments.

I don't see how this can be expressed without nesting AND inside OR.
Ok thanks. It is very possible that what I'm asking for is impossible to do, I wanted to confirm it before giving up on this approach.