2023-07-24 17:56:13 +03:00
|
|
|
module Records;
|
|
|
|
|
2023-09-07 17:20:14 +03:00
|
|
|
type T := constructT : T;
|
|
|
|
|
|
|
|
type T-wrapper := mkWrapper {unwrap : T};
|
2023-07-24 17:56:13 +03:00
|
|
|
|
|
|
|
type Pair (A B : Type) :=
|
2023-09-07 17:20:14 +03:00
|
|
|
--- creates a pair
|
|
|
|
mkPair {
|
|
|
|
fst : A;
|
|
|
|
snd : B
|
|
|
|
};
|
2023-07-24 17:56:13 +03:00
|
|
|
|
|
|
|
p1 : Pair T T :=
|
2024-07-12 19:31:09 +03:00
|
|
|
mkPair@{
|
|
|
|
fst := constructT;
|
|
|
|
snd := constructT
|
|
|
|
};
|
2023-07-24 17:56:13 +03:00
|
|
|
|
|
|
|
type EnumRecord :=
|
2023-09-07 17:20:14 +03:00
|
|
|
| --- doc for C1
|
|
|
|
C1 {
|
2023-07-24 17:56:13 +03:00
|
|
|
c1a : T;
|
|
|
|
c1b : T
|
|
|
|
}
|
|
|
|
| C2 {
|
|
|
|
c2a : T;
|
|
|
|
c2b : T
|
|
|
|
};
|
|
|
|
|
|
|
|
p2 : Pair EnumRecord EnumRecord :=
|
2024-07-12 19:31:09 +03:00
|
|
|
mkPair@{
|
|
|
|
fst :=
|
|
|
|
C1@?{
|
|
|
|
c1a := constructT;
|
|
|
|
c1b := constructT
|
|
|
|
};
|
|
|
|
snd :=
|
|
|
|
C2@{
|
|
|
|
c2a := constructT;
|
|
|
|
c2b := constructT
|
|
|
|
}
|
|
|
|
};
|
2023-07-24 17:56:13 +03:00
|
|
|
|
2023-09-07 17:20:14 +03:00
|
|
|
type newtype := mknewtype {f : T};
|
2023-08-01 11:46:22 +03:00
|
|
|
|
|
|
|
p3 : Pair T T -> T := Pair.fst;
|
|
|
|
|
|
|
|
open Pair;
|
|
|
|
|
|
|
|
p4 {A : Type} : Pair A T -> A := fst;
|
2023-08-07 13:35:36 +03:00
|
|
|
|
|
|
|
type Bool :=
|
|
|
|
| false
|
|
|
|
| true;
|
|
|
|
|
|
|
|
module Update;
|
2024-07-12 19:31:09 +03:00
|
|
|
f {A B : Type} (p : Pair A B) : Pair Bool B := p@Pair{fst := true};
|
2023-08-07 13:35:36 +03:00
|
|
|
end;
|