Skip to content

Commit 8d1b637

Browse files
committed
prop: remove definition of Prop
1 parent d897118 commit 8d1b637

File tree

18 files changed

+12
-129
lines changed

18 files changed

+12
-129
lines changed

Diff for: base/src/main/java/org/aya/concrete/Expr.java

+5-15
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ record Lift(@NotNull SourcePos sourcePos, @NotNull Expr expr, int lift) implemen
332332
return expr == expr() ? this : new Lift(sourcePos, expr, lift);
333333
}
334334

335-
@Override public @NotNull Expr.Lift descent(@NotNull UnaryOperator<@NotNull Expr> f) {
335+
@Override public @NotNull Lift descent(@NotNull UnaryOperator<@NotNull Expr> f) {
336336
return update(f.apply(expr));
337337
}
338338
}
@@ -341,7 +341,7 @@ record Lift(@NotNull SourcePos sourcePos, @NotNull Expr expr, int lift) implemen
341341
* @author tsao-chi
342342
*/
343343
record RawSort(@NotNull SourcePos sourcePos, @NotNull SortKind kind) implements Expr {
344-
@Override public @NotNull Expr.RawSort descent(@NotNull UnaryOperator<@NotNull Expr> f) {
344+
@Override public @NotNull RawSort descent(@NotNull UnaryOperator<@NotNull Expr> f) {
345345
return this;
346346
}
347347
}
@@ -351,7 +351,7 @@ sealed interface Sort extends Expr {
351351

352352
SortKind kind();
353353

354-
@Override default @NotNull Expr.Sort descent(@NotNull UnaryOperator<@NotNull Expr> f) {
354+
@Override default @NotNull Sort descent(@NotNull UnaryOperator<@NotNull Expr> f) {
355355
return this;
356356
}
357357
}
@@ -368,16 +368,6 @@ record Set(@NotNull SourcePos sourcePos, @Override int lift) implements Sort {
368368
}
369369
}
370370

371-
record Prop(@NotNull SourcePos sourcePos) implements Sort {
372-
@Override public int lift() {
373-
return 0;
374-
}
375-
376-
@Override public SortKind kind() {
377-
return SortKind.Prop;
378-
}
379-
}
380-
381371
record ISet(@NotNull SourcePos sourcePos) implements Sort {
382372
@Override public int lift() {
383373
return 0;
@@ -487,13 +477,13 @@ record Match(
487477
* @author kiva
488478
*/
489479
record LitInt(@NotNull SourcePos sourcePos, int integer) implements Expr {
490-
@Override public @NotNull Expr.LitInt descent(@NotNull UnaryOperator<@NotNull Expr> f) {
480+
@Override public @NotNull LitInt descent(@NotNull UnaryOperator<@NotNull Expr> f) {
491481
return this;
492482
}
493483
}
494484

495485
record LitString(@NotNull SourcePos sourcePos, @NotNull String string) implements Expr {
496-
@Override public @NotNull Expr.LitString descent(@NotNull UnaryOperator<@NotNull Expr> f) {
486+
@Override public @NotNull LitString descent(@NotNull UnaryOperator<@NotNull Expr> f) {
497487
return this;
498488
}
499489
}

Diff for: base/src/main/java/org/aya/concrete/desugar/Desugarer.java

-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ public static class DesugarInterruption extends Exception {}
5454
case Expr.RawSort(var pos, var kind) -> switch (kind) {
5555
case Type -> new Expr.Type(pos, 0);
5656
case Set -> new Expr.Set(pos, 0);
57-
case Prop -> new Expr.Prop(pos);
5857
case ISet -> new Expr.ISet(pos);
5958
};
6059
case Expr.BinOpSeq(var pos, var seq) -> {

Diff for: base/src/main/java/org/aya/core/term/PiTerm.java

+2-7
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,14 @@ case PiTerm(var param, var body) when param.explicit() -> {
6969
case Type -> switch (codomain.kind()) {
7070
case Type, Set -> new SortTerm(SortKind.Type, Math.max(alift, blift));
7171
case ISet -> new SortTerm(SortKind.Set, alift);
72-
case Prop -> codomain;
7372
};
7473
case ISet -> switch (codomain.kind()) {
75-
case ISet, Prop -> SortTerm.Set0;
74+
case ISet -> SortTerm.Set0;
7675
case Set, Type -> codomain;
7776
};
7877
case Set -> switch (codomain.kind()) {
7978
case Set, Type -> new SortTerm(SortKind.Set, Math.max(alift, blift));
80-
case ISet, Prop -> new SortTerm(SortKind.Set, alift);
81-
};
82-
case Prop -> switch (codomain.kind()) {
83-
case Prop, Type -> codomain;
84-
default -> new SortTerm(SortKind.Set, blift);
79+
case ISet -> new SortTerm(SortKind.Set, alift);
8580
};
8681
};
8782
}

Diff for: base/src/main/java/org/aya/core/term/SigmaTerm.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ public record SigmaTerm(@NotNull ImmutableSeq<@NotNull Param> params) implements
3030

3131
public static @NotNull SortTerm lub(@NotNull SortTerm x, @NotNull SortTerm y) {
3232
int lift = Math.max(x.lift(), y.lift());
33-
if (x.kind() == SortKind.Prop || y.kind() == SortKind.Prop) {
34-
return SortTerm.Prop;
35-
} else if (x.kind() == SortKind.Set || y.kind() == SortKind.Set) {
33+
if (x.kind() == SortKind.Set || y.kind() == SortKind.Set) {
3634
return new SortTerm(SortKind.Set, lift);
3735
} else if (x.kind() == SortKind.Type || y.kind() == SortKind.Type) {
3836
return new SortTerm(SortKind.Type, lift);

Diff for: base/src/main/java/org/aya/core/term/SortTerm.java

-2
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,13 @@ public SortTerm(@NotNull SortKind kind, int lift) {
2626
public static final @NotNull SortTerm Set0 = new SortTerm(SortKind.Set, 0);
2727
public static final @NotNull SortTerm Set1 = new SortTerm(SortKind.Set, 1);
2828
public static final @NotNull SortTerm ISet = new SortTerm(SortKind.ISet, 0);
29-
public static final @NotNull SortTerm Prop = new SortTerm(SortKind.Prop, 0);
3029

3130
/**
3231
* <a href="https://github.com/agda/agda/blob/6a92d584c70a615fdc3f364975814d75a0e31bf7/src/full/Agda/TypeChecking/Substitute.hs#L1541-L1558">Agda</a>
3332
*/
3433
public @NotNull SortTerm succ() {
3534
return switch (kind) {
3635
case Type, Set -> new SortTerm(kind, lift + 1);
37-
case Prop -> Type0;
3836
case ISet -> Set1;
3937
};
4038
}

Diff for: base/src/main/java/org/aya/generic/SortKind.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// Copyright (c) 2020-2022 Tesla (Yinsen) Zhang.
1+
// Copyright (c) 2020-2023 Tesla (Yinsen) Zhang.
22
// Use of this source code is governed by the MIT license that can be found in the LICENSE.md file.
33
package org.aya.generic;
44

55
public enum SortKind {
6-
Type, Set, Prop, ISet;
6+
Type, Set, ISet;
77

88
public boolean hasLevel() {
99
return this == Type || this == Set;

Diff for: base/src/main/java/org/aya/tyck/pat/PatternProblem.java

-10
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,6 @@ record UnavailableCtor(
6464
}
6565
}
6666

67-
record IllegalPropPat(
68-
@Override @NotNull Pattern pattern
69-
) implements PatternProblem {
70-
@Override public @NotNull Doc describe(@NotNull PrettierOptions options) {
71-
return Doc.vcat(
72-
Doc.english("Prop pattern is disallowed in this context:"),
73-
Doc.par(1, pattern.toDoc(options)));
74-
}
75-
}
76-
7767
record UnknownCtor(@Override @NotNull Pattern pattern) implements PatternProblem {
7868
@Override public @NotNull Doc describe(@NotNull PrettierOptions options) {
7969
return Doc.vcat(

Diff for: base/src/main/java/org/aya/tyck/unify/Synthesizer.java

-4
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ public boolean inheritPiDom(@NotNull Term type, @NotNull SortTerm expected) {
4646
}
4747
if (!(tryPress(type) instanceof SortTerm actual)) return false;
4848
return switch (expected.kind()) {
49-
case Prop -> switch (actual.kind()) {
50-
case Prop, Type -> true;
51-
case Set, ISet -> false;
52-
};
5349
case Type -> actual.kind() != SortKind.Set && actual.lift() <= expected.lift();
5450
case Set -> actual.lift() <= expected.lift();
5551
case ISet -> unreachable(type);

Diff for: base/src/main/java/org/aya/tyck/unify/TermComparator.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ private static boolean sortLt(SortTerm l, SortTerm r) {
9595
case ISet, Set -> true;
9696
default -> false;
9797
};
98-
case Prop -> r.kind() == SortKind.Prop;
9998
case Set -> r.kind() == SortKind.Set && lift <= rift;
10099
};
101100
}
@@ -253,6 +252,7 @@ private boolean doCompareTyped(@NotNull Term type, @NotNull Term lhs, @NotNull T
253252
// Note that it looks tempting to apply some unification here, but it is not correct:
254253
// If ?x =_A y where A : Prop, then it may not be the case that ?x is y!
255254
// I think Arend has probably made such a mistake before, but they removed this feature anyway.
255+
// TODO: revise the above, because `Prop` is now removed
256256
traceEntrance(new Trace.UnifyT(lhs.freezeHoles(state), rhs.freezeHoles(state),
257257
pos, type.freezeHoles(state)));
258258
var ret = switch (type) {

Diff for: base/src/test/java/org/aya/repr/ShapeMatcherTest.java

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ open data Fin (n : Nat) | suc n => fzero | suc n => fsuc (Fin n)
4141

4242
@Test
4343
public void matchList() {
44-
match(true, AyaShape.LIST_SHAPE, "data List (A : Prop) | nil | cons A (List A)");
4544
match(true, AyaShape.LIST_SHAPE, "data List (A : Type) | nil | cons A (List A)");
4645
match(true, AyaShape.LIST_SHAPE, "data List (A : Type) | cons A (List A) | nil");
4746
match(true, AyaShape.LIST_SHAPE, "data List (A : Type) | nil | infixr :< A (List A)");

Diff for: base/src/test/resources/failure/projection/issues2/issue879.aya

-5
This file was deleted.

Diff for: base/src/test/resources/failure/projection/issues2/issue879.aya.txt

-15
This file was deleted.

Diff for: base/src/test/resources/failure/tyck/erased2.aya

-6
This file was deleted.

Diff for: base/src/test/resources/failure/tyck/erased2.aya.txt

-12
This file was deleted.

Diff for: base/src/test/resources/success/common/src/Arith/Nat/Encoding.aya

-17
This file was deleted.

Diff for: base/src/test/resources/success/src/Issues/874.aya

-11
This file was deleted.

Diff for: base/src/test/resources/success/src/Sorts.aya

-16
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,7 @@ def c: Set 1 => ISet
66
def e: Set 2 => Unit -> Set 1
77
def d: e => \u => ISet
88

9-
def f: Prop => Sig (A : Prop) ** A
10-
119
open data Rua : Set | rua
1210
open import Paths
1311
def II : ISet => Sig I ** I
1412
def test : II => (0 , 0)
15-
16-
open data Disj (A B : Prop) : Prop
17-
| inl (a : A)
18-
| inr (b : B)
19-
20-
variable A : Type
21-
22-
// Leibniz equality using impredicative universe of propositions
23-
def Leibniz (x y : A) : Prop
24-
=> Fn (P : A → Prop) → P x → P y
25-
26-
def refl (a : A) : Leibniz a a => \p x => x
27-
def symm {x y : A} (p : Leibniz x y)
28-
: Leibniz y x => p (\ y' => Leibniz y' x) (refl _)

Diff for: cli-impl/src/test/java/org/aya/cli/ReplCompilerTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class ReplCompilerTest {
3737
}
3838

3939
@Test public void simpleExpr() {
40-
compile("Prop");
40+
compile("Set");
4141
}
4242

4343
@Test public void issue382() {

0 commit comments

Comments
 (0)