Skip to content

Commit ae392ce

Browse files
author
x97davka
committed
New file
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@177 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 8466c4f commit ae392ce

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

modeq/types.rml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
2+
module Types :
3+
4+
with "explode.rml"
5+
6+
type Ident = string
7+
datatype Type = COMPLEX of (Ident * Type) list
8+
| BUILTIN of string
9+
10+
relation same_type : (Type, Type) => ()
11+
12+
end
13+
14+
relation pick : ((Ident * Type) list, Ident) => ((Ident * Type) list, Type) =
15+
16+
rule n1 = n2
17+
-------
18+
pick((n1,t)::xs,n2) => (xs,t)
19+
20+
rule pick(xs,n) => (xs',t)
21+
---------------------
22+
pick(_::xs,n) => (xs',t)
23+
24+
end
25+
26+
relation same_type_c : ((Ident * Type) list, (Ident * Type) list) => () =
27+
28+
axiom same_type_c([], [])
29+
30+
rule pick(xs2,n) => (xs2',t2) &
31+
same_type(t1,t2) &
32+
same_type_c(xs1,xs2')
33+
---------------------
34+
same_type_c((n,t1)::xs1, xs2)
35+
36+
end
37+
38+
and same_type : (Type, Type) => () =
39+
40+
rule t1 = t2
41+
-------
42+
same_type(BUILTIN(t1), BUILTIN(t2))
43+
44+
rule same_type_c(els1, els2)
45+
-----------------------
46+
same_type(COMPLEX(els1), COMPLEX(els2))
47+
48+
end

0 commit comments

Comments
 (0)