Skip to content

Commit

Permalink
update distribute forall
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
  • Loading branch information
NikolajBjorner committed Dec 7, 2022
1 parent 80033e8 commit c33e58e
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 162 deletions.
1 change: 1 addition & 0 deletions src/ast/simplifiers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ z3_add_component(simplifiers
card2bv.cpp
demodulator_simplifier.cpp
dependent_expr_state.cpp
distribute_forall.cpp
elim_unconstrained.cpp
eliminate_predicates.cpp
euf_completion.cpp
Expand Down
26 changes: 9 additions & 17 deletions src/ast/simplifiers/distribute_forall.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,23 @@ Module Name:
#pragma once

#include "ast/simplifiers/dependent_expr_state.h"
#include "ast/rewriter/distribute_forall.h"


class distribute_forall_simplifier : public dependent_expr_simplifier {
distribute_forall m_dist;

struct rw_cfg;
struct rw;

public:

distribute_forall_simplifier(ast_manager& m, params_ref const& p, dependent_expr_state& fmls):
dependent_expr_simplifier(m, fmls),
m_dist(m) {
dependent_expr_simplifier(m, fmls) {
}

char const* name() const override { return "distribute-forall"; }

void reduce() override {
if (!m_fmls.has_quantifiers())
return;
expr_ref r(m);
for (unsigned idx : indices()) {
auto const& d = m_fmls[idx];
if (!has_quantifiers(d.fml()))
continue;
m_dist(d.fml(), r);
m_fmls.update(idx, dependent_expr(m, r, nullptr, d.dep()));
}
}

bool supports_proofs() const override { return true; }

void reduce() override;
};

1 change: 0 additions & 1 deletion src/tactic/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ z3_add_component(core_tactics
collect_statistics_tactic.cpp
ctx_simplify_tactic.cpp
der_tactic.cpp
distribute_forall_tactic.cpp
dom_simplify_tactic.cpp
elim_term_ite_tactic.cpp
elim_uncnstr_tactic.cpp
Expand Down
141 changes: 0 additions & 141 deletions src/tactic/core/distribute_forall_tactic.cpp

This file was deleted.

32 changes: 29 additions & 3 deletions src/tactic/core/distribute_forall_tactic.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,40 @@ Module Name:
Leonardo de Moura (leonardo) 2012-02-18.
Tactic Documentation:
## Tactic distribute-forall
### Short Description:
Distribute $\forall$ over conjunctions (and distribute $\exists$ over disjunctions)
### Example
```z3
(declare-const x Int)
(declare-fun p (Int) Bool)
(declare-fun q (Int) Bool)
(assert (forall ((x Int)) (and (p x) (q x))))
(apply distribute-forall)
```
### Notes
* supports unsat cores, proof terms
--*/
#pragma once

#include "util/params.h"
class ast_manager;
class tactic;
#include "tactic/dependent_expr_state_tactic.h"
#include "ast/simplifiers/distribute_forall.h"

tactic * mk_distribute_forall_tactic(ast_manager & m, params_ref const & p);
inline tactic * mk_distribute_forall_tactic(ast_manager& m, params_ref const& p = params_ref()) {
return alloc(dependent_expr_state_tactic, m, p,
[](auto& m, auto& p, auto &s) -> dependent_expr_simplifier* { return alloc(distribute_forall_simplifier, m, p, s); });
}

/*
ADD_TACTIC("distribute-forall", "distribute forall over conjunctions.", "mk_distribute_forall_tactic(m, p)")
Expand Down

0 comments on commit c33e58e

Please sign in to comment.