Giter VIP home page Giter VIP logo

cicada-solo's Introduction

Cicada Language

This is an old implementation of cicada language before we have an active team.

please see cicada-lang/cicada for new developments.

[ HOMEPAGE | MANUAL | ABOUT ]

Welcome *^-^*/

Cicada language is a dependently typed programming language and an interactive theorem prover.

The aim of cicada project is to help people understand that developing software and developing mathematics are increasingly the same kind of activity, and people who practice these developments can learn from each other, and help each other in very good ways.

Development

npm install     # Install dependencies
npm run build   # Compile `src/` to `lib/`
npm run watch   # Watch the compilation
npm run format  # Format the code
npm run test    # Run test

Thanks

Thanks, PLCT Lab, for sponsoring our community at very early stage of our project.

Thank you, Dan Friedman, for we learned most of our knowledge about programming language design from your little books.

Thank you, David Christiansen, for coauthoring "The Little Typer" with Dan, and writing up great tutorials (1, 2) about dependent types.

Contributions

To make a contribution, fork this project and create a pull request.

Please read the STYLE-GUIDE.md before you change the code.

Remember to add yourself to AUTHORS. Your line belongs to you, you can write a little introduction to yourself but not too long.

License

GPLv3

cicada-solo's People

Contributors

mio-19 avatar xieyuheng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cicada-solo's Issues

Define Bools in Nat?

datatype Bool {
  true: Bool
  false: Bool
}

datatype Nat {
  zero: Bool
  suc(pred: Nat): Bool
}

check! Nat.zero : Bool

Is this expected behavior?

Type: Type can lead to Russell's paradox

The following piece of code is a direct replay of The Trouble of Typing Type as Type in Cicada.

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)
}

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

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

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

However, the type checker rejects the code above for dubious reasons:

I infer the type to be:
  (_: [x1: induction (car(car(xInΔ))) { (_) => Type case set(x1, _) => x1 } | Equal(Set, car(car(xInΔ)), induction (car(car(xInΔ))) { (s1) => (_: induction (s1) { (_) => Type case set(x2, _) => x2 }) -> Set case set(_, y, _1) => y(_1) }(x1))]) -> Absurd
But the expected type is:
  (_: [x1: induction (x) { (_) => Type case set(x1, _) => x1 } | Equal(Set, x, induction (x) { (s1) => (_: induction (s1) { (_) => Type case set(x2, _) => x2 }) -> Set case set(_, y, _1) => y(_1) }(x1))]) -> Absurd

Paradox.cic:
 39 |
 40 |// For every x ∈ Δ, x ∉ x. (By definition of Δ.)
 41 |function xInΔ_xNotInx(x: Set, xInΔ: In(x, Δ)): NotIn(x,x) {
 42 |  return cdr(car(xInΔ))
 43 |}
 44 |

I'm not sure how to show car(car(xInΔ))) is definitionally equivalent to x in this context, but I think it is perfectly valid to say car(car(xInΔ))) == x. And the root cause of inconsistency (if ever proved) here is Type : Type, which is accepted by the type checker.

Apply for Contributing

I'm looking forward to the internship envolving in the proof assistant development.
@xieyuheng, I sent one email to you as for my CV and other info, please check it.

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.