substring theorems