formal languages part two
Download
Skip this Video
Download Presentation
Formal Languages, Part Two

Loading in 2 Seconds...

play fullscreen
1 / 20

Formal Languages, Part Two - PowerPoint PPT Presentation


  • 74 Views
  • Uploaded on

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

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Formal Languages, Part Two' - nuala


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
formal languages part two

Formal Languages, Part Two

SIE 550 Lecture

Matt Dube

Doctoral Student – Spatial

where we left off on friday
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

NON- TERMINAL SYMBOLS

atom::=proton{proton}{electron}{neutron}

TERMINAL SYMBOLS

Carbon 14 = 6 protons, 6 electrons, 8 neutrons

Helium = 2 protons, 5 electrons, 2 neutrons

homework from friday
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.

48 + 97 –9+ 17 – 4–1 … =?

one possible solution
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

undo

Another Example to Discuss

Language for Computer Drawing?

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
Questions, Comments, Concerns?
  • Please voice before we move forward
today s class
Today’s Class
  • Apply formal languages to a class of English sentences
  • Propositional logic
  • First Order Languages
  • Predicates
backus naur form

Peter Naur

John Backus

Backus-Naur Form
  • Recall the operators: | ::= [] {} “” ()
  • These operators are referred to as the Backus-Naur Form.
  • “Language of the language” – meta-language
  • Standard syntax
example of bnf
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 veterinarian

The tricycle burns rubber.

the cat rode a tricycle.

a tricycle burns the ferrari.

what are the goals
What are the goals?
  • We want a computer to retrieve correct information.
  • We want a computer to tell us correct information.
  • We want a computer to test the correctness of information.
  • We want a computer to infer correct information.

Query Language

Print Commands

Formal Language

???

How should we go about that?

slide11
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 Can Think!

slide12

You expect me to think?

I am only a machine!

My aren’t they temperamental sometimes!

how do we rectify the situation
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
  • 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?
slide15
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
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
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
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
Example

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)

TERMINAL SYMBOLS

Suzy

John

AXIOMS

Jack

Almice

What can we say about:

Tim

Daniel

other example commands
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
ad