pub fn as_sat_clauses(&self, port_lit: sat::Literal) -> Vec<sat::Clause> {
        if self.is_atomic() {
            // Consequence is a single positive link literal.  The
            // rule is a single two-literal port-link clause.

            vec![sat::Clause::from_pair(self.span[0].into_sat_literal(false), port_lit, "atomic")]
        } else if self.is_singular() {
            // Consequence is a conjunction of _N_ >= 2 positive link
            // literals.  The rule is a sequence of _N_ two-literal
            // port-link clauses.

            self.span
                .iter()
                .map(|id| sat::Clause::from_pair(id.into_sat_literal(false), port_lit, "singular"))
                .collect()
        } else {
            // Consequence is a disjunction of _M_ >= 2 statements,
            // each being a conjunction of _N_ >= 2 positive and
            // negative (at least one of each) link literals.  The
            // rule (after being expanded to CNF by distribution) is a
            // sequence of _N_^_M_ port-link clauses, each consisting
            // of the `port_lit` and _M_ link literals.

            let mut clauses = Vec::new();

            let num_pits = self.pits.len();
            let num_dots = self.span.len();

            let clause_table_row = self.span.iter().map(|id| id.into_sat_literal(false));

            let mut clause_table: Vec<_> = self
                .pits
                .iter()
                .map(|pit| {
                    pit.iter()
                        .zip(clause_table_row.clone())
                        .map(|(bit, lit)| if bit { lit } else { !lit })
                        .collect()
                })
                .collect();

            clause_table.push(vec![port_lit]);

            let mut cursors = vec![0; num_pits + 1];
            let mut pit_ndx = 0;

            let mut num_tautologies = 0;
            let mut num_repeated_literals = 0;

            'outer: loop {
                let lits = cursors.iter().enumerate().map(|(row, &col)| clause_table[row][col]);

                if let Some(clause) = sat::Clause::from_literals_checked(lits, "frame pit") {
                    num_repeated_literals += num_pits + 1 - clause.len();
                    clauses.push(clause);
                } else {
                    num_tautologies += 1;
                }

                'inner: loop {
                    if cursors[pit_ndx] < num_dots - 1 {
                        cursors[pit_ndx] += 1;

                        for cursor in cursors.iter_mut().take(pit_ndx) {
                            *cursor = 0;
                        }
                        pit_ndx = 0;

                        break 'inner
                    } else if pit_ndx < num_pits - 1 {
                        cursors[pit_ndx] = 0;
                        pit_ndx += 1;
                    } else {
                        break 'outer
                    }
                }
            }

            info!(
                "Pushing {} frame subterm clauses (removed {} tautologies and {} repeated \
                 literals)",
                clauses.len(),
                num_tautologies,
                num_repeated_literals,
            );

            clauses
        }
    }
/// Constructs the firing rule of this frame, the logical
/// constraint imposed on firing components, if the frame is
/// attached to the oriented (with polarity) dot represented by
/// `port_lit`.  The rule is transformed into a CNF formula, a
/// conjunction of disjunctions of [`sat::Literal`]s (a sequence
/// of clauses).
///
/// Returns a sequence of clauses in the form of vector of vectors
/// of [`sat::Literal`]s.
Constructs the firing rule of this frame, the logical
constraint imposed on firing components, if the frame is
attached to the oriented (with polarity) dot represented by
`port_lit`.  The rule is transformed into a CNF formula, a
conjunction of disjunctions of [`sat::Literal`]s (a sequence
of clauses).

Returns a sequence of clauses in the form of vector of vectors
of [`sat::Literal`]s.
Constructs the firing rule of this frame the logical constraint imposed on firing components if the frame is attached to the oriented ( with polarity ) dot represented by ` port_lit ` . The rule is transformed into a CNF formula a conjunction of disjunctions of [ ` sat :: Literal ` ] s ( a sequence of clauses ) . Returns a sequence of clauses in the form of vector of vectors of [ ` sat :: Literal ` ] s .
pub fn as_sat_clauses(&self, port_lit: sat::Literal) -> Vec<sat::Clause> {
        if self.is_atomic() {
            // Consequence is a single positive link literal.  The
            // rule is a single two-literal port-link clause.
            vec![sat::Clause::from_pair(self.span[0].into_sat_literal(false), port_lit, "atomic")]
        } else if self.is_singular() {
            // Consequence is a conjunction of _N_ >= 2 positive link
            // literals.  The rule is a sequence of _N_ two-literal
            // port-link clauses.
            self.span
                .iter()
                .map(|id| sat::Clause::from_pair(id.into_sat_literal(false), port_lit, "singular"))
                .collect()
        } else {
            // Consequence is a disjunction of _M_ >= 2 statements,
            // each being a conjunction of _N_ >= 2 positive and
            // negative (at least one of each) link literals.  The
            // rule (after being expanded to CNF by distribution) is a
            // sequence of _N_^_M_ port-link clauses, each consisting
            // of the `port_lit` and _M_ link literals.
            let mut clauses = Vec::new();
            let num_pits = self.pits.len();
            let num_dots = self.span.len();
            let clause_table_row = self.span.iter().map(|id| id.into_sat_literal(false));
            let mut clause_table: Vec<_> = self
                .pits
                .iter()
                .map(|pit| {
                    pit.iter()
                        .zip(clause_table_row.clone())
                        .map(|(bit, lit)| if bit { lit } else { !lit })
                        .collect()
                })
                .collect();
            clause_table.push(vec![port_lit]);
            let mut cursors = vec![0; num_pits + 1];
            let mut pit_ndx = 0;
            let mut num_tautologies = 0;
            let mut num_repeated_literals = 0;
            'outer: loop {
                let lits = cursors.iter().enumerate().map(|(row, &col)| clause_table[row][col]);
                if let Some(clause) = sat::Clause::from_literals_checked(lits, "frame pit") {
                    num_repeated_literals += num_pits + 1 - clause.len();
                    clauses.push(clause);
                } else {
                    num_tautologies += 1;
                }
                'inner: loop {
                    if cursors[pit_ndx] < num_dots - 1 {
                        cursors[pit_ndx] += 1;
                        for cursor in cursors.iter_mut().take(pit_ndx) {
                            *cursor = 0;
                        }
                        pit_ndx = 0;
                        break 'inner
                    } else if pit_ndx < num_pits - 1 {
                        cursors[pit_ndx] = 0;
                        pit_ndx += 1;
                    } else {
                        break 'outer
                    }
                }
            }
            info!(
                "Pushing {} frame subterm clauses (removed {} tautologies and {} repeated \
                 literals)",
                clauses.len(),
                num_tautologies,
                num_repeated_literals,
            );
            clauses
        }
    }
pub fn as_sat_clauses ( & self , port_lit : sat :: Literal ) -> Vec < sat :: Clause > { if self . is_atomic ( ) { // Consequence is a single positive link literal.  The // rule is a single two-literal port-link clause. vec ! [ sat Clause from_pair ( self span [ 0 ] into_sat_literal ( false ) port_lit " " ) ] } else if self . is_singular ( ) { // Consequence is a conjunction of _N_ >= 2 positive link // literals.  The rule is a sequence of _N_ two-literal // port-link clauses. self . span . iter ( ) . map ( | id | sat :: Clause :: from_pair ( id . into_sat_literal ( false ) , port_lit , " " ) ) . collect ( ) } else { // Consequence is a disjunction of _M_ >= 2 statements, // each being a conjunction of _N_ >= 2 positive and // negative (at least one of each) link literals.  The // rule (after being expanded to CNF by distribution) is a // sequence of _N_^_M_ port-link clauses, each consisting // of the `port_lit` and _M_ link literals. let mut clauses = Vec :: new ( ) ; let num_pits = self . pits . len ( ) ; let num_dots = self . span . len ( ) ; let clause_table_row = self . span . iter ( ) . map ( | id | id . into_sat_literal ( false ) ) ; let mut clause_table : Vec < _ > = self . pits . iter ( ) . map ( | pit | { pit . iter ( ) . zip ( clause_table_row . clone ( ) ) . map ( | ( bit , lit ) | if bit { lit } else { ! lit } ) . collect ( ) } ) . collect ( ) ; clause_table . push ( vec ! [ port_lit ] ) ; let mut cursors = vec ! [ 0 num_pits 1 ] ; let mut pit_ndx = 0 ; let mut num_tautologies = 0 ; let mut num_repeated_literals = 0 ; ' outer : loop { let lits = cursors . iter ( ) . enumerate ( ) . map ( | ( row , & col ) | clause_table [ row ] [ col ] ) ; if let Some ( clause ) = sat :: Clause :: from_literals_checked ( lits , " " ) { num_repeated_literals += num_pits + 1 - clause . len ( ) ; clauses . push ( clause ) ; } else { num_tautologies += 1 ; } ' inner : loop { if cursors [ pit_ndx ] < num_dots - 1 { cursors [ pit_ndx ] += 1 ; for cursor in cursors . iter_mut ( ) . take ( pit_ndx ) { * cursor = 0 ; } pit_ndx = 0 ; break ' inner } else if pit_ndx < num_pits - 1 { cursors [ pit_ndx ] = 0 ; pit_ndx += 1 ; } else { break ' outer } } } info ! ( " \
 " clauses len ( ) num_tautologies num_repeated_literals ) ; clauses } }
Constructs the firing rule of this frame, the logical
constraint imposed on firing components, if the frame is
attached to the oriented (with polarity) dot represented by
`port_lit`.
Constructs the firing rule of this frame the logical constraint imposed on firing components if the frame is attached to the oriented ( with polarity ) dot represented by ` port_lit ` .
&self
port_lit
sat::Literal
&self
port_lit
sat::Literal