cong
Leibnitz Law
If two expressions are equal, then whatever is true
for one is true for the other.
replace
Difference: twice vs double
Beispiel n+1 verdoppeln
Twice:
(+ (add1 n) (add1 n))
Double:
(add1 (add1 (+ n n)))
Difference: twice vs double
Beweis für
(add1 (+ n-1 n-1)) equals
(+ n-1 (add1 n-1))
Beispiel n+1 verdoppeln
Twice:
(+ (add1 n) (add1 n))
Double:
(add1 (add1 (+ n n)))
Typ der Box:
Der Typ entspricht dem Typ:
von
Ist der Typ
Vergleich zu was wir wollen:
Erinnerung an add1+=+add1
replace kann add1 nach innen verschieben
Kapitel 10
Data constructor Typ constructor Typ constructor
Cons Pair Σ
Lambda -> Π
Ist das ein Typ?
Was sind Beispiel-Ausdrücke?
Ist das ein Typ?
Was sind Beispiel-Ausdrücke?
𝚺 − 𝐀𝐮𝐬𝐝𝐫𝐮𝐜𝐤
Teilmenge der Nats / Prädikate
• 𝚺 ((n Nat)) (Prim n)
Nicht Teilmenge der Nats
• 𝚺 ((n Nat)) (Vec n Atom)
𝑃𝑎𝑖𝑟 read as statement
(Pair A D) „A and D“
(Pair (= Nat 2 3) (= Atom ‘pie ‘pie)) „2 equals 3 and ‘pie equals ‘pie“
…. ….
Σ read as statement
Σ ((n Nat)) (Prim n) „There exists a natural n that is a prime.“
“There exists a list of atoms that is equal to itself reversed.”
… ….
Proofs for Σ
Expression Proof
(cons nil (same nil)) or
(cons (:: ‘anna (:: ‘bob
(:: ‘anna nil))) (same
(:: ‘anna (:: ‘bob
(:: ‘anna nil))))) ( Σ (( n Nat))
( Vec Atom (double n)))
(cons 2 (vec:: ‘tomate
(vec:: ‘käse vecnil)))