獲取假名'類型 我正在尋找一種通過它的名字獲得假名以匹配它的方法。就像這樣: 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: