Skip to content

Commit f1bd405

Browse files
committed
Document reordering elimination
1 parent f3e6d0b commit f1bd405

3 files changed

Lines changed: 28 additions & 2 deletions

File tree

docs/src/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
- [Hole elaboration]()
99
- ["Local" elaboration](./elaboration/local.md)
1010
- [Resolution uncrowding]()
11-
- [Reordering elimination]()
11+
- [Reordering elimination](./elaboration/reordering.md)
1212
- [Other features](./etc.md)
1313
- [Proof parsing/printing](./etc/parse.md)
1414
- [Proof slicing](./etc/slice.md)

docs/src/elaboration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ elaboration passes are:
2020
- [`lia-generic`]()
2121
- [`local`](./elaboration/local.md)
2222
- [`uncrowd`]()
23-
- [`reordering`]()
23+
- [`reordering`](./elaboration/reordering.md)
2424
- [`hole`]()
2525

2626
By default, Carcara will attempt to apply all of these in the listed order.

docs/src/elaboration/reordering.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Reordering elimination
2+
For many use cases of Alethe like proof translation or reconstruction in proof assistants, clause
3+
reordering steps can be challenging to deal with. With that in mind, Carcara has an elaboration step
4+
that can completely remove all `reordering` steps from a proof.
5+
6+
This is done by replacing the `reordering` step with its premise and, anytime it is used as a
7+
premise in another step, recomputing the clause of the step that used it. As an exmple, consider the
8+
following proof:
9+
```
10+
(step t1 (cl a b c) :rule hole)
11+
(step t2 (cl b a c) :rule reordering :premises (t1))
12+
(step t3 (cl b a c d) :rule weakening :premises (t2))
13+
```
14+
Here, step `t2` will be eliminated, such that step `t3` uses `t1` directly as its premise. However,
15+
simply changing the premise clause of step `t4` would make it invalid[^1]. To avoid this, Carcara
16+
must also recompute the conclusion of `t3`, resulting in the following proof:
17+
```
18+
(step t1 (cl a b c) :rule hole)
19+
(step t3 (cl a b c d) :rule weakening :premises (t1))
20+
```
21+
Of course, if any step further down in the proof uses `t3` as a premise, it will also need to
22+
be recomputed, and these changes will propagate down the proof.
23+
24+
[^1]: Strictly speaking, the step would not be invalid according to the semantics of Alethe, which
25+
are entirely agnostic to clause ordering. However, when elaborating a proof, we aim to ensure a more
26+
strict semantics, in which clause ordering is maitained in rules such as `weakening`.

0 commit comments

Comments
 (0)