CS 7120 Functional and Logic Programming


  • Instructor : T. K. Prasad
  • Phone No. : (937)-775-5109 
  • Email : t.k.prasad@wright.edu 
  • Home Page : http://cecs.wright.edu/people/faculty/tkprasad
  • Semesterer : Summer, 2024.
  • Class Hrs : N/A (Pretend Tue/Thu schedule for lectures)
  • Office Hrs : Prefer email (for private issues) and discord channel for CS7120 (for class-related issues). Special situation: Available in person (395 JC) with appointment.
  • Instructor/Class Communication: By Email/Discord
  • GTA/Grader (Email) [Office Hours]:   Nathaniel Crossman (crossman.4@wright.edu)  [TBA]

  • Course Description

    This course will discuss important concepts and language features to support  (i) functional programming and (ii) logic programming. Specifically:
    (i) The first half of the course will cover functional programming techniques and constructs such as recursive definitions, higher-order functions, type inference, polymorphism, abstract data types, and modules. The examples will illustrate the utility of list-processing, pattern matching, abstraction of data/control, strong typing, and parameterized modules (functors). We will also study the mathematical reasoning (induction) involved in the design of functional programs and for proving properties about functions so defined. The programming assignments will be coded in SML '97 (Standard ML of New Jersey) and Haskell.
    (ii) The second half of the course will cover logic programming paradigm and Prolog. We discuss the syntax and the semantics of Prolog, the workings of a Prolog interpreter, and various applications of Prolog. We consider the use of declarative programming and pattern matching for database querying, parsing, meta-programming, and problem solving in AI.The programming assignments will be coded in XSB and/or SWI_Prolog.


    Prerequisites


    Recommended Texts

    1. ML for the working programmer (2nd Ed.), L. C. PAULSON, Cambridge University Press, 1996. ISBN 0-521-56543-X.
    2. Ivan Bratko, Prolog Programming for Artificial Intelligence (Fourth Edition). Addison-Wesley Publ. Co., 2012. ISBN-13: 9780321417466.
    3. PLUS: Online course material (including slide decks linked below).

    Functional Programming References

    1. Elements of ML Programming (ML 97 Ed.), J. D. ULLMAN, Prentice Hall, 1998. ISBN 0-13-790387-1.
    2. Introduction to Functional Programming in Haskell (2nd Ed.), R. S BIRD, International Series in Computer Science. Prentice Hall, 1998. ISBN: 0-13-484346-0
    3. Programming in Standard ML , Robert Harper, Carnegie Mellon University, 2011.
    4. A Gentle Introduction to Haskell , Paul Hudak, John Peterson, Joseph Fasel, 2000. 
    5. Why Functional Programming Matters, John Hughes.
    6. The Semantic Elegance of Applicative Languages, David Turner, Proceedings of the 1981 conference on Functional programming languages and computer architecture, pp. 85-92, 1981.
    7. The Standard ML Basis Library, Edited by Emden R. Gansner, John H. Reppy, Cambridge University Press, 2004.

    Logic Programming References

    1. David S. Warren, Programming in Tabled Prolog. (Online)
    2. W. F. Clocksin and C.S.Mellish, Programming in Prolog (Fourth Edition), Springer-Verlag, 2000.
    3. Ulf Nilsson and Jan Maluszynki, Logic Programming and Prolog (Second Ediiton), 2000.

    Course Load and

    The course load includes a mixture of homeworks and programming assignments worth 20 points, the first test worth 30 points and the second test worth 50 points. The format of the tests will be communicated to you before their administration and they will not be comprehensive. All the recorded lectures will be available in Panopto from course webpage on Pilot and slide decks for the lectures from this publically available course webpage (https://cecs.wright.edu/people/faculty/tkprasad/courses/cs7120/cs7120.html).  Note that  the lectures  and slide decks  are organized  around  topics and do not clearly  map to  fixed lecture time periods but cover all the requisite content.

    Exam Policy
    The two tests will be conducted in-class and every registered student MUST take them in-person.  Any academic impropriety during the test (which includes copying from or communicating with other students, or accessing web resources and passing it off as your own work) will have a minimum penalty of 'F' grade, plus additional disciplinary action for unethical behavior. See http://www.wright.edu/students/judicial/integrity.html for details.

    Applicable University Policy on Generative AI

    You are not permitted to use generative AI tools (such as ChatGPT and GitHub Co-Pilot) for generating assignment solutions for this course or for tests. It will be considered a violation of the university’s academic integrity policies. In general, if you have any questions about whether or not use of a particular tool or technology is allowed, check with your instructor/GTA first. (Also note that the output generated by these tools can be invalid (due to hallucination) and you will not be able to detect it without first knowing what the "correct" answer is, which is what this course is trying to provide.)


    Grading

    The letter grades will be assigned using the following scale: A[90-100], B[80-90), C[70-80), D[60-70), and F[0-60). However, I reserve the right to adjust the scale to utilize the gaps in the distribution. When the class size is large, the grade cut-offs will be guided by the mean and the standard deviation of the cumulative scores. 

    Class Schedule and Syllabus

    No.
    Topic
    Readings
    Class 1 Functional Programming Basics; Higher-order functions Chap. 1,2,5 (LP) Chap. 1,2,5 (JU)
    Class 2 Type Inference; Polymorphic Type System
    Chap. 2, 3 (LP)   (Fixed Points)
    Class 3   Programming with lists: Pattern matching Chap. 3 (LP) Chap. 3-5 (JU) 
    Class 4 SML-97 Specifics  (JU)
    Class 5
     Introduction to Haskell Adv Haskell (1) (2)
    Class 6
    Fold operations : foldr, foldl Chap. 5 (LP) Chap. 5 (JU)
    Class 7 Types : Concrete and Abstract Chap 6 (JU) Chap 7 (LP)
    Class 8 Modules Chap 7 (LP) Chap. 8 (JU)
    Class 9 Recursion and Induction Chap. 6 (LP)
    Class 10 Examples (Combinatorial Functions)
    Class 11 Efficiency; Streams;Records; Exceptions; References; Chap 5, 8 (LP) Chap. 7 (JU)
    Class 12
    Test 1  (June 5, Wednesday, 10am-11am, Loc: 339 RC)

    Class 13 Lambda Calculus Optional (1) (2) Scala
    Class 14
    Logic Programming Paradigm

    Class 15
    Prolog and Unification

    Class 16
    Meaning of Prolog Programs

    Class 17
    List Processing; Operators
    Class 18
    Arithmetic; Structures
    Class 19
    Controlling Backtracking
    Class 20
    Negation as Failure and Built-in Predicates

    Class 21
    Definite Clause Grammars
    Class 22
    Meta-Programming/Interpreters
    Class 23
    Constraint Logic Programming Practical Applications
    Class 24
    Logic and Models : Semantics of Prolog Programs
    Class 25
    (cont'd)
    Class 26
    Query Evaluation Strategies; Efficiency
      Test 2 (July 24, Wednesday, 10am-11:30am, Loc: 339 RC)

    Assignments ( Summer 2024 (TBA) )

    (Will be emailed)

    Assignments ( Summer 2022 )


    Old Examinations