-
Notifications
You must be signed in to change notification settings - Fork 236
/
Copy pathFStar.Squash.fst
53 lines (38 loc) · 1.75 KB
/
FStar.Squash.fst
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
(*
Copyright 2008-2024 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.Squash
open FStar.IndefiniteDescription
(* This file shows that there is another natural model for some of the
squash things; for this one it doesn't seem to harm importing this
file (exposing the implementation); it probably doesn't help either *)
let return_squash (#a:Type) x = ()
let bind_squash (#a:Type) (#b:Type) f g =
g (elim_squash f)
let push_squash (#a:Type) (#b:(a->Type)) f =
return_squash fun x -> elim_squash (f x)
let get_proof (p:Type) = ()
let give_proof (#p:Type) _ = ()
let proof_irrelevance (p:Type) x y = ()
let squash_double_arrow #a #p f =
bind_squash f push_squash
let push_sum (#a:Type) (#b:(a -> Type)) ($p : dtuple2 a (fun (x:a) -> squash (b x))) =
match p with
| Mkdtuple2 x y ->
bind_squash #(b x) #(dtuple2 a b) y (fun y' ->
return_squash (Mkdtuple2 x y'))
let squash_double_sum (#a:Type) (#b:(a -> Type)) (p : squash (dtuple2 a (fun (x:a) -> squash (b x)))) =
bind_squash p (fun p' -> push_sum p') // Need eta...
let map_squash (#a:Type) (#b:Type) s f =
bind_squash #a #b s (fun x -> return_squash (f x))
let join_squash (#a:Type) (x:squash (squash a)) =
bind_squash x (fun x -> x)