Mit einer einfachen induktiven Definition eines Typs A
konstruieren Gusselement von A
zu subsetA
, wenn filter
übergibt, aber nicht zur Bequemlichkeit Coq, dass es eine gültige Konstruktion für ein Element von "Sig" Typ ist:In Coq, wie ein Element von 'sig' Typ
Definition cast (a: A) : option subsetA :=
match (filter a) with
| true => Some (exist _ a (IstrueB (filter a)))
| false => None
end.
Fehler:
In environment
a : A
The term "IstrueB (filter a)" has type "Prop"
while it is expected to have type "?P a"
(unable to find a well-typed instantiation for "?P": cannot ensure that
"A -> Type" is a subtype of "[email protected]{__:=a} -> Prop").
So erwartet Coq einen tatsächlichen Beweis Typ (IstrueB (filter a))
, aber was stelle ich ist es Prop
geben.
Könnten Sie etwas Licht auf, wie man solche Art zur Verfügung stellen? Danke.
Es gibt auch 'Is_true' in' Bool'. – eponier