1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
//
// ::formally - the open-source formal methods toolchain
//
// Copyright (c) 2025 Nicola Gigante
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE IntsBLE FOR ANY CLAIM, DAMAGES OR OTHER
// IntsBILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
//! Declaration and usage of SMT-LIBv2 theories.
//!
//! This module contains everything regarding the declaration and usage of *theories* understood as
//! in the terminology of SMT-LIBv2.
//!
//! Most of the types declared in this module, except [CombinedTheory], are theories declared
//! through the [theories!] macro, so one may want to look at its documentation as well.
//!
//! Each theory type is a unit struct (e.g. declared as `pub struct Ints;`, so it is instantiated as
//! `Ints`, not `Ints {}`) and exposes a set of associated functions, one for each symbol provided
//! by the theory. Function and constant symbols (e.g. [Ints::plus()] or [Core::True()] are
//! represented by returning a [Primitive] object. Sorts (e.g. [Ints::Int()]) return a [Sort].
//!
//! For parametric sorts (e.g. `(Array X Y)`) the corresponding functions accept a suitable number
//! of [sort arguments](SortArgument), so `(Array Int Int)` would be represented by
//! `Arrays::Array(Ints::Int(), Ints::Int())`.
//!
//! Theories are usually combined in a [Logic](logics::Logic), and the logic is what is set when
//! instantiating a [Solver]. When a logic is set to a solver, its symbols become in scope when
//! the solver applies [name resolution](Term::resolve()) to terms (e.g. those constructed with the
//! [term] macro). Therefore, in common usage of the framework, elements in this module should
//! rarely need to be mentioned directly.
//!
//! Instead, people implementing new *backends* will need to access this module quite
//! often. We refer to the documentation on [how to write a new backend](crate::backends) for
//! details.
use crate::*;
use *;
pub use *;
/// A trait for types representing SMT-LIBv2 theories.
///
/// The purpose of a theory object is that of providing an [environment](Env) providing the symbols
/// that the theory has to provide. Therefore, the trait expose two methods
/// ([functions()](Theory::functions()) and [sorts()](crate::theories::Theory::sorts()) to return
/// the corresponding function and sort scopes.
///
/// Implementing this trait directly is quite rare, since theories are usually better declared
/// using the [theories!] macro.
/// An instance of [Theory] combining multiple theories together.
static SORT_DECL: PrimitiveData = PrimitiveData ;