3 - Closure

ucla | CS 181 | 2024-04-05 14:20


Table of Contents

Basic Notions

  • Regular Language - a language for which there exists a DFA/NFA that recognizes it
  • Regular languages remain regular under regular operations, the definition is bidirectional.

    Regular Operations

    Fundamental Ops

  • Complement L=L1
    • F1F1 for DFAs
    • We need to inspect state transitions for NFAs to ensure the complement is regular.
  • Union L=L1L2
    • Combine using ε transitions
    • Combine M1 and M2 s.t. their union model M is defined by the cartesian products of M1 and M2 definitions
      • Q=Q1×Q2
      • δ((q,r),a)=(δ1(q,a),δ2(r,a))
      • $F’=\bigg{(q,r)\space\space q\in F_1\lor r\in F_2\bigg}=(F_1\times Q_2)\cup(Q_1\times F_2)$
  • Intersection L=L1L2
    • DeMorgan’s => L=L1L2
    • We showed complement is regular, and the union is regular; thus, the intersection is regular bc the complement is regular
      • Q=Q1×Q2
      • δ((q,r),a)=(δ1(q,a),δ2(r,a))
      • $F’=\bigg{(q,r)\space\space q\in F_1\land r\in F_2\bigg}=F_1\times F_2$
  • Concatenation L=l1;l2 | l1L1,l2L2

    Functional Ops

  • Add $L={x\sigma y\space\space \sigma\in\Sigma,xy\in L}$
    • sps DFA D accepts xy
    • make 2 copies: D1,D2, and for some state q that transitions on σ
    • Now, make the state q in D1 have a transition on σ to the same state q in D2
    • but adjust D1 so that all states are rejecting and do NOT include a start transition in D2
  • Skip $L={xy\space\space x\sigma y\in L,\sigma\in\Sigma}$
    • Similar to add, sps D1,D2 are the same DFA but 2 copies that both accept xy
    • D1 has the start transition but is all rejecting and D2 has no start transition
    • now, from some state qD1 draw εtransitions for each symbol in the alphabet to the same state qD2 but unique copies for each symbol
    • i.e., qD1 will have 2 εtransitions for the binary alphabet to 2 copies of qD2

      Corollaries

      If L1,L2,,Ln are regular, then the language described by any regular operations on any number of them is also regular e.g. L=L1L2L3Ln e.g.L=L1L2Ln

Every finite language is regular Pf:

  • sps. L is finite then, wLw is regular by the corollary above WLOG