Download Formal Systems - DCU School of Computing

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
CA208
-- Formal Systems --
Creating a Formal Language
Syntax
Semantics
Deduction
Logic is easier to understand
if viewed as a formal language
Jer Hayes 2001
CA208
A formal system consists of
a formal language and a deductive apparatus.
A formal language consists of two things:
(1) An alphabet - which symbols are to be found in the language
(2) Syntax which governs how the symbols are to be put
together.
Example – a formal language expressing real
numbers e.g. 3.14
We need an alphabet
{
}
Jer Hayes 2001
CA208
The alphabet contains the symbols
that will make acceptable strings.
An acceptable string is a: Well Formed Formula
or wff for short
A wwf is defined by the grammar of the language –
Rules that specify the syntax
Lets consider an example formal language – EFL
Jer Hayes 2001
CA208
Alphabet – { *, $ }
Grammar rules:
A wff in this example formal language is any finite
string of zero of more * symbols, followed by between one and four $
symbols, or a string of one or more * symbols with no $ following.
Are these wff? –
*********$$$
****$$$$
$$
*****************$
*****
Jer Hayes 2001
CA208
Strings which do not fit the grammar
rules are not wff:
**$$$*
$$$*
Note that there are a number of
fixed ways for writing Formal Languages…
What has this got to do with Computer Science?
Consider the following…
Jer Hayes 2001
CA208
Semantics
We have looked at symbols and paid attention to
whether or not these symbols had a meaning.
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, . }
could just as well be
{ *, &, ^, $, ~, <, >, ?, !, |, @ }
Using something counter-intuitive is not
helpful…
Jer Hayes 2001
CA208
To get meaning we have to specify
what every wff means.
This is done by mapping from one domain into
the formal language.
Consider the EFL example:
Alphabet: { *, $ }
Grammar rules:
A wff in this example formal language is any finite string of zero
of more * symbols, followed by between one and four $ symbols,
or a string of one or more * symbols with no $ following.
Jer Hayes 2001
CA208
To this is added –
Interpretation: in the example formal language let * have the value
5 and let $ have the value 1. The placing of one symbol next to the
other indicates that their values are to be added together
What do the following mean?
$$$
1+1+1=3
***$$ 5 + 5 + 5 + $ + $ = 17
Jer Hayes 2001
CA208
The important thing to consider here is that we can change the
interpretation of the language which will change the semantics of
the language but leaves the syntax unaffected.
Consider the following:
A new interpretation - EFL( $ ) = 5. EFL = ( * ) = 10. The placing
of one symbol next to the other indicates that their values are to be
added together
So, what do the following mean?
$$$
5 + 5 + 5 = 15
***$$ 10 + 10 + 10 + 5 + 5 = 40
Jer Hayes 2001
CA208
We should know what a formal language is at this stage.
A formal system is a formal language + a deductive apparatus.
What is a deductive apparatus?
It is a means of manipulating wff without reference to what these
symbols may mean.
The removal of ‘meaning’ may seem strange but consider the
following –
2+2=4
We just need some way of manipulating symbols –
Jer Hayes 2001
CA208
We don’t care if the numbers refer to things in the real world.
We are dealing with abstraction.
Actually this approach has a long history –
Consider the following
All humans are mortal.
Socrates is a human.
Therefore, Socrates is mortal.
This can be abstracted further…
…Aristotle is credited with being the first to spot this.
Jer Hayes 2001
CA208
A deductive apparatus is made up two parts –
(1) Axioms – any wff that can be written down without reference
to other wff
(2) Inference rules – rules which allow us to produce wffs in the
language as immediate consequences of other wffs.
[ The best way to think of an inference rule is that it is generally
going to be – you give me an X and I’ll give you a Y ]
Lets consider an example…
Jer Hayes 2001
CA208
A simple Formal System
Alphabet – { $, *, & }
A sentence is a: string of * followed by a $ followed by a string of
* followed by a & followed by a string of *.
Possible rules for what the strings should be?
Axiom: *$*&**
Inference Rule: If a$b&c is a given wff where a,b, and c are strings
of stars then, a$b*&c* is an immediate consequent of it.
So using this we need to find matches.
Jer Hayes 2001
CA208
Show –
*$****&****
is an immediate consequence of the wff
*$***&***
Jer Hayes 2001
CA208
Once we have all this we can define –
Proof
A proof in a formal system F is a finite sequence of wffs
in the associated formal language…
…each of which is either an axiom of F or an immediate
consequence of one or more of the preceding wffs.
A wff which can be proven within F is called a theorem.
All axioms are theorems.
Jer Hayes 2001
CA208
Theorem is:
*$****&*****
Start with the axiom…
*$*&**
*$**&***
*$***&*****
*$****&*****
Human Reasoning & Mathematics
Jer Hayes 2001