需要帮助在 Agda 中将数字转换为字符串

Need help converting number to string in Agda

Agda 新手。我想要一种从代码中获取一些输出的方法,所以我正在寻找一种打印数字的方法。在标准 library 中找到一个函数,但我无法导入它。我得到以下信息:

Unsolved metas at the following locations:
  /home/user/agda-stdlib-1.7/src/Data/List/Relation/Unary/Any/Properties.agda:100,17-18
  /home/user/agda-stdlib-1.7/src/Data/List/Relation/Unary/Any/Properties.agda:105,16-17
  /home/user/agda-stdlib-1.7/src/Data/List/Relation/Unary/Any/Properties.agda:105,28-29
when scope checking the declaration
  open import Data.List.Relation.Unary.Any.Properties

Failed to solve the following constraints:
  Check definition of to∘from : {P.A.a : Level} {P.A : Set P.A.a}
                                {P.p : Level} {P = P₁ : Pred P.A P.p} {Q.A.a : Level}
                                {Q.A : Set Q.A.a} {Q.p : Level} {Q = Q₁ : Pred Q.A Q.p}
                                {xs = xs₁ : List P.A} {ys = ys₁ : List Q.A}
                                (pq
                                 : Any (λ x → Any (λ y → Prod.Σ (P₁ x) (λ x₁ → Q₁ y)) ys₁) xs₁) →
                                Any-×⁺ (Any-×⁻ pq) ≡ pq
    stuck because
      /home/user/agda-stdlib-1.7/src/Data/List/Relation/Unary/Any/Properties.agda:266,3-34
      I'm not sure if there should be a case for the constructor refl,
      because I get stuck when trying to solve the following unification
      problems (inferred index ≟ expected index):
        lhs ≟ Any.map
              (λ x →
                 Any.map (λ q → P.subst P x p , q)
                 (Any.map
                  (λ x₁ →
                     P.subst Q x₁
                     (_5474 (x = x₂) (pq′ = pq′) (y = y) (y∈ys = y∈ys) (p = p) (q = q)
                      (lem₂ = lem₂) (pq = pq) (x∈xs = x∈xs) (lem₁ = lem₁)
                      (p = (P.subst P x p))))
                  y∈ys))
              x∈xs
      when checking that the pattern refl has type
      lhs ≡.map(λ x →
         Any.map (λ q → P.subst P x p , q)
         (Any.map
          (λ x₁ →
             P.subst Q x₁
             (_5474 (x = x₂) (pq′ = pq′) (y = y) (y∈ys = y∈ys) (p = p) (q = q)
              (lem₂ = lem₂) (pq = pq) (x∈xs = x∈xs) (lem₁ = lem₁)
              (p = (P.subst P x p))))
          y∈ys))
      x∈xs
    (blocked on any(_Q.p_474, _P.p_475))
when scope checking the declaration
  open import Data.List.Relation.Unary.Any.Properties

Any help? :)

问题说文件中有一个未填充的洞

Data/List/Relation/Unary/Any/Properties.agda

这是一个来自标准库的文件,所以有两个可能的原因:

  • 您以某种方式修改了这个文件,这似乎不太可能
  • 您克隆了 agda-stdlib 存储库的开发版本,但没有检出发布标签

假设这是第二个选项,您需要进入 agda-stdlib 文件夹并发出以下命令:

git fetch --all --tags
git checkout tags/v1.7.1

完成此操作后,您应该能够导入 Data.Nat.Show 并使用该模块中的函数,就像从任何其他模块中一样。