FAQ Database Discussion Community


Handling let in hypothesis

coq,proof,dependent-type
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 (ta, tb) := split...

Asymptotic notation and Growth of Combinations of Functions: Difference

algorithm,asymptotic-complexity,proof,growth-rate
I need to prove or disprove the following conjecture: if f(n) = O(h(n)) AND g(n) = O(k(n)) then (f − g)(n) = O(h(n) − k(n)) I am aware of the sum and product theorems for growth combination, but I could not find a way to apply them here, even though...

Why do we need to use the negation part in Turing's Halting Proof?

loops,logic,proof,turing-machines,halting-problem
For instance, let's say I have this Turing machine, H, which tells us whether or not a program and input will halt. Let's say we call H on itself. It has to give an answer, so if it prints out "does not halt" then didn't it technically halt to print...

Concatenation of undef and list is undef - proof Haskell

haskell,undefined,proof
How could one prove that the following is true for every list xs: undefined ++ xs = undefined ...

How to prove x + y - z = x + (y - z) in Coq

coq,proof,coqide
I want to prove this : 1 subgoals x : nat y : nat z : nat ______________________________________(1/1) x + y - z = x + (y - z) It looks trivial, but it confuse me a lot, and I need it for another proof. Thanks....

Merging two small sequencies - algorithm

merge,proof,array-algorithms
Prove that it is enough to make at most 5 comparisons in order to merge two sorted sequences of lengths 2 and 5.

Compute the highest value with a given list and operators in OCaml

algorithm,list,ocaml,proof
With a given positive integer list and the addition and the multiplication as operators, I want to compute the highest value. So if my list is [2,3,4], it will be : 2 * 3 * 4 = 24. If there is at least one 1 in the list, it is...

How to understand the time complexity of Kademlia node operation

algorithm,time-complexity,proof,dht,kademlia
I'm now learning Kademlia network by reading the classical paper Kademlia: A Peer-to-peer Information System Based on the XOR Metric. I want to understand the complexity of its operation but still cannot figure it out. In the 3 Sketch of proof section, the paper gives two definitions: Depth of a...

Agda: Simulate Coq's rewrite tactic

pattern-matching,proof,agda,dependent-type
I have some experience using Coq and am now in the process of learning Agda. I'm working on a correctness proof of insertion sort and have reached a point where I would like to perform something similar to Coq's rewrite tactic. Currently, I have: open import Data.Nat open import Relation.Binary.PropositionalEquality...

Skip a subgoal while proving in Isabelle

proof,isabelle,theorem-proving,isar
I am trying to prove a theorem but got stuck at a subgoal (that I prefer to skip and prove later). How can I skip this and prove the others ? First, I tried oops and sorry but they both abort the entire proof (instead of the only subgoal). I...

Fixed Point and Proof theory

logic,proof,logic-programming,first-order-logic
For any given logic program, proof theory of it uses SLD (Selective Linear Definite) resolution to find the satisfiablity of the query. For the same logic program, we can apply fixed point theorem to find the models. My question is, should we consider finding fixed point of logic programs as...

Formal proof for what algorithm return

algorithm,fibonacci,proof
I need to formal proof that below algorithm return 1 for n = 1 and 0 in other cases. function K( n: word): word; begin if (n < 2) then K := n else K := K(n − 1) * K(n − 2); end; Anyone could help? Thank you...

Needs a proof in a part of prime factorisation

math,proof,prime-factoring,number-theory
According to topcoder Link, We need to compute till square root of number to list its all prime factors... Now I am able to prove in the following code that we are doing right till we are in the for loop.. But I am unable to figure out why the...

Proving st X + st Y = st Y + (st X - 1) + 1 using Coq

coq,proof
Just like the title says, I'm looking for a way to prove st X + st Y = st Y + (st X - 1) + 1 in Coq. I've been trying applying various combinations of plus_comm, plus_assoc and plus_permute but I haven't been able to make it go through....

If f(n) = O(h(n)) then c*f(n) = O(h(n)) for all c > 0 - proof challenged?

algorithm,asymptotic-complexity,proof,growth-rate
I have been asked to prove or disprove the following conjecture: For any given constant c>0 | If f(n) = O(h(n)) then c*f(n) = O(h(n)) I have came up with the following counter example: Let f(n) = n and c = n+1. Then c*f(n) = (n+1)n = n^2+n = O(n^2),...

How can I prove that elem z (xs ++ ys) == elem z xs || elem z ys?

haskell,proof,induction
I have the following: elem :: Eq a => a -> [a] -> Bool elem _ [] = False elem x (y:ys) = x == y || elem x ys How can I prove that for all x's y's and z's... elem z (xs ++ ys) == elem z xs...

Proof assistant for mathematics only

proof,agda,idris,proof-of-correctness,isar
Most proof assistants are functional programming languages with dependent types. They can proof programs/algorithms. I'm interested, instead, in proof assistant suitable best for mathematics and only (calculus for instance). Can you recommend one? I heard about Mizar but I don’t like that the source code is closed, but if it...

Solving (BEq a a0 = BTrue \/ BEq a a0 = BFalse) in Coq

coq,proof,coqide
(BEq a a0 = BTrue \/ BEq a a0 = BFalse) is either true or false since a==a0 or a!=a0. However, I'm not sure how I can get Coq to see this. Here is my complete proof window: 4 subgoal a : aexp a0 : aexp st : state ______________________________________(1/4)...

Asymptotic notation: How to prove that n^2 = Ω(nlogn)?

algorithm,asymptotic-complexity,proof,growth-rate
I was asked to prove or disprove the following conjecture: n^2 = Ω(nlogn) This one feels like it should be very easy, and intuitively it seems to me that because Ω is a lower bound function, and n^2 is by definition of higher magnitude than nlogn, then it is also...