#ifndef wasm_analysis_lattice_h
#define wasm_analysis_lattice_h
#include "wasm.h"
#include <bitset>
#include <iostream>
namespace wasm::analysis {
enum LatticeComparison { NO_RELATION, EQUAL, LESS, GREATER };
template<typename T>
constexpr bool has_compare = std::is_invocable_r<LatticeComparison,
decltype(T::compare),
const T&,
const T&>::value;
template<typename T>
constexpr bool has_getLeastUpperBound = std::
is_invocable_r<void, decltype(&T::getLeastUpperBound), T, const T&>::value;
template<typename T>
constexpr bool has_isTop =
std::is_invocable_r<bool, decltype(T::isTop), const T&>::value;
template<typename T>
constexpr bool has_isBottom =
std::is_invocable_r<bool, decltype(T::isBottom), const T&>::value;
template<typename T>
constexpr bool is_lattice =
has_compare<T>&& has_getLeastUpperBound<T>&& has_isTop<T>&& has_isBottom<T>;
template<size_t N> struct BitsetPowersetLattice {
std::bitset<N> value;
static BitsetPowersetLattice<N> getBottom();
static bool isTop(const BitsetPowersetLattice<N>& element);
static bool isBottom(const BitsetPowersetLattice<N>& element);
static LatticeComparison compare(const BitsetPowersetLattice<N>& left,
const BitsetPowersetLattice<N>& right);
void getLeastUpperBound(const BitsetPowersetLattice<N>& right);
void print(std::ostream& os);
};
}
#include "powerset-lattice-impl.h"
#endif