I'm a beginner in Prolog, and still struggling with the syntax. The goal I want to achieve is fairly simple: I would like to compare a string, which is passed from the first piece of code shown below and is argument input for the second piece of code, and carry out some action depending on the value of the string.
First piece of code:
run(ModelId, CaseId) :-
% load the model
model:load_model(ModelId, Model),
Model = model(_Policy, Platform, _Configuration),
% assurance case specification
AC = [ 'system_properties'-['CryptoControllerSystem.imp', 'sensitive traffic flowing from the red to the black network is encrypted', 'RedNetwork.imp', 'all sensitive traffic is encrypted', 'Splitter.imp', 'correctly splits frames into header and payload', 'Crypto.imp', 'ensures all sensitive traffic is encrypted correctly and with strong cryptographic algorithms', 'Bypass.imp', 'ensures only valid protocol header information passes from red to black', 'Merger.imp', 're-assembles frames from header and payload'] ],
% instantiate
instantiate:instantiate_pattern_list(AC, CaseId),
% export html
export:ac_export(CaseId, 'txt').
Second piece of code:
ac_pattern('system_properties',
[arg('CS', system_properties:systemcomp), arg('P', system_properties:policy), arg('CR', system_properties:redcomp), arg('LR', system_properties:localpolicyred), arg('CS2', system_properties:splittercomp), arg('LS', system_properties:localpolicysplitter), arg('CC', system_properties:cryptocomp), arg('LC', system_properties:localpolicycrypto), arg('CB', system_properties:bypasscomp), arg('LB', system_properties:localpolicybypass), arg('CM', system_properties:mergercomp), arg('LM', system_properties:localpolicymerger)],
goal(g, '{CS} ensures that {P}', [],
[ ac_pattern_ref( 'red_network', ['P', 'CR', 'LR', 'CS2', 'LS', 'CC', 'LC', 'CB', 'LB', 'CM', 'LM'])
])).
ac_pattern('red_network',
[ arg('P', system_properties:policy), arg('CR', system_properties:redcomp), arg('LR', system_properties:localpolicyred), arg('CS2', system_properties:splittercomp), arg('LS', system_properties:localpolicysplitter), arg('CC', system_properties:cryptocomp), arg('LC', system_properties:localpolicycrypto), arg('CB', system_properties:bypasscomp), arg('LB', system_properties:localpolicybypass), arg('CM', system_properties:mergercomp), arg('LM', system_properties:localpolicymerger)],
goal(g, 'The {CR} enforces its local policy: {LR}', [],
[
goal(g, 'All components ensure their local policy', [],
[
ac_pattern_ref( 'splitter_component', ['CS2', 'LS']),
ac_pattern_ref( 'bypass_component', ['CB', 'LB']),
ac_pattern_ref( 'merger_component', ['CM', 'LM']),
( 'CC' = 'Crypto.imp' ->
ac_pattern_ref( 'crypto_component', ['CC', 'LC'])
; 'CC' = 'Crypto2.imp' ->
ac_pattern_ref( 'crypto_component2', ['CC', 'LC'])
)
]),
goal(g, '{LR} is ensured by complying to cryptographic standards', [],
[strategy('for every standard',
iterate('S', system_properties:standard, list(['Encryption standards (AES, RSA)', 'Hash standards (MD5, SHA, HMAC)', 'Wireless Standards (WEP, WPA2)'])), [],
[ goal(g, '{LR} in accordance with standard {S}', [],
[evidence(axiom, '{LR} conforms to {S}', [])])
])
])
])).
Everything is working fine until this part of the code:
( 'CC' = 'Crypto.imp' ->
ac_pattern_ref( 'crypto_component', ['CC', 'LC'])
; 'CC' = 'Crypto2.imp' ->
ac_pattern_ref( 'crypto_component2', ['CC', 'LC'])
)
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire