Computation Club: Predicate calculus  The big picture  Humans can use logical reasoning to draw conclusions and prove things. Is it possible to teach  computers to do this automatically? Yes it is! We just need a language for writing logical  statements and rules for manipulating them. 

The main pieces  ● ● ● ● ● ●





Predicate calculus  is a simple formal language for making statements about the world.  Clausal form  is a restricted subset of predicate calculus.  Any predicate calculus statement can be converted to clausal form via a series of  mechanical transformations.  Two matching clausal form statements can be combined to make a new statement by  using the  resolution  rule.  Even if two statements don’t exactly match, they can sometimes be made to match by  using the  unification  algorithm.  We can prove a statement ( theorem ) by assuming some initial statements ( axioms ),  then assuming the  negation  of the theorem, then using resolution to get to a  contradiction .  For example, we can use this technique to solve the “a man, a wolf, a goat and a  cabbage crossing the river” puzzle, by expressing the rules as axioms and using them to  prove the theorem that everyone can reach the other side.  All of this can be done automatically by a computer. 

Predicate calculus (a.k.a. “first­order logic”)  Syntax  Terms : constants, variables, functions on terms  Formulas : predicates on terms (“atomic formula”), ∧ (“and”), ∨ (“or”), → (“implies”), ~ (“not”), ∀  (“for all”), ∃ (“there exists”)       

Semantics  ● ● ●







The logical connectives (∧, ∨, →, ~) have a built­in meaning (standard truth tables)  The quantifiers (∀, ∃) have a built­in meaning too  The other symbols don’t mean anything by themselves  ○ e.g. we can’t say whether the formula “∀x(∀y(P(x, f(y))))” is true or false, because  it depends what “P” and “f” mean  We need an  interpretation  to give meaning to the predicates and functions  ○ interpretation = a “universe” of values + an interpretation function  ○ the interpretation function maps predicates onto relations (i.e. boolean­valued  functions) on U, functions onto functions in U ­> U  ○ think of the interpretation function as “the method definitions” for the predicate  and function names: each predicate is implemented as a method that returns  booleans, each function is implemented as a method that returns values  satisfiable  means “this formula is true under  some  interpretation”  ○ e.g. “∀x(∃y(P(x, y)))” is true when P means “less than” and the universe is  integers  valid  means “this formula is true under  all  interpretations”  ○ e.g. “∀x(P(x) ∨ ~P(x))” is true regardless of what P means 

  See  https://en.wikipedia.org/wiki/First­order_logic  for more details. 

Implies  “X → Y” means “X implies Y”, or “if X then Y”:    X 



X → Y 

























  e.g. assuming the statement “it’s night time → it’s dark” is true, then:  ● if it’s night time then it  must  be dark;  ● if it’s not dark then it  must not  be night time;  ● if it’s not night time then we  don’t know  whether it’s dark;  ● if it’s dark then we  don’t know  whether it’s night time.    See  https://en.wikipedia.org/wiki/Material_conditional  for more details. 

Clausal form (a.k.a. “conjunctive normal form”)  A formula in clausal form contains only ∨ and ~ and atomic formulas, e.g. “A(x) ∨ ~B(x) ∨ C(y)”.    We can convert any predicate calculus formula into clausal form by applying some mechanical  transformations:    ● eliminate →  ● move ~ down to atomic formulas  ● eliminate ∃ ( Skolemization )  ● move ∀ left  ● move ∨ down to atomic formulas  ● eliminate ∧ by breaking into separate clauses  ● remove all ∀ (they are implied)    After these transformations, our entire “knowledge base” is represented as one big  conjunctive  normal form  (CNF) expression. (We know that the first clause is true  and  the second clause is  true  and  the third clause is true  and …)    See  https://en.wikipedia.org/wiki/Conjunctive_normal_form  for more details. 

Transformations  De Morgan’s laws  for ∧ and ∨:  ● ~(X ∧ Y) ≡ (~X ∨ ~Y)  ● ~(X ∨ Y) ≡ (~X ∧ ~Y)  for ∀ and ∃:  ● ∀x(P(x)) ≡ ~∃x(~P(x))  ● ∃x(P(x)) ≡ ~∀x(~P(x))    See  https://en.wikipedia.org/wiki/De_Morgan%27s_laws  for more details 

Implies  X → Y  ≡ ~(X ∧ ~Y)  ≡ ~X ∨ Y 

(from the truth table)  (by de Morgan’s laws) 

Skolemization  Skolemization lets us remove existential quantifiers by replacing existentially­quantified  variables with functions.    For example:  ● in English: “every integer has another integer that’s greater than it”  ● in predicate calculus: ∀x(∃y(LT(x, y)))  ○ interpretation: x and y are integers, “LT” means “less than”  ● but this means that there’s some way to find a larger number than any x, e.g. x + 1  ● so we can write ∀x(LT(x, f(x))) instead, where f is a function that finds a larger number  than x somehow, e.g. f(x) = x + 1  ● this Skolemized formula is satisfiable if and only if the original is    See  https://en.wikipedia.org/wiki/Skolem_normal_form  for more details. 

Resolution  Say we have two clauses that we know are true:    X ∨ A ∨ B ∨ C    and    ~X ∨ D ∨ E ∨ F    We don’t know what value X has, but atomic formulas have boolean values, so  we know it  must be either false or true . So there are two possibilities:  ● if X is false, then A ∨ B ∨ C must be true (for the first clause to be true)  ● if X is true, then D ∨ E ∨ F must be true (for the second clause to be true)    So either A ∨ B ∨ C is true, or D ∨ E ∨ F is true.    In other words, we’ve created a third clause:    A ∨ B ∨ C ∨ D ∨ E ∨ F    This is  resolution , and it always works when we have two clauses “X ∨ …” and “~X ∨ …”.    To put clauses in a suitable form for resolution, we sometimes have to use  unification , i.e. find  assignments for variables so that two clauses match in the right way. For example, if we want to  use unification on the clauses “P(x) ∨ Q(x)” and “~P(42) ∨ R(y)” we can unify the free variable x  with the constant 42 to make the first clause “P(42) ∨ Q(42)”, then apply resolution to get “Q(42)  ∨ R(y)”.    See  https://en.wikipedia.org/wiki/Resolution_(logic)  for more details. 

Proof  ● ● ●



Start with some formulas we know are true ( axioms )  Add the negation of the formula we want to prove ( theorem )  Use resolution to get to two contradictory clauses  ○ e.g. prove that Socrates is mortal  ○ axioms:  ■ all humans are mortal  ● predicate calculus: ∀x(HUMAN(x) → MORTAL(x))  ● clausal form: ~HUMAN(x) ∨ MORTAL(x)  ■ Socrates is a human  ● predicate calculus: HUMAN(“Socrates”)  ● (that’s already clausal)  ○ theorem:  ■ Socrates is mortal  ● predicate calculus: MORTAL(“Socrates”)  ● (that’s already clausal)  ○ negation of theorem:  ■ Socrates is not mortal  ● clausal form: ~MORTAL(“Socrates”)  ○ proof:  ■ resolve ~MORTAL(“Socrates”) with ~HUMAN(x) ∨ MORTAL(x)  ● unify x = “Socrates” to make clauses match  ○ ~MORTAL(“Socrates”)  ○ ~HUMAN(“Socrates”) ∨  MORTAL(“Socrates”)  ● result: ~HUMAN(“Socrates”)  ■ we have both HUMAN(“Socrates”) and ~HUMAN(“Socrates”), a  contradiction  Because negating the theorem produces a contradiction, the theorem must be true 

  This process is easy to automate. Brute force strategy: try resolving all possible pairs of  formulas until you manage to generate a new one, then repeat until you reach a contradiction or  can’t generate any more. (Smarter strategies exist.) 

Predicate calculus - GitHub

The big picture. Humans can use logical reasoning to draw conclusions and prove things. Is it possible to teach computers to do this automatically? Yes it is!

677KB Sizes 6 Downloads 211 Views

Recommend Documents

Predicate Vectors If You Must
static techniques. We implemented our optimization using LLVM [6], as part of ...... In MICRO, 2011. [4] http://developer.android.com/guide/topics/renderscript/.

Calculus on Computational Graphs: Backpropagation - GitHub
ismp/52_griewank-andreas-b.pdf)). The general .... cheap, and us silly humans have had to repeatedly rediscover this fact. ... (https://shlens.wordpress.com/),.

A Haskell Interpreter for Object Calculus - GitHub
Church numerals and encoding are used to represent data and operators in Lambda ... ers have taken to model object-oriented languages, ei- ther adapting or ...

Wittgensteinian Predicate Logic
jects by difference of signs. Hintikka has shown that predicate logic can indeed be set up in such a way; we show that it can be done nicely. More specifically, we.

Wittgensteinian Predicate Logic
provide a perspicuous cut-free sequent calculus, as well as a Hilbert-type calcu- ... U〉〉, where U, the domain or universe of U, is a nonempty set, and ..... In thus restricting the space of relevant variable assignments, Wittgensteinian semantic

Focus, Presupposition and Light Predicate Raising in ...
Jun 29, 2000 - predicate raising. Cross-linguistic variation in the paradigm then shows that the basic .... Illustration of this is given in (17):. (17) phom doong pai ...

man-44\subject-predicate-worksheets-3rd-grade.pdf
man-44\subject-predicate-worksheets-3rd-grade.pdf. man-44\subject-predicate-worksheets-3rd-grade.pdf. Open. Extract. Open with. Sign In. Main menu.

Proposition Bank: a resource of predicate-argument ...
ﺔﻣوﮐﺣﻟا. ﺔﯾدﻧﮐﻟا. ضرﻓ. رظﺣ. ﯽﻟﻋ. بزﺣ. الله. More statements were released condemning. [the Canadian government's ARG0] [decisionREL]. [to impose a ban on Hezbollah ARG1]. •Example within an LVC. ذﺧïº

Focus, Presupposition and Light Predicate Raising in ...
Jun 29, 2000 - In Cantonese in particular it is argued that the trigger for VP-raising .... the clause c-commanding the lexical descriptive core, i.e., the VP, very.

GitHub
domain = meq.domain(10,20,0,10); cells = meq.cells(domain,num_freq=200, num_time=100); ...... This is now contaminator-free. – Observe the ghosts. Optional ...

GitHub
data can only be “corrected” for a single point on the sky. ... sufficient to predict it at the phase center (shifting ... errors (well this is actually good news, isn't it?)

Calculus exercises
Approximate tna Volue c ſ Sin(f) dt asi-h errorſ 4 o, Ooooo. O. (2) Evoluole Ava old.cinc integrols or shoe divergence. (e) ſix also ax (b) fixer as. (23) Fina. -Ane values cle p al- Lonic Vn AN2 old Jingy integral cover 9s, end evoluccle it for -

Torsten - GitHub
Metrum Research Group has developed a prototype Pharmacokinetic/Pharmacodynamic (PKPD) model library for use in Stan 2.12. ... Torsten uses a development version of Stan, that follows the 2.12 release, in order to implement the matrix exponential fun