*****************************************************************************
*       www.FindStat.org - The Combinatorial Statistic Finder               *
*                                                                           *
*       Copyright (C) 2019 The FindStatCrew <info@findstat.org>             *
*                                                                           *
*    This information is distributed in the hope that it will be useful,    *
*    but WITHOUT ANY WARRANTY; without even the implied warranty of         *
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                   *
*****************************************************************************

-----------------------------------------------------------------------------
Statistic identifier: St000635

-----------------------------------------------------------------------------
Collection: Posets

-----------------------------------------------------------------------------
Description: The number of strictly order preserving maps of a poset into itself.

A map $f$ is strictly order preserving if $a < b$ implies $f(a) < f(b)$.

-----------------------------------------------------------------------------
References: [1]   Alexandersson, P. Whether a total order set of size $n$ has the fewest endomorphisms among posets of size $n$ [[MathOverflow:252913]]

-----------------------------------------------------------------------------
Code:
def is_strictly_order_preserving(f, P):
    return all([f(a),f(b)] in P.cover_relations() for (a, b) in P.cover_relations())

def statistic(P):
    P = P.relabel()
    r = P.cardinality()
    S = cartesian_product([range(r)]*r)
    return len([pi for pi in S if is_strictly_order_preserving(lambda i: pi[i], P)])
 

-----------------------------------------------------------------------------
Statistic values:

([],2)                                    => 4
([(0,1)],2)                               => 1
([],3)                                    => 27
([(1,2)],3)                               => 3
([(0,1),(0,2)],3)                         => 4
([(0,2),(2,1)],3)                         => 1
([(0,2),(1,2)],3)                         => 4
([],4)                                    => 256
([(2,3)],4)                               => 16
([(1,2),(1,3)],4)                         => 16
([(0,1),(0,2),(0,3)],4)                   => 27
([(0,2),(0,3),(3,1)],4)                   => 2
([(0,1),(0,2),(1,3),(2,3)],4)             => 4
([(1,2),(2,3)],4)                         => 4
([(0,3),(3,1),(3,2)],4)                   => 4
([(1,3),(2,3)],4)                         => 16
([(0,3),(1,3),(3,2)],4)                   => 4
([(0,3),(1,3),(2,3)],4)                   => 27
([(0,3),(1,2)],4)                         => 4
([(0,3),(1,2),(1,3)],4)                   => 8
([(0,2),(0,3),(1,2),(1,3)],4)             => 16
([(0,3),(2,1),(3,2)],4)                   => 1
([(0,3),(1,2),(2,3)],4)                   => 2
([],5)                                    => 3125
([(3,4)],5)                               => 125
([(2,3),(2,4)],5)                         => 100
([(1,2),(1,3),(1,4)],5)                   => 135
([(0,1),(0,2),(0,3),(0,4)],5)             => 256
([(0,2),(0,3),(0,4),(4,1)],5)             => 9
([(0,1),(0,2),(0,3),(2,4),(3,4)],5)       => 12
([(0,1),(0,2),(0,3),(1,4),(2,4),(3,4)],5) => 27
([(1,3),(1,4),(4,2)],5)                   => 10
([(0,3),(0,4),(4,1),(4,2)],5)             => 8
([(1,2),(1,3),(2,4),(3,4)],5)             => 20
([(0,2),(0,3),(2,4),(3,4),(4,1)],5)       => 4
([(0,3),(0,4),(3,2),(4,1)],5)             => 4
([(0,2),(0,3),(2,4),(3,1),(3,4)],5)       => 8
([(0,1),(0,2),(1,3),(1,4),(2,3),(2,4)],5) => 16
([(2,3),(3,4)],5)                         => 25
([(1,4),(4,2),(4,3)],5)                   => 20
([(0,4),(4,1),(4,2),(4,3)],5)             => 27
([(2,4),(3,4)],5)                         => 100
([(1,4),(2,4),(4,3)],5)                   => 20
([(0,4),(1,4),(4,2),(4,3)],5)             => 16
([(1,4),(2,4),(3,4)],5)                   => 135
([(0,4),(1,4),(2,4),(4,3)],5)             => 27
([(0,4),(1,4),(2,4),(3,4)],5)             => 256
([(0,4),(1,4),(2,3)],5)                   => 15
([(0,4),(1,3),(2,3),(2,4)],5)             => 24
([(0,4),(1,3),(1,4),(2,3),(2,4)],5)       => 55
([(0,3),(0,4),(1,3),(1,4),(2,3),(2,4)],5) => 108
([(0,4),(1,4),(2,3),(4,2)],5)             => 4
([(0,4),(1,3),(2,3),(3,4)],5)             => 8
([(0,4),(1,4),(2,3),(2,4)],5)             => 38
([(0,4),(1,4),(2,3),(3,4)],5)             => 9
([(1,4),(2,3)],5)                         => 20
([(1,4),(2,3),(2,4)],5)                   => 40
([(0,4),(1,2),(1,4),(2,3)],5)             => 3
([(0,3),(1,2),(1,3),(2,4),(3,4)],5)       => 8
([(1,3),(1,4),(2,3),(2,4)],5)             => 80
([(0,3),(0,4),(1,3),(1,4),(4,2)],5)       => 8
([(0,3),(0,4),(1,3),(1,4),(3,2),(4,2)],5) => 16
([(0,4),(1,2),(1,4),(4,3)],5)             => 6
([(0,4),(1,2),(1,3)],5)                   => 15
([(0,4),(1,2),(1,3),(1,4)],5)             => 38
([(0,2),(0,4),(3,1),(4,3)],5)             => 2
([(0,4),(1,2),(1,3),(3,4)],5)             => 4
([(0,2),(0,3),(1,4),(2,4),(3,1)],5)       => 1
([(0,4),(1,2),(1,3),(2,4),(3,4)],5)       => 12
([(0,3),(0,4),(1,2),(1,4)],5)             => 24
([(0,3),(0,4),(1,2),(1,3),(1,4)],5)       => 55
([(0,2),(0,3),(0,4),(1,2),(1,3),(1,4)],5) => 108
([(0,3),(0,4),(1,2),(1,3),(2,4)],5)       => 1
([(0,3),(1,2),(1,4),(3,4)],5)             => 3
([(0,3),(0,4),(1,2),(2,3),(2,4)],5)       => 8
([(1,4),(3,2),(4,3)],5)                   => 5
([(0,3),(3,4),(4,1),(4,2)],5)             => 4
([(1,4),(2,3),(3,4)],5)                   => 10
([(0,4),(1,2),(2,4),(4,3)],5)             => 2
([(0,3),(1,4),(4,2)],5)                   => 3
([(0,4),(3,2),(4,1),(4,3)],5)             => 2
([(0,4),(1,2),(2,3),(2,4)],5)             => 6
([(0,4),(2,3),(3,1),(4,2)],5)             => 1
([(0,3),(1,2),(2,4),(3,4)],5)             => 4
([(0,4),(1,2),(2,3),(3,4)],5)             => 2
([(0,3),(1,4),(2,4),(3,1),(3,2)],5)       => 4

-----------------------------------------------------------------------------
Created: Oct 25, 2016 at 12:01 by Martin Rubey

-----------------------------------------------------------------------------
Last Updated: Nov 13, 2022 at 11:37 by Martin Rubey