Questions tagged [coinduction]
43 questions
3
votes
3 answers
Defining equality relation for infinite trees
In coq i can define equality relations for coinductive types whose components are pairs:
Section Pairs.
Variable (A:Type).
CoInductive Stream :=
cons : (A * Stream) -> Stream.
CoInductive Stream_eq : Stream -> Stream -> Prop :=
stream_eq :…

Nikita
- 141
- 8
3
votes
1 answer
Ltac call to "cofix" failed. Error: All methods must construct elements in coinductive types
Require Import Streams.
CoFixpoint map {X Y : Type} (f : X -> Y) (s : Stream X) : Stream Y :=
Cons (f (hd s)) (map f (tl s)).
CoFixpoint interleave {X : Type} (s : Stream X * Stream X) : Stream X := Cons (hd (fst s)) (Cons (hd (snd s))…

Carl Patenaude Poulin
- 6,238
- 5
- 24
- 46
3
votes
2 answers
Proving equality on coinductive lazy lists in Coq
I am experimenting with Coq Coinductive types. I use the lazy list type form the Coq'Art book (sect. 13.1.4):
Set Implicit Arguments.
CoInductive LList (A:Set) : Set :=
| LNil : LList A
| LCons : A -> LList A -> LList A.
Implicit Arguments LNil…

Cryptostasis
- 1,166
- 6
- 15
3
votes
1 answer
Termination check of a recursive function call in agda
The following code is perfectly ok in Haskell:
dh :: Int -> Int -> (Int, Int)
dh d q = (2^d, q^d)
a = dh 2 (fst b)
b = dh 3 (fst a)
Similiar code in Agda wouldn't compile (termination check fails):
infixl 9 _^_
_^_ : ℕ → ℕ → ℕ
x ^ zero = 1
x ^ suc…

Vlad Semenov
- 71
- 1
3
votes
1 answer
Why can't I define the following CoFixpoint?
I am using:
$ coqtop -v
The Coq Proof Assistant, version 8.4pl5 (February 2015)
compiled on Feb 06 2015 17:44:41 with OCaml 4.02.1
I defined the following CoInductive type, stream:
$ coqtop
Welcome to Coq 8.4pl5 (February 2015)
Coq < CoInductive…

Aadit M Shah
- 72,912
- 30
- 168
- 299
3
votes
1 answer
Proving a Co-Inductive property (lexical ordering is transitive) in Coq
I'm trying to prove the first example in "Practical Coinduction" in Coq. The first example is to prove that lexicographical ordering on infinite streams of integers is transitive.
I haven't been able to formulate the proof to get around the…

larsr
- 5,447
- 19
- 38
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
2
votes
0 answers
Coinductive principle for streams
I am trying to prove the following principle for stream predicates (defined in the standard library).
From Coq Require Import Streams.
Lemma mystream_ind :
forall A (P : Stream A -> Prop),
(forall s, ForAll P (tl s) -> ForAll P s) ->
…

pjm
- 269
- 1
- 8
2
votes
1 answer
Can I prove "coinductive principles" about coinductive type?
Can I prove "coinductive principles" about coinductive type? For example, the pseudo code of the coinductive principle for the stream type would look like this:
Π P : Stream A -> Type.
Π destruct_head : Π x : Stream A. P x -> Σ y : A. Path A (head…

Hexirp
- 410
- 2
- 11
2
votes
1 answer
Is the only difference between Inductive and CoInductive the well-formedness checks on their uses (in Coq)?
To phrase the question differently: if we were to remove termination-checking and the guardedness condition on uses of inductive and coinductive data types, respectively, would there cease to be a fundamental difference between inductive/coinductive…

Max Heiber
- 14,346
- 12
- 59
- 97
2
votes
1 answer
Eliminating erased argument with only one valid case
I have defined infinite streams as follows:
record Stream (A : Set) : Set where
coinductive
field head : A
field tail : Stream A
and an inductive type which shows that some element in a stream eventually satisfies a predicate:
data…

Eayus
- 65
- 4
2
votes
1 answer
in isabelle what format of goal is required to pertorm coinduction
Hi I am a novice trying to learn how to use coinduction in isabelle. I have been looking at HOL/Datatype_Examples/Process.thy (Andrei Popescu) 2012. As 2019 Isabelle is much improved (and not because of any personal skill) I have simplified the…

david streader
- 589
- 2
- 7
2
votes
1 answer
Coinduction not of form A -> A?
In Coq, coinduction takes the form of proving A -> A subject to the guardedness constraint to make sure there is progress. This formulation is error prone in that it looks like you have reached the destination at the beginning and in that it is not…

scubed
- 307
- 3
- 10
2
votes
1 answer
Coinduction on Coq, type mismatch
I've been trying out coinductive types and decided to define coinductive versions of the natural numbers and the vectors (lists with their size in the type). I defined them and the infinite number as so:
CoInductive conat : Set :=
| cozero : conat
|…

Gabriel Barreto
- 21
- 1
2
votes
1 answer
Coinductive principles corresponding to the *_rect family of functions
Defining a new type foo gives me a recursion principle foo_rect, which elegantly abstracts over fix. Could a coinductive equivalent (abstracting over cofix) be defined by "flipping the arrows" somehow?

Carl Patenaude Poulin
- 6,238
- 5
- 24
- 46