Search code examples
agdaagda-mode

Loading files in Agda: unclear explanation in Learn you an Agda


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?


Solution

  • 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.