Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't link all ports to parent #40

Open
zenna opened this issue Sep 25, 2017 · 2 comments
Open

Don't link all ports to parent #40

zenna opened this issue Sep 25, 2017 · 2 comments

Comments

@zenna
Copy link
Owner

zenna commented Sep 25, 2017

Currently, when we parametrically invert a function we attacH its parametric inputs to its parent (using link_to_parent). Similarly when we compute domain_errors we attach error outputs to the parent.

This means we have a lot of links projecting from each nested composite arrow all the way out to its outermost parent. On the one hand this may seem necessary because we need all the parametric inputs to execute the function for example. On the other hand it is bad for modularity because

  • Suppose I discover redundant parameters, if I "fix" an inner composite arrow, I need to update every other composite arrow that it is a parent of
  • If I decide I want to fix a parametric input to be constant I need to update all the parent compositions

An alternative approach is to link to not link any port to its parent; the ports of an arrow are specified implicitly as the ports on some of the SubArrows. I believe I initially tried this idea and realised it's problematic because:

  • You can't reuse inports without a dupl
  • You can't have shortcut connections directly from in_port to out_port without plugging an identity function in htere
  • You can't specify the types of an arrow without its contents
  • It forces you to conflate implementation with specification

So I think it's a bad idea.

But perhaps there is a middle ground

@zenna zenna added this to the The Great Restructuring milestone Sep 25, 2017
@zenna
Copy link
Owner Author

zenna commented Oct 2, 2017

This problem has become apparent again when solving a parametric inverse. I may find that a parametric inverse has redundant parameters, but eliminating would require me to update all the parents.

  • To use a parametric inverse I am going to still want to be able to evaluate the function with parameters of my choice
  • One kind of mental model is that an arrow is like a circuit where rather than there being wires between ports, each port receives and projects on a frequency. Typically a projection is restricted to the encapsulating composition but that is not necessarily true.

Changes

  • Allow sources (or perhaps all ports) to have a scope
  • Derive loose sub_ports
  • Figure out complications for recursive ports
  • Allow compilation to functions to take any port as output and maybe input

@zenna
Copy link
Owner Author

zenna commented Jun 18, 2019

That scope idea becomes too complicated. If an composite arrow takes input from some where in its scope, how do we invert it?

Let's revisit the idea of having all of some ports be implicit

  • You can't reuse inports without a dupl
    True, but maybe not a problem

  • You can't have shortcut connections directly from in_port to out_port without plugging an identity function in there
    Also, true, but what's wrong with identity

  • You can't specify the types of an arrow without its contents
    Also true, more problematic conceptually. But what problem does it cause in practice

A bigger problem is that the interface is not robust We want the nth port to mean something that is stable under permutations of the internals, or even their existence. Do we also want parameter ports to be robust? If a parameter could be eliminated by simplification, it seems like it is not robust.

The real question is what kind of things are parameters, really, in practice?
They encode values in the relation. They encode values in the preimage. But what's the correspondance between x and y and \theta. It depends; there are many possibilities.

So concretely, one way to think about it is to have parameters which are unstable. ii.e simply

  • don't connect subarrows to parents

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant