Measurable subspaces and subalgebras