Prolog Addition to argumentation

 19 July 16:47   Back prolog is based heavily on academic logic, its advantageous to accept some acquaintance with it afore starting to apprentice prolog. This is a abbreviate addition to argumentation for humans who wish to apprentice prolog. It will altercate two analytic languages: propositional argumentation and first-order logic.

    Propositional argumentation has two basal elements, agreement and connectives. Agreement are represented by belletrist (usually uppercase), and represent the ethics true and false, ie. a appellation can be either true or false, admitting it doesnt consistently accept to be create bright which they represent. They are in this sense, like variables in mathematics, they represent an alien value.

    Connectives, like the chat suggests, affix two terms. The aftereffect of this affiliation takes on the amount true or false, based on the ethics of the two terms. Consider, for instance, the affiliation AND. It could affix the agreement A and B to create the analytic book A AND B (Anything that can yield on the ethics true or false is alleged a sentence). The book A AND B is true if both A and B are true. If one or both of them are false, the book is false. Connectives are usually represented by symbols rather than words. The afterward table shows the alotof frequently acclimated connectives, their acceptation and the symbols that are generally acclimated to represent them.

    


    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
Name acceptance Acceptation symbols
affiliation A land B the book is true if and alone if both agreement are true land quad ,
breach A lor B the book is true if one or both of the agreement are true lor quad ;
absolute or A oplus B the book is true if one of the agreement is true, but not both oplus quad underline quad
antithesis lnot A the book is true if the appellation is false and false if the appellation is true sim quad lnot quad ar
association A
ightarrow B
if A is true the book is true alone if B is true, if A is false, the book is true
ightarrow quad Rightarrow quad models
adequation A leftrightarrow B the book is true if both agreement are true or if both agreement are false leftrightarrow quad Leftrightarrow quad =


    


    Beware of the acceptation of implication, as it can be counter-intuitive. A
ightarrow ; B basically says, if a is true, then so is B, contrarily B can be either true or false.

    Since anniversary appellation can alone yield on two values, all possibilities can calmly be abundant in a alleged accuracy table:

    


    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
A B A land B A lor B A oplus B
eg A
A Rightarrow ; B A Leftrightarrow ; B
f f f f f t t t
f t f t t t t f
t f f t t f f f
t t t t f f t t


    


    The next move is to affix these sentences, using connectives, to create added circuitous sentences, such as (A land B) Rightarrow ; (B Leftrightarrow ; A) or ((A lor C) lor (A lor D)). In the endure sentence, the brackets can be omitted, back A lor (B lor C) is the aforementioned as (A lor B) lor C. However, if in doubt, its best to use brackets to create the acceptation of the book absolutely clear.

    You can analyse circuitous sentences with accuracy tables as well:

    


    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    

    
A B A land B A lor B (A land B) lor (A land C)
f f f f f
f t f t t
t f f t t
t t t t t


    


    We can now bisect sentences in to three groups: valid, clamorous and satisfiable. Accurate sentences or tautologies are consistently true, no amount what ethics the agreement take. Examples of accurate sentences are A or (not A), A => A or (A => B) or ( A and (not B)).

    Unsatisfiable sentences are consistently false, eg: A and (not A) or (A <=> B) and (B <=> not(A)).

    All additional sentences are satisfiable, which agency they can be either true or false, based on the ethics of their terms.

    Its actual important in analytic languages to apprehend that these sentences can be acclimated in altered ways. A wedge B , for instance, does not betoken any acceptation on its own. Its just a academic way of creating analytic constructions. Anyone can accompaniment that A wedge B is true, which would accord the book a acceptation (namely that A and B are both true), which can be acclimated to acquire added truths if additional things are accepted about A and B. Anyone ability aswell ask if A wedge B is true, to which the being asked this would accept to acquisition an acknowledgment based on things already accepted about A and B. In additional words, a analytic book on its own doesnt beggarly anything. The clairvoyant needs to understand the ambition abaft the book (usually catechism or statement) to be able to do something with it.

    A accepted assemble in argumentation is a ability base, a accumulating of sentences that are declared to be true, and a individual book that is airish as a question. The catechism is whether the catechism is true, accustomed the ability base. Consider, for instance, the afterward ability base:

     A wedge B

     ~B

    With the catechism

    A

    That is, is A true, accustomed that the Ability abject is. Its bright that the catechism is absolutely true, back A wedge B is true, and B is too. This ability base/question architecture is in actuality the way that prolog works. You address a ability abject (your program) and ask prolog a question. In allegory to accepted programming languages, the knowledgebase is your program, the catechism is its ascribe and prolog absolute your catechism is the active of the program.

    First Adjustment Argumentation (also accepted as assert logic) expands on propositional logic, by using predicates, variables and objects. In propositional logic, the diminutive sentences (the aboriginal elements that can yield on a true/false value) area terms, symbols represented by letters. In first adjustment argumentation the diminutive sentences are predicates. Predicates accept a name (starting with a capital) which is followed by several variables (starting with a lowercase letter). The afterward are examples of predicates:

    These variables can be instantiated with objects. Altar are elements represented by words that alpha with a basic letter. For instance, in the assert HasWheels(thing) the capricious affair can be instantiated with the altar Car, Bike, or Banana. based on the instantiation of the variables, the assert is true or false (HasWheels(Car) is true admitting HasWheels(Banana) is false). Agenda about that these names are for readability only, they do not infact beggarly anything. HasWheels(Banana) is not functionally altered from X(A). Whether HasWheels(Banana)is true or false needs to be authentic in some academic way (such as a ability base, which is declared below).

    These predicates can be abutting in sentences, just like the agreement in propositional logic, using connectives (the connectives are the aforementioned as in propositional logic). Usually there is a accumulating of sentences that are affected to be true, to make a analytic analogue of predicates. Such a accumulating of sentences that are true is alleged a ability base. Such a ability abject could, for instance accommodate the afterward sentences:

    HasWheels(Car)

    MotherOf(Charles, Elizabeth)

    The sentences acquaint us that the HasWheels assert is true, if its first aspect is car; and the MotherOf assert is true, if Elizabeth is the mother of Charles. To assemble this affectionate of sentences with variables in them we charge to accompaniment what absolutely we beggarly if we use the variables. If HasWheels(x) is true, do we beggarly its true for instantiations of x or that there exists an instantiation of x that makes HasWheels(x) true? To ascertain this we use quantifiers, ie. they actuate the abundance of a variable.

    First adjustment argumentation has two quantifiers, the accepted quantifier forall and the existential quantifier exists. These quantifiers are placed afore a capricious to announce what the capricious agency in the book that follows the quantifier. For instance, the book forall x HasWheels(x) agency that for all accessible instantiations of x, HasWheels(x) is true, that is, all accessible altar accept wheels. The book exists x HasWheels(x) agency that there exists at atomic one item x for which HasWheels(x) is true, in additional words there is at atomic one affair that has wheels. To accept the use of the quantifiers, accede the afterward examples:

    forall x LandVehicle(x) Rightarrow HasWheels(x)

    forall x, y HasChild(x, y) wedge Man(x) => FatherOf(x, y)

    exists x HasWheels(x) wedge sim Car(x)

    forall x Mother(x) => exists y Child(y) wedge HasChild(x, y)

    The argumentation acclimated in prolog is a adaptation of first adjustment logic, with the use of basic belletrist astern (predicates and altar alpha with a lowercase letter, variables alpha with an uppercase letter). A prolog program consists of a knowledgebase area anniversary book is a affiliation of predicates affiliated to a final assert with an implication. For instance:

    forall a,b,c,d Pred1(a, b) wedge Pred2(b, c) wedge Pred3(c, d) Rightarrow Pred4(a)

    A book like this is alleged a Horn Clause.

    In prolog the aloft book would attending like this:

    pred4(A) :- pred1(A, B), pred2(B, C), pred3(C, D).

    Note that the association assurance is reversed, commas are acclimated for conjunction, a aeon is acclimated to end the book and all variables are affected to be universally quantified.

    (x) Address out a accuracy table for the afterward sentences in propositional logic.

    a) (A wedge B) V C

    b) A

    c) A

    d) A

    e) A

    (x) How some connectives are possible, that affix two terms? Why?

    (x) Try to acquisition a blueprint to fit the afterward accuracy tables

    a)

    b)

    c)

    d)

    (x) Accuracy tables are a abundant way to prove that a propositional blueprint is true. Could you do the aforementioned affair for first adjustment logic? Explain how, or why not.

    (x) Catechumen the afterward sentences to first adjustment logic. Try to chase the analytic anatomy of the book carefully (using altar for individuals, variables for groups of people, connectives for analytic constructions and predicates for the rest).

    a) All kids are short.

    b) Assertive kids own shoes.

    b) If anyone is a kid and a boy, he brand cars.

    d) All kids that own shoes, abrasion them.

    e) All kids accept a mother.

    f) If a woman is a mother, she has a kid.

    g) No kid brand a vegetable if its overcooked.

    h) No mother brand a abecedary if he punishes her kid.

    (x) (advanced)The afterward questions affair the = symbol. It takes two variables and is true if they are apprenticed to the aforementioned thing, in additional words x = y is true if x and y represent the aforementioned object.

    (a) Is the = attribute a function, assert or a connective? Why?

    (b) The = attribute shouldnt be abashed with the adequation connective. How are the different?

    (c) Can you anticipate of a book in first adjustment argumentation that, if added to a ability abject (and appropriately advised consistently true) does the aforementioned affair as the = symbol. That is, through its analogue in the ability base, this sentence, with inputs x and y, is true if x and y are equal.

    (d) The existential quantifier exists x defines that a book is true if its true for at atomic one accessible instantiation of x. Can you anticipate of a way to quantify a capricious x for a book so that the book is true if its true for alone one instantiation of x, but no more? Youll apparently charge the = attribute for this.

    

 


Tags: program, usually, capital, based, words, different, starting, letters, mother, letter, clear, elements, called, languages, value, examples, start, instance, question, sentences

 sentence, logic, sentences, false, terms, haswheels, variables, wedge, prolog, knowledge, question, quad, following, connectives, predicates, propositional, ightarrow, logical, objects, land, instance, predicate, forall, values, meaning, thing, leftrightarrow, variable, based, truth, mother, exists, words, represent, symbol, connect, means, program, quantifier, letter, banana, represented, implication, instantiation, quantifiers, usually, called, symbols, capital, start, introduction, likes, examples, table, conjunction, languages, anything, connective, elements, value, oplus, tables, formal, collection, starting, different, valid, clear, letters, , knowledge base, propositional logic, terms are, sentences are, haswheels banana, following sentences, true for, start with, sentences that, truth tables, instance the, true and, connectives are, existential quantifier exists,

Share Prolog Addition to argumentation:
Digg it!   Google Bookmarks   Del.icio.us   Yahoo! MyWeb   Furl  Binklist   Reddit!   Stumble Upon   Technorati   Windows Live   Bookmark

Text link code :
Hyper link code:

Also see ...

Permalink
Article In : Reference & Education  -  Language