Branch data Line data Source code
1 : : /****************************************************************************** 2 : : * This file is part of the cvc5 project. 3 : : * 4 : : * Copyright (c) 2009-2026 by the authors listed in the file AUTHORS 5 : : * in the top-level source directory and their institutional affiliations. 6 : : * All rights reserved. See the file COPYING in the top-level source 7 : : * directory for licensing information. 8 : : * **************************************************************************** 9 : : * 10 : : * Divisibility-by-k predicate. 11 : : */ 12 : : 13 : : #include "cvc5_public.h" 14 : : 15 : : #ifndef CVC5__DIVISIBLE_H 16 : : #define CVC5__DIVISIBLE_H 17 : : 18 : : #include <stddef.h> 19 : : 20 : : #include <iosfwd> 21 : : #include <ostream> 22 : : 23 : : #include "util/integer.h" 24 : : 25 : : namespace cvc5::internal { 26 : : 27 : : /** 28 : : * The structure representing the divisibility-by-k predicate. 29 : : */ 30 : : struct Divisible 31 : : { 32 : : const Integer k; 33 : : 34 : : Divisible(const Integer& n); 35 : : 36 : 686 : bool operator==(const Divisible& d) const { return k == d.k; } 37 : : 38 : : bool operator!=(const Divisible& d) const { return !(*this == d); } 39 : : }; /* struct Divisible */ 40 : : 41 : : /** 42 : : * Hash function for the Divisible objects. 43 : : */ 44 : : struct DivisibleHashFunction 45 : : { 46 : 1787 : size_t operator()(const Divisible& d) const { return d.k.hash(); } 47 : : }; /* struct DivisibleHashFunction */ 48 : : 49 : : inline std::ostream& operator<<(std::ostream& os, const Divisible& d); 50 : 0 : inline std::ostream& operator<<(std::ostream& os, const Divisible& d) 51 : : { 52 : 0 : return os << "divisible-by-" << d.k; 53 : : } 54 : : 55 : : } // namespace cvc5::internal 56 : : 57 : : #endif /* CVC5__DIVISIBLE_H */