Lattice land propagators completion library
Loading...
Searching...
No Matches
lala::pc::Formula< AD, Allocator > Class Template Reference

#include <formula.hpp>

Public Types

using A = AD
 
using allocator_type = Allocator
 
using this_type = Formula<A, allocator_type>
 
using U = typename A::local_universe
 
using term_type = Term<A, allocator_type>
 
using this_ptr = battery::unique_ptr<this_type, allocator_type>
 
using PVarLit = VariableLiteral<A, false>
 
using NVarLit = VariableLiteral<A, true>
 
using Leq = InequalityLEQ<A, allocator_type>
 
using Gt = InequalityGT<A, allocator_type>
 
using Eq = Equality<A, allocator_type>
 
using Neq = Disequality<A, allocator_type>
 
using Conj = Conjunction<A, allocator_type>
 
using Disj = Disjunction<A, allocator_type>
 
using Bicond = Biconditional<A, allocator_type>
 
using Imply = Implication<A, allocator_type>
 
using Xor = ExclusiveDisjunction<A, allocator_type>
 
using AE = AbstractElement<A, allocator_type>
 
using tell_type = typename A::template tell_type<allocator_type>
 
using ask_type = typename A::template ask_type<allocator_type>
 

Public Member Functions

 Formula ()=default
 
 Formula (this_type &&)=default
 
this_typeoperator= (this_type &&)=default
 
template<class A2 , class Alloc2 >
CUDA Formula (const Formula< A2, Alloc2 > &other, const Allocator &allocator=Allocator())
 
CUDA bool is (size_t kind) const
 
CUDA size_t kind () const
 
CUDA bool embed (A &a, const U &u) const
 
CUDA void project (const A &a, U &r) const
 
CUDA void print (const A &a) const
 
template<class Env , class Allocator2 = typename Env::allocator_type>
CUDA TFormula< Allocator2 > deinterpret (const A &a, const Env &env, AType apc, Allocator2 allocator=Allocator2()) const
 
CUDA local::B ask (const A &a) const
 
CUDA local::B nask (const A &a) const
 
CUDA bool deduce (A &a) const
 
CUDA bool contradeduce (A &a) const
 
CUDA size_t length () const
 

Static Public Member Functions

template<size_t I, class SubFormula >
static CUDA this_type make (SubFormula &&sub_formula)
 
static CUDA this_type make_pvarlit (const AVar &avar)
 
static CUDA this_type make_nvarlit (const AVar &avar)
 
static CUDA this_type make_true ()
 
static CUDA this_type make_false ()
 
static CUDA this_type make_leq (term_type &&left, term_type &&right)
 
static CUDA this_type make_gt (term_type &&left, term_type &&right)
 
static CUDA this_type make_eq (term_type &&left, term_type &&right)
 
static CUDA this_type make_neq (term_type &&left, term_type &&right)
 
static CUDA this_type make_conj (this_ptr &&left, this_ptr &&right)
 
static CUDA this_type make_disj (this_ptr &&left, this_ptr &&right)
 
static CUDA this_type make_bicond (this_ptr &&left, this_ptr &&right)
 
static CUDA this_type make_imply (this_ptr &&left, this_ptr &&right)
 
static CUDA this_type make_xor (this_ptr &&left, this_ptr &&right)
 
static CUDA this_type make_abstract_element (tell_type &&tellv, tell_type &&not_tellv, ask_type &&askv, ask_type &&not_askv)
 

Static Public Attributes

static constexpr size_t IPVarLit = 0
 
static constexpr size_t INVarLit = IPVarLit + 1
 
static constexpr size_t ITrue = INVarLit + 1
 
static constexpr size_t IFalse = ITrue + 1
 
static constexpr size_t ILeq = IFalse + 1
 
static constexpr size_t IGt = ILeq + 1
 
static constexpr size_t IEq = IGt + 1
 
static constexpr size_t INeq = IEq + 1
 
static constexpr size_t IConj = INeq + 1
 
static constexpr size_t IDisj = IConj + 1
 
static constexpr size_t IBicond = IDisj + 1
 
static constexpr size_t IImply = IBicond + 1
 
static constexpr size_t IXor = IImply + 1
 
static constexpr size_t IAE = IXor + 1
 

Friends

template<class A2 , class Alloc2 >
class Formula
 

Detailed Description

template<class AD, class Allocator>
class lala::pc::Formula< AD, Allocator >

A formula can occur in a term, e.g., (x = 2) + (y = 2) + (z = 2) >= 2 In that case, the entailment of the formula is mapped onto a sublattice of U supporting initialization from 0 and 1. A term can occur in a formula, as it is usually done. Therefore, a formula is both a formula and a term.

A logical formula is turned into a term by mapping their satisfiability to and from a sublattice of U representing Boolean values:

  • Consists of four distinct values \(\{[\![x = 0]\!]_U \sqcap [\![x = 1]\!]_U, [\![x = 0]\!]_U, [\![x = 1]\!]_U, \top_U \}\).
  • With \(\{[\![x = 0]\!]_U \sqcap [\![x = 1]\!]_U \) meaning neither true or false yet (e.g., unknown), \(\{[\![x = 0]\!]_U \) modelling falsity, \( [\![x = 1]\!]_U \) modelling truth, and \( \top_U \) a logical statement both true and false (i.e., one of the variable is top).

Member Typedef Documentation

◆ A

template<class AD , class Allocator >
using lala::pc::Formula< AD, Allocator >::A = AD

◆ allocator_type

template<class AD , class Allocator >
using lala::pc::Formula< AD, Allocator >::allocator_type = Allocator

◆ this_type

template<class AD , class Allocator >
using lala::pc::Formula< AD, Allocator >::this_type = Formula<A, allocator_type>

◆ U

template<class AD , class Allocator >
using lala::pc::Formula< AD, Allocator >::U = typename A::local_universe

◆ term_type

template<class AD , class Allocator >
using lala::pc::Formula< AD, Allocator >::term_type = Term<A, allocator_type>

◆ this_ptr

template<class AD , class Allocator >
using lala::pc::Formula< AD, Allocator >::this_ptr = battery::unique_ptr<this_type, allocator_type>

◆ PVarLit

template<class AD , class Allocator >
using lala::pc::Formula< AD, Allocator >::PVarLit = VariableLiteral<A, false>

◆ NVarLit

template<class AD , class Allocator >
using lala::pc::Formula< AD, Allocator >::NVarLit = VariableLiteral<A, true>

◆ Leq

template<class AD , class Allocator >
using lala::pc::Formula< AD, Allocator >::Leq = InequalityLEQ<A, allocator_type>

◆ Gt

template<class AD , class Allocator >
using lala::pc::Formula< AD, Allocator >::Gt = InequalityGT<A, allocator_type>

◆ Eq

template<class AD , class Allocator >
using lala::pc::Formula< AD, Allocator >::Eq = Equality<A, allocator_type>

◆ Neq

template<class AD , class Allocator >
using lala::pc::Formula< AD, Allocator >::Neq = Disequality<A, allocator_type>

◆ Conj

template<class AD , class Allocator >
using lala::pc::Formula< AD, Allocator >::Conj = Conjunction<A, allocator_type>

◆ Disj

template<class AD , class Allocator >
using lala::pc::Formula< AD, Allocator >::Disj = Disjunction<A, allocator_type>

◆ Bicond

template<class AD , class Allocator >
using lala::pc::Formula< AD, Allocator >::Bicond = Biconditional<A, allocator_type>

◆ Imply

template<class AD , class Allocator >
using lala::pc::Formula< AD, Allocator >::Imply = Implication<A, allocator_type>

◆ Xor

template<class AD , class Allocator >
using lala::pc::Formula< AD, Allocator >::Xor = ExclusiveDisjunction<A, allocator_type>

◆ AE

template<class AD , class Allocator >
using lala::pc::Formula< AD, Allocator >::AE = AbstractElement<A, allocator_type>

◆ tell_type

template<class AD , class Allocator >
using lala::pc::Formula< AD, Allocator >::tell_type = typename A::template tell_type<allocator_type>

◆ ask_type

template<class AD , class Allocator >
using lala::pc::Formula< AD, Allocator >::ask_type = typename A::template ask_type<allocator_type>

Constructor & Destructor Documentation

◆ Formula() [1/3]

template<class AD , class Allocator >
lala::pc::Formula< AD, Allocator >::Formula ( )
default

◆ Formula() [2/3]

template<class AD , class Allocator >
lala::pc::Formula< AD, Allocator >::Formula ( this_type && )
default

◆ Formula() [3/3]

template<class AD , class Allocator >
template<class A2 , class Alloc2 >
CUDA lala::pc::Formula< AD, Allocator >::Formula ( const Formula< A2, Alloc2 > & other,
const Allocator & allocator = Allocator() )
inline

Member Function Documentation

◆ operator=()

template<class AD , class Allocator >
this_type & lala::pc::Formula< AD, Allocator >::operator= ( this_type && )
default

◆ is()

template<class AD , class Allocator >
CUDA bool lala::pc::Formula< AD, Allocator >::is ( size_t kind) const
inline

◆ kind()

template<class AD , class Allocator >
CUDA size_t lala::pc::Formula< AD, Allocator >::kind ( ) const
inline

◆ make()

template<class AD , class Allocator >
template<size_t I, class SubFormula >
static CUDA this_type lala::pc::Formula< AD, Allocator >::make ( SubFormula< AD, Allocator > && sub_formula)
inlinestatic

◆ make_pvarlit()

template<class AD , class Allocator >
static CUDA this_type lala::pc::Formula< AD, Allocator >::make_pvarlit ( const AVar & avar)
inlinestatic

◆ make_nvarlit()

template<class AD , class Allocator >
static CUDA this_type lala::pc::Formula< AD, Allocator >::make_nvarlit ( const AVar & avar)
inlinestatic

◆ make_true()

template<class AD , class Allocator >
static CUDA this_type lala::pc::Formula< AD, Allocator >::make_true ( )
inlinestatic

◆ make_false()

template<class AD , class Allocator >
static CUDA this_type lala::pc::Formula< AD, Allocator >::make_false ( )
inlinestatic

◆ make_leq()

template<class AD , class Allocator >
static CUDA this_type lala::pc::Formula< AD, Allocator >::make_leq ( term_type && left,
term_type && right )
inlinestatic

◆ make_gt()

template<class AD , class Allocator >
static CUDA this_type lala::pc::Formula< AD, Allocator >::make_gt ( term_type && left,
term_type && right )
inlinestatic

◆ make_eq()

template<class AD , class Allocator >
static CUDA this_type lala::pc::Formula< AD, Allocator >::make_eq ( term_type && left,
term_type && right )
inlinestatic

◆ make_neq()

template<class AD , class Allocator >
static CUDA this_type lala::pc::Formula< AD, Allocator >::make_neq ( term_type && left,
term_type && right )
inlinestatic

◆ make_conj()

template<class AD , class Allocator >
static CUDA this_type lala::pc::Formula< AD, Allocator >::make_conj ( this_ptr && left,
this_ptr && right )
inlinestatic

◆ make_disj()

template<class AD , class Allocator >
static CUDA this_type lala::pc::Formula< AD, Allocator >::make_disj ( this_ptr && left,
this_ptr && right )
inlinestatic

◆ make_bicond()

template<class AD , class Allocator >
static CUDA this_type lala::pc::Formula< AD, Allocator >::make_bicond ( this_ptr && left,
this_ptr && right )
inlinestatic

◆ make_imply()

template<class AD , class Allocator >
static CUDA this_type lala::pc::Formula< AD, Allocator >::make_imply ( this_ptr && left,
this_ptr && right )
inlinestatic

◆ make_xor()

template<class AD , class Allocator >
static CUDA this_type lala::pc::Formula< AD, Allocator >::make_xor ( this_ptr && left,
this_ptr && right )
inlinestatic

◆ make_abstract_element()

template<class AD , class Allocator >
static CUDA this_type lala::pc::Formula< AD, Allocator >::make_abstract_element ( tell_type && tellv,
tell_type && not_tellv,
ask_type && askv,
ask_type && not_askv )
inlinestatic

◆ embed()

template<class AD , class Allocator >
CUDA bool lala::pc::Formula< AD, Allocator >::embed ( A & a,
const U & u ) const
inline

Call deduce iff \( u \leq [\![x = 1]\!]_U \) and contradeduce iff \( u \leq [\![x = 0]\!] \).

◆ project()

template<class AD , class Allocator >
CUDA void lala::pc::Formula< AD, Allocator >::project ( const A & a,
U & r ) const
inline

Maps the truth value of \( \varphi \) to the Boolean sublattice of U (see above).

◆ print()

template<class AD , class Allocator >
CUDA void lala::pc::Formula< AD, Allocator >::print ( const A & a) const
inline

◆ deinterpret()

template<class AD , class Allocator >
template<class Env , class Allocator2 = typename Env::allocator_type>
CUDA TFormula< Allocator2 > lala::pc::Formula< AD, Allocator >::deinterpret ( const A & a,
const Env & env,
AType apc,
Allocator2 allocator = Allocator2() ) const
inline

◆ ask()

template<class AD , class Allocator >
CUDA local::B lala::pc::Formula< AD, Allocator >::ask ( const A & a) const
inline

Given a formula \( \varphi \), the ask operation \( a \vDash \varphi \) holds whenever we can deduce \( \varphi \) from \( a \). More precisely, if \( \gamma(a) \subseteq [\![\varphi]\!]^\flat \), which implies that \( \varphi \) cannot remove further deduce \( a \) since \( a \) is already more precise than \( \varphi \).

◆ nask()

template<class AD , class Allocator >
CUDA local::B lala::pc::Formula< AD, Allocator >::nask ( const A & a) const
inline

Similar to ask but for \( \lnot{\varphi} \).

◆ deduce()

template<class AD , class Allocator >
CUDA bool lala::pc::Formula< AD, Allocator >::deduce ( A & a) const
inline

Refine the formula by supposing it must be true.

◆ contradeduce()

template<class AD , class Allocator >
CUDA bool lala::pc::Formula< AD, Allocator >::contradeduce ( A & a) const
inline

Refine the negation of the formula, hence we suppose the original formula needs to be false.

◆ length()

template<class AD , class Allocator >
CUDA size_t lala::pc::Formula< AD, Allocator >::length ( ) const
inline

Friends And Related Symbol Documentation

◆ Formula

template<class AD , class Allocator >
template<class A2 , class Alloc2 >
friend class Formula
friend

Member Data Documentation

◆ IPVarLit

template<class AD , class Allocator >
size_t lala::pc::Formula< AD, Allocator >::IPVarLit = 0
staticconstexpr

◆ INVarLit

template<class AD , class Allocator >
size_t lala::pc::Formula< AD, Allocator >::INVarLit = IPVarLit + 1
staticconstexpr

◆ ITrue

template<class AD , class Allocator >
size_t lala::pc::Formula< AD, Allocator >::ITrue = INVarLit + 1
staticconstexpr

◆ IFalse

template<class AD , class Allocator >
size_t lala::pc::Formula< AD, Allocator >::IFalse = ITrue + 1
staticconstexpr

◆ ILeq

template<class AD , class Allocator >
size_t lala::pc::Formula< AD, Allocator >::ILeq = IFalse + 1
staticconstexpr

◆ IGt

template<class AD , class Allocator >
size_t lala::pc::Formula< AD, Allocator >::IGt = ILeq + 1
staticconstexpr

◆ IEq

template<class AD , class Allocator >
size_t lala::pc::Formula< AD, Allocator >::IEq = IGt + 1
staticconstexpr

◆ INeq

template<class AD , class Allocator >
size_t lala::pc::Formula< AD, Allocator >::INeq = IEq + 1
staticconstexpr

◆ IConj

template<class AD , class Allocator >
size_t lala::pc::Formula< AD, Allocator >::IConj = INeq + 1
staticconstexpr

◆ IDisj

template<class AD , class Allocator >
size_t lala::pc::Formula< AD, Allocator >::IDisj = IConj + 1
staticconstexpr

◆ IBicond

template<class AD , class Allocator >
size_t lala::pc::Formula< AD, Allocator >::IBicond = IDisj + 1
staticconstexpr

◆ IImply

template<class AD , class Allocator >
size_t lala::pc::Formula< AD, Allocator >::IImply = IBicond + 1
staticconstexpr

◆ IXor

template<class AD , class Allocator >
size_t lala::pc::Formula< AD, Allocator >::IXor = IImply + 1
staticconstexpr

◆ IAE

template<class AD , class Allocator >
size_t lala::pc::Formula< AD, Allocator >::IAE = IXor + 1
staticconstexpr

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