On Wed, Jun 22, 2022 at 08:32:06PM +0100, Paul Onions wrote:
> Hi Waldek,
>
> On 22 Jun 2022, at 09:10, Waldek Hebisch <
de...@fricas.math.uni.wroc.pl> wrote:
> >
> > On Tue, Jun 21, 2022 at 08:32:03PM +0100, Paul Onions wrote:
> >>
> >> Also, I’d like to get the Origins info so I can show where an operation is implemented, and basically get access to any of the other information that the HyperDoc browser displays. Ideally there would be a well-defined API that would allow me to do this, but after looking at the br-*.boot files I see that it all seems to be mixed in with the HyperDoc page construction code. So I need to spend some more time looking into it to see properly how it all works.
> >
> > Note that Origins is about declaration, not implementation. That is
> > place which declared given operation. Spad forms set theoretic sum
> > on signatures, so "the same" signature may be declared in multiple
> > placses, Origins probably only gives one declaration. AFAICS
> > Origins sometimes get confused by coditions.
> >
> > Implemention is separate thing, you get it clicking at Implementions
> > in view for operations. But it works only for fully determined
> > domains, that is all parameters must be explicit.
>
> My understanding is that a domain brings with it a collection of operations, each one implemented either in the domain itself or in a category referenced by the domain (directly or indirectly).
Not exactly. At low level domain has operations that it implements
itself, in a sense it "brings with" those operations. But domain
also have set interfaces (categories). And there is so call 'add
chain': domain may inherit unimplemented operations from another
domain. Actual operation to use is determined at runtime, there
is complicated procedure that examines conditions and decides
which of implementations to use (it looks at operations implemented
in categories and at 'add chain').
The point is that this information is dynamic and distributed, most
is not in the domain. In particular, as long as interface parts
does not change the same binary domain could use implementation
from differnet place after other domains are modified.
> So for any given domain I was expecting it to be possible to list all the operations and to be able to indicate the source of each one explicitly, so we would know how each operation is implemented in that domain.
>
>
> I think you are saying that this can be done, but it requires all domain parameters to be explicitly specified, and that this is called “Implementation” in HyperDoc.
Currently yes. Basically this simulates runtime call and tells you
which operation would be used. Actually, it reuses code used
by runtime calls. But before you can run code domain must be
"instantiated", that is parameters must be known.
People want more info about implementation and in principle we
could provide more: naively search could look at about 15000
implementations (this is rough estimate of number of different
implementation that we have). Actual search is smarter, but
must look at lot of data. We could simulate search, prune
all operations that can not apply and get decision tree
with hopefully small number of alternatives. I wrote
"decision tree" because availability of operations depends
on conditions and conditions depend on parameters. We
could try to simplify conditions, but without parameters
the best we can hope is decision tree. And "simplest form"
of conditions is undecidable, so we need to accept some
redundancy.
However, even such moderate goal, that is getting reasonably
sized decision tree with possibly reduntant conditions
remain unimplemented. One aspect here is that to be
useful it should agree with what runtime search is doing,
so implementer has to be quite careful do exactly what
runtime search is doing, but in "generic way", that is
without evaluationg conditions.
There is extra complication caused by Aldor interface: FriCAS
treats Aldor stuff as black box with small number of contact
points. And IIUC Aldor treats FriCAS stuff mostly as black
box. Difficulty here is that interface can do "find operation
with given signature from fully specified domain", but can not
"give decision tree for signature from generic domain". So
any such extra would break down if there is possiblity that
Aldor code is involved.
> That’s understandable I guess, but it also means that “Origins” is of limited value if it just picks arbitrarily one place where the operation is declared?
Well, it depends on your goal. "Origins" correspond to static
point of view: you look at signature and who _declared_ it.
In principle that is all what you need to know if you want to
use operation or generalize existing code.
Info about implementations is of different spirit: it tells you
what will happen at runtime.
--
Waldek Hebisch