Skip to content

Commit baa8142

Browse files
committed
simplified all induction principle lemmas
1 parent b0ea5c7 commit baa8142

File tree

4 files changed

+383
-148
lines changed

4 files changed

+383
-148
lines changed

01-propositional.mm1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,3 +751,6 @@ theorem or_or_not_an: $ aa \/ bb <-> aa \/ (~aa /\ bb) $ =
751751

752752
theorem absurd_an: $~aa /\ aa <-> bot$ = '(ibii (impcom mpcom) absurdum);
753753
theorem absurd_an_r: $aa /\ ~aa <-> bot$ = '(ibii (curry mpcom) absurdum);
754+
755+
theorem imp_or_split: $ (aa -> bb \/ c) -> (aa -> bb) \/ (aa -> c) $ =
756+
'(rsyl (anr impexp) @ orim (imim2 dne) prop_1);

12-proof-system-p.mm1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1290,11 +1290,15 @@ do {
12901290
(def (pointwise_decomposition_imp_subst subst) '(norm (norm_imp (norm_forall @ norm_imp_r @ norm_subset ,subst norm_refl) @ norm_subset ,subst norm_refl) pointwise_decomposition_imp))
12911291
};
12921292

1293-
theorem subset_mem_disjoint_lemma {x: EVar} (phi: Pattern) (psi: Pattern x)
1293+
theorem subset_mem_lemma_fresh {x: EVar} (phi: Pattern) (psi: Pattern x)
12941294
(freshness_psi: $ _eFresh x psi $):
12951295
$ (phi C= psi) -> forall x ((x in phi) -> x in psi) $ =
12961296
'(anr (imp_forall_fresh @ eFresh_subset eFresh_disjoint freshness_psi) @ univ_gene @ com12 @ rsyl eVar_in_subset_forward @ rsyl subset_trans @ imim2 eVar_in_subset_reverse);
12971297

1298+
theorem subset_mem_lemma {x: EVar} (phi psi: Pattern):
1299+
$ (phi C= psi) -> forall x ((x in phi) -> x in psi) $ =
1300+
'(subset_mem_lemma_fresh eFresh_disjoint);
1301+
12981302
do {
12991303
(def (forall_imp_climb n) (iterate n (fn (pf) '(syl (anl imp_forall) @ imim2 ,pf)) 'id))
13001304

nominal/core.mm1

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,18 @@ axiom function_sort_abstraction: $ ,(is_function '(sym sort_abstraction_sym) '[a
1818

1919
def is_atom_sort (alpha: Pattern): Pattern = $ (is_func alpha) /\ (alpha C= dom atoms) $;
2020
def is_nominal_sort (tau: Pattern): Pattern = $ (is_func tau) /\ (tau C= dom nominal_sorts) $;
21-
def is_atom {a: EVar} (alpha: Pattern): Pattern a = $ is_of_sort (eVar a) alpha $;
21+
def is_atom (a alpha: Pattern): Pattern = $ is_sorted_func alpha a $;
2222

2323
term swap_sym: Symbol;
24-
def swap {a b: EVar} (phi: Pattern a b): Pattern a b = $ (sym swap_sym) @@ eVar a @@ eVar b @@ phi $;
25-
def moot_swap {a: EVar} (phi: Pattern a): Pattern a = $ (sym swap_sym) @@ eVar a @@ eVar a @@ phi $;
24+
def swap (a b phi: Pattern): Pattern = $ (sym swap_sym) @@ a @@ b @@ phi $;
2625
term abstraction_sym: Symbol;
2726
def abstraction (phi rho: Pattern): Pattern = $ (sym abstraction_sym) @@ phi @@ rho $;
2827
term supp_sym: Symbol;
2928
def supp (phi: Pattern): Pattern = $ (sym supp_sym) @@ phi $;
3029
def fresh_for (phi psi: Pattern): Pattern = $ ~ (phi C= supp psi) $;
3130

3231
def EV_pattern {.a .b: EVar} (alpha phi: Pattern): Pattern =
33-
$ s_forall alpha a (s_forall alpha b ((swap a b phi) == phi)) $;
32+
$ s_forall alpha a (s_forall alpha b ((swap (eVar a) (eVar b) phi) == phi)) $;
3433

3534
axiom function_swap:
3635
$ is_atom_sort alpha $ >
@@ -48,79 +47,83 @@ axiom multifunction_supp:
4847
axiom EV_abstraction {a b: EVar} (alpha tau: Pattern) (phi psi: Pattern a b):
4948
$ is_atom_sort alpha $ >
5049
$ is_nominal_sort tau $ >
51-
$ (is_of_sort phi alpha) ->
52-
(is_of_sort psi tau) ->
53-
(s_forall alpha a (s_forall alpha b ((swap a b (abstraction phi psi)) == abstraction (swap a b phi) (swap a b psi)))) $;
54-
50+
$ s_forall alpha a (s_forall alpha b (
51+
(is_of_sort phi alpha) ->
52+
(is_of_sort psi tau) ->
53+
((swap (eVar a) (eVar b) (abstraction phi psi)) == abstraction (swap (eVar a) (eVar b) phi) (swap (eVar a) (eVar b) psi)))) $;
54+
-- add EV axiom for swap
55+
-- add EV axiom for freshness
5556

5657
axiom EV_pred (alpha tau: Pattern):
5758
$ is_atom_sort alpha $ >
5859
$ is_nominal_sort tau $ >
5960
$ EV_pattern alpha (dom tau) $;
60-
axiom S1 (alpha tau: Pattern) {a: EVar} (phi: Pattern a):
61+
axiom S1 (alpha tau a phi: Pattern):
6162
$ is_atom_sort alpha $ >
6263
$ is_nominal_sort tau $ >
6364
$ (is_atom a alpha) ->
6465
(is_of_sort phi tau) ->
65-
((moot_swap a phi) == phi) $;
66-
axiom S2 (alpha tau: Pattern) {a b: EVar} (phi: Pattern a b):
66+
((swap a a phi) == phi) $;
67+
axiom S2 (alpha tau a b phi: Pattern):
6768
$ is_atom_sort alpha $ >
6869
$ is_nominal_sort tau $ >
6970
$ (is_atom a alpha) ->
7071
(is_atom b alpha) ->
7172
(is_of_sort phi tau) ->
7273
(swap a b (swap a b phi)) == phi $;
73-
axiom S3 (alpha: Pattern) {a b: EVar}:
74+
axiom S3 {a b: EVar} (alpha: Pattern a b):
7475
$ is_atom_sort alpha $ >
75-
$ (is_atom a alpha) ->
76-
(is_atom b alpha) ->
77-
((swap a b (eVar a)) == eVar b) $;
78-
axiom S4 (alpha tau: Pattern) {a b: EVar} (phi: Pattern a b):
76+
$ s_forall alpha a (
77+
s_forall alpha b (
78+
((swap (eVar a) (eVar b) (eVar a)) == (eVar b)))) $;
79+
axiom S4 (alpha tau a b phi: Pattern):
7980
$ is_atom_sort alpha $ >
8081
$ is_nominal_sort tau $ >
8182
$ (is_atom a alpha) ->
8283
(is_atom b alpha) ->
8384
(is_of_sort phi tau) ->
8485
((swap a b phi) == (swap b a phi)) $;
85-
axiom F1 (alpha tau: Pattern) {a b: EVar} (phi: Pattern a b):
86+
axiom F1 (alpha tau a b phi: Pattern):
8687
$ is_atom_sort alpha $ >
8788
$ is_nominal_sort tau $ >
8889
$ (is_atom a alpha) ->
8990
(is_atom b alpha) ->
9091
(is_of_sort phi tau) ->
91-
((fresh_for (eVar a) phi) /\ (fresh_for (eVar b) phi) -> ((swap a b phi) == phi)) $;
92-
axiom F2 (alpha: Pattern) {a b: EVar}:
92+
((fresh_for a phi) /\ (fresh_for b phi) -> ((swap a b phi) == phi)) $;
93+
axiom F2 (alpha a b: Pattern):
9394
$ is_atom_sort alpha $ >
9495
$ (is_atom a alpha) ->
9596
(is_atom b alpha) ->
96-
(((eVar a) != (eVar b)) <-> (fresh_for (eVar a) (eVar b))) $;
97-
axiom F3 (alpha1 alpha2: Pattern) {a b: EVar}:
97+
((a != b) <-> (fresh_for a b)) $;
98+
axiom F3 (alpha1 alpha2 a b: Pattern):
9899
$ is_atom_sort alpha1 $ >
99100
$ is_atom_sort alpha2 $ >
100101
$ (is_atom a alpha1) ->
101102
(is_atom b alpha2) ->
102103
(alpha1 != alpha2) ->
103-
((eVar a) != (eVar b)) $;
104-
axiom F4 (alpha tau phi: Pattern) {a: EVar}:
104+
(a != b) $;
105+
-- We restrict F4 to only accept singleton phi's to avoid inconsistencies
106+
-- caused by using the full set of atoms in place of phi
107+
axiom F4 {a: EVar} (alpha tau phi: Pattern):
105108
$ is_atom_sort alpha $ >
106109
$ is_nominal_sort tau $ >
107-
$ (is_of_sort phi tau) ->
110+
$ (is_sorted_func tau phi) ->
108111
(s_exists alpha a (fresh_for (eVar a) phi)) $;
109-
axiom A1 (alpha tau: Pattern) {a b: EVar} (phi rho: Pattern a b):
112+
axiom A1 (alpha tau a b phi rho: Pattern):
110113
$ is_atom_sort alpha $ >
111114
$ is_nominal_sort tau $ >
112115
$ (is_atom a alpha) ->
113116
(is_atom b alpha) ->
114117
(is_of_sort phi tau) ->
115118
(is_of_sort rho tau) ->
116-
(((abstraction (eVar a) phi) == (abstraction (eVar b) rho)) <->
117-
((eVar a == eVar b) /\ (phi == rho)) \/
118-
((fresh_for (eVar a) rho) /\ ((swap a b phi) == rho))) $;
119+
(((abstraction a phi) == (abstraction b rho)) <->
120+
((a == b) /\ (phi == rho)) \/
121+
((fresh_for a rho) /\ ((swap a b phi) == rho))) $;
119122
axiom A2 (alpha tau: Pattern) {x a y: EVar}:
120123
$ is_atom_sort alpha $ >
121124
$ is_nominal_sort tau $ >
122125
$ s_forall (sort_abstraction alpha tau) x
123126
(s_exists alpha a (s_exists tau y (eVar x == abstraction (eVar a) (eVar y)))) $;
124127

125-
def coercion {a: EVar} (phi: Pattern a) {.y: EVar}: Pattern a =
126-
$ exists y (eVar y /\ ((abstraction (eVar a) (eVar y)) == phi)) $;
128+
def coercion (a phi: Pattern) {.y: EVar}: Pattern =
129+
$ exists y (eVar y /\ ((abstraction a (eVar y)) == phi)) $;

0 commit comments

Comments
 (0)