Questions tagged [coinduction]

43 questions
2
votes
1 answer

Compute infinite tree from rooted paths using delay modality

This is a variation on "Compute an (infinite) tree from fixpoint operator using delay modality". The setting. We study a language of binary trees, augmented with the ability to refer to arbitrary other nodes in the tree by a path from the root: type…
Edward Z. Yang
  • 26,325
  • 16
  • 80
  • 110
2
votes
1 answer

Let-binding intermediate results in IO monad

Given this context: open import IO open import Data.String open import Data.Unit open import Coinduction postulate A : Set f : String → A g₁ g₂ : A → String let's say I want to implement something like foo : IO ⊤ foo = ♯ readFiniteFile…
Cactus
  • 27,075
  • 9
  • 69
  • 149
2
votes
2 answers

Coinduction and dependent types

I'm trying to write a Coq function which takes a Stream and a predicate and returns, as a list, the longest prefix of the stream for which the property holds. This is what I have: Require Import List Streams. Require Import Lt. Import…
user2457874
1
vote
1 answer

Reading a string from the command line in Agda 2

How do you read string input into Agda in 2.6+? I have been fighting to just write a program that reads a line of input and immediately spits it back. There seems to always be an issue, no matter what I try. Despite searching, I cannot find a…
mattdf
  • 11
  • 2
1
vote
1 answer

Proving coinductive theorems with coinductive assumptions

I have a simple lazy binary tree implementation: CoInductive LTree (A : Set) : Set := | LLeaf : LTree A | LBin : A -> (LTree A) -> (LTree A) -> LTree A. And following properties: (* Having some infinite branch *) CoInductive SomeInfinite {A} :…
radrow
  • 6,419
  • 4
  • 26
  • 53
1
vote
1 answer

Does safe Agda support coinduction w/out sized-types?

I recently decided to fool around with coinduction in Agda, and found the "copattern" machinery to be fairly brittle. I decided to cut to the chase and define M types, which more-or-less generalize all the coinductive types (setting…
So8res
  • 9,856
  • 9
  • 56
  • 86
1
vote
1 answer

Proving a coinduction principle for co-natural numbers

I have to admit that I'm not very good at coinduction. I'm trying to show a bisimulation principle on co-natural numbers, but I'm stuck on a pair of (symmetric) cases. CoInductive conat := | cozero : conat | cosucc : conat -> conat. CoInductive…
Carl Patenaude Poulin
  • 6,238
  • 5
  • 24
  • 46
1
vote
1 answer

Mutual recursion in primcofix

When I write codatatype inftree = node nat inftree inftree primcorec one :: inftree and two :: inftree where "one = node 1 one two" | "two = node 2 one two" I get "inftree" is neither mutually corecursive with "inftree" nor nested…
Joachim Breitner
  • 25,395
  • 6
  • 78
  • 139
1
vote
1 answer

Define a 'head' for coinductive type stream in Coq(without pattern matching)

1) I believe that it is possible to use inductive types without pattern matching. (using _rec,_rect,_ind only). It is opaque, complicated, but possible. 2) Is it possible to use coinductive types withous pattern matching? There exist a function from…
First Last
  • 33
  • 3
1
vote
2 answers

How to prove sset (cycle xs) = set xs

When working with Isabelle’s infinite stream data type, I need this obviously true lemma, but I am unable to figure out how to prove it (as I am not well versed with coinduction yet). How would I go about proving it? lemma sset_cycle[simp]: "xs ≠…
Joachim Breitner
  • 25,395
  • 6
  • 78
  • 139
0
votes
0 answers

Equality of coinductive types

I use the usual coinductive definition of the M-type. record M (S : Set) (Q : S → Set) : Set where coinductive constructor sup-M field shape : S pos : Q shape → M S Q open M Assume Y, S : Set, Q : S → Set, s : S, h : Q s → Y. I define…
sigma
  • 188
  • 1
  • 11
0
votes
0 answers

Are types that are neither inductive nor coinductive needed for writing real world programs?

Or it's just sometimes it's too hard to prove a type is a coinductive one? I'm talking about a programming language that is total which means it's not Turing complete, and recursion are all wellfounded and corecursion are all productive. Does Turing…
盛安安
  • 1,110
  • 1
  • 8
  • 21
0
votes
1 answer

Unexpected corecursive call

This (trimmed out) corecursive function definition in Isabelle primcorec tree :: "'form fset ⇒ 'vertex ⇒ 'preform ⇒ (('form fset × 'form), ('rule × 'preform) NatRule) dtree" where "tree Γ v p = (case undefined of Hyp h c ⇒ undefined | Reg c ⇒ …
Joachim Breitner
  • 25,395
  • 6
  • 78
  • 139
1 2
3