Questions tagged [induction]

Anything related to mathematical induction principle and techniques applied to computing. Please DO NOT USE this tag for math-only questions since they are off-topic on SO. This tag may be used for math-related questions only if it involves some programming activity or software tools (e.g. automatic theorem proving, etc.).

Anything related to mathematical induction principle and techniques applied to computing. Please DO NOT USE this tag for math-only questions since they are off-topic on SO. This tag may be used for math-related questions only if it involves some programming activity or software tools (e.g. automatic theorem proving, etc.).

262 questions
3
votes
1 answer

Coq - induction on lists with a function applied to each element

Am trying to prove that applying a function f to every element of two lists results similar rel_list lists if they were originaly related. I have a rel on the elements of the list and have proved a lemma Lemma1 that if two elements are in rel, they…
Khan
  • 303
  • 2
  • 14
3
votes
1 answer

TWISTED Longest common subsequence

I was wondering about a special case of the Longest Common Subsequence problem http://en.wikipedia.org/wiki/Longest_common_subsequence_problem What if we have two strings of n symbols and its guaranteed that both of them have exactly 1 symbol and…
3
votes
1 answer

Using Omega to prove a lemma in Coq

I am trying to make a proof in Coq using Omega. I spent a lot of time on it, but nothing came to me. I have to say I am new in Coq, so I am not at ease with this kind of language, and I do not have much experience. But I am working on it. Here's the…
Flo
  • 41
  • 1
  • 4
3
votes
2 answers

Explaining algorithm proofs in plain English

I'm a programmer who never studied Algorithms formally, and have always wanted to fill in that gap in my learning. I'm currently working my way through some books and online material, and I understand conceptually Big O, i.e. what it's for, and the…
eustachio
  • 168
  • 14
2
votes
0 answers

How does one pick the proper loop invariant to prove an algorithm's correctness?

We started with loop invariants last week and our professor proposed this question to work on at home. I've been following along the slides/lectures but I am having so much trouble with identifying a loop invariant which can help me prove the…
b0to
  • 21
  • 3
2
votes
1 answer

Implementing an algorithm in Python to compute a function verifying an induction formula

I have a real function V taking its values in S*{1,...,N} where S is a finite set containing elements of the form (s_0,s_1), where s_0,s_1 are reals. V follows an "induction formula" of the following form : V(s,n)=max_{a in A}…
Skywear
  • 53
  • 4
2
votes
1 answer

I'm trying to build a proof in Coq that two different permutation definitions are equivalent, but the non-inductive side is not working

The two definitions are these: Inductive perm : list nat -> list nat -> Prop := | perm_eq: forall l1, perm l1 l1 | perm_swap: forall x y l1, perm (x :: y :: l1) (y :: x :: l1) | perm_hd: forall x l1 l2, perm l1 l2 -> perm (x :: l1) (x :: l2) |…
Andrey
  • 21
  • 1
2
votes
1 answer

structural induction of haskell

Hello everyone I want to ask if the following a definition of structural induction or not init xs = take ( length xs - 1) xs init :: [ a ] -> [ a ] init ( x :[]) = [] init ( x : z : xs ) = x : init ( z : xs ) also Can someone give me an example…
James332
  • 73
  • 6
2
votes
1 answer

Complexity of the recurrence T(n)=T(n/2)+T(n/2)+n^2?

In accord to Master Theorem this recurrece is θ(n^2), but if we solve this with tree recurrence the solution is θ(n^2*logn). Am I doing something wrong?
user13557576
2
votes
1 answer

How to prove an element does not belong to an inductive_set

Assuming I have already defined an inductive_set, for example, the inductive set "Even" such that: inductive_set Even :: "int set" where ZERO : "0 ∈ Even" | PLUS :"x ∈ Even ⟹x+2 ∈ Even" | MIN :"x ∈ Even ⟹ x-2 ∈ Even" lemma…
user206904
  • 504
  • 4
  • 16
2
votes
1 answer

Proof of Induction when initial condition is 0

Proof of Induction || Iteration method Hi, I am working on a discrete math problem, and I can't figure out what to do with: T(n) = 3 + T(n/2), T(0) = 0 I have tried Plug and Chug method and Induction method, but I can't seem to work it out. My…
Cyril Cabo
  • 31
  • 4
2
votes
2 answers

How do I prove this algorithm's correctness?

My algorithm: Construct a new graph G' whereas for every vertex v in V, create two vertices v_0 and v_1 in G', and for every edge (u, v) in E, create two edges (u_0 , v_1) and (u_1,v_0) in G'. Run Dijkstra on G' starting at s_0. All paths in G'…
2
votes
1 answer

Can Dafny verify summing elements from the right?

Hi I gather that when performing induction Dafny unfold the specification of a function. Thus when writing a method that implements the function it is best to traverse an array in the similar direction. This understanding corresponds the behaviour…
david streader
  • 589
  • 2
  • 7
2
votes
1 answer

How to encode via W-types in agda?

I'm trying to encode lists via W-types in Agda, when trying to prove my encoding correct, I get the following unsolveable goal. Goal: g (f (x a)) ≡ x a' Have: g (f (x a')) ≡ x a' ———————————————————————————————————————————————————————————— a' : A x …
user5775230
2
votes
1 answer

How does one prove weakening for a simple language in agda?

I'm trying to prove a weakening lemma analagous to Harper's from chapter 4 of PFPL. Namely, weakening : {x : String} {Γ : Context} {e : Expr} {τ τ' : Type} → x ∉dom Γ → Γ ⊢ e ؛ τ' → (Γ , x ؛ τ) ⊢ e ؛ τ' I've adapted some of Wadler's code, where he…
user5775230