Documentation

Linglib.Core.Computability.NonContextFree.AnBnCnDn

{aⁿbⁿcⁿdⁿ}: a four-symbol non-context-free witness language #

The single-parameter four-symbol witness anbncndn = {aⁿbⁿcⁿdⁿ | n ≥ 0}, proven non-context-free via the CFL pumping lemma + the unified adjacency lemma in BlockWitness.

Membership requires na = nb = nc = nd (all four counts equal) and the sorted shape aⁿbⁿcⁿdⁿ. Pumping breaks at least one count equality.

This file also hosts the shared FourSymbol substrate consumed by the two-parameter relaxation in NonContextFree.AmBnCmDn:

Closure properties for IsContextFree (homomorphism, regular intersection) live in Linglib.Core.Computability.ContextFreeGrammar.Closure.

inductive FourSymbol :

Alphabet for cross-serial dependency patterns.

Instances For
    @[implicit_reducible]
    Equations
    def instReprFourSymbol.repr :
    FourSymbolStd.Format
    Equations
    Instances For
      @[implicit_reducible]
      Equations
      @[reducible, inline]
      Equations
      Instances For

        The language {aⁿbⁿcⁿdⁿ | n ≥ 0}, modeling Dutch cross-serial dependencies.

        Equations
        Instances For

          Generate aⁿbⁿcⁿdⁿ.

          Equations
          Instances For
            def anbncndn :
            Language FourSymbol

            The language {aⁿbⁿcⁿdⁿ | n ≥ 0} as a mathlib Language.

            Equations
            Instances For
              theorem filter_count (n : ) (s : FourSymbol) :
              (List.filter (fun (x : FourSymbol) => x == s) (makeString_anbncndn n)).length = n

              Each symbol's filter count in makeString_anbncndn n equals n. Shared with AmBnCmDn (which pumps over the same diagonal witness).

              The four-symbol witness is structurally BlockWitness [a, b, c, d] n.

              theorem not_a_and_d_in_vxy (p : ) (u vxy z : FourString) (hw : makeString_anbncndn p = u ++ vxy ++ z) (hvxy : List.length vxy p) :
              ¬(FourSymbol.a vxy FourSymbol.d vxy)
              theorem not_a_and_c_in_vxy (p : ) (u vxy z : FourString) (hw : makeString_anbncndn p = u ++ vxy ++ z) (hvxy : List.length vxy p) :
              ¬(FourSymbol.a vxy FourSymbol.c vxy)
              theorem not_b_and_d_in_vxy (p : ) (u vxy z : FourString) (hw : makeString_anbncndn p = u ++ vxy ++ z) (hvxy : List.length vxy p) :
              ¬(FourSymbol.b vxy FourSymbol.d vxy)
              theorem filter_eq_nil_of_not_mem (l : FourString) (s : FourSymbol) (h : sl) :
              List.filter (fun (x : FourSymbol) => x == s) l = []
              theorem fourSymbol_filter_total (l : FourString) :
              (List.filter (fun (x : FourSymbol) => x == FourSymbol.a) l).length + (List.filter (fun (x : FourSymbol) => x == FourSymbol.b) l).length + (List.filter (fun (x : FourSymbol) => x == FourSymbol.c) l).length + (List.filter (fun (x : FourSymbol) => x == FourSymbol.d) l).length = List.length l

              makeString_anbncndn n is always in {aⁿbⁿcⁿdⁿ}.

              theorem mem_anbncndn_iff (w : FourString) :
              w anbncndn ∃ (n : ), w = makeString_anbncndn n

              Membership characterization: every string in anbncndn is makeString_anbncndn n for some n. The converse to makeString_in_language.

              theorem pump_breaks_anbncndn (p : ) (_hp : p > 0) :
              have w := makeString_anbncndn p; ∀ (u v x y z : FourString), w = u ++ v ++ x ++ y ++ zList.length (v ++ x ++ y) pList.length v + List.length y 1∃ (i : ), u ++ (List.replicate i v).flatten ++ x ++ (List.replicate i y).flatten ++ zanbncndn

              Pumping breaks membership in {aⁿbⁿcⁿdⁿ}.

              {aⁿbⁿcⁿdⁿ} does NOT have the CFL pumping property.

              theorem anbncndn_not_contextFree :
              ¬anbncndn.IsContextFree

              {aⁿbⁿcⁿdⁿ} is not context-free.