Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple lemma about appending permutations #2989

Merged
merged 1 commit into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ulib/FStar.Seq.Properties.fst
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@ let lemma_swap_permutes_aux #_ s i j x =
end
#pop-options

let append_permutations #a s1 s2 s1' s2' =
(
lemma_append_count s1 s2;
lemma_append_count s1' s2'
)

let lemma_swap_permutes #a s i j
= FStar.Classical.forall_intro
#a
Expand Down
5 changes: 5 additions & 0 deletions ulib/FStar.Seq.Properties.fsti
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@ val lemma_swap_permutes_aux: #a:eqtype -> s:seq a -> i:nat{i<length s} -> j:nat{

type permutation (a:eqtype) (s1:seq a) (s2:seq a) =
(forall i. count i s1 = count i s2)

val append_permutations: #a:eqtype -> s1:seq a -> s2:seq a -> s1':seq a -> s2':seq a -> Lemma
(requires permutation a s1 s1' /\ permutation a s2 s2')
(ensures permutation a (append s1 s2) (append s1' s2'))

val lemma_swap_permutes (#a:eqtype) (s:seq a) (i:nat{i<length s}) (j:nat{i <= j && j<length s})
: Lemma (permutation a s (swap s i j))

Expand Down