File: dag-certificate-next.lisp

package info (click to toggle)
acl2 8.6%2Bdfsg-2
  • links: PTS
  • area: main
  • in suites: trixie
  • size: 1,111,420 kB
  • sloc: lisp: 17,818,294; java: 125,359; python: 28,122; javascript: 23,458; cpp: 18,851; ansic: 11,569; perl: 7,678; xml: 5,591; sh: 3,976; makefile: 3,833; ruby: 2,633; yacc: 1,126; ml: 763; awk: 295; csh: 233; lex: 197; php: 178; tcl: 49; asm: 23; haskell: 17
file content (206 lines) | stat: -rw-r--r-- 8,668 bytes parent folder | download | duplicates (2)
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
; AleoBFT Library
;
; Copyright (C) 2024 Provable Inc.
;
; License: See the LICENSE file distributed with this library.
;
; Authors: Alessandro Coglio (www.alessandrocoglio.info)
;          Eric McCarthy (bendyarm on GitHub)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(in-package "ALEOBFT-STAKE2")

(include-book "unequivocal-dags-next")

(local (include-book "kestrel/built-ins/disable" :dir :system))
(local (acl2::disable-most-builtin-logic-defuns))
(local (acl2::disable-builtin-rewrite-rules-for-defaults))
(set-induction-depth-limit 0)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defxdoc+ dag-certificate-next
  :parents (correctness)
  :short "Invariant that retrieving an existing certificate from a DAG
          always returns the same result under all transitions."
  :long
  (xdoc::topstring
   (xdoc::p
    "This is a transition invariant, instead of a state invariant.
     It says that if a certificate with a given author and round
     can be retrieved from the DAG of a correct validator,
     then it can be still retrieved, yielding the same result,
     as the validator changes state via events.
     That is, certificate retrieval is ``stable'' under state changes.")
   (xdoc::p
    "A critical assumption is that certificates are unequivocal.
     This transition invariant is based on
     properties of retrieval operations on unequivocal DAGs,
     which here we lift to (validators in) the system."))
  :order-subtopics t
  :default-parent t)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defsection cert-with-author+round-of-next
  :short "Transition invariant for @(tsee cert-with-author+round)."
  :long
  (xdoc::topstring
   (xdoc::p
    "The only kinds of events that change the DAG
     are @('create') and @('accept').
     They do so by extending the DAG, adding a certificate to it.
     We have already proved the preservation of
     the DAG non-equivocation invariant,
     and here we need to use, directly,
     the fact that DAG non-equivocation is preserved by the transitions:
     this tells us that the new DAG (the one with the added certificate)
     is unequivocal, which lets us use
     @('cert-with-author+round-of-unequivocal-superset')
     to show that we retrieve the same certificate.")
   (xdoc::p
    "We need to assume a number of previously proved invariants,
     which are hypotheses for the preservation of DAG non-equivocation.")
   (xdoc::p
    "The other four kinds of events do not change the DAG,
     and thus the proof is easy."))

  (defruled cert-with-author+round-of-create-next
    (implies (and (system-committees-fault-tolerant-p systate)
                  (no-self-endorsed-p systate)
                  (signer-records-p systate)
                  (signer-quorum-p systate)
                  (unequivocal-dags-p systate)
                  (same-committees-p systate)
                  (set::in val (correct-addresses systate))
                  (create-possiblep cert systate)
                  (cert-with-author+round
                   author
                   round
                   (validator-state->dag
                    (get-validator-state val systate))))
             (equal (cert-with-author+round
                     author
                     round
                     (validator-state->dag
                      (get-validator-state
                       val (create-next cert systate))))
                    (cert-with-author+round
                     author
                     round
                     (validator-state->dag
                      (get-validator-state val systate)))))
    :enable validator-state->dag-of-create-next
    :use ((:instance cert-with-author+round-of-unequivocal-superset
                     (certs0 (validator-state->dag
                              (get-validator-state
                               (certificate->author cert)
                               systate)))
                     (certs (validator-state->dag
                             (get-validator-state
                              (certificate->author cert)
                              (create-next cert systate)))))
          (:instance unequivocal-dags-p-necc-single
                     (val (certificate->author cert))
                     (systate (create-next cert systate)))))

  (defruled cert-with-author+round-of-accept-next
    (implies (and (system-committees-fault-tolerant-p systate)
                  (signer-quorum-p systate)
                  (unequivocal-signed-certs-p systate)
                  (unequivocal-dags-p systate)
                  (same-committees-p systate)
                  (set::in val (correct-addresses systate))
                  (accept-possiblep msg systate)
                  (messagep msg)
                  (cert-with-author+round
                   author
                   round
                   (validator-state->dag
                    (get-validator-state val systate))))
             (equal (cert-with-author+round
                     author
                     round
                     (validator-state->dag
                      (get-validator-state
                       val (accept-next msg systate))))
                    (cert-with-author+round
                     author
                     round
                     (validator-state->dag
                      (get-validator-state val systate)))))
    :enable (validator-state->dag-of-accept-next
             unequivocal-dags-p-of-accept-next)
    :use ((:instance cert-with-author+round-of-unequivocal-superset
                     (certs0 (validator-state->dag
                              (get-validator-state val systate)))
                     (certs (validator-state->dag
                             (get-validator-state
                              val
                              (accept-next msg systate)))))
          (:instance unequivocal-dags-p-necc-single
                     (systate (accept-next msg systate)))))

  (defruled cert-with-author+round-of-advance-next
    (implies (advance-possiblep val1 systate)
             (equal (cert-with-author+round
                     author
                     round
                     (validator-state->dag
                      (get-validator-state
                       val (advance-next val1 systate))))
                    (cert-with-author+round
                     author
                     round
                     (validator-state->dag
                      (get-validator-state val systate)))))
    :enable validator-state->dag-of-advance-next)

  (defruled cert-with-author+round-of-commit-next
    (implies (commit-possiblep val1 systate)
             (equal (cert-with-author+round
                     author
                     round
                     (validator-state->dag
                      (get-validator-state
                       val (commit-next val1 systate))))
                    (cert-with-author+round
                     author
                     round
                     (validator-state->dag
                      (get-validator-state val systate)))))
    :enable validator-state->dag-of-commit-next)

  (defruled cert-with-author+round-of-event-next
    (implies (and (system-committees-fault-tolerant-p systate)
                  (no-self-endorsed-p systate)
                  (signer-records-p systate)
                  (unequivocal-signed-certs-p systate)
                  (signer-quorum-p systate)
                  (unequivocal-dags-p systate)
                  (same-committees-p systate)
                  (set::in val (correct-addresses systate))
                  (event-possiblep event systate)
                  (cert-with-author+round
                   author
                   round
                   (validator-state->dag
                    (get-validator-state val systate))))
             (equal (cert-with-author+round
                     author
                     round
                     (validator-state->dag
                      (get-validator-state
                       val (event-next event systate))))
                    (cert-with-author+round
                     author
                     round
                     (validator-state->dag
                      (get-validator-state val systate)))))
    :enable (event-possiblep
             event-next
             cert-with-author+round-of-create-next
             cert-with-author+round-of-accept-next
             cert-with-author+round-of-advance-next
             cert-with-author+round-of-commit-next)))