Skip to content

Substitution in Tactic.Reflection.Subtitute is buggy #65

@xekoukou

Description

@xekoukou

Consider this code :

open import Agda.Builtin.Reflection
open import Reflection
open import Prelude.Nat
open import Prelude.Bool
open import Prelude.Unit
open import Prelude.List
open import Tactic.Reflection.Substitute

fff : Term
fff = pat-lam [ clause (   arg (arg-info visible relevant) (var "a")
                        ∷ (arg (arg-info visible relevant) (var "b"))
                        ∷ []) (var 0 [ arg (arg-info visible relevant) (var 2 []) ]) ] []

ggg : Term
ggg = substTerm (safe (def (quote Nat) []) _ ∷ []) fff

postulate
  B : Term  Set

aaa : B ggg
aaa = {!!}

Inspecting the hole with normalization gives this output :

Goal: B
      (pat-lam
       [
       clause (vArg (var "a") ∷ [ vArg (var "b") ])
       (var 1 [ vArg (def (quote Nat) []) ])
       ]
       [])

There seem to be at least two errors in the algorithm :
a. https://github.com/UlfNorell/agda-prelude/blob/master/src/Tactic/Reflection/Substitute.agda#L79
b. https://github.com/UlfNorell/agda-prelude/blob/master/src/Tactic/Reflection/Substitute.agda#L101

The example shows the "b" error. You should not use reverse.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions