val update  : #key:eqtype -> #value:Type -> #f:cmp key -> key -> value
              -> m:ordmap key value f -> Tot (ordmap key value f)
let update (#k:eqtype) (#v:Type) #f x y m =
  let s' = insert x (Mk_map?.d m) in
  let g' = F.on_dom k (fun (x':k) -> if x' = x then Some y else (Mk_map?.m m) x') in
  Mk_map s' g'
val update  : #key:eqtype -> #value:Type -> #f:cmp key -> key -> value
              -> m:ordmap key value f -> Tot (ordmap key value f)
let update (#k: eqtype) (#v: Type) #f x y m =
let s' = insert x (Mk_map?.d m) in
let g' = F.on_dom k (fun (x': k) -> if x' = x then Some y else (Mk_map?.m m) x') in
Mk_map s' g'
FStar.OrdMap.fst.checked
prims.fst.checked FStar.Pervasives.Native.fst.checked FStar.Pervasives.fsti.checked FStar.OrdSet.fsti.checked FStar.FunctionalExtensionality.fsti.checked
FStar.OrdMap.fst
Prims.eqtype FStar.OrdSet.cmp FStar.OrdMap.ordmap FStar.OrdMap.Mk_map FStar.FunctionalExtensionality.restricted_t FStar.Pervasives.Native.option FStar.FunctionalExtensionality.on_dom Prims.op_Equality FStar.Pervasives.Native.Some Prims.bool FStar.OrdMap.__proj__Mk_map__item__m FStar.OrdSet.ordset FStar.OrdMap.insert FStar.OrdMap.__proj__Mk_map__item__d
(*
   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.OrdMap

open FStar.OrdSet
open FStar.FunctionalExtensionality
module F = FStar.FunctionalExtensionality

let map_t (k:eqtype) (v:Type) (f:cmp k) (d:ordset k f) =
  g:F.restricted_t k (fun _ -> option v){forall x. mem x d == Some? (g x)}

noeq
type ordmap (k:eqtype) (v:Type) (f:cmp k) =
  | Mk_map: d:ordset k f -> m:map_t k v f d -> ordmap k v f

let empty (#k:eqtype) (#v:Type) #f =
  let d = OrdSet.empty in
  let g = F.on_dom k (fun x -> None) in
  Mk_map d g

let const_on (#k:eqtype) (#v:Type) #f d x =
  let g = F.on_dom k (fun y -> if mem y d then Some x else None) in
  Mk_map d g

let select (#k:eqtype) (#v:Type) #f x m = (Mk_map?.m m) x

let insert (#a:eqtype) (#f:cmp a) (x:a) (s:ordset a f) = union #a #f (singleton #a #f x) s
val update  : #key:eqtype -> #value:Type -> #f:cmp key -> key -> value
              -> m:ordmap key value f -> Tot (ordmap key value f)
x: key -> y: value -> m: FStar.OrdMap.ordmap key value f -> FStar.OrdMap.ordmap key value f