jagomart
digital resources
picture1_Functional Programming Pdf 197041 | Lp All


 157x       Filetype PDF       File size 1.82 MB       Source: www.cs.cmu.edu


File: Functional Programming Pdf 197041 | Lp All
logic programming frankpfenning carnegiemellonuniversity draft of january 2 2007 notes for a course given at carnegie mellon university fall 2006 mate rials available at http www cs cmu edu fp ...

icon picture PDF Filetype PDF | Posted on 07 Feb 2023 | 2 years ago
Partial capture of text on file.
             Logic Programming
             FrankPfenning
             CarnegieMellonUniversity
                     Draft of January 2, 2007
             Notes for a course given at Carnegie Mellon University, Fall 2006. Mate-
             rials available at http://www.cs.cmu.edu/~fp/courses/lp. Please send
             commentstofp@cs.cmu.edu.
                  c
             Copyright
FrankPfenning2006–2007
              LECTURE NOTES               JANUARY2, 2007
                                                   15-819K: Logic Programming
                                                              Lecture 1
                                                   Logic Programming
                                                           FrankPfenning
                                                          August29,2006
                             In this first lecture we give a brief introduction to logic programming. We
                             also discuss administrative details of the course, although these are not
                             included here, but can be found on the course web page.1
                             1.1   Computationvs.Deduction
                             Logic programming is a particular way to approach programming. Other
                             paradigms we might compare it to are imperative programming or func-
                             tional programming. The divisions are not always clear-cut—a functional
                             language may have imperative aspects, for example—but the mindset of
                             various paradigms is quite different and determines how we design and
                             reason about programs.
                                To understand logic programming, we first examine the difference be-
                             tween computation and deduction. To compute we start from a given ex-
                             pression and, according to a fixed set of rules (the program) generatee a
                             result. For example, 15 + 26 → (1 + 2 + 1)1 → (3 + 1)1 → 41. To deduce
                             westartfromaconjectureand,accordingtoafixedsetofrules(theaxioms
                             andinferencerules), tryto constructa proofofthe conjecture. So computa-
                             tion is mechanical and requires no ingenuity, while deduction is a creative
                                                     n     n    n
                             process. For example, a +b 6= c for n > 2, ::: 357 years of hard work :::,
                             QED.
                                Philosophers, mathematicians, and computer scientists have tried to
                             unify the two, or at least to understand the relationship between them for
                             centuries. Forexample,GeorgeBoole2succeededinreducingacertainclass
                               1http://www.cs.cmu.edu/~fp/courses/lp/
                               21815–1864
                             LECTURE NOTES                                               AUGUST29,2006
                      L1.2                                        LogicProgramming
                      oflogical reasoningtocomputationinso-calledBooleanalgebras. Sincethe
                      fundamental undecidability results of the 20th centuries we know that not
                      everythingwecanreasonaboutisinfactmechanicallycomputable,evenif
                      wefollowawell-definedsetofformalrules.
                         In this course we are interested in a connection of a different kind. A
                      first observation is that computation can be seen as a limited form of de-
                      duction because it establishes theorems. For example, 15 + 26 = 41 is both
                      the result of a computation, and a theorem of arithmetic. Conversely, de-
                      duction can be considered a form of computation if we fix a strategy for
                      proof search, removing the guesswork (and the possibility of employing
                      ingenuity)from thedeductive process.
                         Thislatter idea is the foundation of logic programming. Logic program
                      computation proceeds by proof search according to a fixed strategy. By
                      knowingwhatthis strategy is, we can implement particular algorithms in
                      logic, and execute the algorithms by proof search.
                      1.2  JudgmentsandProofs
                      Since logic programming computation is proof search, to study logic pro-
                      grammingmeanstostudyproofs. WeadoptheretheapproachbyMartin-
                      Lo¨f [3]. Although he studied logic as a basis for functional programming
                      rather than logic programming, his ideas are more fundamental and there-
                      fore equally applicable in both paradigms.
                         Themostbasicnotionisthatofajudgment,whichisanobjectofknowl-
                      edge. We know a judgment because we have evidence for it. The kind of
                      evidence we are most interested in is a proof, which we display as a deduc-
                      tion using inference rules in the form
                                                J :::J
                                                 1    n
                                                        R
                                                   J
                      where R is the name of the rule (often omitted), J is the judgment estab-
                      lished by the inference (the conclusion), and J ;:::;J are the premisses of
                                                            1     n
                      the rule. We can read it as
                           If J and ··· and J then we can conclude J by virtue of rule R.
                              1          n
                         ByfarthemostcommonjudgmentisthetruthofapropositionA,which
                      wewrite as A true. Because we will be occupied almost exclusively with
                      the thruth of propositions for quite some time in this course we generally
                      omit the trailing “true”. Other examples of judgments on propositions are
                      LECTURE NOTES                                  AUGUST29,2006
The words contained in this file might help you see if this file matches what you are looking for:

...Logic programming frankpfenning carnegiemellonuniversity draft of january notes for a course given at carnegie mellon university fall mate rials available http www cs cmu edu fp courses lp please send commentstofp c copyright lecture k august in this rst we give brief introduction to also discuss administrative details the although these are not included here but can be found on web page computationvs deduction is particular way approach other paradigms might compare it imperative or func tional divisions always clear cut functional language may have aspects example mindset various quite different and determines how design reason about programs understand examine difference tween computation compute start from ex pression according xed set rules program generatee result deduce westartfromaconjectureand accordingtoaxedsetofrules theaxioms andinferencerules tryto constructa proofofthe conjecture so computa tion mechanical requires no ingenuity while creative n process b years hard work q...

no reviews yet
Please Login to review.