```

# Note: if you state sensible pre- and post-conditions, and if the
# function's body is "simple enough", then the checker will validate the
# function unassisted.
def absValue(x) :
"""{ pre  x != 0
post ans > 0 and (ans == x or ans == 0 - x)
return ans
}"""
#PREMISES FOR NEXT LINE:
# (x != 0)
if x < 0 :
#PREMISES FOR THEN-ARM:
# (x < 0)
# (x != 0)
ans = 0 - x
#PREMISES FOR ATTACHED PROOF, IF ANY:
# (ans == (0 - x))
# (x < 0)
# (x != 0)
#PREMISES FOR NEXT LINE:
# (ans == (0 - x))
# (x < 0)
# (x != 0)
else :
#PREMISES FOR ELSE-ARM:
# not (x < 0)
# (x != 0)
ans = x
#PREMISES FOR ATTACHED PROOF, IF ANY:
# (ans == x)
# not (x < 0)
# (x != 0)
#PREMISES FOR NEXT LINE:
# (ans == x)
# not (x < 0)
# (x != 0)
#PREMISES FOR NEXT LINE:
# (((ans == (0 - x)) and (x < 0)) or ((ans == x) and not (x < 0)))
# (x != 0)
# POSTCONDITION AND ALL GLOBAL INVARIANTS VERIFIED AT POINT OF RETURN
return ans
#PREMISES FOR NEXT LINE:
# (((ans == (0 - x)) and (x < 0)) or ((ans == x) and not (x < 0)))
# (x != 0)
# ((ans > 0) and ((ans == x) or (ans == (0 - x))))
# POSTCONDITION AND ALL GLOBAL INVARIANTS VERIFIED AT END OF FUNCTION
#PREMISES FOR NEXT LINE:

#PREMISES FOR ATTACHED PROOF, IF ANY:
# True
#PREMISES FOR NEXT LINE:
if n == 0 :
#PREMISES FOR THEN-ARM:
# (n == 0)
n = n + 1
#PREMISES FOR ATTACHED PROOF, IF ANY:
# (n == (n_old + 1))
# (n_old == 0)
"""{ 1.OK  n == n_old + 1      premise
2.OK  n_old == 0          premise
3.OK  n != 0              algebra 1 2
}"""
#PREMISES FOR NEXT LINE:
# (n != 0)
else :
#PREMISES FOR ELSE-ARM:
# not (n == 0)
pass
#PREMISES FOR NEXT LINE:
# not (n == 0)
"""{ 1.OK not(n == 0)    premise
2.OK n != 0         algebra 1
}"""
#PREMISES FOR NEXT LINE:
# (n != 0)
#PREMISES FOR NEXT LINE:
# (n != 0)

"""{ 1.OK  n != 0        premise  }"""      # from the conditional.
#PREMISES FOR NEXT LINE:
# (n != 0)
# This premise proves the precondition, too
m = absValue(n)
#PREMISES FOR ATTACHED PROOF, IF ANY:
# ((m > 0) and ((m == n) or (m == (0 - n))))
# (n != 0)
"""{ 1.OK m > 0 and (m == n or m == 0 - n)  premise
# from the function call postcondition
2.OK m > 0                             ande 1
}"""
#PREMISES FOR NEXT LINE:
# (m > 0)
# prove here that  m > 0

```