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
1
vote
1 answer

Understanding type inference issues in agda when proving basic function application laws

I'm trying a to prove the identity law for function application. I get yellow highlighting with respect to supposed identity function, apfId, below. I don't understand, doesn't _≡_ {A} have the type A → A → Set? Is there any simple way to check…
user5775230
1
vote
1 answer

Agda: Constructing a recursive record value?

I'm wondering, is it possible to have records whose values depend on each other, without being recursively defined in terms of types? Basically, I have a record type that looks like this: record SomeRec (a : Set) : Set where   method1 : a -> a ->…
jmite
  • 8,171
  • 6
  • 40
  • 81
1
vote
1 answer

How to prove a*b*c=a*(b*c) in Coq?

Im trying to prove the above question. I have been given a definition of an induction: Definition nat_ind (p : nat -> Prop) (basis : p 0) (step : forall n, p n -> p (S n)) : forall n, p n := fix f n := match n return p n with …
1
vote
1 answer

Induction Proof $T(n) = 9T(n/3) + n^2$

How can I prove that the reccurence T(n) = 9T(n/3) + n2 leads to T(n) = O(n2 log(n)) using the substitution method and a proof by induction? I’m not allowed to use the Master Theorem. Using induction and assuming T(n) ≤ cn2 log n, I got to the…
Joshua
  • 114
  • 1
  • 10
1
vote
2 answers

Type-level induction on KnownNats: Overlapping instances

I'm trying to figure out how to do type-level induction on KnownNats. A toy example, summing up sized vectors from vector-sized: {-# LANGUAGE FlexibleInstances, UndecidableInstances #-} {-# LANGUAGE TypeFamilies, TypeApplications, TypeOperators…
1
vote
1 answer

Boolean operators and Induction

Let @ denote the binary boolean operator defined by the right-hand side below: p @ q = (p ^ ¬q) (b) Is the set of operators {@, ¬} complete? Explain in detail. (c) Prove by induction that any propositional formula in a single propositional variable…
1
vote
1 answer

Closing a lemma on list of nats

I am stuck to prove the following admitted lemma. Kindly help me how to proceed. The function sumoneseq adds to and returns list of repetitions of 'true', in reverse order. Given [true;false;true;true;false;true;true;true], it returns [3;2;1]. The…
Khan
  • 303
  • 2
  • 14
1
vote
1 answer

proving strong induction in coq from scratch

I am in the middle of proving the equivalence of weak and strong induction. I have a definition like: Definition strong_induct (nP : nat->Prop) : Prop := nP 0 /\ (forall n : nat, (forall k : nat, k <= n -> nP k) -> nP (S n)) . And I…
user5876164
  • 471
  • 3
  • 15
1
vote
1 answer

Can you enumerate all values of an inductive type in Coq?

Is there a way to enumerate the values of a finite inductive type in Coq? E.g., consider the type: Inductive state := A | B | C | D | E. Is there any way to take this definition and from it, programmatically gain access to A, B, C, D, and E? I know…
Edward Minnix
  • 2,889
  • 1
  • 13
  • 26
1
vote
1 answer

How to use wolfram to solve induction problem

I need to solve this problem with induction k in natural numbers So how I write this problem in wolfram Engine ?
1
vote
1 answer

Induction principle for `le`

For the inductive type nat, the generated induction principle uses the constructors O and S in its statement: Inductive nat : Set := O : nat | S : nat -> nat nat_ind : forall P : nat -> Prop, P 0 -> (forall n : nat, P n -> P (S n)) ->…
Bob
  • 1,713
  • 10
  • 23
1
vote
1 answer

Induct on two variables?

Given a function that generates a list of identical items I wish to prove that the generated lists consist the given natural number at all positions independent of list length. fun pattern_n :: "nat ⇒ nat ⇒ nat list" where "pattern_n _ 0 = []"…
Attila Karoly
  • 951
  • 5
  • 13
1
vote
0 answers

Prove: if tree has n vertices, it has n-1 edges

This is question number 1-17 in the "Algorithm Design Manual 2nd Ed." by Steven S. Skiena. I found a solution to this question here, http://compalg.inf.elte.hu/~tony/Oktatas/TDK/FINAL/Chap%204.PDF. However, I wanted to know if this constitutes an…
ramziabbyad
  • 56
  • 2
  • 8
1
vote
1 answer

Inductive Proof of Counting Sort?

I am covering the counting sort algorithm, and I understand how it works, but I would like to know if there is a specific way to prove that counting sort is a stable algorithm. I have an idea on how to inductively prove this, but I am unsure of how…
JOhAnn4187
  • 77
  • 1
  • 10
1
vote
0 answers

Why do Dafny inductive predicates use ordinals?

Section 11.1.2 of the Dafny Reference Manual provides these examples of extreme predicates: inductive predicate g(x: int) { x == 0 || g(x-2) } copredicate G(x: int) { x == 0 || G(x-2) } Section 11.1.3 then gives a few example proofs about…
Jason Orendorff
  • 42,793
  • 6
  • 62
  • 96