Skip to content

Commit

Permalink
Add the new tests to the exercises file.
Browse files Browse the repository at this point in the history
  • Loading branch information
cangiuli committed Aug 2, 2024
1 parent fee07c2 commit a273b73
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions 2024-07-Minneapolis/2_Coq/coq_exercises.v
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,11 @@ Definition Z : UU := coprod nat nat.
Notation "⊹ x" := (inl x) (at level 20).
Notation "─ x" := (inr x) (at level 40).

Definition Z5 : Z := ⊹ 5.
Definition Z1 : Z := ⊹ 1.
Definition Z0 : Z := ⊹ 0.
Definition Zn1 : Z := ─ 0.
Definition Zn2 : Z := ─ 1.
Definition Zn3 : Z := ─ 2.

Definition Zcase (A : UU) (fpos : nat → A) (fneg : nat → A) : Z → A :=
Expand All @@ -180,4 +183,7 @@ Eval compute in Zadd Zn3 Z1. (* ─ 1 *)
Eval compute in Zadd Zn3 Zn3. (* ─ 5 *)
Eval compute in Zadd (Zadd Zn3 Zn3) Zn3. (* ─ 8 *)
Eval compute in Zadd Z0 (negate (Zn3)). (* ⊹ 3 *)
Eval compute in Zadd Z0 Zn1. (* ─ 0 *)
Eval compute in Zadd Z1 Zn1. (* ⊹ 0 *)
Eval compute in Zadd Z5 Zn2. (* ⊹ 3 *)
*)

0 comments on commit a273b73

Please sign in to comment.