Skip to content

Hanoi Omega-Automata INT is 32 bits #1226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions src/temporal-logic/hoa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Author: Daniel Kroening, dkr@amazon.com
#include "hoa.h"

#include <util/arith_tools.h>
#include <util/string2int.h>

#include <ebmc/ebmc_error.h>

Expand Down Expand Up @@ -167,9 +168,9 @@ hoa_tokenizert::tokent hoa_tokenizert::get_token(std::istream &in)
}
}

mp_integer hoat::max_state_number() const
hoat::intt hoat::max_state_number() const
{
mp_integer max = 0;
intt max = 0;

for(auto &state : body)
max = std::max(max, state.first.number);
Expand Down Expand Up @@ -208,6 +209,7 @@ class hoa_parsert
labelt parse_label_expr_and();
labelt parse_label_expr_primary();
acc_sigt parse_acc_sig();
hoat::intt parse_int();
};

hoat hoat::from_string(const std::string &src)
Expand All @@ -222,6 +224,15 @@ hoat hoat::from_string(const std::string &src)
return hoat{header, body};
}

hoat::intt hoa_parsert::parse_int()
{
auto text = tokenizer.consume().text;
auto int_opt = string2optional<hoat::intt>(text);
if(!int_opt.has_value())
throw ebmc_errort() << "HOA-parser failed to parse INT";
return int_opt.value();
}

hoat::headert hoa_parsert::parse_header()
{
std::string headername;
Expand Down Expand Up @@ -284,8 +295,7 @@ hoat::state_namet hoa_parsert::parse_state_name()
state_name.label = parse_label();

// INT
auto number = tokenizer.consume().text;
state_name.number = string2integer(number);
state_name.number = parse_int();

// STRING?
if(tokenizer.peek().is_string())
Expand Down Expand Up @@ -324,11 +334,11 @@ hoat::edget hoa_parsert::parse_edge()
edge.label = parse_label();

// state-conj: INT | state-conj "&" INT
edge.dest_states.push_back(string2integer(tokenizer.consume().text));
edge.dest_states.push_back(parse_int());
while(tokenizer.peek().text == "&")
{
tokenizer.consume();
edge.dest_states.push_back(string2integer(tokenizer.consume().text));
edge.dest_states.push_back(parse_int());
}

// acc-sig?
Expand Down
13 changes: 8 additions & 5 deletions src/temporal-logic/hoa.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Author: Daniel Kroening, dkr@amazon.com
#define CPROVER_TEMPORAL_LOGIC_HOA_H

#include <util/irep.h>
#include <util/mp_arith.h>

#include <cstdint>
#include <list>
#include <map>
#include <string>
Expand All @@ -24,12 +24,15 @@ class hoat
using headert = std::list<std::pair<std::string, std::list<std::string>>>;
headert header;

// A HOA INT is non-negative and less than 2^31
using intt = uint32_t;

// body
using labelt = irept;
using acc_sigt = std::vector<std::string>;
struct state_namet
{
mp_integer number;
intt number;
labelt label; // in-state condition
acc_sigt acc_sig;
bool is_accepting() const
Expand All @@ -40,7 +43,7 @@ class hoat
struct edget
{
labelt label; // transition condition
std::vector<mp_integer> dest_states;
std::vector<intt> dest_states;
acc_sigt acc_sig; // acceptance sets
};
using edgest = std::list<edget>;
Expand All @@ -61,10 +64,10 @@ class hoat
return out;
}

mp_integer max_state_number() const;
intt max_state_number() const;

// atomic propositions
std::map<mp_integer, std::string> ap_map;
std::map<intt, std::string> ap_map;
};

#endif // CPROVER_TEMPORAL_LOGIC_HOA_H
2 changes: 1 addition & 1 deletion src/temporal-logic/ltl_to_buechi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ ltl_to_buechi(const exprt &property, message_handlert &message_handler)
// is nonaccepting with an unconditional self-loop.
std::vector<exprt> error_disjuncts;

std::map<mp_integer, std::pair<hoat::state_namet, hoat::edgest>> state_map;
std::map<hoat::intt, std::pair<hoat::state_namet, hoat::edgest>> state_map;
for(auto &state : hoa.body)
state_map[state.first.number] = state;

Expand Down
Loading