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
2
votes
2 answers

Getting the number of unique states in a graph

I've been trying to solve MIT's Mathematics for Computer Science problem sets and here's one of the problems: Each monk entering the Temple of Forever is given a bowl with 15 red beads and 12 green beads. Each time the Gong of Time rings, a monk…
2
votes
1 answer

Generalize a claim in a structural induction proof to be able to use the induction hypothesis

I want to prove the following lemma fixes pi :: "'a path" and T :: "'a ts" shows "valid_path T pi s ⟹ ∀ op ∈ set pi. valid_operator T op" by induction on pi where fun valid_path :: "'a ts ⇒ 'a path ⇒ 'a state ⇒ bool" where "valid_path T [] s =…
Travis
  • 124
  • 6
2
votes
1 answer

recursive selection sort proof of correctness

I need to prove that the following selection sort code (in Haskell) is always sorting: import Data.List (minimum, delete) ssort :: Ord t => [t] -> [t] ssort [] = [] ssort xs = let { x = minimum xs } in x : ssort (delete x xs) We can assume that…
P. Ez
  • 103
  • 4
2
votes
2 answers

How to prove the inductive step in coq?

Coq beginner here, I recently went by myself through the first 7 chapters of "Logical Foundations". I am trying to create a proof by induction in Coq of ∀ n>= 3, 2n+1 < 2^n. I start with destruct removing the false hypotheses until reaching…
user454322
  • 7,300
  • 5
  • 41
  • 52
2
votes
1 answer

Turn off automatic induction principle in Coq

I have defined a nested inductive data type and have defined a custom inductive principle for it. However, automated tactics from a library I'm using (specifically, DBLib for de Bruijn indices) expects induction is on the usual inductive principle.…
2
votes
0 answers

Induction by assume-guarantee with nuSMV

I have an asynchronous symmetric ring-shaped protocol with 5 processes that satisfies a given property. I want to prove (or get counterexample) that the property is true for protocols with 6 number of processes and more; that is ∀n.φ(n) I…
mirzanahal
  • 167
  • 2
  • 12
2
votes
1 answer

proving two fixpoint functions by induction

I am struggling with seemingly simple lemma which involves 2 fixpoint definitions. The following two are axially definitions from CoLoR library: From Coq Require Import Vector Program. Import VectorNotations. Program Fixpoint Vnth {A:Type} {n} (v :…
krokodil
  • 1,326
  • 10
  • 18
2
votes
1 answer

Induction hypothesis for free variables of closed term in the simply typed lambda calculus

I am trying to formalize the simply typed lambda calculus in Coq and have a problem stating the lemma that the set of free variables of a well-typed expression in an empty context is empty. Here is the relevant part of may formalisation. Require…
authchir
  • 1,605
  • 14
  • 26
2
votes
1 answer

Implementing instance of Read typeclass in haskell

I've been playing around with inductive types (defined natural numbers and arithmetic operations on them) a little bit, and I can't get Haskell read function to work. Here's my code: data Natural = Zero | Succ Natural deriving (Eq,…
2
votes
1 answer

Can someone provide me a better proof and scenario for bubble sort compare to what i have proved

Give a list of unsorted elements. Initial condition is A=list of unsorted elements, p=1, N=total array size Bubble(A,p,N) if p>=N return for i=p to N-1 if A[i]>A[i+1] swap(A[i],A[i+1]) Bubble(A,p,N-1) Question 1: Prove the correctness of…
James
  • 37
  • 7
2
votes
1 answer

Using Mathematical Sequences & Induction to Create an Array

I need to generate a sequence of numbers that has a recurrence relation of a(n+1) = a(n)+1. I got this recurrence relation from Wolfram Alpha after inputing a series of numbers, from a list of series. I am unsure what the a variable is however, and…
2
votes
3 answers

Recurrence: T(n)=T(n/2)+ log N

I am stuck on a recurrence question. T(n)=T(n/2)+ log N What I have right now is that: T(N) = T(N/2) + log N T(N/2) = T(N/4) + log(N/2) ... T(N) = T(N/ 2^k) + sum[i=0 and k {log (N/2^i)}] I am stuck on what to do next. Please give me some…
kevin
  • 21
  • 1
  • 2
2
votes
1 answer

Why does Lean enforce recursive type arguments to appear after non-recursive ones?

The following definition is rejected by Lean: inductive natlist | nil : natlist | cons: natlist → ℕ → natlist with the error message "arg #2 of 'natlist.cons' is not recursive, but it occurs after recursive arguments" And the following definition…
2
votes
2 answers

How to implement mathematics induction on Haskell

data Nat = Zero | Succ Nat type Predicate = (Nat -> Bool) -- forAllNat p = (p n) for every finite defined n :: Nat implies :: Bool -> Bool -> Bool implies p q = (not p) || q basecase :: Predicate -> Bool basecase p = p Zero jump :: Predicate…
Joe
  • 107
  • 1
  • 10
2
votes
1 answer

Dafny insert method, a postcondition might not hold on this return path

I have an array "line" which has a string contained in it of length "l" and an array "nl" which has a string contained in it of length "p". Note: "l" and "p" don't necessarily have to be the length of each correspondent array.The parameter "at"…
pmpc
  • 315
  • 4
  • 19