Skip to content

Formal Methods

Formal Methods — mvp.formal_methods

Cluster: Formal Verification | Type: component | MCP Tools: 437

Overview

formal_methods dispatches formal verification queries to solver backends (Z3, Lean, Prolog, TLA+, DPLL, SageMath, Catlab, and more) for propositional logic, SMT solving, theorem proving, and model checking. It exposes 405 tools across 18 MCP sub-packages (16 active, 2 reference-only shells). mermaid_mcp and pics_to_latex_mcp are the deprecated reference-only shells and do not register active tools.

When to use:

  • Verifying safety invariants and pipeline correctness properties
  • SAT/SMT solving for constraint satisfaction problems
  • Formal proofs via Lean, Curry-Howard, or Prolog-style reasoning
  • Checking that an NL->formal translation captured intent before trusting a verified result (intent_fidelity.check_translation_fidelity / autoformalization translation_fidelity field): emits a plain-language back-translation + a risk-tiered, solver-grounded translation-confidence that floors completion_state fail-closed.

Example:

from mvp.formal_methods import FormalMethodsBlock, LogicalQuery

block = FormalMethodsBlock(name="fm")
result = block.infer(LogicalQuery(solver="propositional", formula="(A | B) & ~A"))
# result.ok → True; result.value → FormalResult with satisfiable=True

Works well with: core, align_csf, cegis, meta_programming

Public API

FormalMethodsBlock(AIBlock[LogicalQuery, FormalResult, None])

Dispatches formal verification queries to the appropriate solver.

Field Type Default
name str 'formal_methods'
resource_bounds ResourceBounds \| None None
usage ResourceUsage field(default_factory=ResourceUsage)

Methods:

infer(data: LogicalQuery) -> Result[FormalResult]

capability_plan(op: str, params: dict) -> CapabilityResolution

heavy_dependency_status() -> list[dict]

list_patterns() -> dict[str, object]

Return the applied deterministic-reliability pattern catalog.

FormalMethodsPatternRuntime

Deterministic assurance re-derivation + result self-check (no LLM, no I/O).

Methods:

classify_assurance(solver_used: str, verified: bool, toolchain_available: bool, conclusive: bool, failed: bool = False) -> tuple[str, bool]

Re-derive (assurance_level, review_required) from first principles.

validate_result(result: Any) -> list[str]

Return internal-consistency violations of an emitted FormalResult.

assert_consistent(result: Any) -> Any

Live-path guard: raise if the emitted result is internally inconsistent.

LogicalQuery(BaseModel)

Input for FormalMethodsBlock.

Field Type Default
formula str ''
code str ''
solver Literal['z3', 'propositional', 'prolog', 'lean'] 'z3'
variables dict[str, str] Field(default_factory=dict)
assertions list[str] Field(default_factory=list)
timeout_sec int 30
risk_level Literal['low', 'medium', 'high', 'regulated', 'safety_critical'] 'medium'
operation str \| None None
backend str \| None None
source_payload dict[str, Any] Field(default_factory=dict)
statement str ''
target_system str 'z3_smtlib'
verification_property dict[str, Any] \| None None
ensemble_samples int 1
triangulate bool False
request_id str ''
task_id str ''
run_id str ''

FormalResult(BaseModel)

Result from FormalMethodsBlock.

Field Type Default
satisfiable bool \| None None
proof str ''
model dict[str, Any] Field(default_factory=dict)
solver_used str ''
elapsed_sec float 0.0
error str ''
verification_status str ''
verifier str ''
artifact_hash str ''
artifact_json str ''
policy_decision str ''
policy_json str ''
degraded bool False
degradation_reason str \| None None
completion_state Literal['verified', 'qualified-draft', 'blocked-escalated'] 'qualified-draft'
warning_card str ''
evidence dict[str, Any] Field(default_factory=dict)
request_id str ''
task_id str ''
run_id str ''
assurance_level Literal['primary', 'fallback'] 'fallback'
review_required bool True
proof_artifact_path str \| None None
translation_fidelity TranslationFidelity \| None None
triangulation dict \| None None
optimality OptimalityStamp Field(default_factory=OptimalityStamp)

FormalMethodsSkill

Field Type Default
name str required
pattern_slug str required
description str required
executable bool required
mechanism str required
capabilities tuple[str, ...] required
triggers tuple[str, ...] required
risk_notes tuple[str, ...] required

Methods:

compact() -> dict[str, Any]

FormalMethodsSkillCatalog

Maps each applied pattern slug to a formal_methods deterministic-reliability skill.

Methods:

list_skills() -> list[FormalMethodsSkill]

executable_skills() -> list[FormalMethodsSkill]

get(slug: str) -> FormalMethodsSkill | None

Functions

applied_agentic_patterns() -> list[dict[str, Any]]

Return compact metadata for formal_methods-applied vendored patterns.

dpll_solve(formula: str, extra_vars: set[str] | None = None) -> dict[str, bool] | None

DPLL SAT solver for simple propositional formulas.

get_skill_catalog() -> FormalMethodsSkillCatalog

solver_support_matrix() -> dict[str, dict[str, Any]]

Return honest availability/version metadata for supported solvers.

MCP Tools

Operation Source
create_category catlab_mcp
compose catlab_mcp
check_functor catlab_mcp
natural_transformation catlab_mcp
limit catlab_mcp
colimit catlab_mcp
apply_rewrite catlab_mcp
decapode catlab_mcp
save_artifact catlab_mcp
get_artifact catlab_mcp
list_artifacts catlab_mcp
delete_artifact catlab_mcp
check_commuting catlab_mcp
find_adjunction catlab_mcp
check_monoidal catlab_mcp
evaluate_petri catlab_mcp
simulate_dynamics catlab_mcp
create_schema catlab_mcp
query_cset catlab_mcp
migrate_cset catlab_mcp
search catlab_mcp
export_json catlab_mcp
julia_status catlab_mcp
info catlab_mcp
run_code catlab_mcp
prove curry_howard_mcp
check_proof curry_howard_mcp
and_intro curry_howard_mcp
and_elim curry_howard_mcp
or_intro curry_howard_mcp
or_elim curry_howard_mcp
imply_intro curry_howard_mcp
imply_elim curry_howard_mcp
deduction curry_howard_mcp
modus_ponens curry_howard_mcp
compose_proofs curry_howard_mcp
chain curry_howard_mcp
save_proof curry_howard_mcp
get_proof curry_howard_mcp
list_proofs curry_howard_mcp
delete_proof curry_howard_mcp
validate_proof curry_howard_mcp
compare_proofs curry_howard_mcp
inspect_proof curry_howard_mcp
explain_proof curry_howard_mcp
type_check curry_howard_mcp
search curry_howard_mcp
export_json curry_howard_mcp
info curry_howard_mcp
run_code curry_howard_mcp
query datalog_mcp
assert_fact datalog_mcp
assert_rule datalog_mcp
retract datalog_mcp
create_program datalog_mcp
load_program datalog_mcp
run_program datalog_mcp
aggregate datalog_mcp
negation datalog_mcp
recursive_query datalog_mcp
save_program datalog_mcp
get_program datalog_mcp
list_programs datalog_mcp
update_program datalog_mcp
delete_program datalog_mcp
validate datalog_mcp
explain_derivation datalog_mcp
inspect_database datalog_mcp
compare_programs datalog_mcp
optimize_query datalog_mcp
ground datalog_mcp
search datalog_mcp
export_datalog datalog_mcp
info datalog_mcp
run_code datalog_mcp
create_causal_model dowhy_mcp
identify_effect dowhy_mcp
estimate_effect dowhy_mcp
refute_estimate dowhy_mcp
counterfactual dowhy_mcp
do_calculus dowhy_mcp
sensitivity_analysis dowhy_mcp
save_model dowhy_mcp
get_model dowhy_mcp
list_models dowhy_mcp
update_model dowhy_mcp
delete_model dowhy_mcp
validate_dag dowhy_mcp
find_instruments dowhy_mcp
mediation_analysis dowhy_mcp
compare_estimators dowhy_mcp
backdoor_paths dowhy_mcp
load_data dowhy_mcp
generate_synthetic dowhy_mcp
summarize_data dowhy_mcp
search dowhy_mcp
export_graph dowhy_mcp
visualize dowhy_mcp
info dowhy_mcp
run_code dowhy_mcp
solve_lp google_or_mcp
solve_mip google_or_mcp
solve_cp google_or_mcp
solve_routing google_or_mcp
solve_assignment google_or_mcp
solve_knapsack google_or_mcp
solve_flow google_or_mcp
solve_scheduling google_or_mcp
save_model google_or_mcp
get_model google_or_mcp
list_models google_or_mcp
update_model google_or_mcp
delete_model google_or_mcp
validate_model google_or_mcp
get_solution google_or_mcp
compare_solutions google_or_mcp
sensitivity_analysis google_or_mcp
relaxation google_or_mcp
dual_values google_or_mcp
search google_or_mcp
export_model google_or_mcp
import_model google_or_mcp
visualize google_or_mcp
info google_or_mcp
run_code google_or_mcp
check_proof lean_mcp
elaborate lean_mcp
type_check lean_mcp
eval_expr lean_mcp
search_library lean_mcp
tactic_apply lean_mcp
infer_type lean_mcp
unfold_definition lean_mcp
save_theorem lean_mcp
get_theorem lean_mcp
list_theorems lean_mcp
update_theorem lean_mcp
delete_theorem lean_mcp
validate_proof lean_mcp
compare_proofs lean_mcp
inspect_term lean_mcp
explain_tactic lean_mcp
find_lemma lean_mcp
suggest_tactic lean_mcp
check_termination lean_mcp
search lean_mcp
export_lean lean_mcp
lean_status lean_mcp
info lean_mcp
run_code lean_mcp
oracle math_reasoning_mcp
prove math_reasoning_mcp
meta math_reasoning_mcp
render mermaid_mcp
validate_syntax mermaid_mcp
create_flowchart mermaid_mcp
create_sequence mermaid_mcp
create_class_diagram mermaid_mcp
create_state_diagram mermaid_mcp
create_er_diagram mermaid_mcp
create_gantt mermaid_mcp
create_pie mermaid_mcp
create_mindmap mermaid_mcp
save_diagram mermaid_mcp
get_diagram mermaid_mcp
list_diagrams mermaid_mcp
update_diagram mermaid_mcp
delete_diagram mermaid_mcp
compare_diagrams mermaid_mcp
inspect_diagram mermaid_mcp
explain_syntax mermaid_mcp
convert_format mermaid_mcp
merge_diagrams mermaid_mcp
search mermaid_mcp
export_svg mermaid_mcp
export_png mermaid_mcp
info mermaid_mcp
run_code mermaid_mcp
load_ontology owlready2_mcp
create_ontology owlready2_mcp
add_class owlready2_mcp
add_individual owlready2_mcp
add_property owlready2_mcp
query_sparql owlready2_mcp
classify owlready2_mcp
check_consistency owlready2_mcp
get_ancestors owlready2_mcp
get_descendants owlready2_mcp
save_ontology owlready2_mcp
get_ontology owlready2_mcp
list_ontologies owlready2_mcp
update_ontology owlready2_mcp
delete_ontology owlready2_mcp
validate_ontology owlready2_mcp
compare_ontologies owlready2_mcp
inspect_class owlready2_mcp
explain_inference owlready2_mcp
merge_ontologies owlready2_mcp
export_owl owlready2_mcp
import_owl owlready2_mcp
search owlready2_mcp
info owlready2_mcp
run_code owlready2_mcp
ocr_to_latex pics_to_latex_mcp
latex_to_sympy pics_to_latex_mcp
simplify_expr pics_to_latex_mcp
solve_equation pics_to_latex_mcp
differentiate pics_to_latex_mcp
integrate pics_to_latex_mcp
series_expand pics_to_latex_mcp
factor pics_to_latex_mcp
expand pics_to_latex_mcp
substitute pics_to_latex_mcp
save_expression pics_to_latex_mcp
get_expression pics_to_latex_mcp
list_expressions pics_to_latex_mcp
update_expression pics_to_latex_mcp
delete_expression pics_to_latex_mcp
validate_latex pics_to_latex_mcp
compare_expressions pics_to_latex_mcp
inspect_expression pics_to_latex_mcp
explain_steps pics_to_latex_mcp
numeric_eval pics_to_latex_mcp
search pics_to_latex_mcp
export_latex pics_to_latex_mcp
latex_to_mathml pics_to_latex_mcp
info pics_to_latex_mcp
run_code pics_to_latex_mcp
consult prolog_mcp
query prolog_mcp
assert_clause prolog_mcp
retract_clause prolog_mcp
findall prolog_mcp
functor prolog_mcp
unify prolog_mcp
cut_fail prolog_mcp
trace_query prolog_mcp
meta_interpret prolog_mcp
save_program prolog_mcp
get_program prolog_mcp
list_programs prolog_mcp
update_program prolog_mcp
delete_program prolog_mcp
validate_program prolog_mcp
compare_programs prolog_mcp
inspect_predicate prolog_mcp
explain_query prolog_mcp
module_info prolog_mcp
search prolog_mcp
export_prolog prolog_mcp
import_prolog prolog_mcp
info prolog_mcp
run_code prolog_mcp
check_model pynusmv_mcp
check_ctl pynusmv_mcp
check_ltl pynusmv_mcp
simulate pynusmv_mcp
bmc_check pynusmv_mcp
counterexample pynusmv_mcp
reachability pynusmv_mcp
fairness_check pynusmv_mcp
cone_of_influence pynusmv_mcp
check_invariant pynusmv_mcp
save_model pynusmv_mcp
get_model pynusmv_mcp
list_models pynusmv_mcp
update_model pynusmv_mcp
delete_model pynusmv_mcp
validate_model pynusmv_mcp
compare_models pynusmv_mcp
inspect_state pynusmv_mcp
explain_result pynusmv_mcp
deadlock_check pynusmv_mcp
search pynusmv_mcp
export_smv pynusmv_mcp
import_smv pynusmv_mcp
info pynusmv_mcp
run_code pynusmv_mcp
add_rule pyreason_mcp
add_fact pyreason_mcp
reason pyreason_mcp
query_node pyreason_mcp
query_edge pyreason_mcp
set_threshold pyreason_mcp
temporal_reason pyreason_mcp
get_interpretation pyreason_mcp
explain_rule pyreason_mcp
ground_rules pyreason_mcp
save_graph pyreason_mcp
get_graph pyreason_mcp
list_graphs pyreason_mcp
update_graph pyreason_mcp
delete_graph pyreason_mcp
validate_graph pyreason_mcp
compare_graphs pyreason_mcp
inspect_node pyreason_mcp
explain_reasoning pyreason_mcp
fixpoint_analysis pyreason_mcp
search pyreason_mcp
export_graph pyreason_mcp
import_graph pyreason_mcp
info pyreason_mcp
run_code pyreason_mcp
create_sheaf pysheaf_mcp
add_section pysheaf_mcp
restrict pysheaf_mcp
glue pysheaf_mcp
check_gluing pysheaf_mcp
stalk pysheaf_mcp
pushforward pysheaf_mcp
pullback pysheaf_mcp
sheafify pysheaf_mcp
cohomology pysheaf_mcp
save_sheaf pysheaf_mcp
get_sheaf pysheaf_mcp
list_sheaves pysheaf_mcp
update_sheaf pysheaf_mcp
delete_sheaf pysheaf_mcp
validate_sheaf pysheaf_mcp
compare_sheaves pysheaf_mcp
inspect_sheaf pysheaf_mcp
explain_sheaf pysheaf_mcp
euler_characteristic pysheaf_mcp
nerve pysheaf_mcp
search pysheaf_mcp
export_json pysheaf_mcp
info pysheaf_mcp
run_code pysheaf_mcp
consistency_radius pysheaf_mcp
consistency_energy pysheaf_mcp
spectral_gap pysheaf_mcp
compositional_defect pysheaf_mcp
compute sagemath_mcp
factor_integer sagemath_mcp
solve_equation sagemath_mcp
matrix_ops sagemath_mcp
polynomial_ring sagemath_mcp
number_theory sagemath_mcp
group_theory sagemath_mcp
graph_theory sagemath_mcp
combinatorics sagemath_mcp
calculus sagemath_mcp
save_result sagemath_mcp
get_result sagemath_mcp
list_results sagemath_mcp
update_result sagemath_mcp
delete_result sagemath_mcp
validate_expr sagemath_mcp
compare_results sagemath_mcp
inspect_object sagemath_mcp
explain_computation sagemath_mcp
latex_render sagemath_mcp
search sagemath_mcp
export_sage sagemath_mcp
sage_status sagemath_mcp
info sagemath_mcp
run_code sagemath_mcp
check_spec tla_mcp
check_invariant tla_mcp
check_property tla_mcp
check_liveness tla_mcp
simulate_spec tla_mcp
parse_spec tla_mcp
get_states tla_mcp
check_deadlock tla_mcp
check_symmetry tla_mcp
temporal_check tla_mcp
save_spec tla_mcp
get_spec tla_mcp
list_specs tla_mcp
update_spec tla_mcp
delete_spec tla_mcp
validate_spec tla_mcp
compare_specs tla_mcp
inspect_state tla_mcp
explain_violation tla_mcp
coverage_analysis tla_mcp
search tla_mcp
export_tla tla_mcp
import_tla tla_mcp
info tla_mcp
run_code tla_mcp
create_category yoneda_mcp
add_morphism yoneda_mcp
compose yoneda_mcp
check_identity yoneda_mcp
create_functor yoneda_mcp
apply_functor yoneda_mcp
natural_transformation yoneda_mcp
yoneda_embed yoneda_mcp
yoneda_extract yoneda_mcp
representable yoneda_mcp
verify_roundtrip yoneda_mcp
natural_isomorphism yoneda_mcp
semantic_bridge yoneda_mcp
save_artifact yoneda_mcp
get_artifact yoneda_mcp
list_artifacts yoneda_mcp
delete_artifact yoneda_mcp
validate yoneda_mcp
compare yoneda_mcp
inspect yoneda_mcp
explain yoneda_mcp
search yoneda_mcp
export_json yoneda_mcp
info yoneda_mcp
run_code yoneda_mcp
ops z3_mcp
help z3_mcp
check_sat z3_mcp
check_sat_incremental z3_mcp
prove z3_mcp
optimize z3_mcp
simplify z3_mcp
get_model z3_mcp
quantifier_eliminate z3_mcp
interpolate z3_mcp
create_context z3_mcp
get_context z3_mcp
list_contexts z3_mcp
update_context z3_mcp
delete_context z3_mcp
get_unsat_core z3_mcp
check_entailment z3_mcp
count_models z3_mcp
compare_formulas z3_mcp
get_proof z3_mcp
bitvec_solve z3_mcp
array_solve z3_mcp
string_solve z3_mcp
search z3_mcp
export_smtlib z3_mcp
info z3_mcp
run_code z3_mcp
z3_prove z3_mcp
z3_check z3_mcp
z3_counterexample z3_mcp