17 #ifndef AWALI_WEIGHTSET_F2_HH
18 # define AWALI_WEIGHTSET_F2_HH
46 std::string
vname(
bool =
true)
const
111 throw std::domain_error(
"f2: star: invalid value: 1");
171 if ((stream >> i) && (i == 0 || i == 1))
178 parse(
const std::string & s,
size_t& p) {
179 if ((p>=4)&&(!s.compare(p-4,4,
"true"))) {
183 if ((p>=5)&&(!s.compare(p-5,5,
"false"))) {
197 const std::string& =
"text")
199 return o << (v ?
'1' :
'0');
206 o <<
"\\mathbb{F}_2";
207 else if (
format ==
"text")
210 raise(
"invalid format: ",
format);
215 template<
unsigned version = version::fsm_json>
219 version::check_fsmjson<version>();
230 template<
unsigned version = version::fsm_json>
234 version::check_fsmjson<version>();
243 template<
unsigned version = version::fsm_json>
247 version::check_fsmjson<version>();
virtual bool to_bool() const
Coerces this node_t to bool.
Definition: node.hh:306
object_t * push_back(std::string key, node_t *node)
The field F2.
Definition: f2.hh:37
static value_t conv(self_type, value_t v)
Definition: f2.hh:162
static bool is_one(const value_t v)
Definition: f2.hh:138
static value_t sub(const value_t l, const value_t r)
Definition: f2.hh:81
static constexpr bool is_commutative_semiring()
Definition: f2.hh:143
bool value_t
Definition: f2.hh:58
static f2 make(std::istream &is)
Build from the description in is.
Definition: f2.hh:52
static value_t star(const value_t v)
Definition: f2.hh:106
static size_t hash(value_t v)
Definition: f2.hh:156
json::node_t * to_json() const
Definition: f2.hh:216
static value_t add(const value_t l, const value_t r)
Definition: f2.hh:75
constexpr static bool is_special(value_t)
Definition: f2.hh:126
static value_t conv(std::istream &stream)
Definition: f2.hh:168
static bool less_than(value_t lhs, value_t rhs)
Whether lhs < rhs.
Definition: f2.hh:121
std::string vname(bool=true) const
Definition: f2.hh:46
static bool is_zero(const value_t v)
Definition: f2.hh:132
static const finite_t finite
Definition: f2.hh:60
static value_t one()
Definition: f2.hh:69
value_t value_from_json(json::node_t const *p) const
Definition: f2.hh:244
static bool equals(const value_t l, const value_t r)
Definition: f2.hh:115
static constexpr bool show_one()
Definition: f2.hh:145
std::ostream & print_set(std::ostream &o, const std::string &format="text") const
Definition: f2.hh:203
static value_t transpose(const value_t v)
Definition: f2.hh:151
static value_t zero()
Definition: f2.hh:63
json::node_t * value_to_json(value_t v) const
Definition: f2.hh:231
static value_t mul(const value_t l, const value_t r)
Definition: f2.hh:87
static std::ostream & print(const value_t v, std::ostream &o, const std::string &="text")
Definition: f2.hh:196
static constexpr star_status_t star_status()
Definition: f2.hh:148
static value_t ldiv(const value_t l, const value_t r)
Definition: f2.hh:100
static std::string sname()
Definition: f2.hh:41
static value_t parse(const std::string &s, size_t &p)
Definition: f2.hh:178
static value_t rdiv(const value_t l, const value_t r)
Definition: f2.hh:93
bool finite_t
Definition: f2.hh:59
The semiring of floating Numbers.
Definition: r.hh:35
star_status_t
The different behaviours a weightset may have with respect to the star.
Definition: enums.hh:163
@ NON_STARRABLE
Definition: enums.hh:166
void eat(std::istream &is, char c)
Check lookahead character and advance.
Definition: stream.hh:62
ATTRIBUTE_NORETURN void fail_reading(std::istream &is, std::string explanation)
Throw an exception after failing to read from is.
Definition: stream.hh:93
auto join(const ratexpset< Ctx1 > &a, const ratexpset< Ctx2 > &b) -> ratexpset< join_t< Ctx1, Ctx2 >>
The union of two ratexpsets.
Definition: ratexpset.hh:445
auto format(const ValueSet &vs, const typename ValueSet::value_t &v, Args &&... args) -> std::string
Format v via vs.print.
Definition: stream.hh:109
void require(bool b, Args &&... args)
If b is not verified, raise an error with args as message.
Definition: raise.hh:55
std::size_t hash_value(const T &v)
Definition: hash.hh:76
Main namespace of Awali.
Definition: ato.hh:22
Exceptions thrown during parsing.
Definition: parse_exception.hh:26