What is the name of this generalization of idempotence?
Asked Answered
S

1

13

Lots of commonly useful properties of functions have concise names. For example, associativity, commutativity, transitivity, etc.

I am making a library for use with QuickCheck that provides shorthand definitions of these properties and others.

The one I have a question about is idempotence of unary functions. A function f is idempotent iif ∀x . f x == f (f x).

There is an interesting generalization of this property for which I am struggling to find a similarly concise name. To avoid biasing peoples name choices by suggesting one, I'll name it P and provide the following definition:

A function f has the P property with respect to g iif ∀x . f x == f (g x). We can see this as a generalization of idempotence by redefining idempotence in terms of P. A function f is idempotent iif it has the P property with respect to itself.

To see that this is a useful property observe that it justifies a rewrite rule that can be used to implement a number of common optimizations. This often but not always arises when g is some sort of canonicalization function. Some examples:

  • length is P with respect to map f (for all choices of f)
  • Converting to CNF is P with respect to converting to DNF (and vice versa)
  • Unicode normalization to form NFC is P with respect to normalization to form NFD (and vice versa)
  • minimum is P with respect to nub

What would you name this property?

Swinson answered 1/12, 2011 at 17:52 Comment(0)
V
14

One can say that map f is length-preserving, or that length is invariant under map fing. So how about:

  • g is f-preserving.
  • f is invariant under (applying) g.
Vesture answered 1/12, 2011 at 18:0 Comment(2)
Also, if f is invariant under a set of operations g, then we can say that is symmetric under g.Cervix
I know that property as g-invariant.Idiomatic

© 2022 - 2024 — McMap. All rights reserved.