change stackshift def to use nested ifs

proofs not updated