@rsconcept/rstool 0.7.2 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/docs/CONSTITUENTA.md +1 -1
- package/docs/DIAGNOSTICS.md +8 -5
- package/docs/MODEL-TESTING.md +1 -1
- package/docs/PORTAL-API.md +20 -0
- package/examples/README.md +52 -29
- package/examples/build-chocolate-nim-rsform.ts +311 -0
- package/examples/chocolate-nim/build-rsform.ts +311 -0
- package/examples/chocolate-nim/build-rsmodel.ts +100 -0
- package/examples/chocolate-nim/constants.ts +10 -0
- package/examples/chocolate-nim/rsform-session.json +778 -0
- package/examples/chocolate-nim/rsmodel-session.json +802 -0
- package/examples/expression-bank/bank-constituents.ts +370 -0
- package/examples/expression-bank/build-rsform.ts +59 -0
- package/examples/expression-bank/constants.ts +1 -0
- package/examples/expression-bank/rsform-session.json +4006 -0
- package/examples/{build-kinship-rsform.ts → kinship/build-rsform.ts} +276 -54
- package/examples/{build-kinship-rsmodel.ts → kinship/build-rsmodel.ts} +18 -7
- package/examples/kinship/constants.ts +5 -3
- package/examples/{kinship-rsmodel-session.json → kinship/rsform-session.json} +614 -92
- package/examples/{kinship-rsform-session.json → kinship/rsmodel-session.json} +704 -50
- package/examples/kinship/x1-actions.test.ts +2 -1
- package/examples/movd/build-rsform.ts +325 -0
- package/examples/movd/build-rsmodel.ts +159 -0
- package/examples/movd/constants.ts +18 -0
- package/examples/movd/rsform-session.json +738 -0
- package/examples/movd/rsmodel-session.json +832 -0
- package/examples/{build-sample-rsform.ts → sample/build-rsform.ts} +2 -2
- package/examples/{build-sample-rsmodel.ts → sample/build-rsmodel.ts} +3 -4
- package/examples/template-apply/build-rsform.ts +236 -0
- package/examples/template-apply/constants.ts +13 -0
- package/examples/template-apply/rsform-session.json +333 -0
- package/package.json +12 -6
- package/skills/rstool-helper/EXAMPLES.md +2 -2
- /package/examples/{sample-rsform-session.json → sample/rsform-session.json} +0 -0
- /package/examples/{sample-rsmodel-session.json → sample/rsmodel-session.json} +0 -0
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import { CstType, type AddOrUpdateConstituentaInput } from '../../src';
|
|
2
|
+
|
|
3
|
+
type BankRow = {
|
|
4
|
+
id: number;
|
|
5
|
+
alias: string;
|
|
6
|
+
cstType: CstType;
|
|
7
|
+
term: string;
|
|
8
|
+
definitionFormal: string;
|
|
9
|
+
convention?: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
function row(input: BankRow): AddOrUpdateConstituentaInput {
|
|
13
|
+
return {
|
|
14
|
+
draft: {
|
|
15
|
+
id: input.id,
|
|
16
|
+
alias: input.alias,
|
|
17
|
+
cstType: input.cstType,
|
|
18
|
+
definitionFormal: input.definitionFormal,
|
|
19
|
+
term: input.term,
|
|
20
|
+
convention: input.convention ?? ''
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Шаблоны «Банка выражений» (Portal rsforms/42, alias БВ).
|
|
27
|
+
* Радикалы R1–R3; без базисных X#. Секции T1–T10.
|
|
28
|
+
*/
|
|
29
|
+
const rows: BankRow[] = [
|
|
30
|
+
// T1 — управляющие конструкции
|
|
31
|
+
{ id: 1, alias: 'T1', cstType: CstType.STATEMENT, term: 'Управляющие конструкции', definitionFormal: '1=1' },
|
|
32
|
+
{ id: 2, alias: 'F1', cstType: CstType.FUNCTION, term: 'схема ограниченного выделения', definitionFormal: '[α∈ℬ(R1)] D{ ξ∈α | ξ=ξ }' },
|
|
33
|
+
{
|
|
34
|
+
id: 3,
|
|
35
|
+
alias: 'F2',
|
|
36
|
+
cstType: CstType.FUNCTION,
|
|
37
|
+
term: 'условный переход',
|
|
38
|
+
definitionFormal: '[α∈ℬ(R1)] debool(I{ α | 1=1} ∪ I{ α\\α | 1≠1})'
|
|
39
|
+
},
|
|
40
|
+
{ id: 4, alias: 'F3', cstType: CstType.FUNCTION, term: 'рекурсивное определение', definitionFormal: '[α∈ℬ(R1)] R{ ξ:=α | ξ≠∅ | ξ\\ξ }' },
|
|
41
|
+
|
|
42
|
+
// T2 — бинарные отношения двух множеств
|
|
43
|
+
{ id: 5, alias: 'T2', cstType: CstType.STATEMENT, term: 'Бинарные отношения двух множеств', definitionFormal: '1=1' },
|
|
44
|
+
{ id: 6, alias: 'F4', cstType: CstType.FUNCTION, term: 'обратное отношение', definitionFormal: '[σ∈ℬ(R1×R2)] Pr2,1(σ)' },
|
|
45
|
+
{ id: 7, alias: 'P1', cstType: CstType.PREDICATE, term: 'свойство всюдуопределенности', definitionFormal: '[α∈ℬ(R1), σ∈ℬ(R1×R2)] Pr1(σ) = α' },
|
|
46
|
+
{ id: 8, alias: 'P2', cstType: CstType.PREDICATE, term: 'свойство всюдузначности', definitionFormal: '[α∈ℬ(R2), σ∈ℬ(R1×R2)] Pr2(σ) = α' },
|
|
47
|
+
{ id: 9, alias: 'P3', cstType: CstType.PREDICATE, term: 'свойство прямой однозначности', definitionFormal: '[σ∈ℬ(R1×R2)] card(Pr1(σ)) = card(σ)' },
|
|
48
|
+
{ id: 10, alias: 'P4', cstType: CstType.PREDICATE, term: 'свойство обратной однозначности', definitionFormal: '[σ∈ℬ(R1×R2)] card(Pr2(σ)) = card(σ)' },
|
|
49
|
+
{
|
|
50
|
+
id: 11,
|
|
51
|
+
alias: 'P5',
|
|
52
|
+
cstType: CstType.PREDICATE,
|
|
53
|
+
term: 'функция',
|
|
54
|
+
definitionFormal: '[α∈ℬ(R1), σ∈ℬ(R1×R2)] card(Pr1(σ)) = card(σ) & Pr1(σ) = α'
|
|
55
|
+
},
|
|
56
|
+
{ id: 12, alias: 'F5', cstType: CstType.FUNCTION, term: 'образ элемента', definitionFormal: '[α∈R1, σ∈ℬ(R1×R2)] debool(Pr2(Fi1[{α}](σ)))' },
|
|
57
|
+
{ id: 13, alias: 'F6', cstType: CstType.FUNCTION, term: 'сечение по элементу', definitionFormal: '[α∈R1, σ∈ℬ(R1×R2)] Pr2(Fi1[{α}](σ))' },
|
|
58
|
+
{ id: 14, alias: 'F7', cstType: CstType.FUNCTION, term: 'прообраз значения', definitionFormal: '[α∈R2, σ∈ℬ(R1×R2)] debool(Pr1(Fi2[{α}](σ)))' },
|
|
59
|
+
{ id: 15, alias: 'F8', cstType: CstType.FUNCTION, term: 'сечение по значению', definitionFormal: '[α∈R2, σ∈ℬ(R1×R2)] Pr1(Fi2[{α}](σ))' },
|
|
60
|
+
{ id: 16, alias: 'F9', cstType: CstType.FUNCTION, term: 'образ множества', definitionFormal: '[α∈ℬ(R1), σ∈ℬ(R1×R2)] Pr2(Fi1[α](σ))' },
|
|
61
|
+
{ id: 17, alias: 'F10', cstType: CstType.FUNCTION, term: 'прообраз множества', definitionFormal: '[α∈ℬ(R2), σ∈ℬ(R1×R2)] Pr1(Fi2[α](σ))' },
|
|
62
|
+
{
|
|
63
|
+
id: 18,
|
|
64
|
+
alias: 'F11',
|
|
65
|
+
cstType: CstType.FUNCTION,
|
|
66
|
+
term: 'композиция отношений',
|
|
67
|
+
definitionFormal: '[σ1∈ℬ(R1×R2), σ2∈ℬ(R2×R3)] I{(ξ1, ξ3) | (ξ1,ξ2):∈σ1; ξ3:∈Pr2(Fi1[{ξ2}](σ2))}'
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
// T3 — бинарные отношения на множестве
|
|
71
|
+
{ id: 19, alias: 'T3', cstType: CstType.STATEMENT, term: 'Бинарные отношения на множестве', definitionFormal: '1=1' },
|
|
72
|
+
{ id: 20, alias: 'F12', cstType: CstType.FUNCTION, term: 'участники отношения', definitionFormal: '[σ∈ℬ(R1×R1)] Pr1(σ)∪Pr2(σ)' },
|
|
73
|
+
{
|
|
74
|
+
id: 21,
|
|
75
|
+
alias: 'P6',
|
|
76
|
+
cstType: CstType.PREDICATE,
|
|
77
|
+
term: 'свойство полноты (линейности)',
|
|
78
|
+
definitionFormal: '[α∈ℬ(R1), σ∈ℬ(R1×R1)] σ∪Pr2,1(σ)∪Pr1,1(σ)∪Pr2,2(σ) = α×α'
|
|
79
|
+
},
|
|
80
|
+
{ id: 22, alias: 'P7', cstType: CstType.PREDICATE, term: 'свойство симметричности', definitionFormal: '[σ∈ℬ(R1×R1)] Pr2,1(σ) = σ' },
|
|
81
|
+
{
|
|
82
|
+
id: 23,
|
|
83
|
+
alias: 'P8',
|
|
84
|
+
cstType: CstType.PREDICATE,
|
|
85
|
+
term: 'свойство антисимметричности',
|
|
86
|
+
definitionFormal: '[σ∈ℬ(R1×R1)] (Pr2,1(σ)∩σ)\\Pr1,1(σ)=∅'
|
|
87
|
+
},
|
|
88
|
+
{ id: 24, alias: 'P9', cstType: CstType.PREDICATE, term: 'свойство рефлексивности', definitionFormal: '[σ∈ℬ(R1×R1)] Pr1,1(σ) ⊆ σ' },
|
|
89
|
+
{ id: 25, alias: 'P10', cstType: CstType.PREDICATE, term: 'свойство антирефлексивности', definitionFormal: '[σ∈ℬ(R1×R1)] Pr1,1(σ)∩σ=∅' },
|
|
90
|
+
{
|
|
91
|
+
id: 26,
|
|
92
|
+
alias: 'P11',
|
|
93
|
+
cstType: CstType.PREDICATE,
|
|
94
|
+
term: 'свойство транзитивности',
|
|
95
|
+
definitionFormal: '[σ∈ℬ(R1×R1)] ∀(α1,α2),(β1,β2)∈σ (α2=β1 ⇒ (α1,β2)∈σ)'
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: 27,
|
|
99
|
+
alias: 'P14',
|
|
100
|
+
cstType: CstType.PREDICATE,
|
|
101
|
+
term: 'частичный порядок',
|
|
102
|
+
definitionFormal:
|
|
103
|
+
'[σ∈ℬ(R1×R1)] Pr2,1(σ)∩σ\\Pr1,1(σ)=∅ & (Pr1,1(σ)∩σ=∅ ∨ Pr1,1(σ)⊆σ) & ∀(α1,α2),(β1,β2)∈σ (α2=β1 ⇒ (α1,β2)∈σ)'
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: 28,
|
|
107
|
+
alias: 'P15',
|
|
108
|
+
cstType: CstType.PREDICATE,
|
|
109
|
+
term: 'линейный порядок',
|
|
110
|
+
definitionFormal:
|
|
111
|
+
'[α∈ℬ(R1), σ∈ℬ(R1×R1)] Pr2,1(σ)∩σ\\Pr1,1(σ) = ∅ & (Pr1,1(σ)∩σ = ∅ ∨ Pr1,1(σ) ⊆ σ) & ∀(α1,α2),(β1,β2)∈σ (α2=β1 ⇒ (α1,β2)∈σ) & σ∪Pr2,1(σ)∪Pr1,1(σ)∪Pr2,2(σ) = α×α'
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
id: 29,
|
|
115
|
+
alias: 'F13',
|
|
116
|
+
cstType: CstType.FUNCTION,
|
|
117
|
+
term: 'минимальные элементы порядка на данном подмножестве',
|
|
118
|
+
definitionFormal: '[α∈ℬ(R1), σ∈ℬ(R1×R1)] α \\ Pr2(Fi1,2[α, α](σ))'
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
id: 30,
|
|
122
|
+
alias: 'F14',
|
|
123
|
+
cstType: CstType.FUNCTION,
|
|
124
|
+
term: 'наименьший элемент порядка на данном подмножестве',
|
|
125
|
+
definitionFormal:
|
|
126
|
+
'[α∈ℬ(R1), σ∈ℬ(R1×R1)] debool(I{ β | δ1:=Fi1,2[α, α](σ); δ2:=δ1\\Pr1,1(δ1); β:=Pr1(δ2)\\Pr2(δ2) })'
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
id: 31,
|
|
130
|
+
alias: 'P17',
|
|
131
|
+
cstType: CstType.PREDICATE,
|
|
132
|
+
term: 'эквивалентность',
|
|
133
|
+
definitionFormal: '[σ∈ℬ(R1×R1)] Pr1,1(σ) ⊆ σ & Pr2,1(σ) = σ & ∀(α1,α2),(β1,β2)∈σ (α2=β1 ⇒ (α1,β2)∈σ)'
|
|
134
|
+
},
|
|
135
|
+
{ id: 32, alias: 'P18', cstType: CstType.PREDICATE, term: 'толерантность', definitionFormal: '[σ∈ℬ(R1×R1)] Pr1,1(σ) ⊆ σ & Pr2,1(σ) = σ' },
|
|
136
|
+
{ id: 33, alias: 'F15', cstType: CstType.FUNCTION, term: 'класс эквивалентности элемента', definitionFormal: '[α∈R1, σ∈ℬ(R1×R1)] Pr2(Fi1[{α}](σ))' },
|
|
137
|
+
|
|
138
|
+
// T4 — цепочки
|
|
139
|
+
{ id: 34, alias: 'T4', cstType: CstType.STATEMENT, term: 'Цепочки', definitionFormal: '1=1' },
|
|
140
|
+
{
|
|
141
|
+
id: 35,
|
|
142
|
+
alias: 'P19',
|
|
143
|
+
cstType: CstType.PREDICATE,
|
|
144
|
+
term: 'условие связности цепочки',
|
|
145
|
+
definitionFormal:
|
|
146
|
+
'[σ∈ℬ(R1×R1)] card(Pr1(σ))=card(σ) & card(Pr2(σ))=card(σ) & card(Pr1(σ)\\Pr2(σ))=1 & card(Pr2(σ)\\Pr1(σ))=1'
|
|
147
|
+
},
|
|
148
|
+
{ id: 36, alias: 'F16', cstType: CstType.FUNCTION, term: 'начало цепочки', definitionFormal: '[σ∈ℬ(R1×R1)] debool(Pr1(σ) \\ Pr2(σ))' },
|
|
149
|
+
{ id: 37, alias: 'F17', cstType: CstType.FUNCTION, term: 'конец цепочки', definitionFormal: '[σ∈ℬ(R1×R1)] debool(Pr2(σ) \\ Pr1(σ))' },
|
|
150
|
+
{ id: 38, alias: 'F18', cstType: CstType.FUNCTION, term: 'следующий за данным элемент цепочки', definitionFormal: '[α∈R1, σ∈ℬ(R1×R1)] debool(Pr2(Fi1[{α}](σ)))' },
|
|
151
|
+
{ id: 39, alias: 'F19', cstType: CstType.FUNCTION, term: 'предшествующий данному элемент цепочки', definitionFormal: '[α∈R1, σ∈ℬ(R1×R1)] debool(Pr1(Fi2[{α}](σ)))' },
|
|
152
|
+
|
|
153
|
+
// T5 — графы
|
|
154
|
+
{ id: 40, alias: 'T5', cstType: CstType.STATEMENT, term: 'Графы', definitionFormal: '1=1' },
|
|
155
|
+
{
|
|
156
|
+
id: 41,
|
|
157
|
+
alias: 'P20',
|
|
158
|
+
cstType: CstType.PREDICATE,
|
|
159
|
+
term: 'неориентированный граф',
|
|
160
|
+
definitionFormal: '[γ∈ℬ(R1)×ℬ(R1×R1)] pr2(γ) = Pr2,1(pr2(γ))'
|
|
161
|
+
},
|
|
162
|
+
{ id: 42, alias: 'F20', cstType: CstType.FUNCTION, term: 'истоки', definitionFormal: '[σ∈ℬ(R1×R1)] Pr1(σ) \\ Pr2(σ)' },
|
|
163
|
+
{ id: 43, alias: 'F21', cstType: CstType.FUNCTION, term: 'стоки', definitionFormal: '[σ∈ℬ(R1×R1)] Pr2(σ) \\ Pr1(σ)' },
|
|
164
|
+
{ id: 44, alias: 'F22', cstType: CstType.FUNCTION, term: 'изолированные вершины', definitionFormal: '[α∈ℬ(R1), σ∈ℬ(R1×R1)] α \\ (Pr2(σ) ∪ Pr1(σ))' },
|
|
165
|
+
{ id: 45, alias: 'F23', cstType: CstType.FUNCTION, term: 'потребители', definitionFormal: '[α∈R1, σ∈ℬ(R1×R1)] Pr2(Fi1[{α}](σ))' },
|
|
166
|
+
{ id: 46, alias: 'F24', cstType: CstType.FUNCTION, term: 'поставщики', definitionFormal: '[α∈R1, σ∈ℬ(R1×R1)] Pr1(Fi2[{α}](σ))' },
|
|
167
|
+
{
|
|
168
|
+
id: 47,
|
|
169
|
+
alias: 'F25',
|
|
170
|
+
cstType: CstType.FUNCTION,
|
|
171
|
+
term: 'зависимые вершины',
|
|
172
|
+
definitionFormal: '[α∈R1, σ∈ℬ(R1×R1)] R{ ξ:=Pr2(Fi1[{α}](σ)) | ξ ∪ Pr2(Fi1[ξ](σ)) }',
|
|
173
|
+
convention: 'вершины, достижимые из данной'
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
id: 48,
|
|
177
|
+
alias: 'F26',
|
|
178
|
+
cstType: CstType.FUNCTION,
|
|
179
|
+
term: 'зависимые вершины совокупности',
|
|
180
|
+
definitionFormal: '[α∈ℬ(R1), σ∈ℬ(R1×R1)] R{ ξ:=Pr2(Fi1[α](σ)) | ξ ∪ Pr2(Fi1[ξ](σ)) }'
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
id: 49,
|
|
184
|
+
alias: 'F27',
|
|
185
|
+
cstType: CstType.FUNCTION,
|
|
186
|
+
term: 'влияющие вершины',
|
|
187
|
+
definitionFormal: '[α∈R1, σ∈ℬ(R1×R1)] R{ ξ:=Pr1(Fi2[{α}](σ)) | ξ ∪ Pr1(Fi2[ξ](σ)) }',
|
|
188
|
+
convention: 'вершины, из которых данная достижима'
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
id: 50,
|
|
192
|
+
alias: 'P22',
|
|
193
|
+
cstType: CstType.PREDICATE,
|
|
194
|
+
term: 'свойство ацикличности',
|
|
195
|
+
definitionFormal: '[σ∈ℬ(R1×R1)] ∀γ∈Pr1(σ) γ∉R{ ξ:=Pr2(Fi1[{γ}](σ)) | ξ ∪ Pr2(Fi1[ξ](σ)) }'
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
id: 51,
|
|
199
|
+
alias: 'F29',
|
|
200
|
+
cstType: CstType.FUNCTION,
|
|
201
|
+
term: 'транзитивное замыкание',
|
|
202
|
+
definitionFormal: '[σ∈ℬ(R1×R1)] I{(ξ1, ξ2) | ξ1:∈Pr1(σ); ξ2:∈F25[ξ1, σ]}'
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
// T6 — целые числа
|
|
206
|
+
{ id: 52, alias: 'T6', cstType: CstType.STATEMENT, term: 'Целые числа', definitionFormal: '1=1' },
|
|
207
|
+
{ id: 53, alias: 'F31', cstType: CstType.FUNCTION, term: 'минимум набора чисел', definitionFormal: '[σ∈ℬ(Z)] debool(D{ξ∈σ | ∀α∈σ α ≥ ξ})' },
|
|
208
|
+
{ id: 54, alias: 'F32', cstType: CstType.FUNCTION, term: 'максимум набора чисел', definitionFormal: '[σ∈ℬ(Z)] debool(D{ξ∈σ | ∀α∈σ α ≤ ξ})' },
|
|
209
|
+
{
|
|
210
|
+
id: 55,
|
|
211
|
+
alias: 'F33',
|
|
212
|
+
cstType: CstType.FUNCTION,
|
|
213
|
+
term: 'натуральные числа, меньшие или равные данному',
|
|
214
|
+
definitionFormal: '[α∈Z] R{(ξ,σ):=(0, {0}) | ξ<α | (ξ+1, σ ∪ {ξ+1})}'
|
|
215
|
+
},
|
|
216
|
+
{ id: 56, alias: 'P25', cstType: CstType.PREDICATE, term: 'набор чисел, удовлетворяющий данному периоду', definitionFormal: '[σ∈ℬ(Z), τ∈Z] ∀α∈σ (α+τ ≤ F32[σ] ⇒ α+τ∈σ)' },
|
|
217
|
+
{ id: 57, alias: 'F35', cstType: CstType.FUNCTION, term: 'остаток от деления', definitionFormal: '[α∈Z, β∈Z] R{ξ:=α | ξ≥β & β>0 | ξ-β}' },
|
|
218
|
+
|
|
219
|
+
// T7 — последовательности
|
|
220
|
+
{ id: 58, alias: 'T7', cstType: CstType.STATEMENT, term: 'Последовательности', definitionFormal: '1=1' },
|
|
221
|
+
{
|
|
222
|
+
id: 59,
|
|
223
|
+
alias: 'P26',
|
|
224
|
+
cstType: CstType.PREDICATE,
|
|
225
|
+
term: 'корректная последовательность (позиции с нуля)',
|
|
226
|
+
definitionFormal: '[σ∈ℬ(R1×Z)] card(σ)=card(Pr2(σ)) & ∀λ∈Pr2(σ) λ < card(σ)'
|
|
227
|
+
},
|
|
228
|
+
{ id: 60, alias: 'P28', cstType: CstType.PREDICATE, term: 'подпоследовательность', definitionFormal: '[σ∈ℬ(R1×Z)] card(σ) = card(Pr2(σ))' },
|
|
229
|
+
{ id: 61, alias: 'F36', cstType: CstType.FUNCTION, term: 'начало последовательности', definitionFormal: '[σ∈ℬ(R1×Z)] debool(Pr1(Fi2[{0}](σ)))' },
|
|
230
|
+
{ id: 62, alias: 'F37', cstType: CstType.FUNCTION, term: 'конец последовательности', definitionFormal: '[σ∈ℬ(R1×Z)] debool(Pr1(Fi2[{card(σ) - 1}](σ)))' },
|
|
231
|
+
{
|
|
232
|
+
id: 63,
|
|
233
|
+
alias: 'F40',
|
|
234
|
+
cstType: CstType.FUNCTION,
|
|
235
|
+
term: 'обращенная последовательность',
|
|
236
|
+
definitionFormal: '[σ∈ℬ(R1×Z)] I{(α, λ) | (α,μ):∈σ; λ := card(σ) - μ - 1}'
|
|
237
|
+
},
|
|
238
|
+
|
|
239
|
+
// T8 — групповые операции
|
|
240
|
+
{
|
|
241
|
+
id: 64,
|
|
242
|
+
alias: 'T8',
|
|
243
|
+
cstType: CstType.STATEMENT,
|
|
244
|
+
term: 'Групповые операции',
|
|
245
|
+
definitionFormal: '1=1',
|
|
246
|
+
convention: 'Условия для левых и правых свойств через конкатенацию'
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
id: 65,
|
|
250
|
+
alias: 'F42',
|
|
251
|
+
cstType: CstType.FUNCTION,
|
|
252
|
+
term: 'результат операции для данных аргументов',
|
|
253
|
+
definitionFormal: '[α∈R1, β∈R1, σ∈ℬ((R1×R1)×R1)] debool(Pr2(Fi1[{(α,β)}](σ)))'
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
id: 66,
|
|
257
|
+
alias: 'F43',
|
|
258
|
+
cstType: CstType.FUNCTION,
|
|
259
|
+
term: 'инвариантные элементы',
|
|
260
|
+
definitionFormal: '[σ∈ℬ((R1×R1)×R1)] D{ξ∈Pr1(Pr1(σ)) | ∀α∈Pr1(Pr1(σ)) (((α,ξ),ξ)∈σ & ((ξ,α),ξ)∈σ)}',
|
|
261
|
+
convention: 'например ноль для операции умножения целых чисел'
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
id: 67,
|
|
265
|
+
alias: 'F44',
|
|
266
|
+
cstType: CstType.FUNCTION,
|
|
267
|
+
term: 'нейтральные элементы',
|
|
268
|
+
definitionFormal:
|
|
269
|
+
'[σ∈ℬ((R1×R1)×R1)] D{ξ∈Pr1(Pr1(σ)) | ∀α∈Pr1(Pr1(σ)) (((α,ξ),α)∈σ & ((ξ,α),α)∈σ)}'
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
id: 68,
|
|
273
|
+
alias: 'F45',
|
|
274
|
+
cstType: CstType.FUNCTION,
|
|
275
|
+
term: 'идемпотентные элементы',
|
|
276
|
+
definitionFormal: '[σ∈ℬ((R1×R1)×R1)] D{ξ∈Pr1(Pr1(σ)) | ((ξ,ξ),ξ)∈σ}'
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
id: 69,
|
|
280
|
+
alias: 'F46',
|
|
281
|
+
cstType: CstType.FUNCTION,
|
|
282
|
+
term: 'обратные элементы для данного элемента',
|
|
283
|
+
definitionFormal:
|
|
284
|
+
'[α∈R1, σ∈ℬ((R1×R1)×R1)] D{ω∈Pr1(Pr1(σ)) | F42[α,ω,σ]∈F44[σ] & F42[ω,α,σ]∈F44[σ]}'
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
id: 70,
|
|
288
|
+
alias: 'F47',
|
|
289
|
+
cstType: CstType.FUNCTION,
|
|
290
|
+
term: 'элемент, являющийся данной степенью данного элемента',
|
|
291
|
+
definitionFormal:
|
|
292
|
+
'[α∈R1, λ∈Z, σ∈ℬ((R1×R1)×R1)] pr1(R{(ξ, μ) := (α, 1) | μ<λ & λ>0 | (F42[ξ,α,σ], μ + 1)})'
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
id: 71,
|
|
296
|
+
alias: 'P29',
|
|
297
|
+
cstType: CstType.PREDICATE,
|
|
298
|
+
term: 'свойство замкнутости и однозначности',
|
|
299
|
+
definitionFormal: '[α∈ℬ(R1), σ∈ℬ((R1×R1)×R1)] Pr1(σ) = α×α & card(σ) = card(Pr1(σ))'
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
id: 72,
|
|
303
|
+
alias: 'P30',
|
|
304
|
+
cstType: CstType.PREDICATE,
|
|
305
|
+
term: 'свойство ассоциативности',
|
|
306
|
+
definitionFormal: '[σ∈ℬ((R1×R1)×R1)] ∀α,β,γ∈Pr1(Pr1(σ)) F42[F42[α,β,σ],γ,σ] = F42[α,F42[β,γ,σ],σ]'
|
|
307
|
+
},
|
|
308
|
+
{ id: 73, alias: 'P31', cstType: CstType.PREDICATE, term: 'свойство коммутативности', definitionFormal: '[σ∈ℬ((R1×R1)×R1)] ∀((α1,α2),γ)∈σ ((α2,α1),γ)∈σ' },
|
|
309
|
+
{
|
|
310
|
+
id: 74,
|
|
311
|
+
alias: 'P35',
|
|
312
|
+
cstType: CstType.PREDICATE,
|
|
313
|
+
term: 'полугруппа',
|
|
314
|
+
definitionFormal: '[α∈ℬ(R1), σ∈ℬ((R1×R1)×R1)] P29[α, σ] & P30[σ]',
|
|
315
|
+
convention: 'ассоциативный группоид'
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
id: 75,
|
|
319
|
+
alias: 'P36',
|
|
320
|
+
cstType: CstType.PREDICATE,
|
|
321
|
+
term: 'моноид',
|
|
322
|
+
definitionFormal: '[α∈ℬ(R1), σ∈ℬ((R1×R1)×R1)] P29[α, σ] & P30[σ] & card(F44[σ]) > 0',
|
|
323
|
+
convention: 'полугруппа с нейтральным элементом'
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
id: 76,
|
|
327
|
+
alias: 'P37',
|
|
328
|
+
cstType: CstType.PREDICATE,
|
|
329
|
+
term: 'группа',
|
|
330
|
+
definitionFormal: '[α∈ℬ(R1), σ∈ℬ((R1×R1)×R1)] P29[α, σ] & P30[σ] & card(F44[σ]) > 0 & ∀ξ∈α card(F46[ξ, σ]) > 0'
|
|
331
|
+
},
|
|
332
|
+
|
|
333
|
+
// T9 — кольца
|
|
334
|
+
{ id: 77, alias: 'T9', cstType: CstType.STATEMENT, term: 'Кольца', definitionFormal: '1=1', convention: 'Операции по умолчанию — группоиды' },
|
|
335
|
+
{
|
|
336
|
+
id: 78,
|
|
337
|
+
alias: 'P39',
|
|
338
|
+
cstType: CstType.PREDICATE,
|
|
339
|
+
term: 'свойство дистрибутивности φψ',
|
|
340
|
+
definitionFormal:
|
|
341
|
+
'[φ∈ℬ((R1×R1)×R1), ψ∈ℬ((R1×R1)×R1)] ∀α,β,γ∈Pr1(Pr1(φ)) ( F42[α, F42[β, γ, φ], ψ] = F42[F42[α, β, ψ], F42[α, γ, ψ], φ] & F42[F42[α, β, φ], γ, ψ] = F42[F42[α, γ, ψ], F42[β, γ, ψ], φ] )'
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
id: 79,
|
|
345
|
+
alias: 'P41',
|
|
346
|
+
cstType: CstType.PREDICATE,
|
|
347
|
+
term: 'полукольцо',
|
|
348
|
+
definitionFormal:
|
|
349
|
+
'[α∈ℬ(R1), φ∈ℬ((R1×R1)×R1), ψ∈ℬ((R1×R1)×R1)] P36[α, φ] & P31[φ] & P35[α, ψ] & P39[φ, ψ]',
|
|
350
|
+
convention: 'сложение — моноид + коммутативность; умножение — полугруппа'
|
|
351
|
+
},
|
|
352
|
+
|
|
353
|
+
// T10 — множества подмножеств
|
|
354
|
+
{ id: 80, alias: 'T10', cstType: CstType.STATEMENT, term: 'Множества подмножеств', definitionFormal: '1=1' },
|
|
355
|
+
{ id: 81, alias: 'P46', cstType: CstType.PREDICATE, term: 'свойство покрытия', definitionFormal: '[α∈ℬ(R1), σ∈ℬℬ(R1)] α⊆red(σ)' },
|
|
356
|
+
{ id: 82, alias: 'P47', cstType: CstType.PREDICATE, term: 'свойство попарного непересечения', definitionFormal: '[σ∈ℬℬ(R1)] ∀α,β∈σ (α≠β ⇒ α∩β=∅)' },
|
|
357
|
+
{ id: 83, alias: 'P48', cstType: CstType.PREDICATE, term: 'свойство замкнутости по объединению', definitionFormal: '[σ∈ℬℬ(R1)] ∀α,β∈σ α∪β∈σ' },
|
|
358
|
+
{
|
|
359
|
+
id: 84,
|
|
360
|
+
alias: 'P52',
|
|
361
|
+
cstType: CstType.PREDICATE,
|
|
362
|
+
term: 'разбиение',
|
|
363
|
+
definitionFormal: '[α∈ℬ(R1), σ∈ℬℬ(R1)] red(σ)=α & card(σ)>1 & ∅∉σ & ∀ξ1,ξ2∈σ (ξ1≠ξ2 ⇒ ξ1∩ξ2=∅)'
|
|
364
|
+
},
|
|
365
|
+
{ id: 85, alias: 'F48', cstType: CstType.FUNCTION, term: 'фильтр по вхождению элемента', definitionFormal: '[α∈R1, σ∈ℬℬ(R1)] D{ξ∈σ | α∈ξ}' },
|
|
366
|
+
{ id: 86, alias: 'F49', cstType: CstType.FUNCTION, term: 'фильтр по подмножеству', definitionFormal: '[α∈ℬ(R1), σ∈ℬℬ(R1)] D{ξ∈σ | α⊆ξ}' },
|
|
367
|
+
{ id: 87, alias: 'F50', cstType: CstType.FUNCTION, term: 'фильтр по надмножеству', definitionFormal: '[α∈ℬ(R1), σ∈ℬℬ(R1)] D{ξ∈σ | ξ⊆α}' }
|
|
368
|
+
];
|
|
369
|
+
|
|
370
|
+
export const BANK_DRAFTS: AddOrUpdateConstituentaInput[] = rows.map(row);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { writeFile } from 'node:fs/promises';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
|
|
4
|
+
import { RSToolWrapperClient } from '../../src';
|
|
5
|
+
|
|
6
|
+
import { BANK_DRAFTS } from './bank-constituents';
|
|
7
|
+
import { DEFAULT_RSFORM_SESSION_PATH } from './constants';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Банк шаблонов выражений (Portal rsforms/42, alias БВ).
|
|
11
|
+
* Радикалы R1–R3; секции T1–T10 с представителями F# и P#.
|
|
12
|
+
*/
|
|
13
|
+
async function run() {
|
|
14
|
+
const client = new RSToolWrapperClient({
|
|
15
|
+
cwd: resolve(process.cwd())
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
await client.waitUntilReady();
|
|
20
|
+
const session = await client.call<{ sessionId: string; contractVersion: string }>('createSession');
|
|
21
|
+
|
|
22
|
+
for (const input of BANK_DRAFTS) {
|
|
23
|
+
const result = await client.call<{
|
|
24
|
+
state: { alias: string; analysis: { success: boolean } };
|
|
25
|
+
diagnostics: unknown[];
|
|
26
|
+
}>('addOrUpdateConstituenta', {
|
|
27
|
+
sessionId: session.sessionId,
|
|
28
|
+
input
|
|
29
|
+
});
|
|
30
|
+
const ok = result.state.analysis.success;
|
|
31
|
+
const diagCount = result.diagnostics?.length ?? 0;
|
|
32
|
+
console.log(`${input.draft.alias}: ${ok ? 'OK' : 'FAIL'} (${diagCount} diagnostics)`);
|
|
33
|
+
if (!ok) {
|
|
34
|
+
const diags = await client.call('listDiagnostics', { sessionId: session.sessionId });
|
|
35
|
+
console.log(JSON.stringify(diags, null, 2));
|
|
36
|
+
throw new Error(`${input.draft.alias}: analysis failed (${diagCount} diagnostics)`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
await client.call('commitStep', {
|
|
41
|
+
sessionId: session.sessionId,
|
|
42
|
+
message: 'Банк выражений (rsforms/42): шаблоны T1–T10 на радикалах R1–R3'
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const exported = await client.call<string>('exportSession', {
|
|
46
|
+
sessionId: session.sessionId
|
|
47
|
+
});
|
|
48
|
+
const outputPath = resolve(process.cwd(), DEFAULT_RSFORM_SESSION_PATH);
|
|
49
|
+
await writeFile(outputPath, exported, 'utf8');
|
|
50
|
+
console.log(`Exported: ${outputPath}`);
|
|
51
|
+
} finally {
|
|
52
|
+
await client.close();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
run().catch(error => {
|
|
57
|
+
console.error(error);
|
|
58
|
+
process.exit(1);
|
|
59
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const DEFAULT_RSFORM_SESSION_PATH = 'examples/expression-bank/rsform-session.json';
|