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
4
votes
1 answer

Induction principle for nested inductive types

I noticed that I keep redefining very similar induction principles for nested (and sometime mutually) inductive types because the one generated automatically by Coq is too weak. Here is a very simplified example: Require Import…
authchir
  • 1,605
  • 14
  • 26
4
votes
3 answers

coq induction with passing in equality

I have a list with a known value and want to induct on it, keeping track of what the original list was, and referring to it by element. That is, I need to refer to it by l[i] with varying i instead of just having (a :: l). I tried to make an…
scubed
  • 307
  • 3
  • 10
4
votes
2 answers

Using remember in induction over proposition gives 'ill-typed' error in Coq

Here are the inductive & computational definitions of evenness of natural numbers. Inductive ev : nat -> Prop := | ev_0 : ev O | ev_SS : forall n:nat, ev n -> ev (S (S n)). Definition even (n:nat) : Prop := evenb n = true. And the proof…
user287393
  • 1,221
  • 8
  • 13
4
votes
1 answer

Coq - Induction over functions without losing information

I'm having some troubles in Coq when trying to perform case analysis on the result of a function (which returns an inductive type). When using the usual tactics, like elim, induction, destroy, etc, the information gets lost. I'll put an example: We…
gonzaw
  • 771
  • 4
  • 17
4
votes
2 answers

induction hypothesis for even numbers

I am trying to write an induction hypothesis specifically for proving properties of even numbers. I formulated and proved the following: Theorem ind_hyp_on_evens: forall (p : nat -> Prop), (p 0 -> (forall n, p n -> p (S (S n))) -> forall n, p (n +…
Mayer Goldberg
  • 1,378
  • 11
  • 23
3
votes
1 answer

How to express that one element of an inductive relation can't be derived from another in Coq?

This is slightly different from simple implication, as shown in this toy example. Inductive R : nat -> nat -> Prop := | Base1: R 0 1 | Base2: R 0 2 | Ind: forall n m, R n m -> R (n+1) (m+1). Given this definition, we have three provable…
3
votes
2 answers

How do define a custom induction principle in coq?

This is kind of a follow up on a previous question I asked, but now I'm just trying to implement my own induction principle for the equality type, which I'm not sure how to do without some kind of pattern matching. I'm avoiding using the induction…
user5775230
3
votes
2 answers

Proof exponential runtime by induction

I have a problem showing with induction that the given function foo :: [Int] -> Int foo [] = 0 foo (x:xs) = max (max x (foo xs)) (max (-x) (foo xs)) which returns the max absolute value of a given list of Int's , has a runtime of O(2^n). I got…
nicksheen
  • 550
  • 6
  • 23
3
votes
1 answer

Solve Proof with Circular Symmetry in Coq

I am working on a proof using structural congruence, which is defined very similar to this example: Require Import Nat. Require Import Omega. Inductive expr := | Const : nat -> expr | Add : expr -> expr -> expr. Reserved Notation "e1 === e2"…
3
votes
1 answer

Are inductive definitions finitely generated in Isabelle?

Peter Aczel's classic paper An Introduction to Inductive Definitions https://www.sciencedirect.com/science/article/pii/S0049237X08711200 says that, in an inductive definition, a rule is a pair (X,x), where X is a set, called the set of premisses…
Gergely
  • 6,879
  • 6
  • 25
  • 35
3
votes
1 answer

Different "sorted" predicates should be equivalent in Dafny

According to Automating Induction with an SMT Solver the following should work on Dafny: ghost method AdjacentImpliesTransitive(s: seq) requires ∀ i • 1 ≤ i < |s| ==> s[i-1] ≤ s[i]; ensures ∀ i,j {:induction j} • 0 ≤ i < j < |s| ==> s[i] ≤…
fulem
  • 43
  • 6
3
votes
1 answer

Well-founded recursion by repeated division

Suppose I have some natural numbers d ≥ 2 and n > 0; in this case, I can split off the d's from n and get n = m * dk, where m is not divisible by d. I'd like to use this repeated removal of the d-divisible parts as a recursion scheme; so I thought…
Cactus
  • 27,075
  • 9
  • 69
  • 149
3
votes
2 answers

Wellfounded induction in CoQ

Let's say that I know certain natural numbers are good. I know 1 is good, if n is good then 3n is, and if n is good then n+5 is, and those are only ways of constructing good numbers. It seems to me that the adequate formalization of this in Coq…
Veky
  • 2,646
  • 1
  • 21
  • 30
3
votes
1 answer

To prove equality of two function definitions inductively

How do I do the induction to establish the statement moll n = doll n, with moll 0 = 1 --(m.1) moll n = moll ( n-1) + n --(m.2) doll n = sol 0 n --(d.1) where sol acc 0 = acc…
letter
  • 91
  • 1
  • 7
3
votes
1 answer

How to create the `enumFromTo` function on Morte?

Morte was designed to serve as an intermediate language for super-optimizing functional programs. In order to preserve strong normalization it has no direct recursion, so, inductive types such as lists are represented as folds, and conductive types…
MaiaVictor
  • 51,090
  • 44
  • 144
  • 286
1 2
3
17 18