COMP2111 Final Lecture
Session 1, 2013
Kai Engelhardt
Revision: 1.1
1
Exam
when? Friday 2013/06/14 9:4512:00
where? Keith Burrows Theatre
what to bring? student id, 2 (double-sided if you like) A4 pages
of hand-written notes, pen, pencil (optional)
what n
The Relational Data Model
use a simple and uniform data structure: the relation
has been implemented in most commercial database systems
has a solid theoretic foundation.
Structures
In the relational model, everything is described using relations.
A relat
Relational Data Model vs ER Model:
Relation schema (intension) entity or relationship type schema (intension).
attributes attributes
tuple instance of entity/relationship
relation (instance, extension) entity/relationship extension
composite and multivalu
Checking constraints on updates
To maintain the integrity of the database, we need to check that integrity
constraints will not be violated before proceeding with an update.
Example: Suppose we have the following schema with foreign keys as shown:
Inserti
Specications
COMP2111 Lecture 1b
Session 1, 2015
Kai Engelhardt
Revision: 1.2
1
Surprise Quiz Feedback
I looked at all 71 sheets returned.
13 students cant follow simple instructions such as
For the remaining questions, state whether you
could answer them
Extending the Language
COMP2111 Week 6
Session 1, 2015
Kai Engelhardt
Revision: 1.1
1
mergesort in a Nutshell
If a is an array, mergesort (a) informally works as follows:
if the array a has more than 1 cell then
split a evenly into a1 and a2
mergesort (a1
Maximum Segment-Sum
COMP2111 Week 5
Session 1, 2015
Kai Engelhardt
Revision: 1.1
1
Requirements
We have a C-style array A[N] of numbers and want to write a
program that nds the maximum sum s = A[i] + . . . + A[j 1]
where 0 i j N.
Let s specify this proble
Available at the COMP2111 website.
From Hoare Logic to Renement Rules
COMP2111 Lecture Notes Week 4
Kai Engelhardt
Revision: 1.2
1 Introduction
Weve seen that theres a fundamental connection between Hoare triples on the one hand
and renements on the other
Available at the COMP2111 website.
COMP2111 Notes Week 11
Case Study in Forward Simulation
Kai Engelhardt
May 21, 2015
Revision: 1.1
1 Introduction
This note explains how to prove forward simulation without having to unravel the semantics
of program snipp
Available at the COMP2111 website.
COMP2111 Notes Week 10
How to Prove Forward Simulation
Kai Engelhardt
May 19, 2015
Revision: 1.2
1 Introduction
This note explains how to prove forward simulation without having to unravel the semantics of program snippe
COMP2111 Glossary
Kai Engelhardt
April 2, 2014
symbol
:
.
cfw_ |
P()
usage
id : type type
expr set
num 1 .num 2
expr.expr
cfw_ expr | pred
P(set)
meaning
function type declaration
set membership
number range
maplet
set comprehension
powerset
[/]
[e /x ]
Introduction
New book
Presentation is based on a recent book:
R. J. R. Back and J. von Wright, Renement Calculus:A
Systematic Introduction. Graduate Texts in Computer
Science, Springer-Verlag, New York 1998 (519 pages), ISBN
0-387-98417-8.
Contents of boo
Available at the COMP2111 website.
COMP2111 Notes Week 11
Case Study in Forward Simulation
Kai Engelhardt
May 29, 2015
Revision: 1.2
1 Introduction
This note explains how to prove forward simulation without having to unravel the semantics
of program snipp
Relational Algebra
Relational Algebra is a procedural DML.
It specifies operations on relations to define new relations:
Select, Project, Union, Intersection,
Divide.
Difference, Cartesian Product, Join,
SELECT
Selects a subset of the tuples of a relation
Querying Multi-relations
Example: Find the brewers whose beers John likes.
Likes(drinker, beer)
Beers(name, manf)
SELECT Manf
FROM Likes, Beers
WHERE drinker = John AND beer = name;
MANF
-Caledonian
Sierra Nevada
Sierra Nevada
Lord Nelson
Note: could elim
Id: tute02soln.tex,v 1.1 2014/03/19 04:51:54 kaie Exp kaie
Available at the COMP2111 website.
COMP2111 Tutorial 2
Kai Engelhardt
March 19, 2014
Solution to Exercise 1 The simplest way to draw the relational semantics of the constituent
parts of
while x >
COMP2111 Lecture 5a
Session 1, 2013
Hoare Logic Example
Deriving a Maximum Segment-Sum Algorithm
Kai Engelhardt
Revision: 1.1
1
Example: Maximum Segment-Sum
Suppose we have a C-style array A[N] of numbers and want to
write a program P that nds i j such th
Hoare Logic
COMP2111 Lecture 4b
Session 1, 2013
Hoare Logic
Kai Engelhardt
Revision: 1.1
1
Hoare Logic
A Toy Language Syntax
Let us add assignments and guards as basic statements, and some
form of loops (or recursion) to our imperative, sequential toy
lan
COMP2111 Lecture 1
Session 1, 2013
What, When, How
Kai Engelhardt
Revision: 1.1
Credits: Ken Robinson, John Reynolds,. . .
1
What
Put the word engineering back into SE.
In marginally more detail (= Immd): climb up the ladder of
evolution
1
2
Cobble togeth
Transition Diagrams
COMP2111 Lecture 4a
Session 1, 2013
Assertional Reasoning
Kai Engelhardt
Revision: 1.2
1
Transition Diagrams
Transition Diagrams
Denition
Let be a state space. A transition diagram is a quadruple
P = (L, T , s, t), where:
L is a nite s
The University of New South Wales
Model Exam
Revision: 1.2 of Date: 2013/06/02 11:54:07
Session 1, 2013
COMP2111
System Modelling & Design
Time allowed: 2 hour
Total number of questions: 13
Maximum number of marks: 50
Not all questions are worth the same.
Proving Response Properties of
Event-B Machines
COMP2111 13s1
Kai Engelhardt
Revision: 1.2 of Date: 2013/05/07 05:33:49
1 Introduction
This note is about proving so-called response properties [2]. We introduce a notation
p
q as a shorthand for p q and ada
COMP2111 Lecture 2
Session 1, 2013
Semantics, Renement
Kai Engelhardt
Revision: 1.1
1
A denition of renement
Given a pair of programs called concrete and abstract,
the concrete program renes the abstract program
correctly whenever the use of the concrete
Solutions to the Model Exam COMP2111 13s1
Kai Engelhardt
Revision: 1.4 of Date: 2013/06/12 12:45:41
Answer to Question 1 These are screen shots from Rodin and quite small so I could t
them onto the pages. Some denitions and invariants werent called for in
Id: tute01soln.tex,v 1.1 2014/03/15 03:12:08 kaie Exp kaie
Available at the COMP2111 website.
COMP2111 Tutorial 1 Answers
Kai Engelhardt
March 15, 2014
Amos reported only the rst two exercises were discussed. Thats no problem. Id rather have
fewer questio
Id: tute03soln.tex,v 1.2 2014/06/23 07:03:00 kaie Exp kaie
Available at the COMP2111 website.
COMP2111 Tutorial 3 Solutions
Kai Engelhardt
June 23, 2014
Solution to Exercise 1 We prove soundness of
the guard axiom:
cfw_ cfw_ ,
grd
cfw_ P cfw_ , cfw_ Q cf
Solutions and Statistics for the COMP2111
Exam 14s1
Kai Engelhardt
July 4, 2014
Answers are given in blue.
1 (3 marks)
For each of the following specication statements, give a single assignment statement that renes it.
1. k : [true, k = 10]
k := 10
2.
:=
Id: tute11soln.tex,v 1.1 2014/05/29 04:45:09 kaie Exp kaie
Available at the COMP2111 website.
COMP2111 Tutorial 11 Solutions
Kai Engelhardt
May 29, 2014
Solution to Exercise 1 tba
Solution to Exercise 2 Adapted to our setting, the abstract level is given
Id: tute08soln.tex,v 1.1 2014/05/22 03:08:46 kaie Exp kaie
Available at the COMP2111 website.
COMP2111 Tutorial 8 Solutions
Kai Engelhardt
May 22, 2014
Solution to Exercise 1 Let us dene
if g then P else Q
=
if g P [] g Q
and instantiate Law 4.1 (altern