<commit_before>#ifndef _SNARKFRONT_RANK_1_OPS_HPP_
#define _SNARKFRONT_RANK_1_OPS_HPP_

#include <algorithm>
#include <cassert>
#include <cstdint>
#include <vector>
#include "PowersOf2.hpp"
#include <Rank1DSL.hpp> // snarklib
#include "TLsingleton.hpp"

namespace snarkfront {

////////////////////////////////////////////////////////////////////////////////
// variable consistency, enforce valid values
//

// constrain rank-1 variable to 0 and 1 values
template <template <typename> class SYS, typename FR>
void rank1_booleanity(SYS<FR>& S,
                      const snarklib::R1Variable<FR>& x)
{
#ifdef USE_ASSERT
    assert(! x.zeroIndex());
#endif
    S.addConstraint(x * (FR::one() - x) == FR::zero()); // only roots are 0 and 1
}

template <template <typename> class SYS, typename FR>
void rank1_booleanity(SYS<FR>& S,<commit_msg>scope header file paths<commit_after>#ifndef _SNARKFRONT_RANK_1_OPS_HPP_
#define _SNARKFRONT_RANK_1_OPS_HPP_

#include <algorithm>
#include <cassert>
#include <cstdint>
#include <vector>

#include <snarklib/Rank1DSL.hpp>

#include <snarkfront/PowersOf2.hpp>
#include <snarkfront/TLsingleton.hpp>

namespace snarkfront {

////////////////////////////////////////////////////////////////////////////////
// variable consistency, enforce valid values
//

// constrain rank-1 variable to 0 and 1 values
template <template <typename> class SYS, typename FR>
void rank1_booleanity(SYS<FR>& S,
                      const snarklib::R1Variable<FR>& x)
{
#ifdef USE_ASSERT
    assert(! x.zeroIndex());
#endif
    S.addConstraint(x * (FR::one() - x) == FR::zero()); // only roots are 0 and 1
}

template <template <typename> class SYS, typename FR>
void rank1_booleanity(SYS<FR>& S,
{'fraction_non_alphanumeric': 0.2072387624051372, 'fraction_numerical': 0.014010507880910683, 'mean_word_length': 2.9402298850574713, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5232679', 'n_tokens_mistral': 566, 'n_tokens_neox': 539, 'n_words': 145}