Mathematics Discrete Mathematics Predicate Logic | First-Order Logic | Discrete Mathematics |...

# Predicate Logic | First-Order Logic | Discrete Mathematics | CS School

-

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 F). But it can be the case that two propositions are partially different.

For example: p = All boys wear the uniform. q = Some boys wear the uniform. These twos are different from quantification, all, and some, which is an issue here. Since there is no way of expressing quantification in 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: A Proposition must have a truth value (T or ), on the other hand an statement is just a sentence, we don’t care about its truth value. But statement expresses proposition when 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,” “x+y=z” and “engine ‘x’ is not functioning properly,” or “room x has an intruder” are often found in mathematical assertion, in computer program. also in system specification. These statements are neither True nor False without specific values of the variables. In above statement “x is greater than 5” has two parts. First part the variable x, is the subject of the statement.  The second part “is greater than 5” is the predicate. So, predicate refers to the property that the subject can have. Therefore we can say that predicate depends on x, or 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 (x). -where x is the 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, y), where L is the predicate, and x, y variables. In such predication we also can say that L is a two place predicate, that contain two arguments x, and y.

The statement P (x), or L (x,y) also said to be the value of the propositional function, P at x, or L at x, y. Once we assign the value to the variable, the statement [P (x), or L(x, y)] becomes a proposition and has a Truth value.

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

Solution: Putting the value x=7 we obtain, 7>5, which is true. Hence the statement P (7) is True. However, for P (3), putting x=3 we obtain 3>5, which is false. Therefore the statement P (3) is 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)?

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 False. Again, the statement Q (7, 2) gives “7=2+5,” which is true. Therefore the statement Q (7, 2) is True.

Consider the statement, if x>0 then x=x+1. When this kind of statement a program encounter, the value of the variable x at that point is inserted into (x), which is “x>0”. If P is true for this value of x, program will execute the assignment statement. So program will increase the value of x by 1. If P (x) is false, program will not execute the assignment statement.

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 precondition and postcondition to verify the correctness of the program.

For precondition, we need to have x and y particular values before run the program. So, for this precondition, we use predicate P (x, y), where P (x, y) indicates the statements “x=a and y=b“. a and b are the values of x, y before run the program. Because we want to verify that our program swaps the values of x and y for all input values, therefore we also need predicate logic for postcondition. So, we use Q (x, y), where Q (x, y) is the statement “x=b and y=a.”

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

### Property Decorator | Getters Setters and Deleters in Python

In this article, we will talk about the Property Decorator in Python. It enables the class functionality...

### Dictionaries | HashMap in Python | Working with Key-Values

Dictionaries in Python is similar to Hashmap comparing to other languages. It stores data as a key-value...

### Hash Table | Indexing | Hashing Algorithm | Python Implementation

This article will talk about a high-level view of the Hash Table. As a programmer, this technique...

### Eigenvector Eigenvalue | Linear Algebra Fundamentals

Eigenvector ($bar{v}$) in linear algebra is a non-zero vector (matrix) that doesn't change its direction during linear...

### Pivot Table | Microsoft Excel | Create Data Insight Easily

Pivot table in microsoft Excel is an useful function that gives us a way to create insight...

### Macro Function in Microsoft Excel | Automate Repetitive Task

This article we will talk about the Macro. It is a function in microsoft excel which basically...