fix(datatypes): further fix incorrect comment
This commit is contained in:
parent
cad1ed3395
commit
123ef6ab67
4 changed files with 20 additions and 6 deletions
|
@ -58,9 +58,8 @@ sigma.rec (λ a b, a) p
|
||||||
definition sigma.pr2 [reducible] [unfold 3] {A : Type} {B : A → Type} (p : sigma B) : B (sigma.pr1 p) :=
|
definition sigma.pr2 [reducible] [unfold 3] {A : Type} {B : A → Type} (p : sigma B) : B (sigma.pr1 p) :=
|
||||||
sigma.rec (λ a b, b) p
|
sigma.rec (λ a b, b) p
|
||||||
|
|
||||||
-- pos_num and num are two auxiliary datatypes used when parsing numerals such as 13, 0, 26.
|
-- pos_num and num are two auxiliary datatypes used when parsing numerals such as 13, 0, 26
|
||||||
-- The parser will generate the terms (pos (bit1 (bit0 (bit1 one)))), zero, and (pos (bit0 (bit1 (bit0 (bit1 one))))).
|
-- in an [priority n] flag.
|
||||||
-- This representation can be coerced in whatever we want (e.g., naturals, integers, reals, etc).
|
|
||||||
inductive pos_num : Type :=
|
inductive pos_num : Type :=
|
||||||
| one : pos_num
|
| one : pos_num
|
||||||
| bit1 : pos_num → pos_num
|
| bit1 : pos_num → pos_num
|
||||||
|
|
|
@ -37,6 +37,14 @@ definition lt {A : Type} [s : has_lt A] : A → A → Type := ha
|
||||||
|
|
||||||
definition ge [reducible] {A : Type} [s : has_le A] (a b : A) : Type := le b a
|
definition ge [reducible] {A : Type} [s : has_le A] (a b : A) : Type := le b a
|
||||||
definition gt [reducible] {A : Type} [s : has_lt A] (a b : A) : Type := lt b a
|
definition gt [reducible] {A : Type} [s : has_lt A] (a b : A) : Type := lt b a
|
||||||
|
|
||||||
|
/-
|
||||||
|
bit0 and bit1 are two auxiliary definition used when parsing numerals such as 13, 0, 26.
|
||||||
|
The parser will generate the terms (bit1 (bit0 (bit1 one))), zero, and
|
||||||
|
(bit0 (bit1 (bit0 (bit1 one)))). This works in any type with an addition, a zero and a one.
|
||||||
|
More specifically, there must be type class instances for the classes for has_add, has_zero and
|
||||||
|
has_one
|
||||||
|
-/
|
||||||
definition bit0 [reducible] {A : Type} [s : has_add A] (a : A) : A := add a a
|
definition bit0 [reducible] {A : Type} [s : has_add A] (a : A) : A := add a a
|
||||||
definition bit1 [reducible] {A : Type} [s₁ : has_one A] [s₂ : has_add A] (a : A) : A :=
|
definition bit1 [reducible] {A : Type} [s₁ : has_one A] [s₂ : has_add A] (a : A) : A :=
|
||||||
add (bit0 a) one
|
add (bit0 a) one
|
||||||
|
|
|
@ -80,9 +80,8 @@ or.inr Hb
|
||||||
structure sigma {A : Type} (B : A → Type) :=
|
structure sigma {A : Type} (B : A → Type) :=
|
||||||
mk :: (pr1 : A) (pr2 : B pr1)
|
mk :: (pr1 : A) (pr2 : B pr1)
|
||||||
|
|
||||||
-- pos_num and num are two auxiliary datatypes used when parsing numerals such as 13, 0, 26.
|
-- pos_num and num are two auxiliary datatypes used when parsing numerals such as 13, 0, 26
|
||||||
-- The parser will generate the terms (pos (bit1 (bit1 (bit0 one)))), zero, and (pos (bit0 (bit1 (bit1 one)))).
|
-- in an [priority n] flag.
|
||||||
-- This representation can be coerced in whatever we want (e.g., naturals, integers, reals, etc).
|
|
||||||
inductive pos_num : Type :=
|
inductive pos_num : Type :=
|
||||||
| one : pos_num
|
| one : pos_num
|
||||||
| bit1 : pos_num → pos_num
|
| bit1 : pos_num → pos_num
|
||||||
|
|
|
@ -37,6 +37,14 @@ definition lt {A : Type} [s : has_lt A] : A → A → Prop := has_lt.lt
|
||||||
|
|
||||||
definition ge [reducible] {A : Type} [s : has_le A] (a b : A) : Prop := le b a
|
definition ge [reducible] {A : Type} [s : has_le A] (a b : A) : Prop := le b a
|
||||||
definition gt [reducible] {A : Type} [s : has_lt A] (a b : A) : Prop := lt b a
|
definition gt [reducible] {A : Type} [s : has_lt A] (a b : A) : Prop := lt b a
|
||||||
|
|
||||||
|
/-
|
||||||
|
bit0 and bit1 are two auxiliary definition used when parsing numerals such as 13, 0, 26.
|
||||||
|
The parser will generate the terms (bit1 (bit0 (bit1 one))), zero, and
|
||||||
|
(bit0 (bit1 (bit0 (bit1 one)))). This works in any type with an addition, a zero and a one.
|
||||||
|
More specifically, there must be type class instances for the classes for has_add, has_zero and
|
||||||
|
has_one
|
||||||
|
-/
|
||||||
definition bit0 {A : Type} [s : has_add A] (a : A) : A := add a a
|
definition bit0 {A : Type} [s : has_add A] (a : A) : A := add a a
|
||||||
definition bit1 {A : Type} [s₁ : has_one A] [s₂ : has_add A] (a : A) : A := add (bit0 a) one
|
definition bit1 {A : Type} [s₁ : has_one A] [s₂ : has_add A] (a : A) : A := add (bit0 a) one
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue