Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
concordium
smart-contract-interactions
Commits
3eaadae9
Commit
3eaadae9
authored
May 05, 2019
by
Jakob Botsch Nielsen
Browse files
Rename CursorList -> ChainedList
parent
5cd83c67
Pipeline
#12242
failed with stage
in 22 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
_CoqProject
View file @
3eaadae9
...
...
@@ -2,10 +2,10 @@
src/Automation.v
src/Blockchain.v
src/BoundedN.v
src/ChainedList.v
src/Circulation.v
src/Congress.v
src/Containers.v
src/CursorList.v
src/Extras.v
src/Finite.v
src/LocalBlockchain.v
...
...
src/Blockchain.v
View file @
3eaadae9
...
...
@@ -8,7 +8,7 @@ From SmartContracts Require Import Oak.
From
SmartContracts
Require
Import
Monads
.
From
SmartContracts
Require
Import
Extras
.
From
SmartContracts
Require
Import
Automation
.
From
SmartContracts
Require
Import
C
ursor
List
.
From
SmartContracts
Require
Import
C
hained
List
.
From
RecordUpdate
Require
Import
RecordUpdate
.
From
stdpp
Require
countable
.
...
...
@@ -767,7 +767,7 @@ Definition empty_state : ChainState :=
(
*
The
ChainTrace
captures
that
there
is
a
valid
execution
where
,
starting
from
one
environment
and
queue
of
actions
,
we
end
up
in
a
different
environment
and
queue
of
actions
.
*
)
Definition
ChainTrace
:=
C
ursor
List
ChainState
ChainEvent
.
Definition
ChainTrace
:=
C
hained
List
ChainState
ChainEvent
.
Section
Theories
.
Ltac
destruct_chain_event
:=
...
...
src/C
ursor
List.v
→
src/C
hained
List.v
View file @
3eaadae9
(
*
This
file
implements
,
for
lack
of
a
better
name
,
a
cursor
list
.
This
is
a
list
for
which
each
element
contains
a
"cursor"
type
:
each
element
is
parameterized
over
a
'
from
'
and
'
to
'
element
of
this
type
,
which
must
match
with
the
previous
element
.
For
that
reason
this
is
(
*
This
file
implements
a
chained
list
.
This
is
a
list
for
which
each
element
is
a
link
between
a
from
and
to
element
of
a
provided
"link"
type
.
That
is
,
each
link
(
element
)
has
a
"
from
"
point
that
must
match
the
previous
element
'
s
"to"
point
.
For
that
reason
this
is
also
a
snoc
list
.
Note
that
this
is
not
unlike
fhlist
from
CPDT
,
except
we
place
further
restrictions
on
it
.
*
)
From
SmartContracts
Require
Import
Automation
.
Section
C
ursor
List
.
Context
{
cursor_type
:
Type
}
{
elm_type
:
cursor_type
->
cursor_type
->
Type
}
.
Section
C
hained
List
.
Context
{
point
:
Type
}
{
link
:
point
->
point
->
Type
}
.
Inductive
CursorList
:
cursor_type
->
cursor_type
->
Type
:=
|
nil
:
forall
{
elm
}
,
CursorList
elm
elm
|
snoc
:
forall
{
from
mid
to
}
,
CursorList
from
mid
->
elm_type
mid
to
->
CursorList
from
to
.
Definition
snoc_eq
{
from
mid
mid
'
to
}
(
xs
:
CursorList
from
mid
)
(
x
:
elm_type
mid
'
to
)
:
mid
'
=
mid
->
CursorList
from
to
:=
fun
eq
=>
snoc
xs
(
match
eq
with
eq_refl
=>
x
end
).
Inductive
ChainedList
:
point
->
point
->
Type
:=
|
clnil
:
forall
{
elm
}
,
ChainedList
elm
elm
|
snoc
:
forall
{
from
mid
to
}
,
ChainedList
from
mid
->
link
mid
to
->
ChainedList
from
to
.
Fixpoint
clist_app
{
from
mid
to
}
(
xs
:
C
ursor
List
from
mid
)
(
ys
:
C
ursor
List
mid
to
)
:
C
ursor
List
from
to
:=
(
xs
:
C
hained
List
from
mid
)
(
ys
:
C
hained
List
mid
to
)
:
C
hained
List
from
to
:=
match
ys
with
|
nil
=>
fun
xs
=>
xs
|
cl
nil
=>
fun
xs
=>
xs
|
snoc
ys
'
y
=>
fun
xs
=>
snoc
(
clist_app
xs
ys
'
)
y
end
xs
.
...
...
@@ -33,38 +26,38 @@ Infix "++" := clist_app (right associativity, at level 60).
Definition
clist_prefix
{
from
mid
to
}
(
prefix
:
C
ursor
List
from
mid
)
(
full
:
C
ursor
List
from
to
)
:
Prop
:=
(
prefix
:
C
hained
List
from
mid
)
(
full
:
C
hained
List
from
to
)
:
Prop
:=
exists
suffix
,
full
=
prefix
++
suffix
.
Definition
clist_suffix
{
from
mid
to
}
(
suffix
:
C
ursor
List
mid
to
)
(
full
:
C
ursor
List
from
to
)
:
Prop
:=
(
suffix
:
C
hained
List
mid
to
)
(
full
:
C
hained
List
from
to
)
:
Prop
:=
exists
prefix
,
full
=
prefix
++
suffix
.
Infix
"`prefix_of`"
:=
clist_prefix
(
at
level
70
).
Infix
"`suffix_of`"
:=
clist_suffix
(
at
level
70
).
Section
Theories
.
Lemma
clist_
app_nil_l
{
from
to
}
(
xs
:
C
ursor
List
from
to
)
:
nil
++
xs
=
xs
.
Lemma
app_
cl
nil_l
{
from
to
}
(
xs
:
C
hained
List
from
to
)
:
cl
nil
++
xs
=
xs
.
Proof
.
induction
xs
;
auto
;
cbn
;
solve_by_rewrite
.
Qed
.
Lemma
clist_app_assoc
{
c1
c2
c3
c4
}
(
xs
:
C
ursor
List
c1
c2
)
(
ys
:
C
ursor
List
c2
c3
)
(
zs
:
C
ursor
List
c3
c4
)
:
(
xs
:
C
hained
List
c1
c2
)
(
ys
:
C
hained
List
c2
c3
)
(
zs
:
C
hained
List
c3
c4
)
:
xs
++
ys
++
zs
=
(
xs
++
ys
)
++
zs
.
Proof
.
induction
zs
;
intros
;
auto
;
cbn
;
solve_by_rewrite
.
Qed
.
End
Theories
.
Lemma
prefix_of_app
{
from
mid
to
to
'
}
{
prefix
:
C
ursor
List
from
mid
}
{
xs
:
C
ursor
List
from
to
}
{
suffix
:
C
ursor
List
to
to
'
}
:
{
prefix
:
C
hained
List
from
mid
}
{
xs
:
C
hained
List
from
to
}
{
suffix
:
C
hained
List
to
to
'
}
:
prefix
`prefix_of
`
xs
->
prefix
`prefix_of
`
xs
++
suffix
.
Proof
.
...
...
@@ -72,13 +65,13 @@ Proof.
exists
(
ex_suffix
++
suffix
).
rewrite
clist_app_assoc
;
congruence
.
Qed
.
End
C
ursor
List
.
End
C
hained
List
.
Delimit
Scope
clist_scope
with
trace
.
Bind
Scope
clist_scope
with
C
ursor
List
.
Bind
Scope
clist_scope
with
C
hained
List
.
Infix
"++"
:=
clist_app
(
right
associativity
,
at
level
60
)
:
clist_scope
.
Infix
"`prefix_of`"
:=
clist_prefix
(
at
level
70
)
:
clist_scope
.
Infix
"`suffix_of`"
:=
clist_suffix
(
at
level
70
)
:
clist_scope
.
Arguments
C
ursor
List
:
clear
implicits
.
Arguments
C
hained
List
:
clear
implicits
.
src/Circulation.v
View file @
3eaadae9
...
...
@@ -3,7 +3,7 @@ chain implementing a chain type. More specifically, we show that the circulation
does
not
change
during
execution
of
blocks
.
This
is
proven
under
the
(
implicit
)
assumption
that
the
address
space
is
finite
.
*
)
From
Coq
Require
Import
List
Permutation
ZArith
Psatz
Morphisms
.
From
SmartContracts
Require
Import
Automation
Blockchain
Extras
Finite
C
ursor
List
.
From
SmartContracts
Require
Import
Automation
Blockchain
Extras
Finite
C
hained
List
.
From
RecordUpdate
Require
Import
RecordSet
.
Import
ListNotations
.
...
...
src/LocalBlockchain.v
View file @
3eaadae9
...
...
@@ -9,7 +9,7 @@ From SmartContracts Require Import Extras.
From
SmartContracts
Require
Import
Automation
.
From
SmartContracts
Require
Import
BoundedN
.
From
SmartContracts
Require
Import
Circulation
.
From
SmartContracts
Require
Import
C
ursor
List
.
From
SmartContracts
Require
Import
C
hained
List
.
From
RecordUpdate
Require
Import
RecordUpdate
.
From
Coq
Require
Import
List
.
From
Coq
Require
Import
Psatz
.
...
...
@@ -346,7 +346,7 @@ Section ExecuteActions.
destruct
(
execute_action_step
_
_
_
_
exec_once
)
as
[
step
].
destruct
trace
as
[
trace
].
Hint
Constructors
ChainEvent
:
core
.
Hint
Constructors
C
ursor
List
.
Hint
Constructors
C
hained
List
.
Hint
Unfold
ChainTrace
.
destruct
df
;
eapply
IH
;
try
eassumption
;
eauto
.
(
*
BF
case
,
where
we
need
to
permute
*
)
...
...
@@ -379,7 +379,7 @@ Proof.
refine
{|
lcb_lc
:=
lc_initial
;
lcb_trace
:=
_
|}
.
constructor
.
apply
CursorList
.
nil
.
exact
cl
nil
.
Defined
.
Definition
validate_header
(
new
old
:
BlockHeader
)
:
option
unit
:=
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment