Observability and diagnosability of finite state systems: A unifying framework