A runtime input event. Proposal and ordering are spontaneous in TrecState.Step, so the runtime
carries them in an inbox and consumes them by rewriting.
- propose {Wave : Type u_3} {Hash : Type u_4} (w : Wave) (h : Hash) : Event Wave Hash
- order {Wave : Type u_3} {Hash : Type u_4} (hs : List Hash) : Event Wave Hash
Instances For
Equations
- One or more equations did not get rendered due to their size.
- CordialMiners.Runtime.instDecidableEqEvent.decEq (CordialMiners.Runtime.Event.propose w h) (CordialMiners.Runtime.Event.order hs) = isFalse ⋯
- CordialMiners.Runtime.instDecidableEqEvent.decEq (CordialMiners.Runtime.Event.order hs) (CordialMiners.Runtime.Event.propose w h) = isFalse ⋯
- CordialMiners.Runtime.instDecidableEqEvent.decEq (CordialMiners.Runtime.Event.order a) (CordialMiners.Runtime.Event.order b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
A nullary symbol leaf in the MeTTaIL AST.
Equations
Instances For
An S-expression with a string head.
Equations
- CordialMiners.Runtime.appA s args = MeTTaIL.AST.sexp (MeTTaIL.Label.id s) args
Instances For
Runtime list terminator for variable-length payloads.
Equations
Instances For
Runtime list cons for variable-length payloads.
Equations
- CordialMiners.Runtime.listConsA head tail = CordialMiners.Runtime.appA "list-cons" [head, tail]
Instances For
Encode a Lean list as an explicit AST list payload.
Equations
Instances For
Decode an explicit AST list payload.
Equations
- One or more equations did not get rendered due to their size.
- CordialMiners.Runtime.decodeListA d (MeTTaIL.AST.sexp (MeTTaIL.Label.id "list-nil") []) = some []
- CordialMiners.Runtime.decodeListA d x✝ = none
Instances For
Encoded AST lists decode back to the original Lean list under a left-inverse element codec.
Executable natural-number encoder used by the Nat/Nat demo instance.
Equations
Instances For
Executable natural-number decoder used by the Nat/Nat demo instance.
Equations
Instances For
Convert the older shallow CMIR atom syntax into the real MeTTaIL AST. Applications whose first
element is a symbol become a headed AST node; other lists are preserved under an app head.
Equations
- CordialMiners.Runtime.sexprToAST (CordialMiners.Sexpr.sym s) = CordialMiners.Runtime.symA s
- CordialMiners.Runtime.sexprToAST (CordialMiners.Sexpr.num n) = CordialMiners.Runtime.eNat n
- CordialMiners.Runtime.sexprToAST (CordialMiners.Sexpr.app (CordialMiners.Sexpr.sym h :: args)) = CordialMiners.Runtime.appA h (List.map CordialMiners.Runtime.sexprToAST args)
- CordialMiners.Runtime.sexprToAST (CordialMiners.Sexpr.app args) = CordialMiners.Runtime.appA "app" (List.map CordialMiners.Runtime.sexprToAST args)
Instances For
Encode one coarse protocol fact into the runtime AST.
Equations
- CordialMiners.Runtime.encodeFactA eW eH (CordialMiners.TrecFact.propose w h) = CordialMiners.Runtime.appA "propose" [eW w, eH h]
- CordialMiners.Runtime.encodeFactA eW eH (CordialMiners.TrecFact.qApprove w h) = CordialMiners.Runtime.appA "q-approve" [eW w, eH h]
- CordialMiners.Runtime.encodeFactA eW eH (CordialMiners.TrecFact.certThresh w h) = CordialMiners.Runtime.appA "cert-threshold" [eW w, eH h]
- CordialMiners.Runtime.encodeFactA eW eH (CordialMiners.TrecFact.final w h) = CordialMiners.Runtime.appA "final" [eW w, eH h]
- CordialMiners.Runtime.encodeFactA eW eH (CordialMiners.TrecFact.finalLeader w h) = CordialMiners.Runtime.appA "final-leader" [eW w, eH h]
- CordialMiners.Runtime.encodeFactA eW eH (CordialMiners.TrecFact.orderedPrefix hs) = CordialMiners.Runtime.appA "ordered-prefix" [CordialMiners.Runtime.encodeListA eH hs]
Instances For
Decode a pair of Wave/Hash fields and assemble the result.
Equations
Instances For
Decode an ordered-prefix payload. Runtime terms use one explicit list payload. Legacy shallow extraction used variadic hash arguments, so this decoder accepts that shape too.
Equations
- CordialMiners.Runtime.decodeOrderedPayloadA dH [MeTTaIL.AST.sexp (MeTTaIL.Label.id "list-nil") []] = some []
- CordialMiners.Runtime.decodeOrderedPayloadA dH [MeTTaIL.AST.sexp (MeTTaIL.Label.id "list-cons") [head, tail]] = CordialMiners.Runtime.decodeListA dH (CordialMiners.Runtime.listConsA head tail)
- CordialMiners.Runtime.decodeOrderedPayloadA dH x✝ = List.mapM dH x✝
Instances For
Runtime ordered payloads decode back to the original hash list.
Decode one runtime AST fact back to the coarse protocol fact language. Unknown heads or malformed
arities decode to none.
Equations
- One or more equations did not get rendered due to their size.
- CordialMiners.Runtime.decodeFactA dW dH (MeTTaIL.AST.sexp (MeTTaIL.Label.id "propose") [a, b]) = CordialMiners.Runtime.decodePairA dW dH CordialMiners.TrecFact.propose a b
- CordialMiners.Runtime.decodeFactA dW dH (MeTTaIL.AST.sexp (MeTTaIL.Label.id "q-approve") [a, b]) = CordialMiners.Runtime.decodePairA dW dH CordialMiners.TrecFact.qApprove a b
- CordialMiners.Runtime.decodeFactA dW dH (MeTTaIL.AST.sexp (MeTTaIL.Label.id "cert-threshold") [a, b]) = CordialMiners.Runtime.decodePairA dW dH CordialMiners.TrecFact.certThresh a b
- CordialMiners.Runtime.decodeFactA dW dH (MeTTaIL.AST.sexp (MeTTaIL.Label.id "final") [a, b]) = CordialMiners.Runtime.decodePairA dW dH CordialMiners.TrecFact.final a b
- CordialMiners.Runtime.decodeFactA dW dH (MeTTaIL.AST.sexp (MeTTaIL.Label.id "final-leader") [a, b]) = CordialMiners.Runtime.decodePairA dW dH CordialMiners.TrecFact.finalLeader a b
- CordialMiners.Runtime.decodeFactA dW dH x✝ = none
Instances For
A list of encoded AST items decodes back to the original list.
Direct AST extraction is lossless for individual facts under left-inverse field codecs.
The AC label used for coarse states.
Equations
Instances For
The AC label used for pending input events.
Equations
Instances For
The top-level runtime configuration label.
Equations
Instances For
Sentinel leaf for right-nested AC collections. The sentinel is not an identity law.
Equations
Instances For
A binary collection node.
Equations
- CordialMiners.Runtime.consA op x rest = MeTTaIL.AST.sexp op [x, rest]
Instances For
Encode one runtime input event.
Equations
- CordialMiners.Runtime.encodeEventA eW eH (CordialMiners.Runtime.Event.propose a a_1) = CordialMiners.Runtime.appA "ev-propose" [eW a, eH a_1]
- CordialMiners.Runtime.encodeEventA eW eH (CordialMiners.Runtime.Event.order a) = CordialMiners.Runtime.appA "ev-order" [CordialMiners.Runtime.encodeListA eH a]
Instances For
Decode one runtime input event.
Equations
- CordialMiners.Runtime.decodeEventA dW dH (MeTTaIL.AST.sexp (MeTTaIL.Label.id "ev-propose") [a, b]) = CordialMiners.Runtime.decodePairA dW dH CordialMiners.Runtime.Event.propose a b
- CordialMiners.Runtime.decodeEventA dW dH (MeTTaIL.AST.sexp (MeTTaIL.Label.id "ev-order") rest) = Option.map CordialMiners.Runtime.Event.order (CordialMiners.Runtime.decodeOrderedPayloadA dH rest)
- CordialMiners.Runtime.decodeEventA dW dH x✝ = none
Instances For
Encoded runtime input events decode back to the original event under left-inverse field codecs.
Encode a list of coarse facts as a right-nested state collection. Executable scenarios use this
encoder.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Encode a finite coarse state as a right-nested state collection. The wrapper is noncomputable
because Finset forgets order; executable scenarios use encStateList.
Equations
- CordialMiners.Runtime.encState eW eH s = CordialMiners.Runtime.encStateList eW eH (Finset.toList s)
Instances For
Encode an inbox as a right-nested inbox collection.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Encode a full runtime configuration from an ordered fact list. Executable scenarios use this encoder.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Encode a full runtime configuration.
Equations
- CordialMiners.Runtime.encConfig eW eH events s = MeTTaIL.AST.sexp CordialMiners.Runtime.cmOp [CordialMiners.Runtime.encInbox eW eH events, CordialMiners.Runtime.encState eW eH s]
Instances For
Payloads are clean when they do not contain an embedded runtime configuration head. Payload cleanliness is the syntactic side condition needed by the later backward classifier: protocol rules should fire at the configuration boundary, not inside encoded field payloads.
Equations
- CordialMiners.Runtime.NoEmbeddedConfig (MeTTaIL.AST.var path) = True
- CordialMiners.Runtime.NoEmbeddedConfig (MeTTaIL.AST.sexp l args) = (l ≠ CordialMiners.Runtime.cmOp ∧ CordialMiners.Runtime.NoEmbeddedConfigList args)
- CordialMiners.Runtime.NoEmbeddedConfig (body.subst repl v) = (CordialMiners.Runtime.NoEmbeddedConfig body ∧ CordialMiners.Runtime.NoEmbeddedConfig repl)
Instances For
List form of NoEmbeddedConfig, used to keep the AST recursion structurally visible to Lean.
Equations
Instances For
A well-shaped runtime configuration has one top-level cm node and clean inbox and state payloads.
Equations
Instances For
The runtime sentinel is clean payload.
Explicit AST lists preserve payload cleanliness.
Encoded facts are clean when their field codecs are clean.
Encoded input events are clean when their field codecs are clean.
Encoded state lists are clean when their field codecs are clean.
Encoded inboxes are clean when their field codecs are clean.
Encoded configuration lists satisfy the runtime configuration shape invariant.
Encoded finite-state configurations satisfy the runtime configuration shape invariant.
Flatten one binary collection label. Nonmatching nodes are leaves.
Equations
- One or more equations did not get rendered due to their size.
- CordialMiners.Runtime.collectA op x✝ = [x✝]
Instances For
Decoding a right-nested encoded collection recovers the source list when encoded elements are leaves for that collection and the element codec is lossless.
Decode an inbox collection to the list of well-formed input events it contains. Malformed leaves are ignored, matching the state decoder's abstraction.
Equations
Instances For
Decode the inbox component of a runtime configuration. A bare inbox collection is accepted too, which
mirrors astToState and keeps intermediate lemmas small.
Equations
- CordialMiners.Runtime.astToInbox dW dH (MeTTaIL.AST.sexp (MeTTaIL.Label.id "cm") [ib, head]) = CordialMiners.Runtime.decodeInboxA dW dH ib
- CordialMiners.Runtime.astToInbox dW dH x✝ = CordialMiners.Runtime.decodeInboxA dW dH x✝
Instances For
Decode a state collection, ignoring malformed leaves and collapsing duplicates.
Equations
Instances For
Decode the state component of a runtime configuration. A bare collection is accepted too, which makes the abstraction useful in intermediate lemmas.
Equations
- CordialMiners.Runtime.astToState dW dH (MeTTaIL.AST.sexp (MeTTaIL.Label.id "cm") [ib, head]) = CordialMiners.Runtime.decodeStateA dW dH head
- CordialMiners.Runtime.astToState dW dH x✝ = CordialMiners.Runtime.decodeStateA dW dH x✝
Instances For
Encoded facts are leaves of the runtime state collection.
Encoded input events are leaves of the runtime inbox collection.
Decoding the flattened encoded state list recovers the source fact list.
Decoding an encoded state list gives the finite set represented by the list.
Decoding an encoded inbox recovers the source event list.
Prepending an encoded event to a decoded inbox collection conses the decoded event.
Prepending an encoded fact to a decoded state collection inserts the decoded fact.
Decoding a state collection is insensitive to the AC commutativity generator.
Decoding a state collection is insensitive to the AC associativity generator.
The decoded state of a runtime configuration does not depend on its inbox component.
The decoded state of a runtime configuration is insensitive to state commutativity.
The decoded state of a runtime configuration is insensitive to state associativity.
Re-adding an already decoded fact is a stutter under decodeStateA.
Re-adding an already decoded fact to a runtime configuration is a stutter under astToState.
Decoding an encoded configuration list gives back its inbox event list.
Decoding an encoded finite-set configuration gives back its inbox event list.
Decoding an encoded configuration list gives the finite set represented by its state list.
Decoding an encoded finite-set configuration gives back its coarse state.