Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Test whether evolution of an S combinator expression will halt
ResourceFunction["SCombinatorHaltsQ"][cmb] check whether the S combinator expression cmb will terminate. |
"SGlyph" | CombinatorS | symbol used to represent the S combinator in cmb |
Demonstrate that an combinator expression halts:
In[1]:= | ![]() |
Out[1]= | ![]() |
This corresponds to the fact that its evolution reaches a fixed point after one step:
In[2]:= | ![]() |
Out[2]= | ![]() |
Define an combinator expression with a leaf count that increases with each step:
In[3]:= | ![]() |
Out[4]= | ![]() |
Thus its evolution does not terminate:
In[5]:= | ![]() |
Out[5]= | ![]() |
Define symbols other than the default CombinatorS glyph to represent the combinator:
In[6]:= | ![]() |
Out[6]= | ![]() |
In[7]:= | ![]() |
Out[7]= | ![]() |
SCombinatorHaltsQ throws a failure when the input does not use the specified "SGlyph":
In[8]:= | ![]() |
Out[8]= | ![]() |
The input expression should exclusively use the combinator:
In[9]:= | ![]() |
Out[9]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License