Skip to content

Help with the predefined seq.reverse and seq.subsequence #860

Answered by boulme
boulme asked this question in Help
Discussion options

You must be logged in to vote

Thanks a lot. Your trick of using ghost code to make the proof progress is cute: it reminds me Coq :).
And this shows me how to prove the invariants based on subsequence with postcondition, modulo one single admitted fact:

 // admitted !
#[ghost]
#[requires(0 <= l && l <=  u && u <= s.len() && u <= t.len())]
#[requires(s.subsequence(l, u).ext_eq(t.subsequence(l, u)))]
#[ensures(equiv_range(s,t,l,u)) ]
fn subseq_equiv_range<T>(s : Seq<T>, t : Seq<T>, l : Int, u : Int) { }

But, I needed to use ext_eq instead of == on sequences. And the version with subsequence in invariants induced a lot of pain (i.e. ghost code to help the proof). See main.rs.gz

Finally, my first version above is the simp…

Replies: 3 comments 5 replies

Comment options

You must be logged in to vote
1 reply
@xldenis
Comment options

Comment options

You must be logged in to vote
3 replies
@xldenis
Comment options

@xldenis
Comment options

@boulme
Comment options

Answer selected by boulme
Comment options

You must be logged in to vote
1 reply
@boulme
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants