Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Dependent type 如何在精益中证明编译时的关系?_Dependent Type_Type Theory_Lean - Fatal编程技术网

Dependent type 如何在精益中证明编译时的关系?

Dependent type 如何在精益中证明编译时的关系?,dependent-type,type-theory,lean,Dependent Type,Type Theory,Lean,假设我有一个类型: inductive is_sorted {α: Type} [decidable_linear_order α] : list α -> Prop | is_sorted_zero : is_sorted [] | is_sorted_one : Π (x: α), is_sorted [x] | is_sorted_many : Π {x y: α} {ys: list α}, x < y -> is_sorted (y::ys) -> is_sor

假设我有一个类型:

inductive is_sorted {α: Type} [decidable_linear_order α] : list α -> Prop
| is_sorted_zero : is_sorted []
| is_sorted_one : Π (x: α), is_sorted [x]
| is_sorted_many : Π {x y: α} {ys: list α}, x < y -> is_sorted (y::ys) -> is_sorted (x::y::ys)
如果我有一个特定的列表:

def l1:列表ℕ := [2,3,4,5,16,66]

是否有可能证明它是在“编译时”排序的;要生成
,是否在顶层对l1
进行排序

我试过
def l1\u sorted:is\u sorted l1:=如果H:is\u sorted l1,那么H else对不起
,但我不知道如何证明后一种情况是不可能的。我也尝试了
simp
策略,但似乎没有效果


我可以用
#reduce
来证明它,但是不可能把它的输出分配给一个变量。

你应该能够使用
dec\u trial
来证明
l1\u排序的
。这将尝试推断
可判定(is_sorted l1)
的实例,如果该实例的计算结果为
is_true p
,它将减少为
p

,我将如何编写它
引理l1_排序:is_排序l1:=by dec_Trial
不起作用,也不起作用,
引理l1_排序:is_排序l1:=dec_Trial
这似乎失败了:
推断类型失败,未知变量替代了1 of_as_true:∀ {c:Prop}[h₁ : 可判定的c],如真c→ c
事实上,我的问题是我有了
实例可判定\u排序
而不是
实例可判定\u排序
,我没有意识到查找是基于名称的,对不起。
instance decidable_sorted {α: Type} [decidable_linear_order α] : ∀ (l : list α), decidable (is_sorted l)