simplify_truths/spec/models.tsp

53 lines
935 B
Plaintext
Raw Normal View History

2024-06-07 16:27:52 +02:00
import "@typespec/openapi3";
using TypeSpec.OpenAPI;
namespace Models;
@summary("A binary operator")
2024-06-07 16:27:52 +02:00
enum BinaryOperator {
AND,
OR,
IMPLICATION,
2024-06-07 16:27:52 +02:00
}
@summary("The inverse of an expression")
2024-06-07 16:27:52 +02:00
model ExpressionNot {
@summary("The expression to negate")
not: Expression;
2024-06-07 16:27:52 +02:00
}
@summary("A binary expression")
2024-06-07 16:27:52 +02:00
model ExpressionBinary {
@summary("The left expression")
left: Expression;
@summary("The binary operator")
operator: BinaryOperator;
@summary("The right expression")
right: Expression;
2024-06-07 16:27:52 +02:00
}
@summary("An atomic expression")
2024-06-07 16:27:52 +02:00
model ExpressionAtomic {
@summary("The atomic value")
atomic: string;
2024-06-07 16:27:52 +02:00
}
@oneOf
@summary("A truth expression")
2024-06-07 16:27:52 +02:00
union Expression {
ExpressionNot,
ExpressionBinary,
ExpressionAtomic,
}
@summary("A truth table")
model TruthTable {
@summary("The header of the truth table")
header: string[];
@summary("The rows and columns of the truth table")
truthMatrix: boolean[][];
}