<jupyter_start><jupyter_text>Simplifying and Isolating Failure-Inducing Input<NAME>, <NAME> This demonstrates how the 2002 paper ["Simplifying and Isolating Failure-Inducing Input"](https://dl.acm.org/citation.cfm?id=506206) could look like if it had been written as a notebook.  Its main purpose is to be "imported" into the essay ["Software Papers as Software Modules"](papers-as-modules.ipynb). The key idea of the above paper is to determine a minimal set of circumstances that causes a program to fail (simplifying) or to determine a minimal difference between a passing set and a failing set (isolating).  Here's the core algorithm for simplification, applied on an input string and taking a _test_ function that checks whether the input fails (returning `"FAIL"`) or passes (returning `"PASS"`).<jupyter_code>def ddmin(s, test):
    assert test("") == "PASS"
    assert test(s) == "FAIL"

    n = 2     # Initial granularity
    while len(s) >= 2:
        start = 0
        subset_length = int(len(s) / n)
        some_complement_is_failing = False

        while start < len(s):
            complement = s[:start] + s[start + subset_length:]

            if test(complement) == "FAIL":
                s = complement
                n = max(n - 1, 2)
                some_complement_is_failing = True
                break
                
            start += subset_length

        if not some_complement_is_failing:
            if n == len(s):
                break
            n = min(n * 2, len(s))

    return s<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09003215434083602, 'fraction_numerical': 0.010289389067524116, 'mean_word_length': 2.6102088167053363, 'pattern_counts': {'":': 1, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 1, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '574374', 'license': 'MIT', 'n_tokens_mistral': 472, 'n_tokens_neox': 435, 'n_words': 164, 'path': 'Zeller2002.ipynb', 'repo_name': 'andreas-zeller/papers-as-modules', 'size': '1573'}