Skip to content

Commit 47f7086

Browse files
Fixed bug in findsimilar, which was not checking on the same world; added optimization (rule X5bis)
1 parent cf535b4 commit 47f7086

1 file changed

Lines changed: 47 additions & 4 deletions

File tree

src/many-valued-multi-modal-tableau/alphasat.jl

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ function findsimilar(
1111
) where {
1212
T<:ManyValuedMultiModalTableau
1313
}
14+
w = world(tableau)
1415
ψ = assertion(tableau)[2]
1516
if judgement(tableau)
1617
γ = assertion(tableau)[1]
17-
# Looking for false(β⪯ψ, ...) where β⪯γ
18+
# Looking for false(β⪯ψ, w, ...) where β⪯γ
1819
while !isroot(tableau)
1920
tableau = tableau.father
20-
if !judgement(tableau)
21+
if world(tableau) == w && !judgement(tableau)
2122
if assertion(tableau)[1] isa Truth && assertion(tableau)[2] == ψ
2223
β = convert(FiniteTruth, assertion(tableau)[1])::FiniteTruth
2324
if precedeq(algebra, β, γ)
@@ -28,10 +29,10 @@ function findsimilar(
2829
end
2930
else
3031
β = assertion(tableau)[1]
31-
# Looking for true(γ⪯ψ, ...) where β⪯γ
32+
# Looking for true(γ⪯ψ, w, ...) where β⪯γ
3233
while !isroot(tableau)
3334
tableau = tableau.father
34-
if judgement(tableau)
35+
if world(tableau) == w && judgement(tableau)
3536
if assertion(tableau)[1] isa Truth && assertion(tableau)[2] == ψ
3637
γ = convert(FiniteTruth, assertion(tableau)[1])::FiniteTruth
3738
if precedeq(algebra, β, γ)
@@ -44,6 +45,46 @@ function findsimilar(
4445
return false
4546
end
4647

48+
function findsimilaropt(
49+
tableau::T,
50+
algebra::FiniteFLewAlgebra
51+
) where {
52+
T<:ManyValuedMultiModalTableau
53+
}
54+
w = world(tableau)
55+
ψ = assertion(tableau)[1]
56+
if judgement(tableau)
57+
β = assertion(tableau)[2]
58+
# Looking for false(ψ⪯γ, w, ...) where β⪯γ
59+
while !isroot(tableau)
60+
tableau = tableau.father
61+
if world(tableau) == w && !judgement(tableau)
62+
if assertion(tableau)[2] isa Truth && assertion(tableau)[1] == ψ
63+
γ = convert(FiniteTruth, assertion(tableau)[2])::FiniteTruth
64+
if precedeq(algebra, β, γ)
65+
return true
66+
end
67+
end
68+
end
69+
end
70+
else
71+
γ = assertion(tableau)[2]
72+
# Looking for true(ψ⪯β, w, ...) where β⪯γ
73+
while !isroot(tableau)
74+
tableau = tableau.father
75+
if world(tableau) == w && judgement(tableau)
76+
if assertion(tableau)[2] isa Truth && assertion(tableau)[1] == ψ
77+
β = convert(FiniteTruth, assertion(tableau)[2])::FiniteTruth
78+
if precedeq(algebra, β, γ)
79+
return true
80+
end
81+
end
82+
end
83+
end
84+
end
85+
return false
86+
end
87+
4788
function findtableau(
4889
tableau::T,
4990
j::Bool,
@@ -625,6 +666,8 @@ function alphasat(
625666
β = convert(FiniteTruth, assertion(expansionnode)[2])::FiniteTruth
626667
if !judgement(expansionnode) && istop(β)
627668
close!(expansionnode) # X4
669+
elseif findsimilaropt(expansionnode, algebra)
670+
close!(expansionnode) # X5bis
628671
elseif token(φ) isa NamedConnective{:} && !istop(β)
629672
(ψ, ε) = subformulas(φ)
630673
pairs = Set{NTuple{2,FiniteTruth}}()

0 commit comments

Comments
 (0)