1. Varje bevissteg ska motiveras formellt (informella bevis ger 0 poang)

Relevanta dokument
1. Compute the following matrix: (2 p) 2. Compute the determinant of the following matrix: (2 p)

(D1.1) 1. (3p) Bestäm ekvationer i ett xyz-koordinatsystem för planet som innehåller punkterna

8 < x 1 + x 2 x 3 = 1, x 1 +2x 2 + x 4 = 0, x 1 +2x 3 + x 4 = 2. x 1 2x 12 1A är inverterbar, och bestäm i så fall dess invers.

Tentamen i Matematik 2: M0030M.

denna del en poäng. 1. (Dugga 1.1) och v = (a) Beräkna u (2u 2u v) om u = . (1p) och som är parallell

and Mathematical Statistics Gerold Jäger 9:00-15:00 T Compute the following matrix

Tentamen i Matematik 3: M0031M.

Högskolan i Skövde (SK, JS) Svensk version Tentamen i matematik

LUNDS TEKNISKA HÖGSKOLA Institutionen för Elektro- och Informationsteknik

Tentamen i Matematik 2: M0030M.

and u = och x + y z 2w = 3 (a) Finn alla lösningar till ekvationssystemet

6. a) Visa att följande vektorer är egenvektorer till matrisen A = , och ange motsvarande

Pre-Test 1: M0030M - Linear Algebra.

E: 9p D: 10p C: 14p B: 18p A: 22p

x 2 2(x + 2), f(x) = by utilizing the guidance given by asymptotes and stationary points. γ : 8xy x 2 y 3 = 12 x + 3

Tentamen i kurserna Beräkningsmodeller (TDA181/INN110) och Grundläggande Datalogi (TDA180)

2(x + 1) x f(x) = 3. Find the area of the surface generated by rotating the curve. y = x 3, 0 x 1,

Kurskod: TAMS28 MATEMATISK STATISTIK Provkod: TEN1 05 June 2017, 14:00-18:00. English Version

Isometries of the plane

Avståndsmätare hur användandet kan regleras. Materialet framställt i samarbete mellan: SGF:s Regelkommitté & Tävlingsenhet

Materialplanering och styrning på grundnivå. 7,5 högskolepoäng

S 1 11, S 2 9 and S 1 + 2S 2 32 E S 1 11, S 2 9 and 33 S 1 + 2S 2 41 D S 1 11, S 2 9 and 42 S 1 + 2S 2 51 C 52 S 1 + 2S 2 60 B 61 S 1 + 2S 2 A

Tentamen i kurserna Beräkningsmodeller (TDA181/INN110) och Grundläggande Datalogi (TDA180)

Tentamen MMG610 Diskret Matematik, GU

12.6 Heat equation, Wave equation

1. Find an equation for the line λ which is orthogonal to the plane

Module 1: Functions, Limits, Continuity

Kurskod: TAMS11 Provkod: TENB 28 August 2014, 08:00-12:00. English Version

Workplan Food. Spring term 2016 Year 7. Name:

och v = 1 och vektorn Svar 11x 7y + z 2 = 0 Enligt uppgiftens information kan vi ta vektorerna 3x + 2y + 2z = 1 y z = 1 6x + 6y + 2z = 4

Module 6: Integrals and applications

Kurskod: TAIU06 MATEMATISK STATISTIK Provkod: TENA 17 August 2015, 8:00-12:00. English Version

This exam consists of four problems. The maximum sum of points is 20. The marks 3, 4 and 5 require a minimum

Preschool Kindergarten

Tentamen i Kryptologi 1DT

1. Find for each real value of a, the dimension of and a basis for the subspace

Webbregistrering pa kurs och termin

SkillGuide. Bruksanvisning. Svenska

FÖRBERED UNDERLAG FÖR BEDÖMNING SÅ HÄR

UTLYSNING AV UTBYTESPLATSER VT12 inom universitetsövergripande avtal

Rep MEK föreläsning 2

F ξ (x) = f(y, x)dydx = 1. We say that a random variable ξ has a distribution F (x), if. F (x) =

LUNDS TEKNISKA HÖGSKOLA Inst. for Elektro- och Informationsteknik. SIGNALBEHANDLING I MULTIMEDIA, ETI265 Inlämningsuppgift 1 (av 2), Task 1 (out of 2)

DVG C01 TENTAMEN I PROGRAMSPRÅK PROGRAMMING LANGUAGES EXAMINATION :15-13: 15

Lösningsförslag obs. preliminärt, reservation för fel

Kurskod: TAIU06 MATEMATISK STATISTIK Provkod: TENA 15 August 2016, 8:00-12:00. English Version

The Finite Element Method, FHL064

f(x) = x2 + 4x + 6 x 2 4 by utilizing the guidance given by asymptotes and stationary points.

f(x) =, x 1 by utilizing the guidance given by asymptotes and stationary points. cos(x) sin 3 (x) e sin2 (x) dx,

1. Find the volume of the solid generated by rotating the circular disc. x 2 + (y 1) 2 1

Analys och bedömning av företag och förvaltning. Omtentamen. Ladokkod: SAN023. Tentamen ges för: Namn: (Ifylles av student.

Webbreg öppen: 26/ /

1 Find the area of the triangle with vertices A = (0,0,1), B = (1,1,0) and C = (2,2,2). (6p)

EXTERNAL ASSESSMENT SAMPLE TASKS SWEDISH BREAKTHROUGH LSPSWEB/0Y09

S 1 11, S 2 9 and S 1 + 2S 2 32 E S 1 11, S 2 9 and 33 S 1 + 2S 2 41 D S 1 11, S 2 9 and 42 S 1 + 2S 2 51 C 52 S 1 + 2S 2 60 B 61 S 1 + 2S 2 A

Anvisning om ansvarsförsäkran för studenter

Rastercell. Digital Rastrering. AM & FM Raster. Rastercell. AM & FM Raster. Sasan Gooran (VT 2007) Rastrering. Rastercell. Konventionellt, AM

Solutions to exam in SF1811 Optimization, June 3, 2014

1. Find the 4-tuples (a, b, c, d) that solves the system of linear equations

Grafisk teknik IMCDP IMCDP IMCDP. IMCDP(filter) Sasan Gooran (HT 2006) Assumptions:

Module 4 Applications of differentiation

Styrteknik: Binära tal, talsystem och koder D3:1

M0030M: Maple Laboration

Kurskod: TAMS11 Provkod: TENB 07 April 2015, 14:00-18:00. English Version

Beijer Electronics AB 2000, MA00336A,

. Bestäm Rez och Imz. i. 1. a) Låt z = 1+i ( b) Bestäm inversen av matrisen A = (3p) x + 3y + 4z = 5, 3x + 2y + 7z = 3, 2x y + z = 4.

2.1 Installation of driver using Internet Installation of driver from disk... 3

Schenker Privpak AB Telefon VAT Nr. SE Schenker ABs ansvarsbestämmelser, identiska med Box 905 Faxnr Säte: Borås

Technique and expression 3: weave. 3.5 hp. Ladokcode: AX1 TE1 The exam is given to: Exchange Textile Design and Textile design 2.

Family appendix for applicants Appendix D

INTERAKTIVA UTBILDNINGAR. UPPDRAG: Trafikutbildning åt Örebro kommun. KUND: Agresso Unit4

(4x 12) n n. is convergent. Are there any of those x for which the series is not absolutely convergent, i.e. is (only) conditionally convergent?

Kurskod: TAIU06 MATEMATISK STATISTIK Provkod: TENA 31 May 2016, 8:00-12:00. English Version

TDDC74 Programmering: Abstraktion och modellering Dugga 2, , kl 14-16

samhälle Susanna Öhman

TDDC74 Programmering: Abstraktion och modellering Dugga 2, , kl 17-19

Grafisk teknik IMCDP. Sasan Gooran (HT 2006) Assumptions:

Klyvklingor / Ripping Blades.

Kurskod: TAMS11 Provkod: TENB 12 January 2015, 08:00-12:00. English Version

Discovering!!!!! Swedish ÅÄÖ. EPISODE 6 Norrlänningar and numbers Misi.se

Grafisk teknik. Sasan Gooran (HT 2006)

Michael Q. Jones & Matt B. Pedersen University of Nevada Las Vegas

Application Note SW

Exempel på uppgifter från 2010, 2011 och 2012 års ämnesprov i matematik för årskurs 3. Engelsk version

Styrteknik : Funktioner och funktionsblock

2. Let the linear space which is spanned by the functions p 1, p 2, p 3, where p k (x) = x k, be equipped with the inner product p q = 1

Om oss DET PERFEKTA KOMPLEMENTET THE PERFECT COMPLETION 04 EN BINZ ÄR PRECIS SÅ BRA SOM DU FÖRVÄNTAR DIG A BINZ IS JUST AS GOOD AS YOU THINK 05

Användarhandbok. MHL to HDMI Adapter IM750

Discrete Mathematics (English)

EXPERT SURVEY OF THE NEWS MEDIA

is introduced. Determine the coefficients a ij in the expression for, knowing that the vectors (1, 0, 1), (1, 1, 1), (0, 1, 1) constitute an ON-basis.

Pre exam I PATHOLOGY FOR MEDICAL STUDENTS

Calculate check digits according to the modulus-11 method

Tentamen del 2 SF1511, , kl , Numeriska metoder och grundläggande programmering

EVALUATION OF ADVANCED BIOSTATISTICS COURSE, part I

Datasäkerhet och integritet

Adding active and blended learning to an introductory mechanics course

Support Manual HoistLocatel Electronic Locks

Find an equation for the tangent line τ to the curve γ : y = f(4 sin(xπ/6)) at the point P whose x-coordinate is equal to 1.

Writing with context. Att skriva med sammanhang

Transkript:

Tentamen i Programmeringsteori Institutionen for datorteknik Uppsala universitet 1996{08{14 Larare: Parosh A. A., M. Kindahl Plats: Polacksbacken Skrivtid: 9 15 Hjalpmedel: Inga Anvisningar: 1. Varje bevissteg ska motiveras formellt (informella bevis ger 0 poang) 2. Enkla aritmetiska regler samt alla axiom och teorem i bilagan kan anvandas i bevisen 3. Los endast en uppgift per blad 4. Skriv inte pa baksidan 5. Skriv ditt namn pa varje blad Lycka till! Final Exam in Programming Theory Department of Computer Systems Uppsala University 1996{08{14 Location: Parosh A. A., M. Kindahl Plats: Polacksbacken Time: 9 15 No books or calculator allowed Directions: 1. Each proof step should be motivated formally (no credit for informal proofs) 2. Simple arithmetic rules and all the axioms and theorems in the appendix may be used in the proofs 3. Answer only one problem on each sheet of paper 4. Do not write on the back of the paper 5. Write your name on each sheet of paper Good Luck! 1

Uppgift 1 (20 p) Visa foljande: 0 B@ m1 m2 m3 m4 a[m1 : m3] x a[m2 : m4] x 1 CA =) a[m 1 : m4] x Problem 1 (20 p) Prove the following: 0 B@ m1 m2 m3 m4 a[m1 : m3] x a[m2 : m4] x 1 CA =) a[m 1 : m4] x 2

Uppgift 2 (15 p) Tva program P1 och P2 sags vara ekvivalenta omm wp (P1; R) = wp (P2; R), for alla predikat R. Anta att B2 ) B1. Visa att programmen S och S 0 ar ekvivalenta. S : if B1! S1 2 B2! S2 och S 0 : if B1! S1 2 B2! S Problem 2 (15 p) Two programs P1 and P2 are said to be equivalent i wp (P1; R) = wp (P2; R), for any predicate R. Suppose that B2 ) B1. Show that the programs S and S 0 are equivalent. S : if B1! S1 2 B2! S2 och S 0 : if B1! S1 2 B2! S 3

Uppgift 3 (20 p) Anta att x och y ar naturliga tal. Genom att anvanda teoremet for villkorliga satser, visa att foljande program ar korrekt. Ledtrad: Anvand foljande regler: if y x! x; y := y + 3; x 1 2 x y! y := 4; x := 6 ((0 < c) (x c x)) = F. ((0 < c) (x + c x)) = F. Problem 3 (20 p) Suppose that x and y are natural numbers. Using the alternative command theorem, show that the following program is correct. Hint: Use the following rules. if y x! x; y := y + 3; x 1 2 x y! y := 4; x := 6 ((0 < c) (x c x)) = F. ((0 < c) (x + c x)) = F. 4

Uppgift 4 (25p) Foljande program ar en mycket enkel variant for att losa problemet om omsesidig uteslutning. Variablerna proc 1 respektive proc 2 sager att process 1 respektive process 2 ar inne i den kritiska regionen. For att kontrollera tilltrade till den kritiska regionen anvander vi en aggvariabel ag. Genom att anvanda teoremet for iterativa satser, visa att invarianten ar korrekt (att den verkligen ar invariant). ag; proc 1 ; proc 2 := F; F; F ; finv Q : (proc 1 _ proc 2 ) ag) :(proc 1 proc 2 )g do :ag! ag := T ; proc1 := T [] :ag! ag := T ; proc2 := T [] ag proc 1! skip [] ag proc 2! skip [] ag proc 1! proc 1 := F ; ag := F [] ag proc 2! proc 2 := F ; ag := F od Problem 4 (25p) Following is a program to solve the mutual exclusion problem. The variables proc1 and proc2 respectively denotes that process 1 or process 2 respectively is in the critical region. To control access to the critical region we use a ag variable ag. Using the iterative command theorem, prove that the invariant is correct (i.e. that it really is invariant). ag; proc1 ; proc 2 := F; F; F ; finv Q : (proc 1 _ proc 2 ) ag) :(proc 1 proc 2 )g do :ag! ag := T ; proc 1 := T [] :ag! ag := T ; proc 2 := T [] ag proc 1! skip [] ag proc2! skip [] ag proc 1! proc 1 := F ; ag := F [] ag proc 2! proc 2 := F ; ag := F od 5

Uppgift 5 (20p) Antag att vi representerar polynom som vektorer. Exempelvis sa representerar vi polynomet p(x) = 2x 4 + 3x 3 + x 2 2x + 5 som vektorn p[0 : 4] = ( 2; 3; 1; 2; 5). Betrakta nu problemet att evaluera polynomet, d.v.s. berakna polynomet p[0 : n] givet ett varde x. Detta denieras som nx eval(p; x) = p[i] x n i : i=0 Detta kan man gora eektivt med hjalp av Horners regel som beraknar polynomet p(x) genom att alternera addition och multiplikation. Exempelvis sa beraknas polynomet p ovan i ordningen x(x(x(x( 2) + 3) + 1) 2) + 5: Utveckla ett program som anvander Horners regel fr att evaluera polynom representerade som vektorer. Hitta slutvillkoret R, invarianten P, gransfunktionen t, vakten B samt kommandona S0 och S1 sa att programmet uppfyller speci- kationen. Beskriv noga ur du kommer fram till losningen. Ledtradar: fq: n 0g S0; finv P :?g fbound t:?g do B! S1 od fr:?g Lagra slutresultatet i exempelvis variabeln r. Loopen har endast ett fall. 6

Problem 5 (20p) Suppose we represents polynoms as vectors of coecients, e.g. we represents the polynom p(x) = 2x 4 + 3x 3 + x 2 2x + 5 as the vector p[0 : 4] = ( 2; 3; 1; 2; 5). Consider the problem of evaluating the polynom, i.e. compute the polynom p[0 : n] given a value x. This is dened as nx eval(p; x) = p[i] x n i : i=0 This can be done eciently by using Horner's rule which computes the polynom p(x) by alternating addition and multiplication. As an example; the polynom p above is computed in the order x(x(x(x( 2) + 3) + 1) 2) + 5: Develop a program that uses Horner's rule to evaluate polynoms represented as vectors. Develop the post-condition R, the invariant P, the bound function t, the guard B, and the statements S0 and S1 such that the program satises the specication. Motivate carefully how you nd the solution. Hints: fq: n 1g S0; finv P :?g fbound t:?g do B! S1 od fr:?g Store the result in a variable, e.g. r. The loop has only one guarded command. 7