Unverified Commit 18e54fbc authored by Merlin's avatar Merlin 💧
Browse files

Refactoring and Dest2 -> Dest3 for role

parent 4e809722
Pipeline #14771 waiting for manual action with stages
...@@ -573,28 +573,25 @@ let mkRule_Fusion sort bs focus sl : stateExpander = ...@@ -573,28 +573,25 @@ let mkRule_Fusion sort bs focus sl : stateExpander =
let oneStepSat_MultiModalK (u: bset list) sv = let oneStepSat_MultiModalK (u: bset list) sv =
let (sort, v) = sv in let (sort, v) = sv in
(*Filter for relations*) let boxes = bsetFilter v (fun lf -> (lfGetType sort lf) = AxF) in
let boxargsForRels = (*List of Tuples, where first arg is relation and second are all formulae under a box of that kind*) let diamonds = bsetFilter v (fun lf -> (lfGetType sort lf) = ExF) in
let boxes = (bsetFilter v (fun lf -> (lfGetType sort lf) = AxF)) in let boxargsByRel = (*Array of Tuples, where first arg is relation and second are all formulae under a box of that kind*)
let boxRels = Array.to_list (bsetMap (lfGetDest2 sort) boxes) in let boxRels = bsetMap (lfGetDest3 sort) boxes in
let getRelBoxargsTupleForOneRel rel = let boxargsForRel rel = bsetFilter boxes (fun r -> (lfGetDest3 sort r) = rel) in
rel, (bsetFilter boxes (fun r -> (lfGetDest2 sort r) = rel)) Array.map (fun rel -> (rel, boxargsForRel rel)) boxRels
in
let res = List.map getRelBoxargsTupleForOneRel boxRels in
res
in in
(*Make reduced U for each relation, thus List of tupels of relation and reduced U*) (*Make reduced U for each relation, thus List of tupels of relation and reduced U*)
let reducedU = List.map (fun (rel, boxargs) -> (rel, List.filter (fun bs -> bsetIsSubOrEqual boxargs bs) u)) boxargsForRels in let redU args = List.filter (fun bs -> bsetIsSubOrEqual args bs) u in
(*Make List of tupels of diamond formulae and their respective relation*) let reducedU = Array.map (fun (rel, boxargs) -> (rel, redU boxargs)) boxargsByRel in
let diamonds = bsetFilter v (fun lf -> (lfGetType sort lf) = ExF) in (*check if reducedU contains formula for every diamond per relation*)
let diaRels = Array.to_list (bsetMap (lfGetDest2 sort) diamonds) in let existsInU rel lf =
let diaargs = Array.to_list (bsetMap (lfGetDest1 sort) diamonds) in let cands = match List.assoc_opt rel (Array.to_list reducedU) with
let diaTuples = List.combine diaRels diaargs in | None -> u
(*check if redU contains formula for every diamond per relation*) | Some uc -> uc
let existsInU (rel, lf) = in
List.exists (fun bs -> bsetMem bs lf) (List.assoc rel reducedU) in List.exists (fun bs -> bsetMem bs lf) cands
let res = List.for_all existsInU diaTuples in in
res Array.for_all (fun lf -> existsInU (lfGetDest3 sort lf) (lfGetDest1 sort lf)) diamonds
let rec oneStepGMLRec counters sort v currentU = let rec oneStepGMLRec counters sort v currentU =
let isExceedingBox lf = let isExceedingBox lf =
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment