BE - SEMESTER–VII (NEW)
EXAMINATION – SUMMER 2022
Subject Code:3170716
Date:03/06/2022
Subject Name: Artificial Intelligence
Q.1
(a) Define AI. What are the task domains of AI? 03
ANSWER: Artificial intelligence (AI) refers to the simulation of human intelligence
in machines that are programmed to think like humans and mimic their actions.
Task Domains of Artificial Intelligence (AI)
1.Mundane Tasks:
• Perception • Generation
• Vision • Translation
• Speech • Common sense reasoning
• Natural Languages • Robot Control
• Understanding
➢ Humans have been learning mundane (ordinary) tasks since their birth. They learn
by perception, speaking, using language, and locomotives.
➢ For humans, the mundane tasks are easiest to learn. The same was considered true
before trying to implement mundane tasks in machines.
➢ Earlier, all work of AI was concentrated in the mundane task domain.
2.Formal Tasks:
• Games: chess, checkers, etc
• Mathematics: Geometry, logic, Proving properties of programs
➢ Formal Tasks are the tasks that need deals with verification, theorem proving, deals
with Math, Games, etc.
3.Expert Tasks:
• Engineering (Design, Fault finding, Manufacturing planning)
• Scientific Analysis
• Medical Diagnosis
• Financial Analysis
➢ Expert Tasks are those tasks, which involves scientific analysis, and different
domain analysis, like Financial, healthcare, creative aspects, etc.
➢ Now researchers have understood that to solve mundane tasks, they need better and
more efficient algorithms, and a much more knowledge base to help them tackle the
problems they have set out to solve. And that is the reason that AI has shifted more
on working with Expert Tasks, to enhance the capabilities of the AI system.
(b) Explain Water Jug problem with Sate Space Search method. 04
ANSWER: Problem Definition: You are given two jugs, a 4-gallon one and a 3-gallon one, a
pump which has unlimited water which you can use to fill the jug, and the ground on which water
may be poured. Neither jug has any measuring markings on it. How can you get exactly 2 gallons
of water in the 4-gallon jug?
1.Initial State:
We will represent a state of the problem as a tuple (x, y), where x represents the
amount of water in the 4-gallon jug and y represents the amount of water in the 3-
gallon jug.
Note that 0 ≤ x ≤ 4, and 0 ≤ y ≤ 3.
Here the initial state is (0, 0). The goal state is (2, n) for any value of n.
2.Production Rules
Sr. Current state Next State Descriptions
1 (x, y) if x < 4 (4,y) Fill the 4 gallon jug
2 (x, y) if y <3 (x,3) Fill the 3 gallon jug
3 (x, y) if x > 0 (x-d, y) Pour some water out of the 4 gallon jug
4 (x, y) if y > 0 (x, y-d) Pour some water out of the 3 gallon jug
5 (x, y) if x>0 (0, y) Empty the 4 gallon jug
6 (x, y) if y >0 (x,0) Empty the 3 gallon jug on the ground
7 (x, y) if x+y >= 4 and y > 0 (4, y-(4-x)) Pour water from the 3 gallon jug into the 4 gallon jug until the 4 gallon jug is full
8 (x, y) if x+y >= 3 and x>0 (x-(3-y), 3) Pour water from the 4 gallon jug into the 3-gallon jug until the 3 gallon jug is full
9 (x, y) if x+y <=4 and y>0 (x+y, 0) Pour all the water from the 3 gallon jug into the 4 gallon jug
10 (x, y) if x+y <= 3 and x>0 (0, x+y) Pour all the water from the 4 gallon jug into the 3 gallon jug
11 (0,2) (2,0) Pour the 2 gallons from 3 gallon jug into the 4 gallon jug
12 (2,y) (0,y) Empty the 2 gallons in the 4 gallon jug on the ground
One of the possible solutions is given as:
3. Productions for the water jug problem
Gallons in the 4- gallon jug Gallons in the 3- gallon jug Rule applied
0 0 2
0 3 9
3 0 2
3 3 7
4 2 5 or 12
0 2 9 0r 11
2 0 --
(c) Explain Best First Search with suitable example. 07
ANSWER: Best first search is a combination of DFS and BFS.
• In DFS, all the competing branches are not expanded and BFS never gets trapped
on dead-end paths.
• So, if we combine both and continue following a single path until some competing
path looks more promising, it is what best first search is.
• Best first search explores the most promising node using the heuristic value of
the node.
➢ The algorithm is as follows:
1) Define a list, OPEN, which has the start node, s.
2) IF the list is empty, return failure.
3) Remove from the list the node n with the best score (the node where f is the minimum),
and move it to a list, CLOSED.
4) Expand node n.
5) IF any successor to n is the goal node, return success and the solution (by tracing the
path from the goal node to s).
6) FOR each successor node:
a) apply the evaluation function, f, to the node.
b) IF the node has not been in either list, add it to OPEN.
7) Continue the loop and go back to step-2.
Q.2
(a)Define the following.
1. Modus Ponens 2. Horn Clause 3. Existential Quantifier 03
1. Modus Ponens: The Modus Ponens rule is one of the most important rules of
inference, and it states that if P and P → Q is true, then we can infer that Q will be
true. It can be represented as:
2. Horn Clause: A Horn clause is a clause (a disjunction of literals) with at most
one positive, i.e. unnegated, literal.
3.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.
(b)Explain Semantic Net with example. 04
ANSWER: SEMANTIC NET
➢ A semantic net (or semantic network) is a knowledge representation
technique used for propositional information.
➢ In semantic net, information is represented as a set of nodes connected to each
other by set of labeled arcs, which represent relationships among the nodes.
➢ Semantic net allows us to perform inheritance reasoning as all members of a class
will inherit all the properties of superclass.
➢ Semantic nets allow multiple inheritance.
➢ It allows a common form of inference known as inverse links. For example, we can
have a HasMother link which is the inverse of MotherOf link.
➢ The inverse links make the job of inference algorithms much easier to answer
queries such as who the mother of John is.
EX:- TOM IS A CAT.
CATS LOVE MILK.
TOM IS GREY IN COLOUR.
(c)Consider the following sentences:
1.Rita likes all kinds of food.
2.Apples are food.
3.Anything anyone eats and isn’t killed by is food.
4.Rahi eats peanuts and is still alive.
5.Tanvi eats everything Rahi eats.
i. Translate these sentences into formulas in predicate
logic.
ii. Use resolution to answer the question, “What food does
Tanvi eat?” 07
ANSWER:
(a) Translate these sentences into formulas in FOPC.
1.Rita likes all kinds of food.
->∀x: Food(x) → Likes (Rita, x)
2.Apples are food.
->Food (Apples)
3.Anything anyone eats and isn’t killed by is food.
->∀x∃y Eats(y, x) ∧ ¬KilledBy(y, x) → Food(x)
4.Rahi eats peanuts and is still alive.
->Eats(Bill, Peanuts) ∧ ¬KilledBy(Bill, Peanuts)
5.Tanvi eats everything Rahi eats.
->∀x Eats(Rahi, x) → Eats(Tanvi, x)
(b)Use resolution to answer the question, “What food does Tanvi eat?”
1.¬Eats(Tanvi, x) negated query
2.¬Eats(Rahi, x) ∨ Eats(Tanvi, x)
3.⊥ Eats(Rahi, Peanuts) ¬Eats(Rahi, x) ∨ Eats(Tanvi, x) , unifying Peanuts/x
OR
(c)Explain Forward Reasoning and Backward Reasoning with
example. 07
Answer: Forward Reasoning:
➢ Forward chaining starts from known facts and applies inference rule to extract
more data unit it reaches to the goal.
➢ The Forward chaining algorithm starts from known facts, triggers all rules whose
premises are satisfied, and add their conclusion to the known facts. This process
repeats until the problem is solved.
➢ It is a bottom-up approach.
➢ Forward chaining is known as data-driven inference technique as we reach to
the goal using the available data.
➢ Forward chaining is suitable for the planning, monitoring, control, and
interpretation application.
➢ This technique is used by design expert system.
Backward Reasoning:
➢ Backward chaining starts from the goal and works backward through
inference rules to find the required facts that support the goal.
➢ A backward chaining algorithm is a form of reasoning, which starts with the
goal and works backward, chaining through rules to find known facts that
support the goal.
➢ It is a top-down approach.
➢ Backward chaining is known as goal-driven technique as we start from the
goal and divide into sub-goal to extract the facts.
➢ Backward chaining is suitable for diagnostic, prescription, and debugging
application.
➢ This technique is used by diagnostic expert system.
Q.3
(a)Explain Expert System Shell with example. 03
Answer: Expert System Shells:
An Expert system shell is a software development environment. It contains the basic
components of expert systems. A shell is associated with a prescribed method for
building applications by configuring and instantiating these components.
Shell components and description:
The generic components of a shell: the knowledge acquisition, the knowledge Base,
the reasoning, the explanation and the user interface. The knowledge base and
reasoning engine are the core components.
Example :
TMYCIN is an expert system shell modelled after the EMYCIN shell that was
developed at Standford. It is especially useful for student exercises, although real
expert systems have been written using it. 'TMYCIN' is written in common Lisp and it
is fairly small (11 pages of code). It should run under any implementation of
common Lisp.
(b)Explain MiniMax search procedure. 04
➢ The minimax search is a depth first and depth limited procedure.
➢ The idea is to start at the current position and use the plausible-move generator
to generate the set of possible successor positions.
➢ Now we can apply the static evolution function to those positions and simply
choose the best one.
➢ After doing so, we can back that value up to the starting position to represent our
evolution of it.
➢ Here we assume that static evolution function returns larger values to indicate
good situations for us.
➢ So, our goal is to maximize the value of the static evaluation function of the next
board position.
➢ The opponents’ goal is to minimize the value of the static evaluation function.
➢ The alternation of maximizing and minimizing at alternate ply when evaluations
are to be pushed back up corresponds to the opposing strategies of the two
players is called MINIMAX.
➢ It is recursive procedure that depends on two procedures:
➢ MOVEGEN(position, player)— The plausible-move generator, which returns a
list of nodes representing the moves that can be made by Player in Position.
➢ STATIC(position, player)— static evaluation function, which returns a number
representing the goodness of Position from the standpoint of Player.
(c)Explain Artificial Neural Network. 07
ANSWER:- Artificial Neural Network (ANN):-
• An Artificial Neural Network (ANN) is an information processing paradigm that is
inspired by the way biological nervous systems, such as the brain process
information.
• The brain is a highly complex, nonlinear, and parallel information processing
system. It has the capability of organizing neurons so as to perform certain
computations (e.g. pattern recognition, perception, and motor control) many
times faster than the fastest digital computer. A brain has great structure and the
ability to build up its own rules through what we usually refer to as experience.
• In its most general form, a neural network is a machine that is designed to model
the way in which the brain performs a particular task or function of interest.
• The network is usually implemented using electronic components or simulated in
software on a digital computer.
• To achieve good performance, neural networks employ a massive interconnection
of simple computing cells referred to as neurons or processing units.
• A neural network is a massively parallel distributed processor that has a natural
propensity for storing experiential knowledge and making it available for use.
• It resembles the brain in two respects.
• Knowledge is acquired by the network through a learning process.
• Interneuron connection strengths known as synaptic weights are used to store
the Knowledge.
• Neural networks are also referred to as neuro-computers, connectionist networks,
parallel Distributed processors, etc.
OR
Q.3
(a)Draw and explain architecture of Expert System. 03
Architecture of an Expert System
• Knowledge Base –
The knowledge base represents facts and rules. It consists of knowledge in a
particular domain as well as rules to solve a problem, procedures and intrinsic data
relevant to the domain.
• Inference Engine –
The function of the inference engine is to fetch the relevant knowledge from the
knowledge base, interpret it and to find a solution relevant to the user’s problem.
The inference engine acquires the rules from its knowledge base and applies them
to the known facts to infer new facts. Inference engines can also include an
explanation and debugging abilities.
• Knowledge Acquisition and Learning Module –
The function of this component is to allow the expert system to acquire more and
more knowledge from various sources and store it in the knowledge base.
• User Interface –
This module makes it possible for a non-expert user to interact with the expert
system and find a solution to the problem.
• Explanation Module –
This module helps the expert system to give the user an explanation about how
the expert system reached a particular conclusion.
(b)Show the use of Alpha-Beta pruning. 04
Answer: Alpha-beta pruning:
->Alpha-beta pruning is a modified version of the minimax algorithm. It is an
optimization technique for the minimax algorithm.
->As we have seen in the minimax search algorithm that the number of game states
it has to examine are exponential in depth of the tree. Since we cannot eliminate the
exponent, but we can cut it to half.
->Hence there is a technique by which without checking each node of the game tree
we can compute the correct minimax decision, and this technique is
called pruning.
->This involves two threshold parameter Alpha and beta for future expansion, so it
is called alpha-beta pruning. It is also called as Alpha-Beta Algorithm.
-> Alpha-beta pruning can be applied at any depth of a tree, and sometimes it not
only prune the tree leaves but also entire sub-tree.
->The two-parameter can be defined as:
1. Alpha: The best (highest-value) choice we have found so far at any
point along the path of Maximizer. The initial value of alpha is -∞.
2. Beta: The best (lowest-value) choice we have found so far at any
point along the path of Minimizer. The initial value of beta is +∞.
->The Alpha-beta pruning to a standard minimax algorithm returns the same move
as the standard algorithm does, but it removes all the nodes which are not
really affecting the final decision but making algorithm slow.
->Hence by pruning these nodes, it makes the algorithm fast.
(c)Explain Backpropagation algorithm in Neural Network. 07
ANSWER: Backpropagation algorithm calculates the gradient of the error function.
➢ Backpropagation can be written as a function of the neural network.
➢ Backpropagation algorithms are a set of methods used to efficiently train artificial
neural networks following a gradient descent approach which exploits the chain
rule.
➢ The main features of Backpropagation are the iterative, recursive and efficient
method through which it calculates the updated weight to improve the network
until it is not able to perform the task for which it is being trained.
Two Types of Backpropagation Networks are:
• Static Back-propagation
• Recurrent Backpropagation
Static back-propagation:
➢ It is one kind of backpropagation network which produces a mapping of a static
input for static output.
➢ It is useful to solve static classification issues like optical character recognition.
Recurrent Backpropagation:
➢ Recurrent Back propagation in data mining is fed forward until a fixed value is
achieved.
➢ After that, the error is computed and propagated backward.
Advantages of Backpropagation are:
• Backpropagation is fast, simple and easy to program
• It has no parameters to tune apart from the numbers of input
• It is a flexible method as it does not require prior knowledge about the network
• It is a standard method that generally works well
• It does not need any special mention of the features of the function to be
learned.
Q.4
(a)Briefly explain any one application of Natural Language
Processing. 03
Answer: Different applications of NLP are:
o Sentiment Analysis
o Text Classification
o Chat bots & Virtual Assistants
o Information extraction
o Machine Translation
o Text Summarization
o Auto-Correct
o Speech Recognition
Text Classification:
->Text clarification is the process of categorizing the text into a group of words.
->By using NLP, text classification can automatically analyze text and then assign a
set of predefined tags or categories based on its context.
->For e.g., Spam Detection is used to detect unwanted e-mails getting to a user's
inbox.
(b)A bag I contains 4 white and 6 black balls while
another Bag II contains 4 white and 3 black balls. One
ball is drawn at random from one of the bags, and it is
found to be black. Find the probability that it was drawn
from Bag I. 04
ANSWER:
Let,
E1 = event of choosing the bag I
E2 = event of choosing the bag II
A = event of drawing a blackball
We have to Find P(E1/A) the probability of drawing Black ball from Bag I
Probability P(E1) = bag selected is bag I = 1/2
Probability P(E2) = bag selected is bag II = 1/2
Probability P(A|E1) = probability of drawing Black ball from Bag I
P(A|E1) = 6/10 = 3/5
Probability P(A|E2) = probability of drawing Black ball from Bag II
P(A|E2) = 3/7
Using Bayes Theorem:
P(A) P(A|E1)
P(E1|A) = P(E1) P(A|E1)+ P(E2) P(A|E1)
1 3
∗
2 5
= 1 3 1 3
∗ + ∗
2 5 2 7
3
10
= 3 3
+
10 14
3
10
= 21+15
70
3
10
= 36
70
3 70
= 10 ∗ 36
7
= 12
=0.583
The probability of drawing Black ball from Bag I is 0.583
(c)Explain Roulette-Wheel selection method of genetic
algorithm. 07
ANSWER: Roulette Wheel Selection method:
➢ Parent Selection in genetic algorithm is the process of selecting parents’ which
mate and recombine to create off-springs for the next generation.
➢ Fitness Proportionate Selection is one of the most popular ways of parent selection.
➢ In this every individual can become a parent with a probability which is
proportional to its fitness.
➢ Roulette Wheel Selection method is one of the implementations of fitness
proportionate selection.
➢ In a roulette wheel selection, the circular wheel is divided into n pies, where n is
the number of individuals in the population.
➢ Each individual gets a portion of the circle which is proportional to its fitness value.
➢ A fixed point is chosen on the wheel circumference as shown and the wheel is
rotated.
➢ The region of the wheel which comes in front of the fixed point is chosen as the
parent.
➢ For the second parent, the same process is repeated.
➢ It is clear that a fitter individual has a greater pie on the wheel and therefore a
greater chance of landing in front of the fixed point when the wheel is rotated.
➢ Therefore, the probability of choosing an individual depends directly on its fitness.
➢ Implementation wise, we use the following steps −
• Calculate S = the sum of a finesses.
• Generate a random number between 0 and S.
• Starting from the top of the population, keep adding the finesses to the
partial sum P, till P<S.
• The individual for which P exceeds S is the chosen individual.
OR
Q.4
(a)Enlist and describe different phases involved in
Natural Language Processing. 03
ANSWER:
1. Morphological Analysis:
It involves identifying and analyzing the structure of words. It divides the
whole text into paragraphs, sentences, and words.
2. Syntactic Analysis:
Syntactic Analysis is used to check grammar, word arrangements, and shows
the relationship among the words. Linear sequence of words are transformed
into structures that show how the words relate to each other.
3. Semantic Analysis:
Semantic analysis is concerned with the meaning representation. It mainly
focuses on the literal meaning of words, phrases, and sentences.
4. Discourse Integration:
Discourse Integration is concerned with how immediately preceding sentence
affects the interpretation of the next sentence. This depends upon the
sentences that proceeds it and also invokes the meaning of the sentences that
follow it.
5. Pragmatic Analysis:
Pragmatic is the fifth and last phase of NLP. It helps you to discover the
intended effect by applying a set of rules that characterize cooperative
dialogues.
For Example: "Open the door" is interpreted as a request instead of an
order.
(b)The task is to recognize English alphabetical characters (F, E,
X, Y, I, T) in an image processing system. Define two fuzzy sets I'
and F' to represent the identification of characters I and F. 04
I'={(F, 0.4), (E, 0.3), (X, 0.1), (Y, 0.1), (I, 0.9), (T, 0.8)}
F'={(F, 0.99), (E, 0.8), (X, 0.1), (Y, 0.2), (I, 0.5), (T, 0.5)}
Find the following.
1. I' ∪ F'
2. I' − F'
Answer: Given below is the solution :
(c)Describe the phases of genetic algorithm. 07
ANSWER:- Genetic algorithm basically involves five phases to solve the complex
optimization problems, which are given as below:
o Initialization
o Fitness Assignment
o Selection
o Reproduction
o Termination
1.Initial Population
➢ This is the first phase of the process where an initial population is selected.
➢ The initial population is simply a set of individuals which are potential solution to
the problem we want to solve.
➢ It could actually be made of thousands or even hundreds of thousands of
individuals that may have been randomly selected or selected based on some
specified criteria.
2.Fitness Function:
➢ This is a way of specifying the criteria for the ‘goodness’ of a given solution
compared to others and to the problem being solved.
➢ Based on the fitness, members of the population are separated into two parts:
those that are fit enough to be selected into the next generation and those that
would be dropped.
3.Selection:
➢ Selection is simple the process of selecting the portion of the population that
would pass into the next generation.
➢ The selection process is based on the fitness criteria from the preceding phase.
➢ Two pairs of individual members of the population are selected (like parents)
based on their fitness.
4. Reproduction:
➢ In this step, the creation of a child occurs in the reproduction step.
➢ The two variation operators that are applied to the parent population in the
reproduction phase are given below:
(a)Cross-Over: Cross-over is the most noteworthy & is also called recombination.
o It is a genetic operator that determines what information is passed from the two
parents to the new offspring.
o Cross-over point is the point in within the genes of the parents at which the
cross-over occurs.
(b)Mutation: The mutation operator inserts random genes in the offspring (new
child) to maintain the diversity in the population.
o It can be done by flipping some bits in the chromosomes.
o Mutation helps in solving the issue of premature convergence and enhances
diversification.
5. Termination:
➢ After the reproduction phase, a stopping criterion is applied as a base for
termination.
➢ The algorithm terminates after the threshold fitness solution is reached.
➢ It will identify the final solution as the best solution in the population.
Q.5
(a)Explain planning problem. 03
ANSWER: - Planning problem:
o The planning problem in Artificial Intelligence is about sequence of actions that
achieves a given goal when executed from a given initial world state.
o That is, given
- a set of operator descriptions (defining the possible primitive actions by the
agent),
- an initial state description, and
- a goal state description or predicate,
o Compute a plan, which is - a sequence of operator instances, such that executing
them in the initial state will change the world to a state satisfying the goal-state
description.
o Goals are usually specified as a conjunction of goals to be achieved
Planning:->Set of Actions.
Action:->Precondition:->For actions to performed there is need of some
preconditions.
:->Effect-Effect is result of action performed.
(b)Explain limitations of Hill Climbing algorithm. 04
ANSWER:- Limitations of Hill Climbing algorithm: -
Hill climbing cannot reach the optimal/best state (global maximum) if it enters any of
the following regions:
Local maximum: At a local maximum all neighbouring states have a value that is
worse than the current state. Since hill-climbing uses a greedy approach, it will not
move to the worse state and terminate itself. The process will end even though a
better solution may exist.
To overcome the local maximum problem: Utilize the backtracking technique.
Maintain a list of visited states. If the search reaches an undesirable state, it can
backtrack to the previous configuration and explore a new path.
Plateau: On the plateau, all neighbors have the same value. Hence, it is not
possible to select the best direction.
To overcome plateaus: Make a big jump. Randomly select a state far away from
the current state. Chances are that we will land in a non-plateau region.
Ridge: Any point on a ridge can look like a peak because movement in all possible
directions is downward. Hence the algorithm stops when it reaches this state.
To overcome Ridge: In this kind of obstacle, use two or more rules before testing.
It implies moving in several directions at once.
(c)Explain Cut and Fail predicates in Prolog. 07
ANSWER: Fail:
➢ If we want to force a rule to fail under certain conditions, then built in
predicate called fail is used in Prolog.
➢ Predicate fail tells prolog interpreter to fail a particular goal and
subsequently forces backtracking.
➢ All the sub goals defined after fail will never be executed.
➢ Hence, predicate fail, should always be used as the last sub goal in a rule.
➢ It is also to be noted, that rule containing fail predicate will not produce any
solution.
➢ Ex- goal(x):- failure(x),!.goal(x).
➢ Failure(x) specifies the condition which makes goal(x) fail.
Cut:
➢ Sometimes it is desirable to selectively turn off backtracking
➢ Cut always succeeds but cannot be backtracked
➢ The cut effectively tells Prolog to freeze all the decisions made so far in this
predicate. That is, if required to backtrack, it will automatically fail without
trying other alternatives
➢ Performance is the main reason to use the cut.
➢ The Symbol of cut predicate is “!”.
➢ Ex- minimum(x,y,x):- x<=y,!.minimum(x,y,y):-x>y
➢ Cut is used to tell the interpreter to not to look for solutions when it finds
one.
OR
Q.5
(a)Explain how planning is different from search
procedure? 03
• Planning is the process of computing several steps of a problem-solving procedure
before executing any of them
• This problem can be solved by search
• The main difference between search and planning is the representation of states
• In search, states are represented as a single entity (which may be quite a complex
object, but its internal structure is not used by the search algorithm). Whereas in
planning, states have structured representations (collections of properties) that are
used by the planning algorithm.
• Planning only do predictions and just tells us the outcomes but searching need
coding that's why it has 100 actions.
(b)Compare DFS and BFS. 04
(c)Write a Prolog program to merge two sequentially
ordered (ascending) lists into one ordered list. 07
ANSWER:-
merge([],[],[]).
merge([X],[],[X]).
merge([],[Y], [Y]).
merge([X|List1],[Y|List2],[X|List]) :-
X <= Y,!,
merge(List1, [Y|List2], List).
merge([X]List1],[Y|List2],[Y|List]) :-
merge([X|List1], List2,List).