Unit - 1
Introduction
Q1) Introduce AI?
A1) In today's world, technology is growing very fast, and we are getting in touch with different new technologies day by day.
Here, one of the booming technologies of computer science is Artificial Intelligence which is ready to create a new revolution in the world by making intelligent machines. The Artificial Intelligence is now all around us. It is currently working with a variety of subfields, ranging from general to specific, such as self-driving cars, playing chess, proving theorems, playing music, Painting, etc.
AI is one of the fascinating and universal fields of Computer science which has a great scope in future. AI holds a tendency to cause a machine to work as a human.
Fig 1: Example
Artificial Intelligence is composed of two words Artificial and Intelligence, where Artificial defines "man-made," and intelligence defines "thinking power", hence AI means "a man-made thinking power."
So, we can define AI as:
"It is a branch of computer science by which we can create intelligent machines which can behave like a human, think like humans, and able to make decisions."
Artificial Intelligence exists when a machine can have human based skills such as learning, reasoning, and solving problems With Artificial Intelligence you do not need to preprogram a machine to do some work, despite that you can create a machine with programmed algorithms which can work with own intelligence, and that is the awesomeness of AI.
It is believed that AI is not a new technology, and some people says that as per Greek myth, there were Mechanical men in early days which can work and behave like humans.
Why Artificial Intelligence?
Before Learning about Artificial Intelligence, we should know that what is the importance of AI and why should we learn it. Following are some main reasons to learn about AI:
● With the help of AI, you can create such software or devices which can solve real-world problems very easily and with accuracy such as health issues, marketing, traffic issues, etc.
● With the help of AI, you can create your personal virtual Assistant, such as Cortana, Google Assistant, Siri, etc.
● With the help of AI, you can build such Robots which can work in an environment where survival of humans can be at risk.
● AI opens a path for other new technologies, new devices, and new Opportunities.
What Comprises to Artificial Intelligence?
Artificial Intelligence is not just a part of computer science even it's so vast and requires lots of other factors which can contribute to it. To create the AI first we should know that how intelligence is composed, so the Intelligence is an intangible part of our brain which is a combination of Reasoning, learning, problem-solving perception, language understanding, etc.
To achieve the above factors for a machine or software Artificial Intelligence requires the following discipline:
● Mathematics
● Biology
● Psychology
● Sociology
● Computer Science
● Neurons Study
● Statistics
Fig 2: Factors of Artificial intelligence
Q2) Write the advantages of AI?
A2) Following are some main advantages of Artificial Intelligence:
● High Accuracy with less errors: AI machines or systems are prone to less errors and high accuracy as it takes decisions as per pre-experience or information.
● High-Speed: AI systems can be of very high-speed and fast-decision making, because of that AI systems can beat a chess champion in the Chess game.
● High reliability: AI machines are highly reliable and can perform the same action multiple times with high accuracy.
● Useful for risky areas: AI machines can be helpful in situations such as defusing a bomb, exploring the ocean floor, where to employ a human can be risky.
● Digital Assistant: AI can be very useful to provide digital assistant to the users such as AI technology is currently used by various E-commerce websites to show the products as per customer requirement.
● Useful as a public utility: AI can be very useful for public utilities such as a self-driving car which can make our journey safer and hassle-free, facial recognition for security purpose, Natural language processing to communicate with the human in human-language, etc.
Q3) Write the disadvantages of AI?
A3) Every technology has some disadvantages, and the same goes for Artificial intelligence. Being so advantageous technology still, it has some disadvantages which we need to keep in our mind while creating an AI system. Following are the disadvantages of AI:
● High Cost: The hardware and software requirement of AI is very costly as it requires lots of maintenance to meet current world requirements.
● Can't think out of the box: Even we are making smarter machines with AI, but still they cannot work out of the box, as the robot will only do that work for which they are trained, or programmed.
● No feelings and emotions: AI machines can be an outstanding performer, but still it does not have the feeling so it cannot make any kind of emotional attachment with human, and may sometime be harmful for users if the proper care is not taken.
● Increase dependency on machines: With the increment of technology, people are getting more dependent on devices and hence they are losing their mental capabilities.
● No Original Creativity: As humans are so creative and can imagine some new ideas but still AI machines cannot beat this power of human intelligence and cannot be creative and imaginative.
Q4) Write the goal of AI?
A4) Goals of Artificial Intelligence
Following are the main goals of Artificial Intelligence:
- Replicate human intelligence
- Solve Knowledge-intensive tasks
- An intelligent connection of perception and action
- Building a machine which can perform tasks that requires human intelligence such as:
- Proving a theorem
- Playing chess
- Plan some surgical operation
- Driving a car in traffic
- Creating some system which can exhibit intelligent behavior, learn new things by itself, demonstrate, explain, and can advise to its user.
Q5) Write the problems of AI?
A5) The following are some of the significant issues with Artificial Intelligence, as well as potential solutions.
Safety problem
There has always been a lot of talk about the dangers of artificial intelligence. When professionals like as Elon Musk, Stephen Hawking, and Bill Gates, among others, voice concern about AI's safety, we should pay attention. Artificial Intelligence has gone awry in the past, such as when a Twitter Chabot started spewing hateful and pro-Nazi views, and when Facebook AI bots started talking with each other in a language no one else could comprehend, resulting in the project being shut down.
There are serious concerns that Artificial Intelligence will do harm to humanity. Self-driving weaponry, for example, can be programmed to kill other humans. There are also immediate fears of AI creating its own "Mind of its Own" and disregarding human life. It will be extremely difficult to reverse the effects of such weapons if they are used. The measures that can be performed to alleviate these concerns are as follows.
● We need strict controls, particularly when it comes to the development or testing of autonomous weaponry.
● To ensure that no one gets caught up in the rat race, global cooperation on issues involving such weapons is required.
● To ensure that such technologies are used safely, complete transparency in the system where they were tested is required.
Trust Related Problem
As Artificial Intelligence algorithms get more powerful by the day, it raises various trust-related concerns about its ability to make fair and beneficial judgments for humanity. The issue of trust becomes much more important as AI approaches human-level cognitive capacities. There are a number of applications in which AI acts as a black box. For example, even programmers in high-frequency trading don't fully comprehend the premise on which AI performed the trade.
Some of the more striking examples include Amazon's AI-based same-day delivery algorithm, which was inadvertently biassed against black neighbourhoods, and Correctional Offender Management Profiling for Alternative Sanctions (COMPAS), where the Artificial Intelligence algorithm was biassed against the black community while profiling suspects.
Job loss problem
Concerns about job loss as a result of AI have been the subject of various business cases and academic investigations. According to an Oxford study, by the mid-2030s, more than 47 percent of American jobs will be threatened by automation. Artificial Intelligence technology will replace more than 75 million jobs by 2022, according to the World Economic Forum. Some of the numbers are much more ominous. According to another Mckinsey report, AI-based robots might eventually displace 30% of the worldwide workforce.
In the next 10-15 years, according to AI specialist and Venture Capitalist Kai-Fu Lee, AI-based bots would replace 40% of all occupations on the planet. This shift will disproportionately affect low-wage and low-skilled people. Even well-paid, high-skill workers are becoming more exposed to job losses as AI becomes smarter by the day, as corporations gain better profits by automating their labour, given the high cost of trained workers. However, the following strategies can be used to address the concerns of job loss and income stagnation.
● Restructuring the educational system to place a greater emphasis on abilities such as critical thinking, creativity, and innovation, which are difficult to duplicate.
● Increasing governmental and private investment in human capital development so that it is more closely matched with industry demand.
● Bridging the demand-supply gap and boosting the gig economy to improve the labour market's status.
Ethical Challenge
Ethics and morality are one of the fundamental AI issues that have yet to be resolved. The developers' technological grooming of AI bots to the point where they can flawlessly simulate human conversations is making it increasingly difficult to distinguish between a computer and a real customer support representative.
Based on the training supplied to it, an artificial intelligence programme makes predictions. The programme will label items according to the data assumptions it was trained on. As a result, it will simply ignore the correctness of data; for example, if the algorithm is trained on data that indicates racism or sexism, the forecast output will reflect this rather than automatically correcting it. Some contemporary algorithms have mistakenly categorised black persons as "gorillas." As a result, we must ensure that the algorithms are fair, particularly when they are deployed by private and corporate entities.
Q6) Explain AI techniques?
A6) Intelligence necessitates knowledge, yet knowledge has undesirable characteristics such:
● It is large
● it is difficult to characterise precisely
● it is continually changing
● It differs from data in that it is organised in a way that is appropriate for its intended use.
An AI methodology is a method that uses represented knowledge to solve problems.
● The knowledge captures generalisations; situations that have similar qualities are grouped together rather than being represented separately.
● It is understandable to those who must offer it, despite the fact that for many applications, the majority of the data is generated automatically, such as from readings. In many AI disciplines, people must provide knowledge to programmes in a format that they understand and that the programme accepts.
● It's simple to change to fix errors and reflect changes in real-world conditions.
● Even if it is partial or wrong, it can be widely used.
● It can be used to help overcome its own enormity by reducing the number of options that must normally be explored.
Artificial Intelligence is classified into several categories based on the machine's ability to forecast future judgments based on prior experiences, memory, and self-awareness. Deep Blue is a chess programme developed by IBM that can recognise the pieces on the chessboard. However, it lacks the ability to foresee future behaviours due to a lack of memory. Although this system is useful, it cannot be modified to a different context. Another sort of AI system that predicts decisions based on past experiences and has the benefit of a limited memory. Self-driving automobiles, for example, have decision-making functions that are an example of this type of AI system.
The observations aid in the quick actions that must be made, but they are not saved permanently because the observations change often. At the same time, technological advancements may make it feasible to create machines that have a sense or consciousness, allowing them to understand the existing state of affairs and infer what has to be done. Such systems, however, do not exist.
Fig 3: Artificial intelligence technique
The following are the various Artificial Intelligence categories:
Machine learning
It's one of the AI applications in which machines aren't expressly programmed to execute specific tasks, but instead learn and improve via experience. Deep learning is a type of machine learning that uses artificial neural networks to make predictions. Unsupervised Learning, Supervised Learning, and Reinforcement Learning are examples of machine learning algorithms. The algorithm in Unsupervised Learning does not use classified data to operate on it without any direction. It deduces a function from the training data, which consists of a set of an input object and the intended output in Supervised Learning. Machines utilise reinforcement learning to take appropriate activities to improve the reward in order to determine the best option that should be considered.
Natural language processing (NLP)
It is the interaction of computers with human language in which the computers have been programmed to process natural languages. Machine Learning is a dependable tool for extracting meaning from human languages in Natural Language Processing. The audio of a human conversation is collected by the computer in NLP. After then, there is an audio to text conversation, and the text is processed, and the data is converted into audio. The machine then responds to humans using the audio.
Natural Language Processing is used in contact centre IVR (Interactive Voice Response) programmes, language translation applications like Google Translate, and word processors like Microsoft Word to evaluate the quality of grammar in text. However, because of the rules required in transmitting information via natural language, which are difficult for computers to understand, the nature of human languages makes Natural Language Processing challenging. As a result, NLP employs algorithms to recognise and abstract the rules of natural languages, allowing unstructured data from human languages to be translated into a computer-readable format.
Machine vision
Visual data can be captured and analysed by machines. Cameras are used to capture visual data, and analogue to digital conversion is used to transform the image to digital data, which is then processed via digital signal processing. After that, the data is fed into a computer. Two critical characteristics of machine vision are sensitivity, or the machine's ability to detect weak signals, and resolution, or the range over which the machine can differentiate objects. Machine vision is used in signature recognition, pattern recognition, and medical picture analysis, among other things.
Automation and Robotics
The goal of automation is to have machines perform monotonous and repetitive work, resulting in increased production and more cost-effective and efficient results. In automation, several companies employ machine learning, neural networks, and graphs. Using CAPTCHA technology, such automation can prevent fraud during online financial transactions. Robotic process automation is designed to execute high-volume, repetitive activities while adapting to changing conditions.
Q7) What do you mean by problem solving?
A7) The AI reflex agent converts states into actions. When these agents fail to work in an environment where the state of mapping is too vast for the agent to handle, the stated problem dissolves and is delivered to a problem-solving domain, which divides the large stored problem into smaller storage areas and resolves them one at a time. The desired objectives will be the final integrated action.
Different sorts of issue-solving agents are defined and used at an atomic level without any internal state observable with a problem-solving algorithm based on the problem and their working domain. By describing problems and many solutions, the problem-solving agent executes precisely. So we may say that issue solving is a subset of artificial intelligence that includes a variety of problem-solving approaches such as tree, B-tree, and heuristic algorithms.
Because they immediately transfer states to actions, reflex agents are characterised as the simplest agents. Unfortunately, these agents are unable to function in situations where the mapping is too huge to store and learn. On the other hand, a goal-based agent considers future behaviours as well as the desired outcomes.
The problem-solving agent is a sort of goal-based agent that uses atomic representation and has no internal states observable to the problem-solving algorithms.
AI issue-solving steps: The nature of humans and their actions is closely related to the challenge of AI. As a result, we require a set of defined steps to solve an issue, which makes human labour simple.
These are the steps that must be completed in order to solve a problem:
Goal Formulation: This is the first and most basic stage in fixing an issue. It organises discrete steps to establish a target/goals that necessitate some action in order to be achieved. AI agents are currently used to formulate the goal.
Formulation of the Problem: It is one of the most important elements in the
Problem-solving: process since it determines what action should be performed to attain the stated goal. This essential aspect of AI is reliant on a software agent, which consists of the components listed below to formulate the linked problem.
Components needed to formulate the problem:
Initial state: This state necessitates a beginning state for the task, which directs the AI agent toward a predetermined goal. In this condition, new methods also initialise a specific class to solve the problem domain.
Action: In this stage of issue formulation, all feasible actions are performed using a function with a specific class taken from the initial state.
Transition: In this step of issue formulation, the actual action taken by the previous action stage is combined with the final stage to be passed on to the next stage.
Goal test: This stage determines if the integrated transition model achieved the specified goal or not; if it did, stop the activity and move on to the next stage to calculate the cost of achieving the goal.
Path costing: is a component of problem-solving that assigns a numerical value to the expense of achieving the goal. It necessitates the purchase of all necessary hardware, software, and human labour.
Q8) What do you mean by problem space and search?
A8) A directed graph represents a problem space, with nodes representing the search state and paths representing the operators used to alter the state.
It is often helpful to logically and programmatically represent a problem area as a tree to simplify search techniques.
A tree reduces the complexity of a search but comes at a cost. The cost is due to the fact that some nodes on the tree were linked multiple times in the network; for example, node B and node D in the example below.
A tree is a graph with exactly one path connecting any two vertices. A tree, on the other hand, is any connected graph with no cycles.
Fig 4: Example
The steps for creating a system to tackle an issue are as follows:
● Clearly define the problem, including full requirements and what constitutes a satisfactory solution;
● Examine the problem thoroughly because some aspects may have a significant impact on the solution approach chosen;
● Isolate and express the background knowledge required for the problem's solution;
● In the solution, select the most effective problem-solving strategies.
Defining the Problem as state Search
The term 'state' is commonly used to describe problems in artificial intelligence. A state describes the state of the solution at a specific point in the problem-solving process. As a result, an issue's solution is a collection of problem states. To get the next state, the problem-solving technique applies an operator to a state. The generated state is then subjected to another operator to produce a new state. As a result, the process of applying an operator to a state and then transitioning to the next state is repeated until the objective (desired) state is obtained.
The state space approach is a term used to describe such a method of issue resolution. For example, to address the problem of playing a game, which is limited to two-person table or board games, we'll need the game's rules and winning targets, as well as a way to describe positions in the game. The initial state is the starting position, and the winning position is the target state; there might be more than one. Transfers from the original state to other states on the way to the goal state are possible thanks to legal manoeuvres. However, most games, particularly chess, have much too many rules, which surpass the number of particles in the universe by a factor of ten.
As a result, the rules cannot be presented precisely in general, and computer programmes cannot easily handle them. Another issue is storage, but searching can be accomplished via hashing. The number of rules utilised must be kept to a minimum, and the set can be created by stating each rule as broadly as feasible. The depiction of games in this manner results in a state space representation, which is natural for well-structured games. This representation enables the formal specification of a problem requiring movement from a set of initial positions to one of a set of target positions. It means that the solution involves using known techniques and a systematic search. This is quite a common method in AI.
Q9) Define the problem as state space search?
A9) The state space search representation is the foundation of the majority of AI methods. In two fundamental respects, its structure corresponds to the structure problem solving.
It allows for a formal statement of an issue as the requirement to change one circumstance into another using a set of allowed operations.
It allows us to define the process of solving a specific problem as a mix of recognised procedures and search. The broad method of traversing space in order to identify a path from one state to another that is good.
Search is a critical step in solving a difficult problem for which no other direct methods exist.
The following steps must be taken in order to offer a formal description of a problem:
● Define a state space that encompasses all of the relevant objects' potential configurations.
● Within that space, specify one or more states that depict a conceivable condition in which the problem-solving process could begin. These are known as the first states.
● Specify one or more states that would be acceptable as a problem solution. These are referred to as goal states.
● Create a collection of rules that describe the possible actions (operators).
Water Jug Problem
Problem:
You are handed two jugs as a problem. One with a capacity of 4 gallons and another with a capacity of 3 gallons. Neither is equipped with a measuring device. The jugs can be filled with water with the help of a pump. How do you get 2 gallons of water into a 4 gallon jug exactly?
Solution:
For this problem, the state space is a collection of ordered pairs of integers (x, y) with x = 0, 1, 2, 3, 4 and y = 0, 1, 2, 3. The figures x and y reflect the number of gallon of water in a 4 gallon jug and a 3 gallon jug, respectively. The initial condition is (0, 0). Because the issue does not specify how many gallon must be in the 3 gallon jug, the objective state is (2, n) for any value of n.
Production Rule of water jug problem
Assumptions
We've assumed that we can fill a jug with water from the pump and then spill the water onto the ground. There is no such thing as a measuring device:
Example of a Solution:
Production Systems
The structure for tackling the AI problem is provided by the production system. It consists of the following:
● A set of rules with a left side that establishes application and a right side that details the operation to be carried out.
● One or more knowledge/databases that convert whatever information is needed for the task at hand.
● A control strategy that specifies the sequence in which the rules are compared to the database, as well as a method for resolving conflicts that happen when multiple rules match at the same time.
● A rule applier.
Q10) Write the problem characteristics?
A10) Different aspects of representation and explanation may be present in a problem. It is vital to assess the problem along numerous critical dimensions in order to select the most effective approach for a given challenge.
It is required to examine the problem using various key aspects in order to determine the most effective method for a given problem:
● Is it possible to break the problem down into smaller, easier subproblems?
● Is it possible to disregard or employ solution steps?
● Is the universe of problems predictable?
● Is the best answer to the problem evident when compared to all other possibilities?
● Is the desired outcome a state word or a state path?
● Is a huge quantity of knowledge required to solve the problem, or is it only necessary to limit the search?
Q11) Explain tic tac toe problem?
A11) Tic Tac Toe is also known as Noughts and Crosses or Xs and Os, and it is a game in which players take turns marking spaces in a 3x3 grid with their own marks. If three consecutive marks (Horizontal, Vertical, and Diagonal) are made, the player who owns these movements wins.
Tic-Tac-Toe is a basic two-player game that we used to enjoy as youngsters (especially in boring classrooms). In this game, two players compete to place their respective emblems in a 3x3 grid. The game is won by the person who can line up three of their symbols in a horizontal, vertical, or diagonal row. If neither player succeeds, the game finishes in a tie. If both players always use their best strategy, the game will always finish in a tie.
Fig 5: Tic tac toe board
Because the grid is small and there are only two players, the number of possible moves for each board state is minimal, allowing Tree-based search techniques such as Alpha-Beta pruning to provide a computationally practical and accurate solution for creating a Computer-based Tic-Tac-Toe player.
We look at an approximation (Learning-based) method to the same game in this post. Even if a superior approach (Alpha-beta pruning) exists, the approximate method presents an alternative that could be useful if the board's complexity grows. In addition, the code changes required to implement it would be minor.
Tic-tac-toe is a popular game in which two players, X and O, alternate marking places in a 33-square grid. The game is won by the player who can line up three of their markings in a vertical, horizontal, or diagonal row.
Fig 6: Tic tac toe game
Properties
From a mathematical standpoint, the game has two key characteristics:
Property 1: The game acknowledges that the person who employs this optimal approach will win or tie, but not lose.
Property 2: The number of different possible matches is limited.
Algorithm
The Alpha Beta search is a practical and general algorithm for winning/drawing the game, based on qualities 1 and 2.
At each turn, the algorithm considers all of the possible outcomes of each move (which are feasible owing to property 2) and selects the one that will result in a win or a tie (possible due to property 1).
An AI player who uses the alpha beta search method to choose each move will never lose. To make the game more realistic, add a stochastic feature so that the AI player moves randomly rather than following the alpha beta algorithm each time with a predetermined probability. This will add realism to the game by making the AI player more human, and it will occasionally lose.
Q12) Describe Prolog?
A12) Prolog is that of a logic programming language. It has important role in that of the artificial intelligence. Unlike many of the other programming languages, Prolog is intended primarily as that of a declarative programming language. In prolog, logic is expressed as the relations (called as Facts and Rules). Core heart of prolog lies at that of the logic being applied. Formulation or Computation is carried out by running that of a query over these relations.
Installation in Linux:
Open a terminal (Ctrl+Alt+T) and type:
Sudo apt-get installs swi-prolog
Syntax and Basic Fields:
In prolog, we declare some of the facts. These facts constitute that of the Knowledge Base of the system. We can query against that of the Knowledge Base. We get output as the affirmative if our query is already in that of the knowledge Base or it is implied by Knowledge Base, otherwise we get that of the output as negative. So, Knowledge Base can be considered same to database, against which we can query. Prolog facts are expressed in that of the definite pattern. Facts contain entities and their relation. Entities are written within the parenthesis separated by that of the comma (,). Their relation is expressed at the start and outside the parenthesis. Every fact/rule ends with a dot (.). So, a typical prolog fact goes as follows they are:
Format: relation (entity1, entity2, k’th entity).
Example:
Friends (raju, Mahesh).
Singer (sonu).
Odd number (5).
Explanation:
These facts can be interpreted as:
Raju and Mahesh are friends.
Sonu is a singer.
5 is an odd number.
Key Features:
1. Unification: The basic idea is that the given terms be made to represent that of the same structure.
2. Backtracking: When a task fails the prolog traces backwards and then tries to satisfy previous task.
3. Recursion: Recursion is that of the basis for any search in program.
Running queries:
A typical prolog query can be asked as:
Query 1: ? -singer(sonu).
Output: Yes.
Explanation: As our knowledge base contains the above fact, so output was 'Yes', otherwise
it would have been 'No'.
Query 2: ?- odd_number(7).
Output: No.
Explanation: As our knowledge base does not contain the above fact, so output was 'No'.
Applications:
Prolog is highly used in that of the artificial intelligence(AI). Prolog is also used for the pattern matching over that of the natural language parse trees.
Q13) Write the advantages and disadvantages of Prolog?
A13) Advantages:
1. Easy to build the database. Doesn’t need a lot of the programming effort.
2. Pattern matching is very easy. Search is the recursion based.
3. It has built in that of the list handling. Makes it easier to play with any of the algorithm involving lists.
Disadvantages:
1. LISP (another logic programming language) dominates over that of the prolog with respect to I/O features.
2. Sometimes input and output is not so easy.
Q14) Define LISP?
A14) Lisp is a group of computer programming languages that first appeared in 1958 and has subsequently evolved into other dialects. After Fortran, it is the second-oldest high-level programming language in use today.
Because linked lists are part of key data structures and the source code is made up of lists, the name "Lisp" is derived from "list processing." Because of its origins, Lisp was initially spelled "LISP" as an abbreviation.
LISP was created by John McCarthy in 1958, shortly after FORTRAN was developed. Steve Russell was the first to implement it on an IBM 704 computer.
Because it effectively processes symbolic information, it is particularly well suited for Artificial Intelligence applications.
During the 1980s and 1990s, Common Lisp was created in an attempt to bring together the work of numerous implementation groups that were successors to Maclisp, such as ZetaLisp and NIL (New Implementation of Lisp), among others.
It acts as a universal language that may be easily customised for unique implementation.
Common LISP programmes are not affected by machine-specific properties such as word length.
Because of the intersection of LISP and AI work at MIT, and because AI systems capable of "learning" could be written in LISP as self-modifying programmes, LISP became a frequent language for artificial intelligence (AI) development. Scheme and Common LISP are two dialects of LISP that have evolved through time.
Applications built in LISP
Lisp-based applications with a lot of success.
● Emacs
● G2
● AutoCad
● Igor Engraver
● Yahoo Store
Q15) Write the features of LISP?
A15) Features of LISP
● It is not dependent on any particular machine.
● It employs an iterative design process and is easily extensible.
● It allows for dynamic programme updates.
● It has a high level of debugging.
● It has advanced object-oriented programming capabilities.
● It comes with a handy macro system.
● Objects, structures, lists, vectors, customizable arrays, hash-tables, and symbols are just a few of the data types available.
● It is based on expressiveness.
● It has a condition system that is object-oriented.
● It comes with a comprehensive I/O library.
● It has a lot of control structures.
Q16) Name the areas in which Prolog programming language is used?
A16) Following are some areas in which prolog is used:
Intelligent database retrieval
Natural language understanding
Expert systems
Specification language
Machine learning
Robot planning
Automated reasoning
Problem solving
Q17) Write a sample program in prolog language?
A17) Here is an example of Sample programming language by displaying the message
“Hello”:
SOURCE CODE
// the main program (this is a comment)
Hello:-
Nl,
Write(‘Hello !’ ).
}
Q18) How backtracking in Prolog is done?
A18) BACKTRACKING IS DONE AS FOLLOWS IN PROLOG:
Example:
Who does ROBIN teach?
?- lectures(ROBIN, Course), studies(Student, Course).
Course = 9311
Student = jack;
Course = 9314
Student = jill;
Course = 9314
Student = henry;
Prolog solves this problem by proceeding left to right and then backtracking.
When given the initial query, Prolog starts by trying to solve
Lectures(ROBIN, Course).
There are six lectures clauses, but only two have ROBIN as their first argument.
Prolog uses the first clause that refers to ROBIN: lectures(ROBIN, 9311).
With Course = 9311, it tries to satisfy the next goal, studies(Student, 9311).
It finds the fact studies(jack, 9311). And hence the first solution: (Course = 9311, Student = jack).
Q19) Give an example of using structures in Prolog?
A19) Functional terms can be used to construct complex data structures.Here is the example. Of using structure in PROLOG:
How do we ask, “What books does John own that were written by someone called LeGuin”?
?- owns(john, book(Title, author(leguin, GivenName))).
Title = 'Tehanu'
GivenName = ursula
What books does John own?
?- owns(john, Book).
Book = book('Tehanu', author(leguin, ursula))
What books does John own?
?- owns(john, book(Title, Author)).
Title = 'Tehanu'
Author = author(leguin, ursula)
Prolog performs a complex matching operation between the structures in the query and those in the clause head.
Q20) What are the features of Prolog language?
A20) FOLLOWING ARE THE FEATURES OF PROLOG LANGUAGE:
Intelligent Systems – programs which perform useful tasks by utilizing artificial intelligence techniques.
Expert Systems – intelligent systems which reproduce decision-making at the level of a human expert.
Natural Language Systems – which can analysis and respond to statements made in ordinary language as opposed to approved keywords or menu selections.
Relational Database Systems.