lean4-htt/tests/lean/termination_by.lean
Leonardo de Moura 381f66428a chore: use termination_by'
We are going to define a higher level syntax for `termination_by`.
2022-01-11 15:00:53 -08:00

41 lines
731 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mutual
inductive Even : Nat → Prop
| base : Even 0
| step : Odd n → Even (n+1)
inductive Odd : Nat → Prop
| step : Even n → Odd (n+1)
end
termination_by' measure
mutual
def f (n : Nat) :=
if n == 0 then 0 else f (n / 2) + 1
termination_by' measure
end
def g' (n : Nat) :=
match n with
| 0 => 1
| n+1 => g' n * 3
termination_by'
h => measure
namespace Test
mutual
def f : Nat → ααα
| 0, a, b => a
| n+1, a, b => g n a b |>.1
def g : Nat → αα → (α × α)
| 0, a, b => (a, b)
| n+1, a, b => (h n a b, a)
def h : Nat → ααα
| 0, a, b => b
| n+1, a, b => f n a b
end
termination_by'
f => measure
g => measure
end Test