[Agda] Does the order of patterns matter?

Altenkirch Thorsten psztxa at exmail.nottingham.ac.uk
Thu Sep 27 14:35:55 CEST 2012

On 27/09/2012 12:58, "Martin Escardo" <m.escardo at cs.bham.ac.uk> wrote:

>On 27/09/12 12:06, Altenkirch Thorsten wrote:
>> On 27/09/2012 11:51, "Martin Escardo" <m.escardo at cs.bham.ac.uk> wrote:
>>> Already in definitions by pattern matching on natural
>>> numbers there is a departure from Martin-Lof type theory, because in
>>> MLTT you need an inductive definition to even compute the predecessor
>>> function.
>> I don't understand this remark.
>> Certainly we can define
>> pred : Nat -> Nat
>> pred 0 = 0
>> pred (suc n) = n
>> without any difficulties.
>Yes, that's my point. How do you write in MLTT?

What is wrong with

pred : ℕ → ℕ
pred = RecNat (λ _ → ℕ) 0 (λ n x → n)

assuming that we have

RecNat : (P : ℕ → Set) → P 0 → ((n : ℕ) → P n → P (suc n)) → (n : ℕ) → P n
RecNat P z s zero = z
RecNat P z s (suc n) = s n (RecNat P z s n)


Thorsten (puzzled)

This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

More information about the Agda mailing list