Comments (5)
Evaluating the "cannot prove" rule on the various examples shows that it works well, modulo the imprecision around not
and forall
binders I mentioned:
Example 1. In the first case (forall<T> { T: Foo }
), trying to unify T: Foo
against the impl would yield CannotProve
, which would lead to an overall CannotProve
result. Negating CannotProve
again yields CannotProve
. This successfully indicates that the goal may be provable for some instantiations (but not all).
Example 2. Negation and binders. We would yield CannotProve
for both; to do better requires a different fulfillment context desugaring.
Example 3. Unifying the T: Iterator<Item = i32>
goal with the impl would yield CannotProve
, and hence we would drop that rule in favor of T: Iterator<Item = i32>
from the environment.
from chalk.
After #45, this might be basically done -- the only thing left might be changing how we handle negative reasoning, if we decide we want more precise results. That could also be a separate bug.
from chalk.
Definite: The goal will definitely work. (Does this mean something closer to Unique?)
That's not quite right. The reading is rather: if this goal is to ever work, the existentials must take the given values.
from chalk.
@aturon updated
from chalk.
So I resolved this in #60. The first key observation is that free universally quantified variables (i.e., ForAll
) cannot be considered ground and require some special treatment (this is why for<A, B> { not { A = B } }
was giving us such trouble). The second is that the behavior of existentials in that case is exactly what we want. So essentially was #60 does is to say that, to solve a query like not { !1 = !2 }
, we will check whether ?1 = ?2
has any answers. In other words, convert the universally quantified variables into existential ones. This allows us to drop "cannot prove" entirely.
Revisiting my examples:
Example 1.
trait Foo {}
struct i32 {}
impl Foo for i32 {}
forall<T> { T: Foo } // false
forall<T> { not { T: Foo } } // false -- ?T: Foo has an answer
Example 2.
not { forall<T, U> { T = U } } // true
forall<T, U> { not { T = U } } // false, ?T = ?U has an answer
Example 3.
T: Iterator<Item = i32>
from environment is the only choice.
from chalk.
Related Issues (20)
- Opaque type issue HOT 1
- identifying which method will run for a trait HOT 9
- Publishing is broken HOT 1
- CI Publish job using Mac runner HOT 2
- When Rust 1.55 hits stable, replace `ControlFlow` with std version
- Recursive solver reports ambiguity HOT 7
- Idea: rework how SLG solver uses the environment
- Auto traits are not handled for generic closures HOT 8
- Consider removing unused field
- Clean up coherence chapter in the Chalk book HOT 1
- Ambiguity through unrelated env clauses because of implied bounds HOT 1
- Fix/upgrade Chalk in wake of librarifying Copy/Clone on arrays and reinstate test HOT 1
- reconcile SLG/recursive solver's attempts to merge multiple results
- book: hard to read mermaid diagram in dark themes
- Lowered command panics with auto trait HOT 1
- Recursive solver hangs on cyclic traits HOT 3
- mdbook-mermaid needs updating
- Unable to deduce projection types of dyn types from supertrait bounds
- ICE: negative subgoal had delayed_subgoals HOT 2
- any progress and roadmap? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chalk.