From tfm@computer-lab.cambridge.ac.uk  Sun May 27 07:14:10 1990
Received: by iris.ucdavis.edu (5.57/UCD.EECS.2.0)
        id AA21682; Sun, 27 May 90 07:14:10 PDT
Received: from ucdavis.ucdavis.edu by clover.ucdavis.edu (5.59/UCD.EECS.1.11)
        id AA10653; Sun, 27 May 90 07:18:04 PDT
Received: from nsfnet-relay.ac.uk by ucdavis.ucdavis.edu (5.61/UCD2.03)
        id AA09934; Sun, 27 May 90 07:00:55 -0700
Received: from sun.nsfnet-relay.ac.uk by vax.NSFnet-Relay.AC.UK
           via Janet with NIFTP  id aa06303; 27 May 90 14:50 BST
Received: from moorhen.cl.cam.ac.uk by gnnt.Cl.Cam.AC.UK id aa21308;
          27 May 90 14:54 BST
Received: by uk.ac.cam.cl.moorhen (4.0/SMI-3.0DEV3)
        id AA10250; Sun, 27 May 90 14:54:32 BST
Date: Sun, 27 May 90 14:54:32 BST
From: tfm@computer-lab.cambridge.ac.uk
Message-Id: <9005271354.AA10250@uk.ac.cam.cl.moorhen>
To: info-hol@clover.ucdavis.edu
Subject: MOD and DIV in HOL88 version 1.12

built-in MOD and DIV on the naturals
------------------------------------

In response to (local) demand, I have dusted off my old theory of MOD and DIV
on the natural numbers, and used it to developed a bit further the built-in
theory of these operators in HOL88 Version 1.12.  This version is not yet
ready for general release, but I thought I'd post this message to let users
know what's coming.  What follows is the "Version" documentation for this
enhancement to the built-in theory of arithmetic.

Most interested user have probably already developed their own theory of
modular arithmetic (it's not particularly difficult, just a bit tedious),
but I could post a patch for version 1.11 if there is sufficient demand.

Tom

=============================================================================
=============================================================================

+----------------------------------------------------------------------------+
| CHANGE TYPE:   Addition to theory arithmetic.th.                           |
|----------------------------------------------------------------------------|
| CHANGED BY:    TFM                                                         |
|----------------------------------------------------------------------------|
| FILES CHANGED: theories/mk_arith.ml theories/mk_arith_thms.ml              |
|                ml/load_thms.ml (+ REFERENCE manual)                        |
|----------------------------------------------------------------------------|
| DATE:          26 May 1990.                                                |
+----------------------------------------------------------------------------+

The built-in theory arithmetic has been augmented with a fairly minimal theory
of the functions MOD and DIV on the natural numbers.  The old definitions of
MOD and DIV:

   MOD   |- MOD k n = @r. ?q. (k = (q * n) + r) /\ r < n
   DIV   |- DIV k n = @q. (k = (q * n) + (k MOD n))

have been DELETED, and replaced by the constant specification:

   DIVISION |- !n. 0 < n ==>
                   (!k. (k = ((k DIV n) * n) + (k MOD n)) /\ (k MOD n) < n)

the validity of which is justified by the division algorithm:

   DA  |- !k n. 0 < n ==> (?r q. (k = (q * n) + r) /\ r < n)

The following theorems are also available:

  MOD_ONE      |- !k. k MOD (SUC 0) = 0

  DIV_LESS_EQ  |- !n. 0 < n ==> (!k. (k DIV n) <= k)

  DIV_UNIQUE   |- !n k q. (?r. (k = (q * n) + r) /\ r < n) ==> (k DIV n = q)

  MOD_UNIQUE   |- !n k r. (?q. (k = (q * n) + r) /\ r < n) ==> (k MOD n = r)

  DIV_MULT     |- !n r. r < n ==> (!q. ((q * n) + r) DIV n = q)

  LESS_MOD     |- !n k. k < n ==> (k MOD n = k)

  MOD_EQ_0     |- !n. 0 < n ==> (!k. (k * n) MOD n = 0)

  ZERO_MOD     |- !n. 0 < n ==> (0 MOD n = 0)

  MOD_MULT     |- !n r. r < n ==> (!q. ((q * n) + r) MOD n = r)

  MOD_TIMES    |- !n. 0 < n ==> (!q r. ((q * n) + r) MOD n = r MOD n)

  MOD_PLUS     |- !n. 0 < n ==>
                      (!j k. ((j MOD n) + (k MOD n)) MOD n = (j + k) MOD n)

  MOD_MOD      |- !n. 0 < n ==> (!k. (k MOD n) MOD n = k MOD n)

Other built-in theorems may be added in later releases of HOL.

