fromz3importSolver,Int,And,satdefllm_solve_with_check(problem):code=claude.complete(f"Translate to Z3 Python: {problem}")s=Solver()exec(code)# populates sifs.check()==sat:returns.model()else:returnclaude.complete(f"Z3 returned UNSAT. Repair: {code}")
PSL soft-logic rule
# Lukasiewicz t-norm: A ^ B = max(0, A + B - 1); A => B = min(1, 1 - A + B).# Rule: similar(p,q) ^ likes(p, x) => likes(q, x) [weight 5]# Inference: minimize Σ w_i * max(0, body - head) over continuous truth values.
Scallop differentiable Datalog
importscallopyctx=scallopy.ScallopContext(provenance="difftopkproofs")ctx.add_relation("digit",(int,float),input_mapping=[(0,),(1,),...])ctx.add_rule("sum(a + b) = digit(_, a), digit(_, b)")# Plug into PyTorch; gradients flow through proof structure.
매 결정 기준
상황
Approach
Discrete random variables, known structure
Bayesian network (pgmpy)
First-order rules + data
MLN / ProbLog
Soft constraints, large scale
PSL
Neural perception + symbolic reasoning
DeepProbLog / Scallop
LLM reasoning correctness
LLM + Z3/Lean verifier
Complex generative model
Pyro / PyMC
기본값: For neuro-symbolic 2026 — Scallop 또는 LLM+verifier; for pure SRL, ProbLog.