-
Notifications
You must be signed in to change notification settings - Fork 251
Description
(micro-issue arising in the course of #2317 / #2311 )
UPDATED: two instances of what might be considered parsing 'bugs', but might merely be 'peeves'... but the first does seem to be a semantic failure of the current setup?
Suggest adding a comment in the definition of the combinators, or in the README
to draw attention to this issue?
Or is there a 'better' definition which might help avoid these problems?
- On
master
, the reasoning step here makes a combination of aprep
/'prefix' step with a use ofshift
reflected symmetrically; but if
_ ∷ (_ ∷ ws ++ _) <⟨ ↭-sym (shift _ _ _) ⟩
is replaced with
_ ∷ (_ ∷ ws ++ _) <⟨ shift _ _ _ ⟨
then the parser complains...
- The
step-swap
combinator, defined as:
-- Skip reasoning about the first two elements
step-swap : ∀ x y xs {ys zs : List A} → (y ∷ x ∷ ys) IsRelatedTo zs →
xs ↭ ys → (x ∷ y ∷ xs) IsRelatedTo zs
step-swap x y xs rel xs↭ys = relTo (trans (swap x y xs↭ys) (begin rel))
syntax step-swap x y xs y↭z x↭y = x ∷ y ∷ xs <<⟨ x↭y ⟩ y↭z
seems to work in the handful of places in the library where it is used:
- defining
shift
- defining
drop-mid′
- defining
drop-mid′
but with some bracketing required, as well as only ever being used withrefl
as the intermediate step.
But attempting to deploy it in the associated README
leads to the following unpleasant need for re-bracketing when trying to re-express example lem₂
using the combinator, as follows:
-- In practice it is further useful to extend `PermutationReasoning` with
-- specialised syntax `_∷_<⟨_⟩_` and `_∷_∷_<<⟨_⟩_` to support the
-- distinguished use of the `prep` and `swap` steps, allowing
-- the above proof to be recast in the following form:
lem₂ᵣ : 1 ∷ 2 ∷ 3 ∷ [] ↭ 3 ∷ 1 ∷ 2 ∷ []
lem₂ᵣ = begin
1 ∷ (2 ∷ (3 ∷ [])) <⟨ swap 2 3 refl ⟩
1 ∷ 3 ∷ (2 ∷ []) <<⟨ refl ⟩
3 ∷ 1 ∷ (2 ∷ []) ∎
Removing any of these brackets (or any other bracketing) seems to cause the parser to fall over.