| 1 |
Typeclasses eauto := debug. |
| 2 |
Set Printing All. |
| 3 |
|
| 4 |
Axiom sProp : Set. |
| 5 |
Axiom sp : sProp. |
| 6 |
|
| 7 |
(* If we hardcode valueType := nat, it goes through *) |
| 8 |
Class StateIs := { |
| 9 |
valueType : Type; |
| 10 |
stateIs : valueType -> sProp |
| 11 |
}. |
| 12 |
|
| 13 |
#[export] Instance NatStateIs : StateIs := { |
| 14 |
valueType := nat; |
| 15 |
stateIs := fun _ => sp |
| 16 |
}. |
| 17 |
Canonical Structure NatStateIs. |
| 18 |
|
| 19 |
Class LogicOps F := { land: F -> F }. |
| 20 |
#[export] Instance : LogicOps sProp. Admitted. |
| 21 |
#[export] Instance : LogicOps Prop. Admitted. |
| 22 |
|
| 23 |
Parameter (n : nat). |
| 24 |
(* If this is a [Definition], the resolution goes through fine. *) |
| 25 |
Notation vn := (@stateIs _ n). |
| 26 |
Definition vn' := (@stateIs _ n). |
| 27 |
Definition GOOD : sProp := |
| 28 |
@land _ _ vn'. |
| 29 |
(* This doesn't resolve, if PropLogicOps is defined later than SPropLogicOps *) |
| 30 |
Definition BAD : sProp := |
| 31 |
@land _ _ vn. |
| 32 |
|
| 33 |
|
| 34 |
Class A T := { foo : T -> Prop }. |
| 35 |
#[export] Instance: A nat. Admitted. |
| 36 |
#[export] Instance: A Set. Admitted. |
| 37 |
|
| 38 |
Class B := { U : Type ; b : U }. |
| 39 |
#[export] Instance bi: B := {| U := nat ; b := 0 |}. |
| 40 |
Canonical Structure bi. |
| 41 |
|
| 42 |
Notation b0N := (@b _ : nat). |
| 43 |
Notation b0Ni := (@b bi : nat). |
| 44 |
Definition b0D := (@b _ : nat). |
| 45 |
Definition GOOD1 := (@foo _ _ b0D). |
| 46 |
Definition GOOD2 := (let x := b0N in @foo _ _ x). |
| 47 |
Definition GOOD3 := (@foo _ _ b0Ni). |
| 48 |
Definition BAD1 := (@foo _ _ b0N). (* Error: The term "b0Ni" has type "nat" while it is expected to have type "Set". *) |