You are on page 1of 13

Formal Systems

Examples

Silvia Takahashi

January 24, 2022


Formal System = Formal Language + Deductive Aparatus

https : //en.wikipedia.org /wiki/Formall anguage


Example

Start symbol SumE

I SumE → SumE+N

I SumE → N

I N→sN

I N→B

I B→0

I B → (SumE)
Equality Inference Rules

x +0
Idsum
x

s(x + y )
Defsum
s(x) + y

s n
SumNatsum
n+s 0

x +y
Conmsum
y +x

(x + y ) + z
assocSum1
x + (y + z)
Prove it is valiid to add a new rule: (assocSum2 )
x + (y + z)
(x + y ) + z

x + (y + z)
→ h Conmsum i
( y +z )+x
→ h Conmsum i
(z + y ) + x
→ h assocSum1 i
z +( y +x )
→ h Conmsum i
z + (x + y )
→ h Conmsum i
(x + y ) + z
Equivalences

Idsum x + 0 = x
Defsum s(x + y ) = s(x) + y
SumNatsum s n = n + s 0
Conmsum x + y = y + x
assocSum1 (x + y ) + z = x + (y + z)
Leibniz Rule: Replacing equals

x =y
E [x] = E [y ]
Theorems: Strings that represent even numbers

Axiom 0
n
Rules Plus two
s(s(n))

n
Add Two m
n+m
n
m
(n + s(0)) + (m + s(0))

Step Reason

1 n Given
2 m Given
3 n+m Add Two (1,2)
4 s(s(n + m)) Plus Two (3)
5 s(n + m) + s(0) SumNat (4)
6 ((n + m) + s(0)) + s(0) SumNat (5)
7 ((n + (m + s(0)) + s(0) Assoc (6)
8 ((m + s(0) + n) + s(0) Conm (7)
9 ((m + s(0)) + (n + s(0) Assoc (8)
10 ((n + s(0)) + (m + s(0)) Conm (9)
Logic Systems

Language Logic expressions


I Propositions and Predicates
I operators and quantifiers
Theorems True statements: How to know if something is true?
Axiom Even1 even(0)
even(x)
Rule even1
even(x + s s 0)
even(x)
Rule even2
odd(x + s 0)
odd(x + s 0)
Rule even3
even(x)
odd(x)
Rule even4
x = x̂ + s 0
even(x)
Rule even5 even(y )
even(x + y )
Prove it is valiid to add a new rule: (assocSum2 )
odd(x)
odd(y )
even(x + y )
Step Reason

1 odd(x) Given
2 odd(y ) Given
3 x = x̂ + s 0 even4 (1)
4 y = ŷ + s 0 even4 (2)
5 odd(x̂ + s 0) Leibniz (1,3)
6 odd(ŷ + s 0) Leibniz (2,4)
7 even(x̂) Rule even3 (5)
8 even(ŷ ) Rule even3 (6)
9 even(x̂ + ŷ ) Rule even5 (7,8)
10 even((x̂ + ŷ ) + s s 0) even1 (1)
11 even((x̂ + s 0) + (ŷ + s 0)) Lemma:
(A + B) + s s 0 =
(A + s 0) + (B + s 0)
12 even(x + y ) Leibniz (3,4,11)
(A + B)+ s s 0
= h SumNatsum i
A + (B + (s 0 + s 0))
= h assocSum2 i
A + ((B + s 0) + s 0))
= h Conmsum i
A + (s 0 + (B + s 0))
= h assocSum2 i
(A + s 0) + (B + s 0)

You might also like