let maxlen s n = b2t (normalize_term (strlen s <= n)) \/ strlen s <= n
let maxlen s n =
b2t (normalize_term (strlen s <= n)) \/ strlen s <= n
FStar.String.fsti.checked
prims.fst.checked FStar.Pervasives.fsti.checked FStar.List.Tot.fst.checked FStar.List.fst.checked FStar.Char.fsti.checked FStar.All.fst.checked
FStar.String.fsti
Prims.string Prims.int Prims.l_or Prims.b2t FStar.Pervasives.normalize_term Prims.bool Prims.op_LessThanOrEqual FStar.String.strlen Prims.logical
(*
   Copyright 2008-2019 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.String
open FStar.List.Tot
(* String is a primitive type in F*.

   Most of the functions in this interface have a special status in
   that they are:

   1. All the total functions in this module are handled by F*'s
      normalizers and can be reduced during typechecking

   2. All the total functions, plus two functions in the ML effect,
      have native OCaml implementations in FStar_String.ml

   These functions are, however, not suitable for use in Low* code,
   since many of them incur implicit allocations that must be garbage
   collected.

   For strings in Low*, see LowStar.String, LowStar.Literal etc.
*)

type char = FStar.Char.char

/// `list_of_string` and `string_of_list`: A pair of coercions to
/// expose and pack a string as a list of characters
val list_of_string : string -> Tot (list char)
val string_of_list : list char -> Tot string

/// A pair
val string_of_list_of_string (s:string)
  : Lemma (string_of_list (list_of_string s) == s)
val list_of_string_of_list (l:list char)
  : Lemma (list_of_string (string_of_list l) == l)

/// `strlen s` counts the number of utf8 values in a string
/// It is not the byte length of a string
let strlen s = List.length (list_of_string s)

/// `length`, an alias for `strlen`
unfold
let length s = strlen s

/// `maxlen`: When applied to a literal s of less than n characters,
/// `maxlen s n` reduces to `True` before going to the SMT solver.
/// Otherwise, the left disjunct reduces partially but the right
/// disjunct remains as is, allowing to keep `strlen s <= n` in the
/// context.
val maxlen : s: Prims.string -> n: Prims.int -> Prims.logical
s: Prims.string -> n: Prims.int -> Prims.logical