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

Use new match-replace operator aliasing #252

Open
lukem12345 opened this issue Jun 26, 2024 · 1 comment
Open

Use new match-replace operator aliasing #252

lukem12345 opened this issue Jun 26, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@lukem12345
Copy link
Member

lukem12345 commented Jun 26, 2024

Currently, each operator that can be expanded into its definition is expanded with bespoke operations on Decapodes:

function add_Codiff!(d::SummationDecapode, src_Codiff::Int, tgt_Codiff::Int)
  hodge_star_first = add_part!(d, :Var, type=:infer, name=nothing)
  add_part!(d, :Op1, src=src_Codiff, tgt=hodge_star_first, op1=:)

  exterior_deriv = add_part!(d, :Var, type=:infer, name=nothing)
  add_part!(d, :Op1, src=hodge_star_first, tgt=exterior_deriv, op1=:d)

  add_part!(d, :Op1, src=exterior_deriv, tgt=tgt_Codiff, op1=:)
end

However, PR #37 of DiagrammaticEquations.jl added support for a Match-Replacement approach. This silos imperative pointer-manipulation logic, and provides a declarative interface. “Matches” can be Symbols or Decapodes, and can be replaced with “Replacement” Symbols or Decapodes:

  RHS = @decapode begin
    y == (,d,)(X)
  end
  replace_op1!(MyDecapode, :div, RHS)

So, we should establish a library of definitions in DiagrammaticEquations.jl, and use that functionality in the Decapodes compiler.

@lukem12345 lukem12345 added the enhancement New feature or request label Jun 26, 2024
@lukem12345
Copy link
Member Author

lukem12345 commented Aug 19, 2024

To clarify some language:

DiagrammaticEquations.jl PR 37 implemented a rewrite system (see e.g. Bonchi et al. for an overview), specialized to the case in which signatures are of arity 1 (corresponding to our Op1s) or arity 2 (corresponding to our Op2s) and are all of co-arity 1.

When I say "a Match-Replacement approach", I mean a term rewrite system. When I say "establish a library of definitions", I mean define a collection of rewrite rules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant