{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module FOTC.Data.Stream.PropertiesATP where
open import FOTC.Base
open import FOTC.Base.List
open import FOTC.Data.Conat
open import FOTC.Data.Conat.Equality.Type
open import FOTC.Data.List
open import FOTC.Data.Stream
Stream-in : ∀ {xs} →
∃[ x' ] ∃[ xs' ] xs ≡ x' ∷ xs' ∧ Stream xs' →
Stream xs
Stream-in h = Stream-coind A h' h
where
A : D → Set
A xs = ∃[ x' ] ∃[ xs' ] xs ≡ x' ∷ xs' ∧ Stream xs'
{-# ATP definition A #-}
postulate h' : ∀ {xs} → A xs → ∃[ x' ] ∃[ xs' ] xs ≡ x' ∷ xs' ∧ A xs'
{-# ATP prove h' #-}
zeros-Stream : Stream zeros
zeros-Stream = Stream-coind A h refl
where
A : D → Set
A xs = xs ≡ zeros
{-# ATP definition A #-}
postulate h : ∀ {xs} → A xs → ∃[ x' ] ∃[ xs' ] xs ≡ x' ∷ xs' ∧ A xs'
{-# ATP prove h #-}
ones-Stream : Stream ones
ones-Stream = Stream-coind A h refl
where
A : D → Set
A xs = xs ≡ ones
{-# ATP definition A #-}
postulate h : ∀ {xs} → A xs → ∃[ x' ] ∃[ xs' ] xs ≡ x' ∷ xs' ∧ A xs'
{-# ATP prove h #-}
postulate ∷-Stream : ∀ {x xs} → Stream (x ∷ xs) → Stream xs
{-# ATP prove ∷-Stream #-}
streamLength : ∀ {xs} → Stream xs → length xs ≈ ∞
streamLength {xs} Sxs = ≈-coind R h₁ h₂
where
R : D → D → Set
R m n = ∃[ xs ] Stream xs ∧ m ≡ length xs ∧ n ≡ ∞
{-# ATP definition R #-}
postulate
h₁ : ∀ {m n} → R m n →
m ≡ zero ∧ n ≡ zero
∨ (∃[ m' ] ∃[ n' ] m ≡ succ₁ m' ∧ n ≡ succ₁ n' ∧ R m' n')
{-# ATP prove h₁ #-}
postulate h₂ : R (length xs) ∞
{-# ATP prove h₂ #-}