Skip to content

Commit cad56f8

Browse files
Addition of FunExt.lp, PropExt.lp and some theorems (#35)
Addition of some of the encodings necessary in the verification of Leo-III proofs, specifically: - Addition of FunExt.lp with an axiom for functional extensionality - Addition of PropExt.lp with an axiom for propositional extensionality and a number of theorems proving simplifications and equalities used for the conversion between propositional and equational literals - Addition of nths to list.lp, along with a number of theorems - Addition of a theorem to bool.lp
1 parent 704cc1a commit cad56f8

File tree

5 files changed

+559
-0
lines changed

5 files changed

+559
-0
lines changed

Bool.lp

+10
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ with istrue false ↪ ⊥;
3434

3535
coerce_rule coerce 𝔹 Prop $xistrue $x;
3636

37+
symbol istrue=true [x] : π (istrue x) → π (x = true)≔
38+
begin
39+
assume x h;
40+
refine ∨ₑ (case_𝔹 x) _ _
41+
{ assume h1; refine h1 }
42+
{ assume h1;
43+
have H1: π (istrue false) { rewrite eq_sym h1; refine h };
44+
refine ⊥ₑ H1 };
45+
end;
46+
3747
// non confusion of constructors
3848

3949
opaque symbol falsetrue : π (falsetrue) ≔

CHANGES.md

+9
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ All notable changes to this project will be documented in this file.
33
The format is based on [Keep a Changelog](https://keepachangelog.com/),
44
and this project adheres to [Semantic Versioning](https://semver.org/).
55

6+
7+
## Unreleased
8+
9+
### Added
10+
11+
- FunExt: Axiom for functional extensionality
12+
- PropExt: Axiom for propositional extensionality and related theorems
13+
- List: add nths
14+
615
## 1.2.0 (2025-02-04)
716

817
### Added

FunExt.lp

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
require open Stdlib.Set Stdlib.Prop Stdlib.Eq Stdlib.FOL Stdlib.HOL;
2+
3+
symbol funExt [a b] (f g : τ (ab)) : π(`∀ x, f x = g x) → π(f = g);
4+

List.lp

+76
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ seqn n x_0 ... x_n-1 == the sequence of the x_i; can be partially applied.
3838
** Random access:
3939
nth x0 s i == the item i of s (numbered from 0), or x0 if s does
4040
not have at least i+1 items (i.e., size x <= i)
41+
nths x0 s ks == the sequence that is formed when taking for each
42+
index i in n the i-th item of ks (numbered from 0),
43+
or x0 if s has fewer than i+1 items (i.e., size s <= i).
4144
s`_i == standard notation for nth x0 s i for a default x0,
4245
e.g., 0 for rings.
4346
set_nth x0 s i y == s where item i has been changed to y; if s does not
@@ -1083,6 +1086,21 @@ begin
10831086
assume a beq x l hrefl; simplify; rewrite hrefl; apply ⊤ᵢ;
10841087
end;
10851088

1089+
opaque symbol mem_tail [a] (beq: τ a → τ a → 𝔹) (n m: τ a) (l: 𝕃 a) :
1090+
π (∈ beq n l) → π (∈ beq n (ml)) ≔
1091+
begin
1092+
assume a beq n m; induction
1093+
{assume h1; refine ⊥ₑ h1}
1094+
{assume n0 l h1 h2;
1095+
have H0: π (beq n n0) → π (beq n m or (beq n n0 orbeq n l))
1096+
{assume h3;
1097+
refine orᵢ₂ (beq n m) [beq n n0 orbeq n l] (orᵢ₁ [beq n n0] (∈ beq n l) h3)};
1098+
have H1: π (∈ beq n l) → π (beq n m or (beq n n0 orbeq n l))
1099+
{assume h3;
1100+
refine orᵢ₂ (beq n m) [beq n n0 orbeq n l] (orᵢ₂ (beq n n0) [∈ beq n l] h3)};
1101+
refine orₑ [beq n n0] [∈ beq n l] (beq n m or (beq n n0 orbeq n l)) h2 H0 H1}
1102+
end;
1103+
10861104
opaque symbol mem_take [a] beq n l (xa) :
10871105
π (∈ beq x (take n l)) → π (∈ beq x l) ≔
10881106
begin
@@ -1591,6 +1609,64 @@ begin
15911609
}
15921610
end;
15931611

1612+
// nths
1613+
1614+
symbol nths [a : Set] : τ a → 𝕃 a → 𝕃 nat → 𝕃 a;
1615+
1616+
rule nths $b $l $nmap (nth $b $l) $n;
1617+
1618+
opaque symbol mapS_iota (m n : τ nat) :
1619+
π (map (+1) (iota n m) = iota (n +1) m)≔
1620+
begin
1621+
induction
1622+
{ induction
1623+
{ refine eq_refl □ }
1624+
{ assume n h; refine h } }
1625+
{ induction
1626+
{ assume h n; refine eq_refl (n +1 ⸬ □) }
1627+
{ simplify; assume n0 h0 h1 m; rewrite h1 (m +1);
1628+
refine eq_refl (m +1m +1 +1iota (m +1 +1 +1) n0) } }
1629+
end;
1630+
1631+
opaque symbol indexes_cons [a : Set] (x : τ a) (l : 𝕃 a) :
1632+
π (indexes (xl) = 0 ⸬ (map (+1) (indexes l)))≔
1633+
begin
1634+
assume a x;
1635+
induction
1636+
{ refine eq_refl (0 ⸬ □) }
1637+
{ simplify;
1638+
assume y l h;
1639+
rewrite mapS_iota;
1640+
refine eq_refl (01iota 2 (size l)) }
1641+
end;
1642+
1643+
opaque symbol nths_shift_cons [a : Set] (x b : τ a) (l : 𝕃 a) (n : 𝕃 nat) :
1644+
π ((nths b (xl) (map (+1) n)) = (nths b l n))≔
1645+
begin
1646+
assume a x b l; induction
1647+
{ refine eq_refl □ }
1648+
{ assume n ll h1;
1649+
have H1: π (nths b (xl) (map (+1) (nll)) =
1650+
nth b (xl) (n +1) ⸬ nths b (xl) (map (+1) ll))
1651+
{ refine eq_refl (nth b l nmap (nth b (xl)) (map (+1) ll)) };
1652+
rewrite H1; rewrite h1;
1653+
refine eq_refl (nths b l (nll)) }
1654+
end;
1655+
1656+
opaque symbol nths_indexes_id [a : Set] (b : τ a) (l : 𝕃 a) :
1657+
π (nths b l (indexes l) = l)≔
1658+
begin
1659+
assume a b; induction
1660+
{ refine eq_refl □ }
1661+
{ assume x l h1;
1662+
rewrite indexes_cons x l;
1663+
have H1: π (nths b (xl) (0map (+1) (indexes l)) =
1664+
xnths b (xl) (map (+1) (indexes l)))
1665+
{ refine eq_refl (xmap (nth b (xl)) (map (+1) (indexes l))) };
1666+
rewrite H1; rewrite nths_shift_cons x b l (indexes l); rewrite h1;
1667+
refine eq_refl (xl) }
1668+
end;
1669+
15941670
// sumn
15951671

15961672
symbol sumn : 𝕃 nat → ℕ;

0 commit comments

Comments
 (0)