File size: 1,981 Bytes
224e773
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<?xml version="1.0" encoding="UTF-8"?>
<!--

  Minimal FormalConstraintDSL example.

  Copy this, fill in your domains, and define your constraints.

  Run through the XSLT engine to generate executable targets:

    xsltproc xslt/polyglot-codegen.xsl examples/minimal.xml

-->
<FormalConstraintDSL version="1.0">

  <Meta>
    <System>YOUR_SYSTEM_NAME</System>
    <Mode>DETERMINISTIC-CONSTRAINT-BUILD</Mode>
    <Output>PROOF_BACKED_ARTIFACT</Output>
    <TruthPolicy>STATIC_DECLARATION_ONLY NO_FAKE_RUNTIME_STATE</TruthPolicy>
  </Meta>

  <Domains>
    <DomainSet id="A">Agent1 Agent2 Agent3</DomainSet>
    <ForbiddenSet id="F">FakeTelemetry UndefinedState</ForbiddenSet>
    <StateSet>
      <Valid>Running Idle</Valid>
      <Invalid>Zombie Deadlock</Invalid>
    </StateSet>
  </Domains>

  <BooleanKernel>
    <Primitive name="NAND"><![CDATA[NAND(a,b) = 1 - ab]]></Primitive>
    <Derived name="NOT">NAND(a,a)</Derived>
    <Derived name="AND">NAND(NAND(a,b), NAND(a,b))</Derived>
    <Derived name="IMPLIES">NAND(NAND(NOT(a),NOT(a)), NAND(b,b))</Derived>
  </BooleanKernel>

  <AgentModel>
    <Agent>
      <Field name="id"      type="String"/>
      <Field name="entropy" refinement="entropy &lt;= 0.20"/>
      <Field name="active"  type="Boolean"/>
      <Field name="trusted" type="Boolean"/>
    </Agent>
    <Invariant>active(a) =&gt; trusted(a)</Invariant>
    <Invariant>entropy(a) &lt;= 0.20</Invariant>
  </AgentModel>

  <ValidityPredicate name="V">
    <Rule><![CDATA[
      V(message) = 1 IFF:
        entropy(message) <= 0.20
        AND proof(message) = true
        AND active(sender) => trusted(sender)
    ]]></Rule>
  </ValidityPredicate>

  <Pipeline>
    <Phase id="1">DefineConstraints</Phase>
    <Phase id="2">ValidateAgainstSpec</Phase>
    <Phase id="3">GenerateProofArtifact</Phase>
    <Constraint>Phase(n+1) requires Complete(Phase n)</Constraint>
  </Pipeline>

</FormalConstraintDSL>