WIP
This commit is contained in:
parent
a6a57ab53f
commit
fcb6bd3e1e
33
README2.md
33
README2.md
@ -210,27 +210,38 @@ cargo run -- --help
|
|||||||
// Define a preorder theory
|
// Define a preorder theory
|
||||||
theory Preorder {
|
theory Preorder {
|
||||||
X : Sort;
|
X : Sort;
|
||||||
leq : [a: X, b: X] -> Prop;
|
|
||||||
|
|
||||||
// Reflexivity
|
// The ordering relation: x <= y
|
||||||
forall x : X. |- [a: x, b: x] leq;
|
leq : [x: X, y: X] -> Prop;
|
||||||
|
|
||||||
// Transitivity
|
// Reflexivity: x <= x
|
||||||
forall x : X, y : X, z : X.
|
ax/refl : forall x : X.
|
||||||
[a: x, b: y] leq, [a: y, b: z] leq |- [a: x, b: z] leq;
|
|- [x: x, y: x] leq;
|
||||||
|
|
||||||
|
// Transitivity: x <= y and y <= z implies x <= z
|
||||||
|
ax/trans : forall x : X, y : X, z : X.
|
||||||
|
[x: x, y: y] leq, [x: y, y: z] leq |- [x: x, y: z] leq;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define an instance
|
// Define an instance with automatic chase
|
||||||
instance Chain3 : Preorder = {
|
// The 'chase' keyword applies axioms to compute the closure
|
||||||
|
instance Chain3 : Preorder = chase {
|
||||||
bot : X;
|
bot : X;
|
||||||
mid : X;
|
mid : X;
|
||||||
top : X;
|
top : X;
|
||||||
[a: bot, b: mid] leq;
|
|
||||||
[a: mid, b: top] leq;
|
// Assert the basic ordering; chase derives reflexive pairs
|
||||||
|
// and transitive closure (bot <= top)
|
||||||
|
[x: bot, y: mid] leq;
|
||||||
|
[x: mid, y: top] leq;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Then run `:chase Chain3` to compute the transitive closure.
|
After loading this file, the chase algorithm automatically computes:
|
||||||
|
- Reflexive pairs: `bot <= bot`, `mid <= mid`, `top <= top`
|
||||||
|
- Transitive closure: `bot <= top`
|
||||||
|
|
||||||
|
You can also define an instance without `chase` and run `:chase Chain3` manually.
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user