metaSMT git

metaSMT/transform/satClause.hpp

Go to the documentation of this file.
00001 #pragma once
00002 #include "../tags/SAT.hpp"
00003 #include <boost/mpl/int.hpp>
00004 #include <boost/fusion/include/vector.hpp>
00005 #include <boost/fusion/include/as_vector.hpp>
00006 #include <boost/fusion/include/joint_view.hpp>
00007 #include <boost/fusion/include/single_view.hpp>
00008 
00009 #include <boost/proto/core.hpp>
00010   
00011 namespace metaSMT {
00012   namespace transform {
00013     namespace proto = boost::proto;
00014 
00015     struct satClauseArity
00016       : proto::or_<
00017             proto::when<proto::terminal<proto::_>, boost::mpl::int_<1>()>
00018           , proto::otherwise<proto::fold<proto::_, boost::mpl::int_<0>(), boost::mpl::plus<proto::_state, satClauseArity>()> >
00019       > {};
00020 
00021 
00022     struct satClause 
00023       : proto::or_<
00024         proto::when<
00025           proto::terminal<proto::_>
00026           , boost::fusion::single_view<
00027             proto::_value
00028           > ( 
00029             proto::_value
00030           )
00031         >
00032         , proto::when<
00033             proto::plus<satClause, satClause>
00034           , boost::fusion::joint_view<
00035               boost::add_const<satClause(proto::_left) >
00036             , boost::add_const<satClause(proto::_right) >
00037           >(satClause(proto::_left), satClause(proto::_right))
00038         >
00039         , proto::when<
00040             proto::negate< proto::negate<proto::_> >
00041           , satClause(proto::_child(proto::_child))
00042         >
00043         , proto::when<
00044             proto::negate< proto::terminal<proto::_> >
00045           , boost::fusion::single_view<
00046               proto::call<std::negate<SAT::tag::lit_tag> >(
00047                 proto::_value(proto::_child)
00048               )
00049             > ( 
00050               proto::call<std::negate<SAT::tag::lit_tag> >(
00051                 proto::_value(proto::_child)
00052               )
00053             )
00054         >
00055      > {};
00056 
00057 
00058   } /* transform */
00059 } /* metaSMT */
00060 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines