pub fn add_constraint(&mut self, term: &Term) -> PolarResult<()> {
        self.do_followers(|_, follower| follower.add_constraint(term))?;

        assert!(term.value().as_expression().is_ok());
        let mut op = op!(And, term.clone());
        for var in op.variables().iter().rev() {
            match self._variable_state(&var) {
                BindingManagerVariableState::Unbound => {}
                BindingManagerVariableState::Cycle(c) => {
                    let mut cycle = cycle_constraints(c);
                    cycle.merge_constraints(op.clone());
                    op = cycle;
                }
                BindingManagerVariableState::Partial(e) => {
                    let mut e = e.clone();
                    e.merge_constraints(op);
                    op = e;
                }
                BindingManagerVariableState::Bound(v) => {
                    panic!(
                        "Unexpected bound variable {var} in constraint. {var} = {val}",
                        var = var,
                        val = v
                    );
                }
            }
        }

        self.constrain(&op)
    }
/// Add a constraint. Constraints are represented as term expressions.
///
/// `term` must be an expression`.
///
/// An error is returned if the constraint is incompatible with existing constraints.
///
/// (Currently all constraints are considered compatible).
Add a constraint. Constraints are represented as term expressions.
`term` must be an expression`.

An error is returned if the constraint is incompatible with existing constraints.

(Currently all constraints are considered compatible).
Add a constraint . Constraints are represented as term expressions . ` term ` must be an expression ` . An error is returned if the constraint is incompatible with existing constraints . ( Currently all constraints are considered compatible ) .
pub fn add_constraint(&mut self, term: &Term) -> PolarResult<()> {
        self.do_followers(|_, follower| follower.add_constraint(term))?;
        assert!(term.value().as_expression().is_ok());
        let mut op = op!(And, term.clone());
        for var in op.variables().iter().rev() {
            match self._variable_state(&var) {
                BindingManagerVariableState::Unbound => {}
                BindingManagerVariableState::Cycle(c) => {
                    let mut cycle = cycle_constraints(c);
                    cycle.merge_constraints(op.clone());
                    op = cycle;
                }
                BindingManagerVariableState::Partial(e) => {
                    let mut e = e.clone();
                    e.merge_constraints(op);
                    op = e;
                }
                BindingManagerVariableState::Bound(v) => {
                    panic!(
                        "Unexpected bound variable {var} in constraint. {var} = {val}",
                        var = var,
                        val = v
                    );
                }
            }
        }
        self.constrain(&op)
    }
pub fn add_constraint ( & mut self , term : & Term ) -> PolarResult < ( ) > { self . do_followers ( | _ , follower | follower . add_constraint ( term ) ) ? ; assert ! ( term value ( ) as_expression ( ) is_ok ( ) ) ; let mut op = op ! ( And term clone ( ) ) ; for var in op . variables ( ) . iter ( ) . rev ( ) { match self . _variable_state ( & var ) { BindingManagerVariableState :: Unbound => { } BindingManagerVariableState :: Cycle ( c ) => { let mut cycle = cycle_constraints ( c ) ; cycle . merge_constraints ( op . clone ( ) ) ; op = cycle ; } BindingManagerVariableState :: Partial ( e ) => { let mut e = e . clone ( ) ; e . merge_constraints ( op ) ; op = e ; } BindingManagerVariableState :: Bound ( v ) => { panic ! ( " " var var val v ) ; } } } self . constrain ( & op ) }
Add a constraint.
Add a constraint .
&mut self
term
&Term