Re: [isabelle-dev] Proper sign of gcd / lcm on type int

2016-06-03 Thread Pierpaolo Bernardi
About signs in divisions etc. I found the following paper very useful: http://research.microsoft.com/apps/pubs/default.aspx?id=151917 Maybe someone else will find it useful too. Cheers On Fri, Jun 3, 2016 at 9:29 PM, Makarius wrote: > On 03/06/16 18:49, David Matthews wrote: > >> The Poly/ML

Re: [isabelle-dev] Proper sign of gcd / lcm on type int

2016-06-03 Thread Makarius
On 03/06/16 18:49, David Matthews wrote: > The Poly/ML implementation was based on the idea that something called a > "multiple" ought to follow the usual rules of multiplication; nothing > stronger than that. I don't think I found anything that indicated what > the sign should be. The GCD code

Re: [isabelle-dev] Proper sign of gcd / lcm on type int

2016-06-03 Thread David Matthews
On 02/06/2016 08:19, Manuel Eberl wrote: I do think that we should enforce the same thing in the ML implementation of gcd/lcm. Any definition of gcd/lcm for integers where either of them may be negative does not make much sense to me. My guess would be that lcm can be negative in the implementati

Re: [isabelle-dev] Proper sign of gcd / lcm on type int

2016-06-02 Thread Amine Chaieb
I believe Florian's proposal is good. On a proof-engineering level, the only "inconvinience" is mainly that the property gcd a b * lcm a b = a * b does not hold as such but generally I suspect in the form gcd a b * lcm a b = normalize(a * b) -- The normalize in GCD.thy perhaps has the property

Re: [isabelle-dev] Proper sign of gcd / lcm on type int

2016-06-02 Thread Manuel Eberl
Florian has already hinted at it, but I will say it again explicitly: Mathematically, gcd and lcm are not operations on the elements of a ring, but on the equivalence classes w.r.t. associatedness (i.e. mutual divisibility). In fact, these equivalence classes form a complete lattice w.r.t. div

Re: [isabelle-dev] Proper sign of gcd / lcm on type int

2016-06-01 Thread Florian Haftmann
>> 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? I

Re: [isabelle-dev] Proper sign of gcd / lcm on type int

2016-06-01 Thread Makarius
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

Re: [isabelle-dev] Proper sign of gcd / lcm on type int

2016-06-01 Thread Florian Haftmann
Hi Makarius, > presently on Isabelle/c3896c385c3e and AFP/d9305abd02e9, I am trying to > understand the situation of gcd / lcm for negative arguments. > > We have the following slightly divergent operations: > > * HOL gcd / lcm: always >= 0 (via "normalize" which is "abs") > > * PolyML.IntI

[isabelle-dev] Proper sign of gcd / lcm on type int

2016-05-31 Thread Makarius
Dear integer experts, presently on Isabelle/c3896c385c3e and AFP/d9305abd02e9, I am trying to understand the situation of gcd / lcm for negative arguments. We have the following slightly divergent operations: * HOL gcd / lcm: always >= 0 (via "normalize" which is "abs") * PolyML.IntInf.gcd: