Definitions
Definitions
[A bit like macros]
[A bit like macros]
In[]:=
gg=ResourceFunction["MultiwaySystem"][{"A""AB","BB""A"},{"A"},7,"StatesGraph"]
Out[]=
In[]:=
DefReplace[s_,lhs_]:=If[!StringContainsQ[s,lhs],s,Row[Characters[StringReplace[s,lhs"X"]]/."X"->Style["X",13,Orange]]]
In[]:=
VertexReplace[gg,(#DefReplace[#,"BBB"])&/@VertexList[gg]]
Out[]=
In[]:=
With[{g=ResourceFunction["MultiwaySystem"][{"A""AB","BB""A"},{"A"},8,"StatesGraph"]},VertexReplace[g,(#DefReplace[#,"BBB"])&/@VertexList[g]]]
Out[]=
How much are actually strings shortened by definitions?
How much are actually strings shortened by definitions?
Simple hierarchy dictionary compression can be useful....
What compression can be achieved by looking for common substrings?
What compression can be achieved by looking for common substrings?
Does one only going looking for theorems in terms of the definitions?
Does one only going looking for theorems in terms of the definitions?
Frequent Substrings
Frequent Substrings
Like defining words...
Like defining words...
In[]:=
ResourceFunction["MultiwaySystem"][{"A""AB","BB""A"},{"A"},7]
Out[]=
{{A},{AB},{ABB},{AA,ABBB},{AAB,ABA,ABBBB},{AABB,ABAB,ABBA,ABBBBB},{AAA,AABBB,ABABB,ABBAB,ABBBA,ABBBBBB},{AAAB,AABA,AABBBB,ABAA,ABABBB,ABBABB,ABBBAB,ABBBBA,ABBBBBBB}}
In[]:=
Merge[{<|"A"0,"B"0|>,#},Apply[Plus]]&/@(LetterCounts[#,1,{"A","B"}]&/@Flatten[ResourceFunction["MultiwaySystem"][{"A""AB","BB""A"},{"A"},7]])
Out[]=
{A1,B0,A1,B1,A1,B2,A2,B0,A1,B3,A2,B1,A2,B1,A1,B4,A2,B2,A2,B2,A2,B2,A1,B5,A3,B0,A2,B3,A2,B3,A2,B3,A2,B3,A1,B6,A3,B1,A3,B1,A2,B4,A3,B1,A2,B4,A2,B4,A2,B4,A2,B4,A1,B7}
In[]:=
Transpose[%]
Out[]=
Transpose[{A1,B0,A1,B1,A1,B2,A2,B0,A1,B3,A2,B1,A2,B1,A1,B4,A2,B2,A2,B2,A2,B2,A1,B5,A3,B0,A2,B3,A2,B3,A2,B3,A2,B3,A1,B6,A3,B1,A3,B1,A2,B4,A3,B1,A2,B4,A2,B4,A2,B4,A2,B4,A1,B7}]