22
Enumerating finite structures Peter Jipsen Chapman Univ, Orange, CA February 5, 2008 Peter Jipsen (Chapman Univ, Orange, CA) Enumerating finite structures February 5, 2008 1 / 22

Enumerating finite structures - Chapman Universitymath.chapman.edu/.../JipsenSageDays7Feb2008slides.pdf · Semigroups, monoids, semilattices, lattices, semirings,... Online mathematical

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Enumerating finite structures - Chapman Universitymath.chapman.edu/.../JipsenSageDays7Feb2008slides.pdf · Semigroups, monoids, semilattices, lattices, semirings,... Online mathematical

Enumerating finite structures

Peter Jipsen

Chapman Univ, Orange, CA

February 5, 2008

Peter Jipsen (Chapman Univ, Orange, CA) Enumerating finite structures February 5, 2008 1 / 22

Page 2: Enumerating finite structures - Chapman Universitymath.chapman.edu/.../JipsenSageDays7Feb2008slides.pdf · Semigroups, monoids, semilattices, lattices, semirings,... Online mathematical

Outline

Background

Semigroups, monoids, semilattices, lattices, semirings,...

Online mathematical structures database

Other related packages

Basic algorithm

Constraint satisfaction

Graphs and binary relations; binary decision diagrams

Relation algebras and ternary relational structures

Theorem provers

Peter Jipsen (Chapman Univ, Orange, CA) Enumerating finite structures February 5, 2008 2 / 22

Page 3: Enumerating finite structures - Chapman Universitymath.chapman.edu/.../JipsenSageDays7Feb2008slides.pdf · Semigroups, monoids, semilattices, lattices, semirings,... Online mathematical

Background

Classical mathematics considers specific structures

e.g. Z, Q, R, C, and functions defined on cartesian products of these.

20th century mathematics emphasized the axiomatic approach (originallydeveloped in Greek geometry)

Category theory was developed as a framework for mathematics

Relates well to object-oriented software development

Peter Jipsen (Chapman Univ, Orange, CA) Enumerating finite structures February 5, 2008 3 / 22

Page 4: Enumerating finite structures - Chapman Universitymath.chapman.edu/.../JipsenSageDays7Feb2008slides.pdf · Semigroups, monoids, semilattices, lattices, semirings,... Online mathematical

Mathematical objects

Sage contains categories and many concrete mathematical objects

Databases and iterators produce streams of objects to test conjectures

Combinatorics mostly studies objects that have finite representations

Enumerative combinatorics aims to count objects of a given size

Classification theorems are used to categorize objects

Structure theorems describe the structure of objects in a given class

Peter Jipsen (Chapman Univ, Orange, CA) Enumerating finite structures February 5, 2008 4 / 22

Page 5: Enumerating finite structures - Chapman Universitymath.chapman.edu/.../JipsenSageDays7Feb2008slides.pdf · Semigroups, monoids, semilattices, lattices, semirings,... Online mathematical

First-order structures

Relational structures

Definition: A set with n-ary relations defined on it (of fixed arity).

E.g. sets, graphs, digraphs, trees, partially ordered sets, quasiordered sets,3-hypergraphs, ...

Algebraic structures = universal algebras

Definition: A set with n-ary operations defined on it (of fixed arity).

E.g. unary algebras, automata, semigroups, monoids, groups, quasigroups,loops, semilattices, lattices, boolean algebras, semirings, rings, modalalgebras, residuated lattices, Kleene algebras...

Peter Jipsen (Chapman Univ, Orange, CA) Enumerating finite structures February 5, 2008 5 / 22

Page 6: Enumerating finite structures - Chapman Universitymath.chapman.edu/.../JipsenSageDays7Feb2008slides.pdf · Semigroups, monoids, semilattices, lattices, semirings,... Online mathematical

Relational and algebraic structures

Ordered algebraic structures

E.g. partially ordered semigroups, po-monoids, po-groups, semilattices,lattices, boolean algebras, modal algebras, residuated lattices, ...

Multi-sorted structures

E.g. Vector spaces, modules, G-sets, categories, monads, datatypes, ...

Each of these classes has been studied extensively.

Peter Jipsen (Chapman Univ, Orange, CA) Enumerating finite structures February 5, 2008 6 / 22

Page 7: Enumerating finite structures - Chapman Universitymath.chapman.edu/.../JipsenSageDays7Feb2008slides.pdf · Semigroups, monoids, semilattices, lattices, semirings,... Online mathematical

Some online mathematical structures databases

Neil Sloane’s Online Encyclopedia of Integer Sequences

stores enumerative information about object, but not object themselves

GAP databases of groups (optional Sage package), GUAVA (codingtheory), SONATA (nearring library), LOOPS (includes library of loops)

John Halleck’s list of modal logic systems (no semantic objects) at

www.cc.utah.edu/∼nahaj/logic/structures/systems

Mathematical structures list of mostly algebraic classes (few objects) at

math.chapman.edu/cgi-bin/structures

Designs at designtheory.org/database/

Graph databases and many combinatorial objects are already in Sage

Peter Jipsen (Chapman Univ, Orange, CA) Enumerating finite structures February 5, 2008 7 / 22

Page 8: Enumerating finite structures - Chapman Universitymath.chapman.edu/.../JipsenSageDays7Feb2008slides.pdf · Semigroups, monoids, semilattices, lattices, semirings,... Online mathematical

Relational Structure Format

The Sage RelStructure Class

Finite (universal) algebras and relational structures in SAGE areimplemented as lists of operation tables and relations.

The base set for a relational structure of size n is 0,1,...,n-1.

Binary operations are n × n matrices with entries from [0..n − 1]

Binary relations are dictionaries with i : [..., j , ...] iff i ∼ j

Search routines

The file relstruct.py contains code to search for nonisomorphic groupoidsand binary relations

Searches are done in a simple-minded way by backtracking

Peter Jipsen (Chapman Univ, Orange, CA) Enumerating finite structures February 5, 2008 8 / 22

Page 9: Enumerating finite structures - Chapman Universitymath.chapman.edu/.../JipsenSageDays7Feb2008slides.pdf · Semigroups, monoids, semilattices, lattices, semirings,... Online mathematical

Search for small algebras

Find all nonisomorphic algebras of a given size

find_groupoids(3) # nonisomorphic binary operations

find_semigroups(5) # associative groupoids

find_commutative_semigroups(5)

find_bands(6) # idempotent semigroups

find_monoids(6) # semigroups with identity

find_commutative_monoids(7)

find_semilattices(7) # commutative bands

find_lattices(8) # semilattices with identity

find_algebras_test(True) # test all find_ methods and compare

# lengths of lists with sloane_find

Peter Jipsen (Chapman Univ, Orange, CA) Enumerating finite structures February 5, 2008 9 / 22

Page 10: Enumerating finite structures - Chapman Universitymath.chapman.edu/.../JipsenSageDays7Feb2008slides.pdf · Semigroups, monoids, semilattices, lattices, semirings,... Online mathematical

Search for small relational structures

Find all nonisomorphic binary relations of a given size.

find_binary_relations(5) # nonisomorphic binary relations

find_simple_digraphs(6) # binary relations without loops

find_simple_graphs(7) # symmetric relations without loops

find_relations_test(True)# test all find_methods and compare

# lengths of lists with sloane_find

Peter Jipsen (Chapman Univ, Orange, CA) Enumerating finite structures February 5, 2008 10 / 22

Page 11: Enumerating finite structures - Chapman Universitymath.chapman.edu/.../JipsenSageDays7Feb2008slides.pdf · Semigroups, monoids, semilattices, lattices, semirings,... Online mathematical

The search algorithm

A partial operation table is a matrix with entries from [−1, 0, .., n − 1]

−1 denotes an undefined entry

def complete_operation(m,i,j,associative=False,commutative=False):

"""

find next i,j where alg[i][j] = -1 = undefined

for each val in [0..n-1]

set alg[i][j] = val

check_associativity(m) [if associative=True]

check_permutations

if ok, complete_operation(m,i,j+1)

restore alg

"""

Peter Jipsen (Chapman Univ, Orange, CA) Enumerating finite structures February 5, 2008 11 / 22

Page 12: Enumerating finite structures - Chapman Universitymath.chapman.edu/.../JipsenSageDays7Feb2008slides.pdf · Semigroups, monoids, semilattices, lattices, semirings,... Online mathematical

The search algorithm

def check_associativity(m):

"""

Return False if the partial operation table m violates

associativity

Return True otherwise

"""

def check_permutations(m):

"""

Return False if every completion of some isomorphic

copy q(m) of m will be lexicographically smaller than

Return True otherwise

"""

Peter Jipsen (Chapman Univ, Orange, CA) Enumerating finite structures February 5, 2008 12 / 22

Page 13: Enumerating finite structures - Chapman Universitymath.chapman.edu/.../JipsenSageDays7Feb2008slides.pdf · Semigroups, monoids, semilattices, lattices, semirings,... Online mathematical

To do

Adapt N.I.C.E. code to find automorphism group of the partial algebra

Write the search routine as a Python generator

Create proper Sage objects from the output

E.g. the monoids should be objects in the Monoid category

Peter Jipsen (Chapman Univ, Orange, CA) Enumerating finite structures February 5, 2008 13 / 22

Page 14: Enumerating finite structures - Chapman Universitymath.chapman.edu/.../JipsenSageDays7Feb2008slides.pdf · Semigroups, monoids, semilattices, lattices, semirings,... Online mathematical

Discussion

The current approach is simple, lightweight

Reasonably fast for small structures

Easily adapted to other classes with more operations or relations

More general approach: Constraint satisfaction

More efficient for datastructure for graphs and binary relations: binary

decision diagrams

Examples needing ternary relational structures: relation algebras

On the syntactic side, would like to integrate logical reasoning andtheorem provers in Sage

Peter Jipsen (Chapman Univ, Orange, CA) Enumerating finite structures February 5, 2008 14 / 22

Page 15: Enumerating finite structures - Chapman Universitymath.chapman.edu/.../JipsenSageDays7Feb2008slides.pdf · Semigroups, monoids, semilattices, lattices, semirings,... Online mathematical

Residuated lattices

Definition

A residuated lattice is a system (L,∧,∨, ·, \, /, e) where

(L,∧,∨) is a lattice,

(L, ·, e) is a monoid,

\ and / are binary operations such that the residuation property holds:

x · y ≤ z iff y ≤ x\z iff x ≤ z/y

Galatos, J., Kowalski, Ono, (2007) “Residuated Lattices: An algebraicglimpse at substructural logics”, Studies in Logic, Elsevier, xxi+509 pp.

The symbol · is often omitted

Peter Jipsen (Chapman Univ, Orange, CA) Enumerating finite structures February 5, 2008 15 / 22

Page 16: Enumerating finite structures - Chapman Universitymath.chapman.edu/.../JipsenSageDays7Feb2008slides.pdf · Semigroups, monoids, semilattices, lattices, semirings,... Online mathematical

Properties of residuated lattices

Definition

A residuated lattice is:

commutative if it satisfies xy = yx

integral if it satisfies x ≤ e

divisible if x ≤ y implies x = y(y\x) = (x/y)y

representable if it is isomorphic to a subdirect product of totallyordered residuated lattices

bounded if it has a mimimum element, and there is an additionalconstant 0 which denotes this minimum

In a commutative residuated lattice the operations x\y and y/x coincide

Peter Jipsen (Chapman Univ, Orange, CA) Enumerating finite structures February 5, 2008 16 / 22

Page 17: Enumerating finite structures - Chapman Universitymath.chapman.edu/.../JipsenSageDays7Feb2008slides.pdf · Semigroups, monoids, semilattices, lattices, semirings,... Online mathematical

Subclasses of residuated lattices

Definition

A GBL-algebra is a divisible residuated lattice

A BL-algebra is a bounded commutative integral representableGBL-algebra

A GMV-algebra is a GBL-algebra satisfying x ≤ y impliesy = x/(y\x) = (x/y)\x

An MV-algebra is a bounded commutative GMV-algebra

A lattice ordered group or ℓ-group is (term-equivalent to) a residuatedlattice satisfying x(x\e) = e

Commutative GMV-algebas (and MV-algebras) are always representable

BL-algebras (Hajek ’98) give algebraic semantics of Basic (fuzzy) LogicPeter Jipsen (Chapman Univ, Orange, CA) Enumerating finite structures February 5, 2008 17 / 22

Page 18: Enumerating finite structures - Chapman Universitymath.chapman.edu/.../JipsenSageDays7Feb2008slides.pdf · Semigroups, monoids, semilattices, lattices, semirings,... Online mathematical

The first 50 integral relation algebras

11 12 22 13 23 33 17 27 37 47 57 67 77

137 237 337 437 537 637 737 837 937 1037 1137 1237 1337

1437 1537 1637 1737 1837 1937 2037 2137 2237 2337 2437 2537 2637

2737 2837 2937 3037 3137 3237 3337 3437 3537 3637 3737

Peter Jipsen (Chapman Univ, Orange, CA) Enumerating finite structures February 5, 2008 18 / 22

Page 19: Enumerating finite structures - Chapman Universitymath.chapman.edu/.../JipsenSageDays7Feb2008slides.pdf · Semigroups, monoids, semilattices, lattices, semirings,... Online mathematical

The 65 symmetric integral relation algebras of size 16

165 265 365 465 565 665 765 865 965 1065 1165 1265

1365 1465 1565 1665 1765 1865 1965 2065 2165 2265 2365 2465

2565 2665 2765 2865 2965 3065 3165 3265 3365 3465 3565 3665

3765 3865 3965 4065 4165 4265 4365 4465 4565 4665 4765 4865

4965 5065 5165 5265 5365 5465 5565 5665 5765 5865 5965 6065

6165 6265 6365 6465 6565

Peter Jipsen (Chapman Univ, Orange, CA) Enumerating finite structures February 5, 2008 19 / 22

Page 20: Enumerating finite structures - Chapman Universitymath.chapman.edu/.../JipsenSageDays7Feb2008slides.pdf · Semigroups, monoids, semilattices, lattices, semirings,... Online mathematical

A representation useful for constructing and counting finite GBL-algebras

For example, consider the following lattice structure of a GBL-algebra with17 elements that is obtained from a poset sum of a 2, 3, 4, and 5-elementWajsberg chain over the poset 2 × 2 (the join irreducible idempotents aredenoted by black dots)

2

3 4

5

By the previous theorem the same lattice supports 26 = 64 nonisomorphicGBL-algebras since six other join irreducibles could be idempotents

Peter Jipsen (Chapman Univ, Orange, CA) Enumerating finite structures February 5, 2008 20 / 22

Page 21: Enumerating finite structures - Chapman Universitymath.chapman.edu/.../JipsenSageDays7Feb2008slides.pdf · Semigroups, monoids, semilattices, lattices, semirings,... Online mathematical

Posets of join-irreducibles of distributive lattices of size n

with number of nonisomorphic GBL-algebras below each poset

1 2 3 n = 4 n = 5 n = 6

1 1 2 1 4 1 1 8 2 2 2 1 16

n = 7

1 2 2 4 4 2 2 32

Peter Jipsen (Chapman Univ, Orange, CA) Enumerating finite structures February 5, 2008 21 / 22

Page 22: Enumerating finite structures - Chapman Universitymath.chapman.edu/.../JipsenSageDays7Feb2008slides.pdf · Semigroups, monoids, semilattices, lattices, semirings,... Online mathematical

A finite GBL-algebra is subdirectly irreducible iff the poset ofjoin-irreducibles has a top element

It is representable (and hence expands to a finite BL-algebra) iff the posetof join-irreducibles is a forest.

Since subdirectly irreducible BL-algebras are chains, it follows that forn > 1 there are precisely 2n−2 nonisomorphic subdirectly irreduciblen-element BL-algebras.

Size n = 1 2 3 4 5 6 7

GBL-algebras 1 1 2 5 10 23 49si GBL-algebras 0 1 2 4 9 19 42BL-algebras 1 1 2 5 9 20 38si BL-algebras 0 1 2 4 8 16 32

Peter Jipsen (Chapman Univ, Orange, CA) Enumerating finite structures February 5, 2008 22 / 22