You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is not possible to pattern match on terms
belonging to the sig type family in the following Program Definitions,
because the witnesses seem to get projected out by some hidden coercion.
However, changing sig into sigT or Ssig will allow
implementing the inspect pattern just fine.
From Coq RequireImport Lia Logic.StrictProp NArith.NArith.
ObligationTactic := idtac.
SectionContext.
Import N.
LocalOpenScope N_scope.
Context (f : N -> N) (mono : forall (a b : N) (l : a < b), f a < f b).
PrintCoercions.
FailProgramDefinition f_inspect (n : N) : positive :=
let m := f (succ n) - f n inmatch exist _ m (eq_refl m) with
| exist _ N0 e => _
| exist _ (Npos p) e => p
end.
FailProgramDefinition f_inspect (n : N) : positive :=
let m := f (succ n) - f n inmatch exist _ m (eq_refl m) in sig _ return positive with
| exist _ N0 e => _
| exist _ (Npos p) e => p
end.
ProgramDefinition f_inspect (n : N) : positive :=
let m := f (succ n) - f n inmatch existT _ m (eq_refl m) in sigT _ return positive with
| existT _ N0 e => _
| existT _ (Npos p) e => p
end.
NextObligation. intros n m _ _ e. pose proof mono n (succ n) as l. lia. Qed.
ProgramDefinition f_inspect' (n : N) : positive :=
let m := f (succ n) - f n inmatch Sexists (fun n : N => Squash (m = n)) m (squash (eq_refl m)) in
Ssig _ return positive with
| Sexists _ N0 e => _
| Sexists _ (Npos p) e => p
end.
NextObligation.
intros n m _ _ e'.
exfalso. apply sEmpty_ind. induction e' as [e].
pose proof mono n (succ n) as l. lia. Qed.
EndContext.
The command has indeed failed with message:
Found a constructor of inductive type sig while a constructor of N is expected.
The command has indeed failed with message:
Wrong inductive type.
Version
Coq 8.13.2
Operating system
Red Hat Enterprise Linux Workstation 7.4
Description of the problem
It is not possible to pattern match on terms
belonging to the
sig
type family in the followingProgram Definition
s,because the witnesses seem to get projected out by some hidden coercion.
However, changing
sig
intosigT
orSsig
will allowimplementing the inspect pattern just fine.
Notes
This may be related to coq/coq#4341 or coq/coq#10877.
The text was updated successfully, but these errors were encountered: