I am just starting out with Agda and have been following the LearnYouAnAgda tutorial, in which I have been shown this proof for identity:
proof : (A : Set) → A → A
proof _ x = x
From what I understand the _ is necessary to omit the parameter (A : Set). I wanted to use an implicit parameter to allow me to omit the _:
-- using implicit parameter
proof' : {A : Set} → A → A
proof' x = x
This proof works. I then wanted to apply it to a specific case, as is done in the tutorial. I define ℕ and give the type signature for what I want to prove:
data ℕ : Set where
zero : ℕ
suc : ℕ → ℕ
idProof : ℕ → ℕ
The constructor given in the tutorial using proof is:
idProof = proof ℕ
I don't fully understand this, since I expected proof would need 2 parameters considering the constructor we have already defined.
I wanted to write a constructor using proof' but I found that none of the following worked:
idProof = proof' ℕ
idProof = {x : ℕ} → proof' x
idProof = {x : Set} → proof' x
Using the solver however I found this worked:
idProof = proof' (λ z → z)
My questions are:
What are the differences between
proofandproof'?Why is it acceptable to use a single parameter,
ℕ, forproof?Why do the three constructors using
proof'not work?
Bonus:
A small explanation of how idProof = proof' (λ z → z) works (esp. the lambda) would be appreciated, unless it would likely be out of my current level of understanding of Agda.