val lemma_offset_quantifiers: #a:Type -> h:mem -> b:buffer a -> b':buffer a -> i:FStar.UInt32.t{v i <= length b} -> Lemma
  (requires (live h b /\ live h b' /\ Seq.slice (as_seq h b) (v i) (length b) == as_seq h b'))
  (ensures  (live h b /\ live h b' /\ Seq.slice (as_seq h b) (v i) (length b) == as_seq h b'
    /\ length b' = length b - v i
    /\ (forall (j:nat). {:pattern (get h b' j)} j < length b' ==> get h b' j == get h b (j + v i)) ))
  [SMTPat (Seq.slice (as_seq h b) (v i) (length b)); SMTPat (as_seq h b')]
let lemma_offset_quantifiers #a h b b' i =
  lemma_sub_quantifiers #a h b b' i (uint_to_t (length b - v i))
val lemma_offset_quantifiers: #a:Type -> h:mem -> b:buffer a -> b':buffer a -> i:FStar.UInt32.t{v i <= length b} -> Lemma
  (requires (live h b /\ live h b' /\ Seq.slice (as_seq h b) (v i) (length b) == as_seq h b'))
  (ensures  (live h b /\ live h b' /\ Seq.slice (as_seq h b) (v i) (length b) == as_seq h b'
    /\ length b' = length b - v i
    /\ (forall (j:nat). {:pattern (get h b' j)} j < length b' ==> get h b' j == get h b (j + v i)) ))
  [SMTPat (Seq.slice (as_seq h b) (v i) (length b)); SMTPat (as_seq h b')]
let lemma_offset_quantifiers #a h b b' i =
lemma_sub_quantifiers #a h b b' i (uint_to_t (length b - v i))
FStar.Buffer.Quantifiers.fst.checked
prims.fst.checked FStar.UInt32.fsti.checked FStar.Seq.fst.checked FStar.Pervasives.fsti.checked FStar.HyperStack.fst.checked FStar.Ghost.fsti.checked FStar.Classical.fsti.checked FStar.Buffer.fst.checked
FStar.Buffer.Quantifiers.fst
FStar.Monotonic.HyperStack.mem FStar.Buffer.buffer FStar.UInt32.t Prims.b2t Prims.op_LessThanOrEqual FStar.UInt32.v FStar.Buffer.length FStar.Buffer.Quantifiers.lemma_sub_quantifiers FStar.UInt32.uint_to_t Prims.op_Subtraction Prims.unit
(*
   Copyright 2008-2018 Microsoft Research

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*)
module FStar.Buffer.Quantifiers

open FStar.Seq
open FStar.UInt32
open FStar.HyperStack
open FStar.Ghost
open FStar.Buffer
open FStar.Classical

#set-options "--initial_fuel 0 --max_fuel 0"

val lemma_sub_quantifiers: #a:Type -> h:mem -> b:buffer a -> b':buffer a -> i:FStar.UInt32.t -> len:FStar.UInt32.t{v len <= length b /\ v i + v len <= length b} -> Lemma
  (requires (live h b /\ live h b' /\ Seq.slice (as_seq h b) (v i) (v i + v len) == as_seq h b'))
  (ensures  (live h b /\ live h b' /\ Seq.slice (as_seq h b) (v i) (v i + v len) == as_seq h b'
    /\ length b' = v len
    /\ (forall (j:nat). {:pattern (get h b' j)} j < length b' ==> get h b' j == get h b (j + v i)) ))
  [SMTPat (Seq.slice (as_seq h b) (v i) (v i + v len)); SMTPat (as_seq h b')]
let lemma_sub_quantifiers #a h b b' i len = 
  assert (Seq.length (Seq.slice (as_seq h b) (v i) (v i + v len)) = v len);
  let lemma_post (j:nat) = j < length b' ==> get h b' j == get h b (j + v i) in
  let qj : j:nat -> Lemma (lemma_post j)
    = fun j -> assert (j < v len ==> Seq.index (as_seq h b') j == Seq.index (as_seq h b) (j + v i)) in
  Classical.forall_intro #_ #lemma_post qj
  
val lemma_offset_quantifiers: #a:Type -> h:mem -> b:buffer a -> b':buffer a -> i:FStar.UInt32.t{v i <= length b} -> Lemma
  (requires (live h b /\ live h b' /\ Seq.slice (as_seq h b) (v i) (length b) == as_seq h b'))
  (ensures  (live h b /\ live h b' /\ Seq.slice (as_seq h b) (v i) (length b) == as_seq h b'
    /\ length b' = length b - v i
    /\ (forall (j:nat). {:pattern (get h b' j)} j < length b' ==> get h b' j == get h b (j + v i)) ))
  [SMTPat (Seq.slice (as_seq h b) (v i) (length b)); SMTPat (as_seq h b')]
val lemma_offset_quantifiers: #a:Type -> h:mem -> b:buffer a -> b':buffer a -> i:FStar.UInt32.t{v i <= length b} -> Lemma
  (requires (live h b /\ live h b' /\ Seq.slice (as_seq h b) (v i) (length b) == as_seq h b'))
  (ensures  (live h b /\ live h b' /\ Seq.slice (as_seq h b) (v i) (length b) == as_seq h b'
    /\ length b' = length b - v i
    /\ (forall (j:nat). {:pattern (get h b' j)} j < length b' ==> get h b' j == get h b (j + v i)) ))
  [SMTPat (Seq.slice (as_seq h b) (v i) (length b)); SMTPat (as_seq h b')]

    h: FStar.Monotonic.HyperStack.mem ->
    b: FStar.Buffer.buffer a ->
    b': FStar.Buffer.buffer a ->
    i: FStar.UInt32.t{FStar.UInt32.v i <= FStar.Buffer.length b}
  -> FStar.Pervasives.Lemma
      (requires
        FStar.Buffer.live h b /\ FStar.Buffer.live h b' /\
        FStar.Seq.Base.slice (FStar.Buffer.as_seq h b) (FStar.UInt32.v i) (FStar.Buffer.length b) ==
        FStar.Buffer.as_seq h b')
      (ensures
        FStar.Buffer.live h b /\ FStar.Buffer.live h b' /\
        FStar.Seq.Base.slice (FStar.Buffer.as_seq h b) (FStar.UInt32.v i) (FStar.Buffer.length b) ==
        FStar.Buffer.as_seq h b' /\
        FStar.Buffer.length b' = FStar.Buffer.length b - FStar.UInt32.v i /\
        (forall (j: Prims.nat). {:pattern FStar.Buffer.get h b' j}
            j < FStar.Buffer.length b' ==>
            FStar.Buffer.get h b' j == FStar.Buffer.get h b (j + FStar.UInt32.v i)))
      [
        SMTPat (FStar.Seq.Base.slice (FStar.Buffer.as_seq h b)
              (FStar.UInt32.v i)
              (FStar.Buffer.length b));
        SMTPat (FStar.Buffer.as_seq h b')
      ]