So I'm building a simple text editor in Agda and attempting to write proofs to check modifications of the buffer after certain keystrokes, are correct. The one in particular I am working right now is to check that cursor input is not modifying the text within the buffer, just simply the position of the cursor.
I have a utility function to convert my buffer type to a list of char's:
Buffer -> List Char
Input:
[] <: ('H' :> 'E' :> 'L' :> 'L' :> 'O' :> []) <[
[] <: 'H' <[ <> ]> 'I' :> [] ]>
('H' :> 'E' :> 'L' :> 'L' :> 'O' :> []) :> []
Output:
('H' :> 'E' :> 'L' :> 'L' :> 'O' :> []) :>
('H' :> 'I' :> []) :> ('H' :> 'E' :> 'L' :> 'L' :> 'O' :> []) :> []
The problem: When comparing the input and output of the functor, they ARE reflexive. However the proof will not compile when I try and compile it as refl
, is there something I may be overlooking or missing out such as Agda having some other condition needing satisfied for something to be completely reflexive?
Proof definition:
postulate
within_turn_into_because_ :
{X Y : Set}(f : X -> Y)(x x' : X) ->
x == x' -> f x == f x'
Data Type(s)
record Cursor (M X : Set) : Set where
constructor _<[_]>_
field
beforeMe : Bwd X
atMe : M
afterMe : List X
within ((\ x -> x))
turn inputBuffer
into outputBuffer
because {refl}
InputBuffer
and OutputBuffer
have been replaced to stop from other students possibly coming in and plagiarising. Bwd
is a simple snoc list:
data Bwd (X : Set) : Set where
[] : Bwd X
_<:_ : Bwd X -> X -> Bwd X
Like I say, this is a university assignment so I cannot provide more than this, hopefully you understand.