val field_of_tag' (#l: P.struct_typ') (tgs: tags' l) (t: UInt32.t)
    : Pure (P.struct_field' l) (requires (List.Tot.mem t tgs)) (ensures (fun _ -> True))
let rec field_of_tag'
  (#l: P.struct_typ')
  (tgs: tags' l)
  (t: UInt32.t)
: Pure (P.struct_field' l)
  (requires (List.Tot.mem t tgs))
  (ensures (fun _ -> True))
= let ((f, _) :: l') = l in
  let (t' :: tgs') = tgs in
  if t = t' then f
  else (
    assert (Cons? l');
    let ff' : string = field_of_tag' #l' tgs' t in
    ff'
  )
val field_of_tag' (#l: P.struct_typ') (tgs: tags' l) (t: UInt32.t)
    : Pure (P.struct_field' l) (requires (List.Tot.mem t tgs)) (ensures (fun _ -> True))
let rec field_of_tag' (#l: P.struct_typ') (tgs: tags' l) (t: UInt32.t)
    : Pure (P.struct_field' l) (requires (List.Tot.mem t tgs)) (ensures (fun _ -> True)) =
let (f, _) :: l' = l in
let t' :: tgs' = tgs in
if t = t'
then f
else
  (assert (Cons? l');
    let ff':string = field_of_tag' #l' tgs' t in
    ff')
FStar.TaggedUnion.fsti.checked
prims.fst.checked FStar.UInt32.fsti.checked FStar.Pointer.fst.checked FStar.Pervasives.fsti.checked FStar.List.Tot.fst.checked FStar.HyperStack.ST.fsti.checked FStar.HyperStack.fst.checked
FStar.TaggedUnion.fsti
FStar.Pointer.Base.struct_typ' FStar.TaggedUnion.tags' FStar.UInt32.t Prims.string FStar.Pointer.Base.typ Prims.list FStar.Pervasives.Native.tuple2 Prims.op_Equality Prims.bool FStar.TaggedUnion.field_of_tag' Prims.unit Prims._assert Prims.b2t Prims.uu___is_Cons FStar.Pointer.Base.struct_field' FStar.List.Tot.Base.mem Prims.l_True
(*
   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.TaggedUnion

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

(** Code

  The code of a tagged union with fields `l` is `typ l`
*)

val typ (l: P.union_typ) : P.typ

(******************************************************************************)

(* Tagging, at the logical level

  `tags l` defines "physical tags" (i.e. integers) for the fields of `l`.
*)

let tags' (l: P.struct_typ') : Tot Type0 =
  tl: list UInt32.t {
    List.Tot.length tl == List.Tot.length l /\
    List.Tot.noRepeats tl
  }

let tags (l: P.union_typ) : Tot Type0 =
  tags' l.P.fields

(* Get a field from its physical tag. *)
let rec field_of_tag'
  (#l: P.struct_typ')
  (tgs: tags' l)
  (t: UInt32.t)
: Pure (P.struct_field' l)
  (requires (List.Tot.mem t tgs))
val field_of_tag' (#l: P.struct_typ') (tgs: tags' l) (t: UInt32.t)
    : Pure (P.struct_field' l) (requires (List.Tot.mem t tgs)) (ensures (fun _ -> True))
tgs: FStar.TaggedUnion.tags' l -> t: FStar.UInt32.t
  -> Prims.Pure (FStar.Pointer.Base.struct_field' l)