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

proof by induction using +2

im wondering if this variant of proof by induction is correct the standard proof by induction states that if an equation/algorithm works for n and you can prove that it works for n+1 then you can assume it works for every integer bigger or equal to…
user2475269
1
vote
1 answer

General recursion and induction in Coq

Let's suppose that I have type T wellfounded relation R: T->T->Prop function F1: T->T that makes argument "smaller" condition C: T->Prop that describes "start values" of R function F2: T->T that makes argument "bigger" How can I make Fixpoint that…
zaa
  • 113
  • 4
1
vote
0 answers

Inductive predicate in ACSL stating a linked list is a sublist of another

I need to code, in ACSL, an inductive predicate stating that a linked list is a sublist of another. The signature of the predicate should be something like this: inductive subLinkedList{L1,L2} (LinkedList l) { ... } So basically I want a predicate…
Daniel
  • 95
  • 8
1
vote
3 answers

Proving non-existence of an infinite inductive value in Coq

Suppose I have a very simple inductive type: Inductive ind : Set := | ind0 : ind | ind1 : ind -> ind. and I'd like to prove that certain values can't exist. Specifically, that there can't be non-well-founded values: ~exists i, i = ind1…
jade
  • 744
  • 5
  • 16
1
vote
1 answer

how to prove the correctness of recursive algorithm?

private static void swap(char[] str, int i, int j){ char tmp = str[i]; str[i] = str[j]; str[j] = tmp; } public static void permute(String str){ permute(str.toCharArray(), 0, str.length()); } private static void permute(char[] str, int low,…
1
vote
2 answers

How to prove by induction that a program does something?

I have a computer program that reads in an array of chars that operands and operators written in postfix notation. The program then scans through the array works out the result by using a stack as shown : get next char in array until there are no…
Tom
  • 6,601
  • 12
  • 40
  • 48
1
vote
1 answer

Postgres not available as adapter on Induction

I'm using Postgres.app and the latest build of Induction ( Version 0.1.0 (28) ) and I cannot choose "Postgres" as an adapter. I only have the options for mongodb, redis, and sqlite. If I attempt to type it in manually (i.e. "postgres://locahost"),…
krnjn
  • 125
  • 1
  • 3
  • 8
1
vote
1 answer

Proving Polynomial Big-Theta through induction?

I understand the concept of big theta, big oh, and big omega.. I'm just having a hard time proving it. It's been a long time since I've done induction, so I'm pretty sure I'm just rusty and missing something simple. For example.. the problem I need…
Heather Wilson
  • 153
  • 2
  • 4
  • 13
0
votes
3 answers

Proof for number of internal nodes in a tree

I was reading about compressed tries and read the following: a compressed trie is a tree which has L leaves and every internal node in the trie has at least 2 children. Then the author wrote that a tree with L leaves such that every internal node…
Programmer
  • 6,565
  • 25
  • 78
  • 125
0
votes
2 answers

Proving a recurrence relation by induction

I have a test coming up, and I need some help with a practise question... Need to prove this by induction: Reccurence relation: m(i) = m(i-1) + m(i - 3) + 1, i >= 3 Initial conditions: m(0) = 1, m(1) = 2, m(2) = 3 Prove m(i) >= 2^(i/3) Here is…
Tesla
  • 822
  • 2
  • 13
  • 27
0
votes
0 answers

Proving height of O(logn) using induction for modified binary tree

If I were to have a modified version of a binary tree such that the maximal difference between the right and left child nodes of every node in the tree is ≤2, my intuition tells me that similarly to a regular binary tree, this would have a height of…
0
votes
1 answer

Proving a Type is Uninhabited in Agda

I've been learning Agda recently and I've been making a lot of progress but I'm stuck on one thing: proving that a type is NOT inhabited. I have a relation on Bools defined as follows: data Test : Rel Bool 0ℓ where direct : Test false true …
Sam_W
  • 47
  • 4
0
votes
1 answer

Proving a covariance inequality in Dafny, use contradiction?

I am trying to prove the following property in Dafny: covariance(x,y) <= variance(x) * variance(y), where x and y are real. First of all, I would like to know if I am interpreting covariance and variance correctly. Thus, I make the following…
Theo Deep
  • 666
  • 4
  • 15
0
votes
2 answers

Dafny: property '2*x*y <= x^2+y^2' holds with primitive operations (like 'x*x'), but not when I define operations in my own (like 'power(x,2)')

I am trying to prove a property in Dafny, which makes use of powers. Concretely, this one: forall x,y in Reals : 2xy <= x^2+y^2. I implemented this idea in the following lemma: lemma product2_lessEqual_powProduct (x:real, y:real) requires…
Theo Deep
  • 666
  • 4
  • 15
0
votes
1 answer

How does dafny prove this induction on maps?

I wrote a specification for the leetcode isomorphic strings problem based on the following TypeScript code. Basically, the approach is to assign each letter a number based on when it was first encountered, we do this for both strings and if the…
Hath995
  • 821
  • 6
  • 12