implement Program#toPsitive (K//S in Definition 2.8)