CBMC
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
linear_functiont Class Reference

Canonical representation of linear function, for instance, expression $x + x - y + 5 - 3$ would given by constant_coefficient 2 and coefficients: x -> 2, y -> -1. More...

#include <string_constraint_instantiation.h>

+ Collaboration diagram for linear_functiont:

Public Member Functions

  Put an expression f composed of additions and subtractions into its cannonical representation.
 
  Make this function the sum of the current function with other.
 
 
std::string  format ()
  Format the linear function as a string, can be used for debugging.
 

Static Public Member Functions

  Return an expression y such that f(var <- y) = val.
 

Private Attributes

 
std::unordered_map< exprt, mp_integer, irep_hashcoefficients
 
 

Detailed Description

Canonical representation of linear function, for instance, expression $x + x - y + 5 - 3$ would given by constant_coefficient 2 and coefficients: x -> 2, y -> -1.

Definition at line 52 of file string_constraint_instantiation.h.

Constructor & Destructor Documentation

◆  linear_functiont()

linear_functiont::linear_functiont ( const exprtf )
explicit

Put an expression f composed of additions and subtractions into its cannonical representation.

Definition at line 60 of file string_constraint_instantiation.cpp.

Member Function Documentation

◆  add()

void linear_functiont::add ( const linear_functiontother )

Make this function the sum of the current function with other.

Definition at line 101 of file string_constraint_instantiation.cpp.

◆  format()

std::string linear_functiont::format ( )

Format the linear function as a string, can be used for debugging.

Definition at line 166 of file string_constraint_instantiation.cpp.

◆  solve()

exprt linear_functiont::solve ( linear_functiont  f,
const exprtvar,
const exprtval 
)
static

Return an expression y such that f(var <- y) = val.

The coefficient of var in the linear function must be 1 or -1. For instance, if f corresponds to the expression q + x, solve(q,v,f) returns the expression v - x.

Definition at line 146 of file string_constraint_instantiation.cpp.

◆  to_expr()

exprt linear_functiont::to_expr ( bool  negated = false ) const
Parameters
negated optional Boolean asking to negate the function
Returns
an expression corresponding to the linear function

Definition at line 109 of file string_constraint_instantiation.cpp.

Member Data Documentation

◆  coefficients

std::unordered_map<exprt, mp_integer, irep_hash> linear_functiont::coefficients
private

Definition at line 77 of file string_constraint_instantiation.h.

◆  constant_coefficient

mp_integer linear_functiont::constant_coefficient
private

Definition at line 76 of file string_constraint_instantiation.h.

◆  type

typet linear_functiont::type
private

Definition at line 78 of file string_constraint_instantiation.h.


The documentation for this class was generated from the following files:

AltStyle によって変換されたページ (->オリジナル) /