Duality And Finality For Deterministic And Probabilistic Automata