updates to playground help/comments
This commit is contained in:
@@ -1,48 +1,47 @@
|
|||||||
module Reasoning
|
module Reasoning
|
||||||
|
|
||||||
infix 4 _≡_
|
-- From the "Lists" chapter of Programming Language Foundations in Agda
|
||||||
data _≡_ : {A : U} → A → A → U where
|
-- https://plfa.github.io/Lists/
|
||||||
Refl : ∀ A. {x : A} → x ≡ x
|
|
||||||
|
|
||||||
sym : ∀ A. {x y : A} → x ≡ y → y ≡ x
|
-- We define a few types and functions on lists and prove a couple of properties
|
||||||
|
-- about them. This example demonstrates mixfix operators.
|
||||||
|
|
||||||
|
infix 4 _≡_
|
||||||
|
data _≡_ : ∀ A. A → A → U where
|
||||||
|
Refl : ∀ A. {0 x : A} → x ≡ x
|
||||||
|
|
||||||
|
sym : ∀ A. {0 x y : A} → x ≡ y → y ≡ x
|
||||||
sym Refl = Refl
|
sym Refl = Refl
|
||||||
|
|
||||||
trans : ∀ A. {x y z : A} → x ≡ y → y ≡ z → x ≡ z
|
trans : ∀ A. {0 x y z : A} → x ≡ y → y ≡ z → x ≡ z
|
||||||
trans Refl eq = eq
|
trans Refl eq = eq
|
||||||
|
|
||||||
cong : ∀ A B. (f : A → B) {x y : A}
|
cong : ∀ A B. (0 f : A → B) {0 x y : A}
|
||||||
→ x ≡ y
|
→ x ≡ y
|
||||||
→ f x ≡ f y
|
→ f x ≡ f y
|
||||||
cong f Refl = Refl
|
cong f Refl = Refl
|
||||||
|
|
||||||
cong-app : ∀ A B. {f g : A → B}
|
cong-app : ∀ A B. {0 f g : A → B}
|
||||||
→ f ≡ g
|
→ f ≡ g
|
||||||
→ (x : A) → f x ≡ g x
|
→ (0 x : A) → f x ≡ g x
|
||||||
cong-app Refl = λ y => Refl
|
cong-app Refl = λ y => Refl
|
||||||
|
|
||||||
infixl 1 begin_
|
infixl 1 begin_
|
||||||
infixr 2 _≡⟨⟩_ _≡⟨_⟩_
|
infixr 2 _≡⟨⟩_ _≡⟨_⟩_
|
||||||
infixl 3 _∎
|
infixl 3 _∎
|
||||||
|
|
||||||
begin_ : ∀ A. {x y : A} → x ≡ y → x ≡ y
|
begin_ : ∀ A. {0 x y : A} → x ≡ y → x ≡ y
|
||||||
begin x≡y = x≡y
|
begin x≡y = x≡y
|
||||||
|
|
||||||
_≡⟨⟩_ : ∀ A. (x : A) {y : A} → x ≡ y → x ≡ y
|
_≡⟨⟩_ : ∀ A. (0 x : A) {0 y : A} → x ≡ y → x ≡ y
|
||||||
x ≡⟨⟩ x≡y = x≡y
|
x ≡⟨⟩ x≡y = x≡y
|
||||||
|
|
||||||
_≡⟨_⟩_ : ∀ A. (x : A) {y z : A} → x ≡ y → y ≡ z → x ≡ z
|
_≡⟨_⟩_ : ∀ A. (0 x : A) {0 y z : A} → x ≡ y → y ≡ z → x ≡ z
|
||||||
x ≡⟨ x≡y ⟩ y≡z = trans x≡y y≡z
|
x ≡⟨ x≡y ⟩ y≡z = trans x≡y y≡z
|
||||||
|
|
||||||
_∎ : ∀ A. (x : A) → x ≡ x
|
_∎ : ∀ A. (0 x : A) → x ≡ x
|
||||||
x ∎ = Refl
|
x ∎ = Refl
|
||||||
|
|
||||||
|
|
||||||
-- From the "Lists" chapter of Programming Language Foundations in Agda
|
|
||||||
-- https://plfa.github.io/Lists/
|
|
||||||
|
|
||||||
-- We define a few types and functions on lists and prove a couple of properties
|
|
||||||
-- about them
|
|
||||||
|
|
||||||
-- Natural numbers are zero (Z) or the successor (S) of a natural number
|
-- Natural numbers are zero (Z) or the successor (S) of a natural number
|
||||||
-- We'll use these to represent the length of lists
|
-- We'll use these to represent the length of lists
|
||||||
data Nat : U where
|
data Nat : U where
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Newt is a dependent typed programming language that compiles to javascript. This playground embeds the newt compiler and a codemirror based editor.
|
Newt is a dependent typed programming language that compiles to javascript. This playground embeds the newt compiler and a codemirror based editor.
|
||||||
|
|
||||||
The editor will typecheck the file with newt and render errors as the file is changed. The current file is saved to localStorage and will be restored if there is no data in the URL. Cmd-s or Ctrl-s will create a url embedding the file contents. There is a layout toggle for phone use.
|
The editor will typecheck the file with newt and render errors as the file is changed. The current file is saved to localStorage and will be restored if there is no data in the URL. Cmd-s or Ctrl-s will create a url embedding the file contents.
|
||||||
|
|
||||||
## Tabs
|
## Tabs
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user