Comments (5)
This comes from the fact that for now we do not allow overriding default methods in trait implementations, because it makes the code generation quite hard (and according to the failing assertion, the PartialEq
implementation for Option<T>
overrides at least one of those). Sebastian Ullrich had bumped into the same issue when he worked on Electrolysis several years ago (see http://kha.github.io/electrolysis/#default-methods ).
For now, our trait declarations only contain the required (i.e., non-default) methods, and we translate each default method once, by parameterizing it with a trait instance. For instance, in the case of Iterator
, the trait declaration only contains the function next
, and we generate generic functions for map
, each
, etc., which are parameterized by iterator instance. Of course, it doesn't work if you override one of the default methods.
The general solution would be to put all the methods in the trait declaration, and re-generate all the default methods for all the trait implementations, but this is very heavy especially for traits like Iterator
which have > 70 default methods (in particular if you consider the fact that you would have to write lemmas for all the implementations of methods like all
for instance).
I have a different solution which works for the cases where the default methods and the required methods are not mutually recursive, which seems to be the case in most situations. We would put all the methods in the trait declarations (so the Iterator
trait would have > 70 fields but it is ok), and would generate one translation by default method, which would be parameterized by the other methods that it calls. For example in the case of iterators, functions like map
, all
, etc. would be parameterized by the next
method.
from aeneas.
The following example is sufficient to produce the same crash:
fn main() {
let _ = Some(1) == Some(1);
}
from aeneas.
I'm currently cleaning the issues and removing duplicates: I updated the name of the issue.
from aeneas.
The following code also triggers the same issue (comes from #71):
fn main() {
let x = 1;
let _ = &x == &1;
}
from aeneas.
We plan to solve this on the charon side: AeneasVerif/charon#180.
from aeneas.
Related Issues (20)
- '... and assignment' operators cause an error on arrays.
- Test crates fail to build in CI HOT 1
- `make setup-charon` can fail when the OID doesn't exist in Charon HOT 3
- Improve `scalar_tac`
- Improve `scalar_eq_nf`
- Implement more powerful context simplification tactics
- Implement a saturation tactic to handle universally quantified assumptions
- Implement a congruence closure tactic
- `progress*`
- Use `Nat` and `Int` instead of `Usize` and `Isize`
- Setup Loogle so that we can search for theorems inside the Lean library developed for Aeneas
- Fix the loops of `simp_all` in `scalar_tac`
- Tuple decomposition doesn't work well in the Lean backend
- Improve the `progress` tactic
- Give the possibility of extracting the source code as comments
- Unfolding an extraction can lead to a weird term with `Diverge.FixII.…`
- Rename `assumed` to `builtin`
- Turn the ICFP tutorial into a Lean game HOT 3
- Minimize the parameters of globals/constants
- Make the backward functions not fail
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 aeneas.