A mathematical proof is any mathematical argument which demonstrates the truth of a mathematical statement. Informal proofs are typically rendered in natural language and are held true by consensus; formal proofs are typically rendered symbolically and can be checked mechanically. "Proofs" can be valid or invalid; only the former kind constitutes actual proof, whereas the latter kind usually refers to a flawed attempt at proof.
Questions tagged [proof]
828 questions
12
votes
2 answers
Logic Proof of Associative Property for XOR
I came across a common programming interview problem: given a list of unsigned integers, find the one integer which occurs an odd number of times in the list. For example, if given the list:
{2,3,5,2,5,5,3}
the solution would be the integer 5 since…

Vilhelm Gray
- 11,516
- 10
- 61
- 114
10
votes
2 answers
Proof by Induction of Pseudo Code
I don't really understand how one uses proof by induction on psuedocode. It doesn't seem to work the same way as using it on mathematical equations.
I'm trying to count the number of integers that are divisible by k in an array.
Algorithm:…

John Smith
- 635
- 1
- 10
- 19
10
votes
1 answer
Prove map id = id in idris?
I'm just starting playing with idris and theorem proving in general. I can follow most of the examples of proofs of basic facts on the internet, so I wanted to try something arbitrary by my own. So, I want to write a proof term for the following…

comco
- 573
- 4
- 13
10
votes
11 answers
Formally verifying the correctness of an algorithm
First of all, is this only possible on algorithms which have no side effects?
Secondly, where could I learn about this process, any good books, articles, etc?

joemoe
- 5,734
- 10
- 43
- 60
10
votes
2 answers
Idiomatic Proof by Contradiction in Isabelle?
So far I wrote proofs by contradiction in the following style in Isabelle (using a pattern by Jeremy Siek):
lemma ""
proof -
{
assume "¬ "
then have False sorry
}
then show ?thesis by blast
qed
Is there a way…

Christoph Lange
- 595
- 2
- 13
10
votes
3 answers
How to make the assumption of the second case of an Isabelle/Isar proof by cases explicit right in place?
I have an Isabelle proof structured as follows:
proof (cases "n = 0")
case True
(* lots of stuff here *)
show ?thesis sorry
next
case False
(* lots of stuff here too *)
show ?thesis sorry
qed
The first case is actually several pages…

Christoph Lange
- 595
- 2
- 13
9
votes
3 answers
Would the ability to declare Lisp functions 'pure' be beneficial?
I have been reading a lot about Haskell lately, and the benefits that it derives from being a purely functional language. (I'm not interested in discussing monads for Lisp) It makes sense to me to (at least logically) isolate functions with…

Keith Layne
- 3,688
- 1
- 24
- 28
9
votes
1 answer
Generalizing fold such that it becomes expressive enough to define any finite recursion?
So, there is something known as a "universal property of fold", stating exactly following:
g [] = i; g (x:xs) = f x (g xs) <=> g = fold f i
However, as you probably now, there are rare cases like dropWhile, which can not be redefined as fold f i…

Zazaeil
- 3,900
- 2
- 14
- 31
9
votes
0 answers
Which First Order theorem provers are guaranteed to halt on monadic inputs?
Monadic First Order Logic, where all predicates take exactly one argument, is a known decidable fragment of first order logic. Testing whether a formula is satisfiable in this logic is decidable, and there exist resolution-based methods for deciding…

jmite
- 8,171
- 6
- 40
- 81
9
votes
2 answers
Why Coq doesn't allow inversion, destruct, etc. when the goal is a Type?
When refineing a program, I tried to end proof by inversion on a False hypothesis when the goal was a Type. Here is a reduced version of the proof I tried to do.
Lemma strange1: forall T:Type, 0>0 -> T.
intros T H.
inversion H. (* Coq refuses…

larsr
- 5,447
- 19
- 38
9
votes
1 answer
Context Free Language Question (Pumping Lemma)
I know this isn't directly related to programming, but I was wondering if anyone know how to apply the pumping lemma to the following proof:
Show that L={(a^n)(b^n)(c^m) : n!=m} is not a context free language
I'm pretty confident with applying…

Maixy
- 1,151
- 2
- 12
- 27
9
votes
1 answer
Sorted list in idris (insertion sort)
I am writing an undergraduate thesis on usefulness of dependent types.
I am trying to construct a container, that can only be constructed into a sorted list, so that it is proven sorted by construction:
import Data.So
mutual
data SortedList : (a…

bssstudio
- 142
- 7
9
votes
1 answer
Proving the Functor laws for free monads; am I doing it right?
I'm having a bit of a hard time understanding how to prove the Functor and Monad laws for free monads. First off, let me put up the definitions I'm using:
data Free f a = Pure a | Free (f (Free f a))
instance Functor f => Functor (Free f) where
…

Luis Casillas
- 29,802
- 7
- 49
- 102
9
votes
3 answers
What laws are the standard Haskell type classes expected to uphold?
It's well-known that Monad instances ought to follow the Monad laws. It's perhaps less well-known that Functor instances ought to follow the Functor laws. Nevertheless, I would feel fairly confident writing a GHC rewrite rule that optimizes fmap id…

J. Abrahamson
- 72,246
- 9
- 135
- 180
9
votes
3 answers
Proofs of Applicative laws for haskell instances
Have all the Haskell instances of Applicative typeclass that we get with the Haskell platform been proved to satisfy all the Applicative laws?
If yes, where do we find those proofs?
The source code of Control.Applicative does not seem to contain any…

user1308560
- 409
- 2
- 9