3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-03-22 20:39:11 +00:00
z3/src/tactic/core/injectivity_tactic.h
copilot-swe-agent[bot] c303b56f04 Add injectivity_simplifier and register injectivity2 tactic + injectivity simplifier
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
2026-03-12 04:37:17 +00:00

67 lines
1.6 KiB
C++

/*++
Copyright (c) 2017 Microsoft Corporation
Module Name:
injectivity_tactic.h
Abstract:
Injectivity tactics
Author:
Nicolas Braud-Santoni (t-nibrau) 2017-08-10
Tactic Documentation:
## Tactic injectivity
### Short Description:
- Discover axioms of the form `forall x. (= (g (f x)) x`
Mark `f` as injective
- Rewrite (sub)terms of the form `(= (f x) (f y))` to `(= x y)` whenever `f` is injective.
### Example
```z3
(declare-fun f (Int) Int)
(declare-fun g (Int) Int)
(declare-const x Int)
(declare-const y Int)
(assert (forall ((x Int)) (= (g (f x)) x)))
(assert (not (= (f x) (f (f y)))))
(apply injectivity)
```
### Notes
* does not support cores nor proofs
--*/
#pragma once
#include "util/params.h"
#include "tactic/dependent_expr_state_tactic.h"
#include "ast/simplifiers/injectivity_simplifier.h"
class ast_manager;
class tactic;
tactic * mk_injectivity_tactic(ast_manager & m, params_ref const & p = params_ref());
inline tactic* mk_injectivity2_tactic(ast_manager& m, params_ref const& p = params_ref()) {
return alloc(dependent_expr_state_tactic, m, p,
[](auto& m, auto& p, auto& s) -> dependent_expr_simplifier* {
return alloc(injectivity_simplifier, m, p, s);
});
}
/*
ADD_TACTIC("injectivity", "Identifies and applies injectivity axioms.", "mk_injectivity_tactic(m, p)")
ADD_TACTIC("injectivity2", "Identifies and applies injectivity axioms.", "mk_injectivity2_tactic(m, p)")
ADD_SIMPLIFIER("injectivity", "Identifies and applies injectivity axioms.", "alloc(injectivity_simplifier, m, p, s)")
*/