```

def distance(x, y) :
"""calculates the distance between two points"""
"""{ pre  x != y
post d > 0
return d
}"""
#PREMISES FOR NEXT LINE:
# (x != y)
if  x > y :
#PREMISES FOR THEN-ARM:
# (x > y)
# (x != y)
d = x - y
#PREMISES FOR ATTACHED PROOF, IF ANY:
# (d == (x - y))
# (x > y)
# (x != y)
"""{ 1.OK x > y      premise
2.OK d == x - y  premise
3.OK d > 0      algebra 1 2
}"""
#PREMISES FOR NEXT LINE:
# (d > 0)
else :
#PREMISES FOR ELSE-ARM:
# not (x > y)
# (x != y)
d = y - x
#PREMISES FOR ATTACHED PROOF, IF ANY:
# (d == (y - x))
# not (x > y)
# (x != y)
"""{ 1.OK not(x > y)      premise
2.OK d == y - x      premise
3.OK x != y          premise   # from the precondition!
4.OK d > 0           algebra 1 2 3
}"""
#PREMISES FOR NEXT LINE:
# (d > 0)
#PREMISES FOR NEXT LINE:
# (d > 0)
# (x != y)
# IF ends here
"""{ 1.OK  d > 0     premise   }"""
#PREMISES FOR NEXT LINE:
# (d > 0)
# POSTCONDITION AND ALL GLOBAL INVARIANTS VERIFIED AT POINT OF RETURN
return d
#PREMISES FOR NEXT LINE:
# (d > 0)
# POSTCONDITION AND ALL GLOBAL INVARIANTS VERIFIED AT END OF FUNCTION
#PREMISES FOR NEXT LINE:

# We can call the function as needed:
"""{ 1.OK  3 != 5    algebra   }"""
#PREMISES FOR NEXT LINE:
# (3 != 5)
a = distance(3, 5)
#PREMISES FOR ATTACHED PROOF, IF ANY:
# (a > 0)
# (3 != 5)
"""{ 1.OK  a > 0     premise  }"""
#PREMISES FOR NEXT LINE:
# (a > 0)
```