Skip to content

Commit 9ed09bb

Browse files
committed
rename AtomicPredicate to Predicate
1 parent 93ea357 commit 9ed09bb

File tree

4 files changed

+35
-35
lines changed

4 files changed

+35
-35
lines changed

crates/formality-prove/src/prove/prove_apr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use formality_types::{
2-
grammar::{AtomicPredicate, AtomicRelation, Parameter, Wcs, APR},
2+
grammar::{AtomicRelation, Parameter, Predicate, Wcs, APR},
33
judgment_fn,
44
};
55

@@ -42,7 +42,7 @@ judgment_fn! {
4242
(prove_after(&decls, c, &co_assumptions, &i.where_clause) => c)
4343
(prove_after(&decls, c, &assumptions, &t.where_clause) => c)
4444
----------------------------- ("impl")
45-
(prove_apr(decls, env, assumptions, AtomicPredicate::IsImplemented(trait_ref)) => c.pop_subst(&subst))
45+
(prove_apr(decls, env, assumptions, Predicate::IsImplemented(trait_ref)) => c.pop_subst(&subst))
4646
)
4747

4848
(
@@ -52,7 +52,7 @@ judgment_fn! {
5252
(prove_apr_via(&decls, env, &assumptions, &ti.where_clause, &trait_ref) => c)
5353
(prove_after(&decls, c, &assumptions, &ti.trait_ref) => c)
5454
----------------------------- ("trait implied bound")
55-
(prove_apr(decls, env, assumptions, AtomicPredicate::IsImplemented(trait_ref)) => c.pop_subst(&subst))
55+
(prove_apr(decls, env, assumptions, Predicate::IsImplemented(trait_ref)) => c.pop_subst(&subst))
5656
)
5757

5858
(

crates/formality-rust/src/prove.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use formality_prove as prove;
77
use formality_types::{
88
cast::{To, Upcast, Upcasted},
99
grammar::{
10-
fresh_bound_var, AliasTy, AtomicPredicate, AtomicRelation, Binder, ParameterKind, Ty, Wc,
11-
Wcs, APR,
10+
fresh_bound_var, AliasTy, AtomicRelation, Binder, ParameterKind, Predicate, Ty, Wc, Wcs,
11+
APR,
1212
},
1313
seq,
1414
};
@@ -258,7 +258,7 @@ upcast_to_wcs! {
258258
Wc,
259259
Wcs,
260260
APR,
261-
AtomicPredicate,
261+
Predicate,
262262
AtomicRelation,
263263
}
264264

crates/formality-types/src/grammar/formulas.rs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub type Fallible<T> = anyhow::Result<T>;
1717
/// Atomic predicates are the base goals we can try to prove; the rules for proving them
1818
/// are derived (at least in part) based on the Rust source declarations.
1919
#[term]
20-
pub enum AtomicPredicate {
20+
pub enum Predicate {
2121
/// True if a trait is fully implemented (along with all its where clauses).
2222
#[cast]
2323
IsImplemented(TraitRef),
@@ -53,29 +53,29 @@ impl std::ops::BitAnd for Coinductive {
5353
}
5454
}
5555

56-
impl AtomicPredicate {
56+
impl Predicate {
5757
/// True if this goal can be proven via a cycle. For example,
5858
/// it is ok for a `T: Debug` impl to require `T: Debug`.
5959
pub fn is_coinductive(&self) -> Coinductive {
6060
match self {
61-
AtomicPredicate::IsImplemented(_) => Coinductive::Yes,
62-
AtomicPredicate::NormalizesTo(_, _) => Coinductive::No,
63-
AtomicPredicate::WellFormedAlias(_, _)
64-
| AtomicPredicate::WellFormedAdt(_, _)
65-
| AtomicPredicate::WellFormedTraitRef(_) => Coinductive::Yes,
61+
Predicate::IsImplemented(_) => Coinductive::Yes,
62+
Predicate::NormalizesTo(_, _) => Coinductive::No,
63+
Predicate::WellFormedAlias(_, _)
64+
| Predicate::WellFormedAdt(_, _)
65+
| Predicate::WellFormedTraitRef(_) => Coinductive::Yes,
6666
}
6767
}
6868
}
6969

7070
impl AliasName {
71-
pub fn well_formed(&self, t: impl Upcast<Vec<Parameter>>) -> AtomicPredicate {
72-
AtomicPredicate::WellFormedAlias(self.clone(), t.upcast())
71+
pub fn well_formed(&self, t: impl Upcast<Vec<Parameter>>) -> Predicate {
72+
Predicate::WellFormedAlias(self.clone(), t.upcast())
7373
}
7474
}
7575

7676
impl AliasTy {
77-
pub fn normalizes_to(&self, t: impl Upcast<Ty>) -> AtomicPredicate {
78-
AtomicPredicate::NormalizesTo(self.clone(), t.upcast())
77+
pub fn normalizes_to(&self, t: impl Upcast<Ty>) -> Predicate {
78+
Predicate::NormalizesTo(self.clone(), t.upcast())
7979
}
8080
}
8181

@@ -113,35 +113,35 @@ pub enum AtomicSkeleton {
113113
Outlives,
114114
}
115115

116-
impl AtomicPredicate {
116+
impl Predicate {
117117
/// Separate an atomic predicate into the "skeleton" (which can be compared for equality using `==`)
118118
/// and the parameters (which must be related).
119119
pub fn debone(&self) -> (AtomicSkeleton, Vec<Parameter>) {
120120
match self {
121-
AtomicPredicate::IsImplemented(TraitRef {
121+
Predicate::IsImplemented(TraitRef {
122122
trait_id,
123123
parameters,
124124
}) => (
125125
AtomicSkeleton::IsImplemented(trait_id.clone()),
126126
parameters.clone(),
127127
),
128-
AtomicPredicate::NormalizesTo(AliasTy { name, parameters }, ty) => (
128+
Predicate::NormalizesTo(AliasTy { name, parameters }, ty) => (
129129
AtomicSkeleton::NormalizesTo(name.clone()),
130130
parameters
131131
.iter()
132132
.cloned()
133133
.chain(Some(ty.to_parameter()))
134134
.collect(),
135135
),
136-
AtomicPredicate::WellFormedAdt(id, parameters) => (
136+
Predicate::WellFormedAdt(id, parameters) => (
137137
AtomicSkeleton::WellFormedAdt(id.clone()),
138138
parameters.clone(),
139139
),
140-
AtomicPredicate::WellFormedAlias(id, parameters) => (
140+
Predicate::WellFormedAlias(id, parameters) => (
141141
AtomicSkeleton::WellFormedAlias(id.clone()),
142142
parameters.clone(),
143143
),
144-
AtomicPredicate::WellFormedTraitRef(TraitRef {
144+
Predicate::WellFormedTraitRef(TraitRef {
145145
trait_id,
146146
parameters,
147147
}) => (
@@ -153,18 +153,18 @@ impl AtomicPredicate {
153153
}
154154

155155
impl TraitRef {
156-
pub fn is_implemented(&self) -> AtomicPredicate {
157-
AtomicPredicate::IsImplemented(self.clone())
156+
pub fn is_implemented(&self) -> Predicate {
157+
Predicate::IsImplemented(self.clone())
158158
}
159159

160-
pub fn well_formed(&self) -> AtomicPredicate {
161-
AtomicPredicate::WellFormedTraitRef(self.clone())
160+
pub fn well_formed(&self) -> Predicate {
161+
Predicate::WellFormedTraitRef(self.clone())
162162
}
163163
}
164164

165165
impl AdtId {
166-
pub fn well_formed(&self, parameters: impl Upcast<Vec<Parameter>>) -> AtomicPredicate {
167-
AtomicPredicate::WellFormedAdt(self.clone(), parameters.upcast())
166+
pub fn well_formed(&self, parameters: impl Upcast<Vec<Parameter>>) -> Predicate {
167+
Predicate::WellFormedAdt(self.clone(), parameters.upcast())
168168
}
169169
}
170170

@@ -253,7 +253,7 @@ impl TraitId {
253253
#[term]
254254
pub enum APR {
255255
#[cast]
256-
AtomicPredicate(AtomicPredicate),
256+
AtomicPredicate(Predicate),
257257
#[cast]
258258
AtomicRelation(AtomicRelation),
259259
}
@@ -282,9 +282,9 @@ macro_rules! debone_impl {
282282
}
283283

284284
debone_impl!(APR);
285-
debone_impl!(AtomicPredicate);
285+
debone_impl!(Predicate);
286286
debone_impl!(AtomicRelation);
287287

288288
// Transitive casting impls:
289289

290-
cast_impl!((TraitRef) <: (AtomicPredicate) <: (APR));
290+
cast_impl!((TraitRef) <: (Predicate) <: (APR));

crates/formality-types/src/grammar/wc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::{
1010
set,
1111
};
1212

13-
use super::{AtomicPredicate, AtomicRelation, Binder, BoundVar, TraitRef};
13+
use super::{AtomicRelation, Binder, BoundVar, Predicate, TraitRef};
1414

1515
#[term($set)]
1616
pub struct Wcs {
@@ -152,7 +152,7 @@ impl DowncastFrom<Wc> for WcData {
152152

153153
cast_impl!((APR) <: (WcData) <: (Wc));
154154
cast_impl!((AtomicRelation) <: (APR) <: (Wc));
155-
cast_impl!((AtomicPredicate) <: (APR) <: (Wc));
155+
cast_impl!((Predicate) <: (APR) <: (Wc));
156156
cast_impl!((TraitRef) <: (APR) <: (Wc));
157157

158158
impl UpcastFrom<Wc> for Wcs {
@@ -173,5 +173,5 @@ impl DowncastTo<Wc> for Wcs {
173173

174174
cast_impl!((APR) <: (Wc) <: (Wcs));
175175
cast_impl!((AtomicRelation) <: (Wc) <: (Wcs));
176-
cast_impl!((AtomicPredicate) <: (Wc) <: (Wcs));
176+
cast_impl!((Predicate) <: (Wc) <: (Wcs));
177177
cast_impl!((TraitRef) <: (Wc) <: (Wcs));

0 commit comments

Comments
 (0)