1

I have made an emacs file trial_agda.agda with the following code:

module trial_agda where

data  : Set where
  zero : 
  suc  :  → 

data _even :  → Set where
  ZERO : zero even
  STEP : ∀ x → x even → suc (suc x) even

_+_ :  →  → 
(zero + n) = n
(suc n) + n′ = suc (n + n′)

In http://learnyouanagda.liamoc.net/pages/proofs.html, the author writes:

Now we’ll prove in Agda that four is even. Type the following into an emacs buffer, and type C-c C-l:

-- \_1 to type ₁
proof₁ : suc (suc (suc (suc zero))) even
proof₁ = ?

I typed C-c C-n and then copied and pasted the above code. I received the error Error: First load the file.

What has gone wrong?

user65526
  • 685
  • 6
  • 19
  • 1
    if it's asked to type C-c C-l and you type C-c C-n ofc it won't work. Especially because the later requires the former. – MrO Nov 10 '19 at 18:19
  • No. I needed to put it in the emacs file and not put it in the evaluate expression box. It was not clear to me that it could not go into the evaluate expression box. – user65526 Nov 10 '19 at 18:26
  • 1
    as you said yourself, it's an evaluate expression box, so it needs expressions as inputs, but your code was not an expression. My point is, it's fine to ask questions, but you need to think a bit before doing so. Ask yourself the following questions : what am I inputing ? In what purpose ? What location suits that purpose best ? Did I input the right command ? and so on. – MrO Nov 10 '19 at 19:10
  • @MrO Thanks for your advice, but I think that if you are a complete novice to programming, and to such things (imagine, for example, an alien encountered Agda :)), it is not obvious what is meant by an evaluated expression box, etc. This is not clearly explained at the point in the book for said alien. In general, you shouldn't presuppose I have this knowledge, and they shouldn't. – user65526 Nov 10 '19 at 19:54

1 Answers1

1

It is required to add the code to the same emacs file, underneath the code defining the module and the types, etc.

This was not specified in the book.

user65526
  • 685
  • 6
  • 19