Commit cbf2a43
committed
feat(L10): add propositional state-machine theorems for linearity (A3)
Closes PROOF-NEEDS §P0.2. The existing `NoDoubleFree` is a nullary
marker — documentation-as-data — that asserts QTT's structural
guarantee without producing a theorem a caller can hand to another
proof. This change ADDS a witness-manipulating propositional layer
alongside (no existing API changed):
data Usage = Fresh | Consumed
data LinHandleU : Usage -> Nat -> Type
consume : LinHandleU Fresh tok -> LinHandleU Consumed tok
Theorems:
distinctUsage : Fresh = Consumed -> Void
— Usage constructors are distinct; without this
the state machine would collapse.
consumePreservesData : consume (MkLinFresh off sid) =
MkLinConsumed off sid
— behavioural lemma for `consume`: offset and
schemaId carry through; only the state tag
changes.
noReuse : LinHandleU Consumed tok ->
(Consumed = Fresh) -> Void
— the main Level 10 theorem: the only way to
transport a consumed handle back to fresh is
through an absurd equality, so no total
`unconsume` exists in the safe fragment.
noReuseEcho : LinHandleU Consumed tok ->
LinHandleU Fresh tok ->
(Consumed = Fresh) -> Void
— cast as an echo-type / displayed-fiber statement:
the fiber of `consume` over any consumed handle
is at-most-one point. Connects Linear to the
Echo.idr machinery landed in A0.
The existing (1 _ : LinHandle tok) QTT-based linearity enforcement and
`NoDoubleFree` marker remain untouched; this is purely additive.
idris2 --check clean. panic-attack assail: 0 weak points.
Zero dangerous patterns. %default total throughout.1 parent ff31380 commit cbf2a43
2 files changed
Lines changed: 99 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
| 160 | + | |
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
174 | 178 | | |
175 | 179 | | |
176 | 180 | | |
177 | 181 | | |
178 | 182 | | |
179 | 183 | | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
180 | 277 | | |
181 | 278 | | |
182 | 279 | | |
| |||
0 commit comments