update claude settings and wip DAG with SlotMap

This commit is contained in:
2026-04-22 11:45:35 +02:00
parent 345bc0f126
commit 5ef4893f03
10 changed files with 155 additions and 0 deletions

26
examples/dag.rs Normal file
View File

@@ -0,0 +1,26 @@
use std::cell::RefCell;
use std::rc::Rc;
use circuit_cas::circuit::dag::{Circuit, CircuitExt};
use circuit_cas::var;
fn main() {
let circuit = Rc::new(RefCell::new(Circuit::new()));
// Build (x + y) * (x + z)
let x = circuit.leaf(var!("x"));
let y = circuit.leaf(var!("y"));
let z = circuit.leaf(var!("z"));
let x_plus_y = circuit.leaf(var!("x")) + y;
let x_plus_z = circuit.leaf(var!("x")) + z;
let expr = x_plus_y * x_plus_z;
// Deduplication: both x leaves share the same NodeId
let x2 = circuit.leaf(var!("x"));
assert_eq!(x.id, x2.id);
println!("(x + y) * (x + z) root node id: {:?}", expr.id);
println!("x node id: {:?}", x.id);
println!("x deduplicated node id: {:?}", x2.id);
}