0

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.

Cactus
  • 27,075
  • 9
  • 69
  • 149
  • 2
    Please include definitions of your data types and functions. Also, I can't understand your description of the problem. "When checking if this functor and input and output, it will be reflexive" is ungrammatical. Also, what do you mean by "reflexive", and "reflexive like OO languages"? I know of no OO language that supports proof-writing. – András Kovács Jan 26 '15 at 08:08
  • Unfortunately I need to be vague on purpose as this is part of a University assignment, so I don't know think I can post any of my progress. Sorry I obviously never proof read this when posting, what I meant to say is: When comparing the input and output of the functor, they are both exact duplicates of one another. Yet, my proof will not prove it as being reflexive. The idea of this proof is to show that if the given keystroke is a cursor key and not character input then the buffer's content should not change. Only the cursor position should change. – CookieMonsderp Jan 27 '15 at 19:58
  • If I'm reading this all right, your situation can be simplified into writing a term of type `inputBuffer == outputBuffer` (since that's the type of the hole). We will not be able to help you write that definition without knowing what `inputBuffer` and `outputBuffer` are. – Cactus Feb 02 '15 at 10:49

0 Answers0