In[]:=
Nest[s,k,3]
Out[]=
s[s[s[k]]]
f[s[s[s[s[s[k]]]]]][s[s[s[k]]]]
In[]:=
EnumerateCombinators[3]
Out[]=
{s[s][s],s[s[s]],s[s][k],s[s[k]],s[k][s],s[k[s]],s[k][k],s[k[k]],k[s][s],k[s[s]],k[s][k],k[s[k]],k[k][s],k[k[s]],k[k][k],k[k[k]]}
In[]:=
testPlus[f_]:=Catch[Table[If[CombinatorFixedPoint[f[Nest[s,k,i]][Nest[s,k,j]],"MaxSize"200,"MaxSteps"100]=!=Nest[s,k,i+j],Throw[False]],{i,5},{j,5}];True]
In[]:=
testPlus[s[s[s]]]
Out[]=
False
In[]:=
testPlus/@EnumerateCombinators[3]
Out[]=
{False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False}
In[]:=
ResourceFunction["ParallelMapMonitored"][testPlus,EnumerateCombinators[4]]
Out[]=
{False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False}
In[]:=
With[{n=5},Pick[EnumerateCombinators[n],ResourceFunction["ParallelMapMonitored"][testPlus,EnumerateCombinators[n]]]]
Out[]=
{}
In[]:=
With[{n=6},Pick[EnumerateCombinators[n],ResourceFunction["ParallelMapMonitored"][testPlus,EnumerateCombinators[n]]]]
Out[]=
{}
In[]:=
With[{n=7},Pick[EnumerateCombinators[n],ResourceFunction["ParallelMapMonitored"][testPlus,EnumerateCombinators[n]]]]
Out[]=
{}
In[]:=
With[{n=8},Pick[EnumerateCombinators[n],ResourceFunction["ParallelMapMonitored"][testPlus,EnumerateCombinators[n]]]]
Out[]=
{}
In[]:=
testPlusX[f_]:=Catch[Table[If[CombinatorFixedPoint[f[Nest[s,k,i]][Nest[s,k,j]],"MaxSize"200,"MaxSteps"100]=!=Nest[s,k,i+j],Throw[{i,j}]],{i,5},{j,5}];True]
In[]:=
testPlusX/@EnumerateCombinators[4]
Out[]=
{{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{2,1},{1,1},{1,1},{1,1},{2,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,2},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{2,1},{2,1},{2,1},{1,1},{1,1},{1,1},{2,1},{2,1},{1,1},{1,1},{2,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1}}
In[]:=
TakeLargestBy[testPlusX/@EnumerateCombinators[6],Max,5]
Out[]=
{{2,1},{2,1},{2,1},{2,1},{2,1}}
In[]:=
inc=s[s[k[s]][k]]
Out[]=
s[s[k[s]][k]]
In[]:=
Nest[inc,s[k],5]
Out[]=
s[s[k[s]][k]][s[s[k[s]][k]][s[s[k[s]][k]][s[s[k[s]][k]][s[s[k[s]][k]][s[k]]]]]]
In[]:=
CombinatorFixedPoint[%]
Out[]=
s[s[k[s]][k]][s[s[k[s]][k]][s[s[k[s]][k]][s[s[k[s]][k]][s[s[k[s]][k]][s[k]]]]]]
In[]:=
plus=s[k[s]][s[k[s[k[s]]]][s[k[k]]]]
Out[]=
s[k[s]][s[k[s[k[s]]]][s[k[k]]]]
In[]:=
LeafCount[plus]
Out[]=
11
In[]:=
testGeneral[f_,ints_,op_]:=Catch[Table[If[CombinatorFixedPoint[f[ints[i]][ints[j]],"MaxSize"200,"MaxSteps"100]=!=ints[op[i,j]],Throw[False]],{i,5},{j,5}];True]
In[]:=
With[{n=4},Pick[EnumerateCombinators[n],ResourceFunction["ParallelMapMonitored"][testGeneral[#,Nest[s,s,#]&,Plus]&,EnumerateCombinators[n]]]]
Out[]=
{}
In[]:=
Table[Echo@Pick[EnumerateCombinators[n],ResourceFunction["ParallelMapMonitored"][testGeneral[#,Nest[s,s,#]&,Plus]&,EnumerateCombinators[n]]],{n,11}]
»
{}
»
{}
»
{}
»
{}
»
{}
»
{}
»
{}
»
{}
Out[]=
$Aborted
In[]:=
Table[Echo@Pick[EnumerateCombinators[n],ResourceFunction["ParallelMapMonitored"][testGeneral[#,Nest[k,k,#]&,Plus]&,EnumerateCombinators[n]]],{n,9}]
»
{}
»
{}
»
{}
»
{}
»
{}
»
{}
»
{}
»
{}
Out[]=
$Aborted
In[]:=
EnumerateCombinators[2]
Out[]=
{s[s],s[k],k[s],k[k]}
In[]:=
Nest[s[k],s[k],4]
Out[]=
s[k][s[k][s[k][s[k][s[k]]]]]
In[]:=
CombinatorFixedPoint[%]
Out[]=
s[k][s[k][s[k][s[k][s[k]]]]]
In[]:=
Clear[inc]
In[]:=
Function[inc,Table[Echo@Pick[EnumerateCombinators[n],ResourceFunction["ParallelMapMonitored"][testGeneral[#,Nest[inc,k,#]&,Plus]&,EnumerateCombinators[n]]],{n,7}]]/@EnumerateCombinators[2]
»
{}