Is there a name for this property: x + x - x == x Classic List Threaded 8 messages Open this post in threaded view
|

Is there a name for this property: x + x - x == x

 It's not quite idempotence, because more than one function is involved.It's a common property and I figure I can write a higher order function to build QuickCheck tests for it.  I was just wondering if it has a name. _______________________________________________ Haskell-Cafe mailing list [hidden email] http://www.haskell.org/mailman/listinfo/haskell-cafe
Open this post in threaded view
|

Re: Is there a name for this property: x + x - x == x

 If you have associativity, this seems roughly the same as saying there is an additive inverse for every x, because x + x - x = x => x + (x - x) = x => x + 0 = x. On Wed, Jun 4, 2014 at 7:34 AM, Omari Norman <[hidden email]> wrote: > It's not quite idempotence, because more than one function is involved. > > It's a common property and I figure I can write a higher order function to > build QuickCheck tests for it.  I was just wondering if it has a name. > > _______________________________________________ > Haskell-Cafe mailing list > [hidden email] > http://www.haskell.org/mailman/listinfo/haskell-cafe> _______________________________________________ Haskell-Cafe mailing list [hidden email] http://www.haskell.org/mailman/listinfo/haskell-cafe
Open this post in threaded view
|

Re: Is there a name for this property: x + x - x == x

 In reply to this post by Omari Norman-2 On 06/04/2014 06:34 PM, Omari Norman wrote: > It's not quite idempotence, because more than one function is involved. > > It's a common property and I figure I can write a higher order > function to build QuickCheck tests for it.  I was just wondering if it > has a name. Hello Omari, I guess it's a corollary of two group axioms. There exists an identity element e such what for any a  a + e == e + a == a. And for any element a inverse element -a exists, such that a + (-a) == e. Take a look at http://en.wikipedia.org/wiki/Group_%28mathematics%29Why not compose a name out of these two? :) _______________________________________________ Haskell-Cafe mailing list [hidden email] http://www.haskell.org/mailman/listinfo/haskell-cafe
Open this post in threaded view
|

Re: Is there a name for this property: x + x - x == x

Open this post in threaded view
|

Re: Is there a name for this property: x + x - x == x

 In reply to this post by David Thomas Is there a more general name for it?  Here's what I'm thinking of.  I would think there's a name for it rather than "inversion", which I made up.module Builders where import Test.QuickCheck-- | Takes a single value, x.  Applies a function to that value,-- and then applies a second function to the result of the-- application of the first function.  Passes if the result of the -- second function equals the original value.inversion  :: (Eq a, Show a)  => (a -> b)  -- ^ Apply this function to the original value  -> (b -> a)   -- ^ Apply this function to the result of the first function  -> a  -> Propertyinversion f1 f2 a = f2 (f1 a) === a On Wed, Jun 4, 2014 at 10:42 AM, David Thomas wrote: If you have associativity, this seems roughly the same as saying there is an additive inverse for every x, because x + x - x = x => x + (x - x) = x => x + 0 = x. On Wed, Jun 4, 2014 at 7:34 AM, Omari Norman <[hidden email]> wrote: > It's not quite idempotence, because more than one function is involved. > > It's a common property and I figure I can write a higher order function to > build QuickCheck tests for it.  I was just wondering if it has a name. > > _______________________________________________ > Haskell-Cafe mailing list > [hidden email] > http://www.haskell.org/mailman/listinfo/haskell-cafe > _______________________________________________ Haskell-Cafe mailing list [hidden email] http://www.haskell.org/mailman/listinfo/haskell-cafe
Open this post in threaded view
|

Re: Is there a name for this property: x + x - x == x

 In reply to this post by Omari Norman-2 * Omari Norman <[hidden email]> [2014-06-04 10:34:22-0400] > It's not quite idempotence, because more than one function is involved. > > It's a common property and I figure I can write a higher order function to > build QuickCheck tests for it.  I was just wondering if it has a name. This is similar to the inverse semigroup definition (but note the different order of the operands). https://en.wikipedia.org/wiki/Inverse_semigroupRoman _______________________________________________ Haskell-Cafe mailing list [hidden email] http://www.haskell.org/mailman/listinfo/haskell-cafe signature.asc (836 bytes) Download Attachment