lean4-htt/tests/lean/div_eqn.lean
Leonardo de Moura 438ce08748 feat(library/equations_compiler/util): cleanup equation rhs
The idea is to remove hints used to define a function by well founded
recursion. See new div_eqn.lean test for an example.
2017-05-25 13:09:13 -07:00

9 lines
218 B
Text

def Div : nat → nat → nat
| x y :=
if h : 0 < y ∧ y ≤ x then
have x - y < x, from nat.sub_lt (nat.lt_of_lt_of_le h.left h.right) h.left,
Div (x - y) y + 1
else
0
#check Div.equations._eqn_1