Giter VIP home page Giter VIP logo

Comments (3)

AliasQli avatar AliasQli commented on June 1, 2024 1

I fixed the code and this should do:

datatype Set {
  set(X: Type, y: (X) -> Set): Set
}

function carrier(s: Set): Type {
  return induction(s) {
    (_) => Type
    case set(x, _) => x
  }
}

function index(s: Set): (carrier(s)) -> Set {
  return induction(s) {
    (s) => (carrier(s)) -> Set
    case set(_, y) => y
  }
}

function In(a: Set, b: Set): Type {
  return [ x : carrier(b) | Equal(Set,a,index(b)(x)) ]
}

function NotIn(a: Set, b: Set): Type {
  return (In(a, b)) -> Absurd
}

let Δ = Set.set([s: Set| NotIn(s,s)], (pair) => car(pair))
// check! Δ: Set

// For every x ∉ x, x ∈ Δ. (By definition of Δ.)
function xNotInx_xInΔ(x: Set, xNotInx: NotIn(x, x)): In(x, Δ) {
  return cons(cons(x, xNotInx), refl)
}

function equal_swap
  ( implicit A: Type
  , implicit x: A
  , implicit y: A
  , xy_equal: Equal(A, x, y)
  ):Equal(A, y, x) {
  return replace
    ( xy_equal
    , (w) => Equal(A, w, x)
    , refl
    )
}

// For every x ∈ Δ, x ∉ x. (By definition of Δ.)
function xInΔ_xNotInx(x: Set, xInΔ: In(x, Δ)): NotIn(x,x) {
  return replace
    ( equal_swap(cdr(xInΔ))
    , (s) => NotIn(s,s)
    , cdr(car(xInΔ))
    )
}

// Hence, Δ ∉ Δ.
let ΔNotInΔ: NotIn(Δ, Δ) = (ΔInΔ) => { return xInΔ_xNotInx(Δ, ΔInΔ)(ΔInΔ) }

// However, that means Δ ∈ Δ, which is absurd.
let falso: Absurd = ΔNotInΔ(xNotInx_xInΔ(Δ, ΔNotInΔ))

However, when I finally got falso, cic ran into an error:

RangeError: Maximum call stack size exceeded
    at ImplicitApCore.evaluate (/home/user/.local/lib/node_modules/@cicada-lang/cicada/lib/lang/exps/implicit-pi/implicit-ap-core.js:37:13)
    at evaluate (/home/user/.local/lib/node_modules/@cicada-lang/cicada/lib/lang/core/evaluate.js:7:16)
    at ImplicitApCore.evaluate (/home/user/.local/lib/node_modules/@cicada-lang/cicada/lib/lang/exps/implicit-pi/implicit-ap-core.js:38:57)
    at evaluate (/home/user/.local/lib/node_modules/@cicada-lang/cicada/lib/lang/core/evaluate.js:7:16)
    at ImplicitApCore.evaluate (/home/user/.local/lib/node_modules/@cicada-lang/cicada/lib/lang/exps/implicit-pi/implicit-ap-core.js:38:57)
    at evaluate (/home/user/.local/lib/node_modules/@cicada-lang/cicada/lib/lang/core/evaluate.js:7:16)
    at ApCore.evaluate (/home/user/.local/lib/node_modules/@cicada-lang/cicada/lib/lang/exps/pi/ap-core.js:36:49)
    at evaluate (/home/user/.local/lib/node_modules/@cicada-lang/cicada/lib/lang/core/evaluate.js:7:16)
    at ApCore.evaluate (/home/user/.local/lib/node_modules/@cicada-lang/cicada/lib/lang/exps/pi/ap-core.js:36:49)
    at evaluate (/home/user/.local/lib/node_modules/@cicada-lang/cicada/lib/lang/core/evaluate.js:7:16)

Which I think is because cic can't handle a value with type Absurd.

from cicada-solo.

ksqsf avatar ksqsf commented on June 1, 2024

Actually, Cicada can have Absurd-typed terms. Just abuse the bug in #11 :

datatype WTF {
  wtf: Absurd
}
check! WTF.wtf: Absurd

from cicada-solo.

xieyuheng avatar xieyuheng commented on June 1, 2024

@ksqsf @AliasQli Thanks guys!

Great works.

I will learn about this example, and add it to The Manual.

from cicada-solo.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.