https://github.com/project-everest/hacl-star
Raw File
Tip revision: 0caed2c602ee71eb5d9c18161476fcc58e2a765a authored by Chris Hawblitzel on 05 May 2019, 15:29:41 UTC
Update .vaf files to match syntax changes in new Vale version
Tip revision: 0caed2c
Lib.Loops.fst
module Lib.Loops

open FStar.HyperStack
open FStar.HyperStack.ST

open Lib.IntTypes
open Lib.RawIntTypes

let for start finish inv f =
  C.Loops.for
    (size_to_UInt32 start)
    (size_to_UInt32 finish)
    (fun h i -> v start <= i /\ i <= v finish /\ inv h i)
    (fun i -> f (size_from_UInt32 i))

let while inv guard test body =
  let test: unit -> Stack bool
    (requires inv)
    (ensures  fun _ b h -> inv h /\ b == guard h)
  = test
  in
  C.Loops.while #inv #(fun b h -> inv h /\ b == guard h) test body
back to top