AlgebraicJulia / DiagrammaticEquations.jl

MIT License
9 stars 1 forks source link

DerivOp special case in infer_terminals #77

Open GeorgeR227 opened 6 days ago

GeorgeR227 commented 6 days ago

Currently something is a terminal variable if and only if it is not the source of any other operation. However, something is a source variable if it is not the result of any operation or if it is the source of a Partial T operation. So in the case of ∂ₜ(u) == u, u would be a source variable but not a terminal variable.

For reference, the output decapode looks like this:

SummationDecapode{Any, Any, Symbol} {Var:1, TVar:1, Op1:1, Op2:0, Σ:0, Summand:0, Type:0, Operator:0, Name:0}
┌─────┬───────┬──────┐
│ Var │  type │ name │
├─────┼───────┼──────┤
│   1 │ infer │    u │
└─────┴───────┴──────┘
┌──────┬──────┐
│ TVar │ incl │
├──────┼──────┤
│    1 │    1 │
└──────┴──────┘
┌─────┬─────┬─────┬─────┐
│ Op1 │ src │ tgt │ op1 │
├─────┼─────┼─────┼─────┤
│   1 │   1 │   1 │  ∂ₜ │
└─────┴─────┴─────┴─────┘

In order to balance out this behavior, we should add an case to the terminals that if it is the result of a Partial T operation then it is automatically a terminal.