1 / 32

Equality Axioms {Lecture 28}

Equality Axioms {Lecture 28} Axioms are the essence of logic programming: `a collection of propositions are assumed to be axioms (i.e., universal truths) and from these axioms, a desired fact is proved by applying the rules of inference in automated way. Example of Axioms 

kareem
Download Presentation

Equality Axioms {Lecture 28}

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Equality Axioms {Lecture 28} Axioms are the essence of logic programming: `a collection of propositions are assumed to be axioms (i.e., universal truths) and from these axioms, a desired fact is proved by applying the rules of inference in automated way. Example of Axioms Defining the axioms in KB: • "Heads I win, tails you lose."(Heads => IWin) or, equivalently, (~Heads v IWin)(Tails => YouLose) or, equivalently, (~Tails v YouLose) • Equality Axioms  • There are several different conventions for using equality (or identity) in first-order logic. The most common convention, known as first-order logic with equality, includes the equality symbol as a primitive logical symbol which is always interpreted as the real equality relation. • These equality axioms are: • Reflexivity. For each variable x, x = x. • Substitution for functions. For all variables x and y, and any function symbol f, • x = y → f(...,x,...) = f(...,y,...). • Substitution for formulas. For any variables x and y and any formula φ(x), if φ' is obtained by replacing any number of free occurrences of x in φ with y, such that these remain free occurrences of y, then • x = y → (φ → φ').

  2. Resolution Strategies  [Part of Lecture 28] Unit Resolution At least one parent clause must be a "unit clause," (clause containing a single literal) Not complete in general, but complete for Horn clause KBs Input Resolution At least one parent from the original KB (axioms and the negation of the goal) Not complete in general, but complete for Horn clause KBs Linear Resolution P and Q can be resolved together if either P is in the original KB or if P is an ancestor of Q in the proof tree Complete

  3. Paramodulation  [Lecture 28] • Para-modulation • Given two sentences (P1 v ... v PN) and (t=s v Q1 v ... v QM) where each Pi and Qi is a literal and Pj contains a term t, derive new sentence (P1 v ... v Pj-1 v Pj[s] v Pj+1 v ... v PN v Q1 v ... v QM) where Pj[s] means a single occurrence of the term t is replaced by the term s in Pj • Example: From P(a) and a=b derive P(b • Para-modulation is just like one of the Inference Rules in FOL.

  4. Lecture 29 Horn clauses • Program is facts + rules. (horn clauses). • Prolog programs describe relations, defined by means of clauses. Pure Prolog is restricted to Horn clauses. There are two types of clauses: Facts and rules. A rule is of the form • Head :- Body.and is read as "Head is true if Body is true". A rule's body consists of calls to predicates, which are called the rule's goals. • Clauses with empty bodies are called facts. An example of a fact is: • cat(tom). which is equivalent to the rule: • cat(tom) :- true.

  5. Prolog as a restricted & resolution-based theorem prover [Lecture 29] Much of the modern development of Prolog came from the impetus of the fifth generation computer systems project (FGCS), which developed a variant of Prolog named Kernel Language for its first operating system. Pure Prolog was originally restricted to the use of a resolution theorem prover with Horn clauses of the form: H :- B1, ..., Bn. The application of the theorem-prover treats such clauses as procedures: to show/solve H, show/solve B1 and ... and Bn. Pure Prolog was soon extended, however, to include negation as failure, in which negative conditions of the form not(Bi) are shown by trying and failing to solve the corresponding positive conditions Bi. {INCLUDE EXAMPLE} Subsequent extensions of Prolog by the original team introduced Constraint logic programming abilities into the implementations.

  6. Un-decidability of predicate logic [ Lecture 30] Given a formula φ in propositional logic we can, at least in principle, determine whether φ holds: if φ has n propositional atoms, then the truth table of φ contains 2n lines; and φ holds if, and only if, the column for φ (of length 2n) contains only T entries. The bad news is that such a mechanical procedure, working for all formulas φ, cannot be provided in predicate logic. We will give a formal proof of this negative result, though we rely on an informal (yet intuitive) notion of computability. The truth table method of inference is not complete for FOL because truth table size may be infinite. Automated Inference in FOL is harder than PL because the variables can take on potentially an number of possible values from their domains. Which also contribute to un-decidability in Logic Natural deduction is complete for FOL but it is not practical for automated inference because the “branching factor” in a search is too large, caused by the facts that we would have to potentially try every inference rule in every possible way usinf set of known sentences. Godel’s completeness Theorem also contributes to un-decidability in logic as it says that FOL entailment is only semi decidable. That is if a sentence is true given a set of axioms, there is a procedure that will determine this. However if a sentence is false, then there is no guarantee that a procedure will ever determine this. In other words the procedure may never halt in this case. The problem of determining whether a predicate logic formula is valid is known as a decision problem. A solution to a decision problem is a program (written in Java, C, or any other common language) that takes problem instances as input and always terminates, producing a correct ‘yes’ or ‘no’ output. In the case of the decision problem for predicate logic, the input to the program is an arbitrary formula φ of predicate logic and the program is correct if it produces ‘yes’ whenever the input formula is valid and ‘no’ whenever it is not. Note that the program which solves a decision problem must terminate for all well-formed input: a program which goes on thinking (Non-deterministic & backtracking) about it for ever is not allowed.

  7. Compactness Theorem  Lecture 30] In mathematical logic, the compactness theorem states that a set of first-order sentences has a model if and only if every finite subset of it has a model. This theorem is an important tool in model theory, as it provides a useful method for constructing models of any set of sentences that is finitely consistent. Compactness Theorem Let Гbe any set of formulas of first-order logic. Then Гis satisfiable if every finite subset of Гis satisfiable. Applications  A application of the compactness theorem can show that any theory that has arbitrarily large finite models, or a single infinite model, has models of arbitrary large cardinality Application  application of the compactness theorem is the construction of nonstandard models of the real numbers, that is, consistent extensions of the theory of the real numbers.

  8. Boolean Logic Functions Representations • Function can be represented in different ways • 􀂃 Truth table, equation, K-map, circuit, etc… • 􀂃 Some representations not unique (not canonical)

  9. Representing boolean functions A boolean variable x is a variable ranging over the values 0 and 1. We write x1, x2, . . . and x, y, z, . . . to denote boolean variables. We define the following functions on the set {0, 1}: ¯ 0 (negation) def = 1 and ¯ 1 ( Negation) def = 0; x . y def = 1 if x and y have value 1; otherwise x. y def = 0; x + y def = 0 if x and y have value 0; otherwise x + y def = 1; x Ө y def = 1 if exactly one of x and y equals 1. A boolean function f of n arguments is a function from {0, 1}n to {0, 1}. • Note that ., + and Өare boolean functions with two arguments, whereas • ¯ is a boolean function that takes one argument. The binary functions ., • + and Ө are written in infix notation instead of prefix; i.e. we write x + y • instead of +(x, y),

  10. Why BDDs An Efficient Representation Synthesis, optimization, verification, and testing algorithms/tools manipulate large Boolean functions 􀂃 Important to have efficient way to represent these functions 􀂃 Binary Decision Diagrams (BDDs) have emerged as a popular choice for representing these functions 􀂃 BDDs 􀂃 Graph representation similar to a binary tree (i.e. decision trees from previous lectures) 􀂃 Able to efficiently represent large functions 􀂃 Some representations are canonical (unique)

  11. Mux Representation of Boolean Functions

  12. Binary Decision Diagram (BDD)

  13. Lecture 33 Why should we specify and verify code? Arguments in favour of verification include the following: Documentation: The specification of a program is an important component in its documentation and the process of documenting a program may raise or resolve important issues. The logical structure of the formal specification, written as a formula in a suitable logic, typically serves as a guiding principle in trying to write an implementation in which it holds. Time-to-market: Debugging big systems during the testing phase is costly and time-consuming and local ‘fixes’ often introduce new bugs at other places. Experience has shown that verifying programs with respect to formal specifications can significantly cut down the duration of software development and maintenance by eliminating most errors in the planning phase and helping in the clarification of the roles and structural aspects of system components. Refactoring: Properly specified and verified software is easier to reuse, since we have a clear specification of what it is meant to do. Certification audits: Safety-critical computer systems – such as the control of cooling systems in nuclear power stations, or cockpits of modern aircrafts – demand that their software be specified and verified with as much rigour and formality as possible. Other programs may be commercially critical, such as accountancy software used by banks, and they should be delivered with a warranty: a guarantee for correct performance within proper use. The proof that a program meets its specifications is indeed such a warranty.

  14. Lecture 33 Framework for software verification • Convert the informal description R of requirements for an application domain into an ‘equivalent’ formula φR of some symbolic logic; • Write a program P which is meant to realise φR in the programming environment supplied by your company, or wanted by the particular customer; • Prove that the program P satisfies the formula φR.

  15. Lecture 34 Proof calculus for partial correctness

  16. Modes of truth In propositional or predicate logic, formulas are either true, or false, in any model. Propositional logic and predicate logic do not allow for any further possibilities. From many points of view, however, this is inadequate. In natural language, for example, we often distinguish between various ‘modes’ of truth, such as necessarily true, known to be true, believed to be true and true in the future. For example, we would say that, although the sentence George W. Bush is president of the United States of America. is currently true, it will not be true at some point in the future. Equally, the sentence There are nine planets in the solar system. while true, and maybe true for ever in the future, is not necessarily true, in the sense that it could have been a different number. However, the sentence The cube root of 27 is 3. as well as being true is also necessarily true and true in the future. It does not enjoy all modes of truth, however. It may not be known to be true by some people (children, for example); it may not be believed by others (if they are mistaken). In computer science, it is often useful to reason about modes of truth.

  17. Syntax – Modal Issue The set  of formulas of modal logic is the smallest set satisfying the following : • Every atomic proposition p is a member of . • If  is a member of , so is (¬). • If and are members of , so is (). • If is a member of , so is (❏). We have a derived modality, ◊which is defined as ◊¬❏¬

  18. Semantics Frame A frame is a structure F = (W,R), where W is a set of possible worlds and R  W X W is the accessibility relation. Model A model is a pair M = (F,V) where F = (W,R) is a frame and V:W pow(P) is a valuation. Satisfaction M,w |= p iff p Є V(w) for p Є P M,w |= ¬ iff M,w |≠  M,w |= ( iff M,w |=  or M,w |=  M,w |= ❏ iff for each w' Є W, if wRw' then M,w' |= 

  19. Semantics contd... Satisfiability and validity A formula is satisfiable if there exists a frame F = (W,R) and a model M = (F,V) such that M,w |=  for some w Є W. A formula is valid ,written |= if for every frame F = (W,R), for every model M = (F,V) and for every w Є W, M,w |=. Some examples of valid formulas : (i) Every tautology of propositional logic is valid. (ii) ❏(❏❏ (iii) Suppose that is valid. Then, ❏must also be valid.

  20. Correspondence Theory Let be a formula of modal logic. With , we identify a class of frames Cas follows : F = (W,R) Є Ciff for every valuation V over W, for every world w Є W and for every substitution instance of ((W,R),V),w |= . Characterising classes of frames We say a class of frames C is characterised by the formula  if C=C. Some examples of frame conditions which can be characterised by formulas of modal logic. (i) The class of reflexive frames is characterised by the formula ❏.

More Related