Skip to Content.
Sympa Menu

coq-club - [Coq-Club] Question while learning Coq from Software Foundations book

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] Question while learning Coq from Software Foundations book


Chronological Thread 
  • From: nikhil kaushik <nikhilka585 AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: [Coq-Club] Question while learning Coq from Software Foundations book
  • Date: Wed, 24 May 2017 10:20:47 +0530
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=nikhilka585 AT gmail.com; spf=Pass smtp.mailfrom=nikhilka585 AT gmail.com; spf=None smtp.helo=postmaster AT mail-ua0-f179.google.com
  • Ironport-phdr: 9a23:gUL3GBOx9mipZhNqrHYl6mtUPXoX/o7sNwtQ0KIMzox0LfnzrarrMEGX3/hxlliBBdydsKMazbeJ++C4ACpbsMnH6ChDOLV3FDY7yuwu3DYcSPafDkP6KPO4JwcbJ+9lEGFfwnegLEJOE9z/bVCB6le77DoVBwmtfVEtfre9FYHdldm42P6v8JPPfQpImCC9YbRvJxmqsAndrMcbjI9jJ6oryhbEoGZDd+BKyW91P16ekRLx68Wq8JJ/7yhcvu8q+tJdX6n9Y6k3QrtUASg8PWwy+MPlqwTIQxGV5nsbXGUWkx5IDBbA4RrnQJr/sTb0u/Rk1iWCMsL4Ub47WTK576d2UxDokzsINyQ48G7MlMN9ir9QrQ+7qBx+x47UZ5yVNOZ7c6jAc94WWXZNU8BMXCFHH4iybZYAD/AZMOhYoYfzpEYAowWiCgS3Huzj1iVFi2Xq0aEm0eksFxzN0gw6H9IJtXTZtNP1NKYRUeC1zanIySjIb/BM1jfg84jIchEhofKRVr93d8rRyEovFwPEjlWUqozqJTOY2+cNvmWA4OpgUPigi28jqw1rvjevwcIsh5DPi4kIyV7E7T10zJgpKdC8UkJ2Yt6pHIFOuy2HNYZ6WN4uTmNstSs817YIo4S0fDIQx5Qi3xPfa+KIc4yP4h/7UeaeOzZ4hHZ8dLKinRm+7VGsyuPhWsS21FtGtCVFkt7LtnAC0xzc9NKLRed6/kekwTqP1gbT5f9YIU0si6bXN5oszqQzm5cTq0jPADL6lUfsgKOLdEgp/vCk6+H9bbXnop+cOZV0igb7Mqk2nMy/AOc4MggPX2if+uSzzr3u8E75TbhRgf02l7PWsJHeJcgBuqG5BApV3p456xmjFzemzMgYnX4fIV1ZfxKHlpHlNE3KIPDlFviymE+skTdux/DeJLLtGJTNLn7ZkLfgZ7lx8UBcyBBghexYsplTE/QKJO/5ck73rt3RSBEjYCKuxOOyDtR+1oIaEWGGH7SZMaCa5VmJ5eIuJ+qFOd9IkDn4IvkhofXpiClqyhcmYaC10M5POziDFfN8LhDBbA==

I was going through the book Software foundations to learn Coq and I got stuck on Numbers. In this Type definition

Inductive nat : Type :=
  | O : nat
  | S : nat -> nat.

How does O becomes 0 when we use it in definition of

Definition pred (n : nat) : nat :=
  match n with
    | O => O
    | S n' => n'
  end.

I only understood that O represents natural numbers and S takes a natural number and return another natural number so S is a function. What I do not get is when our defined nat data type is used in preddefinition how does O represent 0? And how does S n' pattern match gives us predecessor of n.


--
~Nikhil Kaushik



Archive powered by MHonArc 2.6.18.

Top of Page