PLC Flashcards

1
Q

Alphabet Notation

A

Σ denotes a generic alphabet.
a,b,c,d stand for the letters.
Empty string is ϵ.
Set of all strings over Σ is Σ*, this always includes the empty string.
For the strings x and y, xy is the result of concatenating them, can be done exponentially too.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Arity of a symbol?

A

How many arguments it takes.

Arity 0 is nullary
Arity 1 is unary
Arity 2 is binary

if a set of symbols is given alongside their arities, they are said to be ranked.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Parts of a concrete syntax?

A

A set of production rules (a.k.a productions, or rules). Each with a head (LHS) and tail (RHS).

Each head consists of a single non-terminal symbol. A rule with a head X is called an X-rule.

The RHS consists of a combination of non-terminal and terminal symbols.

One of the non-terminal symbols is designated as the starting symbol.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Regex Syntax

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Syntax of Semantic Rules?

A

The hypotheses/premises are placed on top of the line, with the conclusion underneath. The side condition is placed to the right hand side.

If the premises are valid, and the conditions are true, then you can deduce the conclusion is valid.

An instantiation of a rule is when the variables are replaced with specific instances of the correct type.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the 5 components of a finite automata?

A
  • A collection of states Q
  • A finite alphabet Sigma
  • A transition function sigma of type Q X Sigma -> Q
  • An initial state q0 which is an element of Q
  • A collection of accepting states F which is a subset of Q
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the language of a finite automata?

A

L(M) = The set of all strings accepted by M

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the shared trait between Regular Expressions and Finite Automata?

A

Both express the same set of languages (regular languages)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Pumping Lemma Definition

A

For any regular language:

There is a natural number p such that for any word of length at least p, the word can be split into three parts u,v,w such that:

  • v is not empty
  • |uv| <= p
  • for any integer i u(v^i)w is in the language
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the state of an arithmetic expression?

A

A mapping of variable values to values in Z.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do you denote a state function?

A

[x->v]sigma maps x to v in the state sigma.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

If the variable x is not defined in the state sigma, what is sigma(x)?

A

0, by convention

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is A⁻ & A

A

The set of simple (no variables) arithmetic expressions in While, the set of all arithmetic expressions in While

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is ℬ and B.

A

ℬ is the set of boolean expressions. B is a variable that represents a specific boolean expression.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is 𝒮 and S.

A

𝒮 is the set of statements. S represents a specific statement.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the formal definition of Safety?

A

Finding a subset of all possible States where each state in the subset evaluates to another state when passed to a program.

17
Q

Difference between partial and total correctness?

A

Partial Correctness - All executions that terminate are correct
Total Correctness - All executions terminate and are correct

18
Q

What is a postcondition?

A

A condition that holds at the end of execution

19
Q

What is a partial function?

A

A function that might not have an output for every input. Denoted with ⇀ e.g. f : ℕ ⇀ ℕ.

The function computed by a while program must be partial because while programs may infinitely loop on some inputs.

20
Q

What is a computable function?

A

A function F is computable if there is a while program that computes F with respect to the variable x. “with respect to” is often abbreviated to “wrt.”

21
Q

What is the characteristic function of a predicate U?

A

A function XU(n) that returns 1 if n is in U, and 0 if it is not.

22
Q

What makes a predicate decidable?

A

A predicate U ⊆ ℕ is decidable just if its characteristic function is computable, if it not computable then the predicate is undecidable.

The while program that computes the characteristic function is called a decision procedure

23
Q

What is a semi-characteristic function of a predicate U?

A

A function ξU(n) that returns 1 if n is in U, and is undefined if it is not.

The idea is that semi-characteristic functions are easier to compute since the program does not need to terminate on ns that aren’t in U.

A predicate is semi-decidable just if its semi-characteristic function is computable.

24
Q

Injections, Surjections, and Bijections

A

Injective functions are 1-1 mappings. If f(a1) == f(a2) then a1==a2.
f : A ↣ B

Surjective functions are functions where every element in the output set has a corresponding element in the input set.
f : A ↠ B

A function is a bijection if it is both Injective and Surjective.

25
Q

What makes a function an isomorphism?

A

A function f : A → B is an isomorphism just if it has an inverse.

A function is a bijection if and only if it is an isomorphism.

26
Q

How do we encode a set of data as natural numbers?

A

Create a bijection between them. We usually end up using a pairing function (a function that maps NxN -> N) as the base of this bijection.

27
Q

What is a reflection of a function?

A

The function f: A ⇀ A has a reflection f̃: ℕ ⇀ ℕ which converts the input from ℕ to A, runs it through f and then converts that output to ℕ. It uses a provided bijection/encoding to do so: i : A ⇀ ℕ

This can also be done with functions with a different domain and codomain by using a different bijection for the domain and codomain.

28
Q

What is a Gödel numbering?

A

An encoding of a system within itself. They can be used to represent While programs as natural numbers, allowing us to write While programs that handle other While programs.

29
Q

What is the universal function?

A

A function that can produce the behaviour of every computable function.

U : Stmt × ℕ ⇀ ℕ
U(P, n) = ⟦ P ⟧(n)

That is it outputs the result of running the program P with the input n. U is partial because the computable functions themselves are partial.

The existence of this function allows for the writing of an interpreter, in the form of a program which reads in each statement in the program, simulates it, and continues to the next line.

30
Q

What is the Church-Turing thesis?

A

Any two models of computation are equivalent with respect to the computability of functions ℕ ⇀ ℕ.

This means an interpreter can be written in any model of computation for any other model of computation.

31
Q

What is the set of Partial Recursive functions?

A

The set of partial functions on ℕ that are considered computable by any realistic model of computation.

32
Q

What does e = ⌜ S ⌝ mean?

A

e is the encoding of the statement S under a Gödel numbering

33
Q

What is a many-to-one reduction?

A

Let U,V be predicates in ℕ. Let f : ℕ → ℕ. The function f is a many-to-one reduction from U to V just if:

  • it is computable, and
  • n ∈ U ⟺ f(n) ∈ V

We may sometimes write f : U ≲ V to mean f is a reduction from U to V

If U reduces to V and V is decidable, then so is U. Contrapositively: if U is undecidable, so is V.

34
Q

What do the up arrows and down arrows mean in reference to a program?

A

The up arrow means that a program never terminates, a down arrow means it terminates.

35
Q

What is Rice’s Theorem?

A

For any subset of PR (all computable functions), that isn’t trivial (all/no functions), the reflected set is undecidable. That is to say if we have a subset of PR (e.g functions that return a zero) asking if a function is part of that set is not necessarily possible. We may not be able to tell, or we might get the answer wrong.

36
Q

Sum of integers 0 through n inclusive?

A

(n/2) (n+1)

37
Q

DFA vs NFA

A

An NFA (non-deterministic finite automata) can have multiple transitions from the same state for the same character. Usually used to represent systems with multiple workers computing at the same time.