Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Arthur Adjedj <[email protected]>
  • Loading branch information
nomeata and arthur-adjedj authored Dec 4, 2023
1 parent 9cb7ff2 commit 7c269da
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions doc/declarations.md
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ end Hide
Well-founed recursion
---------------------

If structural recursion fails, the equation compiler falls back on well-founded recursion. It tries to infer an instance of ``SizeOf`` for the type of each argument, and then tries to find a permutation of the arguments such that that each recursive call is decreasing under the lexicographic order with respect to ``sizeOf`` measures. Lean uses information in the local context, so you can often provide the relevant proof manually using ``have`` in the body of the definition. In this case of well-founded recursion, the defining equations hold only propositionally, and can be accessed using ``simp`` and ``rewrite`` with the name ``foo``.
If structural recursion fails, the equation compiler falls back on well-founded recursion. It tries to infer an instance of ``SizeOf`` for the type of each argument, and then tries to find a permutation of the arguments such that each recursive call is decreasing under the lexicographic order with respect to ``sizeOf`` measures. Lean uses information in the local context, so you can often provide the relevant proof manually using ``have`` in the body of the definition. In this case of well-founded recursion, the defining equations hold only propositionally, and can be accessed using ``simp`` and ``rewrite`` with the name ``foo``.

```lean
namespace Hide
Expand All @@ -568,7 +568,7 @@ end Hide

If Lean cannot find a permutation of the arguments for which all recursive calls are decreasing, it will print a table that contains, for every recursive call, which arguments Lean could prove to be decreasing.

If Lean will print the termination argument it found if ``set_option showInferredTerminationBy true`` is set.
Lean will print the termination argument it found if ``set_option showInferredTerminationBy true`` is set.

If Lean does not find the termination argument, or if you want to be explict, you can append a `termination_by` clause to the function definition. It is fo the form
```
Expand Down

0 comments on commit 7c269da

Please sign in to comment.