all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: MON KEY <monkey@sandpframing.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Chong Yidong <cyd@stupidchicken.com>,
	Andreas Schwab <schwab@linux-m68k.org>,
	6878@debbugs.gnu.org
Subject: bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element
Date: Thu, 19 Aug 2010 13:06:58 -0400	[thread overview]
Message-ID: <AANLkTim9AGuFE0CTc3Rgbae_mpUFxSTut=HN9fL=0PLc@mail.gmail.com> (raw)
In-Reply-To: <jwv1v9uzjrj.fsf-monnier+emacs@gnu.org>

On Thu, Aug 19, 2010 at 11:51 AM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
>> Prove it!
>
> Easy! formally, he said:
>
>  ∀ n ≥ 0 ∧ n < 0. (aref (make-bool-vector 0 t) n) ∈ { nil, t }
>
> And since there is no such `n', this is trivially true.
> More specifically, "n ≥ 0 ∧ n < 0" is a falsehood, and from false you
> can conclude anything you wish.  Among other things you can just
> a trivially prove:
>
>  ∀ n ≥ 0 ∧ n < 0. the sky is green
>

The problem with the above semantic vodoo is that it doesn't reflect the
contents of the manual either:

,---- (info "(elisp)bool-vectors")
|
| A bool-vector is much like a vector, except that it stores only the
| values `t' and `nil'.  If you try to store any non-`nil' value into an
| element of the bool-vector, the effect is to store `t' there.
|
`----

Informally, your formal proof is valid only so long as we suspend
belief in the manual and the sources which the manual is intended to
inform, specifically the place where it doesn't say that 0 length
bool-vectors don't have a value at index 0. IOW your proofs universal
qualifer relies on an empty domain where the manual would suggest
otherwise.  Since there is no "formal Emacs Lisp specification", and
since we are not discussing the formal realm of denotational semantics
nor first order logic w/ regards to a formal Emacs Lisp specification
your proof is indeed only trivially applicable.

Here is what I think the manual should say:

at info node "Bool-Vector Type"

,----
|
| A "bool-vector" is a special type of one-dimensional array.  An elment
| of a bool-vector which is accesible by its non-zero index must only be
| `t' or `nil'.
|
`----

at info node "Bool-vectors"

,----
|
| A bool-vector is a special type of vector which stores only the values `t'
| and `nil'.  If you try to store any non-`nil' value into an element of the
| bool-vector, the effect is to store `t' there.  As with all arrays,
| bool-vector indices start from 0. Emacs allows creation of a bool-vector of
| length 0 however its length cannot be changed once the bool-vector is created.
| An error is singaled if you try to access the 0 index of a bool-vector of
| length 0.  Bool-vectors are constants when evaluated.
|
`----


--
/s_P\





  reply	other threads:[~2010-08-19 17:06 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-18  4:19 bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element MON KEY
2010-08-18  7:36 ` Stefan Monnier
2010-08-19  1:51   ` MON KEY
2010-08-19  8:42     ` Andreas Schwab
2010-08-19 14:13       ` MON KEY
2010-08-19 15:51         ` Stefan Monnier
2010-08-19 17:06           ` MON KEY [this message]
2010-08-19 14:47       ` Stefan Monnier
2010-08-19 15:04         ` Andreas Schwab
2010-08-19 16:18     ` Chong Yidong
2010-08-19 17:09       ` MON KEY
2010-08-19 18:40         ` Juanma Barranquero
2010-08-19 23:24         ` Chong Yidong
2010-08-20  2:01           ` MON KEY
2010-08-20  2:23             ` Juanma Barranquero
2010-08-20 18:01               ` MON KEY
2010-08-20 19:49                 ` Juanma Barranquero
2010-08-20 23:06                   ` MON KEY
2010-08-20 13:02             ` Stefan Monnier
2010-08-20 18:44               ` MON KEY
2010-08-21 12:40                 ` Kevin Rodgers
2010-08-21 15:53                   ` Andreas Schwab
2010-08-21 17:02   ` MON KEY
2010-08-18  8:36 ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTim9AGuFE0CTc3Rgbae_mpUFxSTut=HN9fL=0PLc@mail.gmail.com' \
    --to=monkey@sandpframing.com \
    --cc=6878@debbugs.gnu.org \
    --cc=cyd@stupidchicken.com \
    --cc=monnier@iro.umontreal.ca \
    --cc=schwab@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.