Mathematical Proofs are logic statements written in english with some
symbols to validate a theorem, using definitions and axioms previously
declared. For example, the proof of the infinitude of primes.
Theorem 1The number of primes are infinite.
Proof: We begin by a list of primes \[N = p_1p_2p_3...p_{n}\].
The number N is the product of all primes up to n. Being so, P = N + 1 is
not divisible by any of the primes. It means that, if P is composite,
P is divisible by some x the list N, but the result is 1, therefore P is not
composite, and the number P is a prime number. We can continue appending
the list N with more primes, and by repeating the process there is always
a new prime number outside the list. Proving that the prime numbers are
infinite. The algorithm stops when the assumption of P being composite is
false, therefore the opposite is true.
The beauty of this proof is that it is a machine to generate prime numbers.
This machine never stops generating primes not on the initial list.
The proof was done by using the reductio ad absurdum or a proof by
contradiction, assuming that P is not prime.
An application of the induction are in loop invariants. Consider the
following factorial code with a loop.
func factorial(var n int) {
var res int = 1
var i int = 1
while i <= n{
res = res * i
i = i + 1
}
return res
}
The loop invariant is calculated by making sure the value o res is
correct in every loop cycle.
We prove the base case n = 0: i = 1 res = 1 implies 1*1
Then for n = 1: 1*(1+1) = 2
assume that for n \[\sum_{i = 1}^{n} (i)*(i+1)\] is true.
Proceeding with the summation, for n-1, \[\sum_{i = 1}^{n-1} (n-1)*(n-1+1)\]
\[(n-1)*(n-1+1) = (n-1)(n) = n!\]
Well Ordering PrinciplePhilosophy is the mother of science, and logic is a daughter of philosophy. Good reasoning is what is required for algorithms to work precisely. We call that an effective process, as A. Turing defined it. A list of statements like a mathematical proof to solve a certain problem in a finite number of steps, each step clearly defined. Introduction to Logic |
|
Elements of ProgrammingWe attempt to describe some elements that are philosophically relevant to the computer science. We have abstract entities and concrete entities. The former are unchanged over time, while the latter comes and goes out of existence. These entities have species and genus, that is, they have specific properties that are common to a set of entities. In object oriented languages, the genus is the class, while species is an instanciation of that class. Functions are associations of abstract or concrete entities containing arguments and after some transformation leads to a result. In a computer, a value is a datum, that is, zeroes and ones 0100100101, mapped to an entity name. The value int x := 0100_1001_0010b creates a value type. The 0100_1001_0010b is the representation of x, while x is the interpretation of 0100_1001_0010b. Sometimes we have identity defined as the representational identity, for example, if two files have the same binary data, they are just equal to each other even if one file is an image and the other is text. |
|
3. Calculator |