Mercurial > hg > Papers > 2021 > soto-prosym
comparison Paper/src/atton-master-sample.agda.replaced @ 0:c59202657321
init
author | soto <soto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 02 Nov 2021 06:55:58 +0900 |
parents | |
children | 339fb67b4375 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c59202657321 |
---|---|
1 module atton-master-sample where | |
2 | |
3 open import Data.Nat | |
4 open import Data.Unit | |
5 open import Function | |
6 Int = @$\mathbb{N}$@ | |
7 | |
8 record Context : Set where | |
9 field | |
10 a : Int | |
11 b : Int | |
12 c : Int | |
13 | |
14 | |
15 open import subtype Context | |
16 | |
17 | |
18 | |
19 record ds0 : Set where | |
20 field | |
21 a : Int | |
22 b : Int | |
23 | |
24 record ds1 : Set where | |
25 field | |
26 c : Int | |
27 | |
28 instance | |
29 _ : DataSegment ds0 | |
30 _ = record { set = (\c d @$\rightarrow$@ record c {a = (ds0.a d) ; b = (ds0.b d)}) | |
31 ; get = (\c @$\rightarrow$@ record { a = (Context.a c) ; b = (Context.b c)})} | |
32 _ : DataSegment ds1 | |
33 _ = record { set = (\c d @$\rightarrow$@ record c {c = (ds1.c d)}) | |
34 ; get = (\c @$\rightarrow$@ record { c = (Context.c c)})} | |
35 | |
36 cs2 : CodeSegment ds1 ds1 | |
37 cs2 = cs id | |
38 | |
39 cs1 : CodeSegment ds1 ds1 | |
40 cs1 = cs (\d @$\rightarrow$@ goto cs2 d) | |
41 | |
42 cs0 : CodeSegment ds0 ds1 | |
43 cs0 = cs (\d @$\rightarrow$@ goto cs1 (record {c = (ds0.a d) + (ds0.b d)})) | |
44 | |
45 main : ds1 | |
46 main = goto cs0 (record {a = 100 ; b = 50}) |