let gsub_inj (#a:Type0) = mgsub_inj #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a) (trivial_preorder a)
let gsub_inj (#a: Type0) =
mgsub_inj #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a) (trivial_preorder a)
LowStar.Buffer.fst.checked
prims.fst.checked LowStar.Monotonic.Buffer.fsti.checked FStar.UInt32.fsti.checked FStar.Seq.fst.checked FStar.Preorder.fst.checked FStar.Pervasives.fsti.checked FStar.List.Tot.fst.checked FStar.HyperStack.ST.fsti.checked FStar.HyperStack.fst.checked FStar.Ghost.fsti.checked
LowStar.Buffer.fst
LowStar.Monotonic.Buffer.mgsub_inj LowStar.Buffer.trivial_preorder LowStar.Monotonic.Buffer.mbuffer FStar.UInt32.t Prims.unit Prims.l_and Prims.b2t Prims.op_LessThanOrEqual Prims.op_Addition FStar.UInt32.v LowStar.Monotonic.Buffer.length Prims.op_Equals_Equals_Equals LowStar.Monotonic.Buffer.mgsub Prims.squash Prims.eq2 Prims.l_imp Prims.nat Prims.Nil FStar.Pervasives.pattern
(*
   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 LowStar.Buffer

include LowStar.Monotonic.Buffer

module P = FStar.Preorder
module G = FStar.Ghost
module U32 = FStar.UInt32
module Seq = FStar.Seq

module HS = FStar.HyperStack
module HST = FStar.HyperStack.ST

(*
 * Wrapper over LowStar.Monotonic.Buffer, with trivial preorders
 *   -- functions that take explicit preorder as arguments (e.g. sub etc.)
 *   -- these include allocation functions also
 *)
let trivial_preorder (a:Type0) :srel a = fun _ _ -> True

type buffer (a:Type0) = mbuffer a (trivial_preorder a) (trivial_preorder a)

unfold let null (#a:Type0) :buffer a = mnull #a #(trivial_preorder a) #(trivial_preorder a)

unfold let gsub (#a:Type0) = mgsub #a #(trivial_preorder a) #(trivial_preorder a) (trivial_preorder a)
val gsub_inj : b1:
      LowStar.Monotonic.Buffer.mbuffer a
        (LowStar.Buffer.trivial_preorder a)
        (LowStar.Buffer.trivial_preorder a) ->
    b2:
      LowStar.Monotonic.Buffer.mbuffer a
        (LowStar.Buffer.trivial_preorder a)
        (LowStar.Buffer.trivial_preorder a) ->
    i1: FStar.UInt32.t ->
    i2: FStar.UInt32.t ->
    len1: FStar.UInt32.t ->
    len2: FStar.UInt32.t
  -> FStar.Pervasives.Lemma
      (requires
        FStar.UInt32.v i1 + FStar.UInt32.v len1 <= LowStar.Monotonic.Buffer.length b1 /\
        FStar.UInt32.v i2 + FStar.UInt32.v len2 <= LowStar.Monotonic.Buffer.length b2 /\
        LowStar.Monotonic.Buffer.mgsub (LowStar.Buffer.trivial_preorder a) b1 i1 len1 ===
        LowStar.Monotonic.Buffer.mgsub (LowStar.Buffer.trivial_preorder a) b2 i2 len2)
      (ensures
        len1 == len2 /\ (b1 == b2 ==> i1 == i2) /\
        (i1 == i2 /\ LowStar.Monotonic.Buffer.length b1 == LowStar.Monotonic.Buffer.length b2 ==>
          b1 == b2))

    b1:
      LowStar.Monotonic.Buffer.mbuffer a
        (LowStar.Buffer.trivial_preorder a)
        (LowStar.Buffer.trivial_preorder a) ->
    b2:
      LowStar.Monotonic.Buffer.mbuffer a
        (LowStar.Buffer.trivial_preorder a)
        (LowStar.Buffer.trivial_preorder a) ->
    i1: FStar.UInt32.t ->
    i2: FStar.UInt32.t ->
    len1: FStar.UInt32.t ->
    len2: FStar.UInt32.t
  -> FStar.Pervasives.Lemma
      (requires
        FStar.UInt32.v i1 + FStar.UInt32.v len1 <= LowStar.Monotonic.Buffer.length b1 /\
        FStar.UInt32.v i2 + FStar.UInt32.v len2 <= LowStar.Monotonic.Buffer.length b2 /\
        LowStar.Monotonic.Buffer.mgsub (LowStar.Buffer.trivial_preorder a) b1 i1 len1 ===
        LowStar.Monotonic.Buffer.mgsub (LowStar.Buffer.trivial_preorder a) b2 i2 len2)
      (ensures
        len1 == len2 /\ (b1 == b2 ==> i1 == i2) /\
        (i1 == i2 /\ LowStar.Monotonic.Buffer.length b1 == LowStar.Monotonic.Buffer.length b2 ==>
          b1 == b2))