@@ -1328,8 +1328,8 @@ struct callback_applier {
1328
1328
return leaves;
1329
1329
}
1330
1330
1331
- sp_tau_node<BAs...> apply_wff_remove_buniversal ( const sp_tau_node<BAs...>& n) {
1332
- auto args = n || tau_parser::wff_cb_arg || only_child_extractor<BAs...>;
1331
+ std::pair< sp_tau_node<BAs...>, sp_tau_node<BAs...>> get_quantifier_remove_constituents ( const tau_parser::nonterminal type, const sp_tau_node<BAs...>& n) {
1332
+ auto args = n || type || only_child_extractor<BAs...>;
1333
1333
auto var = args[0 ];
1334
1334
auto T = args[2 ];
1335
1335
auto F = args[3 ];
@@ -1341,54 +1341,26 @@ struct callback_applier {
1341
1341
right_changes[var] = F;
1342
1342
auto right = replace<sp_tau_node<BAs...>>(args[1 ], right_changes)
1343
1343
| only_child_extractor<BAs...> | optional_value_extractor<sp_tau_node<BAs...>>;
1344
+ return {left, right};
1345
+ }
1346
+
1347
+ sp_tau_node<BAs...> apply_wff_remove_buniversal (const sp_tau_node<BAs...>& n) {
1348
+ auto [left, right] = get_quantifier_remove_constituents (tau_parser::wff_cb_arg, n);
1344
1349
return build_wff_and<BAs...>(left, right);
1345
1350
}
1346
1351
1347
1352
sp_tau_node<BAs...> apply_wff_remove_bexistential (const sp_tau_node<BAs...>& n) {
1348
- auto args = n || tau_parser::wff_cb_arg || only_child_extractor<BAs...>;
1349
- auto var = args[0 ];
1350
- auto T = args[2 ];
1351
- auto F = args[3 ];
1352
- std::map<sp_tau_node<BAs...>, sp_tau_node<BAs...>> left_changes;
1353
- left_changes[var] = T;
1354
- auto left = replace<sp_tau_node<BAs...>>(args[1 ], left_changes)
1355
- | only_child_extractor<BAs...> | optional_value_extractor<sp_tau_node<BAs...>>;
1356
- std::map<sp_tau_node<BAs...>, sp_tau_node<BAs...>> right_changes;
1357
- right_changes[var] = F;
1358
- auto right = replace<sp_tau_node<BAs...>>(args[1 ], right_changes)
1359
- | only_child_extractor<BAs...> | optional_value_extractor<sp_tau_node<BAs...>>;
1353
+ auto [left, right] = get_quantifier_remove_constituents (tau_parser::wff_cb_arg, n);
1360
1354
return build_wff_or<BAs...>(left, right);
1361
1355
}
1362
1356
1363
1357
sp_tau_node<BAs...> apply_bf_remove_funiversal (const sp_tau_node<BAs...>& n) {
1364
- auto args = n || tau_parser::bf_cb_arg || only_child_extractor<BAs...>;
1365
- auto var = args[0 ];
1366
- auto T = args[2 ];
1367
- auto F = args[3 ];
1368
- std::map<sp_tau_node<BAs...>, sp_tau_node<BAs...>> left_changes;
1369
- left_changes[var] = T;
1370
- auto left = replace<sp_tau_node<BAs...>>(args[1 ], left_changes)
1371
- | only_child_extractor<BAs...> | optional_value_extractor<sp_tau_node<BAs...>>;
1372
- std::map<sp_tau_node<BAs...>, sp_tau_node<BAs...>> right_changes;
1373
- right_changes[var] = F;
1374
- auto right = replace<sp_tau_node<BAs...>>(args[1 ], right_changes)
1375
- | only_child_extractor<BAs...> | optional_value_extractor<sp_tau_node<BAs...>>;
1358
+ auto [left, right] = get_quantifier_remove_constituents (tau_parser::bf_cb_arg, n);
1376
1359
return build_bf_and<BAs...>(left, right);
1377
1360
}
1378
1361
1379
1362
sp_tau_node<BAs...> apply_bf_remove_fexistential (const sp_tau_node<BAs...>& n) {
1380
- auto args = n || tau_parser::bf_cb_arg || only_child_extractor<BAs...>;
1381
- auto var = args[0 ];
1382
- auto T = args[2 ];
1383
- auto F = args[3 ];
1384
- std::map<sp_tau_node<BAs...>, sp_tau_node<BAs...>> left_changes;
1385
- left_changes[var] = T;
1386
- auto left = replace<sp_tau_node<BAs...>>(args[1 ], left_changes)
1387
- | only_child_extractor<BAs...> | optional_value_extractor<sp_tau_node<BAs...>>;
1388
- std::map<sp_tau_node<BAs...>, sp_tau_node<BAs...>> right_changes;
1389
- right_changes[var] = F;
1390
- auto right = replace<sp_tau_node<BAs...>>(args[1 ], right_changes)
1391
- | only_child_extractor<BAs...> | optional_value_extractor<sp_tau_node<BAs...>>;
1363
+ auto [left, right] = get_quantifier_remove_constituents (tau_parser::bf_cb_arg, n);
1392
1364
return build_bf_or<BAs...>(left, right);
1393
1365
}
1394
1366
0 commit comments