RU beehive logo promo banner for Computing & Info Sciences
CS 420
2024fall
ibarland

Definitions
sets; FSMs

Previously, on itec420…

Sets and set-notation; functions and relations (1-1, onto); cardinalities

Logic notation

- logic notation: translate engl. <-> logic:
  -    ∃m∈ℕ.n+m=0        "n has an additive-inverse in ℕ"  [note: n is a free var.]
                          This formula is true if n happens to be 0 or -5, but false if n=17

  -    ∀n∈ℕ.∃m∈ℕ.n+m=0   "every number in ℕ has an additive inverse in ℕ" [note: NO free var]
                         False.

  - if we replace the previous with "m∈ℤ", it becomes true.

  -    "n/2 is an integer"   (a.k.a. "n is even")
          n/2 ∈ ℤ
       Now, write it w/o referring to division (but mult. okay)
            {{{  thinking:  n = 2*(some integer).  NOW we can logic-ize it!:  }}}
        ∃k∈ℤ. n=2*k

       Thus we could define the set of even numbers as
            2ℤ = { n | ∃k∈ℤ. n=2*k }


  -   ∃k∈N. n=5k      in english is:   "n is divisible by 5"

  - "The set ℤ is closed under squaring" (which is true, btw)
       ∀z∈ℤ. (z²∈ℤ)


  - a natnum n is composite ("non-prime",nearly):
          (n∈ℕ) ∧ (∃k∈ℕ .∃m∈ℕ. n=m*k ^ n>1 ^ m>1)
          (n∈ℕ) ∧ (∃k,m∈ℕ. n=m*k,  n,m>1)


  - "every prime# is odd"  (which, btw, is false);
     use an `->` to capture  "for all primes" rather than "for all integers":
       forall n, prime(n) -> n is odd
       ∀n. prime(n) → ∃k.n=2k+1
       ∀n. prime(n) → ∀k.n≠2k

    where prime(n) is shorthand for:  ((n∈ℕ) ∧ ¬(∃k∈ℕ .∃m∈ℕ. n=m*k ^ n>1 ^ m>1)  ∧ n≠1)

    How can we further modify this, to make it true over N?




  - if n a mult. of 5, then n ends in '0' or '5'  (use function 'lastDigitOfNumeral_10')

  - f is an inverse of g
    (Actually, note: we have "left-inverse" and "right-inverse".  Sometimes g is both of those; sometimes not.)

  - relation R  A×B        is a function
        recall: a relation is just a set of pairs: e.g.
          { (16,4), (9, 3), (256,16), (16,-4), … }
    a relation is a *function* iff:   ("there is only one output for a given input")
          ∀ a∈A:   ∀b,c. (a,b)∈R ^ (a,c)∈R → b=c.
                ∧  ∃z.(a,z)∈R

  - every 'a' is followed by a 'b'; use "charAt"
  - string w has string p as a prefix





  - book 4.3 (p.35+15=50):  for a language L over an alphabet Σ

       From book: given a language L over Σ:
       chop(L)={w: ∃x∈L (x=x₁cx₂ ∧ x₁∈Σ* ∧ x₂∈Σ* ∧ c∈Σ ∧ |x₁|=|x₂| ∧ w=x₁x₂) }
        wtf??  Let's work it out!

       firstchars(L) = (see book for def'n, and we'll work through it)

    Next:
- Writing FSMs (Chpt.05)
   - Example 5.2
   - Example 5.3, every "a" region in w is even-length:
   - Task: odd-parity (soln: Example 5.4)



  Now back to formalizing:

  Def'n: FSA (as tuple), p.42+15
     - define configuration
     - define acceptance

logo for creative commons by-attribution license
This page licensed CC-BY 4.0 Ian Barland
Page last generated
Please mail any suggestions
(incl. typos, broken links)
to ibarlandradford.edu
Rendered by Racket.