-
Notifications
You must be signed in to change notification settings - Fork 0
/
Everything.agda
186 lines (151 loc) · 5.17 KB
/
Everything.agda
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
{-# OPTIONS --safe --without-K #-}
module Everything where
{-
These two modules define store predicates and Hoare triple
postconditions over any type of store. They also define some common
syntax commonly used in separation logic.
-}
import Relation.Hoare.StorePredicate
import Relation.Hoare.PostCondition
{-
Defines an interface for the pointsto (_↦_) predicate in separation
logic. Also defines derived predicates from the pointsto predicate.
-}
import Relation.Hoare.Pointsto
{-
Defines a Hoare Triple and Separation Logic Triple and structural
rules. The relation is polymorphic over terms that evaluate to
values and any Store that implements `Relation.Hoare.Store.IsStore`.
-}
import Relation.Hoare
{-
Contains a Store interface that defines operations on stores.
Polymorhpic over any type of locations and values.
-}
import Relation.Hoare.Structures.Store
{-
Defines a bundle for store definitions.
-}
import Relation.Hoare.Bundles
-------------------------------------------------------------
-- Ternary Constructs
{-
A functional map with a domain to generate fresh locations. In
order to generate fresh locations to insert new values the map has
an ordering on its keys, such that there always exists a key that is
free.
-}
import Relation.Ternary.Construct.DomainMap
{-
Defines a separating relation on `Data.List.Fresh`, aka a
"FreshList". A fresh list has the same structure as a normal list,
but it also carries a proof that every element follows a binary
relation with every other element in the list.
-}
import Relation.Ternary.Construct.FreshList
{-
Defines a separating relation on an ordered list. An ordered list
has the same structure as a normal list, but it also carries a proof
that every element follows a binary relation with the following
element in the list.
-}
import Relation.Ternary.Construct.OrderedList
-------------------------------------------------------------
-- Hoare Constructs
{-
Implements `IsStore` for `Relation.Ternary.Construct.DomainMap`.
-}
import Relation.Hoare.Construct.DomainMap
{-
Implements `IsStore` for `Relation.Ternary.Construct.FreshList.
In this construct we choose the natural numbers as locations and an
inequality relation as the relation on locations in the list. This
means that a list can only be constructed with unique
locations. This is useful for implementing the `IsStore` interface,
since that requires stores to not have aliased locations.
-}
import Relation.Hoare.Construct.FreshList
-------------------------------------------------------------
-- Ternary Solvers
{-
Defines a record that all type of monoid solvers can use to solve
predicate expressions. This record serves as an interface for
solvers and is used by the Hoare triple syntax to choose a solver.
-}
import Relation.Ternary.Tactic.Core
{-
Convenient bundles used by the solver to construct proofs on
predicate monoid expressions with a unique empty predicate.
-}
import Relation.Ternary.Tactic.Bundles
{-
Reflection terms that are used by all solvers.
-}
import Relation.Ternary.Tactic.Reflection
{-
Expression representation of separation logic predicates.
-}
import Relation.Ternary.Tactic.Expression
{-
Defines how to evaluate an expression and normal form in an
environment of predicates. Furhtermore, defines homomorphisms
between evaluating normal forms and expressions.
-}
import Relation.Ternary.Tactic.Expression.Properties
{-
Implements the solver interface to solve equalities on predicates in
a ternary monoid.
-}
import Relation.Ternary.Tactic.MonoidSolver
{-
Implements the solver interface to solve equalities on predicates in
a ternary commutative monoid.
-}
import Relation.Ternary.Tactic.CommutativeMonoidSolver
-------------------------------------------------------------
-- Languages
{-
Defines inductive data type and semantics for an untyped imperative
toy language. The language is defined over an abstract memory
location type. The big-step semantics are substitution free and
instead use delayed substitution with an environment and
variables. Variable naming is implemented with De Bruijn indexing.
-}
import Data.Lang.Lang
import Data.Lang.Semantics
import Data.Lang.Hoare
{-
Defines a tactic for automatically constructing lookup of a variable
in an environment. Makes outlines more readable and less cumbersome.
-}
import Data.Lang.Reflection
import Data.Lang.Tactic
{-
Work in progress:
Defines a semantics-preserving transformation of PCF to
Administrative Normal Form. Can be used to write outlines in ANF and
then automatically derive a triple that is not ANF but has the same
semantics.
import Data.PCF.Rename
import Data.PCF.Anf
-}
-------------------------------------------------------------
-- Examples (case studies)
{-
Some examples of abstract Hoare proof outlines. Uses the syntax from
`Relation.Hoare` module.
-}
import HoareOutlines
{-
Examples of proofs of simple short programs that show all features
PCF has.
-}
import LangHoareOutlines.CopyList
import LangHoareOutlines.DoubleRef
import LangHoareOutlines.ModifyVal
import LangHoareOutlines.Swap
{-
Examples of using the `Ternary.Relation.Tactic.MonoidSolver`.
-}
import Solver
import Bench