lean4-htt/tests/lean/1050.lean
Joachim Breitner b5122b6a7b feat: per-function termination hints
This change

 * moves `termination_by` and `decreasing_by` next to the function they
   apply to
 * simplify the syntax of `termination_by`
 * apply the `decreasing_by` goal to all goals at once, for better
   interactive use.

See the section in `RELEASES.md` for more details and migration advise.

This is a hard breaking change, requiring developers to touch every
`termination_by` in their code base. We decided to still do it as a
hard-breaking change, because supporting both old and new syntax at the
same time would be non-trivial, and not save that much. Moreover, this
requires changes to some metaprograms that developers might have
written, and supporting both syntaxes at the same time would make
_their_ migration harder.
2024-01-10 17:27:35 +01:00

49 lines
1,007 B
Text

universe u
inductive Foo : Type u → Type u → Type (u+1)
| foo {as bs cs: Type u}: Foo as bs → Foo bs cs → Foo as cs
namespace Foo
mutual
def bar : {as bs: Type u} → Foo.{u} as bs → bs :=
bar_aux
termination_by _ _ => 0
decreasing_by sorry
def bar_aux: {as bs: Type u} → Foo.{u} as bs → bs
| as, bs, foo _ x => x.bar
termination_by _ _ _ => 0
decreasing_by sorry
end
end Foo
namespace Foo
mutual
def bar1 : {as bs: Type u} → Foo.{u} as bs → bs
| as, bs, x => bar_aux1 x
termination_by _ _ _ => 0
decreasing_by sorry
def bar_aux1 : {as bs: Type u} → Foo.{u} as bs → bs
| as, bs, foo _ x => x.bar1
termination_by _ _ _ => 0
decreasing_by sorry
end
end Foo
namespace Foo
mutual
def bar2 : Foo as bs → bs
| x => bar_aux2 x
termination_by x => (sizeOf x, 1)
def bar_aux2 : Foo as bs → bs
| foo _ x => x.bar2
termination_by x => (sizeOf x, 0)
end
end Foo