From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,c9d5fc258548b22a X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!o7g2000prn.googlegroups.com!not-for-mail From: Shark8 Newsgroups: comp.lang.ada Subject: Re: How do I write directly to a memory address? Date: Wed, 9 Feb 2011 13:40:41 -0800 (PST) Organization: http://groups.google.com Message-ID: <76c123ab-7425-44d8-b26d-b2b41a9aa42b@o7g2000prn.googlegroups.com> References: <67063a5b-f588-45ea-bf22-ca4ba0196ee6@l11g2000yqb.googlegroups.com> <4d51905c$0$19486$882e7ee2@usenet-news.net> <36212a7b-deab-45d9-ac45-aa29cd90c7bc@o18g2000prh.googlegroups.com> <4d51a7bb$0$19486$882e7ee2@usenet-news.net> <4d52b489$0$19486$882e7ee2@usenet-news.net> <9a8njlwvey1p.1a96yvvgdf6yu.dlg@40tude.net> <4d52c5e5$0$19486$882e7ee2@usenet-news.net> <720b7e8f-1ae2-4b3b-851e-12b08b3c99e0@r4g2000prm.googlegroups.com> <4d52dd97$0$18057$882e7ee2@usenet-news.net> <9a8f406d-05ca-4bf3-8487-918d4e0dd634@o18g2000prh.googlegroups.com> <4d52ee47$0$18057$882e7ee2@usenet-news.net> <4d5306a0$0$18057$882e7ee2@usenet-news.net> NNTP-Posting-Host: 174.28.151.164 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1297287641 9695 127.0.0.1 (9 Feb 2011 21:40:41 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 9 Feb 2011 21:40:41 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: o7g2000prn.googlegroups.com; posting-host=174.28.151.164; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 ( .NET CLR 3.5.30729; .NET4.0E),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:17166 Date: 2011-02-09T13:40:41-08:00 List-Id: On Feb 9, 2:26=A0pm, Hyman Rosen wrote: > On 2/9/2011 3:29 PM, Shark8 wrote: > > > On Feb 9, 12:43 pm, Hyman Rosen =A0wrote: > >> On 2/9/2011 2:20 PM, Shark8 wrote: > > >>> Sure I can; but to do that I need to be given a value of N, obviously= . > > >> OK, how about N =3D 90? > > >> =A0 > =A0We can also show its correctness via mathematical induction. > > >> Go ahead, do that. > > > The Fibonacci Sequence is defined as... > > OK, let's see if I understand: > > =A0 =A0 =A0Function SumTo( N : Positive ) Return Positive is > =A0 =A0 =A0begin > =A0 =A0 =A0 =A0 Case N is > =A0 =A0 =A0 =A0 =A0 When 1 =3D> Return 1; > =A0 =A0 =A0 =A0 =A0 When Others =3D> Return 1 + SumTo(N-1); > =A0 =A0 =A0 =A0 end case; > =A0 =A0 =A0end SumTo; > > The induction should be similar, correct? So the induction > will tell me what result I will get for SumTo(100_000_000)? Er, no. Induction just proves that for some statement P, and some parameter n {where n may or may not be constrained}, that P(n) being true necessarily means that P(N+Step) is also true. {I have to wax quite general here because* the statement, P, and the step are not fixed in any way.} What induction *CAN* do is tell you whether or not SumTo is correctly constructed and that, barring exceptions, is what guarantees the return-value to be correct. IE It is a proof of correctness; not per se a returner of values. * it is perfectly valid to run induction on, say, prime numbers as steps (1,2,3,5,7,11,...)... though I can't readily think of a case requiring it.