cicada-lang / cicada-solo Goto Github PK
View Code? Open in Web Editor NEWCicada Language (solo version)
Home Page: https://cicada-lang.org
License: GNU General Public License v3.0
Cicada Language (solo version)
Home Page: https://cicada-lang.org
License: GNU General Public License v3.0
datatype Bool {
true: Bool
false: Bool
}
datatype Nat {
zero: Bool
suc(pred: Nat): Bool
}
check! Nat.zero : Bool
Is this expected behavior?
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.
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.
I wonder whether there is or could be any knowledge and/or experience sharing between Cicada and Kind2 (or HVM).
https://github.com/Kindelia/Kind2
https://github.com/Kindelia/HVM
Thoughts?
For example, in cubical Agda
funExt : ∀ {ℓ} {A : Set ℓ} {B : A → Set ℓ} {f g : (x : A) → B x} →
((x : A) → f x ≡ g x) → f ≡ g
funExt p i x = p x i
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.