Skip to content

Commit

Permalink
Merge pull request #69 from AlgebraicJulia/simplify_pbpo
Browse files Browse the repository at this point in the history
Simplify PBPO+ rewriting
  • Loading branch information
kris-brown authored Jun 18, 2024
2 parents 7413d6b + 47183f3 commit e47c31c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions src/rewrite/PBPO.jl
Original file line number Diff line number Diff line change
Expand Up @@ -305,16 +305,19 @@ we do not check it.
L <--⌞•
m ↓ ↓
G ⟵ Gk
See Lemma 7.2 of "TERMINATION OF GRAPH TRANSFORMATION SYSTEMS USING WEIGHTED
SUBGRAPH COUNTING" by Overbeek and Endrullis (2023)
"""
function rewrite_match_maps(rule::PBPORule,mα; check=false, kw...)
function rewrite_match_maps(rule::PBPORule, mα; kw...)
_, _, _, α =
S = acset_schema(dom(left(rule)))
gl, u′ = var_pullback(Cospan(α, rule.l′)) # A <-- Gk --> K'
abs_K = abstract_attributes(dom(left(rule))) # absK -> K
u = only(filter(u->force(compose(u,u′))==force(compose(abs_K,rule.tk)),
homomorphisms(dom(abs_K), dom(u′))))
v, i = var_pullback(Cospan(u′, rule.tk))
u = invert_iso(i) v
abs_r = homomorphism(dom(abs_K), codom(right(rule));
initial=Dict([o=>collect(right(rule)[o]) for o in ob(S)]))
initial=Dict(o=>collect(right(rule)[o]) for o in ob(S)))
w, gr = pushout(abs_r, u)

return Dict(:gl=>gl, :u′=>u′, :u=>u, :gr=>gr, :w=>w)
Expand Down
4 changes: 2 additions & 2 deletions test/rewrite/PBPO.jl
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ end

init = Dict(:V => [1, 2]) => Dict()

get_matches(rule, G; initial=init)
homomorphisms(codom(left(rule)), G; monic=true)
@test length(get_matches(rule, G; initial=init))==1
@test isempty(homomorphisms(codom(left(rule)), G; monic=true))

@test only(get_matches(rule, G; initial=init)) == get_match(rule, G;initial=init)
@test is_isomorphic(expected, rewrite(rule, G; initial=init))
Expand Down

0 comments on commit e47c31c

Please sign in to comment.