#include "formula_profile.h"

// Example matcher for smoke tests. Real matcher packages should replace this
// with a conservative structural boundary for their target solver.
LYMPHOSAT_MATCHER {
    if (profile.parse_error) {
        return false;
    }

    const auto is_pbl_style = [&]() {
        return !profile.truncated &&
               profile.distinct_clause_len_count >= 4 &&
               profile.positive_block_candidate_len >= 3 &&
               profile.positive_block_candidate_len <= 9 &&
               profile.binary_clause_fraction > 0.0 &&
               profile.binary_clause_fraction < 0.009 &&
               profile.binary_graph_degree_mean >= 1.0 &&
               profile.binary_graph_degree_mean <= 4.1 &&
               profile.avg_clause_len >= 6.5 &&
               profile.avg_clause_len <= 8.7 &&
               profile.mixed_clause_fraction >= 0.95 &&
               profile.normalized_clause_span_mean >= 0.72 &&
               profile.small_span_clause_fraction <= 0.001 &&
               profile.positive_block_clause_fraction <= 0.02;
    };

    const auto is_grid_pbl_style = [&]() {
        return !profile.truncated &&
               profile.positive_block_candidate_len == 4 &&
               profile.distinct_clause_len_count >= 3 &&
               profile.distinct_clause_len_count <= 4 &&
               profile.binary_clause_fraction > 0.001 &&
               profile.binary_clause_fraction < 0.009 &&
               profile.binary_graph_degree_mean >= 0.9 &&
               profile.binary_graph_degree_mean <= 1.1 &&
               profile.avg_clause_len >= 3.95 &&
               profile.avg_clause_len <= 4.02 &&
               profile.dominant_clause_len_fraction >= 0.99 &&
               profile.horn_clause_fraction >= 0.30 &&
               profile.horn_clause_fraction <= 0.33 &&
               profile.dual_horn_clause_fraction >= 0.30 &&
               profile.dual_horn_clause_fraction <= 0.33 &&
               profile.mixed_clause_fraction >= 0.86 &&
               profile.mixed_clause_fraction <= 0.89 &&
               profile.normalized_clause_span_mean >= 0.59 &&
               profile.normalized_clause_span_mean <= 0.61 &&
               profile.positive_block_clause_fraction >= 0.055 &&
               profile.positive_block_clause_fraction <= 0.07 &&
               profile.small_span_clause_fraction <= 0.001;
    };

    const auto is_peb_pyrofpyr_style = [&]() {
        return profile.distinct_clause_len_count == 3 &&
               profile.positive_block_candidate_len == 7 &&
               profile.binary_clause_fraction > 0.0 &&
               profile.binary_clause_fraction < 0.001 &&
               profile.binary_graph_degree_mean >= 3.5 &&
               profile.binary_graph_degree_mean <= 4.5 &&
               profile.avg_clause_len >= 6.8 &&
               profile.avg_clause_len <= 7.2 &&
               profile.dominant_clause_len == 7 &&
               profile.dominant_clause_len_fraction >= 0.999 &&
               profile.mixed_clause_fraction >= 0.983 &&
               profile.normalized_clause_span_mean >= 0.74 &&
               profile.positive_block_clause_fraction <= 0.01 &&
               profile.small_span_clause_fraction <= 0.0001;
    };

    const auto is_pbl_unsat_variant = [&]() {
        return !profile.truncated &&
               profile.distinct_clause_len_count >= 10 &&
               profile.positive_block_candidate_len == 6 &&
               profile.positive_block_candidate_count >= 500 &&
               profile.positive_block_candidate_count <= 700 &&
               profile.binary_clause_fraction >= 0.001 &&
               profile.binary_clause_fraction <= 0.0014 &&
               profile.binary_graph_degree_mean >= 1.4 &&
               profile.binary_graph_degree_mean <= 1.7 &&
               profile.avg_clause_len >= 7.6 &&
               profile.avg_clause_len <= 7.8 &&
               profile.mixed_clause_fraction >= 0.93 &&
               profile.mixed_clause_fraction <= 0.94 &&
               profile.normalized_clause_span_mean >= 0.72 &&
               profile.normalized_clause_span_mean <= 0.74 &&
               profile.positive_block_clause_fraction >= 0.05 &&
               profile.positive_block_clause_fraction <= 0.06;
    };

    return is_pbl_style() || is_grid_pbl_style() || is_peb_pyrofpyr_style() ||
           is_pbl_unsat_variant();
}
