Skip to content

Commit

Permalink
Add normalize case and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
giopaglia committed Jul 5, 2024
1 parent de84baf commit 098ff90
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SoleLogics"
uuid = "b002da8f-3cb3-4d91-bbe3-2953433912b5"
authors = ["Mauro MILELLA", "Giovanni PAGLIARINI", "Edoardo PONSANESI", "Alberto PAPARELLA", "Eduard I. STAN"]
version = "0.9.2"
version = "0.9.3"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Expand Down
16 changes: 16 additions & 0 deletions src/syntax-utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,22 @@ See also
[`SyntaxTree`](@ref)), [`Formula`](@ref).
"""
normalize(f::Formula, args...; kwargs...) = normalize(tree(f), args...; kwargs...)
function normalize(
t::LLF;
kwargs...
) where {LLF<:Union{LeftmostConjunctiveForm,LeftmostDisjunctiveForm}}
ch = children(t)
unique!(ch)
ch = normalize.(ch; kwargs...)
unique!(ch)
if connective(t) == ()
filter!(c->c != ⊤, ch)
elseif connective(t) == ()
filter!(c->c != ⊥, ch)
end
return LLF(ch)
end

function normalize(
t::SyntaxTree;
profile = :readability,
Expand Down

0 comments on commit 098ff90

Please sign in to comment.