Skip to content

Commit

Permalink
fixing bug in tau*
Browse files Browse the repository at this point in the history
  • Loading branch information
ZachJHansen authored and teiesti committed Aug 28, 2024
1 parent bd5aafa commit d42e72a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/translating/tau_star.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,9 @@ fn construct_total_function_formula(
}

// Integer division. Not Abstract Gringo compliant in negative divisor edge cases.
// Division: exists I J Q R (I = J * Q + R & val_t1(I) & val_t2(J) & J != 0 & R >= 0 & R < Q & Z = Q)
// Modulo: exists I J Q R (I = J * Q + R & val_t1(I) & val_t2(J) & J != 0 & R >= 0 & R < Q & Z = R)
// Follows the corrected arXiv paper (https://arxiv.org/abs/2008.02025), not the TPLP paper
// Division: exists I J Q R (I = J * Q + R & val_t1(I) & val_t2(J) & J != 0 & R >= 0 & R < J & Z = Q)
// Modulo: exists I J Q R (I = J * Q + R & val_t1(I) & val_t2(J) & J != 0 & R >= 0 & R < J & Z = R)
fn construct_partial_function_formula(
valti: fol::Formula,
valtj: fol::Formula,
Expand Down Expand Up @@ -254,7 +255,7 @@ fn construct_partial_function_formula(
term: fol::GeneralTerm::IntegerTerm(fol::IntegerTerm::Variable(rvar.clone())),
guards: vec![fol::Guard {
relation: fol::Relation::Less,
term: fol::GeneralTerm::IntegerTerm(fol::IntegerTerm::Variable(qvar.clone())),
term: fol::GeneralTerm::IntegerTerm(fol::IntegerTerm::Variable(j.clone())),
}],
}))
.into(),
Expand Down Expand Up @@ -909,8 +910,8 @@ mod tests {
for (term, var, target) in [
("X + 1", "Z1", "exists I$i J$i (Z1$g = I$i + J$i and I$i = X and J$i = 1)"),
("3 - 5", "Z1", "exists I$i J$i (Z1$g = I$i - J$i and I$i = 3 and J$i = 5)"),
("Xanadu/Yak", "Z1", "exists I$i J$i Q$i R$i (I$i = J$i * Q$i + R$i and (I$i = Xanadu and J$i = Yak) and (J$i != 0 and R$i >= 0 and R$i < Q$i) and Z1$g = Q$i)"),
("X \\ 3", "Z1", "exists I$i J$i Q$i R$i (I$i = J$i * Q$i + R$i and (I$i = X and J$i = 3) and (J$i != 0 and R$i >= 0 and R$i < Q$i) and Z1$g = R$i)"),
("Xanadu/Yak", "Z1", "exists I$i J$i Q$i R$i (I$i = J$i * Q$i + R$i and (I$i = Xanadu and J$i = Yak) and (J$i != 0 and R$i >= 0 and R$i < J$i) and Z1$g = Q$i)"),
("X \\ 3", "Z1", "exists I$i J$i Q$i R$i (I$i = J$i * Q$i + R$i and (I$i = X and J$i = 3) and (J$i != 0 and R$i >= 0 and R$i < J$i) and Z1$g = R$i)"),
("X..Y", "Z", "exists I$i J$i K$i (I$i = X and J$i = Y and Z$g = K$i and I$i <= K$i <= J$i)"),
("X+1..Y", "Z1", "exists I$i J$i K$i ((exists I1$i J$i (I$i = I1$i + J$i and I1$i = X and J$i = 1)) and J$i = Y and Z1 = K$i and I$i <= K$i <= J$i)"),
] {
Expand Down

0 comments on commit d42e72a

Please sign in to comment.