Skip to content

Commit

Permalink
Deploying to gh-pages from @ eb5e8c2 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
Kha committed Jan 12, 2024
1 parent 931d2a1 commit ce1a34f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
13 changes: 7 additions & 6 deletions induction_and_recursion.html
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ <h2><a class="header" href="#well-founded-recursion-and-induction" id="well-foun
| 0, y =&gt; y+1
| x+1, 0 =&gt; ack x 1
| x+1, y+1 =&gt; ack x (ack (x+1) y)
termination_by ack x y =&gt; (x, y)
termination_by x y =&gt; (x, y)
</code></pre>
<p>Note that a lexicographic order is used in the example above because the instance
<code>WellFoundedRelation (α × β)</code> uses a lexicographic order. Lean also defines the instance</p>
Expand All @@ -846,7 +846,7 @@ <h2><a class="header" href="#well-founded-recursion-and-induction" id="well-foun
r
else
r
termination_by go i r =&gt; as.size - i
termination_by as.size - i
</code></pre>
<p>Note that, auxiliary function <code>go</code> is recursive in this example, but <code>takeWhile</code> is not.</p>
<p>By default, Lean uses the tactic <code>decreasing_tactic</code> to prove recursive applications are decreasing. The modifier <code>decreasing_by</code> allows us to provide our own tactic. Here is an example.</p>
Expand All @@ -865,11 +865,12 @@ <h2><a class="header" href="#well-founded-recursion-and-induction" id="well-foun
| 0, y =&gt; y+1
| x+1, 0 =&gt; ack x 1
| x+1, y+1 =&gt; ack x (ack (x+1) y)
termination_by ack x y =&gt; (x, y)
termination_by x y =&gt; (x, y)
decreasing_by
simp_wf -- unfolds well-founded recursion auxiliary definitions
first | apply Prod.Lex.right; simp_arith
| apply Prod.Lex.left; simp_arith
all_goals simp_wf -- unfolds well-founded recursion auxiliary definitions
· apply Prod.Lex.left; simp_arith
· apply Prod.Lex.right; simp_arith
· apply Prod.Lex.left; simp_arith
</code></pre>
<p>We can use <code>decreasing_by sorry</code> to instruct Lean to &quot;trust&quot; us that the function terminates.</p>
<pre><code class="language-lean">def natToBin : Nat → List Nat
Expand Down
13 changes: 7 additions & 6 deletions print.html
Original file line number Diff line number Diff line change
Expand Up @@ -6796,7 +6796,7 @@ <h2><a class="header" href="#well-founded-recursion-and-induction" id="well-foun
| 0, y =&gt; y+1
| x+1, 0 =&gt; ack x 1
| x+1, y+1 =&gt; ack x (ack (x+1) y)
termination_by ack x y =&gt; (x, y)
termination_by x y =&gt; (x, y)
</code></pre>
<p>Note that a lexicographic order is used in the example above because the instance
<code>WellFoundedRelation (α × β)</code> uses a lexicographic order. Lean also defines the instance</p>
Expand All @@ -6817,7 +6817,7 @@ <h2><a class="header" href="#well-founded-recursion-and-induction" id="well-foun
r
else
r
termination_by go i r =&gt; as.size - i
termination_by as.size - i
</code></pre>
<p>Note that, auxiliary function <code>go</code> is recursive in this example, but <code>takeWhile</code> is not.</p>
<p>By default, Lean uses the tactic <code>decreasing_tactic</code> to prove recursive applications are decreasing. The modifier <code>decreasing_by</code> allows us to provide our own tactic. Here is an example.</p>
Expand All @@ -6836,11 +6836,12 @@ <h2><a class="header" href="#well-founded-recursion-and-induction" id="well-foun
| 0, y =&gt; y+1
| x+1, 0 =&gt; ack x 1
| x+1, y+1 =&gt; ack x (ack (x+1) y)
termination_by ack x y =&gt; (x, y)
termination_by x y =&gt; (x, y)
decreasing_by
simp_wf -- unfolds well-founded recursion auxiliary definitions
first | apply Prod.Lex.right; simp_arith
| apply Prod.Lex.left; simp_arith
all_goals simp_wf -- unfolds well-founded recursion auxiliary definitions
· apply Prod.Lex.left; simp_arith
· apply Prod.Lex.right; simp_arith
· apply Prod.Lex.left; simp_arith
</code></pre>
<p>We can use <code>decreasing_by sorry</code> to instruct Lean to &quot;trust&quot; us that the function terminates.</p>
<pre><code class="language-lean">def natToBin : Nat → List Nat
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion searchindex.json

Large diffs are not rendered by default.

0 comments on commit ce1a34f

Please sign in to comment.