100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Lecture Notes on Part II of Fundamentals of Computation (COMP11212) $12.32   Add to cart

Class notes

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

 4 views  0 purchase
  • Course
  • Institution

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 s...

[Show more]

Preview 2 out of 6  pages

  • May 30, 2024
  • 6
  • 2023/2024
  • Class notes
  • Ramon fraga pereira
  • The while programming language, coding and counting programs, complexity and asymptomatic analysis, and correctness
  • Unknown
avatar-seller
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]

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller jpxoi. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $12.32. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

79223 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$12.32
  • (0)
  Add to cart