From 5780cc80c04597ecc5aa54aa2091524883adcd71 Mon Sep 17 00:00:00 2001 From: Calum C Date: Wed, 11 Mar 2026 14:17:00 +0000 Subject: [PATCH 01/16] feat(domain_debugging): Basic outline --- crates/conjure-cp-cli/src/pretty.rs | 3 ++- crates/conjure-cp-cli/src/utils/testing.rs | 29 ++++++++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/crates/conjure-cp-cli/src/pretty.rs b/crates/conjure-cp-cli/src/pretty.rs index 08dc5fa5b6..fff0f326c9 100644 --- a/crates/conjure-cp-cli/src/pretty.rs +++ b/crates/conjure-cp-cli/src/pretty.rs @@ -3,7 +3,7 @@ use std::{path::PathBuf, sync::Arc}; use anyhow::anyhow; use clap::ValueHint; -use conjure_cp_cli::utils::testing::serialize_model; +use conjure_cp_cli::utils::testing::{serialize_domains, serialize_model}; use crate::cli::{GlobalArgs, LOGGING_HELP_HEADING}; use crate::solve::{init_context, parse}; @@ -28,6 +28,7 @@ pub fn run_pretty_command(global_args: GlobalArgs, pretty_args: Args) -> anyhow: // Running the correct method to acquire pretty string let output = match pretty_args.output_format.as_str() { "ast-json" => serialize_model(&model), + "domains" => serialize_domains(&model), // "add_new_flag" => method(), _ => { return Err(anyhow!( diff --git a/crates/conjure-cp-cli/src/utils/testing.rs b/crates/conjure-cp-cli/src/utils/testing.rs index bf09b9c759..be80d3c852 100644 --- a/crates/conjure-cp-cli/src/utils/testing.rs +++ b/crates/conjure-cp-cli/src/utils/testing.rs @@ -1,4 +1,4 @@ -use std::collections::{BTreeMap, HashMap, HashSet}; +use std::collections::{BTreeMap, HashMap, HashSet, VecDeque}; use std::fmt::Debug; use std::path::Path; use std::{io, mem, vec}; @@ -7,13 +7,14 @@ use conjure_cp::ast::records::RecordValue; use conjure_cp::ast::serde::ObjId; use conjure_cp::bug; use itertools::Itertools as _; +use rayon::iter::ExponentialBlocks; use std::fs::File; use std::hash::Hash; use std::io::{BufRead, BufReader, Write}; use std::sync::{Arc, RwLock}; use uniplate::Uniplate; -use conjure_cp::ast::{AbstractLiteral, GroundDomain, Moo, SerdeModel}; +use conjure_cp::ast::{AbstractLiteral, Domain, Expression, GroundDomain, Moo, SerdeModel}; use conjure_cp::context::Context; use serde_json::{Error as JsonError, Value as JsonValue}; @@ -115,6 +116,30 @@ pub fn serialize_model(model: &ConjureModel) -> Result { serde_json::to_string_pretty(&sorted_json) } +// #[derive(Debug)] +struct ExprInfo { + pretty: String, + domain: Option>, + children: Vec, +} + +fn create_expr_info(expr: &Expression) -> ExprInfo { + let pretty = expr.to_string(); + let domain = expr.domain_of(); + let children = expr.children().iter().map(|x| create_expr_info(x)).collect(); + + ExprInfo { pretty, domain, children } +} + +pub fn serialize_domains(model: &ConjureModel) -> Result { + + let exprs: Vec = model.constraints().iter().map(|x| create_expr_info(x)).collect(); + serde_json::to_string(&exprs) + // Ok(format!("{:?}", exprs)) +} + + + pub fn save_model_json( model: &ConjureModel, path: &str, From 475aa8d8a6f802e81c9c4ba9369e81ff1668b63b Mon Sep 17 00:00:00 2001 From: Calum C Date: Wed, 11 Mar 2026 14:19:32 +0000 Subject: [PATCH 02/16] updating error printing --- crates/conjure-cp-cli/src/pretty.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/conjure-cp-cli/src/pretty.rs b/crates/conjure-cp-cli/src/pretty.rs index fff0f326c9..9fd4efbb5d 100644 --- a/crates/conjure-cp-cli/src/pretty.rs +++ b/crates/conjure-cp-cli/src/pretty.rs @@ -28,11 +28,11 @@ pub fn run_pretty_command(global_args: GlobalArgs, pretty_args: Args) -> anyhow: // Running the correct method to acquire pretty string let output = match pretty_args.output_format.as_str() { "ast-json" => serialize_model(&model), - "domains" => serialize_domains(&model), + "expr_domains" => serialize_domains(&model), // "add_new_flag" => method(), _ => { return Err(anyhow!( - "Unknown output format {}; supports [ast-json]", + "Unknown output format {}; supports [ast-json, expr_domains]", &pretty_args.output_format )); } From 1a9627ea3eb259d419226a9deabaf72feed610b6 Mon Sep 17 00:00:00 2001 From: Calum C Date: Wed, 11 Mar 2026 14:21:25 +0000 Subject: [PATCH 03/16] re-correct --- crates/conjure-cp-cli/src/utils/testing.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/conjure-cp-cli/src/utils/testing.rs b/crates/conjure-cp-cli/src/utils/testing.rs index be80d3c852..96ef842736 100644 --- a/crates/conjure-cp-cli/src/utils/testing.rs +++ b/crates/conjure-cp-cli/src/utils/testing.rs @@ -116,7 +116,7 @@ pub fn serialize_model(model: &ConjureModel) -> Result { serde_json::to_string_pretty(&sorted_json) } -// #[derive(Debug)] +#[derive(Debug)] struct ExprInfo { pretty: String, domain: Option>, @@ -134,8 +134,8 @@ fn create_expr_info(expr: &Expression) -> ExprInfo { pub fn serialize_domains(model: &ConjureModel) -> Result { let exprs: Vec = model.constraints().iter().map(|x| create_expr_info(x)).collect(); - serde_json::to_string(&exprs) - // Ok(format!("{:?}", exprs)) + // serde_json::to_string(&exprs) + Ok(format!("{:?}", exprs)) } From 4cc02a544ad3f969ebdf42aa857526c12e7ad45b Mon Sep 17 00:00:00 2001 From: Calum C Date: Wed, 11 Mar 2026 14:47:59 +0000 Subject: [PATCH 04/16] Putting the ExprInfo struct into the model file --- crates/conjure-cp-cli/src/utils/testing.rs | 19 +++++++++---------- crates/conjure-cp-core/src/ast/model.rs | 10 ++++++++++ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/crates/conjure-cp-cli/src/utils/testing.rs b/crates/conjure-cp-cli/src/utils/testing.rs index 96ef842736..43a766d600 100644 --- a/crates/conjure-cp-cli/src/utils/testing.rs +++ b/crates/conjure-cp-cli/src/utils/testing.rs @@ -7,14 +7,13 @@ use conjure_cp::ast::records::RecordValue; use conjure_cp::ast::serde::ObjId; use conjure_cp::bug; use itertools::Itertools as _; -use rayon::iter::ExponentialBlocks; use std::fs::File; use std::hash::Hash; use std::io::{BufRead, BufReader, Write}; use std::sync::{Arc, RwLock}; use uniplate::Uniplate; -use conjure_cp::ast::{AbstractLiteral, Domain, Expression, GroundDomain, Moo, SerdeModel}; +use conjure_cp::ast::{AbstractLiteral, Domain, Expression, GroundDomain, Moo, SerdeModel, ExprInfo}; use conjure_cp::context::Context; use serde_json::{Error as JsonError, Value as JsonValue}; @@ -116,12 +115,12 @@ pub fn serialize_model(model: &ConjureModel) -> Result { serde_json::to_string_pretty(&sorted_json) } -#[derive(Debug)] -struct ExprInfo { - pretty: String, - domain: Option>, - children: Vec, -} +// struct ExprInfo { +// /// # use serde_json::json; +// pretty: String, +// domain: Option>, +// children: Vec, +// } fn create_expr_info(expr: &Expression) -> ExprInfo { let pretty = expr.to_string(); @@ -134,8 +133,8 @@ fn create_expr_info(expr: &Expression) -> ExprInfo { pub fn serialize_domains(model: &ConjureModel) -> Result { let exprs: Vec = model.constraints().iter().map(|x| create_expr_info(x)).collect(); - // serde_json::to_string(&exprs) - Ok(format!("{:?}", exprs)) + serde_json::to_string_pretty(&exprs) + // Ok(format!("{:?}", exprs)) } diff --git a/crates/conjure-cp-core/src/ast/model.rs b/crates/conjure-cp-core/src/ast/model.rs index 8c265d9534..0b0120a764 100644 --- a/crates/conjure-cp-core/src/ast/model.rs +++ b/crates/conjure-cp-core/src/ast/model.rs @@ -3,6 +3,7 @@ use std::fmt::{Debug, Display}; use std::hash::Hash; use std::sync::{Arc, RwLock}; +use crate::ast::Domain; use crate::context::Context; use crate::{bug, into_matrix_expr}; use derivative::Derivative; @@ -549,3 +550,12 @@ impl SerdeModel { model.collect_stable_id_mapping() } } + +/// A struct for the information about expressions +#[serde_as] +#[derive(Serialize)] +pub struct ExprInfo { + pub pretty: String, + pub domain: Option>, + pub children: Vec, +} \ No newline at end of file From a724523b12608c5a0302fb167ba67fcefddd5b9e Mon Sep 17 00:00:00 2001 From: Calum C Date: Wed, 11 Mar 2026 23:06:03 +0000 Subject: [PATCH 05/16] change from expr_ to expression-, finish moving Info struct out of CLI, remove unused imports, change feild visability --- crates/conjure-cp-cli/src/pretty.rs | 4 +-- crates/conjure-cp-cli/src/utils/testing.rs | 30 +++++++--------------- crates/conjure-cp-core/src/ast/model.rs | 22 +++++++++++++--- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/crates/conjure-cp-cli/src/pretty.rs b/crates/conjure-cp-cli/src/pretty.rs index 9fd4efbb5d..b9f5715b4f 100644 --- a/crates/conjure-cp-cli/src/pretty.rs +++ b/crates/conjure-cp-cli/src/pretty.rs @@ -28,11 +28,11 @@ pub fn run_pretty_command(global_args: GlobalArgs, pretty_args: Args) -> anyhow: // Running the correct method to acquire pretty string let output = match pretty_args.output_format.as_str() { "ast-json" => serialize_model(&model), - "expr_domains" => serialize_domains(&model), + "expression-domains" => serialize_domains(&model), // "add_new_flag" => method(), _ => { return Err(anyhow!( - "Unknown output format {}; supports [ast-json, expr_domains]", + "Unknown output format {}; supports [ast-json, expression-domains]", &pretty_args.output_format )); } diff --git a/crates/conjure-cp-cli/src/utils/testing.rs b/crates/conjure-cp-cli/src/utils/testing.rs index 43a766d600..742c78acee 100644 --- a/crates/conjure-cp-cli/src/utils/testing.rs +++ b/crates/conjure-cp-cli/src/utils/testing.rs @@ -1,4 +1,4 @@ -use std::collections::{BTreeMap, HashMap, HashSet, VecDeque}; +use std::collections::{BTreeMap, HashMap, HashSet}; use std::fmt::Debug; use std::path::Path; use std::{io, mem, vec}; @@ -13,7 +13,9 @@ use std::io::{BufRead, BufReader, Write}; use std::sync::{Arc, RwLock}; use uniplate::Uniplate; -use conjure_cp::ast::{AbstractLiteral, Domain, Expression, GroundDomain, Moo, SerdeModel, ExprInfo}; +use conjure_cp::ast::{ + AbstractLiteral, ExprInfo, GroundDomain, Moo, SerdeModel, +}; use conjure_cp::context::Context; use serde_json::{Error as JsonError, Value as JsonValue}; @@ -115,30 +117,16 @@ pub fn serialize_model(model: &ConjureModel) -> Result { serde_json::to_string_pretty(&sorted_json) } -// struct ExprInfo { -// /// # use serde_json::json; -// pretty: String, -// domain: Option>, -// children: Vec, -// } - -fn create_expr_info(expr: &Expression) -> ExprInfo { - let pretty = expr.to_string(); - let domain = expr.domain_of(); - let children = expr.children().iter().map(|x| create_expr_info(x)).collect(); - - ExprInfo { pretty, domain, children } -} - pub fn serialize_domains(model: &ConjureModel) -> Result { - - let exprs: Vec = model.constraints().iter().map(|x| create_expr_info(x)).collect(); + let exprs: Vec = model + .constraints() + .iter() + .map(|x| ExprInfo::create(x)) + .collect(); serde_json::to_string_pretty(&exprs) // Ok(format!("{:?}", exprs)) } - - pub fn save_model_json( model: &ConjureModel, path: &str, diff --git a/crates/conjure-cp-core/src/ast/model.rs b/crates/conjure-cp-core/src/ast/model.rs index 0b0120a764..dee3a1875a 100644 --- a/crates/conjure-cp-core/src/ast/model.rs +++ b/crates/conjure-cp-core/src/ast/model.rs @@ -555,7 +555,21 @@ impl SerdeModel { #[serde_as] #[derive(Serialize)] pub struct ExprInfo { - pub pretty: String, - pub domain: Option>, - pub children: Vec, -} \ No newline at end of file + pretty: String, + domain: Option>, + children: Vec, +} + +impl ExprInfo { + pub fn create(expr: &Expression) -> ExprInfo { + let pretty = expr.to_string(); + let domain = expr.domain_of(); + let children = expr.children().iter().map(|x| Self::create(x)).collect(); + + ExprInfo { + pretty, + domain, + children, + } + } +} From 91bb91c6ee9059052170fa0f26a0fa299fe952f9 Mon Sep 17 00:00:00 2001 From: Calum C Date: Wed, 11 Mar 2026 23:42:32 +0000 Subject: [PATCH 06/16] remove redundant closure --- crates/conjure-cp-core/src/ast/model.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/conjure-cp-core/src/ast/model.rs b/crates/conjure-cp-core/src/ast/model.rs index dee3a1875a..f26071a841 100644 --- a/crates/conjure-cp-core/src/ast/model.rs +++ b/crates/conjure-cp-core/src/ast/model.rs @@ -564,7 +564,7 @@ impl ExprInfo { pub fn create(expr: &Expression) -> ExprInfo { let pretty = expr.to_string(); let domain = expr.domain_of(); - let children = expr.children().iter().map(|x| Self::create(x)).collect(); + let children = expr.children().iter().map(Self::create).collect(); ExprInfo { pretty, From 2d177aa152c488b45095130b07652b5a08b66263 Mon Sep 17 00:00:00 2001 From: Calum C Date: Wed, 11 Mar 2026 23:54:51 +0000 Subject: [PATCH 07/16] making clippy happy, part two electric boogaloo --- crates/conjure-cp-cli/src/utils/testing.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/conjure-cp-cli/src/utils/testing.rs b/crates/conjure-cp-cli/src/utils/testing.rs index 742c78acee..edce93c6f0 100644 --- a/crates/conjure-cp-cli/src/utils/testing.rs +++ b/crates/conjure-cp-cli/src/utils/testing.rs @@ -121,10 +121,9 @@ pub fn serialize_domains(model: &ConjureModel) -> Result { let exprs: Vec = model .constraints() .iter() - .map(|x| ExprInfo::create(x)) + .map(ExprInfo::create) .collect(); serde_json::to_string_pretty(&exprs) - // Ok(format!("{:?}", exprs)) } pub fn save_model_json( From 7c2bce88db0b6af8ed148db134df5ce2ca2555ad Mon Sep 17 00:00:00 2001 From: Calum C Date: Thu, 12 Mar 2026 00:10:25 +0000 Subject: [PATCH 08/16] clippy again --- crates/conjure-cp-cli/src/utils/testing.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/crates/conjure-cp-cli/src/utils/testing.rs b/crates/conjure-cp-cli/src/utils/testing.rs index edce93c6f0..352d394812 100644 --- a/crates/conjure-cp-cli/src/utils/testing.rs +++ b/crates/conjure-cp-cli/src/utils/testing.rs @@ -13,9 +13,7 @@ use std::io::{BufRead, BufReader, Write}; use std::sync::{Arc, RwLock}; use uniplate::Uniplate; -use conjure_cp::ast::{ - AbstractLiteral, ExprInfo, GroundDomain, Moo, SerdeModel, -}; +use conjure_cp::ast::{AbstractLiteral, ExprInfo, GroundDomain, Moo, SerdeModel}; use conjure_cp::context::Context; use serde_json::{Error as JsonError, Value as JsonValue}; @@ -118,11 +116,7 @@ pub fn serialize_model(model: &ConjureModel) -> Result { } pub fn serialize_domains(model: &ConjureModel) -> Result { - let exprs: Vec = model - .constraints() - .iter() - .map(ExprInfo::create) - .collect(); + let exprs: Vec = model.constraints().iter().map(ExprInfo::create).collect(); serde_json::to_string_pretty(&exprs) } From b8bedd52b0923f7cbbf2546ddc081cb078acc8a3 Mon Sep 17 00:00:00 2001 From: Calum C Date: Thu, 12 Mar 2026 01:06:43 +0000 Subject: [PATCH 09/16] add test case --- .../tests/custom/pretty-02/model.essence | 2 + .../tests/custom/pretty-02/run.sh | 1 + .../tests/custom/pretty-02/stdout.expected | 39 +++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 tests-integration/tests/custom/pretty-02/model.essence create mode 100644 tests-integration/tests/custom/pretty-02/run.sh create mode 100644 tests-integration/tests/custom/pretty-02/stdout.expected diff --git a/tests-integration/tests/custom/pretty-02/model.essence b/tests-integration/tests/custom/pretty-02/model.essence new file mode 100644 index 0000000000..9fa674ea18 --- /dev/null +++ b/tests-integration/tests/custom/pretty-02/model.essence @@ -0,0 +1,2 @@ +find x : int(1..3) +such that x < 2 \ No newline at end of file diff --git a/tests-integration/tests/custom/pretty-02/run.sh b/tests-integration/tests/custom/pretty-02/run.sh new file mode 100644 index 0000000000..9f882e4151 --- /dev/null +++ b/tests-integration/tests/custom/pretty-02/run.sh @@ -0,0 +1 @@ +conjure-oxide pretty model.essence --output-format="expression-domains" \ No newline at end of file diff --git a/tests-integration/tests/custom/pretty-02/stdout.expected b/tests-integration/tests/custom/pretty-02/stdout.expected new file mode 100644 index 0000000000..66a8e41960 --- /dev/null +++ b/tests-integration/tests/custom/pretty-02/stdout.expected @@ -0,0 +1,39 @@ +[ + { + "pretty": "(x < 2)", + "domain": { + "Ground": "Bool" + }, + "children": [ + { + "pretty": "x", + "domain": { + "Ground": { + "Int": [ + { + "Bounded": [ + 1, + 3 + ] + } + ] + } + }, + "children": [] + }, + { + "pretty": "2", + "domain": { + "Ground": { + "Int": [ + { + "Single": 2 + } + ] + } + }, + "children": [] + } + ] + } +] \ No newline at end of file From 61a010201627dd034ff6ad914b58a0c9ee86da2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=CC=88zgu=CC=88r=20Akgu=CC=88n?= Date: Fri, 13 Mar 2026 00:49:57 +0000 Subject: [PATCH 10/16] an alternative "expression-domains" format --- crates/conjure-cp-cli/src/pretty.rs | 7 +- crates/conjure-cp-cli/src/utils/testing.rs | 23 +- .../tests/custom/pretty-02/model.essence | 5 +- .../tests/custom/pretty-02/run.sh | 2 +- .../tests/custom/pretty-02/stdout.expected | 54 ++-- .../tests/custom/pretty-03/model.essence | 3 + .../tests/custom/pretty-03/run.sh | 1 + .../tests/custom/pretty-03/stdout.expected | 252 ++++++++++++++++++ 8 files changed, 302 insertions(+), 45 deletions(-) create mode 100644 tests-integration/tests/custom/pretty-03/model.essence create mode 100644 tests-integration/tests/custom/pretty-03/run.sh create mode 100644 tests-integration/tests/custom/pretty-03/stdout.expected diff --git a/crates/conjure-cp-cli/src/pretty.rs b/crates/conjure-cp-cli/src/pretty.rs index b9f5715b4f..0ed8e873a9 100644 --- a/crates/conjure-cp-cli/src/pretty.rs +++ b/crates/conjure-cp-cli/src/pretty.rs @@ -3,7 +3,9 @@ use std::{path::PathBuf, sync::Arc}; use anyhow::anyhow; use clap::ValueHint; -use conjure_cp_cli::utils::testing::{serialize_domains, serialize_model}; +use conjure_cp_cli::utils::testing::{ + serialize_domains, serialize_domains_json, serialize_model, +}; use crate::cli::{GlobalArgs, LOGGING_HELP_HEADING}; use crate::solve::{init_context, parse}; @@ -29,10 +31,11 @@ pub fn run_pretty_command(global_args: GlobalArgs, pretty_args: Args) -> anyhow: let output = match pretty_args.output_format.as_str() { "ast-json" => serialize_model(&model), "expression-domains" => serialize_domains(&model), + "expression-domains-json" => serialize_domains_json(&model), // "add_new_flag" => method(), _ => { return Err(anyhow!( - "Unknown output format {}; supports [ast-json, expression-domains]", + "Unknown output format {}; supports [ast-json, expression-domains, expression-domains-json]", &pretty_args.output_format )); } diff --git a/crates/conjure-cp-cli/src/utils/testing.rs b/crates/conjure-cp-cli/src/utils/testing.rs index 352d394812..3095fddcd4 100644 --- a/crates/conjure-cp-cli/src/utils/testing.rs +++ b/crates/conjure-cp-cli/src/utils/testing.rs @@ -13,7 +13,7 @@ use std::io::{BufRead, BufReader, Write}; use std::sync::{Arc, RwLock}; use uniplate::Uniplate; -use conjure_cp::ast::{AbstractLiteral, ExprInfo, GroundDomain, Moo, SerdeModel}; +use conjure_cp::ast::{AbstractLiteral, ExprInfo, Expression, GroundDomain, Moo, SerdeModel}; use conjure_cp::context::Context; use serde_json::{Error as JsonError, Value as JsonValue}; @@ -116,6 +116,27 @@ pub fn serialize_model(model: &ConjureModel) -> Result { } pub fn serialize_domains(model: &ConjureModel) -> Result { + let mut output = String::new(); + for constraint in model.constraints() { + serialize_domains_expr(constraint, 0, &mut output); + } + Ok(output) +} + +fn serialize_domains_expr(expr: &Expression, depth: usize, output: &mut String) { + let domain = expr + .domain_of() + .map(|domain| domain.to_string()) + .unwrap_or_else(|| "".to_owned()); + output.push_str(&" ".repeat(depth)); + output.push_str(&format!("{expr} :: {domain}\n")); + + for child in expr.children() { + serialize_domains_expr(&child, depth + 1, output); + } +} + +pub fn serialize_domains_json(model: &ConjureModel) -> Result { let exprs: Vec = model.constraints().iter().map(ExprInfo::create).collect(); serde_json::to_string_pretty(&exprs) } diff --git a/tests-integration/tests/custom/pretty-02/model.essence b/tests-integration/tests/custom/pretty-02/model.essence index 9fa674ea18..8e429118aa 100644 --- a/tests-integration/tests/custom/pretty-02/model.essence +++ b/tests-integration/tests/custom/pretty-02/model.essence @@ -1,2 +1,3 @@ -find x : int(1..3) -such that x < 2 \ No newline at end of file +find x,y,z : int(1..3) +find a,b,c : int(0..4) +such that (x+y < z-2) -> a + b > c diff --git a/tests-integration/tests/custom/pretty-02/run.sh b/tests-integration/tests/custom/pretty-02/run.sh index 9f882e4151..970ca66ebf 100644 --- a/tests-integration/tests/custom/pretty-02/run.sh +++ b/tests-integration/tests/custom/pretty-02/run.sh @@ -1 +1 @@ -conjure-oxide pretty model.essence --output-format="expression-domains" \ No newline at end of file +conjure-oxide pretty model.essence --output-format=expression-domains \ No newline at end of file diff --git a/tests-integration/tests/custom/pretty-02/stdout.expected b/tests-integration/tests/custom/pretty-02/stdout.expected index 66a8e41960..1058573be5 100644 --- a/tests-integration/tests/custom/pretty-02/stdout.expected +++ b/tests-integration/tests/custom/pretty-02/stdout.expected @@ -1,39 +1,15 @@ -[ - { - "pretty": "(x < 2)", - "domain": { - "Ground": "Bool" - }, - "children": [ - { - "pretty": "x", - "domain": { - "Ground": { - "Int": [ - { - "Bounded": [ - 1, - 3 - ] - } - ] - } - }, - "children": [] - }, - { - "pretty": "2", - "domain": { - "Ground": { - "Int": [ - { - "Single": 2 - } - ] - } - }, - "children": [] - } - ] - } -] \ No newline at end of file +((sum([x,y;int(1..2)]) < (z - 2))) -> ((sum([a,b;int(1..2)]) > c)) :: bool + (sum([x,y;int(1..2)]) < (z - 2)) :: bool + sum([x,y;int(1..2)]) :: int(2..6) + [x,y;int(1..2)] :: matrix indexed by [int(1..2)] of int(1..3) + x :: int(1..3) + y :: int(1..3) + (z - 2) :: int(-1..1) + z :: int(1..3) + 2 :: int(2) + (sum([a,b;int(1..2)]) > c) :: bool + sum([a,b;int(1..2)]) :: int(0..8) + [a,b;int(1..2)] :: matrix indexed by [int(1..2)] of int(0..4) + a :: int(0..4) + b :: int(0..4) + c :: int(0..4) diff --git a/tests-integration/tests/custom/pretty-03/model.essence b/tests-integration/tests/custom/pretty-03/model.essence new file mode 100644 index 0000000000..8e429118aa --- /dev/null +++ b/tests-integration/tests/custom/pretty-03/model.essence @@ -0,0 +1,3 @@ +find x,y,z : int(1..3) +find a,b,c : int(0..4) +such that (x+y < z-2) -> a + b > c diff --git a/tests-integration/tests/custom/pretty-03/run.sh b/tests-integration/tests/custom/pretty-03/run.sh new file mode 100644 index 0000000000..f6643d9724 --- /dev/null +++ b/tests-integration/tests/custom/pretty-03/run.sh @@ -0,0 +1 @@ +conjure-oxide pretty model.essence --output-format=expression-domains-json diff --git a/tests-integration/tests/custom/pretty-03/stdout.expected b/tests-integration/tests/custom/pretty-03/stdout.expected new file mode 100644 index 0000000000..fcc60c93ba --- /dev/null +++ b/tests-integration/tests/custom/pretty-03/stdout.expected @@ -0,0 +1,252 @@ +[ + { + "pretty": "((sum([x,y;int(1..2)]) < (z - 2))) -> ((sum([a,b;int(1..2)]) > c))", + "domain": { + "Ground": "Bool" + }, + "children": [ + { + "pretty": "(sum([x,y;int(1..2)]) < (z - 2))", + "domain": { + "Ground": "Bool" + }, + "children": [ + { + "pretty": "sum([x,y;int(1..2)])", + "domain": { + "Ground": { + "Int": [ + { + "Bounded": [ + 2, + 6 + ] + } + ] + } + }, + "children": [ + { + "pretty": "[x,y;int(1..2)]", + "domain": { + "Ground": { + "Matrix": [ + { + "Int": [ + { + "Bounded": [ + 1, + 3 + ] + } + ] + }, + [ + { + "Int": [ + { + "Bounded": [ + 1, + 2 + ] + } + ] + } + ] + ] + } + }, + "children": [ + { + "pretty": "x", + "domain": { + "Ground": { + "Int": [ + { + "Bounded": [ + 1, + 3 + ] + } + ] + } + }, + "children": [] + }, + { + "pretty": "y", + "domain": { + "Ground": { + "Int": [ + { + "Bounded": [ + 1, + 3 + ] + } + ] + } + }, + "children": [] + } + ] + } + ] + }, + { + "pretty": "(z - 2)", + "domain": { + "Ground": { + "Int": [ + { + "Bounded": [ + -1, + 1 + ] + } + ] + } + }, + "children": [ + { + "pretty": "z", + "domain": { + "Ground": { + "Int": [ + { + "Bounded": [ + 1, + 3 + ] + } + ] + } + }, + "children": [] + }, + { + "pretty": "2", + "domain": { + "Ground": { + "Int": [ + { + "Single": 2 + } + ] + } + }, + "children": [] + } + ] + } + ] + }, + { + "pretty": "(sum([a,b;int(1..2)]) > c)", + "domain": { + "Ground": "Bool" + }, + "children": [ + { + "pretty": "sum([a,b;int(1..2)])", + "domain": { + "Ground": { + "Int": [ + { + "Bounded": [ + 0, + 8 + ] + } + ] + } + }, + "children": [ + { + "pretty": "[a,b;int(1..2)]", + "domain": { + "Ground": { + "Matrix": [ + { + "Int": [ + { + "Bounded": [ + 0, + 4 + ] + } + ] + }, + [ + { + "Int": [ + { + "Bounded": [ + 1, + 2 + ] + } + ] + } + ] + ] + } + }, + "children": [ + { + "pretty": "a", + "domain": { + "Ground": { + "Int": [ + { + "Bounded": [ + 0, + 4 + ] + } + ] + } + }, + "children": [] + }, + { + "pretty": "b", + "domain": { + "Ground": { + "Int": [ + { + "Bounded": [ + 0, + 4 + ] + } + ] + } + }, + "children": [] + } + ] + } + ] + }, + { + "pretty": "c", + "domain": { + "Ground": { + "Int": [ + { + "Bounded": [ + 0, + 4 + ] + } + ] + } + }, + "children": [] + } + ] + } + ] + } +] \ No newline at end of file From 2767acd5bf57fbe93450408ee800b95c373bba10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=CC=88zgu=CC=88r=20Akgu=CC=88n?= Date: Fri, 13 Mar 2026 01:24:47 +0000 Subject: [PATCH 11/16] hygiene --- crates/conjure-cp-cli/src/pretty.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/crates/conjure-cp-cli/src/pretty.rs b/crates/conjure-cp-cli/src/pretty.rs index 0ed8e873a9..511f033e0e 100644 --- a/crates/conjure-cp-cli/src/pretty.rs +++ b/crates/conjure-cp-cli/src/pretty.rs @@ -3,9 +3,7 @@ use std::{path::PathBuf, sync::Arc}; use anyhow::anyhow; use clap::ValueHint; -use conjure_cp_cli::utils::testing::{ - serialize_domains, serialize_domains_json, serialize_model, -}; +use conjure_cp_cli::utils::testing::{serialize_domains, serialize_domains_json, serialize_model}; use crate::cli::{GlobalArgs, LOGGING_HELP_HEADING}; use crate::solve::{init_context, parse}; From ed2ae03e86bcf82aceea097700a2c2944561f47d Mon Sep 17 00:00:00 2001 From: Calum C Date: Fri, 13 Mar 2026 09:29:48 +0000 Subject: [PATCH 12/16] get rid of redundant brackets --- crates/conjure-cp-core/src/ast/domains/attrs.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/conjure-cp-core/src/ast/domains/attrs.rs b/crates/conjure-cp-core/src/ast/domains/attrs.rs index 5a52e224a6..3feb93d06a 100644 --- a/crates/conjure-cp-core/src/ast/domains/attrs.rs +++ b/crates/conjure-cp-core/src/ast/domains/attrs.rs @@ -44,10 +44,10 @@ impl Default for SetAttr { impl Display for SetAttr { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match &self.size { - Range::Single(x) => write!(f, "(size({x}))"), - Range::Bounded(l, r) => write!(f, "(minSize({l}), maxSize({r}))"), - Range::UnboundedL(r) => write!(f, "(maxSize({r}))"), - Range::UnboundedR(l) => write!(f, "(minSize({l}))"), + Range::Single(x) => write!(f, "(size {x})"), + Range::Bounded(l, r) => write!(f, "(minSize {l}, maxSize {r})"), + Range::UnboundedL(r) => write!(f, "(maxSize {r})"), + Range::UnboundedR(l) => write!(f, "(minSize {l})"), Range::Unbounded => write!(f, ""), } } From 80774ed199e5132e2db001889936fc22d9eb0688 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=CC=88zgu=CC=88r=20Akgu=CC=88n?= Date: Fri, 13 Mar 2026 10:55:56 +0000 Subject: [PATCH 13/16] add new challenge test cases --- .../expression-domains/01/model.essence | 24 +++++++++++++++++++ .../tests/custom/expression-domains/01/run.sh | 1 + .../expression-domains/01/stdout.expected | 7 ++++++ .../expression-domains/02/model.essence | 23 ++++++++++++++++++ .../tests/custom/expression-domains/02/run.sh | 1 + .../expression-domains/02/stdout.expected | 7 ++++++ .../expression-domains/03/model.essence | 23 ++++++++++++++++++ .../tests/custom/expression-domains/03/run.sh | 1 + .../expression-domains/03/stdout.expected | 7 ++++++ .../expression-domains/04/model.essence | 23 ++++++++++++++++++ .../tests/custom/expression-domains/04/run.sh | 1 + .../expression-domains/04/stdout.expected | 7 ++++++ .../expression-domains/05/model.essence | 23 ++++++++++++++++++ .../tests/custom/expression-domains/05/run.sh | 1 + .../expression-domains/05/stdout.expected | 7 ++++++ 15 files changed, 156 insertions(+) create mode 100644 tests-integration/tests/custom/expression-domains/01/model.essence create mode 100644 tests-integration/tests/custom/expression-domains/01/run.sh create mode 100644 tests-integration/tests/custom/expression-domains/01/stdout.expected create mode 100644 tests-integration/tests/custom/expression-domains/02/model.essence create mode 100644 tests-integration/tests/custom/expression-domains/02/run.sh create mode 100644 tests-integration/tests/custom/expression-domains/02/stdout.expected create mode 100644 tests-integration/tests/custom/expression-domains/03/model.essence create mode 100644 tests-integration/tests/custom/expression-domains/03/run.sh create mode 100644 tests-integration/tests/custom/expression-domains/03/stdout.expected create mode 100644 tests-integration/tests/custom/expression-domains/04/model.essence create mode 100644 tests-integration/tests/custom/expression-domains/04/run.sh create mode 100644 tests-integration/tests/custom/expression-domains/04/stdout.expected create mode 100644 tests-integration/tests/custom/expression-domains/05/model.essence create mode 100644 tests-integration/tests/custom/expression-domains/05/run.sh create mode 100644 tests-integration/tests/custom/expression-domains/05/stdout.expected diff --git a/tests-integration/tests/custom/expression-domains/01/model.essence b/tests-integration/tests/custom/expression-domains/01/model.essence new file mode 100644 index 0000000000..7521a1c47f --- /dev/null +++ b/tests-integration/tests/custom/expression-domains/01/model.essence @@ -0,0 +1,24 @@ +find x : set (maxSize 1) of int(1..2) +find y : set (maxSize 1) of int(2..3) +find a : set (maxSize 2) of int(1..2) +find b : set (maxSize 2) of int(1..3) +such that x union y subsetEq a intersect b + + +$ initial domains +$ ((x union y) subsetEq (a intersect b)) :: bool +$ (x union y) :: set (maxSize 2) of int(1..3) +$ x :: set (maxSize 1) of int(1..2) +$ y :: set (maxSize 1) of int(2..3) +$ (a intersect b) :: set (maxSize 2) of int(1..2) +$ a :: set (maxSize 2) of int(1..2) +$ b :: set (maxSize 2) of int(1..3) + +$ pruned domains +$ ((x union y) subsetEq (a intersect b)) :: bool +$ (x union y) :: set (maxSize 2) of int(1..2) +$ x :: set (maxSize 1) of int(1..2) +$ y :: set (maxSize 1) of int(2..2) +$ (a intersect b) :: set (maxSize 2) of int(1..2) +$ a :: set (maxSize 2) of int(1..2) +$ b :: set (maxSize 2) of int(1..3) diff --git a/tests-integration/tests/custom/expression-domains/01/run.sh b/tests-integration/tests/custom/expression-domains/01/run.sh new file mode 100644 index 0000000000..970ca66ebf --- /dev/null +++ b/tests-integration/tests/custom/expression-domains/01/run.sh @@ -0,0 +1 @@ +conjure-oxide pretty model.essence --output-format=expression-domains \ No newline at end of file diff --git a/tests-integration/tests/custom/expression-domains/01/stdout.expected b/tests-integration/tests/custom/expression-domains/01/stdout.expected new file mode 100644 index 0000000000..0a70aae577 --- /dev/null +++ b/tests-integration/tests/custom/expression-domains/01/stdout.expected @@ -0,0 +1,7 @@ +((x union y) subsetEq (a intersect b)) :: bool + (x union y) :: set of set of int(1..3) + x :: set (maxSize(1)) of int(1..2) + y :: set (maxSize(1)) of int(2..3) + (a intersect b) :: set of set of int(1..2) + a :: set (maxSize(2)) of int(1..2) + b :: set (maxSize(2)) of int(1..3) diff --git a/tests-integration/tests/custom/expression-domains/02/model.essence b/tests-integration/tests/custom/expression-domains/02/model.essence new file mode 100644 index 0000000000..7b74852a5b --- /dev/null +++ b/tests-integration/tests/custom/expression-domains/02/model.essence @@ -0,0 +1,23 @@ +find x : set (maxSize 1) of int(1..2) +find y : set (maxSize 1) of int(3..4) +find a : set (maxSize 2) of int(1..3) +find b : set (maxSize 2) of int(1..2) +such that x union y subsetEq a intersect b + +$ initial domains +$ ((x union y) subsetEq (a intersect b)) :: bool +$ (x union y) :: set (maxSize 2) of int(1..4) +$ x :: set (maxSize 1) of int(1..2) +$ y :: set (maxSize 1) of int(3..4) +$ (a intersect b) :: set (maxSize 2) of int(1..2) +$ a :: set (maxSize 2) of int(1..3) +$ b :: set (maxSize 2) of int(1..2) + +$ pruned domains +$ ((x union y) subsetEq (a intersect b)) :: bool +$ (x union y) :: set (maxSize 1) of int(1..2) +$ x :: set (maxSize 1) of int(1..2) +$ y :: set (maxSize 0) of int(3..4) +$ (a intersect b) :: set (maxSize 2) of int(1..2) +$ a :: set (maxSize 2) of int(1..3) +$ b :: set (maxSize 2) of int(1..2) diff --git a/tests-integration/tests/custom/expression-domains/02/run.sh b/tests-integration/tests/custom/expression-domains/02/run.sh new file mode 100644 index 0000000000..970ca66ebf --- /dev/null +++ b/tests-integration/tests/custom/expression-domains/02/run.sh @@ -0,0 +1 @@ +conjure-oxide pretty model.essence --output-format=expression-domains \ No newline at end of file diff --git a/tests-integration/tests/custom/expression-domains/02/stdout.expected b/tests-integration/tests/custom/expression-domains/02/stdout.expected new file mode 100644 index 0000000000..ee893041f0 --- /dev/null +++ b/tests-integration/tests/custom/expression-domains/02/stdout.expected @@ -0,0 +1,7 @@ +((x union y) subsetEq (a intersect b)) :: bool + (x union y) :: set of set of int(1..4) + x :: set (maxSize(1)) of int(1..2) + y :: set (maxSize(1)) of int(3..4) + (a intersect b) :: set of set of int(1..2) + a :: set (maxSize(2)) of int(1..3) + b :: set (maxSize(2)) of int(1..2) diff --git a/tests-integration/tests/custom/expression-domains/03/model.essence b/tests-integration/tests/custom/expression-domains/03/model.essence new file mode 100644 index 0000000000..2c01e78e5f --- /dev/null +++ b/tests-integration/tests/custom/expression-domains/03/model.essence @@ -0,0 +1,23 @@ +find x : set (minSize 1, maxSize 1) of int(2..3) +find y : set (minSize 1, maxSize 1) of int(1..2) +find a : set (minSize 1, maxSize 2) of int(1..3) +find b : set (minSize 1, maxSize 2) of int(2..4) +such that x union y subsetEq a intersect b + +$ initial domains +$ ((x union y) subsetEq (a intersect b)) :: bool +$ (x union y) :: set (minSize 1, maxSize 2) of int(1..3) +$ x :: set (minSize 1, maxSize 1) of int(2..3) +$ y :: set (minSize 1, maxSize 1) of int(1..2) +$ (a intersect b) :: set (maxSize 2) of int(2..3) +$ a :: set (minSize 1, maxSize 2) of int(1..3) +$ b :: set (minSize 1, maxSize 2) of int(2..4) + +$ pruned domains +$ ((x union y) subsetEq (a intersect b)) :: bool +$ (x union y) :: set (minSize 1, maxSize 2) of int(2..3) +$ x :: set (minSize 1, maxSize 1) of int(2..3) +$ y :: set (minSize 1, maxSize 1) of int(2..2) +$ (a intersect b) :: set (maxSize 2) of int(2..3) +$ a :: set (minSize 1, maxSize 2) of int(2..3) +$ b :: set (minSize 1, maxSize 2) of int(2..3) diff --git a/tests-integration/tests/custom/expression-domains/03/run.sh b/tests-integration/tests/custom/expression-domains/03/run.sh new file mode 100644 index 0000000000..970ca66ebf --- /dev/null +++ b/tests-integration/tests/custom/expression-domains/03/run.sh @@ -0,0 +1 @@ +conjure-oxide pretty model.essence --output-format=expression-domains \ No newline at end of file diff --git a/tests-integration/tests/custom/expression-domains/03/stdout.expected b/tests-integration/tests/custom/expression-domains/03/stdout.expected new file mode 100644 index 0000000000..a82b3dc456 --- /dev/null +++ b/tests-integration/tests/custom/expression-domains/03/stdout.expected @@ -0,0 +1,7 @@ +((x union y) subsetEq (a intersect b)) :: bool + (x union y) :: set of set of int(1..3) + x :: set (minSize(1), maxSize(1)) of int(2..3) + y :: set (minSize(1), maxSize(1)) of int(1..2) + (a intersect b) :: set of set of int(2..3) + a :: set (minSize(1), maxSize(2)) of int(1..3) + b :: set (minSize(1), maxSize(2)) of int(2..4) diff --git a/tests-integration/tests/custom/expression-domains/04/model.essence b/tests-integration/tests/custom/expression-domains/04/model.essence new file mode 100644 index 0000000000..eb91af4c70 --- /dev/null +++ b/tests-integration/tests/custom/expression-domains/04/model.essence @@ -0,0 +1,23 @@ +find x : set (minSize 1, maxSize 2) of int(1..3) +find y : set (minSize 1, maxSize 1) of int(2..4) +find a : set (minSize 1, maxSize 2) of int(2..3) +find b : set (minSize 1, maxSize 2) of int(1..2) +such that x union y = a intersect b + +$ initial domains +$ ((x union y) = (a intersect b)) :: bool +$ (x union y) :: set (minSize 1, maxSize 3) of int(1..4) +$ x :: set (minSize 1, maxSize 2) of int(1..3) +$ y :: set (minSize 1, maxSize 1) of int(2..4) +$ (a intersect b) :: set (maxSize 2) of int(2..2) +$ a :: set (minSize 1, maxSize 2) of int(2..3) +$ b :: set (minSize 1, maxSize 2) of int(1..2) + +$ pruned domains +$ ((x union y) = (a intersect b)) :: bool +$ (x union y) :: set (minSize 1, maxSize 1) of int(2..2) +$ x :: set (minSize 1, maxSize 2) of int(2..2) +$ y :: set (minSize 1, maxSize 1) of int(2..2) +$ (a intersect b) :: set (minSize 1, maxSize 1) of int(2..2) +$ a :: set (minSize 1, maxSize 2) of int(2..3), with 2 definitely in +$ b :: set (minSize 1, maxSize 2) of int(1..2), with 2 definitely in diff --git a/tests-integration/tests/custom/expression-domains/04/run.sh b/tests-integration/tests/custom/expression-domains/04/run.sh new file mode 100644 index 0000000000..970ca66ebf --- /dev/null +++ b/tests-integration/tests/custom/expression-domains/04/run.sh @@ -0,0 +1 @@ +conjure-oxide pretty model.essence --output-format=expression-domains \ No newline at end of file diff --git a/tests-integration/tests/custom/expression-domains/04/stdout.expected b/tests-integration/tests/custom/expression-domains/04/stdout.expected new file mode 100644 index 0000000000..1d738235d5 --- /dev/null +++ b/tests-integration/tests/custom/expression-domains/04/stdout.expected @@ -0,0 +1,7 @@ +((x union y) = (a intersect b)) :: bool + (x union y) :: set of set of int(1..4) + x :: set (minSize(1), maxSize(2)) of int(1..3) + y :: set (minSize(1), maxSize(1)) of int(2..4) + (a intersect b) :: set of set of int(2) + a :: set (minSize(1), maxSize(2)) of int(2..3) + b :: set (minSize(1), maxSize(2)) of int(1..2) diff --git a/tests-integration/tests/custom/expression-domains/05/model.essence b/tests-integration/tests/custom/expression-domains/05/model.essence new file mode 100644 index 0000000000..36aa279b8c --- /dev/null +++ b/tests-integration/tests/custom/expression-domains/05/model.essence @@ -0,0 +1,23 @@ +find x : set (minSize 2, maxSize 2) of int(1..3) +find y : set (minSize 1, maxSize 1) of int(3..4) +find a : set (minSize 2, maxSize 2) of int(2..4) +find b : set (minSize 2, maxSize 2) of int(1..3) +such that x union y = a intersect b + +$ initial domains +$ ((x union y) = (a intersect b)) :: bool +$ (x union y) :: set (minSize 2, maxSize 3) of int(1..4) +$ x :: set (minSize 2, maxSize 2) of int(1..3) +$ y :: set (minSize 1, maxSize 1) of int(3..4) +$ (a intersect b) :: set (maxSize 2) of int(2..3) +$ a :: set (minSize 2, maxSize 2) of int(2..4) +$ b :: set (minSize 2, maxSize 2) of int(1..3) + +$ pruned domains +$ ((x union y) = (a intersect b)) :: bool +$ (x union y) :: set (minSize 2, maxSize 2) of int(2..3) +$ x :: set (minSize 2, maxSize 2) of int(2..3) +$ y :: set (minSize 1, maxSize 1) of int(3..3) +$ (a intersect b) :: set (minSize 2, maxSize 2) of int(2..3) +$ a :: set (minSize 2, maxSize 2) of int(2..3) +$ b :: set (minSize 2, maxSize 2) of int(2..3) diff --git a/tests-integration/tests/custom/expression-domains/05/run.sh b/tests-integration/tests/custom/expression-domains/05/run.sh new file mode 100644 index 0000000000..970ca66ebf --- /dev/null +++ b/tests-integration/tests/custom/expression-domains/05/run.sh @@ -0,0 +1 @@ +conjure-oxide pretty model.essence --output-format=expression-domains \ No newline at end of file diff --git a/tests-integration/tests/custom/expression-domains/05/stdout.expected b/tests-integration/tests/custom/expression-domains/05/stdout.expected new file mode 100644 index 0000000000..a6e04f9b83 --- /dev/null +++ b/tests-integration/tests/custom/expression-domains/05/stdout.expected @@ -0,0 +1,7 @@ +((x union y) = (a intersect b)) :: bool + (x union y) :: set of set of int(1..4) + x :: set (minSize(2), maxSize(2)) of int(1..3) + y :: set (minSize(1), maxSize(1)) of int(3..4) + (a intersect b) :: set of set of int(2..3) + a :: set (minSize(2), maxSize(2)) of int(2..4) + b :: set (minSize(2), maxSize(2)) of int(1..3) From 63cec88ab3f75acdf123f00f8911d9469e112a5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=CC=88zgu=CC=88r=20Akgu=CC=88n?= Date: Fri, 13 Mar 2026 11:30:43 +0000 Subject: [PATCH 14/16] update test files --- ...e-via-solver-ac-smt-lia-arrays-expected-rule-trace.txt | 8 ++++---- ...e-via-solver-ac-smt-lia-arrays-expected-rule-trace.txt | 8 ++++---- ...e-via-solver-ac-smt-lia-arrays-expected-rule-trace.txt | 4 ++-- .../roundtrip/set_attrs/via-conjure.expected.essence | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests-integration/tests/integration/smt/set/eq/via-conjure-naive-via-solver-ac-smt-lia-arrays-expected-rule-trace.txt b/tests-integration/tests/integration/smt/set/eq/via-conjure-naive-via-solver-ac-smt-lia-arrays-expected-rule-trace.txt index bdef69c45a..3db8faa982 100644 --- a/tests-integration/tests/integration/smt/set/eq/via-conjure-naive-via-solver-ac-smt-lia-arrays-expected-rule-trace.txt +++ b/tests-integration/tests/integration/smt/set/eq/via-conjure-naive-via-solver-ac-smt-lia-arrays-expected-rule-trace.txt @@ -1,7 +1,7 @@ Model before rewriting: -find a: set (minSize(1)) of int(1..2) -find b: set (minSize(1)) of int(1..2) +find a: set (minSize 1) of int(1..2) +find b: set (minSize 1) of int(1..2) such that @@ -24,8 +24,8 @@ and([(1 in a) <-> (1 in b),(2 in a) <-> (2 in b);int(1..)]), Final model: -find a: set (minSize(1)) of int(1..2) -find b: set (minSize(1)) of int(1..2) +find a: set (minSize 1) of int(1..2) +find b: set (minSize 1) of int(1..2) such that diff --git a/tests-integration/tests/integration/smt/set/eq_overlap/via-conjure-naive-via-solver-ac-smt-lia-arrays-expected-rule-trace.txt b/tests-integration/tests/integration/smt/set/eq_overlap/via-conjure-naive-via-solver-ac-smt-lia-arrays-expected-rule-trace.txt index f55dd078c4..7fa8f2a6f0 100644 --- a/tests-integration/tests/integration/smt/set/eq_overlap/via-conjure-naive-via-solver-ac-smt-lia-arrays-expected-rule-trace.txt +++ b/tests-integration/tests/integration/smt/set/eq_overlap/via-conjure-naive-via-solver-ac-smt-lia-arrays-expected-rule-trace.txt @@ -1,7 +1,7 @@ Model before rewriting: -find a: set (minSize(1)) of int(1..2) -find b: set (minSize(1)) of int(2..3) +find a: set (minSize 1) of int(1..2) +find b: set (minSize 1) of int(2..3) such that @@ -25,8 +25,8 @@ and([!(1 in a),(2 in a) <-> (2 in b),!(3 in b);int(1..)]), Final model: -find a: set (minSize(1)) of int(1..2) -find b: set (minSize(1)) of int(2..3) +find a: set (minSize 1) of int(1..2) +find b: set (minSize 1) of int(2..3) such that diff --git a/tests-integration/tests/integration/smt/set/subset-sum/via-conjure-naive-via-solver-ac-smt-lia-arrays-expected-rule-trace.txt b/tests-integration/tests/integration/smt/set/subset-sum/via-conjure-naive-via-solver-ac-smt-lia-arrays-expected-rule-trace.txt index cc30660fe2..2b86dbcc4f 100644 --- a/tests-integration/tests/integration/smt/set/subset-sum/via-conjure-naive-via-solver-ac-smt-lia-arrays-expected-rule-trace.txt +++ b/tests-integration/tests/integration/smt/set/subset-sum/via-conjure-naive-via-solver-ac-smt-lia-arrays-expected-rule-trace.txt @@ -1,7 +1,7 @@ Model before rewriting: letting s be 0 -find x: set (minSize(1)) of int(-7, -3..-2, 5, 8) +find x: set (minSize 1) of int(-7, -3..-2, 5, 8) such that @@ -24,7 +24,7 @@ sum([product([-7,toInt(-7 in x);int(1..)]),product([-3,toInt(-3 in x);int(1..)]) Final model: letting s be 0 -find x: set (minSize(1)) of int(-7, -3..-2, 5, 8) +find x: set (minSize 1) of int(-7, -3..-2, 5, 8) such that diff --git a/tests-integration/tests/roundtrip/set_attrs/via-conjure.expected.essence b/tests-integration/tests/roundtrip/set_attrs/via-conjure.expected.essence index 791fb0af5e..8459938867 100644 --- a/tests-integration/tests/roundtrip/set_attrs/via-conjure.expected.essence +++ b/tests-integration/tests/roundtrip/set_attrs/via-conjure.expected.essence @@ -1,4 +1,4 @@ -find s: set (size(2)) of int(1..3) +find s: set (size 2) of int(1..3) such that From 5f2d9c06d692a256b1827676c3288c2066125a8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=CC=88zgu=CC=88r=20Akgu=CC=88n?= Date: Fri, 13 Mar 2026 12:52:05 +0000 Subject: [PATCH 15/16] update test files --- .../tests/custom/expression-domains/01/stdout.expected | 8 ++++---- .../tests/custom/expression-domains/02/stdout.expected | 8 ++++---- .../tests/custom/expression-domains/03/stdout.expected | 8 ++++---- .../tests/custom/expression-domains/04/stdout.expected | 8 ++++---- .../tests/custom/expression-domains/05/stdout.expected | 8 ++++---- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/tests-integration/tests/custom/expression-domains/01/stdout.expected b/tests-integration/tests/custom/expression-domains/01/stdout.expected index 0a70aae577..bca3a832ae 100644 --- a/tests-integration/tests/custom/expression-domains/01/stdout.expected +++ b/tests-integration/tests/custom/expression-domains/01/stdout.expected @@ -1,7 +1,7 @@ ((x union y) subsetEq (a intersect b)) :: bool (x union y) :: set of set of int(1..3) - x :: set (maxSize(1)) of int(1..2) - y :: set (maxSize(1)) of int(2..3) + x :: set (maxSize 1) of int(1..2) + y :: set (maxSize 1) of int(2..3) (a intersect b) :: set of set of int(1..2) - a :: set (maxSize(2)) of int(1..2) - b :: set (maxSize(2)) of int(1..3) + a :: set (maxSize 2) of int(1..2) + b :: set (maxSize 2) of int(1..3) diff --git a/tests-integration/tests/custom/expression-domains/02/stdout.expected b/tests-integration/tests/custom/expression-domains/02/stdout.expected index ee893041f0..164242116a 100644 --- a/tests-integration/tests/custom/expression-domains/02/stdout.expected +++ b/tests-integration/tests/custom/expression-domains/02/stdout.expected @@ -1,7 +1,7 @@ ((x union y) subsetEq (a intersect b)) :: bool (x union y) :: set of set of int(1..4) - x :: set (maxSize(1)) of int(1..2) - y :: set (maxSize(1)) of int(3..4) + x :: set (maxSize 1) of int(1..2) + y :: set (maxSize 1) of int(3..4) (a intersect b) :: set of set of int(1..2) - a :: set (maxSize(2)) of int(1..3) - b :: set (maxSize(2)) of int(1..2) + a :: set (maxSize 2) of int(1..3) + b :: set (maxSize 2) of int(1..2) diff --git a/tests-integration/tests/custom/expression-domains/03/stdout.expected b/tests-integration/tests/custom/expression-domains/03/stdout.expected index a82b3dc456..918e481f4c 100644 --- a/tests-integration/tests/custom/expression-domains/03/stdout.expected +++ b/tests-integration/tests/custom/expression-domains/03/stdout.expected @@ -1,7 +1,7 @@ ((x union y) subsetEq (a intersect b)) :: bool (x union y) :: set of set of int(1..3) - x :: set (minSize(1), maxSize(1)) of int(2..3) - y :: set (minSize(1), maxSize(1)) of int(1..2) + x :: set (minSize 1, maxSize 1) of int(2..3) + y :: set (minSize 1, maxSize 1) of int(1..2) (a intersect b) :: set of set of int(2..3) - a :: set (minSize(1), maxSize(2)) of int(1..3) - b :: set (minSize(1), maxSize(2)) of int(2..4) + a :: set (minSize 1, maxSize 2) of int(1..3) + b :: set (minSize 1, maxSize 2) of int(2..4) diff --git a/tests-integration/tests/custom/expression-domains/04/stdout.expected b/tests-integration/tests/custom/expression-domains/04/stdout.expected index 1d738235d5..3308da8423 100644 --- a/tests-integration/tests/custom/expression-domains/04/stdout.expected +++ b/tests-integration/tests/custom/expression-domains/04/stdout.expected @@ -1,7 +1,7 @@ ((x union y) = (a intersect b)) :: bool (x union y) :: set of set of int(1..4) - x :: set (minSize(1), maxSize(2)) of int(1..3) - y :: set (minSize(1), maxSize(1)) of int(2..4) + x :: set (minSize 1, maxSize 2) of int(1..3) + y :: set (minSize 1, maxSize 1) of int(2..4) (a intersect b) :: set of set of int(2) - a :: set (minSize(1), maxSize(2)) of int(2..3) - b :: set (minSize(1), maxSize(2)) of int(1..2) + a :: set (minSize 1, maxSize 2) of int(2..3) + b :: set (minSize 1, maxSize 2) of int(1..2) diff --git a/tests-integration/tests/custom/expression-domains/05/stdout.expected b/tests-integration/tests/custom/expression-domains/05/stdout.expected index a6e04f9b83..bd7c7144d3 100644 --- a/tests-integration/tests/custom/expression-domains/05/stdout.expected +++ b/tests-integration/tests/custom/expression-domains/05/stdout.expected @@ -1,7 +1,7 @@ ((x union y) = (a intersect b)) :: bool (x union y) :: set of set of int(1..4) - x :: set (minSize(2), maxSize(2)) of int(1..3) - y :: set (minSize(1), maxSize(1)) of int(3..4) + x :: set (minSize 2, maxSize 2) of int(1..3) + y :: set (minSize 1, maxSize 1) of int(3..4) (a intersect b) :: set of set of int(2..3) - a :: set (minSize(2), maxSize(2)) of int(2..4) - b :: set (minSize(2), maxSize(2)) of int(1..3) + a :: set (minSize 2, maxSize 2) of int(2..4) + b :: set (minSize 2, maxSize 2) of int(1..3) From 1d58f5d82eb231451e3a368255ab8b571c4a094d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=CC=88zgu=CC=88r=20Akgu=CC=88n?= Date: Fri, 13 Mar 2026 12:54:24 +0000 Subject: [PATCH 16/16] remove expression-domains-json --- crates/conjure-cp-cli/src/pretty.rs | 5 +- crates/conjure-cp-cli/src/utils/testing.rs | 7 +- .../tests/custom/pretty-03/model.essence | 3 - .../tests/custom/pretty-03/run.sh | 1 - .../tests/custom/pretty-03/stdout.expected | 252 ------------------ 5 files changed, 3 insertions(+), 265 deletions(-) delete mode 100644 tests-integration/tests/custom/pretty-03/model.essence delete mode 100644 tests-integration/tests/custom/pretty-03/run.sh delete mode 100644 tests-integration/tests/custom/pretty-03/stdout.expected diff --git a/crates/conjure-cp-cli/src/pretty.rs b/crates/conjure-cp-cli/src/pretty.rs index 511f033e0e..b9f5715b4f 100644 --- a/crates/conjure-cp-cli/src/pretty.rs +++ b/crates/conjure-cp-cli/src/pretty.rs @@ -3,7 +3,7 @@ use std::{path::PathBuf, sync::Arc}; use anyhow::anyhow; use clap::ValueHint; -use conjure_cp_cli::utils::testing::{serialize_domains, serialize_domains_json, serialize_model}; +use conjure_cp_cli::utils::testing::{serialize_domains, serialize_model}; use crate::cli::{GlobalArgs, LOGGING_HELP_HEADING}; use crate::solve::{init_context, parse}; @@ -29,11 +29,10 @@ pub fn run_pretty_command(global_args: GlobalArgs, pretty_args: Args) -> anyhow: let output = match pretty_args.output_format.as_str() { "ast-json" => serialize_model(&model), "expression-domains" => serialize_domains(&model), - "expression-domains-json" => serialize_domains_json(&model), // "add_new_flag" => method(), _ => { return Err(anyhow!( - "Unknown output format {}; supports [ast-json, expression-domains, expression-domains-json]", + "Unknown output format {}; supports [ast-json, expression-domains]", &pretty_args.output_format )); } diff --git a/crates/conjure-cp-cli/src/utils/testing.rs b/crates/conjure-cp-cli/src/utils/testing.rs index 3095fddcd4..fc67a376c1 100644 --- a/crates/conjure-cp-cli/src/utils/testing.rs +++ b/crates/conjure-cp-cli/src/utils/testing.rs @@ -13,7 +13,7 @@ use std::io::{BufRead, BufReader, Write}; use std::sync::{Arc, RwLock}; use uniplate::Uniplate; -use conjure_cp::ast::{AbstractLiteral, ExprInfo, Expression, GroundDomain, Moo, SerdeModel}; +use conjure_cp::ast::{AbstractLiteral, Expression, GroundDomain, Moo, SerdeModel}; use conjure_cp::context::Context; use serde_json::{Error as JsonError, Value as JsonValue}; @@ -136,11 +136,6 @@ fn serialize_domains_expr(expr: &Expression, depth: usize, output: &mut String) } } -pub fn serialize_domains_json(model: &ConjureModel) -> Result { - let exprs: Vec = model.constraints().iter().map(ExprInfo::create).collect(); - serde_json::to_string_pretty(&exprs) -} - pub fn save_model_json( model: &ConjureModel, path: &str, diff --git a/tests-integration/tests/custom/pretty-03/model.essence b/tests-integration/tests/custom/pretty-03/model.essence deleted file mode 100644 index 8e429118aa..0000000000 --- a/tests-integration/tests/custom/pretty-03/model.essence +++ /dev/null @@ -1,3 +0,0 @@ -find x,y,z : int(1..3) -find a,b,c : int(0..4) -such that (x+y < z-2) -> a + b > c diff --git a/tests-integration/tests/custom/pretty-03/run.sh b/tests-integration/tests/custom/pretty-03/run.sh deleted file mode 100644 index f6643d9724..0000000000 --- a/tests-integration/tests/custom/pretty-03/run.sh +++ /dev/null @@ -1 +0,0 @@ -conjure-oxide pretty model.essence --output-format=expression-domains-json diff --git a/tests-integration/tests/custom/pretty-03/stdout.expected b/tests-integration/tests/custom/pretty-03/stdout.expected deleted file mode 100644 index fcc60c93ba..0000000000 --- a/tests-integration/tests/custom/pretty-03/stdout.expected +++ /dev/null @@ -1,252 +0,0 @@ -[ - { - "pretty": "((sum([x,y;int(1..2)]) < (z - 2))) -> ((sum([a,b;int(1..2)]) > c))", - "domain": { - "Ground": "Bool" - }, - "children": [ - { - "pretty": "(sum([x,y;int(1..2)]) < (z - 2))", - "domain": { - "Ground": "Bool" - }, - "children": [ - { - "pretty": "sum([x,y;int(1..2)])", - "domain": { - "Ground": { - "Int": [ - { - "Bounded": [ - 2, - 6 - ] - } - ] - } - }, - "children": [ - { - "pretty": "[x,y;int(1..2)]", - "domain": { - "Ground": { - "Matrix": [ - { - "Int": [ - { - "Bounded": [ - 1, - 3 - ] - } - ] - }, - [ - { - "Int": [ - { - "Bounded": [ - 1, - 2 - ] - } - ] - } - ] - ] - } - }, - "children": [ - { - "pretty": "x", - "domain": { - "Ground": { - "Int": [ - { - "Bounded": [ - 1, - 3 - ] - } - ] - } - }, - "children": [] - }, - { - "pretty": "y", - "domain": { - "Ground": { - "Int": [ - { - "Bounded": [ - 1, - 3 - ] - } - ] - } - }, - "children": [] - } - ] - } - ] - }, - { - "pretty": "(z - 2)", - "domain": { - "Ground": { - "Int": [ - { - "Bounded": [ - -1, - 1 - ] - } - ] - } - }, - "children": [ - { - "pretty": "z", - "domain": { - "Ground": { - "Int": [ - { - "Bounded": [ - 1, - 3 - ] - } - ] - } - }, - "children": [] - }, - { - "pretty": "2", - "domain": { - "Ground": { - "Int": [ - { - "Single": 2 - } - ] - } - }, - "children": [] - } - ] - } - ] - }, - { - "pretty": "(sum([a,b;int(1..2)]) > c)", - "domain": { - "Ground": "Bool" - }, - "children": [ - { - "pretty": "sum([a,b;int(1..2)])", - "domain": { - "Ground": { - "Int": [ - { - "Bounded": [ - 0, - 8 - ] - } - ] - } - }, - "children": [ - { - "pretty": "[a,b;int(1..2)]", - "domain": { - "Ground": { - "Matrix": [ - { - "Int": [ - { - "Bounded": [ - 0, - 4 - ] - } - ] - }, - [ - { - "Int": [ - { - "Bounded": [ - 1, - 2 - ] - } - ] - } - ] - ] - } - }, - "children": [ - { - "pretty": "a", - "domain": { - "Ground": { - "Int": [ - { - "Bounded": [ - 0, - 4 - ] - } - ] - } - }, - "children": [] - }, - { - "pretty": "b", - "domain": { - "Ground": { - "Int": [ - { - "Bounded": [ - 0, - 4 - ] - } - ] - } - }, - "children": [] - } - ] - } - ] - }, - { - "pretty": "c", - "domain": { - "Ground": { - "Int": [ - { - "Bounded": [ - 0, - 4 - ] - } - ] - } - }, - "children": [] - } - ] - } - ] - } -] \ No newline at end of file