Skip to content

SMT enforce variable types#3030

Merged
chriseth merged 1 commit intodevelopfrom
smt-variable-types
Oct 20, 2017
Merged

SMT enforce variable types#3030
chriseth merged 1 commit intodevelopfrom
smt-variable-types

Conversation

@axic
Copy link
Contributor

@axic axic commented Oct 5, 2017

No description provided.

@axic axic force-pushed the smt-variable-types branch from 6c430c5 to 18ae0c3 Compare October 5, 2017 11:29
Copy link
Contributor

@pirapira pirapira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@axic
Copy link
Contributor Author

axic commented Oct 5, 2017

Realised that z3 has the same problem so perhaps we should do this in the SolverInterface, though in the case of z3 it is of a smaller issue because that is compiled together with Solidity so any issue is spotted instantly, while with SMT, the file might be transmitted, processed and transmitted back, so it makes sense to spot issues earlier.

@chriseth
Copy link
Contributor

chriseth commented Oct 5, 2017

Yes, this should be part of the interface. Also: For now, the assertion is fine, but soon we also want to see the values for non-integer variables, e.g. bools.

@axic
Copy link
Contributor Author

axic commented Oct 20, 2017

@chriseth current version of the Z3 code uses a map for constant/function names, which does the same assert due to duplicate key will be refused by the map.

Basically Z3 part does everything this PR does for the SMT interface, i.e. this should be merged.

auto const& e = _expressionsToEvaluate.at(i);
// TODO they don't have to be ints...
solAssert(m_variables.count(e.name), "");
solAssert(m_variables[e.name] == SMTVariableType::Integer, "");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of them will actually be functions (mapping int to int or int to bool).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this code is not tested by travis.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sorry, they are of course not functions.

std::vector<std::string> m_accumulatedOutput;

enum class SMTVariableType {
Function,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I think we also need the domain and codomain of that function, otherwise it does not make too much sense.

@chriseth
Copy link
Contributor

Ok, let's merge it for now, but I think we should rather pull that up into SolverInterface later.

@chriseth chriseth merged commit 7d0e46b into develop Oct 20, 2017
@axic axic deleted the smt-variable-types branch October 24, 2017 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments