annotate paper/src/atton-master-sample.agda.replaced @ 2:c7acb9211784

add code, figure. and paper fix content
author ryokka
date Mon, 27 Jan 2020 20:41:36 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
1 module atton-master-sample where
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
2
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
3 open import Data.Nat
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
4 open import Data.Unit
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
5 open import Function
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
6 Int = @$\mathbb{N}$@
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
7
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
8 record Context : Set where
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
9 field
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
10 a : Int
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
11 b : Int
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
12 c : Int
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
13
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
14
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
15 open import subtype Context
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
16
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
17
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
18
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
19 record ds0 : Set where
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
20 field
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
21 a : Int
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
22 b : Int
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
23
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
24 record ds1 : Set where
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
25 field
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
26 c : Int
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
27
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
28 instance
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
29 _ : DataSegment ds0
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
30 _ = record { set = (\c d @$\rightarrow$@ record c {a = (ds0.a d) ; b = (ds0.b d)})
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
31 ; get = (\c @$\rightarrow$@ record { a = (Context.a c) ; b = (Context.b c)})}
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
32 _ : DataSegment ds1
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
33 _ = record { set = (\c d @$\rightarrow$@ record c {c = (ds1.c d)})
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
34 ; get = (\c @$\rightarrow$@ record { c = (Context.c c)})}
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
35
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
36 cs2 : CodeSegment ds1 ds1
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
37 cs2 = cs id
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
38
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
39 cs1 : CodeSegment ds1 ds1
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
40 cs1 = cs (\d @$\rightarrow$@ goto cs2 d)
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
41
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
42 cs0 : CodeSegment ds0 ds1
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
43 cs0 = cs (\d @$\rightarrow$@ goto cs1 (record {c = (ds0.a d) + (ds0.b d)}))
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
44
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
45 main : ds1
c7acb9211784 add code, figure. and paper fix content
ryokka
parents:
diff changeset
46 main = goto cs0 (record {a = 100 ; b = 50})