首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >导电证明的问题

导电证明的问题
EN

Stack Overflow用户
提问于 2015-02-20 23:56:15
回答 1查看 88关注 0票数 1

我试着用Agda来理解共感应(我在读Sangiorgi的书)。我已经证明了流之间的一些简单等式,但是我不得不证明所有自然数(ℕ类型的值)都在流中--ℕ--函数--所有ℕ都是ℕ。有什么关于我该怎么做的建议吗?

代码语言:javascript
运行
复制
open import Coinduction
open import Data.Nat

module Simple where

   data Stream (A : Set) : Set where
     _∷_ : A → ∞ (Stream A) → Stream A

   infix 4 _∈_

   data _∈_ {A : Set} : A → Stream A → Set where
     here  : ∀ {x xs} → x ∈ x ∷ xs
     there : ∀ {x y xs} → (x ∈ ♭ xs) → x ∈ y ∷ xs

   enum : ℕ → Stream ℕ
   enum n = n ∷ (♯ enum (suc n))

   allℕ : Stream ℕ
   allℕ = enum 0

   allℕisℕ : ∀ (n : ℕ) → n ∈ allℕ
   allℕisℕ n = ?
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-02-25 19:46:21

分享完整的解决方案..。

代码语言:javascript
运行
复制
open import Coinduction
open import Data.Nat

module Simple where

  data Stream (A : Set) : Set where
    _∷_ : A → ∞ (Stream A) → Stream A

  infix 4 _∈_

  data _∈_ {A : Set} : A → Stream A → Set where
    here  : ∀ {x xs} → x ∈ x ∷ xs
    there : ∀ {x y xs} → (x ∈ ♭ xs) → x ∈ y ∷ xs

  enum : ℕ → Stream ℕ
  enum n = n ∷ (♯ enum (suc n))

  allℕ : Stream ℕ
  allℕ = enum 0

  ∈-suc : ∀ {n m : ℕ} → n ∈ enum m → suc n ∈ enum (suc m)
  ∈-suc here = here
  ∈-suc (there p) = there (∈-suc p)

  allℕisℕ : ∀ (n : ℕ) → n ∈ allℕ
  allℕisℕ zero = here
  allℕisℕ (suc n) = there (∈-suc (allℕisℕ n))
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28640248

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档