Preview

Prolog

Satisfactory Essays
Open Document
Open Document
617 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Prolog
LOGIC PROGRAMMING

What are the various programming paradigms

I’ve used so far?

2 CSED Computational Intelligence

February 26, 2013

PROGRAMMING PARADIGMS

  

Imperative
Procedural Declarative Functional LISt Processing C, Pascal




Logical
Object Oriented

PROgramming in LOGic
C++

3 CSED Computational Intelligence

February 26, 2013

PROLOG :: COMPONENTS

 

FACTS
RULES QUESTIONS/QUERIES

4 CSED Computational Intelligence

February 26, 2013

PROLOG :: COMPONENTS :: FACTS attacks (tom, jerry) relationship object_1 object_2

; round(earth) relationship object



The names of relationship and objects start with lowercase letters.
The relationship should be written first and the objects should be separated by commas.



5 CSED Computational Intelligence

February 26, 2013

PROLOG :: COMPONENTS :: FACTS example_01 : Directed Graph edge (a, b). edge (a, e). edge (b, d).

edge (b, c). edge (c, a). edge (e, b).
6 CSED Computational Intelligence

February 26, 2013

PROLOG :: COMPONENTS :: RULES



Rule is a general way to say when a predicate is true.
With rules we can state that a predicate is true,

provided that other predicates are true. example: a :- b, c, d. {a is true if b, c, d are true} a :- b, c, d. b. c. d :- e e. example_01 : Directed Graph :: Rule for “Path of length two” tedge(Node1, Node2) :- edge (Node1, X), edge (X, Node2).
7 CSED Computational Intelligence

February 26, 2013

PROLOG :: COMPONENTS :: QUESTIONS


Look for FACTS from database
?- attacks (tom, jerry). ?- edge (a, b).

True or False

8 CSED Computational Intelligence

February 26, 2013

SWI PROLOG :: INSTALL & COMPILE
1) Download SWI Prolog: http://www.swi-prolog.org/download/devel 2) Create a new file with an extension .pl :
3) Write a sample Prolog program and save the file as test01.pl 4) To compile the program type the following in the prompt: ?- [test01].
(don’t

You May Also Find These Documents Helpful

  • Satisfactory Essays

    Prolog was invented in 1972 by roussel Kowalski and colmerauer was the first logic programming language. Was meant for general programming branching with AI and computer linguistics…

    • 388 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    unit 5 assignment 1

    • 423 Words
    • 3 Pages

    4. The AND operator connects two Boolean expressions into one compound expression. Both must be true for the compound expression to be true.…

    • 423 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    pt1420 exam review

    • 738 Words
    • 3 Pages

    1 - Design the Program2 - Write the Code3 - Correct Syntax Errors4 - Test the Executable Code…

    • 738 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    When two conditions are joined by the AND logical operator, both of the conditions must be…

    • 4553 Words
    • 34 Pages
    Satisfactory Essays
  • Good Essays

    Explication

    • 274 Words
    • 2 Pages

    The best way to sum up Club Denali is in the first paragraph when the author says, “The ten-minute Denali show runs heavily to images of thundering avalanches, storm-flattened tents, hands deformed by horrible frostbite blisters, and grotesquely twisted bodies being pulled from the depths of enormous crevasses. Like the military’s VD movies, the Denali show is graphic enough to make even the thickest skin crawl. As a tool for promoting sensible behavior, it would appear that it’s also just as ineffective”.…

    • 274 Words
    • 2 Pages
    Good Essays
  • Good Essays

    Programming Logic

    • 1499 Words
    • 6 Pages

    2. Design the logic for a program that outputs every number from 1 through 10.…

    • 1499 Words
    • 6 Pages
    Good Essays
  • Good Essays

    I would recommend Sin and Syntax: How to Craft Wicked Good Prose. Much of its unconventional advice could teach even the most experienced writer. At the same time, any illiterate can stay afloat with the novel’s tips on grammar, rhythm, and rhetorical devices. Constance Hale helps readers choose the right words for any situation by using everyday literature to show what separates good writing from the exceptional. She pokes fun at businessmen and rallies against puffed up verbs while analyzing famous speeches and obscure raps. Sin and Syntax is an organized guide to writing offered in a simple paperback.…

    • 99 Words
    • 1 Page
    Good Essays
  • Satisfactory Essays

    Problem Solving

    • 299 Words
    • 2 Pages

    Acknowledge the addiction, attending local alcoholics’ anonymous meetings, and learning why people turn to self-medication.…

    • 299 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    Nowadays, many rap and hip-hop songs have evolved, or rather devolved, to simple beats with lyrics that encourage violence and drug use and lack a true meaning. Logic, on the other hand, is ?distinguished by [his] confidence, passion, versatility, raw lyricism, intellect, and a Frank Sinatra-like swagger? [footnoteRef:1]. Logic?s identity is evident through not only his lyrics, but also the musical composition of his songs. His style mimics the old school style of rap, and has drawn the praise of many in the hip-hop community, including stars such as Lupe Fiasco and Nas. In all, Logic's unique use of rhythm and timbre throughout his mix tape "Young Sinatra Undeniable" reveals his thoughts,…

    • 1203 Words
    • 5 Pages
    Powerful Essays
  • Satisfactory Essays

    Informal Logic

    • 576 Words
    • 3 Pages

    Karl Popper advocates, as a more efficient way to examine a scientific hypothesis, which of the following?…

    • 576 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    Syntax And Syntax

    • 634 Words
    • 3 Pages

    There are two views of reading that have been explored throughout the years, the learning view and the acquisition view. There are similarities between both views, including that syntax plays a role in reading, that previous knowledge is important, and that early reading skills like phonetic awareness are important as well. The differences between the views lies with the focus that each view takes on syntax, including the importance of syntax and how syntax is approached with reading instruction. Although the learning view places more importance on words while the acquisition view focuses on syntax, there are specific differences and likenesses between the two views.…

    • 634 Words
    • 3 Pages
    Good Essays
  • Good Essays

    High-stakes tests or high-stakes appraisals have turned out to be a piece of the training vernacular since the entry of the No Child Left Behind Act (Cohen , 2007). These evaluations have vital choices or outcomes riding on the outcome. In training, these choices regularly identify with government and neighborhood subsidizing, position and graduation choices or continuous residency for educators. It's to some degree telling that low-stakes testing is the way we allude to appraisals used to really decide the scholastic advancement of the understudy.…

    • 548 Words
    • 3 Pages
    Good Essays
  • Good Essays

    Problem Solving

    • 507 Words
    • 3 Pages

    In order to solve the problem it was necessary to first interpret the scenario. In completing the Riverbank activity, I took the following approach:…

    • 507 Words
    • 3 Pages
    Good Essays
  • Good Essays

    مخظنالاتار

    • 3442 Words
    • 14 Pages

    1 - 2 (c,d) - 5 (c) - 7 (b) - 11 - 17 (a,f) - 23 (d,e) - 33 1.4 Predicates and Quantifiers…

    • 3442 Words
    • 14 Pages
    Good Essays
  • Good Essays

    Winter Syntax Analysis

    • 397 Words
    • 2 Pages

    In the poem, "Winter Syntax", Billy Collins writes about the difficulties of writing literature through the representation of a "lone traveler" and his adventures through a blizzard. Collins talks about the important aspects of good writing. He starts off the poem emphasizing the importance of the first sentence and how it is analogous to a lone traveler going through a tough blizzard. By using the analogy of the traveler, Collins allows readers to vicariously imagine the difficulties a writer goes through while writing. Collins ends the poem saying "the man will express a single thought" as if to say he has finally finished explaining the difficulties of writing -the lone traveler that travelled through the storm. The structure of the poem is organized into 6 stanzas; some of the stanzas contain continuous sentences with no pauses. This effect shows that the "traveler" is indeed continuously travelling. The poet intentionally made the first stanza just one continuous sentence to depict that the most important aspect of written work is its first sentence. "A sentence starts out like a lone traveler/heading into a blizzard at midnight". Most writers take a lot of time to find inspiration therefore they need to brainstorm their ideas, the "traveler" is an abstract presentation of all their difficulties writing. However, as good writers, they will be determined to persevere through all obstacles to achieve producing quality work, just like the traveler who "tilts into the wind" as if fighting against it. If the writer puts in enough effort, "the tails of his thin coat" will start "flapping behind" them. In other words, the "tails of the thin coat" represent the writer's progress and the "flapping" is like a reminder for him to move on. In the second stanza, Collins talks about how gestures can symbolize words and talks about how gestures are described in literature as verbs. The words "hold", "lift", "toss" and "blazing" are examples…

    • 397 Words
    • 2 Pages
    Good Essays