Questions tagged [proof]

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.

828 questions
9
votes
3 answers

Using big-O to prove N^2 is O(2^N)

I can clearly see than N^2 is bounded by c2^N, but how do i prove it by using formal definition of big-O. I can simply prove it by M.I. Here is my attempt.. By definition, there for any n>n0, there exist a constant C which f(n) <= Cg(n) where…
Timothy Leung
  • 1,407
  • 7
  • 22
  • 39
8
votes
1 answer

How to prove this invariant?

I aim to prove that the Horner's Rule is correct. To do so, I compare the value currently calculated by Horner with the value of "real" polynominal. So I made this piece of code: package body Poly with SPARK_Mode is function Horner (X : Integer;…
8
votes
0 answers

Which axioms may be safely added to Coq?

This question is a request for references or explanation. The main idea is: What if I add every axiom from standard library of Coq? Will it raise a contradiction or they are well-adjusted to each other? What are other reliable sources of information…
ged
  • 687
  • 7
  • 19
8
votes
1 answer

How can I have Idris automatically prove that two values are not equal?

How can I have Idris automatically prove that two values are not equal? p : Not (Int = String) p = \Refl impossible How can I have Idris automatically generate this proof? auto does not appear to be capable of proving statements involving Not. My…
michaelmesser
  • 3,601
  • 2
  • 19
  • 42
8
votes
1 answer

Handling let in hypothesis

As an exercise in Coq, I'm trying to prove that the following function returns a pair of lists of equal length. Require Import List. Fixpoint split (A B:Set)(x:list (A*B)) : (list A)*(list B) := match x with |nil => (nil, nil) |cons (a,b) x1 => let…
kjam
  • 809
  • 1
  • 7
  • 17
8
votes
3 answers

How to prove False from obviously contradictory assumptions

Suppose I want to prove following Theorem: Theorem succ_neq_zero : forall n m: nat, S n = m -> 0 = m -> False. This one is trivial since m cannot be both successor and zero, as assumed. However I found it quite tricky to prove it, and I don't know…
Michal Seweryn
  • 363
  • 2
  • 8
8
votes
1 answer

How or is that possible to prove or falsify `forall (P Q : Prop), (P -> Q) -> (Q -> P) -> P = Q.` in Coq?

I want to prove or falsify forall (P Q : Prop), (P -> Q) -> (Q -> P) -> P = Q. in Coq. Here is my approach. Inductive True2 : Prop := | One : True2 | Two : True2. Lemma True_has_one : forall (t0 t1 : True), t0 = t1. Proof. intros. destruct…
TorosFanny
  • 1,702
  • 1
  • 16
  • 25
8
votes
2 answers

Why is the greedy algorithm optimal?

Codility, lesson 14, task TieRopes (https://codility.com/demo/take-sample-test/tie_ropes). Stated briefly, the problem is to partition a list A of positive integers into the maximum number of (contiguous) sublists having sum at least K. I've only…
NPS
  • 6,003
  • 11
  • 53
  • 90
8
votes
2 answers

Core of Verifier in Isabelle/HOL

Question What is the core algorithm of the Isabelle/HOL verifier? I'm looking for something on the level of a scheme metacircular evaluator. Clarification I'm only interested in the Verifier , not the strategies for automated theorem…
user1416711
  • 111
  • 3
8
votes
4 answers

How can we prove by induction that binary search is correct?

I'm having a hard time understanding how induction, coupled with some invariant, can be used to prove the correctness of algorithms. Namely, how is the invariant found, and when is the inductive hypothesis used- particularly for binary search? I…
Bob John
  • 3,688
  • 14
  • 43
  • 57
7
votes
2 answers

Stable comparison sort with O(n * log(n)) time and O(1) space complexity

While going through Wikipedia's list of sorting algorithms I noticed that there's no stable comparison sort that has O(n*log(n)) (worst-case) time-complexity and O(1) (worst-case) space-complexity. This surely looks like a theoretical boundary, but…
Florian Brucker
  • 9,621
  • 3
  • 48
  • 81
7
votes
2 answers

Prove the efficiency of repeated calls to successor() in binary trees?

I need a hint for this exercise from the CLRS Algorithms book: Prove that no matter what node we start at in a height-h binary search tree, k successive calls to Tree-Successor take O(k+h) time.
ssierral
  • 8,537
  • 6
  • 26
  • 44
7
votes
5 answers

How to prove (forall x, P x /\ Q x) -> (forall x, P x)

How does one prove (forall x, P x /\ Q x) -> (forall x, P x) in Coq? Been trying for hours and can't figure out how to break down the antecedent to something that Coq can digest. (I'm a newb, obviously :)
Farley Knight
  • 1,795
  • 1
  • 13
  • 17
7
votes
1 answer

Simple congruence proof error with Liquid Haskell - Liquid Type Mismatch

I'm following the official tutorial on Liquid Haskell, and stumbled upon what seems to be a "bug" in it. The following code is present in the tutorial, and Liquid Haskell was supposed to check that it is safe. {-@ type TRUE = {v:Bool | v }…
Thales MG
  • 761
  • 5
  • 15
7
votes
1 answer

Proof that a binary tree with n leaves has a height of at least log n

I've been able to create a proof that shows the maximum total nodes in a tree is equal to n = 2^(h+1) - 1 and logically I know that the height of a binary tree is log n (can draw it out to see) but I'm having trouble constructing a formal proof to…
MandyLB
  • 307
  • 1
  • 4
  • 18