Artificial Intelligence: PREDICT FUTURE OUTCOMES with LOGIC - Learn AI's PROGRAMMING LANGUAGE ! | Davide Agostini | Skillshare

Playback Speed


1.0x


  • 0.5x
  • 0.75x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 1.75x
  • 2x

Artificial Intelligence: PREDICT FUTURE OUTCOMES with LOGIC - Learn AI's PROGRAMMING LANGUAGE !

teacher avatar Davide Agostini

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

    • 1.

      01 Intro

      1:16

    • 2.

      2 Reasoning

      0:30

    • 3.

      3Deductive Reasoning

      0:22

    • 4.

      4Sentences

      0:25

    • 5.

      5Connectives

      1:01

    • 6.

      6Truth Functions

      1:08

    • 7.

      7Truth Table

      0:36

    • 8.

      8NNF

      0:54

    • 9.

      9Sat Solvers

      1:31

    • 10.

      10Tutorial Z3 Online Compiler

      2:10

    • 11.

      11Tutorial Z3 Flow

      2:37

    • 12.

      12Tutorial Z3 Math Problem

      4:30

    • 13.

      13Tutorial XOR3 Function

      3:35

    • 14.

      14Simple Assertion Problem

      2:43

    • 15.

      15Distinct Variables Peoblem

      2:39

    • 16.

      16Complex Problem

      5:49

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

240

Students

2

Projects

About This Class

Use Description Logic to translate FACTS, DATA, and BELIEFS into computer-REASONABLE CONTENT, predict events and outcomes, use programs to automatically derive conclusions from LOGICALLY LINKED ASSERTIONS, check whether a phrase is SATISFIABLE, provide a truth-table to identify whose propositions holds and build a KNOWLEDGE BASE.

Artificial intelligence requires reasoning in order for the computer to think rationally and perform as well as a human brain.

In this course, every lecture will analyze a specific assignment to reinforce and apply your learned pieces of information!

Meet Your Teacher

Level: Beginner

Class Ratings

Expectations Met?
    Exceeded!
  • 0%
  • Yes
  • 0%
  • Somewhat
  • 0%
  • Not really
  • 0%

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. 01 Intro: Hi, and welcome to this artificial intelligence scores based on description logics. Today you will learn anything you need to know the start using machines language, and I will be your instructor. But first of all, why should you be interested in taking this course? Well, just to get started, ai is widely used to provide personalized experiences to people, for example, based on their previous searches or purchases or other online behavior. Ai is also important in commerce for optimizing products, planning inventory or logistics. Even security companies at began to adopt narrow networks, machine learning and natural language processing solutions to improve their system is even getting into space, and this is the perfect timing to start learning something new about artificial intelligence. Currently, spacecraft needs to communicate with Earth to do their job. And being able to develop autonomous spacecraft that take care of themselves would be very useful for exploring new parts of the solar system, but also for reducing mission costs. 2. 2 Reasoning: The mental process of extracting logical conclusions and making predictions from existing knowledge. Data, in fact, is known as reasoning. Reasoning is a way of extracting knowledge from existing data. The general process of reasoning is to arrive at valid conclusions. Artificial intelligence uses reasoning to think rationally and in order to perform as well as the human brain. 3. 3Deductive Reasoning: Deductive reasoning is the process of extracting new knowledge from previously known information that is logically linked. It is legitimate way of thinking in inductive reasoning that if the premises are true, then also the conclusion must be true. In other words, if the conclusion is true, the premises are true as well. 4. 4Sentences: Any proposition for which it makes sense to question whether it is true or untrue. This quote, a sentence. For example, Mike is jogging, it's sunny and it is windy day. If it rains, then I go to the sea. Examples of sentences. 5. 5Connectives: The words and, or if then not or but I called connectives. As a result, connectives allow you to make new sentences out of other phrases. Connectives allow you to construct sentences out of simple statements. For example, consider the phrase, it rains and it is a windy day. If we indicate with letter B, it rains and with the letter Q, it is a windy day. And in-between, we put the logical operator that refers to, and we obtain something like p and q. If it rains and Q, it is a windy day are both true, then this statement is true, or in a more precise way, satisfiable. But we will see later what satisfiable means. 6. 6Truth Functions: The first approach to basic logical problems is to investigate the issue of accuracy. For example, consider these influence problem. If it shines, then I take the bike, but I did not take your bike, so it does not shine. We want to see if the conclusion is valid. So we proceed by assigning to our prepositional letter P, The phrase, it shines, the propositional letter Q, the phrase, I take the bike. Then using connectives and our two atoms, p and q, we can start by, it can start constructing new formerly with totally different meaning. For example, we know that if it's shrines and then take the bike, I took the bike. And so we know for sure that these conclusions are valid because there's no discrepancy between the premises and the conclusion. The conclusion shows that also the premises are true. 7. 7Truth Table: The formula p and q is true if and only if both p and q are true. If we take a and b in general, that are two sentences. The formula a and B is true if and only if both a and B are true. We can see that summarized below in this table, which is called the truth table of the connective. And it summarizes what we've just said. 8. 8NNF: If a formula does not include implications and all negations appear in front of atomic formula. That formula is said to be a negation normal form, also known as N and F. On the other hand, if the formula contains only conjunction of clauses, then it is said to be in conjunctive normal form. To convert the formula to a, formula b that is logically equal to a, we just need to assign to apply these properties and just form it into an F. For example, we have here that C implies the, if we find that formula like this, we just need to transform it into Nazi or D. I hope it is clear. See you on the next lecture. 9. 9Sat Solvers: So there's our programs that use variations of the DPLL process to solve subproblems. And four, replies are just the names of the connectives that we are used to. And they must be expressed in at least like mutations. For example, B and Q will be expressed as p cubed them. To test if the formula p and not q implies r, we must first declare the variables that we're using. So p, q, and r in our sub-problem express the list black notation. So as you can see, declare const P Bu. So we are declaring constant. The digits taboo because it returns a value of truth false. After we have declared our variables, we can proceed by asserting our formula with p and not q implies r. We can see that the problem is pretty long and it is not so easy to read and understand its meaning. But you will get used to. In the end of a word file if we want to say to our SAT solver, to check for satisfiability, to check if our assertion odes, we must write checks out. 10. 10Tutorial Z3 Online Compiler: In the next lectures, we're going to deal with debt free programming language. To do so. We don't want to install in our computer complex programs or libraries. So we're going to just type on Google free online compiler that the first result is just fine. On this console, we'll be able to write the free programs. Actually get a response, a satisfiable or unsatisfiable and swear. And then additionally, we will be able to get a model to know the values or our variables. In this case, we're usually using a, B, and C as variables, just integers. We are declaring them. Next, we are telling to the compiler our constraints. So for example, we are asserting that ABC are greater than 0. Lastly, that we are just asserting formula. An algorithm. In the end. By telling the computer checks out. We're just asking for which values of a, b, and c. The formula, the final formula holds. Finally, we'd get model. The program actually tells us which values belongs to a, b, and c to make these programs satisfiable. That's, that's what satisfiability means. If formula is satisfiable, it just means that there are variables that satisfy some constraints. So that actually there is a response. 11. 11Tutorial Z3 Flow: I'm going to present you a problem and I'm going to show you degenerate process in order to obtain a satisfiable or unsatisfiable answer from our program. I'm asking you to declare a variable of name b and asks whether P AND NOT B is satisfiable. How can we do this? So, first of all, let's delete everything. Remember, the first thing that you need to do is to declare your variables. In this case, we need a variable of name be the glare fun function, name b, with no arguments of type bool. Eventually, you have typed all of your variables and then let's proceed with our constraints. Our constraint is p and naught p. Which means we're asking the problem, the program, whether P and not P contains satisfiable result. Whether it makes actually sense whether there is a value of b for which P and not P holds. Let's ask the program this by asserting our formula. So assert and eventually checks out. To ask the program for satisfiability. Let's press execute. The answer is answered. Indicates as that default molar pn naught B is not satisfiable. There is no value of b for which the assertion is true. Equivalently, the negation of P and not P is true. Not B and not B is a tautology. 12. 12Tutorial Z3 Math Problem: Today's problem consists in writing acid free solver script to find the values of x and y based on the given equations. X plus two multiplied by epsilon equals 20. X minus y equals two. Actually, well, asking the program to say satisfiable or not, whether there is a solution to those equations or not. Whether we can give to x or y some values and we can get the result, the equation. Let's actually proceed. First of all, we need to declare our variables X and Y. Declare funds X, no variables of type integer. The same goes for y. Then we need to assert our equations, our goods strains. It's a third, x plus two multiplied by y plus x multiplied by y. Sorry, y multiplied by two, actually equals to 20. Our last assertion is that x minus y equals two equals minus x y. Jak-stat. Let's see what the program says. That there is an error on line six expected. The solution is sat. As you can see, if you forget to put a bracket, then it's a problem because it's very hard to see at least the program that you wear, you forgot the bracket or rather stakes. But just put attention. The result. The problem that we did indeed have a solution, but did not say what the solution is. We got a SAP and swear, but now, what's the solution? To find a solution, one must set a couple options and the news to get value calm and after checks out, Let's use the getValue command. Get value actually devalue the variables that you give. In this case, we asked to get the value of x and y. And the program told us that x equals eight and y six. 13. 13Tutorial XOR3 Function: In this problem, I'm going to ask you to write a function that given three objects, chooses just one out of three. How can we do that? Let's go into our compiler. Let's start writing some code. In this case, we don't need to declare variables. We are just creating a function with three imaginary variables, free variables that will be swept with the real ones. Just prototypes of Bibles. Let's see how to define a function like that defined function. Let's give it a name, x over three. Because this function is going to choose just one element out of three. Just calling it, she's gonna get the result. So let's give it 23 arguments. Three is case sensitive, so remember to be very careful. And these returns the bowl. We're going to say that we're going to give to the function x, y, and z to both variables. And we're going to ask whether, whether to choose between X, Y, or Z. But we're not done yet. We need to specify not true, to not choose two variables, we just need one. So let's say that we get x and epsilon. X and epsilon. We don't want this kind of problems. We're done. I forgot the brackets. As always. This bracket goes just to resume, where it created a function with name. Free, free that accepts three variables, x, y, and z. But it could be every letter. They are just prototypes for our real variables that we are gonna swiping dysfunction. It takes three by three Boolean variables and just returns one. Then we ask, take the variables and we want just one variable out of the three out of it, x, Epsilon, y, and z. So don't choose same time, two of them, just one. 14. 14Simple Assertion Problem: Here we have a new problem. We need to assert that B and NOT Q implies R. First of all, we need to declare constants, then proceed with writing our assertions. Check for satisfiability. Let's go to our program. We need to first declare our constant. Proceed. Glare columns of type bool, just like that. Copy and paste, and then q and r. So we have a circuit, all of our variables. Let's proceed with certain them. What's the formula? List black notation implies not q. What we just implies is R. Then we close our brackets. Like that. I missed one. Nice. Let's ask the program for checking satisfiability and hope that we get the result. The answer is, maybe we could get modal fall of them are false. Then the result is satisfiable. Get value for q and r. Let's see. False. False, but not Q. X experiment. Not Q is true and R is false. 15. 15Distinct Variables Peoblem: In this new problem, we need to assert that P, Q and R, P1, Q1 and air are not the same. How can we do that? How can we tell the program that two elements are not the same thing? Let's see. First we need to declare our constants of dipole. Then that's borrowing. Let's just copy and paste six times P1, Q1, our R1. We have the glare, our variables. Now we need to serve our constraints. Our constraints that we want to say that P0 and P1 and Q1, air and Irwin are different things. Assert not be equals b1, NOT Q equals Q1 equals R1. Then we need to close everything. Basically what we just said. We need, we said that apart from everything, we don't want that P0 and P1 are treated as the same, as the same thing. They are two different things which will different values. So if it happens that Q and Q1 at the same value, then it is unsatisfiable. Let's check for SAT, satisfiability. Get full. So a model. 16. 16Complex Problem: You already saw how to express richer concepts or more complex successions. You need to introduce richer, new and richer language. And so even in the free programming language, we introduce a new tool. Name is sort n-bit creates a sort of world apart. We'd assume variables and functions. In fact, if you try to make two variables of two different sorts interact together, each other, then you get an error. Hope you got the idea. Let's proceed with the problem. With the syllogism problem. It's States before humans are mortal and Socrates is human. Then check whether the assertion Socrates is mortal volts. Obviously, we can do that by asserting simple statements or simple variables, constants. Actually. What's the plan? First, we need to declare a set. Our sort, of course in this problem, maybe it's not essential, but it's very important that you learn how to use. Let's proceed by declaring it. The glare sort. Let's call it d, or maybe I don't know, K. Then let's declare our constant for sovereignty. And that is a constant because Socrates is a person. It's not a variable. It doesn't change. Declare const mode. For Socrates, he needs to belong. You need to tell two which sort it belongs in this k. K. Then let's proceed by declaring. Now. Previously in the theory part, you saw how, for example, and cooling. For example, declaring on humans or motor, it's not possible to declare it through a single letter p. You need the function. Let's create the function for 4 million that given a certain x, that x is martyr, the glare of the sort k, return that, which returns a bool. And the same thing, given x as a variable. If these variable belongs to the function, then x is human. Later obviously, we'll put inside of that variable, our Socrates, to tell if mortar and is human. And a lot of combinations. What we have just asserted, declare fun. M and h is a unitary predicate for mortal and human. Let's proceed by asserting. We need to set that all humans are mortars. We need also to introduce new symbols, the fluorophore, which means that for all possible axis, then x is mortal. Let's proceed. Served. For over. It's written like that. We need to declare the element, which will be Socrates. If the sort key, then all humans are motor. So all x for all x implies that it is mortar, that x is mortal, that x is human, and x is also more mortar. Then we close bracket. Then we need to assert that Socrates is human. Quality is human. To type like the cert that Socrates, socrates then is not mortar. Then we can proceed by checking for satisfiability. It's, in fact, Socrates is mortal.