Liyi li and Elsa Guntera method to translate order-sorted algebras to many-sorted algebras
Order-Sorted Algebra (B)
Many-Sorted Algebra (A)
(S,\Phi,\Sigma,E,R)
(S,O,\Phi,\Sigma,E,R)
Example


-
The O relation ( ) can be viewed as a direct graph where each relation is an edge.
-
The graph may have different connected components.
-
For any tow sorts in a connected component in a order-sorted algebra, there is a unique top supersort of them.
\small
s \equiv_{\leq} s' := \text{s and s' have a common supersort }
\leq
The operator f and f' are Argument compatible iif:
(\forall_{s_{i}, s'_{i}} | f:\Pi_{1}^{n} s_{i} \rightarrow s \wedge f':\Pi_{1}^{n} s'_{i} \rightarrow s' : s_i \equiv_{\leq} s'_{i} )
AC(f,f') := f and f' are arugment comptaible
An Order-Sorted algebra is sensible iif:
(\forall_{f,f'}| ac(f,f'): s\equiv_{\leq}s')
An Order-Sorted algebra is strictly sensible iif:
(\forall_{f,f'} \ \ | \ \ ac(f,f'): s = s')
(\forall_{f} \ \ | \ \ (\exists_{f'} \ \ | \ \ f':\Pi_{1}^{n} s'_{i} \rightarrow s' \ : \\ (\forall_{f'':\Pi_{1}^{n} s''_{i}} \ |
\ ac(f,f'') \ : ac(f',f'') \wedge s'' \leq s' ) ) )
Translation TR
-
Translating Operators
-
Translating Equations and Terms
-
Translating Semantic Rules
(tr_{\Sigma})
The Order-Sorted algebra must be strictly sensibleTranslating Operators
tr_{\Sigma} = tr^{\#}_{\Sigma} \circ tr^{'}_{\Sigma}
1.
tr_{\Sigma}^{'}
find a maximal argument-bounding operator f' for every operator f. Eliminate f if f' is different from f.
2.
tr_{\Sigma}^{\#}
for each pair (s,s') in O, create a unary relation:
\text{Cast\_s\_to\_s'}: s \rightarrow s'
non-core constructors
Translating Equations
E^{\#} = E \cup C_{E}
C_{E}
Set of core equality equations. For every two nodes in , if there are more than one paths from the first node to the second, a equation is added to connect them.
\leq
Translating Equations (Example)
nat < real, real < AExp, nat < int, int < AExp
There is a new equation
Cast\_nat\_to\_int(Cast\_int\_to\_AExp(A:nat)) = Cast\_nat\_to\_real(Cast\_real\_to\_AExp(A:nat))
Translating terms (Example)
s(A:nat) + B:nat = A:nat + s(B:nat)
There is a new equation
Cast\_int\_to\_AExp(Cast\_nat\_to\_int(s(A:nat))) + Cast\_int\_to\_AExp(Cast\_nat\_to\_int(B:nat))
\\ = \\
Cast\_int\_to\_AExp(Cast\_nat\_to\_int(A:nat)) + Cast\_int\_to\_AExp(Cast\_nat\_to\_int(s(B:nat)))
Order-Sorted 2 Many-Sorted
By Mateo Sanabria Ardila
Order-Sorted 2 Many-Sorted
- 23