Type Theory
Marene Dimmendaal, Pleun Koldewijn
Type Theory Proof by reflection Marene Dimmendaal, Pleun Koldewijn - - PowerPoint PPT Presentation
Type Theory Proof by reflection Marene Dimmendaal, Pleun Koldewijn Overview - What is proof by reflection? - The two main classes: - Direct computation proofs - Algebraic computation proofs - Example Direct proof - Example
Marene Dimmendaal, Pleun Koldewijn
computation steps
Direct computation proofs Algebraic computation proofs
Proof of “C t”: Proof of ‘C t’:
predicate function
The reflection process relies on the following theorem:
Functions and
Proved by computing remainders Coq proof: A reasonably sized natural number is prime
In this case, C x is the mathematical statement for ‘x is prime’, i.e. there is no integer n (not equal to 1 or x) which divides x.
Only smaller number need to be checked: Existence of a divisor:
To check presence of divisors:
To check primality:
Isn’t it simpler with two arguments?
This is our f_correct!
TTTT
This proof takes a few minutes while the naïve procedure could not cope with a number this size.
For set A and a binary operation *, we have that Associativity law: ( x * y ) * z = x * ( y * z ) for all x y z in A
Easily use For With
x y z t u x y z t u
x y z t u x y z t u
Data Type A : Function f :
Data Type A : Function i :
x y z t u x y z t u
x y z t u x y z t u
For set A and a binary operation *, we have that Associativity law: ( x * y ) * z = x * ( y * z ) for all x y z in A
f x ( f ( f y z ) ( f t u ) ) represented as
f x ( f ( f y z ) ( f t x ) ) x y z t x x y z t x
Original : Generic :
f x ( f ( f y z ) ( f t x ) ) f x ( f ( f y z ) ( f t x ) ) cons x ( cons y ( cons z ( cons t ( cons x ) ) ) ) x y z t x x y z t x
f x ( f ( f y z ) ( f t x ) ) f x ( f ( f y z ) ( f t x ) ) cons x ( cons y ( cons z ( cons t ( cons x ) ) ) ) 1 2 3 1 2 3
f x ( f ( f y z ) ( f t x ) ) f x ( f ( f y z ) ( f t x ) ) cons x ( cons y ( cons z ( cons t ( cons x ) ) ) ) 1 2 3 1 2 3
f x ( f ( f y z ) ( f t x ) ) 1 2 3 1 2 3
f x ( f ( f y z ) ( f t x ) ) 1 2 3 1 2 3 1 2 3