[isabelle-dev] Proper sign of gcd / lcm on type int
Makarius
makarius at sketis.net
Wed Jun 1 21:57:02 CEST 2016
On 01/06/16 21:27, Florian Haftmann wrote:
> Note that the mixed signs of PolyML.IntInf.lcm maintain the property
>
> gcd a b * lcm a b = a * b
>
> whereas the lcm in GCD.thy obeys
>
> gcd a b * lcm a b = normalize a * normalize b
>
> which emphasises the dual nature of the gcd/lcm lattice.
>
> Both are ok in my view; ironically, lcm is used more often in
> Isabelle/ML than gcd. Providing an lcm in the manner of HOL is trivial,
> though:
>
> Integer.gcd = PolyML.gcd
> Integer.lcm = abs oo PolyML.lcm
These two lines are the plan. Is that a good one or a bad one?
Presently, I have used PolyML.IntInf.gcd and PolyML.IntInf.lcm for
rat.ML (see da38571dd5bd). It somehow violates our cozy Isabelle/ML
library environment to refer to structure PolyML.
BTW, AFP has special code generator setup for PolyML.IntInf.gcd here:
https://bitbucket.org/isa-afp/afp-devel/src/54c65361e6ed029f70572de89cfc5736153a0feb/thys/Gauss_Jordan/Code_Generation_IArrays_SML.thy?at=default&fileviewer=file-view-default#Code_Generation_IArrays_SML.thy-33
https://bitbucket.org/isa-afp/afp-devel/src/54c65361e6ed029f70572de89cfc5736153a0feb/thys/Echelon_Form/Examples_Echelon_Form_IArrays.thy?at=default&fileviewer=file-view-default#Examples_Echelon_Form_IArrays.thy-44
Luckily, this is only gcd and not lcm, so it coincides already.
Makarius
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://mailman46.in.tum.de/pipermail/isabelle-dev/attachments/20160601/acdb2fda/attachment.sig>
More information about the isabelle-dev
mailing list