Add paragraph about order of arguments to x ≟ y

Thank you to Peter Thiemann for suggesting a paragraph on this subject.
This commit is contained in:
Philip Wadler 2020-04-21 10:50:41 -03:00 committed by GitHub
parent 8b9fc489c3
commit 8da824a96a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -775,13 +775,13 @@ Where the construct introduces a bound variable we need to compare it
with the substituted variable, applying the drop lemma if they are with the substituted variable, applying the drop lemma if they are
equal and the swap lemma if they are distinct. equal and the swap lemma if they are distinct.
Testing variable names for equality using the `_≟_` operator has a Note that for Agda it makes a difference whether we write `x ≟ y` or
catch. For Agda it makes a difference whether we write `x ≟ y` or `y ≟ x`. In an interactive proof, Agda will show which residual `with`
`y ≟ x`. If the test matches the constraint that Agda expects, then the clauses in the definition of `_[_:=_]` need to be simplified, and the
proof goes through as demonstrated. Otherwise, Agda produces a message `with` clauses in `subst` need to match these exactly. The guideline is
that reveals the low-level implementation of string equality. To avoid that Agda knows nothing about symmetry or commutativity, which require
this problem, the guideline is to always match literally on the expression invoking appropriate lemmas, so it is important to think about order of
on which Agda's evaluation is currently stuck. arguments and to be consistent.
#### Exercise `subst` (stretch) #### Exercise `subst` (stretch)