Skip to content

Commit 704cc1a

Browse files
authored
Set: move cartesian product to a separate file, and change notation for pairs (#33)
1 parent 47db76e commit 704cc1a

File tree

3 files changed

+28
-27
lines changed

3 files changed

+28
-27
lines changed

List.lp

+8-8
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ protected with nosimpl.
195195
*/
196196

197197
require open Stdlib.Set Stdlib.Prop Stdlib.FOL Stdlib.Eq
198-
Stdlib.Nat Stdlib.Bool;
198+
Stdlib.Nat Stdlib.Bool Stdlib.Prod;
199199

200200
(a:Set) inductive 𝕃:TYPE
201201
| □ : 𝕃 a // \Box
@@ -583,20 +583,20 @@ symbol zip [a b] : 𝕃 a → 𝕃 b → 𝕃 (a × b);
583583
rule zip □ □ ↪ □
584584
with zip □ _ ↪ □
585585
with zip _ □ ↪ □
586-
with zip ($x ⸬ $l) ($y ⸬ $m) ↪ $x & $yzip $l $m;
586+
with zip ($x ⸬ $l) ($y ⸬ $m) ↪ ($x $y)zip $l $m;
587587

588588
symbol unzip1 [a b] : 𝕃 (a × b) → 𝕃 a;
589589

590590
rule unzip1 □ ↪ □
591-
with unzip1 ($x & _ ⸬ $l) ↪ $xunzip1 $l;
591+
with unzip1 (($x ‚ _ ) ⸬ $l) ↪ $xunzip1 $l;
592592

593593
symbol unzip2 [a b] : 𝕃 (a × b) → 𝕃 b;
594594

595595
rule unzip2 □ ↪ □
596-
with unzip2 (_ & $y ⸬ $l) ↪ $yunzip2 $l;
596+
with unzip2 ((_ ‚ $y) ⸬ $l) ↪ $yunzip2 $l;
597597

598-
assertunzip1 ((3 & 5) ⸬ (6 & 4) ⸬ (7 & 2) ⸬ (8 & 1) ⸬ □) ≡ 3678 ⸬ □;
599-
assertunzip2 ((3 & 5) ⸬ (6 & 4) ⸬ (7 & 2) ⸬ (8 & 1) ⸬ □) ≡ 5421 ⸬ □;
598+
assertunzip1 ((3 5) ⸬ (6 4) ⸬ (7 2) ⸬ (8 1) ⸬ □) ≡ 3678 ⸬ □;
599+
assertunzip2 ((3 5) ⸬ (6 4) ⸬ (7 2) ⸬ (8 1) ⸬ □) ≡ 5421 ⸬ □;
600600

601601
symbol all2 [a b] : (τ a → τ b → 𝔹) → 𝕃 a → 𝕃 b → 𝔹;
602602

@@ -687,12 +687,12 @@ begin
687687
apply @seq_ind2 a bl1 l2, (zip (l1 ++ sa) (l2 ++ sb) = zip l1 l2 ++ zip sa sb)) _ _ la lb h {
688688
reflexivity;
689689
} {
690-
assume l1 l2 e1 e2 h1 h2; simplify; apply feql, e1 & e2l) h2;
690+
assume l1 l2 e1 e2 h1 h2; simplify; apply feql, (e1 e2)l) h2;
691691
};
692692
end;
693693

694694
opaque symbol nth_zip [a b] (xa) (yb) la lb i: π(size la = size lb) →
695-
π(nth (x & y) (zip la lb) i = nth x la i & nth y lb i) ≔
695+
π(nth (x y) (zip la lb) i = nth x la i nth y lb i) ≔
696696
begin
697697
assume a b x y; induction
698698
{ assume lb i h;

Prod.lp

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Cartesian product
2+
3+
require open Stdlib.Set;
4+
5+
constant symbol × : SetSetSet; notation × infix right 10; // \times
6+
7+
assert a b ca × b × ca × (b × c);
8+
9+
symbol ‚ [a b] : τ a → τ b → τ (a × b); notationinfix right 30;
10+
11+
assert a (xa) b (yb) c (zc) ⊢ xyz : τ(a × b × c);
12+
assert x y zxyzx ‚ (yz);
13+
14+
symbol ₁ [a b] : τ(a × b) → τ a; notationpostfix 10;
15+
16+
rule ($x ‚ _)₁ ↪ $x;
17+
18+
symbol ₂ [a b] : τ(a × b) → τ b; notationpostfix 10;
19+
20+
rule (_ ‚ $x)₂ ↪ $x;

Set.lp

-19
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,3 @@ builtin "T" ≔ τ;
1313
// We assume that sets are non-empty
1414

1515
symbol el a : τ a;
16-
17-
// Cartesian product
18-
19-
constant symbol × : SetSetSet; notation × infix right 10; // \times
20-
21-
assert a b ca × b × ca × (b × c);
22-
23-
symbol & [a b] : τ a → τ b → τ (a × b); notation & infix right 30;
24-
25-
assert a (xa) b (yb) c (zc) ⊢ x & y & z : τ(a × b × c);
26-
assert x y zx & y & zx & (y & z);
27-
28-
symbol ₁ [a b] : τ(a × b) → τ a; notationpostfix 10;
29-
30-
rule ($x & _)₁ ↪ $x;
31-
32-
symbol ₂ [a b] : τ(a × b) → τ b; notationpostfix 10;
33-
34-
rule (_ & $x)₂ ↪ $x;

0 commit comments

Comments
 (0)