<jupyter_start><jupyter_text>An Example Attack On Plant Inputs<jupyter_code>import pywrapfst as fst
syms = fst.SymbolTable()
syms.add_symbol('e')  # Epsilon (empty character)
syms.add_symbol('i1')
syms.add_symbol('i2')<jupyter_output><empty_output><jupyter_text>Plant $\mathcal{P}$<jupyter_code>P = fst.Fst()
P.add_state()
P.set_start(0).set_final(0)
P.add_arc(0,fst.Arc(1,1,0,0)).add_arc(0,fst.Arc(2,2,0,0))
P.set_input_symbols(syms).set_output_symbols(syms).arcsort()<jupyter_output><empty_output><jupyter_text>Model of the Desired Language $K$<jupyter_code>MK = fst.Fst()
MK.add_state()
MK.set_start(0).set_final(0)
MK.set_final(MK.add_state())
MK.add_arc(0,fst.Arc(1,1,0,1)).add_arc(0,fst.Arc(2,2,0,1))
MK.set_final(MK.add_state())
MK.add_arc(1,fst.Arc(1,0,0,2)).add_arc(1,fst.Arc(2,2,0,2))
MK.add_arc(2,fst.Arc(1,0,0,2)).add_arc(2,fst.Arc(2,0,0,2))
MK.set_input_symbols(syms).set_output_symbols(syms).arcsort()<jupyter_output><empty_output><jupyter_text>Input Attacker $\mathcal{A}_{I}$<jupyter_code>AI = fst.Fst()
AI.add_state()
AI.set_start(0).set_final(0)
AI.set_final(AI.add_state())
AI.add_arc(0,fst.Arc(1,1,0,1)).add_arc(0,fst.Arc(1,2,0,1))
AI.add_arc(1,fst.Arc(1,1,0,1)).add_arc(1,fst.Arc(2,2,0,1))
AI.set_input_symbols(syms).set_output_symbols(syms).arcsort()<jupyter_output><empty_output><jupyter_text>Supervisor $\mathcal{S}$$$\mathcal{S} = \mathcal{M}_K \circ \mathcal{A}^{-1}_I$$<jupyter_code>S = fst.compose(MK,AI.copy().invert())
S.arcsort()<jupyter_output><empty_output><jupyter_text>Output Language $L_O(\mathcal{S} \circ \mathcal{A}_I)$<jupyter_code>LO = fst.compose(S,AI).project(project_output=True)
LO = fst.epsnormalize(LO).minimize()
LO.arcsort()<jupyter_output><empty_output><jupyter_text>Controllability $L_O(\mathcal{S} \circ \mathcal{A}_I) \stackrel{?}{=} K$<jupyter_code>K = fst.epsnormalize(MK.copy().project(project_output=True)).minimize().arcsort()
fst.equivalent(LO,K)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.20930232558139536, 'fraction_numerical': 0.03565891472868217, 'mean_word_length': 10.877300613496933, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '23190', 'license': 'Apache-2.0', 'n_tokens_mistral': 948, 'n_tokens_neox': 921, 'n_words': 67, 'path': 'examples/.ipynb_checkpoints/Attacks On Plant Inputs I-checkpoint.ipynb', 'repo_name': 'alperkamil/arsc', 'size': '1935'}