<<

Help Taking a step back

Logic query Languages and expressiveness Propositional logic Specification of propositional logic data Learning model Inference algorithms for propositional logic Inference in propositional logic with only definite clauses Inference in full propositional logic predictions First­order logic Specification of first­order logic Models describe how the world works (relevant to some task) Inference algorithms for first­order logic Inference in first­order logic with only definite clauses What type of models? Inference in full first­order logic Other logics Logic and probability CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 1

Some modeling paradigms Outline

State space models: search problems, MDPs, games Languages and expressiveness Applications: route finding, game playing, etc. Propositional logic Specification of propositional logic Think in terms of states, actions, and costs Inference algorithms for propositional logic Variable­based models: CSPs, Markov networks, Bayesian Inference in propositional logic with only definite networks clauses Applications: scheduling, object tracking, medical diagnosis, etc. Inference in full propositional logic Think in terms of variables and factors First­order logic Specification of first­order logic Logical models: propositional logic, first­order logic Inference algorithms for first­order logic Applications: proving , program verification, reasoning Inference in first­order logic with only definite clauses Think in terms of logical formulas and inference rules Inference in full first­order logic Other logics Logic and probability CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 2 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 3

Language

Language is a mechanism for expressing models/knowledge/ideas.

Natural languages: Desiderata: want a language than can represent complex facts English: even numbers about the world and allows for sophisticated reasoning about those German: geraden Zahlen facts...

Programming languages:

Python: def even(x): return x % 2 == 0 C++: bool even(int x) { return x % 2 == 0; }

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 4 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 5 Procedural programming languages Variable­based models

Procedural languages represent knowledge using data structures, Variable­based models are a declarative language: define algorithms manipulates data structures. constraints/factors over variables; ask any query over variables. Implicit representation? def f(positions): All students work hard. distances = [dist(pos, me) for pos in positions] John is a student. minDistance = min(distances) Therefore, John works hard. return minDistance Variable­based models would explictly represent all the students — intuitively shouldn't be necessary. Easy query: Given positions, what is minDistance? Higher­order reasoning? Hard query: Given minDistance, what are positions? John believes it will rain. Will it rain? Need a declarative language ( ) Does John believe it will not rain (assuming John is logical)? Need something more expressive to represent...

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 6 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 7

Natural languages A puzzle

A dime is better than a nickel. If John likes probability, then John likes logic. A nickel is better than a penny. Therefore, a dime is better than penny. If it is Thursday, then John likes probability or John likes logic.

General rule (transitivity): if and , then . It is Thursday. A penny is better than nothing. Nothing is better than world peace. Does John like probability? Therefore, a penny is better than world peace??? Does John like logic? Natural language is not formal, can be slippery...

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 8 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 9

Notes A puzzle Propositional logic chat demo

You get extra credit if you write a paper and you solve the Tell me some something or ask me something. I will try to convert your utterance into propositional logic and apply resolution to carry out your request. I have no personality. problems. Example: "If it rained, then the ground is wet.", "It rained.", "Is the ground wet?" Example: "(implies (or rain snow) wet)", "rain", "(or wet cold)?"

You didn't get extra credit.

You solve the problems.

Did you write a paper?

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 10 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 11 Ingredients Syntax versus semantics

Syntax: defines a set of valid formulas ( ) Syntax: what are valid expressions in the language? Semantics: Semantics: what do these expressions mean? A model describes a possible situation in the world An interpretation function mapping each Different syntax, same semantics: and model to a truth value x + y y + x Inference rules: what new formulas can be added without changing semantics ( )? Same syntax, different semantics: Inference algorithm: apply inference rules in some clever order to 3 / 2 (Python) 3 / 2 (Javascript) answer queries (is true?)

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 12 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 13

Outline Outline

Languages and expressiveness Languages and expressiveness Propositional logic Propositional logic Specification of propositional logic Specification of propositional logic Inference algorithms for propositional logic Inference algorithms for propositional logic Inference in propositional logic with only definite Inference in propositional logic with only definite clauses clauses Inference in full propositional logic Inference in full propositional logic First­order logic First­order logic Specification of first­order logic Specification of first­order logic Inference algorithms for first­order logic Inference algorithms for first­order logic Inference in first­order logic with only definite clauses Inference in first­order logic with only definite clauses Inference in full first­order logic Inference in full first­order logic Other logics Other logics Logic and probability Logic and probability CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 14 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 15

Syntax of propositional logic Syntax of propositional logic

Propositional symbols: (think variables in CSPs); these are Formula: formulas Non­formula: Logical connectives:

Build up formulas recursively—if and are formulas, so are the following: Negation: Note: formulas are just symbols — no meaning yet! Conjunction: Disjunction: Implication: Biconditional:

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 16 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 17 Model Interpretation function

A model in propositional logic is an assignment of truth values Given a formula and a model , interpretation function to propositional symbols returns either true (1) or false (0). Example: Base case: 3 propositional symbols: For a propositional symbol (e.g., ): possible models : Recursive case: For any two formulas and :

0 0 1 0 0 1 1 0 1 1 0 1 1 0 1 0 0 0 1 0 0 1 1 0 1 1 1 1

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 18 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 19

Example Formulas represent sets of models

Formula: Fach formula and model has an interpretation Model: Formula: Interpretation: Models with true interpretation :

Point: formula is symbols that compactly represent a set of models. Think of formula as putting constraints on the world.

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 20 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 21

Types of formulas Knowledge base

Validity: for all models (tautologies that provide no Let . information, e.g., )

Unsatisfiability: for all models (contradictions, e.g., ) Definition: Knowledge base A knowledge base is a set of formulas with . Contingent: neither valid nor unsatisfiable (provides information, e.g., ) Note: think conjunction:

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 22 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 23 Entailment Contradiction

Intuition: contradicts what we know (captured in ). Intuition: added no information/constraints (it was already known). Example: contradicts Definition: Entailment entails (written ) iff . Relationship between entailment and contradiction:

Example: entails ( ) iff is unsatisfiable

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 24 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 25

Contingency Interacting with a knowledge base

or response Tell: It rained. ( ) Possible responses: Already knew that: entailment ( ) Don't believe that: contradiction ( ) Intuition: adds non­trivial information to Learned something new (update knowledge base): contingent Ask: Did it rain? ( ) Possible responses: Yes: entailment ( ) No: contradiction ( ) Example: and I don't know: contingent Everything boils down to entailment (checking )...

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 26 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 27

Model checking Outline

Checking satisfiability (SAT) is special case of solving CSPs Languages and expressiveness propositional symbol variable Propositional logic formula constraint Specification of propositional logic model assignment Inference algorithms for propositional logic Inference in propositional logic with only definite A B C clauses Solving CSPs is model checking (operate over models). Inference in full propositional logic Popular algorithms: First­order logic DPLL (backtracking search) Specification of first­order logic WalkSat (Gibbs sampling) Inference algorithms for first­order logic But logic allows us to peer inside factors and exploit structure... Inference in first­order logic with only definite clauses proving operates on formulas. Inference in full first­order logic Other logics Logic and probability CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 28 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 29 Inference rules Inference framework

Example of making an inference: In general, have a set of rules with the following form: It rained. ( ) If it rained, then the ground is wet. ( ) Therefore, the ground is wet. ( ) Forward inference algorithm Repeat until no changes to : Choose set of formulas . inference rule Find matching rule . For any formulas and : Add to . Say that ( derives/proves ) if there exists sequence Key: operate on syntax, not semantics (can be more efficient). of rule applications that eventually adds to .

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 30 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 31

Soundness and completeness Soundness

What properties does a set of inference rules have? Is (Modus ponens) sound? Definition: Soundness (only prove entailed formulas) A set of rules is sound if: ? implies 0 1 0 1 0 1 Definition: Completeness (prove all entailed formulas) 0 0 0 A set of rules is complete if: 1 1 1 implies Yes! Models represented by and is subset of Point: These properties link syntax (inference rules) and semantics those represented by . (entailment).

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 32 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 33

Soundness Soundness

Is (Modus tollens) sound? Is sound?

? ?

0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 1 1 1 1 1 1

Yes! No!

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 34 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 35 Soundness Completeness

Example: Is (resolution rule) sound?

? Can verify that all is sound, but not complete...for example, given , can't infer . 0 1 0 1 0 1 0,0 0,0 0,0 What set of rules is complete? This is tricker than soundness... 0,1 0,1 0,1 Plan: 1,0 1,0 1,0 Propositional logic with only definite clauses: only need Modus 1,1 1,1 1,1 ponens Yes! Propositional logic: only need resolution rule (+ preprocessing)

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 36 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 37

Outline A restriction of propositional logic

Languages and expressiveness Assume knowledge base (KB) contains only definite clauses: Propositional logic Definition: Definite clause Specification of propositional logic A definite clause has the following form: Inference algorithms for propositional logic Inference in propositional logic with only definite clauses for propositional symbols . Inference in full propositional logic Intuition: if premises hold, then conclusion holds. First­order logic Example: Specification of first­order logic Inference algorithms for first­order logic Non­example: Inference in first­order logic with only definite clauses Non­example: Inference in full first­order logic Allowed queries to the KB: Other logics Logic and probability CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 38 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 39

Example scenario Inference rule

Suppose we have the following knowledge base: The single rule is sound and complete for propositional logic with only definite clauses: Definition: Modus ponens

Proof tree:

Queries: ? ? Each node is a formula derived from children using modus ponens, leaves are original formulas in .

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 40 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 41 Algorithms Outline

KB: Languages and expressiveness Query: Propositional logic Forward chaining: Specification of propositional logic From known , iteratively apply rules to derive new Inference algorithms for propositional logic propositions. Inference in propositional logic with only definite Proactively make new when information comes in. clauses Time: linear in size of knowledge base. Inference in full propositional logic : First­order logic Start from query and recursively derive premises that conclude Specification of first­order logic the query. Inference algorithms for first­order logic Make inferences tailored towards answering a particular query. Inference in first­order logic with only definite clauses Time: often much less than linear in size of knowledge base. Inference in full first­order logic Other logics Logic and probability CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 42 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 43

High­level strategy Resolution algorithm

Goal: determine whether Goal: determine whether is satisfiable. Example: Example: Algorithm: Algorithm (performs proof by contradiction): Convert all formulas in into conjunctive normal form. Set . Example: Example: Repeatedly apply resolution rule. Example: Run inference algorithm to check satisfiability of . Conclude iff is unsatisfiable. Example: unsatisfiable Return unsatisfiable iff derive false (0).

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 44 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 45

Conjunctive normal form Conversion to CNF

Definition: Conjunctive normal form (CNF) Goal: convert arbitrary into CNF formula A CNF formula is a conjunction of disjunctions of optional Steps (exercise: verify semantic equivalence): negations of propositional symbols. Eliminate : Eliminate : Eliminate double negation: Example: Move inwards: Move inwards: Distribute over :

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 46 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 47 Resolution rule Summary

Resolution rule A model describes a possible state of the world (e.g., ). Each formulas (e.g., ) describes a set of models (think of providing information or imposing constraints). Example: Inference rules (e.g., ) allow one to derive new formulas from old ones. Soundness/completeness links syntax and semantics. Definite clauses only: ( ) forward/backward chaining yields linear time inference. Propositional logic: ( ) resolution yields exponential time inference.

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 48 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 49

Outline Limitations of propositional logic

Languages and expressiveness Alice and Bob both know arithmetic. Propositional logic Specification of propositional logic Inference algorithms for propositional logic All students know arithmetic. Inference in propositional logic with only definite clauses Inference in full propositional logic First­order logic Specification of first­order logic Every even integer greater than 2 is the sum of two primes. Inference algorithms for first­order logic Inference in first­order logic with only definite clauses ??? Inference in full first­order logic Other logics Logic and probability CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 50 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 51

Limitations of propositional logic Outline

All students know arithmetic. Languages and expressiveness Propositional logic Specification of propositional logic Inference algorithms for propositional logic Inference in propositional logic with only definite Propositional logic is very clunky. What's missing? clauses Objects and relations: propositions (e.g., Inference in full propositional logic ) has more internal structure ( , First­order logic , ) Specification of first­order logic Inference algorithms for first­order logic Quantifiers and variables: all is a which references all Inference in first­order logic with only definite clauses people, don't want to enumerate them all... Inference in full first­order logic Other logics Logic and probability CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 52 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 53 Some examples of first­order logic Syntax of first­order logic

Alice and Bob both know arithmetic. Ingredients: Connectives from propositional logic: Constant symbols (e.g., ): refer to objects Predicate symbols (e.g., ): relate multiple objects Function symbols (e.g., ): map objects to single object All students know arithmetic. Variables (e.g., ): refers to objects Quantifiers (e.g., ): aggregate results from different assignments to variables

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 54 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 55

Syntax of first­order logic Models in first­order logic

Terms (refer to objects): constant symbol (e.g., ), Recall a model represents a possible state of affairs (mapping from variable (e.g., ), or function applied to terms (e.g., ) symbols to their interpretation). Formulas (refer to truth values): Propositional logic: Model maps propositional symbols to truth Atomic formulas: Predicate applied to terms (e.g., values. ); analogue of propositional symbol in e.g., propositional logic First­order logic: Connectives applied to formulas (e.g., Model maps constant symbols to objects ); same as e.g., propositional logic Model maps predicate symbols to tuples of objects Quantifiers applied to formulas (e.g., ) e.g.,

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 56 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 57

Notes Graph representation Database semantics (alternative)

A model as be represented a directed graph (if only have binary There are two students, John and Bob. predicates):

Definition: Unique names assumption Each object has at most one constant symbol. This rules out . Definition: Domain closure Each object has at least one constant symbol. This rules out . Nodes are objects, labeled with constant symbols Definition: Closed­world assumption Directed edges are relations, labeled with predicate symbols All atomic formulas not known (labels not present) are false.

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 58 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 59 Quantifiers Quantifiers

Universal quantification ( ): Universal quantification ( ):

Every student knows arithmetic. Think conjunction: is like

Existential quantification ( ):

Think disjunction: is like Existential quantification ( ): Some properties: Some student knows arithmetic. equivalent to different from

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 60 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 61

Notes Some examples of first­order logic Outline

There is some course that every student has taken. Languages and expressiveness Propositional logic Specification of propositional logic Inference algorithms for propositional logic Every even integer greater than 2 is the sum of two primes. Inference in propositional logic with only definite clauses Inference in full propositional logic First­order logic If a student takes a course and the course covers some concept, then Specification of first­order logic the student knows that concept. Inference algorithms for first­order logic Inference in first­order logic with only definite clauses Inference in full first­order logic Other logics Logic and probability CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 62 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 63

Outline Definite clauses

Languages and expressiveness Assume knowledge base (KB) contains only definite clauses: Propositional logic Definition: Definite clause Specification of propositional logic A definite clause has the following form: Inference algorithms for propositional logic Inference in propositional logic with only definite clauses for atomic formulas and variables that Inference in full propositional logic appear in the atomic formulas. First­order logic Example: Specification of first­order logic Inference algorithms for first­order logic Inference in first­order logic with only definite Intuition: think of first­order definite clause compactly representing clauses all instantiations of the variables (for all objects). Inference in full first­order logic Other logics CS221: ALrtioficgiali Icnt elalignendce p(Arutoumbn a20b12i)l ­i Pteyrcy Liang 64 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 65 Substitution and unification Substitution

Goal: define inference rules that work on formulas with quantifiers Definition: Substitution A substitution maps variables to constant symbols or variables. Example: returns the result of performing substitution on . Given and .

Infer ? Examples: Problem: and don't match exactly. Two concepts: Substitution: morph a formula into another Unification: make two formulas the same

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 66 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 67

Unification Inference rule

Definition: Unification Generalized modus ponens Unification takes two formulas and and returns a substitution , which is the most general unifier: such that where is the most general unifier . or fail if no exists. Example inputs: Examples:

Example result:

Derive

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 68 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 69

Forward/backward chaining Time/space complexity

If there are no function symbols, then bounded by number of Inference algorithms analogous to those for propositional logic. domain elements to the maximum arity of a predicate (3 in this case). Forward chaining: starting from known atomic formulas (e.g., If there are function symbols (e.g., ), then infinite... ), find rules whose premises unify with them, and derive conclusion. Theorem: Semi­decidability First­order logic (even restricted to only definite clauses) is semi­ Backward chaining: starting from query atomic formula (e.g., decidable. ), find rules whose conclusion unifies with If , forward/backward chaining will prove in finite time. it, and recursive on premises. If , no algorithm can show this in finite time.

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 70 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 71 Outline Resolution

Languages and expressiveness Goal: given a knowledge base, can we derive a contradiction Propositional logic (unsatisfiable)? Specification of propositional logic Inference algorithms for propositional logic Recall: First­order logic can include formulas like this (not a Inference in propositional logic with only definite definite clause) clauses Inference in full propositional logic First­order logic Specification of first­order logic High­level strategy (same as in propositional logic): Inference algorithms for first­order logic Convert all formulas to CNF Inference in first­order logic with only definite clauses Repeatedly apply resolution rule Inference in full first­order logic Other logics Logic and probability CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 72 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 73

Conversion to CNF Conversion to CNF

Input: Input: Eliminate implications (old):

Push inwards (old): Output: Standardize variables (new):

Replace existentially quantified variables with Skolem functions (new): New to first­order logic: Distribute over (old): All variables (e.g., ) have universal quantifiers by default Remove universal quantifiers (new): Introduce Skolem functions (e.g., ) to represent existential quantified variables Interpretation: represents animal that doesn't like, represents person who likes

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 74 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 75

Resolution Outline

Generalized resolution rule Languages and expressiveness Propositional logic Specification of propositional logic where . Inference algorithms for propositional logic Inference in propositional logic with only definite clauses Example: Inference in full propositional logic First­order logic Specification of first­order logic Inference algorithms for first­order logic with substitution . Inference in first­order logic with only definite clauses Inference in full first­order logic Other logics Logic and probability CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 76 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 77 Motivation Temporal logic

Goal: represent knowledge and perform inferences Barack Obama is the US president.

Why use anything besides propositional or first­order logic?

Expressiveness: George Washington was the US president. Temporal logic: express time Modal logic: express alternative worlds Higher­order logic: fancier quantifiers Some woman will be the US president. Notational convenience, computational efficiency: Description logic

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 78 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 79

Temporal logic Modal logic for propositional attitudes

Point: all formulas interpreted at a current time. Alice believes one plus one is two. The following operators change the current time and quantify over ?? it (think of as ): Alice believes Boston is a city. : held at some point in the past ?? : will hold at some point in the future Problem: is true, is true, : held at every point in the past but two are not interchangeable in this context. : will hold at every point in the future Solution: every formula interpreted with respect to a possible world, operator interprets according to Alice's world Every student will at some point never be a student again.

Model: map from time points to models in first­order logic Model: map from possible worlds to models in first­order logic

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 80 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 81

Higher­order logic: lambda calculus Description logic

Simple: People with at least three sons who are all unemployed and married to doctors, and at most two daughters who are professors...are weird. Alice has visited some museum. Lambda calculus:

More complex: Description logic: Alice has visited at least 10 museums. : boolean function representing set of museums Alice has visited Advantages: Generalized quantifiers without variables: notationally more compact Higher­order logic allows us to model these generalized quantifiers. First­order is semi­decidable, description logic is decidable

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 82 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 83 Summary of logics Outline

Propositional logic: Languages and expressiveness First­order logic: Propositional logic Specification of propositional logic Temporal / modal logic: Inference algorithms for propositional logic Description logic: Inference in propositional logic with only definite clauses Higher­order logic (lambda calculus): Inference in full propositional logic First­order logic Specification of first­order logic Inference algorithms for first­order logic Inference in first­order logic with only definite clauses Inference in full first­order logic Other logics Logic and probability CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 84 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 85

Limitations Markov logic

In logic, every formula is true or false. In reality, there is Assume database semantics. Defines Markov network: uncertainty. Random variables: First­order formula: Probability used to define joint distributions: Think of as propositional symbols A model is Equivalent propositional logic formulas: We are placing a distribution over possible worlds . Probability theory: Pro: allows us to manage uncertainty in a coherent way Con: captures propositional logic

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 86 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 87

Markov logic Summary

One parameter for each first­order formula (e.g., ) Logic is a language for expressing facts in a knowledge base is the interpretation of in Markov logic defines a Markov network: Considerations: expressiveness, notational convenience, inferential complexity

Defines distribution over possible worlds (models) Propositional logic with definite clauses, propostional logic, description logic, first­order logic, temporal logic, modal logic, All grounded instances of a formula have same parameter higher­order logic weight Can do lifted probabilistic inference for efficiency (important Markov logic: marry logic (abstract reasoning by working on for learning) formulas) and probability (maintaining uncertainty) As , get ordinary logic

CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 88 CS221: Artificial Intelligence (Autumn 2012) ­ Percy Liang 89