Under what conditions each of the matrices generated by a finite set of matrices unique? I have a set of matrices $A_1,\ldots,A_n \in \mathbb{R}^{d \times d}$.
Let $a$ be a sequence of length $l$ of integers between $1$ and $n$.
Define $B_a = \prod_{i=1}^l A_{a_i}$. Now let $$\mathcal{A} = \{ B_a | a \textit{ is a sequenece as above} \}$$.
Can someone give me a few examples of conditions under which any $B \in \mathcal{A}$ uniquely identifies the sequence of integers $a$ such that $B = B_a$?
(or give me a reference to something that could shed light on this. this is probably related to viewing matrices as a group, but I don't know enough to know what to look for.)

Let $\Phi=\Phi_n$ denote the free semigroup on $n$ letters $a_1,..,a_n$. In other words, the elements of $\Phi$ are sequences $a_{i_1}a_{i_2}...a_{i_k}$, where $k$ is an arbitrary natural number and 
$$
a_{i_j}\in {\mathcal S}=\{a_1,...,a_n\}. 
$$
The empty word is the neutral element of the semigroup. The multiplication operation in $\Phi$ is just the concatenation of two sequences. If $G$ is another semigroup (e.g., the semigroup of $d\times d$ matrices) then defining a homomorphism 
$$
h: \Phi\to G
$$
amounts to choosing elements $A_i:=h_0(a_i)\in G, i=1,...,n$. This map $h_0: {\mathcal S}\to G$ extends uniquely to a homomorphism $h$ of semigroups. 
You are asking for maps $h_0$ such that the homomorphism $h$ is one-to-one (this is what it means that the value of product of matrices $A_i$ determines uniquely the sequence in which they are multiplied). 
How does one construct injective semigroup homomorphisms $\Phi_n\to End(R^d)$? For instance, we can use injective homomorphisms of the free group $F_n$ (on $n$ generators) to the group $GL(d, R)$. Examples of such injective homomorphisms abound once $d\ge 2$. For instance, you can take $n=2$ and 
$$
A_1=\left[\begin{array}{cc}
1&2\\
0&1
\end{array}
\right], \quad A_2=\left[\begin{array}{cc}
1&0\\
2&1
\end{array}
\right]. 
$$
Look for instance at this question and this one. Also, take a look at this book. 
