# starts by taking the usual Tribonnacci Rauzy fractal
from badic import *
m0 = DumontThomas(WordMorphism('a->ab,b->ac,c->a')).mirror()
m0
# define a subset of the beta-adic set of the previous Rauzy fractal, where we take half of the points
m = BetaAdicSet(x^3-x^2-x-1, DetAutomaton([(0,0,0),(0,1,1),(1,1,0),(1,2,1),(2,2,0),(2,1,1)], i=0, final_states=[0,1]))
m.plot()
# the automaton of this beta-adic set
m.a.plot()
# if we plot the beta-adic set m on the beta-adic set m0,
# we see that not all points are in m (the red is a little bit gray)
m0.plot_list([m])
# we can compute a substitution describing the beta-adic set m
d, la = m.substitution(get_aut=True)
d
# list of automata describing the pieces of the Rauzy fractal
la
m0.plot_list([a for a,t in la])
# plot the Rauzy fractal
s = WordMorphism(d)
print(s)
s.rauzy_fractal_plot()
# We can see that translated copies of the Rauzy fractal that naturally
# tiles the plane have a non-trivial intersection.
# Hence, this substitution does not satisfy the Pisot conjecture (but is not irreducible)
s.rauzy_fractal_plot(translate=[(0,0,0),(1,0,0)])
s.is_primitive()
# we can remove the unusefull letter 2, but it will not change a lot of thing
# (it removes only one point from the beta-adic set)
s = WordMorphism('a->e,b->ca,c->cda,d->ba,e->c')
s
s.rauzy_fractal_plot()
s.is_primitive()
s.rauzy_fractal_plot(translate=[(0,0,0),(1,0,0)])