On Monday, June 9, 2014 2:19:32 PM UTC-7, William wrote:

> I wanted to understand what you just claimed, so in Magma [1] I typed 
> this: 
>
>     5 eq GF(7)!5 
>
> but it output "true".    So clearly I completely misunderstood your 
> claim.  Can you be more precise? 
>

Sorry, you didn't misunderstand me, I was just mistaken in my claim. As it 
turns out Magma takes a different approach, by mandating that for its 
associative arrays, the keys live in a predetermined parent. One can make a 
"coproduct" key set that includes both integers and finite field elements, 
but equality there is indeed first by parent:

> a:=Integers()!1;
> b:=GF(5)!1;
> C:=cop<Integers(),GF(5)>;
> a eq b;
true
> (C!a) eq (C!b); //this is a worthwhile example to remember!
false

so they are breaking that equality is preserved under conversion, leading to

> A1:=AssociativeArray();
> A1[a]:="value_under_a";
> A1[b]:="value_under_b";
> A1; //index universe derived from first assignment
Associative Array with index universe Integer Ring
> A1[a],A1[b];           
value_under_b value_under_b

> A2:=AssociativeArray(C);
> A1[a]:="value_under_a";
> A2[b]:="value_under_b"; //magma is willing to use a section to get a key 
into the index set!
> A2[a],A2[b];
value_under_a value_under_b

Universes are allowed to be extended, but that can lead to unexpected 
results:

> A1[1/3]:="value_under_1/3";
> A1;
Associative Array with index universe Rational Field
> A1[b]:="value_under_b";
Runtime error in :=: No over-structure for index and index universe

At any particular moment, though, an associative array has an index 
universe, so as long as equality and hash are consistent within that 
universe, there is at least well-defined behaviour at that moment (it's 
clear that an associative array could be wildly different after its index 
set has been extended).

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to