Horn Clauses

Sdílet
Vložit
  • čas přidán 6. 07. 2024
  • Horn clauses are a Turing-complete subset of predicate logic. Horn clauses are the logical foundation of Prolog.
  • Věda a technologie

Komentáře • 28

  • @sefirotsama
    @sefirotsama Před 3 lety +6

    the work you do with prolog is the best it happened to the field, probably with an intangible value.

    • @ThePowerOfProlog
      @ThePowerOfProlog  Před 3 lety +2

      Thank you so much for your kind words, I greatly appreciate them! Enjoy!

  • @mathom21
    @mathom21 Před 7 měsíci +1

    Outstanding matrial! Danke!

  • @arlet9788
    @arlet9788 Před 4 lety +6

    Very interesting and well explained!! keep it up :)

  • @amaladiguna8873
    @amaladiguna8873 Před 4 lety +4

    Very well structured and very well explained, thank you.

  • @bayesianadventures6246
    @bayesianadventures6246 Před 2 lety +1

    Terrific content! I would love to see how you might solve Smullyan-type logic puzzles with Prolog!

  • @alessandroporfirio1910
    @alessandroporfirio1910 Před 3 lety +3

    Great presentation. Thank you.

    • @ThePowerOfProlog
      @ThePowerOfProlog  Před 3 lety

      Thank you a lot, I'm very glad you find it useful! Enjoy!

  • @MaximeJakubowski
    @MaximeJakubowski Před 3 lety +2

    Great video! I really like your content. I have a question that is a bit out of the scope of this video: if Horn clauses in Prolog can express all computations, why is there negation in Prolog? I understand the negation in Prolog means "cannot be proven". So it is some kind of construct to simplify the representations of the application domain? Am I right in saying that negation in Prolog is not needed in the sense that all programs with negation can be written without it?

    • @ThePowerOfProlog
      @ThePowerOfProlog  Před 3 lety +2

      Yes, that is right: Negation is not needed in the sense that all programs can be written also without negation. You can show this by expressing a Turing machine with Horn clauses. Instead of negation as finite failure, use predicates like dif/2 and if_/3 to express "not equal" etc. in a pure way that allows logical reasoning about programs by means of failure slicing, generalizations etc. if_/3 was not yet found when the Prolog standard was written, it is a newer language construct with more desirable declarative properties. Thank you a lot for your kind words, and your interest. Enjoy!

  • @mostafasallam4944
    @mostafasallam4944 Před 11 měsíci

    Thank you😊

  • @alamagordoingordo3047
    @alamagordoingordo3047 Před 3 lety +2

    Thank you for the good work. OFF TOPIC What is your opinion of Mercury?

    • @ThePowerOfProlog
      @ThePowerOfProlog  Před 3 lety +2

      The trade-off is between static type checking and meta-interpretation. With Mercury, you get static type checking, and lose the ability to write convenient meta-interpreters. In my own programs, I tend to rely heavily on meta-interpretation and therefore prefer to use Prolog.

    • @alamagordoingordo3047
      @alamagordoingordo3047 Před 3 lety +1

      @@ThePowerOfProlog Thank you, of the explanation.

  • @Kenspectacle
    @Kenspectacle Před 3 lety +1

    Hi, I am interested to understand this video, but it seems my knowledge is still lacking. Is there perhaps any recommended beginner-friendly tutorials/books that builds up into this level knowledge that could help me understand this video? thank you

    • @ThePowerOfProlog
      @ThePowerOfProlog  Před 3 lety +1

      Thank you a lot for your interest! For a very solid introduction, I recommend the book "Computability and Logic" by Boolos, Jeffrey and Burgess.

  • @raypraise
    @raypraise Před 2 lety +1

    ty sir

  • @ahsanalikhan5704
    @ahsanalikhan5704 Před 3 lety

    Sir I need your help can you help me. I need Davis Putnam Sat procedure in prolog

  • @stefankral1264
    @stefankral1264 Před 4 lety

    Nit: Horn clauses are sufficient for expressing not only all known computations, but in fact all CONCEIVABLE ones -- even the once that have never been expressed/formulated/run/&c yet.

    • @ThePowerOfProlog
      @ThePowerOfProlog  Před 4 lety +4

      At 17:07, I say that they are general enough to express ALL computations. The conceivable ones seem to fall well into this set. The reason I sometimes say "known" is that there may be different *types* of computation that are not yet known, I mean computations that are not Turing-computable.

  • @callahan7257
    @callahan7257 Před 4 lety

    Was ich bisher überhaupt nicht verstanden habe ist, wie ich eine 'goal clause' in Prolog abbilde. Für eine 'definite clause' ist es ja letztendlich nur A :- B. Aber wie sieht eine 'goal clause' aus. A :- 0 geht ja schlecht.

    • @ThePowerOfProlog
      @ThePowerOfProlog  Před 4 lety

      Goal clause entspricht einer Query: Eine Query wird implizit als negiertes Ziel interpretiert. D.h. ?- A. zu posten bedeutet aus Sicht von Resolution, dass ¬A zu den Klauseln hinzugefügt wird und dann versucht wird, einen Widerspruch abzuleiten. Gelingt das, so ist A logische Konsequenz des Programms.

    • @callahan7257
      @callahan7257 Před 4 lety

      @@ThePowerOfProlog
      Nun habe ich das Problem, dass ich einige Prädikate in Form von Horn-Klauseln habe. Diese möchte ich in ein Prolog Programm überführen.
      Beispielhafter Sourcecode:
      pred1(a).
      pred2(a).
      pred3(X) :- pred1(a), pred2(a).
      Jedoch habe ich jetzt die goal clause (¬pred1(X) ∧ ¬pred2(X) ∧ ¬pred(X)). Muss jetzt kein Sinn ergeben, nur um ein Beispiel zu haben.
      Wie würde ich diese im Sourcecode angeben?
      Und danke für die Antwort :).

    • @ThePowerOfProlog
      @ThePowerOfProlog  Před 4 lety

      @@callahan7257 Das Beispiel ist keine Horn Klausel, und daher in Prolog nicht direkt hinschreibbar. Prolog unterstützt ausschließlich Horn-Klauseln.

    • @callahan7257
      @callahan7257 Před 4 lety

      @@ThePowerOfProlog
      Sorry, natürlich Disjunktion: (¬pred1(X) ∨ ¬pred2(X) ∨ ¬pred(X)).

    • @ThePowerOfProlog
      @ThePowerOfProlog  Před 4 lety

      @@callahan7257 Das entspricht der Query ?- pred1(X), pred2(X), pred(X). Deklarativ ist das die Behauptung, dass weder pred1(X), noch pred2(X), noch pred(X) gilt. Wenn das widerlegt werden kann, so ist dieses Ziel eine logische Konsequenz des Programms.

  • @XetXetable
    @XetXetable Před 2 lety +1

    I don't understand why you reference "Programming as Theory Building". It is absolutely NOT relevant to the topic at hand. When Naur uses the word "theory" he is speaking of an intuitive understanding of what a large program is supposed to accomplish and mainly speaks about how this theory is separate from things like documentation and source code. He states, for example;
    "The dependence of a theory on a grasp of certain kinds of similarity between situations and events of the real world gives the reason why the knowledge held by someone who has the theory could not, in principle, be expressed in terms of rules."
    He is adamantly not talking about systems of rules or formal descriptions when he talks of "theories"; he's talking about intuitions instantiated in the minds of programmers, entirely separate from the content of the programs themselves. This completely goes against the way you're using "theory".

    • @ThePowerOfProlog
      @ThePowerOfProlog  Před 2 lety

      Naur states that he uses the word theory "in the sense of Ryle [1949]" (referring to Ryle's book "The Concept of Mind"), and explains in his paper: "Very briefly, a person who has or possesses a theory in this sense knows how to do certain things and in addition can support the actual doing with explanations, justifications, and answers to queries, about the activity of concern." This is very similar to a logical theory: We can use it to answer queries about the domain of interest, give explanations, justifications etc. And further, Naur says: "theory is understood as the knowledge a person must have in order not only to do certain things intelligently but also to explain them, to answer queries about them, and so forth." This further stresses the connection between theory, knowledge, answering queries etc., as we know them from logical theories. He gives a specific example: "A person having Newton's theory of mechanics must thus understand how it applies to the motions of pendulums and the planets, and must be able to recognize similar phenomena in the world, so as to be able to employ the mathematically expressed rules of the theory properly." Note that Naur is explicitly mentioning "the rules of the theory" in the paper. How the subsequent paragraph that you cite relates to these points seems a bit unclear, and in fact its truth could also be questioned: Is it really so clear that the kinds of similarity between situations and events "could not, in principle, be expressed in terms of rules"? Does the term "intuition" occur anywhere in the paper?