File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments