summaryrefslogtreecommitdiff
path: root/src/theory/bv/proof_checker.cpp
blob: 711e9798caa49b7f3644cc6fc387a15883fb3d47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/******************************************************************************
 * Top contributors (to current version):
 *   Mathias Preiner
 *
 * This file is part of the cvc5 project.
 *
 * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
 * in the top-level source directory and their institutional affiliations.
 * All rights reserved.  See the file COPYING in the top-level source
 * directory for licensing information.
 * ****************************************************************************
 *
 * Implementation of bit-vectors proof checker.
 */

#include "theory/bv/proof_checker.h"

namespace cvc5 {
namespace theory {
namespace bv {

void BVProofRuleChecker::registerTo(ProofChecker* pc)
{
  pc->registerChecker(PfRule::BV_BITBLAST, this);
  pc->registerChecker(PfRule::BV_BITBLAST_CONST, this);
  pc->registerChecker(PfRule::BV_BITBLAST_VAR, this);
  pc->registerChecker(PfRule::BV_BITBLAST_EQUAL, this);
  pc->registerChecker(PfRule::BV_BITBLAST_ULT, this);
  pc->registerChecker(PfRule::BV_BITBLAST_ULE, this);
  pc->registerChecker(PfRule::BV_BITBLAST_UGT, this);
  pc->registerChecker(PfRule::BV_BITBLAST_UGE, this);
  pc->registerChecker(PfRule::BV_BITBLAST_SLT, this);
  pc->registerChecker(PfRule::BV_BITBLAST_SLE, this);
  pc->registerChecker(PfRule::BV_BITBLAST_SGT, this);
  pc->registerChecker(PfRule::BV_BITBLAST_SGE, this);
  pc->registerChecker(PfRule::BV_BITBLAST_NOT, this);
  pc->registerChecker(PfRule::BV_BITBLAST_CONCAT, this);
  pc->registerChecker(PfRule::BV_BITBLAST_AND, this);
  pc->registerChecker(PfRule::BV_BITBLAST_OR, this);
  pc->registerChecker(PfRule::BV_BITBLAST_XOR, this);
  pc->registerChecker(PfRule::BV_BITBLAST_XNOR, this);
  pc->registerChecker(PfRule::BV_BITBLAST_NAND, this);
  pc->registerChecker(PfRule::BV_BITBLAST_NOR, this);
  pc->registerChecker(PfRule::BV_BITBLAST_COMP, this);
  pc->registerChecker(PfRule::BV_BITBLAST_MULT, this);
  pc->registerChecker(PfRule::BV_BITBLAST_ADD, this);
  pc->registerChecker(PfRule::BV_BITBLAST_SUB, this);
  pc->registerChecker(PfRule::BV_BITBLAST_NEG, this);
  pc->registerChecker(PfRule::BV_BITBLAST_UDIV, this);
  pc->registerChecker(PfRule::BV_BITBLAST_UREM, this);
  pc->registerChecker(PfRule::BV_BITBLAST_SDIV, this);
  pc->registerChecker(PfRule::BV_BITBLAST_SREM, this);
  pc->registerChecker(PfRule::BV_BITBLAST_SMOD, this);
  pc->registerChecker(PfRule::BV_BITBLAST_SHL, this);
  pc->registerChecker(PfRule::BV_BITBLAST_LSHR, this);
  pc->registerChecker(PfRule::BV_BITBLAST_ASHR, this);
  pc->registerChecker(PfRule::BV_BITBLAST_ULTBV, this);
  pc->registerChecker(PfRule::BV_BITBLAST_SLTBV, this);
  pc->registerChecker(PfRule::BV_BITBLAST_ITE, this);
  pc->registerChecker(PfRule::BV_BITBLAST_EXTRACT, this);
  pc->registerChecker(PfRule::BV_BITBLAST_REPEAT, this);
  pc->registerChecker(PfRule::BV_BITBLAST_ZERO_EXTEND, this);
  pc->registerChecker(PfRule::BV_BITBLAST_SIGN_EXTEND, this);
  pc->registerChecker(PfRule::BV_BITBLAST_ROTATE_RIGHT, this);
  pc->registerChecker(PfRule::BV_BITBLAST_ROTATE_LEFT, this);
  pc->registerChecker(PfRule::BV_EAGER_ATOM, this);
}

Node BVProofRuleChecker::checkInternal(PfRule id,
                                       const std::vector<Node>& children,
                                       const std::vector<Node>& args)
{
  if (id == PfRule::BV_BITBLAST)
  {
    Assert(children.empty());
    Assert(args.size() == 1);
    Assert(args[0].getKind() == kind::EQUAL);
    return args[0];
  }
  else if (id == PfRule::BV_BITBLAST_CONST || id == PfRule::BV_BITBLAST_VAR
           || id == PfRule::BV_BITBLAST_EQUAL || id == PfRule::BV_BITBLAST_ULT
           || id == PfRule::BV_BITBLAST_ULE || id == PfRule::BV_BITBLAST_UGT
           || id == PfRule::BV_BITBLAST_UGE || id == PfRule::BV_BITBLAST_SLT
           || id == PfRule::BV_BITBLAST_SLE || id == PfRule::BV_BITBLAST_SGT
           || id == PfRule::BV_BITBLAST_SGE || id == PfRule::BV_BITBLAST_NOT
           || id == PfRule::BV_BITBLAST_CONCAT || id == PfRule::BV_BITBLAST_AND
           || id == PfRule::BV_BITBLAST_OR || id == PfRule::BV_BITBLAST_XOR
           || id == PfRule::BV_BITBLAST_XNOR || id == PfRule::BV_BITBLAST_NAND
           || id == PfRule::BV_BITBLAST_NOR || id == PfRule::BV_BITBLAST_COMP
           || id == PfRule::BV_BITBLAST_MULT || id == PfRule::BV_BITBLAST_ADD
           || id == PfRule::BV_BITBLAST_SUB || id == PfRule::BV_BITBLAST_NEG
           || id == PfRule::BV_BITBLAST_UDIV || id == PfRule::BV_BITBLAST_UREM
           || id == PfRule::BV_BITBLAST_SDIV || id == PfRule::BV_BITBLAST_SREM
           || id == PfRule::BV_BITBLAST_SMOD || id == PfRule::BV_BITBLAST_SHL
           || id == PfRule::BV_BITBLAST_LSHR || id == PfRule::BV_BITBLAST_ASHR
           || id == PfRule::BV_BITBLAST_ULTBV || id == PfRule::BV_BITBLAST_SLTBV
           || id == PfRule::BV_BITBLAST_ITE || id == PfRule::BV_BITBLAST_EXTRACT
           || id == PfRule::BV_BITBLAST_REPEAT
           || id == PfRule::BV_BITBLAST_ZERO_EXTEND
           || id == PfRule::BV_BITBLAST_SIGN_EXTEND
           || id == PfRule::BV_BITBLAST_ROTATE_RIGHT
           || id == PfRule::BV_BITBLAST_ROTATE_LEFT)
  {
    return args[0];
  }
  else if (id == PfRule::BV_EAGER_ATOM)
  {
    Assert(children.empty());
    Assert(args.size() == 1);
    Assert(args[0].getKind() == kind::BITVECTOR_EAGER_ATOM);
    return args[0].eqNode(args[0][0]);
  }
  // no rule
  return Node::null();
}

}  // namespace bv
}  // namespace theory
}  // namespace cvc5
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback