-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathterm_interface.fst
87 lines (58 loc) · 1.76 KB
/
term_interface.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
module Term_interface
(***********************
Types
************************)
type symbol_cat =
| Constructor: symbol_cat
| Destructor: symbol_cat
type symbol =
{
name_s: string;
arity: nat;
category_s: symbol_cat
}
type quantifier =
| Free
| Existential
| Universal
type variable =
{
name: string;
id: nat;
}
type name_cat =
| Public
| Private
type name =
{
name_n : string;
id : nat
}
type term =
| Var : variable -> term
| Name : name -> term
| Func : s:symbol -> l:(list term){ List.Tot.length l = s.arity } -> term
(*** Variables ***)
(*** WARNING : DO NOT IMPLEMENT THIS FUNCTION ! Keep it as an assume ***)
assume val fresh : quantifier -> FStar.Set.set variable -> Tot variable
(*** WARNING : DO NOT IMPLEMENT THIS LEMMA ! Keep it as an assume ***)
assume val lemma_fresh : q:quantifier -> set:FStar.Set.set variable ->
Lemma (requires True)
(ensures (FStar.Set.mem (fresh q set) set = false))
(*** Testing functions ***)
assume val is_equal : term -> term -> Tot bool
assume val is_function : term -> Tot bool
assume val is_name : term -> Tot bool
assume val is_variable : term -> Tot bool
assume val is_ground : term -> Tot bool
assume val is_constructor : term -> Tot bool
assume val var_occurs : variable -> term -> Tot bool
(*** Generation function ****)
assume val of_variable : variable -> Tot term
assume val of_name : name -> Tot term
assume val apply_function : f:symbol -> l:(list term){ List.Tot.length l = f.arity } -> Tot term
(*** Access function ****)
assume val variable_of : t:term{ is_variable t } -> Tot variable
assume val name_of : t:term{ is_name t } -> Tot name
assume val root : t:term{ is_function t } -> Tot symbol
assume val get_args : term -> Tot (list term)