**Predicate Logic** represents the internal structure of simple proposition. It shifts the focus from the logical relations that hold between sentences to those within sentences. **Propositional Logic** we have discussed earlier. It treats propositions as identical or totally different (* T* or

*). But it can be the case that two propositions are*

**F****partially different**.

* For example: p* =

**All**boys wear the uniform.

*=*

**q****Some**boys wear the uniform. These twos are different from quantification,

*, and*

**all***, which is an issue here. Since there is no way of expressing quantification in*

**some****propositional logic**, therefore it is not possible to point out differences between these two propositions. Therefore to handle such propositions we need

**Predicate Logic**and

**Quantifiers**.

Intuition:APropositionmust have a truth value (TorF), on the other hand anstatementis just a sentence, we don’t care about its truth value. Butstatementexpressespropositionwhen the distinction is made.Difference between Proposition and Statement

## Predicate Logic | Also First-Order Logic

Statements involving variables, such as: “* x>5*,” “

*,” “*

**x=y+5***” and “*

**x+y=z***,” or “*

**engine ‘x’ is not functioning properly***” are often found in mathematical assertion, in computer program. also in system specification. These statements are neither*

**room x has an intruder***nor*

**True***without specific values of the variables. In above statement*

**False****“x is greater than 5”**has two parts. First part the variable

*, is the subject of the statement. The second part*

**x****“is greater than 5”**is the

*. So,*

**predicate***. Therefore we can say that predicate depends on*

**predicate refers to the property that the subject can have***, or*

**x****Predicate is the function of subject(s)**. This relationship also refers to as

*.*

**Predication**If we denote the predicate with * P*, then the statements will be

**P (***. -where*

**x)***is the*

**x****subject**of the statement. If an statement has two variables, such as “John Loves Jane,” or “x Loves y.” We can denote such statement as

*(*

**L***,*

**x***), where*

**y***is the predicate, and*

**L***,*

**x***variables. In such predication we also can say that*

**y***is a two place predicate, that contain two arguments*

**L***, and*

**x***.*

**y**The statement * P* (

*), or*

**x***(*

**L***,*

**x***) also said to be*

**y****the value**of the

*,*

**propositional function***at*

**P***, or*

**x***at*

**L***,*

**x***. Once we assign the value to the variable, the statement [*

**y***(*

**P***), or*

**x***(*

**L***,*

**x***)] becomes a proposition and has a*

**y***value.*

**Truth****Example:** Let **P** (**x**) denotes the statement “**x>5**.” What are the truth value of **P**(**7**) and **P**(**3**)?

**Example:**

**P**

**x**

**x>5**

**P**

**7**

**P**

**3**

* Solution:* Putting the value x=7 we obtain, 7>5, which is true. Hence the statement

*(7) is*

**P***. However, for*

**True***(3), putting x=3 we obtain 3>5, which is false. Therefore the statement*

**P***(3) is*

**P***.*

**False****Another Example:** Let Q (x, y) denotes the statement “x=y+5.” What are the truth value of the proposition, Q (1, 3) and Q (7, 2)?

**Another Example:**

** Solution:** To obtain Q (1, 3) we set x=1, and y=3 in the statement “x=y+5,” that gives “1=3+5” which is false. So the statement Q (1, 3) is

*. Again, the statement Q (7, 2) gives “7=2+5,” which is true. Therefore the statement Q (7, 2) is*

**False***.*

**True**Consider the statement, if * x>0 then x=x+1*. When this kind of statement a program encounter, the value of the variable

*at that point is inserted into*

**x***(*

**P***), which is “x>0”. If*

**x***is true for this value of*

**P***, program will execute the assignment statement. So program will increase the value of*

**x***by 1. If*

**x***(*

**P***) is false, program will not execute the assignment statement.*

**x****Predicate Logic** are also useful for verification that computer program produce the desired output for valid input. The statements that describe valid input are **preconditions**. Also the conditions that the output should satisfy are **postconditions**. We use predicate logic to describe both preconditions and postconditions.

### The swap program

Consider the following common program, designed to interchange the values of two variables * x* and

*.*

**y****temp = x; ****x=y; ****y=temp;**

in this program we use * predicates* as

*and*

**precondition***to verify the correctness of the program.*

**postcondition**For **precondition**, we need to have * x* and

*particular values before run the program. So, for this precondition, we use predicate*

**y***(*

**P***,*

**x***), where*

**y***(*

**P***,*

**x***) indicates the statements “*

**y***and*

**x=a***“.*

**y=b***and*

**a***are the values of*

**b***,*

**x***before run the program. Because we want to verify that our program swaps the values of*

**y***and*

**x***for all input values, therefore we also need predicate logic for*

**y***. So, we use*

**postcondition***(*

**Q***,*

**x***), where*

**y***(*

**Q***,*

**x***) is the statement “*

**y***and*

**x=b***.”*

**y=a**//end of general discussion on Predicate Logic. Next we will discuss about Quantifiers **here>>**