Extraction of Programs for Exact Number Computation Using Agda

Extraction of Programs for Exact Number Computation Using Agda

_________________________________________________________________________Swansea University E-Theses Extraction of programs for exact number computation using Agda. Chuang, Chi Ming How to cite: _________________________________________________________________________ Chuang, Chi Ming (2011) Extraction of programs for exact number computation using Agda.. thesis, Swansea University. http://cronfa.swan.ac.uk/Record/cronfa42274 Use policy: _________________________________________________________________________ This item is brought to you by Swansea University. Any person downloading material is agreeing to abide by the terms of the repository licence: copies of full text items may be used or reproduced in any format or medium, without prior permission for personal research or study, educational or non-commercial purposes only. The copyright for any work remains with the original author unless otherwise specified. The full-text must not be sold in any format or medium without the formal permission of the copyright holder. Permission for multiple reproductions should be obtained from the original author. Authors are personally responsible for adhering to copyright and publisher restrictions when uploading content to the repository. Please link to the metadata record in the Swansea University repository, Cronfa (link given in the citation reference above.) http://www.swansea.ac.uk/library/researchsupport/ris-support/ Extraction of Programs for Exact Real Number Computation U sing Agda Swansea University Prifysgol Abertawe Chi Ming Chuang Department of Computer Science Swansea University Submitted to Swansea University in fulfilment of the requirements for the Degree of Doctor of Philosophy 2011 ProQuest Number: 10797982 All rights reserved INFORMATION TO ALL USERS The quality of this reproduction is dependent upon the quality of the copy submitted. In the unlikely event that the author did not send a com plete manuscript and there are missing pages, these will be noted. Also, if material had to be removed, a note will indicate the deletion. uest ProQuest 10797982 Published by ProQuest LLC(2018). Copyright of the Dissertation is held by the Author. All rights reserved. This work is protected against unauthorized copying under Title 17, United States C ode Microform Edition © ProQuest LLC. ProQuest LLC. 789 East Eisenhower Parkway P.O. Box 1346 Ann Arbor, Ml 48106- 1346 LIBRARY A bstract This thesis contains the to our knowledge first research project to ex­ tract in the theorem prover Agda programs from proofs involving pos­ tulated axioms. Our method doesn’t require to write a Meta program for extracting programs from proofs. It shows as well the correctness of the machinery. This method has been applied to the extraction of programs about real number computation. The method has been used for showing that the signed digit approximable real numbers are closed under addition, multiplication, and contain the rational numbers. Therefore we obtain in Agda a provably correct program which executes the corresponding operations on signed digit streams. The first part of the thesis introduces axioms about real numbers using postulated data types and functions in Agda without giving any computational rules. Then we investigate some properties of real numbers constructed by Cauchy sequences: we introduce the set of real numbers which are limits of Cauchy sequences of rational num­ bers (Cauchy Reals) and show that they are closed under addition and multiplication. We also prove that Cauchy Reals are Cauchy complete. Furthermore, we introduce the real numbers in the interval [-1,1], which have a binary signed digit representation, i.e. r = O.d0did2 ..., where di G { — 1,0,1}. This set of real numbers is given as a codata type (SDR). We determine for rational numbers in the interval [—1,1] their SDR and show that SDRs are closed under the average function and the multiplication function. Besides, a finding digit function is defined which determines the first n digits of a stream of signed digits. In the second part of the thesis, a theorem is given which shows the correctness of our method. It shows that under certain conditions our method always normalises and doesn’t make use of the axioms. The conditions mainly guarantee that a postulated function or axiom has as result type only a postulated type, so the reduction of elements of algebraic data types to head normal form will not refer to these postulates. Because of our theorem the finding digit function applied to a real number r s.t. SDR r holds normalises to [do, d i,..., dn_i] for the first n digit dodi... dn_i of r. Therefore, we can compute the SDR of rational numbers and from SDRs of real numbers the SDR of their average and product. Declaration This work has not previously been accepted in substance for any degree and is not being concurrently submitted in candidature for any degree. Signed . (candidate) D a te ...................................*........................ Statement 1 This thesis is the result of my own investigations, except where otherwise stated. Where correction services have been used, the extent and nature of the correction is clearly marked in a footnote(s). Other sources are acknowledged by footnotes giving explicit references. A bibli­ ography is appended. Signed ... (candidate) D ate ................................................................. Statement 2 I hereby give my consent for my thesis, if accepted, to be available for photocopy­ ing and for inter-library loan, and for the title and summary to be made available to outside organisations. Signed . (candidate) D a te........................................................... C ontents Contents iv 1 Introduction 1 1.1 Program Extraction .............................................................................. 2 1.2 Main Result of Thesis: Internalisation of Program Extraction into Agda together with Correctness Proof ................................................ 5 1.3 The Structure of the T hesis.............................................................. 6 1.4 Related W ork ....................................................................................... 7 1.5 More Details on Interval Arithmetic and Program Extraction . 11 1.6 Talk, P u b licatio n ................................................................................. 15 2 Introduction to Agda 16 2.1 The Language of A gda ....................................................................... 16 2.1.1 Basic Principles ........................................................................ 17 2.1.2 Postulated Types and Term s................................................... 17 2.1.3 Dependent Functions ............................................................... 18 2.1.4 Data type and Pattern M atc h in g ......................................... 19 2.1.5 Inductive and Coinductive Data ty p e .................................... 21 2.1.6 E q u ality ..................................................................................... 23 2.1.7 Let, Where-expressions and Mutual Definitions ................ 24 2.1.8 BUILTIN and P rim itiv e ......................................................... 25 2.1.9 M odules ..................................................................................... 27 2.1.10 Compiled Version of A g d a ...................................................... 29 iv CONTENTS 3 Real Numbers and Their Axiomatisation 31 3.1 Natural Numbers, Integers, and Rational Numbers ....................... 32 3.2 Real Numbers ....................................................................................... 33 3.2.1 Dedekind C u t s ........................................................................ 34 3.2.2 Cauchy Sequences..................................................................... 36 4 Coalgebras and Coinduction 41 4.1 Initial Algebras and Final Coalgebras .............................................. 43 4.2 Coalgebras and Codata in A gda ........................................................ 50 4.3 Least and Greatest Fixed Points in SetTheory ................ 55 5 Cauchy Reals in Agda 58 5.1 Axioms .................................................................................................... 58 5.2 Q' Closure Under A ddition ................................................................. 66 5.3 Q' Closure Under M ultiplication ........................................................ 67 5.4 Q' is Cauchy-com plete....................................................................... 71 6 Signed Digit Representation of Real Numbers in Classical Math­ ematics 74 6.1 Signed Digit R epresentation .............................................................. 75 6.2 The signed Digit Representations of Real Numbers -1,0 and 1 . 83 6.3 The signed Digit Representations of Rational Nu m b e rs .................. 85 6.4 A v erag e ................................................................................................. 85 6.4.1 Function a v a u x ...................................................................... 86 6.4.2 Function a v ............................................................................ 87 6.5 M ultiplication ....................................................................................... 88 6.5.1 Function m paux ...................................................................... 89 6.5.2 Function a d d R ...................................................................... 92 6.5.3 Function m p ...........................................................................

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    217 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us