comp.lang.ada
 help / color / mirror / Atom feed
From: Shark8 <onewingedshark@gmail.com>
Subject: Re: quantified expression with empty array?
Date: Fri, 9 Mar 2018 13:08:09 -0800 (PST)
Date: 2018-03-09T13:08:09-08:00	[thread overview]
Message-ID: <e6cd6379-82aa-44d2-abe5-67f16f281651@googlegroups.com> (raw)
In-Reply-To: <8279f333-07ec-4477-a175-7c033b2424aa@googlegroups.com>

On Friday, March 9, 2018 at 10:15:12 AM UTC-7, Stephen Leake wrote:
> I ran across this question recently:
> 
> If I have a quantified expression:
> 
>   (for some Child of Children => Predicate (Child))
> 
> what is the value if Children'Length = 0?
> 
> ARM 2012 4.5.8 8/4, 9/4 talk about evaluating the predicates, but in this case there are no predicates to evaluate.
> 
> I wrapped this piece of code in "if Children'Length = 0 then" to be safe.

(FOR SOME ...) is exactly equivalent to a "THERE EXISTS" in logic, therefore if the domain for the ∃x is the null-set, then the evaluation is False because the thing didn't exists.

OTOH, the (FOR ALL ...) construct is exactly equivalent to the "FOR ALL" in logic and all 0 objects of ∀x {NULL} satisfy that, the expression evaluates to True.

So just remember that FOR ALL and FOR SOME are, respectively, ∀ and ∃.


      parent reply	other threads:[~2018-03-09 21:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-09 17:15 quantified expression with empty array? Stephen Leake
2018-03-09 18:40 ` Jeffrey R. Carter
2018-03-09 18:41 ` Niklas Holsti
2018-03-09 21:08 ` Shark8 [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox