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

Lecture Notes on Part II of Fundamentals of Computation (COMP11212)

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

Advance your understanding of computation with these in-depth lecture notes on Part II of Fundamentals of Computation (COMP11212). These notes cover: The While Programming Language, Coding and Counting Programs, Complexity and Asymptotic Analysis, and. Correctness These lecture notes provide a structured approach to complex topics, making them accessible and easy to understand. Ideal for students aiming to master the advanced concepts in COMP11212.

Show more Read less
Institution
Course









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

Written for

Institution
Study
Unknown
Course

Document information

Uploaded on
May 30, 2024
Number of pages
6
Written in
2023/2024
Type
Class notes
Professor(s)
Ramon fraga pereira
Contains
The while programming language, coding and counting programs, complexity and asymptomatic analysis, and correctness

Subjects

Content preview

The While Programming Language

he Three Cs of
-




Computer Science What is a computer ?

1. Does
program Pr and Pa that
a both compute a
function ,
f
Complexity A thing that compute...
which one is better ?



.
2 Does Correctness
a
program p correctly compute a
function fu
.
3 What functions can we compute ? i e
.
. are there functions that Computability
cannot be computed by any program ?

Do we need a
computer for Computation ?
No !




The While
Programming Language
Semantics What a
Meaning of a
program what function it
computes
:
program means



Define what it means to interpret execute programs Operational
Syntax : The
form that programs are allowed to take We
focus on these

Define a
program by what it provably does Axiomatic
All languages have will defined
a
syntax
Transform other metalanguage Denotational
Very few have a
formal semantics programs
into some




Syntax given as a
grammar Semantics of the Language
.
5 v := alskip)Seise if then Sy else Se while b do s We need : Weintroduce a relation - on
programs and states :


b : true false an = as an Ea2 it b, "be
·
Represent current values of variables (State

a : In a, +as a, -de a, a2
·
Evaluate arithmetic and logical expressions Si G
A
↓ Sid
·


program state
·
Show how program statements transform state


S =
Statements (Stm) S , 019, 01 ...
15

b =
Boolean Expression (BExp) State = Var 1 > I


a =
Arithmetic Expressions (AExp) D 5


X =
Variables Y 7 [ -1) 5 4117 2110] , ,



I
maps to ...



n =
Numerals Z O




Use () to remove ambiguities Examples
[x + <
3 , y1 ,
2](x) = 3 ([x . < 3) [x ·,
2] (x) =
3 [24y](x) =
?

o(x) · (x) = 2 Y + T
= 3




[2H 3)
[NYIST
· 1 , y H 2 ,
2 -


I




not state (0 ( y +
47)(y) =
3 (0[2 +])(2) + =
4

Y = 4 x = 1




(0[X ++
2))(v) =
3

v = 0 not defined variables default to 0



o this
The Transition System is in the !
given exam




[ass] [Skip]
!
[2 : = 1
,
[]) <2 : = x +y, [X +
1]) < Skip ,
[x ++ 3, y >
2]




IJAIS
↓ [x
↓ +
1][z1)1] ↓ [2 3, y + .
2



S - [x + 1
,
24 1]


- [] [11 <
I

-[2 H
1]

, [iffetiff] b is true
,
then use iffet b is false , then use iffff [while]

if two then [J] *
else [J) While (y < 1) do (y : y + 2) [y Y
1 else
~
,
z := v : = 2
,
if xx then X := 1 v : = 2 = + 2]
10
,
I


So
,


9b Si Sa 9b Si
WE While (y < 1) do (y : =
y + 2)
S2
-
↓ (v : = 1
, []Y (iftt) ↓ [v : = 2, [JY lifff) ↓ (if (y <1) than (4 :=
y +2
; W) also ship [y
,
+
2]) [while]

[ifff]
Si
↓ [2H 1] (ass) ↓ [2 + 2] (ass) ↓ (skip [y ,
+ 2])

↓ [y +
2] [Skip]




[comp]
!!!
(2 := 10 = x +1
, []

Rewrite ! Alternative !
[x : = 1
,
[3)][X +
1] X(x := x +1
,
[x +
1]) [ass]
[comp2]
[ : = 1 ; k : = x +1
, [])X(k := x + 1 ,
[x +
1]) ↓ [x +
2] [ass]
$13.01
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

Get to know the seller

Seller avatar
jpxoi The University of Manchester
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 tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right 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 aced it. It really can be that simple.”

Alisha Student

Frequently asked questions