Computational Logic and Cognitive Science: An Overview Session 1: Logical Foundations Technical University of Dresden 25th of August, 2008 University of Osnabrück
Who we are Helmar Gust Interests: Analogical Reasoning, Logic Programming, E-Learning Systems, Neuro-Symbolic Integration Kai-Uwe Kühnberger Interests: Analogical Reasoning, Ontologies, Neuro-Symbolic Integration Where we work: University of Osnabrück Institute of Cognitive Science Working Group: Artificial Intelligence
Cognitive Science in Osnabrück Institute of Cognitive Science International Study Programs Bachelor Program Master Program Joined degree with Trento/Rovereto PhD Program Doctorate Program Cognitive Science Graduate School Adaptivity in Hybrid Cognitive Systems Web: www.cogsci.uos.de
Who are You? Prerequisites? Logic? Propositional logic, FOL, models? Calculi, theorem proving? Non-classical logics: many-valued logic, non-monotonicity, modal logic? Topics in Cognitive Science? Rationality (bounded, unbounded, heuristics), human reasoning? Cognitive models / architectures (symbolic, neural, hybrid)? Creativity?
Overview of the Course First Session (Monday) Foundations: Forms of reasoning, propositional and FOL, properties of logical systems, Boolean algebras, normal forms Second Session (Tuesday) Cognitive findings: Wason-selection task, theories of mind, creativity, causality, types of reasoning, analogies Third Session (Thursday morning) Non-classical types of reasoning: many-valued logics, fuzzy logics, modal logics, probabilistic reasoning Fourth Session (Thursday afternoon) Non-monotonicity Fifth Session (Friday) Analogies, neuro-symbolic approaches Wrap-up
Forms of Reasoning: Deduction, Abduction, Induction Theorem Proving, Sherlock Holmes, and All Swans are White...
Basic Types of Inferences: Deduction Deduction: Derive a conclusion from given axioms ( knowledge ) and facts ( observations ). Example: All humans are mortal. Socrates is a human. Therefore, it follows that Socrates is mortal. (axiom) (fact/ premise) (conclusion) The conclusion can be derived by applying the modus ponens inference rule (Aristotelian logic). Theorem proving is based on deductive reasoning techniques.
Basic Types of Inferences: Induction Induction: Derive a general rule (axiom) from background knowledge and observations. Example: Socrates is a human Socrates is mortal (background knowledge) (observation/ example) Therefore, I hypothesize that all humans are mortal (generalization) Remarks: Induction means to infer generalized knowledge from example observations: Induction is the inference mechanism for (machine) learning.
Basic Types of Inferences: Abduction Abduction: From a known axiom (theory) and some observation, derive a premise. Example: All humans are mortal Socrates is mortal (theory) (observation) Therefore, Socrates must have been a human (diagnosis) Remarks: Abduction is typical for diagnostic and expert systems. If one has the flue, one has moderate fewer. Patient X has moderate fewer. Therefore, he has the flue. Strong relation to causation
Deduction Deductive inferences are also called theorem proving or logical inference. Deduction is truth preserving: If the premises (axioms and facts) are true, then the conclusion (theorem) is true. To perform deductive inferences on a machine, a calculus is needed: A calculus is a set of syntactical rewriting rules defined for some (formal) language. These rules must be sound and should be complete. We will focus on first-order logic (FOL). Syntax of FOL. Semantics of FOL.
Propositional Logic and First-Order Logic Some rather Abstract Stuff
Propositional Logic Formulas: Given is a countable set of atomic propositions AtProp = {p,q,r,...}. The set of well-formed formulas Form of propositional logic is the smallest class such that it holds: p AtProp: p Form ϕ, ψ Form: ϕ ψ Form ϕ, ψ Form: ϕ ψ Form ϕ Form: ϕ Form Semantics: A formula ϕ is valid if ϕ is true for all possible assignments of the atomic propositions occurring in ϕ A formula ϕ is satisfiable if ϕ is true for some assignment of the atomic propositions occurring in ϕ Models of propositional logic are specified by Boolean algebras (A model is a distribution of truth-values over AtProp making ϕ true)
Propositional Logic Hilbert-style calculus Axioms: p (q p) [p (q r)] [(p q) (p r)] ( p q) (q p) p q p and (p q) q (r p) ((r q) (r p q)) p (p q) and q (p q) (p r) ((q r) (p q r)) Rules: Modus Ponens: If expressions ϕ and ϕ ψ are provable then ψ is also provable. Remark: There are other possible axiomatizations of propositional logic.
Propositional Logic Other calculi: Gentzen-type calculus http://en.wikipedia.org/wiki/sequent_calculus Tableaux-calculus http://en.wikipedia.org/wiki/method_of_analytic_tableaux Propositional logic is relatively weak: no temporal or modal statements, no rules can be expressed Therefore a stronger system is needed
First-Order Logic Syntactically well-formed first-order formulas for a signature Σ = {c 1,...,c n,f 1,...,f m,r 1,...,R l } are inductively defined. The set of Terms is the smallest class such that: A variable x Var is a term, a constant c i {c 1,...,c n } is a term. Var is a countable set of variables. If f i is a function symbol of arity r and t 1,...,t r are terms, then f i (t 1,...,t r ) is a term. The set of Formulas is the smallest class such that: If R j is a predicate symbol of arity r and t 1,...,t r are terms, then R j (t 1,...,t r ) is a formula (atomic formula or literal). For all formulas ϕ and ψ: ϕ ψ, ϕ ψ, ϕ, ϕ ψ, ϕ ψ are formulas. If x Var and ϕ is a formula, then xϕ and xϕ are formulas. Notice that term and formula are rather different concepts. Terms are used to define formulas and not vice versa.
First-order Logic Semantics (meaning) of FOL formulas. Expressions of FOL are interpreted using an interpretation function I: Σ A(U) I(c i ) U I(f i ) : U arity(fi) U I(R i ) : U arity(ri) {true, false} U is the called the universe or the domain A pair M = <U,I> is called a structure.
First-order Logic Semantics (meaning) of FOL formulas. Recursive definition for interpreting terms and evaluating truth values of formulas: For c {c 1,...,c n }: [[c i ]] = I(c i ) [[f i (t 1,...,t r )]] = I(f I )([[t 1 ]],...,[[t r ]]) [[R(t 1,...,t r )]] = true iff <[[t 1 ]],...,[[t r ]]> I(R) [[ϕ ψ]] = true iff [[ϕ]] = true and [[ψ]] = true [[ϕ ψ]] = true iff [[ϕ]] = true or [[ψ]] = true [[ ϕ]] = true iff [[ϕ]] = false [[ x ϕ(x)]] = true iff for all d U: [[ϕ(x)]] x=d = true [[ x ϕ(x)]] = true iff there exists d U: [[ϕ(x)]] x=d = true
First-order Logic Semantics Model If the interpretation of a formula ϕ with respect to a structure M = <U,I> results in the truth value true, M is called a model for ϕ (formal: M ϕ) Validity If every structure M = <U,I> is a model for ϕ we call ϕ valid ( ϕ) Satisfiability If there exists a model M = <U,I> for ϕ we call ϕ satisfiable Example: x y (R(x) R(y) R(x) R(y)) [valid] If x and y are rich then either x is rich or y is rich If x and y are even then either x is even or y is even
First-order Logic Semantics An example: x (N(x) P(x,c)) [satisfiable] There is a natural number that is smaller than 17. There exists someone who is a student and likes logic. Notice that there are models which make the statement false Logical consequence A formula ϕ is a logical consequence (or a logical entailment) of A = {A 1,...,A n }, if each model for A is also a model for ϕ. We write A ϕ Notice: A ϕ can mean that A is a model for ϕ or that ϕ is a logical consequence of A Therefore people usually use different alphabets or fonts to make this difference visible
Theories The theory Th(A) of a set of formulas A: Th(A) := {ϕ A ϕ} Theories are closed under semantic entailment The operator: Th : A Th(A) is a so called closure operator: X Th(X) extensive / inductive X Y Th(X) Th(Y) monotone Th(Th(X)) = Th(X) idempotent
First-order Logic Semantic equivalences Two formulas ϕ and ψ are semantically equivalent (we write ϕ ψ) if for all interpretations of ϕ and ψ it holds: M is a model for ϕ iff M is a model for ψ. A few examples: ϕ ϕ ϕ ϕ ψ ψ ϕ ϕ (ψ χ) (ϕ ψ) (ϕ χ) The following statements are equivalent (based on the deduction theorem): G is a logical consequence of {A 1,...,A n } A 1... A n G is valid Every structure is a model for this expression. A 1... A n G is not satisfiable. There is no structure making this expression true This can be used in the resolution calculus: If an expression A 1... A n G is not satisfiable, then false can be derived syntactically.
Repetition: Semantic Equivalences Here is a list of semantic equivalences (ϕ ψ) (ψ ϕ), (ϕ ψ) (ψ ϕ) (commutativity) (ϕ ψ) χ ϕ (ψ χ), (ϕ ψ) χ ϕ (ψ χ) (associativity) (ϕ (ϕ ψ)) ϕ, (ϕ (ϕ ψ)) ϕ (absorption) (ϕ (ψ χ)) (ϕ ψ) (ϕ χ) (distributivity) (ϕ (ψ χ)) (ϕ ψ) (ϕ χ) (distributivity) ϕ ϕ (double negation) (ϕ ψ) ( ϕ ψ), (ϕ ψ) ( ϕ ψ) (demorgan) ( ϕ), ( ϕ) ϕ ( ϕ) ϕ, ( ϕ) Here are some more semantic equivalences (ϕ ϕ) ϕ, (ϕ ϕ) ϕ (idempotency) ϕ ϕ (tautology) ϕ ϕ (contradiction) xϕ x ϕ, xϕ x ϕ (quantifiers) ( x ϕ ψ) x (ϕ ψ), ( x ϕ ψ) x (ϕ ψ) x(ϕ ψ) ( xϕ xψ) Etc.
Properties of Logical Systems Soundness A calculus is sound, if only such conclusions can be derived which also hold in the model In other words: Everything that can be derived is semantically true Completeness A calculus is complete, if all conclusions can be derived which hold in the models In other words: Everything that is semantically true can syntactically be derived Decidability A calculus is decidable if there is an algorithm that calculates effectively for every formula whether such a formula is a theorem or not Usually people are interested in completeness results and decidability results We say a logic is sound/complete/decidable if there exists a calculus with these properties
Some Properties of Classical Logic Propositional Logic: Sound and Complete, i.e. everything that can be proven is valid and everything that is valid can be proven Decidable, i.e. there is an algorithm that decides for every input whether this input is a theorem or not First-order logic: Complete (Gödel 1930) Undecidable, i.e. no algorithm exists that decides for every input whether this input is a theorem or not (Church 1936) More precisely FOL is semi-decidable Models The classical model for FOL are Boolean algebras
Boolean Algebras P [[P]] U if arity is 1 (or [[P]] U... U if arity > 1) x 1,...,x n : P(x 1,...,x n ) Q(x 1,...,x n ) [[P]] [[Q]] We can draw Venn diagrams: P Q Regions (e.g. arbitrary subsets) of the n-dimensional real space can be interpreted as a Boolean algebra
Boolean Algebras The power set (U) has the following properties: It is a partially ordered set with order A B is the largest set X with X A and X B A B is the smallest set X with A X and B X comp(a) is the largest set X with A X = U is the largest set in (U), such that X U for all X (U) is the smallest set in (U), such that X for all X (U)
Boolean Algebras The concept of a lattice Definition: A partial order D = <D, > is called a lattice if for each two elements x,y D it holds: sup(x,y) exists and inf(x,y) exists sup(x,y) is the least upper bound of elements x and y inf(x,y) is the greatest lower bound of x and y The concept of a Boolean Algebra Definition: A Boolean algebra is a tuple M = <D,,,,> (or alternatively <D,,,,,>) such that <D, > = <D,, > is a distributive lattice is the top and the bottom element is a complement operation
Lindenbaum Algebras The Linbebaum algebra for propositional logic with atomic propositions p and q
Normal Forms If there are a lot of different representations of the same statement Are there simple ones? Are there normal forms? Different normal forms for FOL Negation normal form Only negations of atomic formulas Prenex normal form No embedded Quantifiers Conjunctive normal form Only conjunctions of disjunctions Disjunctive normal form Only disjunctions of conjunctions Gentzen normal form Only implications where the condition is an atomic conjunction and the conclusion is an atomic disjunction
Normal Forms If there are a lot of different representations of the same statement Are there simple ones? Are there normal forms? Different normal forms for FOL (x:(p(x) y:q(x,y))) Negation normal form x:(p(x) y: q(x,y)) Only negations of atomic formulas Prenex normal form xy:(p(x) : q(x,y)) No embedded Quantifiers Conjunctive normal form p(c x ) q(c x,y) Only conjunctions of disjunctions Disjunctive normal form Only disjunctions of conjunctions Gentzen normal form q(c x,y) p(c x ) Only implications where the condition is an atomic conjunction and the conclusion is an atomic disjunction
Clause Form Conjunctive normal form. We know: Every formula of propositional logic can be rewritten as a conjunction of disjunctions of atomic propositions. Similarly every formula of predicate logic can be rewritten as a conjunction of disjunctions of literals (modulo the quantifiers). A formula is in clause form if it is rewritten as a set of disjunctions of (possibly negative) literals. Example: {{p(c x ) },{ q(c x,y)}} Theorem: Every FOL formula F can be transformed into clause form F such that F is satisfiable iff F is satisfiable
What is the meaning of these Axioms? x: C(x,x) x,y: C(x,y) C(y,x) x,y: P(x,y) z: (C(z,x) C(z,y)) x,y: O(x,y) z: (P(z,x) P(z,y)) x,y: DC(x,y) C(x,y) x,y: EC(x,y) C(x,y) O(x,y) x,y: PO(x,y) O(x,y) P(x,y) P(y,x) x,y: EQ(x,y) P(x,y) P(y,x) x,y: PP(x,y) P(x,y) P(y,x) x,y: TPP(x,y) PP(x,y) z(ec(z,x) EC(z,y)) x,y: TPPI(x,y) PP(y,x) z(ec(z,y) EC(z,x)) x,y: NTPP(x,y) PP(x,y) z(ec(z,x) EC(z,y)) x,y: NTPPI(x,y) PP(y,x) z(ec(z,y) EC(z,x))
Is This a Theorem? x,y,z: NTPP(x,y) NTPP(y,z) NTPP(x,z) Easy to see if we look at models!
Relations of Regions of the RCC-8 (a canonical model: n-dimensional closed discs)
Thank you very much!!