簡體   English   中英

如何使用具有匹配模式的定理

[英]How to use a theorem with a match pattern

基本上,我有一個函數,以及一個關於這個函數的一些性質的定理。

該函數具有以下簽名:

Fixpoint compute_solution (s : list nat) : (option list nat) := 
...=> None
...=> Some l

定理是:

Theorem solution_is_correct:
  forall (s : list nat), length s = 9 * 9 ->
       match compute_solution s with
         None => forall s1, length s1 = 9 *9  -> ~ nice_property s1
       | Some s1 => nice_property s1
       end.

現在,當我嘗試證明一個附加定理時,我最終處於以下情況:

s: list nat
Hs: length s = 9 * 9
prem: list nat
sol: compute_solution s = Some prem
...
================================
nice_property prem

如何利用 solution_is_correct 來證明目標?

謝謝您的幫助。

這應該工作

pose proof (solution_is_correct s Hs) as Tmp.
rewrite sol in Tmp.

但我寧願重新設計定理以使其更有用,例如

thm1 : forall s l, ... -> compute_solution s = Some l -> nice_property l
thm2 : forall s, ... -> compute_solution s = None -> ...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM