@@ -84,7 +84,7 @@ impl BddManagerStats {
84
84
}
85
85
}
86
86
87
- pub trait BddBuilder < ' a > : BottomUpBuilder < ' a , Ptr = BddPtr < ' a > > {
87
+ pub trait BddBuilder < ' a > : BottomUpBuilder < ' a , BddPtr < ' a > > {
88
88
fn eq_bdd ( & self , a : BddPtr , b : BddPtr ) -> bool ;
89
89
90
90
fn get_or_insert ( & ' a self , bdd : BddNode < ' a > ) -> BddPtr < ' a > ;
@@ -114,22 +114,22 @@ pub trait BddBuilder<'a>: BottomUpBuilder<'a, Ptr = BddPtr<'a>> {
114
114
}
115
115
}
116
116
117
- impl < ' a , T > BottomUpBuilder < ' a > for T
117
+ impl < ' a , T > BottomUpBuilder < ' a , BddPtr < ' a > > for T
118
118
where
119
119
T : BddBuilder < ' a > ,
120
120
{
121
- type Ptr = BddPtr < ' a > ;
121
+ // type Ptr = BddPtr<'a>;
122
122
123
- fn true_ptr ( & self ) -> Self :: Ptr {
123
+ fn true_ptr ( & self ) -> BddPtr < ' a > {
124
124
BddPtr :: true_ptr ( )
125
125
}
126
126
127
- fn false_ptr ( & self ) -> Self :: Ptr {
127
+ fn false_ptr ( & self ) -> BddPtr < ' a > {
128
128
BddPtr :: false_ptr ( )
129
129
}
130
130
131
131
/// Get a pointer to the variable with label `lbl` and polarity `polarity`
132
- fn var ( & ' a self , label : VarLabel , polarity : bool ) -> Self :: Ptr {
132
+ fn var ( & ' a self , label : VarLabel , polarity : bool ) -> BddPtr < ' a > {
133
133
let bdd = BddNode :: new ( label, BddPtr :: false_ptr ( ) , BddPtr :: true_ptr ( ) ) ;
134
134
let r = self . get_or_insert ( bdd) ;
135
135
if polarity {
@@ -153,45 +153,45 @@ where
153
153
/// let a_and_not_a = man.and(a, a.neg());
154
154
/// assert!(a_and_not_a.is_false());
155
155
/// ```
156
- fn and ( & ' a self , f : Self :: Ptr , g : Self :: Ptr ) -> Self :: Ptr {
156
+ fn and ( & ' a self , f : BddPtr < ' a > , g : BddPtr < ' a > ) -> BddPtr < ' a > {
157
157
self . ite ( f, g, BddPtr :: false_ptr ( ) )
158
158
}
159
159
160
- fn negate ( & ' a self , f : Self :: Ptr ) -> Self :: Ptr {
160
+ fn negate ( & ' a self , f : BddPtr < ' a > ) -> BddPtr < ' a > {
161
161
f. neg ( )
162
162
}
163
163
164
164
/// if f then g else h
165
- fn ite ( & ' a self , f : Self :: Ptr , g : Self :: Ptr , h : Self :: Ptr ) -> Self :: Ptr {
165
+ fn ite ( & ' a self , f : BddPtr < ' a > , g : BddPtr < ' a > , h : BddPtr < ' a > ) -> BddPtr < ' a > {
166
166
self . ite_helper ( f, g, h)
167
167
}
168
168
169
169
/// Compute the Boolean function `f iff g`
170
- fn iff ( & ' a self , f : Self :: Ptr , g : Self :: Ptr ) -> Self :: Ptr {
170
+ fn iff ( & ' a self , f : BddPtr < ' a > , g : BddPtr < ' a > ) -> BddPtr < ' a > {
171
171
self . ite ( f, g, g. neg ( ) )
172
172
}
173
173
174
- fn xor ( & ' a self , f : Self :: Ptr , g : Self :: Ptr ) -> Self :: Ptr {
174
+ fn xor ( & ' a self , f : BddPtr < ' a > , g : BddPtr < ' a > ) -> BddPtr < ' a > {
175
175
self . ite ( f, g. neg ( ) , g)
176
176
}
177
177
178
178
/// Existentially quantifies out the variable `lbl` from `f`
179
- fn exists ( & ' a self , bdd : Self :: Ptr , lbl : VarLabel ) -> Self :: Ptr {
179
+ fn exists ( & ' a self , bdd : BddPtr < ' a > , lbl : VarLabel ) -> BddPtr < ' a > {
180
180
// TODO this can be optimized by specializing it
181
181
let v1 = self . condition ( bdd, lbl, true ) ;
182
182
let v2 = self . condition ( bdd, lbl, false ) ;
183
183
self . or ( v1, v2)
184
184
}
185
185
186
186
/// Compute the Boolean function `f | var = value`
187
- fn condition ( & ' a self , bdd : Self :: Ptr , lbl : VarLabel , value : bool ) -> Self :: Ptr {
187
+ fn condition ( & ' a self , bdd : BddPtr < ' a > , lbl : VarLabel , value : bool ) -> BddPtr < ' a > {
188
188
let r = self . cond_helper ( bdd, lbl, value) ;
189
189
bdd. clear_scratch ( ) ;
190
190
r
191
191
}
192
192
193
193
/// Compose `g` into `f` by substituting for `lbl`
194
- fn compose ( & ' a self , f : Self :: Ptr , lbl : VarLabel , g : Self :: Ptr ) -> Self :: Ptr {
194
+ fn compose ( & ' a self , f : BddPtr < ' a > , lbl : VarLabel , g : BddPtr < ' a > ) -> BddPtr < ' a > {
195
195
// TODO this can be optimized with a specialized implementation to make
196
196
// it a single traversal
197
197
let var = self . var ( lbl, true ) ;
0 commit comments