AI Classnotes
AI Classnotes
Class notes
The 8 puzzle problem solution is covered in this article. A 3 by 3 board with 8 tiles (each tile has a number from 1
to 8) and a single empty space is provided. The goal is to use the vacant space to arrange the numbers on the
tiles such that they match the final arrangement. Four neighbouring (left, right, above, and below) tiles can be moved
into the available area.
In this solution, further movements might not always send us closer to the objective, but rather further away.
Regardless of the initial state, the state-space tree searches down the leftmost route from the root. With this
method, an answer node might never be discovered.
We can search the state space tree using a breadth-first approach. It always locates the goal state that is closest to
the root. However, the algorithm tries the same series of movements as DFS regardless of the initial state.
The route taken by the aforementioned algorithm to arrive at the final configuration of the 8-Puzzle from the starting
configuration supplied is shown in the diagram below. Keep in mind that only nodes with the lowest costs
function value are extended.
We suppose that it will costs one unit to move a tile in any direction. In light of this, we create the following costs
function for the 8-puzzle algorithm:
Bidirectional Search
Bidirectional search is a graph search algorithm which find smallest path from source to goal vertex. It runs
two simultaneous search ----
1. Forward search from source/initial vertex toward goal vertex
2. Backward search from goal/target vertex toward source vertex
Bidirectional search replaces single search graph (which is likely to grow exponentially) with two smaller
sub graphs -- one starting from initial vertex and other starting from goal vertex. The search terminates
when two graphs intersect.
Bidirectional search can be guided by a heuristic estimate of remaining distance from source to goal and
vice versa for finding shortest path possible.
Consider following simple example-
Suppose we want to find if there exists a path from vertex 0 to vertex 14. Here we can execute two searches,
one from vertex 0 and other from vertex 14. When both forward and backward search meet at vertex 7, we
know that we have found a path from node 0 to 14 and search can be terminated now. We can clearly see
that we have successfully avoided unnecessary exploration.
Why bidirectional approach?
Because in many cases it is faster, it dramatically reduce the amount of required exploration.
Suppose if branching factor of tree is b and distance of goal vertex from source is d, then the normal
BFS/DFS searching complexity would be O (𝑏 𝑑 ). On the other hand, if we execute two search operation
then the complexity would be O (𝑏 𝑑/2 ) for each search and total complexity would be O (𝑏 𝑑/2 ) +𝑏 𝑑/2 )
which is far less than O (𝑏 𝑑 ).
When to use bidirectional approach?
We can consider bidirectional approach when-
1. Both initial and goal states are unique and completely defined.
2. The branching factor is exactly the same in both directions.
Performance measures
Step 5: Exit.
2. Plateau: A plateau is the flat area of the search space in which all the neighbor states of the current
state contains the same value, because of this algorithm does not find any best direction to move. A hill-
climbing search might be lost in the plateau area.
Solution: The solution for the plateau is to take big steps or very little steps while searching, to solve the
problem. Randomly select a state which is far away from the current state so it is possible that the
algorithm could find non-plateau region.
3. Ridges: A ridge is a special form of the local maximum. It has an area which is higher than its
surrounding areas, but itself has a slope, and cannot be reached in a single move.
Solution: With the use of bidirectional search, or by moving in different directions, we can improve this
problem.
Simulated Annealing simulates the annealing process used in metalworking. The algorithm
begins with a randomly generated initial solution and incrementally improves it by
accepting less desirable solutions with a certain probability. The probability of accepting a
worse solution decreases as the algorithm progresses, which enables it to escape local
optima and find the global optimum.
Simulated annealing explores the search space and avoids local optimum by employing a
probabilistic method to accept a worse solution with a given probability. The initial
temperature, cooling schedule, and acceptance probability function are just a few of the
tuning parameters. Hill Climbing is faster, but Simulated Annealing is better at locating
the global optimum, particularly for complex issues with numerous local optima.
Simulated Annealing is inspired by annealing in metallurgy. It consists in heating the metal to a high
temperature and then slowly cooling it. In this way, the internal structure of the metal is first broken and
then very slowly "repaired". This results in a metal that has significantly better properties than at the
beginning of the process
Remember how at Hill Climbing we looked at all the neighbors and picked the best one? Simulated
annealing does the same thing, but... But with some probability, it is willing to accept a worse solution. If
we decide on a worse solution at the right moment, we can later get to a better one = get out of the local
minimum/maximum.
A Simulated annealing algorithm is a method to solve bound-constrained and unconstrained optimization
parameters models. The method is based on physical annealing and is used to minimize system energy.
In every simulated annealing example, a random new point is generated. The distance between the current
point and the new point has a basis of the probability distribution on the scale of the proportion of
temperature. The algorithm aims at all those points that minimize the objective with certain constraints and
probabilities. Those points that raise the objective are also accepted to explore all the possible solutions
instead of concentrating only on local minima.
Optimization by simulated annealing is performed by systematically decreasing the temperature and
minimizing the search’s extent.
Let’s now try to draw parallels between Annealing in metallurgy and Simulated annealing for Feature
selection:
In terms of feature selection,
Algorithm
As with other optimization algorithms, we will create a random solution. However, its optimization will
consist in lowering the temperature a pre-defined number of times (n) and based on this temperature and
the generated neighbor we can accept or reject it. A simplified form of the algorithm would work like this:
1. solution = random solution
2. temperature = initial temperature
3. n times
a. neighbor_solution = neighborhood solution based on solutions
b. sneighboring_solution = is better than solution
c. lower temperature
4. Return best solution found yet
Implementation of SA is surprisingly simple.
The algorithm is basically hill-climbing except instead of picking the best move, it picks a random move.
If the selected move improves the solution, then it is always accepted. Otherwise, the algorithm makes the
move anyway with some probability less than 1. The probability decreases exponentially with the
“badness” of the move, which is the amount delta E by which the solution is worsened (i.e., energy is
increased.)
Prob (accepting uphill move) ~ 1 – exp (delta E / kT))
A parameter T is also used to determine this probability. It is analogous to temperature in an annealing
system. At higher values of T, uphill moves are more likely to occur. As T tends to zero, they become
more and more unlikely, until the algorithm behaves more or less like hill-climbing. In a typical SA
optimization, T starts high and is gradually decreased according to an “annealing schedule”. The parameter
k is some constant that relates temperature to energy (in nature it is Boltzmann’s constant.)
Simulated annealing is typically used in discrete, but very large, configuration spaces, such as the set of
possible orders of cities in the Traveling Salesman problem and in VLSI routing. It has a broad range of
application that is still being explored.
Variants
When I studied this algorithm, it became clear that many people have a different idea of its use. Basically
there are 2 main use cases:
1. We get a neighbor with a small change and accept him with a certain probability.
2. The higher the temperature, the more significant changes w e can make in the neighbor.
Furthermore, the algorithm can vary, for example, in when we change the temperature. Someone changes
the temperature in each iteration, someone lets the algorithm cool down every n-iterations.
No one can simply say how to set the initial temperature, and no one can say how fast to let the temperature
cool down (value of α).
Heuristics function:
Heuristic is a function which is used in Informed Search, and it finds the most promising path. It takes
the current state of the agent as its input and produces the estimation of how close agent is from the
goal.
The heuristic method, however, might not always give the best solution, but it guaranteed to find a good
solution in reasonable time. Heuristic function estimates how close a state is to the goal. It is represented
by h(n), and it calculates the cost of an optimal path between the pair of states. The value of the heuristic
function is always positive.
Admissibility of the heuristic function is given as:
h(n) <= h*(n)
Here h(n) is heuristic cost, and h*(n) is the estimated cost. Hence heuristic cost should be less than or
equal to the estimated cost.
1. Inaccurate Results: Greedy Best-First Search is not always guaranteed to find the optimal solution, as
it is only concerned with finding the most promising path.
2. Local Optima: Greedy Best-First Search can get stuck in local optima, meaning that the path chosen
may not be the best possible path.
3. Heuristic Function: Greedy Best-First Search requires a heuristic function in order to work, which
adds complexity to the algorithm.
4. Lack of Completeness: Greedy Best-First Search is not a complete algorithm, meaning it may not
always find a solution if one is exists. This can happen if the algorithm gets stuck in a cycle or if the
search space is a too much complex.
The greedy best first algorithm is implemented by the priority queue.
Example: Consider the below search problem, and we will traverse it using greedy best-first search. At
each iteration, each node is expanded using evaluation function f (n) =h (n), which is given in the below
table.
In this search example, we are using two lists which are OPEN and CLOSED Lists. Following are the
iteration for traversing the above example.
Advantages:
Best first search can switch between BFS and DFS by gaining the advantages of both the
algorithms.
This algorithm is more efficient than BFS and DFS algorithms.
Disadvantages:
It can behave as an unguided depth-first search in the worst case scenario.
It can get stuck in a loop as DFS.
This algorithm is not optimal.
It uses heuristic function h (n), and cost to reach the node n from the start state g (n). It has combined
features of UCS and greedy best-first search, by which it solve the problem efficiently.
A* search algorithm finds the shortest path through the search space using the heuristic function.
This search algorithm expands less search tree and provides optimal result faster.
A* algorithm is similar to UCS except that it uses g (n) +h (n) instead of g (n). Uniform-cost
search (UCS) expands the node with lowest path cost (i.e. with the lowest g (n)), whereas best-
first search (BFS) expand the node with closest to the goal.
In A* search algorithm, we use search heuristic as well as the cost to reach the node. Hence we
can combine both costs as following, and this sum is called as a fitness number.
At each point in the search space, only those node is expanded which have the lowest value of f(n), and
the algorithm terminates when the goal node is found.
Example:
In this example, we will traverse the given graph using the A* algorithm. The heuristic value of all states
is given in the below table so we will calculate the f(n) of each state using the formula f(n)= g(n) + h(n),
where g(n) is the cost to reach any node from start state. Here we will use OPEN and CLOSED list.
Solution:
Algorithm of A* search:
Advantages:
1) A* search algorithm is the best algorithm than other search algorithms.
2) A* search algorithm is optimal and complete.
3) This algorithm can solve very complex problems.
Disadvantages:
1) It does not always produce the shortest path as it mostly based on heuristics and approximation.
2) A* search algorithm has some complexity issues.
3) The main drawback of A* is memory requirement as it keeps all generated nodes in the memory,
so it is not practical for various large-scale problems.
Points to remember:
I. A* algorithm returns the path which occurred first, and it does not search for all remaining paths.
II. The efficiency of A* algorithm depends on the quality of heuristic.
III. A* algorithm expands all nodes which satisfy the condition f(n)
Complete: A* algorithm is complete as long as:
I. Branching factor is finite.
II. Cost at every action is fixed.
Optimal: A* search algorithm is optimal if it follows below two conditions:
I. Admissible: the first condition requires for optimality is that h(n) should be an admissible
heuristic for A* tree search. An admissible heuristic is optimistic in nature.
II. Consistency: Second required condition is consistency for only A* graph-search.
If the heuristic function is admissible, then A* tree search will always find the least cost path.
Time Complexity: The time complexity of A* search algorithm depends on heuristic function, and the
number of nodes expanded is exponential to the depth of solution d. So the time complexity is O(b^d),
where b is the branching factor.
Space Complexity : The space complexity of A* search algorithm is O(b^d)
Best-First Search:
Best-First search is a searching algorithm used to find the shortest path which uses distance as a heuristic.
The distance between the starting node and the goal node is taken as heuristics. It defines the evaluation
function for each node n in the graph as f(n) = h(n) where h(n) is heuristics function.
A*Search:
A*search is a searching algorithm used to find the shortest path which calculates the cost of all its
neighboring nodes and selects the minimum cost node. It defines the evaluation function f(n) = g(n) +
h(n) where, h(n) is heuristics function and g(n) is the past knowledge acquired while searching.
1 Evaluation Function The evaluation function for best-first The evaluation function for A* search
search is f(n) = h(n). is f(n) = h(n) + g(n).
2. Past Knowledge This search algorithm involves past This search algorithm does not
knowledge. involve past knowledge.
3 Completeness Best-first search is not complete. A* search is complete.
4 Optimal Best-first search is not optimal as the A* search is optimal as the path
path found may not be optimal. found is always optimal
5 Time and Space Its time complexity is O(b^d) and space Its time complexity O(b^d) and space
Complexity complexity can be polynomial. where b complexity is also (b^d)where b is the
is the branching and m is the maximum branching and m is the maximum
depth of the search tree depth of the search tree
Beam search, like other heuristic algorithms, uses a "best guess" or heuristic to guide the search
towards promising solutions, rather than exhaustively exploring every possibility.
Limited Set:
Instead of expanding all possible nodes at each step, beam search maintains a "beam" or a limited set of
the most promising candidates.
Beam Width:
The "beam width" (often denoted as 'k') determines the number of nodes kept in the beam at each step.
Memory Efficiency:
By focusing on a limited set, beam search reduces memory requirements compared to algorithms that
explore all possible paths.
Applications:
Beam search is commonly used in machine learning, particularly in natural language processing (NLP)
and speech recognition, where it helps find the most probable or optimal sequence of words or characters.
How it Works:
(i) Start with a single node (or a set of initial nodes) in the beam.
(ii) Expand each node in the beam, generating its successors.
(iii) Evaluate the successors based on a heuristic function.
(iv) Select the top 'k' successors (based on the heuristic) to form the next beam.
(v) Repeat steps 2-4 until a solution is found or the beam is exhausted.
Relationship to Best-First Search:
1. Beam search can be seen as a modification of best-first search, where the breadth of the search is
limited to the beam width
2. Beam search is a heuristic search algorithm that explores a graph by expanding the most
optimistic node in a limited set. Beam search is an optimization of best-first search that
reduces its memory requirements.
3. Best-first search is a graph search that orders all partial solutions according to some heuristic.
But in beam search, only a predetermined number of best partial solutions are kept as candidates.
Therefore, it is a greedy algorithm.
4. Beam search uses breadth-first search to build its search tree.
At each level of the tree, it generates all successors of the states at the current level, sorting them
in increasing order of heuristic cost. However, it only stores a predetermined number (β), of best states
at each level called the beamwidth. Only those states are expanded next.
The greater the beam width, the fewer states are pruned. No states are pruned with infinite beam
width, and beam search is identical to breadth-first search.
The beamwidth
Since a goal state could potentially be pruned, beam search sacrifices completeness (the guarantee
that an algorithm will terminate with a solution if one exists).
Beam search is not optimal, which means there is no guarantee that it will find the best solution.
In general, beam search returns the first solution found. Once reaching the configured maximum search
depth (i.e., translation length), the algorithm will evaluate the solutions found during a search at various
depths and return the best one that has the highest probability.
The beam width can either be fixed or variable. One approach that uses a variable beam width
starts with the width at a minimum. If no solution is found, the beam is widened, and the procedure is
repeated.
The problem is the problem to be solved, usually represented as a graph, and contains a set of nodes in
which one or more of the nodes represents a goal. The set of heuristic rules are rules specific to the
problem domain and prune unfavorable nodes from memory regarding the problem domain.
The memory is where the "beam" is stored, memory is full, and a node is to be added to the beam, the
most costly node will be deleted, such that the memory limit is not exceeded.
Beam Search Algorithm
The following algorithm for a beam search, as a modified best-first search, is adapted from Zhang's 1999:
beamSearch(problemSet, ruleSet, memorySize)
openMemory = new memory of size memorySize
nodeList = problemSet.listOfNodes
node = root or initial search node
Add node to openMemory;
while (node is not a goal node)
Delete node from openMemory;
Expand node and obtain its children, evaluate those children;
If a child node is pruned according to a rule in ruleSet, delete it;
Place remaining, non-pruned children into openMemory;
If memory is full and has no room for new nodes, remove the worst
node, determined by ruleSet, in openMemory;
node = the least costly node in openMemory;
Drawbacks of Beam Search:
1. In general, the Beam Search Algorithm is not complete. Despite these disadvantages, beam search
has found success in the practical areas of speech recognition, vision, planning, and machine
learning.
2. The main disadvantages of a beam search are that the search may not result in an optimal goal and
may not even reach a goal at all after given unlimited time and memory when there is a path from
the start node to the goal node.
3. The beam search algorithm terminates for two cases: a required goal node is reached, or a goal
node is not reached, and there are no nodes left to be explored.
A more accurate heuristic function and a larger beam width can improve Beam
Search's chances of finding the goal.
In this example,
1. There are two players one is called Maximizer and other is called Minimizer.
2. Maximizer will try to get the Maximum possible score, and Minimizer will try to get the
minimum possible score.
3. This algorithm applies DFS, so in this game-tree, we have to go all the way through the leaves
to reach the terminal nodes.
4. At the terminal node, the terminal values are given so we will compare those value and
backtrack the tree until the initial state occurs.
Following are the main steps involved in solving the two-player game tree:
Step-1: In the first step, the algorithm generates the entire game-tree and apply the utility function to
get the utility values for the terminal states.
In the below tree diagram, let's take A is the initial state of the tree. Suppose maximizer takes first turn
which has worst-case initial value = - infinity, and minimizer will take next turn which has worst-case
initial value = +infinity.
For the maximizer, starting with −∞ means that initially, it assumes the worst possible
value. As it explores possible moves, it will try to increase its score .
For the minimizer, starting with +∞ means it assumes the worst possible loss. It will try to
reduce the score as much as possible.
Step 2 : Now, first we find the utilities value for the Maximizer, its initial value is -∞, so we will
compare each value in terminal state with initial value of Maximizer and determines the higher
nodes values. It will find the maximum among the all.
Step 3 : In the next step, it's a turn for minimizer, so it will compare all nodes value with +∞, and will
find the 3rd layer node values.
For node B= min (4, 6) = 4
For node C= min (-3, 7) = -3
Step 4: Now it's a turn for Maximizer, and it will again choose the maximum of all nodes value and
find the maximum value for the root node. In this game tree, there are only 4 layers, hence we reach
immediately to the root node, but in real games, there will be more than 4 layers.
For node A max (4, -3) = 4
That was the complete workflow of the minimax two player game.
Properties of Mini-Max algorithm:
Complete- Min-Max algorithm is Complete. It will definitely find a solution (if exist), in the finite
search tree.
Optimal- Min-Max algorithm is optimal if both opponents are playing optimally.
Time complexity - As it performs DFS for the game-tree, so the time complexity of Min-Max algorithm
is O (𝑏 𝑑 ). where b is branching factor of the game-tree, and d is the maximum depth of the tree.
Space Complexity - Space complexity of Mini-max algorithm is also similar to DFS which is O (𝑏 𝑑 ).
Limitation of the minimax Algorithm:
The main drawback of the minimax algorithm is that it gets really slow for complex games such as Chess,
go, etc. This type of games has a huge branching factor, and the player has lots of choices to decide. This
limitation of the minimax algorithm can be improved from alpha-beta pruning which we have discussed
in the next topic.
Alpha-beta pruning
Alpha-beta pruning is an optimization for the minimax algorithm used in game-playing AI,
reducing unnecessary computations by pruning branches in the game tree that cannot influence the final
decision, while maintaining the optimal result.
Here's a more detailed explanation:
Minimax Algorithm:
The minimax algorithm is a decision-making process used in two-player, zero-sum games (like chess)
where one player aims to maximize their score, and the other aims to minimize it. It works by exploring
all possible game states (represented as a tree) and assigning values to the leaf nodes based on potential
outcomes.
Alpha-Beta Pruning:
This technique optimizes the minimax algorithm by pruning branches of the game tree that cannot affect
the final outcome.
How it works:
Alpha: Represents the best (highest) value found so far for the maximizing player (the player trying to
maximize the score).
Beta: Represents the best (lowest) value found so far for the minimizing player (the player trying to
minimize the score).
Pruning: If during the search, the value of a node is found to be worse than the current alpha (for a
maximizing player) or beta (for a minimizing player), that branch and its descendants can be pruned
(skipped) because they cannot influence the optimal outcome.
Benefits:
Reduced Computational Cost: By pruning unnecessary branches, alpha-beta pruning significantly
reduces the number of nodes that need to be evaluated, making the search process faster and more efficient.
Faster Decision-Making: This efficiency is crucial for real-time applications like game-playing AI, where
speed is essential.
Example:
Imagine a game tree where the maximizing player (AI) has two options: A and B. Option A leads to a value
of 5, and option B leads to a value of 2. The minimizing player (human) will choose the option that leads
to the lowest value, which is 2. Alpha-beta pruning would recognize that the branch leading to option B is
not relevant to the maximizing player's decision and can be pruned.
Limitations:
Alpha-beta pruning's efficiency depends on good move ordering (exploring promising moves first). It is
not suitable for games involving chance or incomplete information.
To represent the above statements, PL logic is not sufficient, so we required some more powerful logic,
such as first-order logic.
First-Order logic:
1. First-order logic is another way of knowledge representation in artificial intelligence. It is an
extension to propositional logic.
2. FOL is sufficiently expressive to represent the natural language statements in a concise way.
3. First-order logic is also known as Predicate logic or First-order predicate logic. First-order logic
is a powerful language that develops information about the objects in a more easy way and can
also express the relationship between those objects.
4. First-order logic (like natural language) does not only assume that the world contains facts like
propositional logic but also assumes the following things in the world:
Objects: A, B, people, numbers, colors, wars, theories, squares, pits ...
Relations: It can be unary relation such as: red, round, is adjacent, or n-any relation such
as: the sister of, brother of, has color, comes between
Function: Father of, best friend, third inning of, end of, ......
Variables x, y, z, a, b,....
Connectives ∧, ∨, ¬, ⇒, ⇔
∧ represents "and", ∨ represents "or", and ¬ represents "not"."⇒" means "implies" or "if...then..."
while " ⇔ " means " if and only if" or "is equivalent to".
P ⇒ Q: If P is true, then Q is true.
P ⇔ Q: P is true if and only if Q is true (or P is equivalent t o Q).
Equality ==
Quantifier ∀, ∃
Atomic sentences:
Atomic sentences are the most basic sentences of first-order logic. These sentences are formed from a
predicate symbol followed by a parenthesis with a sequence of terms.
We can represent atomic sentences as Predicate (term1, term2, ..., term n).
Example: Ravi and Ajay are brothers: => Brothers (Ravi, Ajay).
ABC is a cat: => cat (ABC).
Complex Sentences:
Complex sentences are made by combining atomic sentences using connectives.
First-order logic statements can be divided into two parts:
1. Subject: Subject is the main part of the statement.
2. Predicate: A predicate can be defined as a relation, which binds two atoms together in a
statement.
Consider the statement: "x is an integer.", it consists of two parts, the first part x is the subject of the
statement and second part "is an integer," is known as a predicate.
Universal Quantifier:
Universal quantifier is a symbol of logical representation, which specifies that the statement within its
range is true for everything or every instance of a particular thing.
Example:
All man drink coffee.
Let a variable x which refers to a men so all x can be represented in UOD (Universe of Discourse) as
below:
Existential Quantifier:
Existential quantifiers are the type of quantifiers, which express that the statement within its scope is true
for at least one instance of something.
It is denoted by the logical operator ∃, which resembles as inverted E. When it is used with a predicate
variable then it is called as an existential quantifier.
Note: In Existential quantifier we always use AND or Conjunction symbol (∧ ).
If x is a variable, then existential quantifier will be ∃x or ∃(x). And it will be read as:
∃ x: boys(x) ∧ intelligent(x)
It will be read as: There are some x where x is a boy who is intelligent.
Points to remember:
a) The main connective for universal quantifier ∀ is implication →.
b) The main connective for existential quantifier ∃ is and ∧.
Properties of Quantifiers:
a) In universal quantifier, ∀x is similar to ∀y ∀x.
b) In Existential quantifier, ∃x ∃y is similar to ∃y ∃x.
c) ∃x ∀y is not similar to ∀y ∃x.
Sure! Here's how we can represent the given sentences in First Order Logic (FOL):
Let:
Bird(x) : x is a bird
Flies(x) : x can fly
FOL:
∀x (Bird(x) →Flies(x))
b. Every man respects his parent.
Let:
FOL:
Boy(x): x is a boy
PlaysCricket(x): x plays cricket
FOL:
∃x (Boy(x) ∧ PlaysCricket(x))
Student(x): x is a student
LikesMath(x): x likes Mathematics
LikesScience(x): x likes Science
"Not all" means it is not the case that all students like both:
FOL:
¬∀x (Student(x)→(LikesMath(x)∧LikesScience(x)))
∃x (Student(x)∧¬(LikesMath(x)∧LikesScience(x)))
∃x (Student(x)∧FailedMath(x) ∧ ∀y ((Student(y)∧FailedMath(y))→y=x))
FOL Statement:
1. ∃x
→ There exists some individual x
2. Student(x)∧FailedMath(x)
→ x is a student and x failed in Mathematics
3. ∀y ((Student(y)∧FailedMath(y))→y=x
→ For any individual y, if y is a student and y failed in Mathematics, then y must be the
same as x.
So, it perfectly captures the meaning of "Only one student failed in Mathematics."
∀x bird(x) →fly(x).
2. Every man respects his parent.
In this question, the predicate is "respect(x, y)," where x=man, and y= parent.
Since there is every man so will use ∀, and it will be represented as follows:
Learn more
Bound Variable: A variable is said to be a bound variable in a formula if it occurs within the scope of the
quantifier.
Example: ∀x [A (x) B( y)], here x and y are the bound variables.