2020 James B. Wilson
Colorado State University
Minimal requirements to define abstract algebra as the substitution of values, operations, and equations in equational formulas.
1. Understand ways to limit substitution to contexts.
2. Define Types of data:
Suppose x↦2x, then [x:=2](x↦2x)⊳22
(Said in short hand 2↦22.)
That cannot be what we mean normally; rather, when x:=2 we expect this means 2x:=2×x.
Suppose x↦2x, then substituting :-\ for x yields
2:-\
Here it really is the correct use, because this substitution is trying to make a silly emoji into a silly emoji with awesome hair.
The type of data guides substitution.
x a natural number? then 2x is multiplication.
x a string of letters? then 2x is a new string beginning with the character 2.
all data x has a (data) type X to go with it, we annotate x with this type,
Notation. write x∈X (usually for sets X) and x:X (for all other data, but also to include sets).
We are documenting how we plan to use x.
5∈N or 5:N or uint 5, or 5:Nat,....
−5∈Z or −5:Z. Notice −5∈/N, so N is a different type of data then Z
*For technical reasons we don't use ∈ but rather `:` for large things like this, see below.
Hence G:Group instead of set-notation G∈Group.
Given types X and Y can form a new type of data called functions denoted
X→Y
x↦x2 can be treated as a function of type R→[0,∞). I.e. here X=R and Y=[0,∞).
G↦∣G∣ the function that computes the order of a finite group, has type Group→N
These are functions in our sense of substitutions but these are not between sets so they are not functions in that they are not defined by points (input,output).
ConclusionPremises
PP⇒QQ
¬PP∨QQ
P⊢QP⇒Q
⊢ (turnstile) "assertion",i.e. ⊢Q reads as "assert Q is true"
P⊢Q reads "Assume P, assert Q"
Given a function f of type X→Y and x of type X, then there is a term f(x) of type Y.
f(x):Yx:Xf:X→Y(E→)
For sets X and Y and set-functions f:X→Y, f really means:
Theorem (Church). Every Set-function f:X→Y is a type-function of type X→Y.
Proof. Given x∈X (same as x:X for sets), and define f(x) as the unique y∈Y where (x,y)∈f. Hence, this model of a function up holds the rule
f(x):Yx:Xf:X→Y(E→).
□
Prop. If f:X→Y and g:Y→Z then x:X⇒g(f(x)):Z.
Proof. x:Xf:X→Yf(x):Yg:Y→Zg(f(x)):Z
□
Prop. If f:X→Y and g:Y→Z then
x:X⇒g(f(x)):Z.
Proof. Given x of type X and f of type X→Y, then by the elimination rule of → we know f(x) has type Y. Furthermore, g has type Y→Z so by eliminating → again we have that g(f(x)) has type Z. □
Same proof written in words...
Given a formula M, with the property that x:X implies [t:=x](t↦M):Y, then there is a function f:X→Y, i.e.
fM:X→Yx:X⊢(M[t:=x]):Y(I→)
E.g. Set M=t/2. Then
fM:N→Qn∈N⊢(M[t:=n])∈Q(I→)
fM:X→Yx:X⊢(M[t:=x]):Y(I→)
E.g. For sets this is nothing new, e.g. take M=t/2. Then
fM:N→Qn∈N⊢(M[t:=n])∈Q(I→)
I.e. t↦t/2 can become a function f:N→Q, because n/2 is always rational.
But cannot have type N→N because for example n=1 will produce 1/2 which is not of type N.
Note that we use ∈ here because we have sets.
fM:X→Yx:X⊢(M[t:=x]):Y(I→)
E.g. For general data just use types, e.g. take M≡∣t∣. Then
fM:Group→N∪{∞}G:Group⊢∣G∣:N∪{∞}(I→)
fM:X→Yx:X⊢(M[t:=x]):Y(I→)
The same M can be a typed function many different ways:
E.g.1 M=x×y
fM:N→(N→N)m,n∈N⊢m×n∈N(I→)
E.g.2 M=x×y
fM:Group→(Group→Group)G:Group,H:Group⊢G×H:Group(I→)
Prop. If f:X→Y and g:Y→Z then x:X⇒g(f(x)):Z.
Corollary: There is a composition
g∘f:X→Zf:X→Y,g:Y→Z,x:X⊢g(f(x)):Z(I→)
Introductions are how you construct new data (in programming we call these "constructors")
I.e we form old data f,g, we made new data g∘f, provided that data obey some rules.
Consider x↦x+2.
First introduce(construct) a typed function
fx+2:N→Nn:N⊢(n+2)∈N(I→)
We can therefore eliminate fx+2
fx+2(n):Nn:Nfx+2:N→N(E→)
But what makes fx+2(5)=5+2? No connection yet.
fM(x)=M[t:=x]x:X⊢M[t:=x]:Y(C→).
*One very small concern, notice the conclusion (bottom) is not data, nor a type, i.e. it is not written like a:A.
To fix lets call x=y a type, the type of evidence of a claim (i.e. the type of proof we have).
The data of this type is the proof, e.g. The reflexive axiom is the proof that x=x so write refl:x=x
refl:fM(x)=M[t:=x]x:X⊢M[t:=x]:Y(C→).
Using "proofs as data" and "propositions as types" will take several more examples to master.