I haven't been able to prove the following, using Dafny: S(x) < S(y) ==> x < y for the datatype of unary numbers with constructors Z and S (here I am only using S).
I tried forms of induction and I can suspect the reason lies in the generality of the < relation, but still I am wondering whether there could be a way out.
The built-in
<operator on datatypes probably doesn't do what you want here. I would recommend defining your own notion of "less than" on your type. Then you should be able to use induction on it normally.See the reference manual for how the built-in
<operator is defined for datatypes: