-
Notifications
You must be signed in to change notification settings - Fork 0
/
test2.dol
110 lines (94 loc) · 1.63 KB
/
test2.dol
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
logic CASL
spec binop =
sort A
op binop: A * A -> A
end
spec ident =
sort A
op binop: A * A -> A
op e:A
forall x:A
. binop(x,e) = x
end
spec inv =
sort A
op binop: A * A -> A
op e:A
op inv:A -> A
forall x:A
. binop(x,inv(x)) = e
end
spec assoc =
sort A
op binop: A * A -> A
forall x,y,z:A
. binop(x,binop(y,z)) = binop(binop(x,y),z)
end
spec comm =
sort A
op binop: A * A -> A
forall x,y:A
. binop(x,y) = binop(y,x)
end
spec func =
sort A
op f: A -> A
op finv: A -> A
forall x: A
. f(finv(x)) = x
end
spec finiteness =
sort A
op binop: A*A -> A
forall x:A. exists y,z:A
. x = binop(y,z)
end
spec finiteident =
sort A
op binop: A*A -> A
op e:A
forall x:A
. binop(x,e) = x
. exists y:A . binop(x,y) = e
end
spec NatSuc =
sort Nat
ops zero:Nat
s: Nat -> Nat
__ + __: Nat * Nat -> Nat
forall x,y,z: Nat
. s(x) = y /\ s(x) = z => y = z
. s(x) = s(y) => x=y
. exists a: Nat . s(x) = a
. not (s(x) = zero)
. s(x) + y = s(x+y)
. zero + y = y
end
spec Cyclicity = %%BLEND????%%
NatSuc then
sort A
op generator:A
op __ ^ __: A*Nat -> A
op e: A
op binop: A * A -> A
forall x,y,z:A; m:Nat
. binop (x, binop(y,z)) = binop(binop(x,y),z)
. exists n:Nat. generator ^ n = y
. x ^ zero = e
. x ^ s(m) = binop(x,x^m)
end
spec Gen =
sort S
op binop: S*S -> S
op func: S -> S
op id:S
end
interpretation I1: Gen to inv =
S |-> A,
binop |-> binop,
func |-> inv
interpretation I2: Gen to NatSuc =
S |-> Nat,
binop |-> __ + __,
func |-> s
spec colimit = combine I1, I2