This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ///| | |
| type Zero | |
| ///| | |
| type Succ[N] | |
| ///| | |
| trait Nat {} | |
| ///| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct arc { | |
| int32_t rc; | |
| uv_mutex_t mutex; | |
| }; | |
| typedef void* moonbit_reference_t; | |
| struct arc_ref { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ///| | |
| test "split internal iterator" { | |
| let xs = [1, 2, 3, 4, 5] | |
| let iter = xs.iter().drop(4) | |
| inspect!(xs.iter().last(), content="Some(5)") | |
| inspect!(iter.head(), content="Some(5)") | |
| } | |
| ///| | |
| priv type ImmutExIter[A] () -> (A, ImmutExIter[A])? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Data.Function (fix) | |
| -- lazy pattern match example | |
| (is_odd, is_even) = | |
| fix | |
| ( \ ~(is_odd, is_even) -> | |
| ( (\n -> if n == 0 then False else is_even (n - 1)) | |
| , (\n -> if n == 0 then True else is_odd (n - 1)) | |
| ) | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Require Import Classical_Prop. | |
| Require Import ClassicalFacts. | |
| (* https://math.stackexchange.com/questions/447098/why-peirces-law-implies-law-of-excluded-middle *) | |
| Definition strengthen : | |
| forall P : Prop, | |
| (P \/ ~P -> False) -> ~P | |
| := | |
| fun P H p => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (* https://math.stackexchange.com/questions/447098/why-peirces-law-implies-law-of-excluded-middle *) | |
| Definition strengthen : | |
| forall P : Prop, | |
| (P \/ ~P -> False) -> ~P | |
| := | |
| fun P H p => | |
| let e : ~P := fun p => H (or_introl p) in | |
| H (or_intror e) | |
| . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Require Import Classical_Prop. | |
| Require Import ClassicalFacts. | |
| Definition NNPP' : forall P:Prop, | |
| excluded_middle -> (~ ~ P -> P) | |
| := | |
| fun P em => | |
| let e1 := em P in | |
| match e1 with | |
| | or_intror r => fun p => False_ind P (p r) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (* | |
| word based completion list | |
| https://www.cs.cornell.edu/courses/cs3110/2018sp/a5/coq-tactics-cheatsheet.html | |
| assumption reflexivity trivial auto discriminate exact contradiction Transforming goals | |
| intros / intro simpl unfold apply rewrite inversion left / right replace Breaking apart goals and hypotheses |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (* | |
| 用 Gallina 重写的一个版本 | |
| ref: Tactics Version | |
| Coq里的排中律 - 遇到困难睡大觉的文章 - 知乎 | |
| https://zhuanlan.zhihu.com/p/361454504 | |
| *) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (* https://www.cs.cornell.edu/courses/cs3110/2018sp/a5/coq-tactics-cheatsheet.html *) | |
| Definition ex0 : | |
| forall n : nat, | |
| 0 = 1 -> 0 = 1 + n | |
| := | |
| fun n e1 => | |
| nat_ind | |
| (fun n => 0 = 1 + n) | |
| e1 |
NewerOlder