Formal Languages, Part Two SIE 550 Lecture Matt Dube Doctoral Student – Spatial.

Slides:



Advertisements
Similar presentations
Introduction to Programming
Advertisements

Predicate Logic Colin Campbell. A Formal Language Predicate Logic provides a way to formalize natural language so that ambiguity is removed. Mathematical.
The Foundations: Logic and Proofs
ICE1341 Programming Languages Spring 2005 Lecture #6 Lecture #6 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University.
BNF. What is BNF? BNF stands for “Backus-Naur Form,” after the people who invented it BNF is a metalanguage--a language used to describe another language.
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 11.
Chapter Chapter Summary Languages and Grammars Finite-State Machines with Output Finite-State Machines with No Output Language Recognition Turing.
SIE 550 – Formal Languages Lecture for SIE 550 Matt Dube Doctoral Student – Spatial IGERT Fellow.
1 Logic What is it?. 2 Formal logic is the science of deduction. It aims to provide systematic means for telling whether or not given conclusions follow.
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages Chapter 3 : Describing Syntax and Semantics Axiomatic Semantics.
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
C. Varela; Adapted w/permission from S. Haridi and P. Van Roy1 Declarative Computation Model Defining practical programming languages Carlos Varela RPI.
Concepts of Programming Languages 1 Describing Syntax and Semantics Brahim Hnich Högskola I Gävle
CS 330 Programming Languages 09 / 13 / 2007 Instructor: Michael Eckmann.
TR1413: Discrete Mathematics For Computer Science Lecture 3: Formal approach to propositional logic.
Axiomatic Semantics Dr. M Al-Mulhem ICS
From Chapter 4 Formal Specification using Z David Lightfoot
PSUCS322 HM 1 Languages and Compiler Design II Formal Semantics Material provided by Prof. Jingke Li Stolen with pride and modified by Herb Mayer PSU Spring.
Dr. Muhammed Al-Mulhem 1ICS ICS 535 Design and Implementation of Programming Languages Part 1 Fundamentals (Chapter 4) Axiomatic Semantics ICS 535.
Chapter 3: Formal Translation Models
1 Knowledge Representation and Reasoning. 2 Knowledge Representation & Reasoning How knowledge about the world can be represented How knowledge about.
Logical and Rule-Based Reasoning Part I. Logical Models and Reasoning Big Question: Do people think logically?
FIRST ORDER LOGIC Levent Tolga EREN.
Predicates and Quantifiers
The Foundations: Logic and Proofs
Copyright © Cengage Learning. All rights reserved.
Theory Of Automata By Dr. MM Alam
Formal Theories SIE 550 Lecture Matt Dube Doctoral Student - Spatial.
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
First Order Logic Chapter 7. PL is a Weak Representational Language §Propositional Logic (PL) is not a very expressive language because: §Hard to identify.
Syntax Specification and BNF © Allan C. Milne Abertay University v
A sentence (S) is composed of a noun phrase (NP) and a verb phrase (VP). A noun phrase may be composed of a determiner (D/DET) and a noun (N). A noun phrase.
Languages, Grammars, and Regular Expressions Chuck Cusack Based partly on Chapter 11 of “Discrete Mathematics and its Applications,” 5 th edition, by Kenneth.
CS Describing Syntax CS 3360 Spring 2012 Sec Adapted from Addison Wesley’s lecture notes (Copyright © 2004 Pearson Addison Wesley)
1 Sections 1.5 & 3.1 Methods of Proof / Proof Strategy.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
5 BASIC CONCEPTS OF ANY PROGRAMMING LANGUAGE Let’s get started …
ProgrammingLanguages Programming Languages Language Syntax This lecture introduces the the lexical structure of programming languages; the context-free.
C H A P T E R TWO Syntax and Semantic.
1.  Provides the ability to access individual assertions. e.g. in Predicate calculus we may say: P denotes “It rained on Tuesday” but in predicate calculus.
1 Syntax In Text: Chapter 3. 2 Chapter 3: Syntax and Semantics Outline Syntax: Recognizer vs. generator BNF EBNF.
Programming Paradigms Backus Naur Form and Syntax Diagrams.
Copyright © Curt Hill Languages and Grammars This is not English Class. But there is a resemblance.
C++ Basics C++ is a high-level, general purpose, object-oriented programming language.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
© 2004 Pearson Addison-Wesley. All rights reserved ComS 207: Programming I Instructor: Alexander Stoytchev
1 Introduction to Computational Linguistics Eleni Miltsakaki AUTH Spring 2006-Lecture 8.
Chapter 3 Describing Syntax and Semantics
CS6133 Software Specification and Verification
Syntax and Grammars.
Programming Errors. Errors of different types Syntax errors – easiest to fix, found by compiler or interpreter Semantic errors – logic errors, found by.
Syntax and Semantics Form and Meaning of Programming Languages Copyright © by Curt Hill.
Propositional Logic Rather than jumping right into FOL, we begin with propositional logic A logic involves: §Language (with a syntax) §Semantics §Proof.
C H A P T E R T W O Syntax and Semantic. 2 Introduction Who must use language definitions? Other language designers Implementors Programmers (the users.
Lecture 041 Predicate Calculus Learning outcomes Students are able to: 1. Evaluate predicate 2. Translate predicate into human language and vice versa.
Logic Programming Logic programming Candidates should be familiar with the concept of logic programming for declaring logical relationships.
7.2 Programming Languages - An Introduction to Informatics WMN Lab. Hye-Jin Lee.
March 3, 2016Introduction to Artificial Intelligence Lecture 12: Knowledge Representation & Reasoning I 1 Back to “Serious” Topics… Knowledge Representation.
Chapter 3 – Describing Syntax CSCE 343. Syntax vs. Semantics Syntax: The form or structure of the expressions, statements, and program units. Semantics:
PROGRAMMING LANGUAGES
CS510 Compiler Lecture 4.
What does it mean? Notes from Robert Sebesta Programming Languages
Theory of Computation Languages.
First-order (predicate) Logic
CS 416 Artificial Intelligence
Plan for Lecture Review code and trace output
Predicates and Quantifiers
Logical and Rule-Based Reasoning Part I
Introduction to Computational Linguistics
Instructor: Alexander Stoytchev
Presentation transcript:

Formal Languages, Part Two SIE 550 Lecture Matt Dube Doctoral Student – Spatial

Where we left off on Friday Formal Languages –Terminal Symbols – base-level instances “symbols that we can’t break down further”-Jake –Non-terminal Symbols – rules to extract specific sequences of terminal symbols “symbols that can be broken down” Well Formed Formulas (WFF) –Valid outputs of a formal language –Semantics DO NOT matter! –Logic is not involved TERMINAL SYMBOLS NON- TERMINAL SYMBOLS atom::=proton{proton}{electron}{neutron} Carbon 14 = 6 protons, 6 electrons, 8 neutronsHelium = 2 protons, 5 electrons, 2 neutrons

Homework from Friday You are a math teacher and want to take a nap during class. Create a formal language that will generate addition and subtraction problems involving arbitrary terms over positive integers – – 4 – 1 … =?

One possible solution start ::= problem problem ::= integer sign {term} integer end term ::= integer sign integer ::= digit/0 {digit} sign ::= “+” | “-” end ::= “=?” digit/0 ::= “1” | “2” | … | “9” digit ::= “0” | “1” | “2” | … | “9”

Another Example to Discuss Language for Computer Drawing? undo Just like text, we can interpret this as a formal language and use the same concepts and terminology! Terminal Symbols? Non-terminal Symbols?

Questions, Comments, Concerns? Please voice before we move forward

Today’s Class Apply formal languages to a class of English sentences Propositional logic First Order Languages Predicates

Backus-Naur Form Recall the operators: |::=[]{}“” () These operators are referred to as the Backus-Naur Form. “Language of the language” – meta-language Standard syntax John Backus Peter Naur

Example of BNF start ::= transitive_sentence transitive_sentence ::= [article] noun verb [article] noun end article ::= “a” | “an” | “the” noun ::= “tricycle” | “cat” | “veterinarian” | “rubber” | “ferrari” verb ::= “rides” | “fixes” | “eats” | “burns” | “jumps” end ::= “.” the cat fixes the veterinarian.an ferrari eats a cat.ferrari jumps a veterinarianThe tricycle burns rubber.the cat rode a tricycle.a tricycle burns the ferrari.

What are the goals? 1.We want a computer to retrieve correct information. 2.We want a computer to tell us correct information. 3.We want a computer to test the correctness of information. 4.We want a computer to infer correct information. Query Language Print Commands ??? Formal Language How should we go about that?

Well… How do we do it minus a computer? Propositional Logic –Related statements and then moving information between them –Example: Jake lives in Hampden Hampden is in Maine Therefore Jake lives in Maine. Very effective system if…

You expect me to think? I am only a machine! My aren’t they temperamental sometimes!

How do we rectify the situation? We need a logic system “Propositional logic”-like, but… We know a computer can: –Handle a formal language –Cross-reference and replace terms –Pass information through code So what’s missing? –We need functions to pass through

First Order Logic First order logic = functional propositional logic Example: –man(X) –X=socrates –X=plato man(socrates) -> socrates is a man. man(plato) -> plato is a man. Could we use this?YES –What if we established “man(socrates)” as a terminal symbol and put something above it in the code saying mortal(X)::=man(X)? –Do we find out anything else about socrates?

Note Things in a computer program starting with a capital letter are variables. Things in a computer program starting with a lowercase letter are constants. IMPLICATION: The program sees what satisfies the capital letter and then passes that information through the rest of the program.

A New Language It is now time to define a new type of formal language: a first order language. WFFs in a first order language –a predicate –(WFF or WFF) –(WFF and WFF) –(WFF implies WFF) –(WFF = WFF) WHAT IS A PREDICATE? animal( )

Predicates Gateways –man() Whatever we put inside the parentheses is a man. –father(,) Whatever we put first is the father; second is the child. User defined linkages Predicates are non-terminal symbols Variables are non-terminal symbols Constants are terminal symbols Number of terms in the predicate = arity

Use formal language now Treat predicate information based on constants as if they were terminal symbols –man(mike), man(henry), etc. Treat predicate information based on variables as if they were non-terminal symbols –mortal(X)::=man(X) If X is a man, than X is also a mortal. We can now build in as many crazy combinations as we choose.

Example What can we say about: JohnSuzy Jack Daniel Almice Tim TERMINAL SYMBOLS AXIOMS PREDICATE CALCULUS parent(X,A) ::= father(X,A) | mother(X,A) child(X,A) ::= father(A,X) | mother(A,X) father(john,suzy) father(jack,daniel) mother(almice,jack) mother(almice,tim)

Other Example Commands We used an or statement –Mother or father makes you a parent father(X,A)=child(A,X) –If X is A’s father, then A is a child of X IMPLY parents(X,Y,A)=parent(X,A) parent(Y,A) –X and Y are A’s parents if X is A’s parent and Y is also A’s parent AND