Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix is_prop, is_set etc. to satisfy type checking #84

Open
bvssvni opened this issue May 27, 2022 · 3 comments
Open

Fix is_prop, is_set etc. to satisfy type checking #84

bvssvni opened this issue May 27, 2022 · 3 comments

Comments

@bvssvni
Copy link
Contributor

bvssvni commented May 27, 2022

Currently, is_prop, is_set etc. doesn't satisfy type checking, because the following is not provable:

is_prop(x, a, b) & (a => x) & (b => c) => ((a == b) => x)

This might be thought of as:

A : Type
B : Type
--------
(A -> B, B -> A) : Type
@bvssvni
Copy link
Contributor Author

bvssvni commented May 27, 2022

In the case of is_prop, the definition can be changed to:

pub fn is_prop(x: u64, a: u64, b: u64) -> u64 {
    imply(
        and(imply(a, x), imply(b, x)),
        imply(eq(a, b), x)
    )
}

@bvssvni
Copy link
Contributor Author

bvssvni commented May 27, 2022

In the case of is_set, the definition can be changed to:

/// Defines a set relation from a set `x[0]` to potential members `a` and `b`.
///
/// `x[1]` is a propositional type storing equivalences.
pub fn is_set(x: [u64; 2], a: u64, b: u64) -> u64 {
    imply(
        and(imply(a, x[0]), imply(b, x[0])),
        imply(imply(eq(a, b), x[1]), imply(eq(qubit(a), qubit(b)), x[1]))
    )
}

@bvssvni
Copy link
Contributor Author

bvssvni commented May 27, 2022

An alternative is to make a language trade-off in design.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant