# Some Techniques for Proving Correctness of Programs which Alter Data Structures

Save this PDF as:

Size: px
Start display at page:

Download "Some Techniques for Proving Correctness of Programs which Alter Data Structures"

## Transcription

1 Some Techniques for Proving Correctness of Progrms which Alter Dt Structures R. M. Burstll Deprtment of Mchine Intelligence University of Edinburgh 1. INTRODUCTION Consider the following sequence of instructions in list-processing lnguge With roughly ALGOL 60 syntx nd LISP semntics (hd (hed) is LISP CAR nd tl (til) is LISP CDR). x: = cons(1, nil); y:=cons(2, x); hd(x): =3; (compre LISP RPLACA) print(x); print(y); The intention is s follows. x becomes the list (1) y becomes the list (2, 1) The hed (first element) of the list x becomes 3. Since y ws mnufctured from x it 'shres' list cell with x, nd hence is side-effected by the ssignment to hd(x). When x is printed it is (3) nd y when printed is (2, 3) rther thn (2, 1) s it would hve been hd the lst ssignment left it undisturbed. How re we to prove ssertions bout such progrms? Figure 1 trces the course of events in the trditionl picture lnguge of boxes nd rrows. Our tsk will be to obtin more forml mens of mking inferences, which, unlike the picture lnguge, will del with generl propositions bout lists. We will extend Floyd's proof system for flow digrms to hndle commnds Which process lists. The principles which pply to lists would generlise in strightforwrd wy to multi-component dt structures with shring nd circulrities. Although this technique permits proofs, they re rther imperspicuous nd fiddling for lck of pproprite higher level concepts. Investigting the specil cse of liner lists in more depth we define 'the list from x to y' nd consider Systems of such lists (or perhps we should sy list frgments) which do not 23

2 PROGRAM PROOF AND MANIPULATION x: = cons (1, nil); 1 nil y: = cons (2, x) 2 1 nil hd (x): =3 2 3 nil Figure 1. shre with ech other or within themselves. (By liner list we men one which either termintes with nil, such s LISP (A, (B, C), D), or is circulr; by tree we men list structure which termintes with toms rther thn with nil, such s LISP ((A. B). (C. D))). We thus get rther nturl wy of describing the sttes of the mchine nd the trnsformtions on them nd hence obtin esy proofs for progrms. Some ides from the ppliction of ctegory theory to tree utomt help us to extend this tretment from lists to trees: frgments of lists or trees turn out to be morphisms in n pproprite ctegory. Acquintnce with ctegory-theoretic notions is not however needed to follow the rgument. Our im hs been to obtin proofs which correspond with the progrmmer's intuitive ides bout lists nd trees. Extension to other kinds of dt structures wits further investigtion. 2. PREVIOUS WORK Since McCrthy (1963) rised the problem number of techniques for proving properties of progrms hve been proposed. A convenient nd nturl method is due to Floyd (1967) nd it hs formed the bsis of pplictions to non-trivil progrms, for exmple by London (1970) nd Hore (1971). Floyd's technique s originlly proposed delt with ssignments to numericl vribles, for exmple, x: = x + 1, but did not cter for ssignments to rrys, for exmple, [i]:=[j]+ 1, or to lists, such s t/(x): =cons(hd(x), 11(11(x))). McCrthy nd Pinter (1967) del with rrys by introducing 'chnge' nd 'ccess' functions so s to write [i]:=[j]+1 s : = chnge (, i, ccess 24

3 BURSTALL (, j)+ 1), treting rrys s objects rther thn functions. King (1969) in mechnising Floyd's technique gives method for such ssignments which, however, introduces cse nlysis tht sometimes becomes unwieldy. Good (1970) suggests nother method which distinguishes by subscripts the vrious versions of the rry. We will explin below how Good's method cn be dpted to list processing. Although the proofs mentioned bove by London (.1970) nd Hore (1971) involve rrys they do not give rigorous justifiction of the inferences involving rry ssignments, which re rther strightforwrd. List processing progrms in the form of recursive functions hve received ttention from McCrthy (1963), Burstll (1969) nd others, but quite different problems rise when ssignments re mde to components of lists. This ws discussed in Burstll (1970) s n extension to the xiomtic semntics of ALGOL, but the emphsis there ws on semntic definition rther thn progrm proof. Hewitt (1970), Chpter 7, touches on proofs for list Processing progrms with ssignments. J. Morris of Berkeley hs lso done some unpublished work, so hve B.Wegbreit nd J.Poupon of Hrvrd (Ph.D. thesis, forthcoming). 3. FLOYD'S TECHNIQUE Let us recll briefly the technique of Floyd (1967) for proving correctness of progrms in flow digrm form. We ttch ssertions to the points in the flow digrm nd then verify tht the ssertion t ech point follows from those t ll the immeditely preceding points in the light of the intervening commnds. Floyd shows, by induction on the length of the execution pth, tht if this verifiction hs been crried out whenever the progrm is entered with stte stisfying the ssertion t the entry point it will exit, if t ll, only with stte stisfying the ssertion t the exit point. The rules for verifiction distinguish two cses: tests nd ssignments. (1) A triple consisting of n ssertion, test nd nother ssertion. thus Si YES S2 is sid to be verified if Sli PF AS2, tht is, ssertion S2 is deducible from Si nd test P using some xioms A, sy the xioms for integer rithmetic. If 52 IS ttched to the NO brnch the triple is verified if SI, IPI-AS2. (2) A triple consisting of n ssertion, n ssignment nd nother ssertion, thus 25

4 PROGRAM PROOF AND MANIPULATION Si I: =E S2 where / is some identifier nd E some expression, is sid to be verified if S1 FA [S2]f where [S2], mens the sttement S2 with E substituted for I throughout. (This is clled bckwrd verifiction by King (1969); it is vrint of Floyd's originl method, which introduces n existentilly quntified vrible.) We will here retin the inductive method of Floyd for deling with flow digrms contining loops, but give methods for coping with more complex kinds of ssignment commnd. 4. EXTENSION OF THE VERIFICATION PROCEDURE TO ARRAY ASSIGN MENTS Consider the following commnd nd ssertions 1,i< 9 nd for ll x, such tht 1 <x<100, (x)=x (((i)+1)x(i+1)):=0 (ixi+2xi+1)0(i) The second ssertion does hold if the first one does, but the verifiction rule given bove for ssignments to numeric vribles, such s j: =2 x j, is indequte for rry ssignments such s this. Thus ttempts to substitute 0 for (((i)+1)x(i+1)) in (ix i+2 x i+1)0(i) merely leve it unchnged, but the unchnged ssertion does not follow from the first ssertion. (Floyd's version of the rule, using n existentil quntifier is eqully inpplicble.) Following Good (1970), with slightly different nottion, we cn overcome the difficulty by distinguishing the new version of the rry from the old one by giving it distinct symbol, sy '. We lso mke explicit the fct tht other elements hve not chnged. We thus ttempt to show tht 1 <i<9, (Vx)(1<x<100(x)=x), '(((i)+1)x(i+1))=0, (Vy)(y0((i)+1)x(i+l)'(y)=(y))1-. rith '(ix 1+2 xi+1)0d(i). Once we note tht ((i)+1)x (i+1) is (1+1)2, s is (ix 1+2 x i+1) nd tht, since 1<i, (1+1)201, we hve '(ix i+ 2 x i+ 1)=0 nd '(0=i, so 26

5 IIURSTALL '(0> 0. The distinction between nd ' nd the condition tht ll elements which re not ssigned to re unchnged reduce the problem to elementry lgebr. 5. COMMANDS, CHANGE SETS AND TRANSFORMATION SENTENCES The following technique is vrint of the one given by Good (1970). He uses it for ssignments to rrys but not for list processing. With ech ssignment commnd we ssocite set of identifiers clled the chnge set nd set of sentences clled the trnsformtion sentences. (Rules for specifying these re given below.) The bsic rule of inference is: If set S of sentences re written before commnd C, nd C hs set T of trnsformtion sentences, then we my write sentence U fter C if S, TI-U', where U' is U with ech identifier i in the chnge set of C replced by i'. (1) Simple ssignment Commnd: I:=E e.g. i: =i+j Chnge set: {/} {i} Trnsformtion sentences: /'=E =i-fj Exmple: i>0 j>0 i:=1-fj 1>1 1>1 is legitimte t becuse i> 0, j> 0, i'=i+j1-i'> 1. Note. By AFB we men B is provble from A using xioms of rithmetic or other xioms bout the opertions of the lnguge. Note. Vribles (identifiers) in the progrm become constnts in the logic. (2) Arry ssignment Commnd: A[E1]:=E2 e.g. [[i]]:=[i]+[j] Chnge set: (A) () Trnsformtion sentences: A 1(E1)=E2 '((i))=(i)+(j) (ix)(x0e1 A'(x)=A(x)) (Vx)(x0(i)'(x)=(x)) (3) List processing () Commnd: hd(e1):=e2 e.g. hd(t1(hd(i))):=hd(i) Chnge set: {hd) {hd} Trnsformtion sentences: hd'(e1)=e2 hd'01(hd(i)))=hd(i) (Vx)(x Eihd'(x)=hd(x)) (Vx)(x tl(hd(i))hd'(x)=hd(x)) (b) Commnd: 1/(E1):=E2. s for hd 27

6 PROGRAM PROOF AND MANIPULATION (c) Commnd: I: = cons(eli E2) Chnge set: {I, used, new} Trnsformtion sentences: new'oused used' =usedk.) (new') hd(new' )= tl(new')=e2 I' =new' e.g. i: =cons(2, j) {1, used, new} new'oused used' =usedu {new') hd(new')=2 tl(new')=j i' =new' Note. We ssume E1 nd E2 do not contin cons. Complex cons expressions must be decomposed. It should be cler tht the choice of two-element list cells is quite rbitrry, nd exctly nlogous rules could be given for lnguge llowing 'records' or 'plexes', tht is vriety of multi-component cells. 6. CONCEPTS FOR LIST PROCESSING We could now proceed to give exmples of proofs for simple list processing progrms, but with our present limited concepts it would be difficult to express the theorems nd ssertions except in very d hoc wy. We wnt to tlk bout the list pointed to by n identifier i nd sy tht this is distinct from some other list. We wnt to be ble to define conveniently such concepts s reversing or conctenting (ppending) lists. To do this we now specilise our discussion to the cse where cons, hd nd t/ re used to represent liner lists. Such lists terminte in nil or else in cycle, nd we do not llow toms other thn nil in the til position. Thus we exclude binry trees nd more complicted multi-component record structures. First we define the possible sttes of list processing mchine. A mchine is chrcterised by: C, denumerble set of cells nil, specil element A, set of toms (C, {nil} nd A re disjoint), function from finite subsets of C to C, such tht (X) 0 X, function for producing new cell. It is convenient to write XO for Xu {nil} where Xg. C. A stte is chrcterised by: Uc C, the cells in use hd: U--0 Au Uo 11: U-+ UO(thus we re tlking bout lists rther thn binry trees) Let X* be the set of ll strings over set X, including the empty string which we write s 1. Also let T= {true, flse}. It is convenient to define unit strings over Au UO thus Unit: (Au Uo)* Unit (cr).:*.cr e (Au U0) We cn now ssocite set 2 of triples with stte. (cc, u, v) e 2 mens 28

7 BURSTALL tht is list from u to v (or perhps we should sy list frgment from u to v). Thus c (Au Uo)* x U0 x U We shll write u )v s mnemonic bbrevition for (, u, v), hd u for hd (u) nd tl u for 11(u). We define 2 inductively, thus: (i) 2 for ech u e U0 P (ii) if u--ve 29 nd v w 2 then u.-+w e hdu (iii)u-+ t/ue2forechu U. l For exmple, in figure 2, X-4y, y-9, nd z * nil re ll in Figure 2. Identity lists re defined thus Identity: Identity (u, v)<=ne = 1 A prtil opertion of composition (.) between lists is defined thus :2x2-+T p ft (14-40 (1)-+W)=14 W Thus list from u to v cn be composed with one from v' to w if nd only if Vry'. The reder fmilir with ctegory theory will notice tht 2 forms ctegory with U s objects nd the lists (triples in 2) s morphisms. (A definition of 'ctegory' is given in the Appendix.) Indeed it is the free ctegory hdu generted by the grph whose rrows re the lists u + 11 u for ech u. There is forgetful functor from 2' to (A u U )*, where the ltter is regrded s ctegory with one object. This functor gives the string represented by list frgment (cf. Wegbreit nd Poupon's notion of covering function in the unpublished work mentioned on p. 25). 29

8 PROGRAM PROOF AND MANIPULATION We define the number of occurrences of cell in list by induction (5: Ux..T-4N (i) 6(v-,v)=0 (ii) 6,4(x-o t/ x-02 w)=6,(t1 x:-,w)+1 if x=u =3 (t1 x-+w) if xou It follows by n obvious induction tht 6 (A p)=3 (A)+6 (p). To keep trck of the effects of ssignments we now define reltion of distinctness between lists, tht is, they hve no cells in common. Distinct: 2' x 21-4T Distinct(A, 1t)<=15 (A) =0 or 5p) =0 for ll u e U. We lso define property of non-repetition for lists Nonrep: 21-+T Nonrep(A)<*15 (A)< 1 for ll UE U Lemm 1 1 (i) Distinct(A,u-+u) for ll A nd u (ii) Nonrep(u-4u) for ll u (iii) Distinct(A, p) nd Nonrep(A) nd Nonrep(p) = Nonrep(A p), if A p is defined. Proof. Immedite. We re now equipped to stte the correctness criterion for simple list processing progrm nd to supply nd prove the ssertions. Consider the problem of reversing list by ltering the pointers without using ny new spce (figure 3). We first need to define n uxiliry function to reverse string rev: X*-4 X* rev (1) =1 rev (x)=rev()x for XE X, e X* Before After nil nil Figure 3. 30

9 BURSTALL j =RE VER S E(k) Assume rev: U*4 U* reverses strings. K is constnt string. ':=nil 1 K -k-nil e Nonrep(k3ni1). IC --(343)[k->ni1e 2.j3nile 2. Nonrep (k-> nil). Nonrep (j-> nil). Distinct(k- > nil,] -1-3>nil). rev ()fl =rev (K)]. YES rev(k) j --> nil e 2. := ilk (314)[k4t1 k e 11 k-; nil e 2. Anil e 2. Nonrep k->ni1). Nonrep(j->ni1). Distinct(k-> ilk, ii k-3ni1). P 1 Distinct (t1 k-> nil,)->ni1). Distinct (j->nil, k-> k). Unit (k411 k). rev (1413 =rev (K)]. 1 P - -- (3143)[k-> tike 2. i;nil e 2. j-> nil e 2. NonrepOni1). P 1 Nonrep (j--)ni1). Distinct (k-> ilk, i-)nil). P P 1 Distinct (13 nil, j->ni1). Distinct (j->nil, k-> tl k). i Unit (k->t1 k). rev ()113 =rev (K)]. ilk =j I 1 P (314)[i->nil e 2. k->j e 2. p> nil e 2. Nonrep(i->n11). j:=k k:=i Nonrep (j-> nil). Distinct(k4j, i->nil). Is P : Distinct(i3nil,j-)ni1). Distinct (j-nil, k-)j). : Unit (k--)j). rev ()1,3 =rev (K)]. Figure 4. Reversing list. 31

10 PROGRAM PROOF AND MANIPULATION By well-known methods of induction on the length of the string (structurl induction) we cn prove simple lemms such s rev (i3)=rev(13) rev() for; fie X* Notice the distinction between the function rev which works on strings nd hs esily proved properties nd the function or procedure REVERSE to reverse lists using ssignment, which we re bout to define. The ltter is essentilly function from mchine sttes to mchine sttes, where mchine stte is chrcterised by the two functions hd nd The flow digrm for REVERSE with ssertions is given in figure 4. Notice tht the ssertions re long nd tedious. We cn verify the ssertions by using the techniques given bove, distinguishing between d nd ti' nd consequently between List, Distinct nd List', Distinct'. The verifiction proofs re quite long for such simple mtter nd very boring. We will not wery the reder with them; insted we will try to do better. 7. DISTINCT NON-REPEATING LIST SYSTEMS We will now gther together the concepts introduced so fr into single notion, tht of Distinct Non-repeting List System (DNRL System). Using suitble bbrevited nottion we cn render the ssertions brief nd perspicuous. To mke the verifiction proofs eqully ttrctive we show how the vrious kinds of commnds, nmely ssignment to hed or til nd cons commnds, correspond to simple trnsformtions of these systems. We cn prove this once nd for ll using our previous technique nd then use the results on vriety of progrms. We define Distinct Non-repeting List System s n n-tuple of triples 1i, 1=1,.. n, such tht (i) Ai e 2' for ech i= 1,.. n (ii) Nonrep(1i) for ech i = 1,...,n (iii) If j0 i then Distinct(2,, 2) for ech i, j = 1,.. n It is cler tht if S is DNRL System then so is ny permuttion of S. Thus the ordering of the sequence is immteril. We should not think of S merely s set of triples, however, since it is importnt whether S contins triple x-+y once only or more thn once (in the ltter cse it fils to be DNRL System unless =1). (S1 CC2 2k-1 s 2 Abbrevition. We will write ui-4u2-u3. -4 uk, for u1-4u2, u2-4143, k - 14_1 U. We lso write *S for 'S is DNRL System'. For exmple, n bbrevited stte description for the stte shown in figure 2 is ls s 4s s l s *(X u-*y --+ u, z--q1 w--41 z) or less explicit description p y (3fly(5)(*(x-,u-9,-)u, z-)nil) nd *(w--nil) nd Atom()) 32

11 BURSTALL j=reverse(k) Assume rev: (Au U)*->(Au U)* reverses strings. K is constnt string.. Assume, b, c.., Ay re existentilly quntified before ech ssertion. fi *(k3 nil, j-> nil). rev ()fl =rev (K). y p rev(y)fl=rev(k). Unit(). 7 P *(k-)i->nil, nil). rev(y)fl=rev(k). Unit(). fl 7 *(k3j->nil, rev(y)l3=rev(k). Figure 5. Reversing list. 33

12 PROGRAM PROOF AND MANIPULATION Figure 5 shows the REVERSE progrm gin with much pithier ssertions. We will now consider how to verify ssertions such s these pinlessly. The following proposition which enbles us to mnipulte DNRL Systems follows esily from the definitions bove. Proposition 1 (i) Permuttion *S*S' if S' is permuttion of S. (ii) Deletion *Pi, An) *(22, An) (iii) Identity *Pi, An) *(u--+u, Ai, An) (iv) Composition p p *(u--)v-w, 11, Ali. An) nd conversely s *(14-4W, Alp.0 An)(3v)*(u-ov-+w, An) (v) Distinctness p *(u-*v, u-+w)cc= 1 or ig =1 (vi) Inequlity *(uv) nd u v(3bi3)(unit(b) nd cc =0). Proof. (i) nd (ii) Immedite from the definition of *. (iii) By Lemm 1 (i) nd (ii). (iv) By Lemm 1 (iii). (v) lf 1 nd \$1 then 6.(u-- v)= 1 nd (5 (u-4w)=1 so they re not distinct. (vi) By definition of 2'. We re now ble to give the trnsformtion sentences ssocited with the vrious commnds, in terms of * rther thn in terms of hd nd 11. They enble us to verify the ssertions in figure 5 very esily. The trnsformtion sentences ll involve replcing or inserting component of *-expression, leving the other components unchnged. They re displyed in figure 6. We will mke some comments on these trnsformtion sentences nd how to use them. Their correctness my be proved using the trnsformtion sentences given erlier for hd nd ti nd the following lemm. Lemm 2. Suppose for ll y x, hd'y=hd y nd tl'y. = Then for ll A e 2' such tht 3(A)=0 we hve A e 21' nd 5(A) =ö(a)for ll y. Corollry. Under the sme suppostion if A, /I e 2' nd 5n(2)=0 nd 3 04)=0 then Nonrep(A)Nonrep'(A) nd Distinct(A, p)distince(a, Proof. By n obvious induction on 2'. The rule for ssignment to simple identifier is s before. Trnsformtion sentences re given for the YES nd No brnches of test, even though these do not lter the stte (their chnge sets re empty). 34

13 BURSTALL Assume n, Ai,..., An, x, y, re universlly quntified. The trnsformtion sentences re shown to the right of the commnd. We ssume tht E, E1 nd E2 do not contin cons. II:=E I Chnge set = {I} 1' =E Chnge set = { } =E2 YES Chnge set ={ E1 E2. NO hdei:=e21 Chnge set ={17d,..., A ) nd Unit()=. E2 *'(El 4Y, Al f 'I An) Chnge set ={ ti, * *(E1-)y, A1, An) nd Unit() ii : = E2 *'(E14E2, A1, An) E:=cons(Eb E2) Chnge set ={*, I} An) *'(E ->E2, A1, An) Figure 6. Trnsformtion sentences for stte descriptions. 35

14 PROGRAM PROOF AND MANIPULATION Consider for exmple the NO brnch of the test 'lc =nil' in the REVERSE progrm of figure 5. Before the commnd we hve (3211)r rev()f3=rev(k)] (1) The trnsformtion sentence, putting n =1, is konil. (2) After the commnd, we hve 7 (3yf3)[*(k->nil,j-mil). rev(y)i3=rev(k). Unit()] (3) But (3) follows immeditely from (1) nd (2) using Proposition 1 (vi). In generl, Proposition 1 will be used to reorder or otherwise mnipulte the *-expressions nd if E1 or E2 contin references to hd or ti these will need to be removed by replcing them by E1 nd E2 using Proposition 2. Still, the verifiction is quite trivil. Consider nother exmple from the REVERSE progrm, the commnd 'ilk: =j'. Before the commnd, we hve 7 (3yfl)[*(k--4-)ni0->ni1). rev(y)fl=rev(k). Unit()] (1) The trnsformtion sentence, putting n =2, is *(k--)y, 21, 22) *'(k->j, 21,12), for ll, y, Ali 12 (2) Rewriting the sttement fter the commnd with *' for *, we hve p (9y13)[*'(k-+j--+nil, rev(y)(213 =rev(k)] (3) We must prove this from (1) nd (2). Combining (1) with (2) we get 7 (3y13)[*1(k-V, rev(y)13=rev(k). Unit()] ' But permuting the *' expression (Proposition 1 (i)) nd using obvious properties of rev we get (3). The sentences for hd nd cons re used in n nlogous wy. Becuse their mening chnges in reltively complex wy it is dvisble to debr hd nd ti from ppering in stte descriptions nd work in terms of * lone. We now consider how to reduce n expression involving hd or tl with respect to stte description so s to eliminte references to these. For exmple the expression hd(t1(t1(0)) with respect to the stte description c..) with Unit(), Unit(b), Unit(c) reduces to c. If such n expression occurs in trnsformtion sentence we reduce it to obtin n equivlent trnsformtion sentence not involving hd or ti. The reduction of n expression E with respect to stte description D, written E, is defined recursively by (i) If E is n identifier, constnt or vrible then E=E (ii) If E is hd El nd D contins *(EI x,.) nd Unit() then f= 36

15 BURSTALL (iii) If E is 11E1 nd D contins *(E\--* x,.) nd Unit() then E=x. Proposition 2. D t= E. The proof is strightforwrd by induction on the structure of E, using the definition of *. 8. EXAMPLES OF PROOFS FOR LIST PROCESSING The trnsformtion sentences cn best be understood by seeing how we use them in proving some simple list processing progrms which lter the list structures. Although these progrms re short their mode of opertion, nd hence their correctness, is not immeditely obvious. We hve lredy looked t the progrm REVERSE. Another exmple, involving cons, is conctention of two lists, copying the first nd terminting it with pointer to the second, see figure 7. Notice tht the input lists need not necessrily be distinct. The other, destructive, method of conctention is to overwrite the finl nil of the first list with Pointer to the second. In this cse our initil condition would hve to be ensuring distinctness. Our next exmple, figure 8, is reversing cyclic list, where insted of terminting with nil the list eventully reches the strting cell gin. The next exmple, figure 9, involves list with sub-lists. A list of lists re to be conctented together nd the REVERSE nd CONCAT routines lredy defined re used. The suspicious reder my notice tht we re mking free with.' in the ssertions, but we cn lwys replce (s1, by, sy, (si)7.,1 or sequence(s,l,n), so nothing mysterious is involved. Some of the ttrctions of such proofs seems to come from the fct tht the form of the ssertions is grph-like nd so (t lest in figures 6, 7 nd 8) strictly nlogous to the structures they describe. 9. TREES We will now pss from lists to trees. We will consider generl 'record' or plex' structures with vrious kinds of cell ech hving specified number of components, s for exmple in Wirth nd Hore (1966). A prticulr cse is tht of binry trees. Thus, insted of hd: U--+Auuo U UO we now llow hd: U--+AuU 11: U AuU (nil hs no specil plce in binry trees; it cn be considered n tom like ny other). More generlly we my replce trees built using cons with trees (terms or expressions) built using ny number of opertors with rbitrry numbers of rguments, corresponding to different kinds of records. 37

16 PROGRAM PROOF AND MANIPULATION m=concat(k,l) K nd L re constnt strings of toms, nd b units. j: =k YES in: = cons (hd j, nil) j: =tij i:=171 *(k-i.> nil). *(1-14ni1). *(k->nil). *(13ni1). K=1. m: =I L see EXIT below p L *(k4x4ni1). *(I->nil). pig = K. 1 P L *(k->j->nil). *(1->ni1). l3= K. 1 ft *(k4 j-.> nil, m->ni1). L *(I->nil, fl = K. e If *(k->j->nil, i ->x). L *(19nil, in? ix). fl = K. *(k->nil, i 4 *(I->nil, m->i->x). ow= K. i: =I!E XIT K K KL --*(k-> nil, m41). *(m4i-->nil). by *(k3j-)nil, in-> i ->x). L :0(0 nil, n13 i -)x). by= K. 11 = cons (hd j, nil) by b *(k->j->nil, m-> 4y). L b j: =11j *(I->nil, m31-3y). by = K. I:= tl Figure 7. Conctention. 38

17 BURSTALL j=cyclicreverse(1) (*(/->ni/) nd L=1) or (*(1-->I) nd L=). YES j:- rev(l) *(g1). L=. *(1:13k41). rev () =rev (L). p *(j-314)c,k41). rev ()fl =rev(l). /i *(j-)l >x). fici =rev (L). - # b 7 *(F> 14x, k-->y -)1). rev(by)fl =rev (L). # b *(j413x, k > i-->1). rev (by)fl =rev (L). ---*(k;\$ax, 41). rev (by)fl =rev (L). tl I: =j *(j rev(l) Figure 8. Reversing cyclic list. 39

18 PROGRAM PROOF AND MANIPULATION 1=M ULTICONCAT(i) Assume N, C1,. CN, Aj, AN re constnts. =RE VE RS E(i) j:=i : =nil C CN At AN nil, Cir> nil). rev(cf. CN) At AN * nil, Cr> nil,. CN.->ni1). 1 rev(ci...cn) At AN " *(j3j > nil, Ci--> nil,. Cpr> CN.. Cm Cm-1..C1 Ary )J >nil,l )nil, At AN CN-->ni1). 11 I:=CONCAT(hd j,1) =tlj CN..Cm Cm- I 2..Cl Am... AN - > j > x --> ni1,1 > nil, CN.. Cm Cm-1 Cm- 2.. Ct At. AN C1--> nil,. C >ni1). Am I Am...AN x-4 nil, 1 > y > nil, At C1-)'nil,.. AN CN-)nil). CN...C1 At AN *(i nil,! ---> nil, C r-> nil). 1:=REVERSE(i) *(i C1...CN AI AN Af AN > ni1,1--)nil,cr> Figure 9. Multiple conctention. 40

19 BURSTALL Our previous discussion depended rther hevily on the conctention opertion for lists. Fortuntely Lwvere (1963) with his notion of 'Free Theory' hs shown how conctention cn be extended from strings to trees (see lso Eilenberg nd Wright 1967). His ctegory theory pproch is convenient in view of the remrk in n erlier section tht 2 forms ctegory. We will not present our ides in ctegory-theoretic lnguge, since this my not be fmilir to some reders, but will be content to point out where the concept of ctegory is pproprite. Our first tsk is to define system of trees or expressions with composition opertion, nlogous to the strings used bove. We will then pply them to tree-like dt structures under ssignment commnds. Let 12 = tfln), n=0, 1,.. be sequence of sets of opertors, (xi}, i = 1, 2,.. sequence of distinct vribles, nd let X, = We define sequence of sets of terms (or trees) T =[Tn(X,)},m =0, 1... TrI(X,,,) mens ll terms, in the usul sense of logic, in the opertors fl nd vribles X,. We cn regrd Tn(X, ) s subset of the strings (Uf2uX,)* nd define it inductively thus (i) x etn(x,) if x e X, (ii) coti t e Tn(X, ) if ) e 12 for some n nd th t e (Algebriclly speking Tn(X,) forms the word lgebr or generic lgebr over f2 with generting set X,.) If t e Tn(X,) nd (Si, s,) e Tn(X )m, m 0, by the composition t (s1,. s,) we men the term in T(X) obtined by substituting si for xi in t, 1,. To preserve the nlgy with our previous tretment of strings we would like to mke composition ssocitive. For this we consider n-tuples of trees. Thus, more generlly, if Oh. ti) e Tn(X,)I nd (Si,. s,) e we define the composition by (ti, ti) (si, s,)=(ti (si,., sm), ti (si,, Sin)). This composition is in T0(S,)1. For exmple if C22= {cons}, C20= {, b, c,..}, nd we llow ourselves to write prentheses in the terms for redbility (cons(xli ), cons(x2, xi), b) E Tn( Xz)3 (c, xi) e XI )2 nd their composition is (cons(c, ), cons(xi, c), b) e T(X1)3. The composition is now ssocitive nd (xi, x) T0(X) " is n identity for ech n. It is, however, prtil opertion (compre mtrix multipliction, which is only defined for mtrices of mtching sizes). We see now tht the disjoint union of the Tn(X ) forms ctegory, Tn, with s objects the integers n=0,1,.. nd with set of morphisms Tn(X )"' from in to n for ech m, n. Indeed, this is just wht Lwvere clls the Free Theory on f2. Eilenberg nd Wright (1967) use it to extend utomt theory to trees s well s strings, giving ctegory theory presenttion (see 41

20 PROGRAM PROOF AND MANIPULATION lso Arbib nd Giv'eon (1968)). The ctegory T0 replces the monoid (Au U)* used in our tretment of lists, the min difference being tht the composition opertion, unlike string conctention, is only prtil. The strings over n lphbet E cn be regrded s specil cse by tking f/1 to be E nd S20 to be {nil}. In the Appendix we summrise the bstrct definition of Free Theory s given by Eilenberg nd Wright. We will not use ny ctegory theory here, but it is perhps comforting to know wht kind of structure one is deling with. We will consider fixed n nd X for the time being nd write T, for Tri(X )m, the set of m-tuples of terms in n vribles. If co e n. we will tke the liberty of writing co for the term coxi x in T1. This bbrevition my pper more nturl if we think of n element r of T1 s corresponding to the function txi x t from T0(25)" to T(Ø). For exmple cons is short for 2x1, x2 cons (xi, x2), but not of course for 2x1, X2. cons(x2, We will write 1 for the identity (x1,.. x ) e T nd 0 for the 0-tuple o G To,,. We will sometimes identify the 1-tuple (x) with x. 10. STATE DESCRIPTIONS USING TREES We cn now use the m-tuples of terms, T,, just s we previously used strings to provide stte descriptions. Suppose now tht ech co e n =0, 1, corresponds to clss of cells U0 (records) with n-components nd tht these components cn be selected by functions Sr: e UQ), 1=1,. n We put U=U U0,:co e US1). For exmple if n2 = { cons}, Slo= A nd Q,=Ø for 0)00 or 2 then 6cions is hd: Ucons--. U H _ cons A 32"'s is th cons--* UconsU A (here we hve put U,, ={) for ech e A, nd Ucons is just our previous U, the set of list cells). A stte is defined by the U nd the br nd we ssocite with it set of triples, just s the set 2 ws previously ssocited with stte. If triple (r, u, v) is in.9" then for some m, n, u e Urn, v e U" nd r e T,. As before we write u-+v for (r, u, v). We define.t inductively thus: (i) If e T, is (xi xi,,,) nd if e {1,..., n} for j=1, m (tht,is, r involves only vribles nd not opertors) then (ui. ) is in T (ii) If u---ov e nd v 'w e 9" then their composition (u + v) (v--0 w) is T 41 defined s u-+w, nd it is in ". (t1) (to t, to (iii)if(u1) v,.. (10 0 v re in.9- then (ui,. u )--4 v is in (iv) If co e S2 nd br(u)= vi for i =1, n then (u)-- (vi, v ) is in 9. 42

21 BURSTALL Tking the cse where f2 consists of cons nd toms, (iv) mens tht cons (u) (v, w) E g. if hd(u)=v nd 11(u) =w, lso tht ()-() is in.9" for ech tom e A. An exmple will mke this clerer. In the stte pictured in figure 105" contins the following triples, mongst others, (i) cons(cons(cons(c,d),),cons(cons(c,d),b)) cons(cons(xl,),cons(xi,b)) (ii) (j) cons(c,d) (iii) (j)--- cons(cons(xl,),x 2) (iv) ( (j, k) cons(x 1,x i) (V) (1)---4(1) The first of these is the composition of the second nd third. Figure 10. It will be noticed tht 9" forms ctegory with objects u for ech u e U", n. 1,.... The triples (T, u, v) in.9" re the morphisms from to v. There is forgetful functor represents: g".-'. We cn now define Distinct Non-repeting Tree System nlogous to Distinct Non-repeting List System. We tke over the definitions of Distinct- ness nd Non-repetition lmost unchnged except tht they now pply to.r rther thn to 2. We cll (T, u, v) e elementry if involves vribles nd opertors in Oo but none in 1"2, n> 1 (for exmple, trees which shre only elementry constituents cn shre toms but not list cells). We now define, s for lists, the number of occurrences of cell in n n-tuple of trees, thus 6: Ux,-*N (i) 6 (v--% w) =0 if u is elementry CO T (ii) 6 ((x)- v -w)=3 (v->w) +1 if XU )>f =6 (v-uv) if xou 43 WE 0, n>

### LINEAR TRANSFORMATIONS AND THEIR REPRESENTING MATRICES

LINEAR TRANSFORMATIONS AND THEIR REPRESENTING MATRICES DAVID WEBB CONTENTS Liner trnsformtions 2 The representing mtrix of liner trnsformtion 3 3 An ppliction: reflections in the plne 6 4 The lgebr of

### 1. The leves re either lbeled with sentences in ;, or with sentences of the form All X re X. 2. The interior leves hve two children drwn bove them) if

Q520 Notes on Nturl Logic Lrry Moss We hve seen exmples of wht re trditionlly clled syllogisms lredy: All men re mortl. Socrtes is mn. Socrtes is mortl. The ide gin is tht the sentences bove the line should

### Finite Automata. Informatics 2A: Lecture 3. John Longley. 25 September School of Informatics University of Edinburgh

Lnguges nd Automt Finite Automt Informtics 2A: Lecture 3 John Longley School of Informtics University of Edinburgh jrl@inf.ed.c.uk 25 September 2015 1 / 30 Lnguges nd Automt 1 Lnguges nd Automt Wht is

### Regular Sets and Expressions

Regulr Sets nd Expressions Finite utomt re importnt in science, mthemtics, nd engineering. Engineers like them ecuse they re super models for circuits (And, since the dvent of VLSI systems sometimes finite

### Polynomial Functions. Polynomial functions in one variable can be written in expanded form as ( )

Polynomil Functions Polynomil functions in one vrible cn be written in expnded form s n n 1 n 2 2 f x = x + x + x + + x + x+ n n 1 n 2 2 1 0 Exmples of polynomils in expnded form re nd 3 8 7 4 = 5 4 +

### Generalized Inverses: How to Invert a Non-Invertible Matrix

Generlized Inverses: How to Invert Non-Invertible Mtrix S. Swyer September 7, 2006 rev August 6, 2008. Introduction nd Definition. Let A be generl m n mtrix. Then nturl question is when we cn solve Ax

### Solutions to Section 1

Solutions to Section Exercise. Show tht nd. This follows from the fct tht mx{, } nd mx{, } Exercise. Show tht = { if 0 if < 0 Tht is, the bsolute vlue function is piecewise defined function. Grph this

### Quadratic Equations. Math 99 N1 Chapter 8

Qudrtic Equtions Mth 99 N1 Chpter 8 1 Introduction A qudrtic eqution is n eqution where the unknown ppers rised to the second power t most. In other words, it looks for the vlues of x such tht second degree

### Chapter 6 Solving equations

Chpter 6 Solving equtions Defining n eqution 6.1 Up to now we hve looked minly t epressions. An epression is n incomplete sttement nd hs no equl sign. Now we wnt to look t equtions. An eqution hs n = sign

### Exponentiation: Theorems, Proofs, Problems Pre/Calculus 11, Veritas Prep.

Exponentition: Theorems, Proofs, Problems Pre/Clculus, Verits Prep. Our Exponentition Theorems Theorem A: n+m = n m Theorem B: ( n ) m = nm Theorem C: (b) n = n b n ( ) n n Theorem D: = b b n Theorem E:

### 4.11 Inner Product Spaces

314 CHAPTER 4 Vector Spces 9. A mtrix of the form 0 0 b c 0 d 0 0 e 0 f g 0 h 0 cnnot be invertible. 10. A mtrix of the form bc d e f ghi such tht e bd = 0 cnnot be invertible. 4.11 Inner Product Spces

### Matrix Algebra CHAPTER 1 PREAMBLE 1.1 MATRIX ALGEBRA

CHAPTER 1 Mtrix Algebr PREAMBLE Tody, the importnce of mtrix lgebr is of utmost importnce in the field of physics nd engineering in more thn one wy, wheres before 1925, the mtrices were rrely used by the

### In this section make precise the idea of a matrix inverse and develop a method to find the inverse of a given square matrix when it exists.

Mth 52 Sec S060/S0602 Notes Mtrices IV 5 Inverse Mtrices 5 Introduction In our erlier work on mtrix multipliction, we sw the ide of the inverse of mtrix Tht is, for squre mtrix A, there my exist mtrix

### SPECIAL PRODUCTS AND FACTORIZATION

MODULE - Specil Products nd Fctoriztion 4 SPECIAL PRODUCTS AND FACTORIZATION In n erlier lesson you hve lernt multipliction of lgebric epressions, prticulrly polynomils. In the study of lgebr, we come

### MODULE 3. 0, y = 0 for all y

Topics: Inner products MOULE 3 The inner product of two vectors: The inner product of two vectors x, y V, denoted by x, y is (in generl) complex vlued function which hs the following four properties: i)

### and thus, they are similar. If k = 3 then the Jordan form of both matrices is

Homework ssignment 11 Section 7. pp. 249-25 Exercise 1. Let N 1 nd N 2 be nilpotent mtrices over the field F. Prove tht N 1 nd N 2 re similr if nd only if they hve the sme miniml polynomil. Solution: If

### 1 Numerical Solution to Quadratic Equations

cs42: introduction to numericl nlysis 09/4/0 Lecture 2: Introduction Prt II nd Solving Equtions Instructor: Professor Amos Ron Scribes: Yunpeng Li, Mrk Cowlishw Numericl Solution to Qudrtic Equtions Recll

### PROF. BOYAN KOSTADINOV NEW YORK CITY COLLEGE OF TECHNOLOGY, CUNY

MAT 0630 INTERNET RESOURCES, REVIEW OF CONCEPTS AND COMMON MISTAKES PROF. BOYAN KOSTADINOV NEW YORK CITY COLLEGE OF TECHNOLOGY, CUNY Contents 1. ACT Compss Prctice Tests 1 2. Common Mistkes 2 3. Distributive

### Example 27.1 Draw a Venn diagram to show the relationship between counting numbers, whole numbers, integers, and rational numbers.

2 Rtionl Numbers Integers such s 5 were importnt when solving the eqution x+5 = 0. In similr wy, frctions re importnt for solving equtions like 2x = 1. Wht bout equtions like 2x + 1 = 0? Equtions of this

### A new algorithm for generating Pythagorean triples

A new lgorithm for generting Pythgoren triples RH Dye 1 nd RWD Nicklls 2 The Mthemticl Gzette (1998); 82 (Mrch, No. 493), p. 86 91 (JSTOR rchive) http://www.nicklls.org/dick/ppers/mths/pythgtriples1998.pdf

### Integration by Substitution

Integrtion by Substitution Dr. Philippe B. Lvl Kennesw Stte University August, 8 Abstrct This hndout contins mteril on very importnt integrtion method clled integrtion by substitution. Substitution is

### 4: RIEMANN SUMS, RIEMANN INTEGRALS, FUNDAMENTAL THEOREM OF CALCULUS

4: RIEMA SUMS, RIEMA ITEGRALS, FUDAMETAL THEOREM OF CALCULUS STEVE HEILMA Contents 1. Review 1 2. Riemnn Sums 2 3. Riemnn Integrl 3 4. Fundmentl Theorem of Clculus 7 5. Appendix: ottion 10 1. Review Theorem

### 11. Fourier series. sin mx cos nx dx = 0 for any m, n, sin 2 mx dx = π.

. Fourier series Summry of the bsic ides The following is quick summry of the introductory tretment of Fourier series in MATH. We consider function f with period π, tht is, stisfying f(x + π) = f(x) for

### Algorithms Chapter 4 Recurrences

Algorithms Chpter 4 Recurrences Outline The substitution method The recursion tree method The mster method Instructor: Ching Chi Lin 林清池助理教授 chingchilin@gmilcom Deprtment of Computer Science nd Engineering

### Factoring Polynomials

Fctoring Polynomils Some definitions (not necessrily ll for secondry school mthemtics): A polynomil is the sum of one or more terms, in which ech term consists of product of constnt nd one or more vribles

### Algebra Review. How well do you remember your algebra?

Algebr Review How well do you remember your lgebr? 1 The Order of Opertions Wht do we men when we write + 4? If we multiply we get 6 nd dding 4 gives 10. But, if we dd + 4 = 7 first, then multiply by then

### 4.0 5-Minute Review: Rational Functions

mth 130 dy 4: working with limits 1 40 5-Minute Review: Rtionl Functions DEFINITION A rtionl function 1 is function of the form y = r(x) = p(x) q(x), 1 Here the term rtionl mens rtio s in the rtio of two

### 9 CONTINUOUS DISTRIBUTIONS

9 CONTINUOUS DISTIBUTIONS A rndom vrible whose vlue my fll nywhere in rnge of vlues is continuous rndom vrible nd will be ssocited with some continuous distribution. Continuous distributions re to discrete

### Graphs on Logarithmic and Semilogarithmic Paper

0CH_PHClter_TMSETE_ 3//00 :3 PM Pge Grphs on Logrithmic nd Semilogrithmic Pper OBJECTIVES When ou hve completed this chpter, ou should be ble to: Mke grphs on logrithmic nd semilogrithmic pper. Grph empiricl

### Vectors 2. 1. Recap of vectors

Vectors 2. Recp of vectors Vectors re directed line segments - they cn be represented in component form or by direction nd mgnitude. We cn use trigonometry nd Pythgors theorem to switch between the forms

### Math 135 Circles and Completing the Square Examples

Mth 135 Circles nd Completing the Squre Exmples A perfect squre is number such tht = b 2 for some rel number b. Some exmples of perfect squres re 4 = 2 2, 16 = 4 2, 169 = 13 2. We wish to hve method for

### Babylonian Method of Computing the Square Root: Justifications Based on Fuzzy Techniques and on Computational Complexity

Bbylonin Method of Computing the Squre Root: Justifictions Bsed on Fuzzy Techniques nd on Computtionl Complexity Olg Koshelev Deprtment of Mthemtics Eduction University of Texs t El Pso 500 W. University

### Reasoning to Solve Equations and Inequalities

Lesson4 Resoning to Solve Equtions nd Inequlities In erlier work in this unit, you modeled situtions with severl vriles nd equtions. For exmple, suppose you were given usiness plns for concert showing

### MATLAB: M-files; Numerical Integration Last revised : March, 2003

MATLAB: M-files; Numericl Integrtion Lst revised : Mrch, 00 Introduction to M-files In this tutoril we lern the bsics of working with M-files in MATLAB, so clled becuse they must use.m for their filenme

### Example A rectangular box without lid is to be made from a square cardboard of sides 18 cm by cutting equal squares from each corner and then folding

1 Exmple A rectngulr box without lid is to be mde from squre crdbord of sides 18 cm by cutting equl squres from ech corner nd then folding up the sides. 1 Exmple A rectngulr box without lid is to be mde

### Integration. 148 Chapter 7 Integration

48 Chpter 7 Integrtion 7 Integrtion t ech, by supposing tht during ech tenth of second the object is going t constnt speed Since the object initilly hs speed, we gin suppose it mintins this speed, but

### Assuming all values are initially zero, what are the values of A and B after executing this Verilog code inside an always block? C=1; A <= C; B = C;

B-26 Appendix B The Bsics of Logic Design Check Yourself ALU n [Arthritic Logic Unit or (rre) Arithmetic Logic Unit] A rndom-numer genertor supplied s stndrd with ll computer systems Stn Kelly-Bootle,

### Uniform convergence and its consequences

Uniform convergence nd its consequences The following issue is centrl in mthemtics: On some domin D, we hve sequence of functions {f n }. This mens tht we relly hve n uncountble set of ordinry sequences,

### Lecture 3 Basic Probability and Statistics

Lecture 3 Bsic Probbility nd Sttistics The im of this lecture is to provide n extremely speedy introduction to the probbility nd sttistics which will be needed for the rest of this lecture course. The

### Anti-derivatives/Indefinite Integrals of Basic Functions

Anti-derivtives/Indefinite Integrls of Bsic Functions Power Rule: x n+ x n n + + C, dx = ln x + C, if n if n = In prticulr, this mens tht dx = ln x + C x nd x 0 dx = dx = dx = x + C Integrl of Constnt:

### Mathematics. Vectors. hsn.uk.net. Higher. Contents. Vectors 128 HSN23100

hsn.uk.net Higher Mthemtics UNIT 3 OUTCOME 1 Vectors Contents Vectors 18 1 Vectors nd Sclrs 18 Components 18 3 Mgnitude 130 4 Equl Vectors 131 5 Addition nd Subtrction of Vectors 13 6 Multipliction by

### EQUATIONS OF LINES AND PLANES

EQUATIONS OF LINES AND PLANES MATH 195, SECTION 59 (VIPUL NAIK) Corresponding mteril in the ook: Section 12.5. Wht students should definitely get: Prmetric eqution of line given in point-direction nd twopoint

### 9.3. The Scalar Product. Introduction. Prerequisites. Learning Outcomes

The Sclr Product 9.3 Introduction There re two kinds of multipliction involving vectors. The first is known s the sclr product or dot product. This is so-clled becuse when the sclr product of two vectors

### MATLAB Workshop 13 - Linear Systems of Equations

MATLAB: Workshop - Liner Systems of Equtions pge MATLAB Workshop - Liner Systems of Equtions Objectives: Crete script to solve commonly occurring problem in engineering: liner systems of equtions. MATLAB

### . At first sight a! b seems an unwieldy formula but use of the following mnemonic will possibly help. a 1 a 2 a 3 a 1 a 2

7 CHAPTER THREE. Cross Product Given two vectors = (,, nd = (,, in R, the cross product of nd written! is defined to e: " = (!,!,! Note! clled cross is VECTOR (unlike which is sclr. Exmple (,, " (4,5,6

### Curve Sketching. 96 Chapter 5 Curve Sketching

96 Chpter 5 Curve Sketching 5 Curve Sketching A B A B A Figure 51 Some locl mximum points (A) nd minimum points (B) If (x, f(x)) is point where f(x) reches locl mximum or minimum, nd if the derivtive of

### 5.2. LINE INTEGRALS 265. Let us quickly review the kind of integrals we have studied so far before we introduce a new one.

5.2. LINE INTEGRALS 265 5.2 Line Integrls 5.2.1 Introduction Let us quickly review the kind of integrls we hve studied so fr before we introduce new one. 1. Definite integrl. Given continuous rel-vlued

### Lecture 2: Matrix Algebra. General

Lecture 2: Mtrix Algebr Generl Definitions Algebric Opertions Vector Spces, Liner Independence nd Rnk of Mtrix Inverse Mtrix Liner Eqution Systems, the Inverse Mtrix nd Crmer s Rule Chrcteristic Roots

### 2005-06 Second Term MAT2060B 1. Supplementary Notes 3 Interchange of Differentiation and Integration

Source: http://www.mth.cuhk.edu.hk/~mt26/mt26b/notes/notes3.pdf 25-6 Second Term MAT26B 1 Supplementry Notes 3 Interchnge of Differentition nd Integrtion The theme of this course is bout vrious limiting

### MATH 150 HOMEWORK 4 SOLUTIONS

MATH 150 HOMEWORK 4 SOLUTIONS Section 1.8 Show tht the product of two of the numbers 65 1000 8 2001 + 3 177, 79 1212 9 2399 + 2 2001, nd 24 4493 5 8192 + 7 1777 is nonnegtive. Is your proof constructive

### Equations between labeled directed graphs

Equtions etween leled directed grphs Existence of solutions Grret-Fontelles A., Misnikov A., Ventur E. My 2013 Motivtionl prolem H 1 nd H 2 two sugroups of the free group generted y X A, F (X, A). H 1

### Hillsborough Township Public Schools Mathematics Department Computer Programming 1

Essentil Unit 1 Introduction to Progrmming Pcing: 15 dys Common Unit Test Wht re the ethicl implictions for ming in tody s world? There re ethicl responsibilities to consider when writing computer s. Citizenship,

### 6.2 Volumes of Revolution: The Disk Method

mth ppliction: volumes of revolution, prt ii Volumes of Revolution: The Disk Method One of the simplest pplictions of integrtion (Theorem ) nd the ccumultion process is to determine so-clled volumes of

### Homework 3 Solutions

CS 341: Foundtions of Computer Science II Prof. Mrvin Nkym Homework 3 Solutions 1. Give NFAs with the specified numer of sttes recognizing ech of the following lnguges. In ll cses, the lphet is Σ = {,1}.

### Union, Intersection and Complement. Formal Foundations Computer Theory

Union, Intersection nd Complement FAs Union, Intersection nd Complement FAs Forml Foundtions Computer Theory Ferury 21, 2013 This hndout shows (y exmples) how to construct FAs for the union, intersection

### The Chain Rule. rf dx. t t lim " (x) dt " (0) dx. df dt = df. dt dt. f (r) = rf v (1) df dx

The Chin Rule The Chin Rule In this section, we generlize the chin rule to functions of more thn one vrible. In prticulr, we will show tht the product in the single-vrible chin rule extends to n inner

### The Velocity Factor of an Insulated Two-Wire Transmission Line

The Velocity Fctor of n Insulted Two-Wire Trnsmission Line Problem Kirk T. McDonld Joseph Henry Lbortories, Princeton University, Princeton, NJ 08544 Mrch 7, 008 Estimte the velocity fctor F = v/c nd the

### Solving BAMO Problems

Solving BAMO Problems Tom Dvis tomrdvis@erthlink.net http://www.geometer.org/mthcircles Februry 20, 2000 Abstrct Strtegies for solving problems in the BAMO contest (the By Are Mthemticl Olympid). Only

### FUNCTIONS AND EQUATIONS. xεs. The simplest way to represent a set is by listing its members. We use the notation

FUNCTIONS AND EQUATIONS. SETS AND SUBSETS.. Definition of set. A set is ny collection of objects which re clled its elements. If x is n element of the set S, we sy tht x belongs to S nd write If y does

### In the following there are presented four different kinds of simulation games for a given Büchi automaton A = :

Simultion Gmes Motivtion There re t lest two distinct purposes for which it is useful to compute simultion reltionships etween the sttes of utomt. Firstly, with the use of simultion reltions it is possile

### Notes for Thurs 8 Sept Calculus II Fall 2005 New York University Instructor: Tyler Neylon Scribe: Kelsey Williams

Notes for Thurs 8 Sept Clculus II Fll 00 New York University Instructor: Tyler Neylon Scribe: Kelsey Willims 8. Integrtion by Prts This section is primrily bout the formul u dv = uv v ( ) which is essentilly

### Virtual Machine. Part II: Program Control. Building a Modern Computer From First Principles. www.nand2tetris.org

Virtul Mchine Prt II: Progrm Control Building Modern Computer From First Principles www.nnd2tetris.org Elements of Computing Systems, Nisn & Schocken, MIT Press, www.nnd2tetris.org, Chpter 8: Virtul Mchine,

### Section 7-4 Translation of Axes

62 7 ADDITIONAL TOPICS IN ANALYTIC GEOMETRY Section 7-4 Trnsltion of Aes Trnsltion of Aes Stndrd Equtions of Trnslted Conics Grphing Equtions of the Form A 2 C 2 D E F 0 Finding Equtions of Conics In the

### A.7.1 Trigonometric interpretation of dot product... 324. A.7.2 Geometric interpretation of dot product... 324

A P P E N D I X A Vectors CONTENTS A.1 Scling vector................................................ 321 A.2 Unit or Direction vectors...................................... 321 A.3 Vector ddition.................................................

### Net Change and Displacement

mth 11, pplictions motion: velocity nd net chnge 1 Net Chnge nd Displcement We hve seen tht the definite integrl f (x) dx mesures the net re under the curve y f (x) on the intervl [, b] Any prt of the

### 1. Inverse of a tridiagonal matrix

Pré-Publicções do Deprtmento de Mtemátic Universidde de Coimbr Preprint Number 05 16 ON THE EIGENVALUES OF SOME TRIDIAGONAL MATRICES CM DA FONSECA Abstrct: A solution is given for problem on eigenvlues

### Protocol Analysis. 17-654/17-764 Analysis of Software Artifacts Kevin Bierhoff

Protocol Anlysis 17-654/17-764 Anlysis of Softwre Artifcts Kevin Bierhoff Tke-Awys Protocols define temporl ordering of events Cn often be cptured with stte mchines Protocol nlysis needs to py ttention

### Section 2.3. Motion Along a Curve. The Calculus of Functions of Several Variables

The Clculus of Functions of Severl Vribles Section 2.3 Motion Along Curve Velocity ccelertion Consider prticle moving in spce so tht its position t time t is given by x(t. We think of x(t s moving long

### MATH34032: Green s Functions, Integral Equations and the Calculus of Variations 1

MATH3432: Green s Functions, Integrl Equtions nd the Clculus of Vritions Section 3 Integrl Equtions Integrl Opertors nd Liner Integrl Equtions As we sw in Section on opertor nottion, we work with functions

### Lecture 5. Inner Product

Lecture 5 Inner Product Let us strt with the following problem. Given point P R nd line L R, how cn we find the point on the line closest to P? Answer: Drw line segment from P meeting the line in right

### 1.00/1.001 Introduction to Computers and Engineering Problem Solving Fall 2011 - Final Exam

1./1.1 Introduction to Computers nd Engineering Problem Solving Fll 211 - Finl Exm Nme: MIT Emil: TA: Section: You hve 3 hours to complete this exm. In ll questions, you should ssume tht ll necessry pckges

### 1.2 The Integers and Rational Numbers

.2. THE INTEGERS AND RATIONAL NUMBERS.2 The Integers n Rtionl Numers The elements of the set of integers: consist of three types of numers: Z {..., 5, 4, 3, 2,, 0,, 2, 3, 4, 5,...} I. The (positive) nturl

### Section 5-4 Trigonometric Functions

5- Trigonometric Functions Section 5- Trigonometric Functions Definition of the Trigonometric Functions Clcultor Evlution of Trigonometric Functions Definition of the Trigonometric Functions Alternte Form

### Experiment 6: Friction

Experiment 6: Friction In previous lbs we studied Newton s lws in n idel setting, tht is, one where friction nd ir resistnce were ignored. However, from our everydy experience with motion, we know tht

### INTERCHANGING TWO LIMITS. Zoran Kadelburg and Milosav M. Marjanović

THE TEACHING OF MATHEMATICS 2005, Vol. VIII, 1, pp. 15 29 INTERCHANGING TWO LIMITS Zorn Kdelburg nd Milosv M. Mrjnović This pper is dedicted to the memory of our illustrious professor of nlysis Slobodn

### Operations with Polynomials

38 Chpter P Prerequisites P.4 Opertions with Polynomils Wht you should lern: Write polynomils in stndrd form nd identify the leding coefficients nd degrees of polynomils Add nd subtrct polynomils Multiply

### On decidability of LTL model checking for process rewrite systems

Act Informtic (2009) 46:1 28 DOI 10.1007/s00236-008-0082-3 ORIGINAL ARTICLE On decidbility of LTL model checking for process rewrite systems Lur Bozzelli Mojmír Křetínský Vojtěch Řehák Jn Strejček Received:

### Section A-4 Rational Expressions: Basic Operations

A- Appendi A A BASIC ALGEBRA REVIEW 7. Construction. A rectngulr open-topped bo is to be constructed out of 9- by 6-inch sheets of thin crdbord by cutting -inch squres out of ech corner nd bending the

### Pentominoes. Pentominoes. Bruce Baguley Cascade Math Systems, LLC. The pentominoes are a simple-looking set of objects through which some powerful

Pentominoes Bruce Bguley Cscde Mth Systems, LLC Astrct. Pentominoes nd their reltives the polyominoes, polycues, nd polyhypercues will e used to explore nd pply vrious importnt mthemticl concepts. In this

### Use Geometry Expressions to create a more complex locus of points. Find evidence for equivalence using Geometry Expressions.

Lerning Objectives Loci nd Conics Lesson 3: The Ellipse Level: Preclculus Time required: 120 minutes In this lesson, students will generlize their knowledge of the circle to the ellipse. The prmetric nd

### Module Summary Sheets. C3, Methods for Advanced Mathematics (Version B reference to new book) Topic 2: Natural Logarithms and Exponentials

MEI Mthemtics in Ection nd Instry Topic : Proof MEI Structured Mthemtics Mole Summry Sheets C, Methods for Anced Mthemtics (Version B reference to new book) Topic : Nturl Logrithms nd Eponentils Topic

### Novel Methods of Generating Self-Invertible Matrix for Hill Cipher Algorithm

Bibhudendr chry, Girij Snkr Rth, Srt Kumr Ptr, nd Sroj Kumr Pnigrhy Novel Methods of Generting Self-Invertible Mtrix for Hill Cipher lgorithm Bibhudendr chry Deprtment of Electronics & Communiction Engineering

### Binary Representation of Numbers Autar Kaw

Binry Representtion of Numbers Autr Kw After reding this chpter, you should be ble to: 1. convert bse- rel number to its binry representtion,. convert binry number to n equivlent bse- number. In everydy

### Bayesian Updating with Continuous Priors Class 13, 18.05, Spring 2014 Jeremy Orloff and Jonathan Bloom

Byesin Updting with Continuous Priors Clss 3, 8.05, Spring 04 Jeremy Orloff nd Jonthn Bloom Lerning Gols. Understnd prmeterized fmily of distriutions s representing continuous rnge of hypotheses for the

### Sirindhorn International Institute of Technology Thammasat University at Rangsit

Sirindhorn Interntionl Institute of Technology Thmmst University t Rngsit School of Informtion, Computer nd Communiction Technology COURSE : ECS 204 Bsic Electricl Engineering L INSTRUCTOR : Asst. Prof.

### Object Semantics. 6.170 Lecture 2

Object Semntics 6.170 Lecture 2 The objectives of this lecture re to: to help you become fmilir with the bsic runtime mechnism common to ll object-oriented lnguges (but with prticulr focus on Jv): vribles,

### Ostrowski Type Inequalities and Applications in Numerical Integration. Edited By: Sever S. Dragomir. and. Themistocles M. Rassias

Ostrowski Type Inequlities nd Applictions in Numericl Integrtion Edited By: Sever S Drgomir nd Themistocles M Rssis SS Drgomir) School nd Communictions nd Informtics, Victori University of Technology,

### Treatment Spring Late Summer Fall 0.10 5.56 3.85 0.61 6.97 3.01 1.91 3.01 2.13 2.99 5.33 2.50 1.06 3.53 6.10 Mean = 1.33 Mean = 4.88 Mean = 3.

The nlysis of vrince (ANOVA) Although the t-test is one of the most commonly used sttisticl hypothesis tests, it hs limittions. The mjor limittion is tht the t-test cn be used to compre the mens of only

### Review guide for the final exam in Math 233

Review guide for the finl exm in Mth 33 1 Bsic mteril. This review includes the reminder of the mteril for mth 33. The finl exm will be cumultive exm with mny of the problems coming from the mteril covered

### Mechanics Cycle 1 Chapter 5. Chapter 5

Chpter 5 Contct orces: ree Body Digrms nd Idel Ropes Pushes nd Pulls in 1D, nd Newton s Second Lw Neglecting riction ree Body Digrms Tension Along Idel Ropes (i.e., Mssless Ropes) Newton s Third Lw Bodies

Why network is n essentil productivity tool for ny smll business Effective technology is essentil for smll businesses looking to increse the productivity of their people nd business. Introducing technology

### Suffix Trees CMSC 423

Suffix Trees CMSC 423 Preprocessing Strings Over the next few lectures, we ll see severl methods for preprocessing string dt into dt structures tht mke mny questions (like serching) esy to nswer: Suffix

### Modular Generic Verification of LTL Properties for Aspects

Modulr Generic Verifiction of LTL Properties for Aspects Mx Goldmn Shmuel Ktz Computer Science Deprtment Technion Isrel Institute of Technology {mgoldmn, ktz}@cs.technion.c.il ABSTRACT Aspects re seprte

### Homework #6: Answers. a. If both goods are produced, what must be their prices?

Text questions, hpter 7, problems 1-2. Homework #6: Answers 1. Suppose there is only one technique tht cn be used in clothing production. To produce one unit of clothing requires four lbor-hours nd one

### The Semantics of Graph Programs

The Semntics of Grph Progrms Detlef Plump Deprtment of Computer Science The University of York, UK Sndr Steinert Deprtment of Computer Science The University of York, UK GP (for Grph Progrms) is rule-bsed,

### How fast can we sort? Sorting. Decision-tree model. Decision-tree for insertion sort Sort a 1, a 2, a 3. CS 3343 -- Spring 2009

CS 4 -- Spring 2009 Sorting Crol Wenk Slides courtesy of Chrles Leiserson with smll chnges by Crol Wenk CS 4 Anlysis of Algorithms 1 How fst cn we sort? All the sorting lgorithms we hve seen so fr re comprison

### Basic Analysis of Autarky and Free Trade Models

Bsic Anlysis of Autrky nd Free Trde Models AUTARKY Autrky condition in prticulr commodity mrket refers to sitution in which country does not engge in ny trde in tht commodity with other countries. Consequently

### On the Meaning of Regression Coefficients for Categorical and Continuous Variables: Model I and Model II; Effect Coding and Dummy Coding

Dt_nlysisclm On the Mening of Regression for tegoricl nd ontinuous Vribles: I nd II; Effect oding nd Dummy oding R Grdner Deprtment of Psychology This describes the simple cse where there is one ctegoricl