solidity/libsolidity/formal/PredicateSort.h

80 lines
3.2 KiB
C
Raw Normal View History

2020-09-08 14:52:58 +00:00
/*
This file is part of solidity.
solidity is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
solidity is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
#pragma once
#include <libsolidity/formal/Predicate.h>
2020-09-18 16:55:23 +00:00
#include <libsolidity/formal/SymbolicState.h>
2020-09-08 14:52:58 +00:00
#include <libsmtutil/Sorts.h>
namespace solidity::frontend::smt
{
/**
* This file represents the specification for CHC predicate sorts.
* Types of predicates:
*
* 1. Interface
* The idle state of a contract. Signature:
* interface(this, cryptoFunctions, blockchainState, stateVariables).
2020-09-08 14:52:58 +00:00
*
* 2. Nondet interface
* The nondeterminism behavior of a contract. Signature:
2020-09-18 16:55:23 +00:00
* nondet_interface(blockchainState, stateVariables, blockchainState', stateVariables').
2020-09-08 14:52:58 +00:00
*
* 3. Constructor entry/summary
* The summary of a contract's deployment procedure.
* Signature:
* If the contract has a constructor function, this is the same as the summary of that function. Otherwise:
* constructor_summary(error, this, cryptoFunctions, txData, blockchainState, blockchainState', stateVariables, stateVariables').
2020-09-08 14:52:58 +00:00
*
* 4. Function entry/summary
2020-09-08 14:52:58 +00:00
* The entry point of a function definition. Signature:
* function_entry(error, this, cryptoFunctions, txData, blockchainState, stateVariables, inputVariables, blockchainState', stateVariables', inputVariables', outputVariables').
2020-09-08 14:52:58 +00:00
*
* 5. Function body
2020-09-08 14:52:58 +00:00
* Use for any predicate within a function. Signature:
* function_body(error, this, txData, blockchainState, stateVariables, inputVariables, blockchainState', stateVariables', inputVariables', outputVariables', localVariables).
2020-09-08 14:52:58 +00:00
*/
/// @returns the interface predicate sort for _contract.
2020-09-18 16:55:23 +00:00
smtutil::SortPointer interfaceSort(ContractDefinition const& _contract, SymbolicState& _state);
2020-09-08 14:52:58 +00:00
/// @returns the nondeterminisc interface predicate sort for _contract.
2020-09-18 16:55:23 +00:00
smtutil::SortPointer nondetInterfaceSort(ContractDefinition const& _contract, SymbolicState& _state);
2020-09-08 14:52:58 +00:00
/// @returns the constructor entry/summary predicate sort for _contract.
2020-09-18 16:55:23 +00:00
smtutil::SortPointer constructorSort(ContractDefinition const& _contract, SymbolicState& _state);
2020-09-08 14:52:58 +00:00
/// @returns the function entry/summary predicate sort for _function contained in _contract.
2020-09-18 16:55:23 +00:00
smtutil::SortPointer functionSort(FunctionDefinition const& _function, ContractDefinition const* _contract, SymbolicState& _state);
2020-09-08 14:52:58 +00:00
/// @returns the function body predicate sort for _function contained in _contract.
2020-09-18 16:55:23 +00:00
smtutil::SortPointer functionBodySort(FunctionDefinition const& _function, ContractDefinition const* _contract, SymbolicState& _state);
2020-09-08 14:52:58 +00:00
/// @returns the sort of a predicate without parameters.
smtutil::SortPointer arity0FunctionSort();
/// Helpers
std::vector<smtutil::SortPointer> stateSorts(ContractDefinition const& _contract) ;
}