CA 208 Logic Ex9 Define the following list processing predicates in Prolog: member(X,L) % if X is a member of list L last_member(X,L) %

Slides:



Advertisements
Similar presentations
Recognising Languages We will tackle the problem of defining languages by considering how we could recognise them. Problem: Is there a method of recognising.
Advertisements

Regular operations Sipser 1.1 (pages 44 – 47). CS 311 Fall Building languages If L is a language, then its complement is L’ = {w | w ∉ L} Let A.
The Logic of Quantified Statements
06/01/101 Functional Programming GC16 / 3011 Chris Clack.
1 Generalized Buchi automaton. 2 Reminder: Buchi automata A=  Alphabet (finite). S: States (finite).  : S x  x S ) S is the transition relation. I.
1 Languages. 2 A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet: Languages.
Finite Automata Section 1.1 CSC 4170 Theory of Computation.
Regular operations Sipser 1.1 (pages 44 – 47). CS 311 Mount Holyoke College 2 Building languages If L is a language, then its complement is L’ = {w |
CS5371 Theory of Computation
1 Lecture 22 Myhill-Nerode Theorem –distinguishability –equivalence classes of strings –designing FSA’s –proving a language L is not regular.
1 Module 9 Recursive and r.e. language classes –representing solvable and half-solvable problems Proofs of closure properties –for the set of recursive.
1 CSCI-2400 Models of Computation. 2 Computation CPU memory.
1 Languages and Finite Automata or how to talk to machines...
Fall 2006Costas Busch - RPI1 Properties of Regular Languages.
Foundations of (Theoretical) Computer Science Chapter 1 Lecture Notes (Section 1.1: DFA’s) David Martin With some modifications.
1 Module 24 Myhill-Nerode Theorem –distinguishability –equivalence classes of strings –designing FSA’s –proving a language L is not regular.
1 Module 10 Recursive and r.e. language classes –representing solvable and half-solvable problems Proofs of closure properties –for the set of recursive.
(a) (b) (c) (d). What is (1,2,3)  (3,4,2)? (a) (1, 2, 3, 4) (b) (1,2)  (3,4) (c) (1,3,4,2) (d) (3,1)  (4,2)
The Church-Turing Thesis Lecture by H. Munoz-Avila.
INTRODUCTION TO THE THEORY OF COMPUTATION INTRODUCTION MICHAEL SIPSER, SECOND EDITION 1.
CSC312 Automata Theory Lecture # 2 Languages.
Costas Busch - LSU1 Languages. Costas Busch - LSU2 Language: a set of strings String: a sequence of symbols from some alphabet Example: Strings: cat,
L ECTURE 1 T HEORY OF A UTOMATA. P RAGMATICS  Pre-Requisites  No Pre-Requisite  Text book  Introduction to Computer Theory by Daniel I.A. Cohen 
1 Strings and Languages. 2 Review Sets and sequences Functions and relations Graphs Boolean logic:      Proof techniques: – Construction, Contradiction,
CS3518 Languages and Computability Kees van Deemter Lectures Monday14:00New King’s 14 Tuesday11:00KC T2 Tutorials/Practicals Tuesday13:00-15:00.
1 INFO 2950 Prof. Carla Gomes Module Modeling Computation: Language Recognition Rosen, Chapter 12.4.
Languages Given an alphabet , we can make a word or string by concatenating the letters of . Concatenation of “x” and “y” is “xy” Typical example: 
Chapter Three: Lists, Operators, Arithmetic 1. © Patrick Blackburn, Johan Bos & Kristina Striegnitz Important things about lists  List elements are enclosed.
Strings and Languages CS 130: Theory of Computation HMU textbook, Chapter 1 (Sec 1.5)
Models of Computation. Computation: Computation is a general term for any type of information processing information processing CPU memory.
2.3 – Solving Multi-Step Equations. Note: REVERSE Order of Operations! Ex. 1 -7(p + 8) = 21.
Principles of programming languages 12: Logic programming Supplemental material Definition of prefix and suffix Isao Sasano Department of Information Science.
Module Code MA1032N: Logic Lecture for Week Autumn.
CS 111 – Nov. 5 Sorting –Selection and Bubble √ –insertion: place next element in correct place by shifting over other ones to make space –Merge: Repeatedly.
ARITHMETIC SEQUENCES. SEQUENCE  What is a sequence?  “A list of things (usually numbers) that are in order.”  We are free to define what order that.
1 Artificial Intelligence CS370D Prolog programming List operations.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 0 Introduction Some slides are in courtesy of Prof.
07/10/04 AIPP Lecture 5: List Processing1 List Processing Artificial Intelligence Programming in Prolog Lecturer: Tim Smith Lecture 5 07/10/04.
String Analysis for JavaScript Programs Serena KingDr.Lu Yves Engelmann.
2.4 – Solving Equations with the Variable on Each Side.
A Quick Review of Set Theory A set is a collection of objects. A B D E We can enumerate the “members” or “elements” of finite sets: { A, D, B, E }. There.
Binary Search Trees CH Gowri Kumar
Theory of Computation Automata Theory Dr. Ayman Srour.
Deterministic Finite-State Machine (or Deterministic Finite Automaton) A DFA is a 5-tuple, (S, Σ, T, s, A), consisting of: S: a finite set of states Σ:
Chapter 2: SETS.
Introduction Chapter 0.
Languages.
Lecture 1 Theory of Automata
Languages Prof. Busch - LSU.
Languages Costas Busch - LSU.
Properties of Regular Languages
Jaya Krishna, M.Tech, Assistant Professor
CSE322 PROPERTIES OF REGULAR LANGUAGES
Properties of Regular Languages
SETS A set is a collection of objects of any kind which are collected together perhaps because of some property they have in common. Examples: The collection.
صياغة البرامج ولغات البرمجة Programming & programming languages
Strings and Languages cs466(Prasad) L2Lang.
Finite-State Methods in Natural-Language Processing: Basic Mathematics
Introduction Chapter 0.
Test123 blah. hjghgghhg.
Section 2.6 Infinite Sets.
Chapter 1 Regular Language
Dr. Yasser Nada Fall 2010/2011 Lecture 5
7C Complements of Sets 7D-7G Venn Diagrams
CSC 4170 Theory of Computation Finite Automata Section 1.1.
LANGUAGE EDUCATION.
List Operation in ProLog EUSL/TC/IS/2013/COM/08. In here list will print..
_______ Book Title #1 Here Book Title #1 Book Title #3 Book Title #5 Book Title #2 Book Title #4 This is an example of what the QR Code will look.
Languages Fall 2018.
Terminology and Symbols
Presentation transcript:

CA 208 Logic Ex9 Define the following list processing predicates in Prolog: member(X,L) % if X is a member of list L last_member(X,L) % if X is the last member of list L last_two_members(X,Y,L) % if X and Y are the last two members of list L odd_list(L) % if L has odd number of elements even_list(L) % if L has even number of elements insert(X,L1,L2) % if list L2 is list L1 with X inserted delete(X,L1,L2) % if list L2 is L1 with X deleted conc(L1,L2,L) % if list L is the concatenation of L1 with L2 reverse(L1,L2) % if list L2 is the reverse of L1

CA 208 Logic Ex9 Define a “waffle”-machine in Prolog as a Finite-State Automaton that accepts/generates the infinite language (coded as Prolog lists): [ ] [b,l,a,h] [b,l,a,h,b,l,a,h] [b,l,a,h,b,l,a,h,b,l,a,h, ....]