makeTruthTable[header0_,vars_]:=Module[{data,header},
header=ToString[#,TraditionalForm]&/@header0;
data=BooleanTable[header0,vars]/.{True->"T", False->"F"};
Text@Grid[Prepend[data,header],Background->{None,{Lighter[Yellow,.9],{White,Lighter[Blend[{Blue,Green}],.8]}}},Dividers->{{Darker[Gray,.6],{Lighter[Gray,.5]},Darker[Gray,.6]},{Darker[Gray,.6],Darker[Gray,.6],{False},Darker[Gray,.6]}},ItemSize->Automatic]

]

makeTextTable[data0_]:=Module[{data},
data=Table[ToString[#,TraditionalForm]&/@(data0[[i]]),{i,1,Length[data0]}];

Text@Grid[data0,Background->{None,{Lighter[Yellow,.9],{White,Lighter[Blend[{Blue,Green}],.8]}}},Dividers->{{Darker[Gray,.6],{Lighter[Gray,.5]},Darker[Gray,.6]},{Darker[Gray,.6],Darker[Gray,.6],{False},Darker[Gray,.6]}},ItemSize->Automatic]

]

1.2.1. Statements involving variables

The sentence “x + 2 = 5” cannot be assigned a truth value and so it is technically not a statement. However, if we knew the value of x we could determine its truth value. We say that it is a statement involving a variable, namely x. If we allow x to have value 3 then we get a true statement whereas, if we let x have value 1 we get a false statement. Symbolically, we might represent the above statement as p(x). We see that p(3) is true while p(1) is false. Similarly, the statement xy = 4 could be represented symbolically as q(x,y) since it is a statement involving two variables. Again, to assign a truth value to q(x,y) we would have to know the values of both x and y. If x had value 2 and y had value 5 then q(2,5) would have truth value F. Note that q(2,2) has truth value T.

Another way to be able to assign truth values to statements involving variables is through the use of quantifiers. 

Definition 1.2.1.1. The universal quantifier, ∀ , in English means “For all possible values of the variable”.

Definition 1.2.1.2. The existential quantifier, ∃ , in English means “There is a value of the variable”. 

Thus, with the examples above, the following are statements: ∀ x, p(x); (Subscript[∃, x]) p(x). The first states that for all possible values of the variable x that x + 2 = 5. The second states that there is a value of x for which x + 2 = 5. Clearly, we have made each of these a statement (and we might believe the first to be false and the second to be true). The problem we are left with is what do we mean by the possible values of the variable? 

Definition 1.2.1.3. We assume that the variable in our statement may be replaced by a quantity from a set of known objects. This set of objects is called the universal set of discourse, or more briefly, the universal set.

Usually, this universal set will be understood from the context. However, if necessary, we shall define the universal set for each variable in the statement and write something like ∀ x∈U, p(x). Here, the notation x∈U translates into English as “x an element of the set U”. Note that for quantified statements involving more than one variable, the universal set for each variable may be different.

Alternatively, we may think about a statement involving variables as a statement about the universal set U. 

Definition 1.2.1.4. The truth set of the statement consists of those elements of U for which the statement is true. 

For example, if the universal set is the set of integers then the truth set of the statement “(x^2)=4” is -2,2 . A statement about U is a tautology if and only if its truth set is U and a contradiction if its truth set is the empty set. Thus a statement such as ∀ x∈U, p(x) is true if its truth set is U. If its truth set is a proper subset of U then it is a false statement. A statement of the form ∃ x∈U, p(x) is true if its truth set is non empty and false if its truth set is the empty set.

1.2.2. Negation of statements involving variables

Consider the statement ∀ x∈U, p(x) . If this statement is true then its truth set is U. Its negation must be false and have truth set the empty set. Alternatively, if the statement is false (i.e. its truth set is a proper subset of U) then its negation has to be true. We claim that the negation is the statement ∃ x∈U, ¬p(x) . Clearly this is the negation if the original statement is true. If the original is false then there must have been some x for which p(x) was false. We conclude that the statement  ¬(∀ x, p(x)) is equivalent to ∃ x, ¬p(x) . Similarly, ¬(∃ x, p(x)) is equivalent to ∀ x, ¬p(x) .

For statements involving more than one variable we have a similar situation. We give below a table of statements involving two quantifiers along with its negation.

data={{"Statement","Negation"},
{"\!\(\*FormBox[
RowBox[{"∀", 
RowBox[{"x", 
RowBox[{"∀", 
RowBox[{
StyleBox["y",
FontSlant->"Plain"], "    ", 
RowBox[{"p", 
StyleBox["(",
FontSlant->"Italic"], 
StyleBox[
RowBox[{"x", ",", "y"}],
FontSlant->"Italic"], 
StyleBox[")",
FontSlant->"Italic"]}]}]}]}]}],
TraditionalForm]\)","\!\(TraditionalForm\`∃ x \(∃ y\\ \\ \\ \(¬ p(x, y)\)\)\)"},
{"∀x ∃y   p(x,y)","\!\(TraditionalForm\`∃ x \(∀ y\\ \\ \\ \(¬ p(x, y)\)\)\)"},
{"∃x ∀y   p(x,y)","\!\(TraditionalForm\`∀ x \(∃ y\\ \\ \\ \(¬ p(x, y)\)\)\)"},
{"∃x ∃y   p(x,y)","∃x ∃y   ¬p(x,y)"}
};
makeTextTable[data]

1.2.2.a. Negation

We illustrate why the negation of ∃x∈X,∀y∈Y, p(x,y) is ∀x∈X,∃y∈Y,  ¬p(x,y)  using two sets X and Y, each having two elements. In the diagrams below, if p(x,y) is true we mark the square red and if it is false then we leave it white. There are of course 16 such diagrams.

Now consider the statement  ∃x∈X,∀y∈Y, p(x,y). For this to be true we must have one of the following diagrams. This is because for at least one fixed x and every element of Y the statement is true. Thus there must be at least one red row. 

Fig. 1.2.2.a.1.

GraphicsRow[{RegionPlot[x≥0 || y<0,{x,-2,2},{y,-2,2},Mesh->1,Frame->True,FrameLabel->{"Y","X"},ImageSize->120,FrameTicks->None,PlotStyle->Red,BoundaryStyle->None],
RegionPlot[y≥0 || y<0,{x,-2,2},{y,-2,2},Mesh->1,Frame->True,FrameLabel->{"Y","X"},ImageSize->120,FrameTicks->None,PlotStyle->Red,BoundaryStyle->None],
RegionPlot[x<0 || y<0,{x,-2,2},{y,-2,2},Mesh->1,Frame->True,FrameLabel->{"Y","X"},ImageSize->120,FrameTicks->None,PlotStyle->Red,BoundaryStyle->None],
RegionPlot[ y≤ 0,{x,-2,2},{y,-2,2}, Frame->True,FrameLabel->{"Y","X"},ImageSize->120,FrameTicks->None,PlotStyle->Red,BoundaryStyle->None],
RegionPlot[y≥0 || x<0,{x,-2,2},{y,-2,2},Mesh->1,Frame->True,FrameLabel->{"Y","X"},ImageSize->120,FrameTicks->None,PlotStyle->Red,BoundaryStyle->None],
RegionPlot[y≥0 ,{x,-2,2},{y,-2,2},Frame->True,FrameLabel->{"Y","X"},ImageSize->120,FrameTicks->None,PlotStyle->Red,BoundaryStyle->None],
RegionPlot[y≥0 || x≥0,{x,-2,2},{y,-2,2},Mesh->1,Frame->True,FrameLabel->{"Y","X"},ImageSize->120,FrameTicks->None,PlotStyle->Red,BoundaryStyle->None]}]

It is false for the remaining nine diagrams shown below (since no row is all red).

Fig. 1.2.2.a.2.

GraphicsRow[{RegionPlot[False,{x,-2,2},{y,-2,2},Mesh->1,Frame->True,FrameLabel->{"Y","X"},ImageSize->120,FrameTicks->None,PlotStyle->Red,BoundaryStyle->None],
RegionPlot[x≥ 0 && y≥  0,{x,-2,2},{y,-2,2},Frame->True,FrameLabel->{"Y","X"},ImageSize->120,FrameTicks->None,PlotStyle->Red,BoundaryStyle->None],
RegionPlot[(x≥ 0 && y≥  0)||(x< 0 && y<  0),{x,-2,2},{y,-2,2},Mesh->1,Frame->True,FrameLabel->{"Y","X"},ImageSize->120,FrameTicks->None,PlotStyle->Red,BoundaryStyle->None],
RegionPlot[x< 0 && y<  0,{x,-2,2},{y,-2,2}, Frame->True,FrameLabel->{"Y","X"},ImageSize->120,FrameTicks->None,PlotStyle->Red,BoundaryStyle->None],
RegionPlot[x≤ 0 && y≥ 0,{x,-2,2},{y,-2,2},Frame->True,FrameLabel->{"Y","X"},ImageSize->120,FrameTicks->None,PlotStyle->Red,BoundaryStyle->None],
RegionPlot[x≥0 ,{x,-2,2},{y,-2,2},Frame->True,FrameLabel->{"Y","X"},ImageSize->120,FrameTicks->None,PlotStyle->Red,BoundaryStyle->None],
RegionPlot[x≥ 0 && y<  0,{x,-2,2},{y,-2,2},Frame->True,FrameLabel->{"Y","X"},ImageSize->120,FrameTicks->None,PlotStyle->Red,BoundaryStyle->None],
RegionPlot[(x< 0 && y≥  0)||(x≥ 0 && y<  0),{x,-2,2},{y,-2,2},Frame->True,FrameLabel->{"Y","X"},ImageSize->120,FrameTicks->None,PlotStyle->Red,BoundaryStyle->None],
RegionPlot[x<0,{x,-2,2},{y,-2,2},Frame->True,FrameLabel->{"Y","X"},ImageSize->120,FrameTicks->None,PlotStyle->Red,BoundaryStyle->None]}]

The situation is reversed for the statement ∀x∈X,∃y∈Y,¬p(x,y) . In this case, the statement is true if there is no completely red row and false when there is.

1. Quantifiers and propositionals - examples

1. Let p(x) be “x ≥  2” and q(x) be “(x^2) - 3 > 0”. Then the statement:
	∀ x, ( p(x) ⇒ q(x) )
is true.

q=Plot[x^2 -3&&x≥2,{x,-8,8},AxesLabel->{"x","f(x)"},PlotLabel->"f(x) =\!\(TraditionalForm\`\(\(\\ \)\(\*SuperscriptBox[\(x\), \(2\)]\\  - \\ 3\)\)\)\n",PlotLegends->ToString[Style["-",Blue],TraditionalForm]<>"\!\(TraditionalForm\`\(\(\\ \)\(\*SuperscriptBox[\(x\), \(2\)]\\  - \\ 3\)\)\) > 0"];
q1=Plot[x^2 -3,{x,-8,8},AxesLabel->{"x","f(x)"},PlotStyle->{Red,Dashed},PlotLegends->ToString[Style["-",Red],TraditionalForm]<>"\!\(TraditionalForm\`\(\(\\ \)\(\*SuperscriptBox[\(x\), \(2\)]\\  - \\ 3\)\)\) "];
Show[q,q1]

2. Every student of Mathematics knows what Discrete Mathematics is. 

Let p(x) be “x knows what discrete Mathematics is”. Then we can rewrite it to:
	∀x, p(x)
where the universe of discours consists of all students of Mathematics.

3.Everyone has one good friend.
Let p(x,y) be the statement “y is a good friend of x”. Then the statement can be expressed as:
	∀x, ∃y, p(x,y)
	
4. The propositional function p(x) is given by “x > 0” and the universe of discourse for x is the set of integers. To create a propositional from  p, we may assign a value for x. For example:
	a) if x=-3, we get p(-3): “-3>0”, which is false
	b) if x=3, we get p(2): “2>0”, which is true.

g4=NumberLinePlot[{x<0,x>0},x,PlotLegends->"Expressions"]

5. Suppose p(x) is "x has fur" and the universe of discourse for x is the set of all animals. If x is a cat, p(x) is a true value. When x is alligator, p(x) is false

6. Suppose p(x) is " x + 2 = 2 x ", and the universe of discourse for x is the set {1,2,3}. Then:
	• ∀x, p(x) is the proposition "For every x in {1,2,3}, x+2 = 2x ". This proposition is false.
	∃x, p(x) is the propositiona "There exists x in {1,2,3} such that x+2 = 2 x". This propositional is true.
	
7. f(x): x is a fox.
    s(x): x is sly.
    t(x): x is trustworthy.
    
    and the universe of discourse for all three functions is the set of all animals.
    
    • Everything is a fox: 
     	∀x, f(x)
    • All foxes are sly: 
    	∀x, ( f(x) ⇒ s(x) )
    • If any fox is sly, then it is not trustworthy:
    	∀x, ( f(x) ∧ s(x) ⇒ ¬t(x) )  ⇔ ∃x, ( f(x) ∧ s(x) ∧ t(x) )
    	
8. If the universe of discourse is U = {1, 2, 3}, then
	• ∀x, p(x) ⇔ p(1) ∧ p(2) ∧ p(3)
	• ∃x, p(x) ⇔ p(1) ∨ p(2) ∨ p(3)

9. Suppose the universe of discourse U is the set of real numbers.
	• If p(x) is the predicate (x^2) > 0, then ∀x, p(x) is false, since p(0) is false.
	• If p(x) is the predicate (x^2) − 3x − 4 = 0, then ∃x, p(x) is true, since p(−1) is true.
	• If p(x) is the predicate (x^2) + x + 1 = 0, then ∃x, p(x) is false, since there are no real solutions to the equation (x^2) + x + 1 = 0.
	• If p(x) is the predicate "If x 6= 0, then x2 ≥ 1', then ∀x, p(x) is false, since p(0.5) is false.
	
10. Let p(x, y) be "xy = 1", the universe of discourse for x is the set of positive integers, and the universe of discourse for y is the set of real numbers.
	• ∀x, ∀y, p(x, y) may be read "For every positive integer x and for every real
number y, xy = 1". This proposition is false
	• ∀x, ∃y, p(x, y) may be read "For every positive integer x there is a real number
y such that xy = 1". This proposition is true.
	• ∃y, ∀x, p(x, y) may be read "There exists a real number y such that, for every
positive integer x, xy = 1." This proposition is false.

11. p(x, y) is "x is a citizen of y." q(x, y) is "x lives in y." The universe of discourse of x is the set of all people and the universe of discourse for y is the set of US states.
	• All people who live in Florida are citizens of Florida.
		∀x, ( q(x, Florida) ⇒ p(x, Florida) )
	• Every state has a citizen that does not live in that state.
		∀y, ∃x, ( P(x, y) ∧ ¬Q(x, y) )