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

Coq: Problems with List In inductive

I'm new to Coq, but with some effort I was able to prove various inductive lemmas. However I get stuck on all exercises that uses the following inductive definition: Inductive In (A:Type) (y:A) : list A -> Prop := | InHead : forall xs:list A,…
Cristiano Sousa
  • 934
  • 1
  • 6
  • 31
2
votes
2 answers

PostgreSQL Database Browser for Rails 3.2 app - Induction App instead of SQLite Database Browser

I am following the Rails Tutorial with the database set up using postgreSQL so the development and production are the same locally and where it is deployed on Heroku. So far so good. I've got the User model set up and working both locally and in…
1
vote
2 answers

Proving an algorithm is correct for solving a game

Given is a row of at most 30 stones which can either be black or white. No gaps are allowed at the start of the game, but there can be less than 30 stones. The goal is to remove all the stones. Only black stones can be removed, if a stone is…
rbnvrw
  • 347
  • 3
  • 15
1
vote
2 answers

Definition by minimization in Coq

Assume P: nat -> T -> Prop is a proposition that for any given t: T, either there exists a k: nat such that P holds for all numbers greater than or equal to k and no number less than k. or P k t is false for all k : nat. I want to define min_k : T…
1
vote
2 answers

How does Dafny support induction if Z3 does not?

Dafny has the option to set {:induction false}. Also, as far as I know, whenever we use assertions in Dafny, what happens below it that it constructs proof obligations and then calculates on them using Z3. However, I read Z3 does not support…
Theo Deep
  • 666
  • 4
  • 15
1
vote
1 answer

Induction on recursive problems

Let () be defined recursively as follows: (1) = and () = (⌊n/2⌋) + for all integers ≥ 2, where is an arbitrary positive constant. Prove by induction on that () ≤ log + . (Note: ⌊⌋ is the floor function, defined as rounding down to the closest…
1
vote
2 answers

Dafny sequence filter function and lemmas

Trying to setup a few functions for a quicksort implementation I got stuck on the following lemmas, filterLemmaExtra and filterLemmaSizes. function filter(xs: seq, p: (T) -> bool): seq ensures forall x: T :: x in xs && p(x) ==> x in…
Hath995
  • 821
  • 6
  • 12
1
vote
1 answer

Why do I get this exception on an induction rule for a lemma?

I am trying to prove the following lemma (which is the meaning formula for the addition of two Binary numerals). It goes like this : lemma (in th2) addMeaningF_2: "∀m. m ≤ n ⟹ (m = (len x + len y) ⟹ (evalBinNum_1 (addBinNum x y) = plus (evalBinNum_1…
1
vote
2 answers

Coq: Implementation of splitstring and proof that nothing gets deleted

after working for a whole day on this with no success, I might get some help here. I implemented a splitString function in Coq: It takes a String (In my case a list ascii) and a function f: ascii->bool. I want to return a list of strings (In my case…
Leo G.
  • 33
  • 2
1
vote
1 answer

Parameter arithmetic in Prolog

In Prolog, I would like to implement a trivial logical induction predicate i as (1): i(0). i(N) :- i(N-1). or (2): i(0). i(N+1) :- i(N). But this doesn't work; with (1), query i(3). causes a stack overflow; with (2), i(3). returns false. Instead,…
silver
  • 160
  • 7
1
vote
1 answer

Structural induction haskell

I would like to know how I can show in structural induction that list xs , or how the induction work in this: map f (map g xs) = map (\x -> f(g x)) xs with this function definition map :: ( a -> b ) -> [ a ] -> [ b ] map _ [] = [] map f…
James332
  • 73
  • 6
1
vote
1 answer

Deleting element at specific index failing in Dafny

I have the following problem: I have to implement a priority queue in Dafny. I have the following interface: trait PQSpec { var nrOfElements: int; var capacity: int; var contents: array; var priorities: array; predicate Valid() reads…
Kropius Dop
  • 105
  • 1
  • 9
1
vote
2 answers

Induction on integers in Lean creates non-int types

I want to use induction on an integer variable, doing an inductive step both in the positive and negative direction. Consider the following theorem (for demonstration, no matter if it makes sense): theorem exmpl (x : ℤ) : (x = 5):= begin induction…
502E532E
  • 431
  • 2
  • 11
1
vote
0 answers

Coq - trivial induction on lists doesn't accept assumtion

In my current proof, I end up requiring the following result for the else situation of a case disjunction. 1 subgoal (ID 28899) l : list (Concrete.cvalue sem) ============================ match l with | [] | _ => True end I therefore…
Berelex
  • 11
  • 3
1
vote
0 answers

Can't get a correct theory by Aleph with SWI-Prolog

I’m trying to use Aleph with SWI-Prolog to construct a theory. But the result seems incorrect. My prolog file is: :- use_module(library(aleph)). :- if(current_predicate(use_rendering/1)). :- use_rendering(prolog). :- endif. :- aleph. :-…
Vic
  • 27
  • 1
  • 4