100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Lecture notes

Lecture Notes on Recursion for Syntax and The Natural Numbers (COMP11120)

Rating
-
Sold
-
Pages
2
Uploaded on
30-05-2024
Written in
2023/2024

Unlock the power of recursion with these detailed lecture notes for COMP11120. Covering essential topics such as recursive definitions, applications in syntax, and the properties of natural numbers, these notes offer clear explanations and practical examples to solidify your understanding. Ideal for COMP11120 students and self-learners alike, these notes are organized and concise, making complex concepts accessible and easier to grasp. Enhance your learning and excel in your studies with this indispensable resource!

Show more Read less








Whoops! We can’t load your doc right now. Try again or contact support.

Document information

Uploaded on
May 30, 2024
Number of pages
2
Written in
2023/2024
Type
Lecture notes
Professor(s)
Andrea schalk
Contains
Recursion for syntax and the natural numbers

Content preview

Recursion for Syntax and The Natural Numbers

Syntax and recursion :
Logic

Propositional Formulae are defined recursively ! Example of a recursively defined operation : boolean interpretation

base case If p is a
propositional atom ,
then p is a
formula
Let be valuation that 10 13 to each prop variable
Step .
case
If A is a formula ,
then -A is a
formula v a assigns a value in , .




·
If A B ,
are
formulae ,
then o
AvB Can define Iv : Set of all prop formulae > 10 1),




·
An B base case Irp =
up

·
A > B Step Cases < [v(1A) = LIVA


are
formulae .
v
[v(AvB) = IvA v IrB


1 [v(AnB) =
IvA n lvB


< Iv(A >
B) = IvA > IvB




Syntax and recursion : Formal Languages

Example Pattern : (or regular expression) over alphabet Example : The
property of a
string matching a pattern is recursive




base cases &O is a
pattern base cases & E matches E

E G is a pattern X xEE matches X

X Forxe[ ,
X is a
pattern Step cases - If s, matches p , and se matches Pe then Sisa matches (pipal
,



Step cases + If P , PC are patterns , then so is (PIPa) If s matches p , then
s matches P, /P2

If p , pC are patterns , then so is (P /Pa) , If s matches pa then
s matches P, /P2
,


If pattern then (P )
*
*
p
is a
,
so is *
If ne I and Sy up to Sn pr then
match SiSa ...
In matches pX
What if n = 0 ?

> 3 matches p*




Example : Consider the following definition mapping patterns over [ to subsets of IR




I
base cases 20 = O

-LE =
43] Can prove by induction :

x2x =
(2) Prop Lp =
[SE ** Is matches pl
oncatonation
.




Step cases
+
h(pipa) =
Lp . .
2 c =
455/st2 se2) ,



[(p /Pa)
.
=
Lup u Lp
, &* =
(5 ,
...

Sn nEIN ,
SitL]
*((p*) =
(2p) *



Further examples of recursive constructions ·
Recursion is a
very useful way of defining syntatic expressions of arbitrary leught
·
string generated by a
grammar
·
Can then also use recursion to help us
give meaning to such expressions.

· The While language :
· arithmetic expressions ·
Can then use induction to prove properties of such expressions operations or properties for these.
·
boolean expressions

·
statements
·
Execution of While
a
program
·
Derivations of Hours triples for While programs
£6.49
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
jpxoi

Also available in package deal

Thumbnail
Package deal
Complete Semester 2 Lecture Notes Bundle
-
8 2024
£ 49.92 More info

Get to know the seller

Seller avatar
jpxoi The University of Manchester
View profile
Follow You need to be logged in order to follow users or courses
Sold
0
Member since
1 year
Number of followers
0
Documents
20
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these revision notes.

Didn't get what you expected? Choose another document

No problem! You can straightaway pick a different document that better suits what you're after.

Pay as you like, start learning straight away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and smashed it. It really can be that simple.”

Alisha Student

Frequently asked questions