(* Copyright 2008-2014 Nikhil Swamy, Aseem Rastogi, Microsoft Research, University of Maryland 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. *) //SNIPPET_START: SimplifiedFStarSet.Impl$ module SimplifiedFStarSet (** Computational sets (on eqtypes): membership is a boolean function *) #set-options "--fuel 0 --ifuel 0" open FStar.FunctionalExtensionality module F = FStar.FunctionalExtensionality let set (a:eqtype) = F.restricted_t a (fun _ -> bool) (* destructors *) let mem #a x s = s x (* constructors *) let empty #a = F.on_dom a (fun x -> false) let singleton #a x = F.on_dom a (fun y -> y = x) let union #a s1 s2 = F.on_dom a (fun x -> s1 x || s2 x) let intersect #a s1 s2 = F.on_dom a (fun x -> s1 x && s2 x) let complement #a s = F.on_dom a (fun x -> not (s x)) (* equivalence relation *) let equal (#a:eqtype) (s1:set a) (s2:set a) = F.feq s1 s2 (* Properties *) let mem_empty #a x = () let mem_singleton #a x y = () let mem_union #a x s1 s2 = () let mem_intersect #a x s1 s2 = () let mem_complement #a x s = () (* extensionality *) let equal_intro #a s1 s2 = () let equal_elim #a s1 s2 = () //SNIPPET_END: SimplifiedFStarSet.Impl$