Function Repository Resource:

# UpToBinaryCompositions

List all possible unary and binary combinations for a chosen set of functions and symbols

 ResourceFunction["UpToBinaryCompositions"][leafn,sym,unaries,binaries] returns all possible compositions of symbols listed in sym by unary and binary functions listed in unaries and binaries, whose proper leaf count (terminal nodes only) equals leafn.

## Details

Arguments unaries and binaries are lists, which should contain unary and binary functions, respectively.
Exactly one unary function from unaries is applied around each leaf and around each branch point, including the root, so unaries must usually contain Identity.
Binary functions are applied similarly to Groupings, but to all possible orderings of atomistic symbols listed in sym.

## Examples

### Basic Examples (1)

Mimic the functionality of the resource function BinaryCompositions:

 In[1]:=
 Out[1]=

### Properties and Relations (2)

Compare UpToBinaryCompositions with Groupings by treating outputs as sets (A and B respectively):

 In[2]:=
 Out[2]=

Test the Catalan counting property:

 In[3]:=
 Out[3]=
 In[4]:=
 Out[4]=

### Possible Issues (1)

Without specifying at least one unary operator, no combinations are possible:

 In[5]:=
 Out[5]=

### Neat Examples (2)

Count Boolean tautologies out of a finite set of compositions:

 In[6]:=
 Out[6]=

Generate a complicated polynomial data structure:

 In[7]:=

Count degeneracies and put them in a table:

 In[8]:=
 Out[8]=

Compare row lengths with OEIS core sequence A002572:

 In[9]:=
 Out[9]=

Compare last term of each row with relatively new OEIS sequence A345135:

 In[10]:=
 Out[10]=

Compare row weights with OEIS core sequence A000984:

 In[11]:=
 Out[11]=

Explore the effects of perturbing the unary function away from identity:

 In[12]:=
 Out[12]=

Test a possible identity relating row weights:

 In[13]:=
 Out[13]=