Correctness proof for the WAM with types