获取假名'类型 我正在寻找一种通过它的名字获得假名以匹配它的方法。就像这样: Ltac mytactic h_name :=
let h := hyp_from_name h_name in
match h with
| _ /\ _ => do_something
| _ => print_error_message
end
.
这将是像这样使用:
的元素,类型为A的一个简单的归纳定义: Inductive A: Set := mkA : nat-> A.
(*get ID of A*)
Function getId (a: A) : nat := match a with mkA n => n end.
和子类型的定义: (* filter that test ID of *A* is 0 *)
Function filter
对于从属类型,它可以定义一个感应式的有序列表,例如: data IsSorted : {a: Type} -> (ltRel: (a -> a -> Type)) -> List a -> Type where
IsSortedZero : IsSorted {a=a} ltRel Nil
IsSortedOne : (x: a) -> IsSorted ltRel [x]
SIG类型的元素随着SIG类型确定指标,如: Inductive A: Set := mkA : nat-> A.
Function getId (a: A) : nat := match a with mkA n => n end.
Function filter (a: A) : bool := if (beq_nat (getId a) 0) then true else false.
Section Definitions.
Definition eq_dec X := forall x y : X, {x=y} + {x <> y}.
Existing Class eq_dec.
(* Any function that uses eq_dec. Doesn't matter -- ↓ ↓ ↓ *)
Definition f {X: