Open stefjoosten opened 2 years ago
This is a bug, the first of the two scripts should give a disambiguation error. Will investigate.
One more thing, @sjcjoosten. I figured out your challenge how to model that two distinct concepts must always have the same population:
CONTEXT Distinct
CLASSIFY A ISA G
CLASSIFY B ISA G
ENFORCE I[A] := I[B]
ENDCONTEXT
How do I model the two concepts A
and B
to become aliases?
Answer:
CONTEXT Alias
CLASSIFY A ISA G
CLASSIFY B ISA G
CLASSIFY G ISA A
CLASSIFY G ISA B
ENDCONTEXT
or shorter:
CONTEXT Alias
CLASSIFY A ISA B
CLASSIFY B ISA A
ENDCONTEXT
Note that the ENFORCE I[A] := I[B]
would be redundant in CONTEXT Alias
because it follows from the fact that the populations of A
and B
are equal at all times.
In the former script (CONTEXT Distinct
) I would expect a disambiguation error in the following:
CONTEXT Distinct
CLASSIFY A ISA G
CLASSIFY B ISA G
ENFORCE I[A] := I[B]
RELATION r[X*A]
RELATION r[X*B]
RULE r;r~
ENDCONTEXT
In the latter script (CONTEXT Alias
) I would expect no compiler errors in the following:
CONTEXT Alias
CLASSIFY A ISA B
CLASSIFY B ISA A
RELATION r[X*A]
RELATION r[X*B]
RULE r;r~
ENDCONTEXT
All of the above is exactly as Ampersand behaves now. It is just that the following yields a disambiguation error:
CONTEXT Alias
CLASSIFY A IS B
RELATION r[X*A]
RELATION r[X*B]
RULE r;r~
ENDCONTEXT
@sjcjoosten Good discussion yesterday. We agreed on the following:
CLASSIFY A IS B
should be interchangeable with CLASSIFY A ISA B
and CLASSIFY B ISA A
, in all situations (i.e. in situations where there are type errors, population errors, or no errors). I have renamed this issue accordingly.RULE r;r~
is ambiguously typed.A
and B
must be equal.So now I'm looking for the right methodological motivation for one or the other. Here are some arguments; one pro and one con:
@sjcjoosten, please add your other arguments. When our discussion stopped, yesterday, you had just dropped an example in the chat. However, I could not recover that chat, so maybe you can drop the example once again in this discussion thread.
@sjcjoosten I am also curious to know what our scientific papers Relational Heterogeneity Relaxed by Subtyping (DOI 10.1007/978-3-642-21070-9_25) and Type Checking by Domain Analysis in Ampersand (DOI 10.1007/978-3-319-24704-5_14) have to say about this matter... Maybe Jaap van der Woude has something to say about this?
I think this relates to issue #1281.
What happened
I have two scripts:
Script_ISA
andScript_IS
:Script_ISA
compiles without errors. The following script doesn't:Script_IS
produces the following error message:What I expected
I expected that both scripts would compile without errors. In the wake of the discussion in issue #1306, I hesitate to call this a feature or a bug. Since $A\subseteq B\wedge B\subseteq A\Rightarrow A=B$, I would expect that
Script_ISA
entailsScript_IS
. With this result, I'm not sure anymore about issue #1306... How do I explain this to students?Version of Ampersand that was used
I did this on RAP, using Ampersand-v4.3.0 [32141f41cf2af837d59eb57bc73320f4ef48fa00:refs/heads/development], build time: 15-Aug-21 07:39:12 UTC