|
2 | 2 |
|
3 | 3 | ; program: $get_ai_norm_rec |
4 | 4 | ; args: |
5 | | -; - f (-> S S S): The function we are considering, which is assumed to be associative+idempotent and has the given identity. |
| 5 | +; - f (-> S S S): The function we are considering, which is assumed to be |
| 6 | +; associative+idempotent and has the given identity. |
6 | 7 | ; - id S: The nil terminator of f. |
7 | 8 | ; - s S: The term to process. |
8 | | -; return: the result of normalizing s based on associative+idempotent+identity reasoning. |
9 | | -(program $get_ai_norm_rec ((T Type) (S Type) (f (-> S S S)) (id T) (x T) (x1 T) (x2 T)) |
| 9 | +; return: the result of normalizing s based on associative+idempotent+identity |
| 10 | +; reasoning. |
| 11 | +(program $get_ai_norm_rec |
| 12 | + ((T Type) (S Type) (f (-> S S S)) (id T) (x T) (x1 T) (x2 T)) |
10 | 13 | :signature ((-> S S S) T T) T |
11 | 14 | ( |
12 | | - (($get_ai_norm_rec f id (f x1 x2)) (eo::list_setof f (eo::list_concat f ($get_ai_norm_rec f id x1) ($get_ai_norm_rec f id x2)))) |
13 | | - (($get_ai_norm_rec f id id) id) |
14 | | - (($get_ai_norm_rec f id x) (_ f x id)) |
| 15 | + (($get_ai_norm_rec f id (f x1 x2)) |
| 16 | + (eo::list_setof f |
| 17 | + (eo::list_concat f ($get_ai_norm_rec f id x1) ($get_ai_norm_rec f id x2))) |
| 18 | + ) |
| 19 | + (($get_ai_norm_rec f id id) id) |
| 20 | + (($get_ai_norm_rec f id x) (_ f x id)) |
15 | 21 | ) |
16 | 22 | ) |
17 | 23 |
|
18 | 24 | ; program: $get_ai_norm |
19 | 25 | ; args: |
20 | 26 | ; - t U: The term to process. |
21 | | -; return: the result of normalizing t based on associative+idempotent+identity reasoning. |
| 27 | +; return: the result of normalizing t based on associative+idempotent+identity |
| 28 | +; reasoning. |
22 | 29 | (program $get_ai_norm ((S Type) (U Type) (f (-> S S S)) (x U) (y U)) |
23 | 30 | :signature (U) U |
24 | 31 | ( |
25 | | - (($get_ai_norm (f x y)) (eo::define ((id (eo::nil f (eo::typeof (f x y))))) |
26 | | - (eo::list_singleton_elim f ($get_ai_norm_rec f id (f x y))))) |
| 32 | + (($get_ai_norm (f x y)) |
| 33 | + (eo::define ((id (eo::nil f (eo::typeof (f x y))))) |
| 34 | + (eo::list_singleton_elim f ($get_ai_norm_rec f id (f x y))))) |
27 | 35 | ) |
28 | 36 | ) |
29 | 37 |
|
30 | 38 | ; program: $get_a_norm_rec |
31 | 39 | ; args: |
32 | | -; - f (-> S S S): The function we are considering, which is assumed to be associative and has the given identity. |
| 40 | +; - f (-> S S S): The function we are considering, which is assumed to be |
| 41 | +; associative and has the given identity. |
33 | 42 | ; - id S: The nil terminator of f. |
34 | 43 | ; - s S: The term to process. |
35 | 44 | ; return: the result of normalizing s based on associative+identity reasoning. |
36 | | -(program $get_a_norm_rec ((T Type) (S Type) (f (-> S S S)) (id T) (x T) (x1 T) (x2 T)) |
| 45 | +(program $get_a_norm_rec |
| 46 | + ((T Type) (S Type) (f (-> S S S)) (id T) (x T) (x1 T) (x2 T)) |
37 | 47 | :signature ((-> S S S) T T) T |
38 | 48 | ( |
39 | | - (($get_a_norm_rec f id (f x1 x2)) (eo::list_concat f ($get_a_norm_rec f id x1) ($get_a_norm_rec f id x2))) |
40 | | - (($get_a_norm_rec f id id) id) |
41 | | - (($get_a_norm_rec f id x) (_ f x id)) |
| 49 | + (($get_a_norm_rec f id (f x1 x2)) |
| 50 | + (eo::list_concat f ($get_a_norm_rec f id x1) ($get_a_norm_rec f id x2))) |
| 51 | + (($get_a_norm_rec f id id) id) |
| 52 | + (($get_a_norm_rec f id x) (_ f x id)) |
42 | 53 | ) |
43 | 54 | ) |
44 | 55 |
|
|
49 | 60 | (program $get_a_norm ((S Type) (U Type) (f (-> S S S)) (x U) (y U)) |
50 | 61 | :signature (U) U |
51 | 62 | ( |
52 | | - (($get_a_norm (f x y)) (eo::define ((id (eo::nil f (eo::typeof (f x y))))) |
53 | | - (eo::list_singleton_elim f ($get_a_norm_rec f id (f x y))))) |
| 63 | + (($get_a_norm (f x y)) |
| 64 | + (eo::define ((id (eo::nil f (eo::typeof (f x y))))) |
| 65 | + (eo::list_singleton_elim f ($get_a_norm_rec f id (f x y))))) |
54 | 66 | ) |
55 | 67 | ) |
56 | 68 |
|
57 | 69 | ; A placeholder that indicates that the given list can be sorted with respect |
58 | | -; to operator f. For example, (@aci.sorted f t) indicates that t is an application |
59 | | -; of a commutative operator f. We show the equivalence of two applications marked |
| 70 | +; to operator f. For example, (@aci.sorted f t) indicates that t is an |
| 71 | +; application |
| 72 | +; of a commutative operator f. We show the equivalence of two applications |
| 73 | +; marked |
60 | 74 | ; in this way using the operator for multiset equality below. |
61 | | -(declare-parameterized-const @@aci_sorted ((U Type :implicit) (T Type :implicit)) (-> U T T)) |
| 75 | +(declare-parameterized-const @@aci_sorted |
| 76 | + ((U Type :implicit) (T Type :implicit)) |
| 77 | + (-> U T T)) |
| 78 | + |
62 | 79 | (define @aci.sorted () @@aci_sorted) |
63 | 80 |
|
64 | 81 | ; program: $aci_norm_eq |
|
69 | 86 | (program $aci_norm_eq ((S Type) (U Type) (t U) (s U) (f (-> S S S))) |
70 | 87 | :signature (U U) Bool |
71 | 88 | ( |
72 | | - (($aci_norm_eq t t) true) |
73 | | - (($aci_norm_eq (@aci.sorted f t) t) true) |
| 89 | + (($aci_norm_eq t t) true) |
| 90 | + (($aci_norm_eq (@aci.sorted f t) t) true) |
74 | 91 | (($aci_norm_eq (@aci.sorted f t) (@aci.sorted f s)) (eo::list_meq f t s)) |
75 | | - (($aci_norm_eq t s) false) |
| 92 | + (($aci_norm_eq t s) false) |
76 | 93 | ) |
77 | 94 | ) |
78 | 95 |
|
|
84 | 101 | ; - bn S: The normalized form of the second term. |
85 | 102 | ; return: whether a can be shown equal to b by ACI_NORM |
86 | 103 | (define $is_aci_norm ((S Type :implicit) (a S) (b S) (an S) (bn S)) |
87 | | - (eo::ite ($aci_norm_eq an b) true ; first check if we are singleton case |
88 | | - (eo::ite ($aci_norm_eq bn a) true ; vice versa |
89 | | - ($aci_norm_eq an bn)))) ; otherwise check equivalence by above |
| 104 | + (eo::ite ($aci_norm_eq an b) |
| 105 | + true ; first check if we are singleton case |
| 106 | + (eo::ite ($aci_norm_eq bn a) |
| 107 | + true ; vice versa |
| 108 | + ($aci_norm_eq an bn)))) ; otherwise check equivalence by above |
0 commit comments