2

In the following example

open import Agda.Builtin.Nat
open import Agda.Builtin.Equality

postulate
  f : Nat → Nat
  g : ∀{x y} → f x ≡ suc y → Nat

h : Nat → Nat
h x with f x
h x | zero = zero
h x | suc y = g {x} {y} {!refl!}

Agda doesn't accept refl for an argument.

The main questions are,

  1. what am I doing wrong?
  2. what is the correct/optimal/established/preferred way of proving stuff like this?

And of course any insights into Agda's behavior are greatly appreciated.

Primary Key
  • 1,237
  • 9
  • 14

1 Answers1

2

≡-Reasoning and 'with' patterns and Agda: type isn't simplified in with block should answer your questions. The official docs describe how to do what you want, but they don't seem to be too beginner-friendly.

effectfully
  • 12,325
  • 2
  • 17
  • 40
  • 1
    btw, the official docs seem to be just fine at least for people who care to thoroughly read them through before asking questions. :) – Primary Key May 15 '19 at 19:37