In[]:=
SKOuterEvolveList[s[s][k][s[s[s]][s]][s],8]
Out[]=
{s[s][k][s[s[s]][s]][s],s[s[s[s]][s]][k[s[s[s]][s]]][s],s[s[s]][s][s][k[s[s[s]][s]][s]],s[s][s][s[s]][k[s[s[s]][s]][s]],s[s[s]][s[s[s]]][k[s[s[s]][s]][s]],s[s][k[s[s[s]][s]][s]][s[s[s]][k[s[s[s]][s]][s]]],s[s[s[s]][k[s[s[s]][s]][s]]][k[s[s[s]][s]][s][s[s[s]][k[s[s[s]][s]][s]]]],s[s[s[s]][s[s[s]][s]]][k[s[s[s]][s]][s][s[s[s]][k[s[s[s]][s]][s]]]],s[s[s[s]][s[s[s]][s]]][s[s[s]][s][s[s[s]][k[s[s[s]][s]][s]]]]}
In[]:=
SKStep[expr_]:=MapAt[Replace[{s[x_][y_][z_]x[z][y[z]],k[x_][y_]x}],expr,{First[SortBy[Position[expr,s[_][_][_]|k[_][_],{0,Infinity},HeadsTrue],Length],{}]}]
In[]:=
SKStep[s[s][k][s[s[s]][s]][s]]
Out[]=
s[s[s[s]][s]][k[s[s[s]][s]]][s]
In[]:=
CombinatorTree[%]
Out[]=
In[]:=
CombinatorTree/@NestList[SKStep,s[s][k][s[s[s]][s]][s],5]
Out[]=
,
,
,
,
,
Does S create two copies of the z subtrees, or is it the same subtree? Should be the same subtree (otherwise one gets a dependency explosion...)
Does S create two copies of the z subtrees, or is it the same subtree? Should be the same subtree (otherwise one gets a dependency explosion...)
In[]:=
MapAt[Framed,#,Position[#,s[_][_][_]|k[_][_]]]&/@NestList[SKStep,s[s][k][s[s[s]][s]][s],5]
Out[]=
[s],,,,,
In[]:=
SKBox[s[x_][y_][z_]]:=Grid[{{s,x,y,z}},FrameAll,Background{{Red,Lighter[Red,.8],Lighter[Red,.8],Lighter[Red,.8]}}]
In[]:=
SKBox[k[x_][y_]]:=Grid[{{k,x,y}},FrameAll,Background{{Blue,Lighter[Blue,.8],Lighter[Blue,.8]}}]
In[]:=
MapAt[SKBox,#,Position[#,s[_][_][_]|k[_][_]]]&/@NestList[SKStep,s[s][k][s[s[s]][s]][s],5]//Column
Out[]=
| ||||||||||
| ||||||||||
| ||||||||||
| ||||||||||
| ||||||||||
|
In[]:=
MapAt[SKBox,#,Position[#,s[_][_][_]|k[_][_]]]&/@NestList[SKStep,s[s][k][s[s[s]][s]][s],8]//Column
Out[]=
| |||||||||||||
| |||||||||||||
| |||||||||||||
| |||||||||||||
| |||||||||||||
| |||||||||||||
ss[s[s]]
| |||||||||||||
ss[s[s]]
| |||||||||||||
ss[s[s]]
|
This should be more correct..........
In[]:=
MapAt[SKBox,#,ReverseSortBy[Position[#,s[_][_][_]|k[_][_]],Length]]&/@NestList[SKStep,s[s][k][s[s[s]][s]][s],8]//Column
Out[]=
| |||||||||||||
| |||||||||||||
| |||||||||||||
| |||||||||||||
| |||||||||||||
| |||||||||||||
ss[s[s]]
| |||||||||||||
ss[s[s]]
| |||||||||||||
ss[s[s]]
|
The following is wrong......
In[]:=
Module[{i=0},MapAt[If[i++0,Framed[SKBox[#],BackgroundOrange],SKBox[#]]&,#,SortBy[Position[#,s[_][_][_]|k[_][_]],Length]]]&/@NestList[SKStep,s[s][k][s[s[s]][s]][s],8]//Column
Out[]=
| ||||||||||
| ||||||||||
| ||||||||||
| ||||||||||
ss[s[s]]
| ||||||||||
ss[s[s]]
| ||||||||||
ss[s[s]]
|
In[]:=
Module[{i=0},MapAt[(Echo[#];If[i++0,Framed[SKBox[#],BackgroundOrange],SKBox[#]])&,#,Echo@SortBy[Position[#,s[_][_][_]|k[_][_]],Length]]]&/@NestList[SKStep,s[s][k][s[s[s]][s]][s],8]//Column
»
{{0}}
»
s[s][k][s[s[s]][s]]
»
{{}}
»
s[s[s[s]][s]][k[s[s[s]][s]]][s]
»
{{0},{1}}
»
s[s[s]][s][s]
»
k[s[s[s]][s]][s]
»
{{0},{1}}
»
s[s][s][s[s]]
»
k[s[s[s]][s]][s]
»
{{},{1}}
Here you can copy subtrees; unlike in hypergraphs.....
Here you can copy subtrees; unlike in hypergraphs.....