val closure (#a:Type u#a) (r:binrel u#a u#r a) : preorder u#a u#0 a
let closure #a r =
  closure_reflexive r;
  closure_transitive r;
  _closure0 r
val closure (#a:Type u#a) (r:binrel u#a u#r a) : preorder u#a u#0 a
let closure #a r =
closure_reflexive r;
closure_transitive r;
_closure0 r
FStar.ReflexiveTransitiveClosure.fst.checked
prims.fst.checked FStar.Tactics.V2.fst.checked FStar.Tactics.Effect.fsti.checked FStar.Squash.fsti.checked FStar.Pervasives.fsti.checked
FStar.ReflexiveTransitiveClosure.fst
FStar.ReflexiveTransitiveClosure.binrel FStar.ReflexiveTransitiveClosure._closure0 Prims.unit FStar.ReflexiveTransitiveClosure.closure_transitive FStar.ReflexiveTransitiveClosure.closure_reflexive FStar.ReflexiveTransitiveClosure.preorder
(*
   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.ReflexiveTransitiveClosure

open FStar.Tactics.V2
#set-options "--max_ifuel 1 --max_fuel 0"

noeq
type _closure (#a:Type u#a) (r:binrel u#a u#r a) : a -> a -> Type u#(max a r) =
| Refl: x:a -> _closure r x x
| Step: x:a -> y:a -> squash (r x y) ->_closure r x y
| Closure: x:a -> y:a -> z:a -> _closure r x y -> _closure r y z -> _closure r x z

let _closure0 (#a:Type) (r:binrel a) (x y: a) : prop =
  squash (_closure r x y)

let get_squash (#a:Type) (r:binrel a) (x:a) (y:a{_closure0 r x y})
  : Tot (squash (_closure r x y))
  = assert_norm (_closure0 r x y ==> squash (_closure r x y))

val closure_reflexive: #a:Type u#a -> r:binrel u#a u#r a -> Lemma (reflexive (_closure0 r))
let closure_reflexive #a r =
  assert (forall x. _closure0 r x x) by
    (let x = forall_intro () in
     mapply (`FStar.Squash.return_squash);
     mapply (`Refl))

#push-options "--warn_error -271"
val closure_transitive: #a:Type u#a -> r:binrel u#a u#r a -> Lemma (transitive (_closure0 r))
let closure_transitive #a r =
  let open FStar.Squash in
  let aux (x y z:a)
          (s0:squash (_closure r x y))
          (s1:squash (_closure r y z))
    : GTot (squash (_closure r x z))
    = bind_squash s0 (fun p0 ->
      bind_squash s1 (fun p1 ->
      return_squash (Closure x y z p0 p1)))
  in
  let aux (x y z:a)
    : Lemma (requires (_closure0 r x y /\ _closure0 r y z))
            (ensures _closure0 r x z)
            [SMTPat ()]
    = get_squash r x y; get_squash r y z; aux x y z () ()
  in
  ()
#pop-options
val closure (#a:Type u#a) (r:binrel u#a u#r a) : preorder u#a u#0 a
r: FStar.ReflexiveTransitiveClosure.binrel a -> FStar.ReflexiveTransitiveClosure.preorder a