Skip to content

Commit 9c26575

Browse files
committed
Add two theorems about transitivity of Append/Tail and IsInjective.
1 parent 4a1032a commit 9c26575

File tree

3 files changed

+79
-0
lines changed

3 files changed

+79
-0
lines changed

.github/workflows/main.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ jobs:
1616
- name: Get current date
1717
id: date
1818
run: echo "::set-output name=date::$(date +'%Y%m%d%H%M')"
19+
- name: Get TLAPS
20+
run: wget https://tla.msr-inria.inria.fr/tlaps/dist/1.4.4/tlaps-1.4.4-x86_64-linux-gnu-inst.bin
21+
- name: Install TLAPS
22+
run: |
23+
chmod +x tlaps-1.4.4-x86_64-linux-gnu-inst.bin
24+
./tlaps-1.4.4-x86_64-linux-gnu-inst.bin -d tlaps
25+
- name: Run TLAPS
26+
run: tlaps/bin/tlapm --cleanfp -I tlaps/ -I modules/ modules/SequencesExtTheorems_proofs.tla
1927
- name: Build with Ant
2028
run: ant -noinput -buildfile build.xml -Dtimestamp=${{steps.date.outputs.date}}
2129
- name: Create Release

modules/SequencesExtTheorems.tla

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
------------------------ MODULE SequencesExtTheorems ------------------------
2+
LOCAL INSTANCE SequencesExt
3+
LOCAL INSTANCE Sequences
4+
LOCAL INSTANCE Functions
5+
6+
LEMMA AppendTransitivityIsInjective
7+
== ASSUME NEW S, NEW seq \in Seq(S),
8+
IsInjective(seq),
9+
NEW elt \in S,
10+
elt \notin Range(seq)
11+
PROVE IsInjective(Append(seq, elt))
12+
13+
LEMMA TailTransitivityIsInjective
14+
== ASSUME NEW S, NEW seq \in Seq(S),
15+
seq # <<>>,
16+
IsInjective(seq)
17+
PROVE IsInjective(Tail(seq))
18+
19+
=============================================================================
20+
\* Modification History
21+
\* Last modified Thu Feb 27 11:38:41 PST 2020 by markus
22+
\* Created Tue Feb 25 20:49:08 PST 2020 by markus
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
--------------------- MODULE SequencesExtTheorems_proofs ---------------------
2+
LOCAL INSTANCE SequencesExt
3+
LOCAL INSTANCE Sequences
4+
LOCAL INSTANCE Naturals
5+
LOCAL INSTANCE Functions
6+
LOCAL INSTANCE TLAPS
7+
8+
LEMMA AppendTransitivityIsInjective \* With TLAPS 1.4.4+ (3ed0cde)
9+
== ASSUME NEW S, NEW seq \in Seq(S),
10+
IsInjective(seq),
11+
NEW elt \in S,
12+
elt \notin Range(seq)
13+
PROVE IsInjective(Append(seq, elt))
14+
BY DEF IsInjective, Range
15+
16+
LEMMA TailTransitivityIsInjective \* With TLAPS 1.4.3
17+
== ASSUME NEW S, NEW seq \in Seq(S),
18+
seq # <<>>,
19+
IsInjective(seq)
20+
PROVE IsInjective(Tail(seq))
21+
<1> DEFINE ts == Tail(seq)
22+
<1>1. IsInjective(ts)
23+
<2> SUFFICES ASSUME NEW i \in DOMAIN ts, NEW j \in DOMAIN ts,
24+
ts[i] = ts[j]
25+
PROVE i = j
26+
BY DEF IsInjective
27+
<2>1. ts[i] = seq[i + 1] /\ ts[j] = seq[j + 1]
28+
BY SMT
29+
<2>2. 1..Len(ts) = 1..Len(seq)-1
30+
BY SMT
31+
<2>3. 1..Len(ts) \subseteq 1..Len(seq)
32+
BY SMT
33+
<2>4. DOMAIN ts = 1..Len(seq)-1
34+
BY SMT
35+
<2>5. DOMAIN seq = 1..Len(seq)
36+
BY SMT
37+
<2>6. \A r, s \in 1..Len(seq): (seq[r] = seq[s]) => (r = s)
38+
BY Isa, <2>5 DEF IsInjective
39+
<2>7. seq \in [1..Len(seq) -> Range(seq)]
40+
BY Isa, <2>5 DEF Range
41+
<2>8. DOMAIN ts \subseteq DOMAIN seq
42+
BY Isa, <2>2, <2>3, <2>4, <2>7
43+
<2>9. QED BY <2>1, <2>2, <2>3, <2>5, <2>6, <2>7, <2>8 DEF IsInjective
44+
<1>2. QED BY <1>1
45+
46+
=============================================================================
47+
\* Modification History
48+
\* Last modified Thu Feb 27 11:44:49 PST 2020 by markus
49+
\* Created Thu Feb 27 11:27:48 PST 2020 by markus

0 commit comments

Comments
 (0)