]> matita.cs.unibo.it Git - helm.git/commitdiff
propagating the arithmetics library, partial commit
authorFerruccio Guidi <ferruccio.guidi@unibo.it>
Mon, 15 Mar 2021 12:10:02 +0000 (13:10 +0100)
committerFerruccio Guidi <ferruccio.guidi@unibo.it>
Mon, 15 Mar 2021 12:10:02 +0000 (13:10 +0100)
+ relocation updated and ported (de Bruijn indexes now start at 1)
+ recomm updated to generate substitution files
+ results on positive integers added to arith
+ some corrections

81 files changed:
matita/matita/contribs/lambdadelta/bin/recomm/mrcInput.ml
matita/matita/contribs/lambdadelta/bin/recomm/recomm.ml
matita/matita/contribs/lambdadelta/bin/recomm/recommCheck.ml
matita/matita/contribs/lambdadelta/bin/recomm/recommLib.ml [new file with mode: 0644]
matita/matita/contribs/lambdadelta/bin/recomm/recommLib.mli [new file with mode: 0644]
matita/matita/contribs/lambdadelta/bin/recomm/recommOutput.ml
matita/matita/contribs/lambdadelta/bin/recomm/recommOutput.mli
matita/matita/contribs/lambdadelta/bin/recomm/recommParser.mly
matita/matita/contribs/lambdadelta/bin/recomm/recommTypes.ml
matita/matita/contribs/lambdadelta/ground/arith/arith_etc.txt
matita/matita/contribs/lambdadelta/ground/arith/nat_le.ma
matita/matita/contribs/lambdadelta/ground/arith/nat_le_plus.ma
matita/matita/contribs/lambdadelta/ground/arith/nat_lt.ma
matita/matita/contribs/lambdadelta/ground/arith/nat_lt_plus.ma
matita/matita/contribs/lambdadelta/ground/arith/nat_minus_plus.ma
matita/matita/contribs/lambdadelta/ground/arith/nat_plus_rplus.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/arith/nat_pred.ma
matita/matita/contribs/lambdadelta/ground/arith/nat_pred_succ.ma
matita/matita/contribs/lambdadelta/ground/arith/nat_rplus.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/arith/nat_rplus_succ.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/arith/nat_succ.ma
matita/matita/contribs/lambdadelta/ground/arith/pnat.ma
matita/matita/contribs/lambdadelta/ground/arith/pnat_le.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/arith/pnat_le_plus.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/arith/pnat_le_pred.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/arith/pnat_lt.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/arith/pnat_lt_pred.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/arith/pnat_plus.ma
matita/matita/contribs/lambdadelta/ground/arith/pnat_pred.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/notation/relations/ratsucc_3.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/relocation/mr2.ma
matita/matita/contribs/lambdadelta/ground/relocation/mr2_at.ma
matita/matita/contribs/lambdadelta/ground/relocation/mr2_minus.ma
matita/matita/contribs/lambdadelta/ground/relocation/mr2_plus.ma
matita/matita/contribs/lambdadelta/ground/relocation/nstream.ma [deleted file]
matita/matita/contribs/lambdadelta/ground/relocation/nstream_after.ma [deleted file]
matita/matita/contribs/lambdadelta/ground/relocation/nstream_basic.ma [deleted file]
matita/matita/contribs/lambdadelta/ground/relocation/nstream_coafter.ma [deleted file]
matita/matita/contribs/lambdadelta/ground/relocation/nstream_eq.ma [deleted file]
matita/matita/contribs/lambdadelta/ground/relocation/nstream_id.ma [deleted file]
matita/matita/contribs/lambdadelta/ground/relocation/nstream_isid.ma [deleted file]
matita/matita/contribs/lambdadelta/ground/relocation/nstream_istot.ma [deleted file]
matita/matita/contribs/lambdadelta/ground/relocation/nstream_sor.ma [deleted file]
matita/matita/contribs/lambdadelta/ground/relocation/pstream.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/relocation/pstream_after.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/relocation/pstream_basic.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/relocation/pstream_coafter.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/relocation/pstream_eq.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/relocation/pstream_id.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/relocation/pstream_isid.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/relocation/pstream_istot.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/relocation/pstream_sor.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/relocation/pstream_tl.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/relocation/pstream_tls.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/relocation/rtmap.ma
matita/matita/contribs/lambdadelta/ground/relocation/rtmap_after.ma
matita/matita/contribs/lambdadelta/ground/relocation/rtmap_after_nat_uni.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/relocation/rtmap_after_uni.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/relocation/rtmap_at.ma
matita/matita/contribs/lambdadelta/ground/relocation/rtmap_at_uni.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/relocation/rtmap_basic.ma
matita/matita/contribs/lambdadelta/ground/relocation/rtmap_basic_after.ma
matita/matita/contribs/lambdadelta/ground/relocation/rtmap_basic_at.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/relocation/rtmap_basic_nat.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/relocation/rtmap_coafter.ma
matita/matita/contribs/lambdadelta/ground/relocation/rtmap_coafter_uni.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/relocation/rtmap_fcla.ma
matita/matita/contribs/lambdadelta/ground/relocation/rtmap_id.ma
matita/matita/contribs/lambdadelta/ground/relocation/rtmap_isdiv.ma
matita/matita/contribs/lambdadelta/ground/relocation/rtmap_isfin.ma
matita/matita/contribs/lambdadelta/ground/relocation/rtmap_isid.ma
matita/matita/contribs/lambdadelta/ground/relocation/rtmap_istot.ma
matita/matita/contribs/lambdadelta/ground/relocation/rtmap_nat.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/relocation/rtmap_nat_uni.ma [new file with mode: 0644]
matita/matita/contribs/lambdadelta/ground/relocation/rtmap_nexts.ma
matita/matita/contribs/lambdadelta/ground/relocation/rtmap_pushs.ma
matita/matita/contribs/lambdadelta/ground/relocation/rtmap_sle.ma
matita/matita/contribs/lambdadelta/ground/relocation/rtmap_sor.ma
matita/matita/contribs/lambdadelta/ground/relocation/rtmap_tls.ma
matita/matita/contribs/lambdadelta/ground/relocation/rtmap_uni.ma
matita/matita/contribs/lambdadelta/ground/web/ground_src.tbl

index c5d7f585772a9caf4b54597f56e003c162873bcb..e31efac1f9a3134168f6c9fe34c279c812b38844 100644 (file)
@@ -1,14 +1,11 @@
 module ET = MrcTypes
+module RL = RecommLib
 
 let read_substs substs ich =
-  let map subst =
-    let words = String.split_on_char ' ' subst in
-    List.filter ((<>) "") words
-  in
   while true do
     let line = input_line ich in
-    let subst = String.split_on_char ',' line in   
-    substs := List.map map subst :: !substs
+    let subst = RL.split_on_char ',' line in
+    substs := List.map (RL.split_on_char ' ') subst :: !substs
   done
 
 let read_file file =
index ce971dd452bb8a4cc304e53a63c39c574575c07f..87caeb10b960a18857265629d23863866106b30b 100644 (file)
@@ -13,9 +13,22 @@ let write = ref false
 
 let force = ref false
 
+let subst = ref None
+
 let chdir path =
   Sys.chdir path
 
+let start_substs () =
+  subst := Some (open_out "subst.txt")
+
+let write_substs lint = function
+  | None     -> ()
+  | Some och -> EO.write_substs och lint
+
+let stop_substs = function
+  | None     -> ()
+  | Some och -> close_out och
+
 let rec process path name =
   let file = Filename.concat path name in 
   if Sys.is_directory file then begin
@@ -26,6 +39,7 @@ let rec process path name =
     Printf.eprintf "processing: %S\n" file;
     let orig = EI.read_srcs file in
     let lint = EC.recomm_srcs orig in
+    write_substs lint !subst;
     if !force || (!write && lint <> orig) then EO.write_srcs file lint
   end else begin
     Printf.eprintf "skipping: %S\n" file
@@ -43,6 +57,7 @@ let msg_o = " Log other comments (default: no)"
 let msg_r = " Replace the input files (default: no)"
 let msg_s = " Log section comments (default: no)"
 let msg_t = " Log title comments (default: no)"
+let msg_u = " Write substitution file (default: no)"
 let msg_w = " Write the changed output files (default: no)"
 
 let main =
@@ -59,5 +74,7 @@ let main =
     "-r", Arg.Set EO.replace, msg_r;
     "-s", Arg.Set EC.log_s, msg_s;
     "-t", Arg.Set EC.log_t, msg_t;
+    "-u", Arg.Unit start_substs, msg_u;
     "-w", Arg.Set write, msg_w;
-  ] (process "") ""
+  ] (process "") "";
+  stop_substs !subst
index 655ff8095324a1a779f619bcaeef95f3ce2e41ac..53e68f84bdb20185521285680d5fed7fc2ebd56e 100644 (file)
@@ -64,20 +64,20 @@ let log color s =
 
 let rec recomm srcs st =
   match srcs with
-  | []                             ->
+  | []                                ->
     st
-  | ET.Line _ as hd :: tl          ->
+  | ET.Line _ as hd :: tl             ->
     recomm tl @@ add hd @@ st
-  | ET.Text _ as hd :: tl          ->
+  | ET.Text _ as hd :: tl             ->
     recomm tl @@ add hd @@ st
-  | ET.Mark s as hd :: tl          ->
+  | ET.Mark s as hd :: tl             ->
     if !log_m then log red s;
     recomm tl @@ add hd @@ st
-  | ET.Key (s1, s2) as hd :: tl    ->
+  | ET.Key (s1, s2) as hd :: tl       ->
     if middle st then Printf.eprintf "middle: %S\n" s1;
     if !log_k then log prune (s1^s2);
     recomm tl @@ add hd @@ st
-  | ET.Title ss :: tl              ->
+  | ET.Title ss :: tl                 ->
     if middle st then Printf.eprintf "middle: TITLE\n";
     let r, ss1, ss2 = !c_line k_final ET.OO [] ss in
     let ss2 =
@@ -87,7 +87,7 @@ let rec recomm srcs st =
     let s = String.concat " " ss in
     if !log_t then log blue s;
     recomm tl @@ add (ET.Title ss) @@ st
-  | ET.Slice ss :: tl              ->
+  | ET.Slice ss :: tl                 ->
     if middle st then Printf.eprintf "middle: Section\n";
     let r, ss1, ss2 = !s_line k_final ET.OO [] ss in
     let ss2 =
@@ -97,7 +97,7 @@ let rec recomm srcs st =
     let s = String.capitalize_ascii (String.concat " " ss) in
     if !log_s then log sky s;
     recomm tl @@ add (ET.Slice ss) @@ st
-  | ET.Other (_, s, _) as hd :: tl ->
+  | ET.Other (_, _, s, _) as hd :: tl ->
     if !log_o && not (Array.mem s mute_o) then log black s;
     recomm tl @@ add hd @@ st
 
diff --git a/matita/matita/contribs/lambdadelta/bin/recomm/recommLib.ml b/matita/matita/contribs/lambdadelta/bin/recomm/recommLib.ml
new file mode 100644 (file)
index 0000000..7624d9a
--- /dev/null
@@ -0,0 +1,2 @@
+let split_on_char c s =
+  List.filter ((<>) "") (String.split_on_char c s)
diff --git a/matita/matita/contribs/lambdadelta/bin/recomm/recommLib.mli b/matita/matita/contribs/lambdadelta/bin/recomm/recommLib.mli
new file mode 100644 (file)
index 0000000..ca2c912
--- /dev/null
@@ -0,0 +1 @@
+val split_on_char: char -> string -> string list
index 187a2984b73bcd042279cfe585be40facc1b810b..c48ba9304804a8adc1802271ee09b12eea018723 100644 (file)
@@ -1,3 +1,4 @@
+module EL = RecommLib
 module ET = RecommTypes
 
 let width = ref 78
@@ -23,24 +24,24 @@ let complete s n =
   end
 
 let out_src och = function
-  | ET.Line s             ->
+  | ET.Line s                ->
     Printf.fprintf och "%s" s
-  | ET.Text s             ->
+  | ET.Text s                ->
     Printf.fprintf och "%s" s
-  | ET.Mark s             ->
+  | ET.Mark s                ->
     Printf.fprintf och "(* *%s*)" s
-  | ET.Key (s1, s2)       ->
+  | ET.Key (s1, s2)          ->
     let s3 =
       if s1 = "NOTE" then complete (s1^s2) 0 else ""
     in
     Printf.fprintf och "(* %s%s%s*)" s1 s2 s3
-  | ET.Title ss           ->
+  | ET.Title ss              ->
     let s = String.concat " " ss in
     Printf.fprintf och "(* %s %s*)" s (complete s 1)
-  | ET.Slice ss           ->
+  | ET.Slice ss              ->
     let s = String.capitalize_ascii (String.concat " " ss) in
     Printf.fprintf och "(* %s %s*)" s (complete s 1)
-  | ET.Other (s1, s2, s3) ->
+  | ET.Other (_, s1, s2, s3) ->
     Printf.fprintf och "%s%s%s" s1 s2 s3
 
 let write_srcs file srcs =
@@ -55,3 +56,33 @@ let write_srcs file srcs =
   let och = open_out target in
   List.iter (out_src och) srcs;
   close_out och
+
+let write_subst och n s =
+  Printf.fprintf och "%s %s\n" s n
+
+let rec write_fst och = function
+  | []                                                    -> ()
+  | ET.Other (2, _, s, _) :: ET.Line _ :: ET.Text t :: tl ->
+    write_snd och tl s (EL.split_on_char ' ' t)
+  | ET.Other (2, _, s, _) :: tl                           ->
+    Printf.eprintf "skipping fst: %S\n" s;
+    write_fst och tl
+  | _ :: tl                                  -> write_fst och tl
+
+and write_snd och tl s = function
+  | "definition" :: n :: _
+  | "fact" :: n :: _
+  | "lemma" :: n :: _
+  | "inductive" :: n :: _
+  | "theorem" :: n :: _     ->
+    let ss = EL.split_on_char ' ' s in
+    List.iter (write_subst och n) (List.tl ss);
+    write_fst och tl
+  | t :: _       ->
+    Printf.eprintf "skipping snd: %S %S\n" s t;
+    write_fst och tl
+  | []             ->
+    Printf.eprintf "skipping snd: %S\n" s;
+    write_fst och tl
+
+let write_substs = write_fst
index 088b7fd9ddc5ffbe1a2398a96da726e3d82a2f16..05a0fe3247f6a81f17e6008ebc06c8e2a0e443e2 100644 (file)
@@ -3,3 +3,5 @@ val width: int ref
 val replace: bool ref
 
 val write_srcs: string -> RecommTypes.srcs -> unit
+
+val write_substs: out_channel -> RecommTypes.srcs -> unit
index 79512c7c4db97c1250390960fe9ec6ad94116e6d..d8c655bf72695175c7a43f3895127f5baa97da9e 100644 (file)
@@ -79,16 +79,16 @@ sws:
   | SP sw sws { $2 :: $3 }
 
 src_l:
-  | NL               { ET.Line  $1                     }
-  | OP sp PP inns CP { ET.Mark  $4                     }
-  | OP sp KW inns CP { ET.Key   ($3, $4)               }
-  | OP sp CW cws CP  { ET.Title ($3 :: $4)             }
-  | OP sp HW sws CP  { ET.Slice (lc $3 :: $4)          }
-  | OP sp CP         { ET.Other ($1, $2, $3)           }
-  | OP sp inns_r CP  { ET.Other ($1, $2 ^ $3, $4)      }
-  | OP SR inns CP    { ET.Other ($1, $2 ^ $3, $4)      }
-  | OP SR SR inns CP { ET.Other ($1, $2 ^ $3 ^ $4, $5) }
-  | OP SP SR inns CP { ET.Mark  $4                     }
+  | NL               { ET.Line  $1                        }
+  | OP sp PP inns CP { ET.Mark  $4                        }
+  | OP sp KW inns CP { ET.Key   ($3, $4)                  }
+  | OP sp CW cws CP  { ET.Title ($3 :: $4)                }
+  | OP sp HW sws CP  { ET.Slice (lc $3 :: $4)             }
+  | OP sp CP         { ET.Other (0, $1, $2, $3)           }
+  | OP sp inns_r CP  { ET.Other (0, $1, $2 ^ $3, $4)      }
+  | OP SR inns CP    { ET.Other (1, $1, $2 ^ $3, $4)      }
+  | OP SR SR inns CP { ET.Other (2, $1, $2 ^ $3 ^ $4, $5) }
+  | OP SP SR inns CP { ET.Mark  $4                        }
 
 src:
   | outs { ET.Text $1 }
index 7225e916e2368aff21821118aea7e5f05bd82187..7098edb5ca2a3994a5ada39c445e6eba0d97fed9 100644 (file)
@@ -18,7 +18,7 @@ type src =
 (* section *)
   | Slice of words
 (* other comment *)
-  | Other of text * text * text
+  | Other of int * text * text * text
 
 type srcs = src list
 
index 331e5a93900832a0020843e4ebfab9786b0e9a0a..9de8f4ed3f04e5f07d3dc46a33d17563a50d02a6 100644 (file)
@@ -41,21 +41,6 @@ qed-.
 
 (* Decidability of predicates ***********************************************)
 
-lemma dec_lt (R:predicate nat):
-      (∀n. Decidable … (R n)) →
-      ∀n. Decidable … (∃∃m. m < n & R m).
-#R #HR #n elim n -n [| #n * ]
-[ @or_intror * /2 width=2 by lt_zero_false/
-| * /4 width=3 by lt_S, or_introl, ex2_intro/
-| #H0 elim (HR n) -HR
-  [ /3 width=3 by or_introl, ex2_intro/
-  | #Hn @or_intror * #m #Hmn #Hm
-    elim (le_to_or_lt_eq … Hmn) -Hmn #H destruct [ -Hn | -H0 ]
-    /4 width=3 by lt_S_S_to_lt, ex2_intro/
-  ]
-]
-qed-.
-
 lemma dec_min (R:predicate nat):
       (∀n. Decidable … (R n)) → ∀n. R n →
       ∃∃m. m ≤ n & R m & (∀p. p < m → R p → ⊥).
index c2d89a6f76f5e273b2bc1eba015daaa2b12df051..5d99e4c55a1606fca21959c80055157a9c83d9fe 100644 (file)
@@ -18,7 +18,6 @@ include "ground/arith/nat_succ.ma".
 (* ORDER FOR NON-NEGATIVE INTEGERS ******************************************)
 
 (*** le *)
-(*** le_ind *)
 inductive nle (m:nat): predicate nat ≝
 | nle_refl   : nle m m
 | nle_succ_dx: ∀n. nle m n → nle m (↑n)
@@ -88,7 +87,7 @@ lemma nle_inv_succ_zero (m): ↑m ≤ 𝟎 → ⊥.
 
 lemma nle_inv_succ_sn_refl (m): ↑m ≤ m → ⊥.
 #m @(nat_ind_succ … m) -m [| #m #IH ] #H
-[ /3 width=2 by nle_inv_zero_dx, eq_inv_zero_nsucc/
+[ /2 width=2 by nle_inv_succ_zero/
 | /3 width=1 by nle_inv_succ_bi/
 ]
 qed-.
@@ -110,7 +109,7 @@ lemma nle_ind_alt (Q: relation2 nat nat):
       (∀m,n. m ≤ n → Q m n → Q (↑m) (↑n)) →
       ∀m,n. m ≤ n → Q m n.
 #Q #IH1 #IH2 #m #n @(nat_ind_2_succ … m n) -m -n //
-[ #m #H elim (nle_inv_succ_zero … H)
+[ #m #_ #H elim (nle_inv_succ_zero … H)
 | /4 width=1 by nle_inv_succ_bi/
 ]
 qed-.
index d54738f250b4100fea5bbdde0c20518572aad361..7a53e23f745851ddc67afeab505582aa40f4592e 100644 (file)
@@ -39,7 +39,11 @@ lemma nle_plus_dx_sn_refl (m) (n): m ≤ n + m.
 /2 width=1 by nle_plus_bi_sn/ qed.
 
 (*** le_plus_a *)
-lemma nle_plus_dx_sn (m) (n) (o): n ≤ m → n ≤ o + m.
+lemma nle_plus_dx_sn (o) (m) (n): n ≤ m → n ≤ o + m.
+/2 width=3 by nle_trans/ qed.
+
+(*** le_plus_b *)
+lemma nle_plus_dx_dx (o) (m) (n): n ≤ m → n ≤ m + o.
 /2 width=3 by nle_trans/ qed.
 
 (* Main constructions with nplus ********************************************)
index 0abb785f77f2966800665ace1bad20baceb18c68..4cfdfbacda75c0ce3e16bb77c56d3184a144e8ae 100644 (file)
@@ -149,3 +149,22 @@ lemma nlt_ind_alt (Q: relation2 nat nat):
 | /4 width=1 by nlt_inv_succ_bi/
 ]
 qed-.
+
+(* Advanced constructions (decidability) ************************************)
+
+(*** dec_lt *)
+lemma dec_nlt (R:predicate nat):
+      (∀n. Decidable … (R n)) →
+      ∀n. Decidable … (∃∃m. m < n & R m).
+#R #HR #n @(nat_ind_succ … n) -n [| #n * ]
+[ @or_intror * /2 width=2 by nlt_inv_zero_dx/
+| * /4 width=3 by nlt_succ_dx_trans, ex2_intro, or_introl/
+| #H0 elim (HR n) -HR
+  [ /3 width=3 by or_introl, ex2_intro/
+  | #Hn @or_intror * #m #Hmn #Hm
+    elim (nle_split_lt_eq … Hmn) -Hmn #H destruct [ -Hn | -H0 ]
+    [ /4 width=3 by nlt_inv_succ_bi, ex2_intro/
+    | lapply (eq_inv_nsucc_bi … H) -H /2 width=1 by/
+  ]
+]
+qed-.
index 89af3af2b449a9945de8419dab10d8befd8f7b56..0f0a21c829a551516ca199498b200384e5c32eab 100644 (file)
@@ -31,6 +31,12 @@ lemma nlt_plus_bi_sn (m) (n1) (n2): n1 < n2 → m + n1 < m + n2.
 @nlt_i >nplus_succ_dx /2 width=1 by nle_plus_bi_sn/
 qed.
 
+lemma nlt_plus_dx_dx (o) (m) (n): m < n → m < n + o.
+/2 width=1 by nle_plus_dx_dx/ qed.
+
+lemma nlt_plus_dx_sn (o) (m) (n) : m < n → m < o + n.
+/2 width=1 by nle_plus_dx_sn/ qed.
+
 lemma nlt_succ_plus_dx_refl_sn (m) (n): m < ↑(m + n).
 /2 width=1/ qed.
 
index ecda40f03cc32b1ca32e434d09e1f036fbf1137b..e910fdaa0c94802be4767ba40f7e13a349951a46 100644 (file)
@@ -25,7 +25,7 @@ lemma nminus_plus_sn_refl_sn (m) (n): m = m + n - n.
 #n #IH <nplus_succ_dx <nminus_succ_bi //
 qed.
 
-(*** minus_plus_m_m *)
+(*** minus_plus_m_m_commutative *)
 lemma nminus_plus_sn_refl_dx (m) (n): m = n + m - n.
 #m #n <nplus_comm //
 qed.
@@ -61,7 +61,7 @@ lemma eq_inv_plus_nminus_refl_sn (m) (n) (o):
        | ∧∧ 𝟎 = n & 𝟎 = o.
 #m #n @(nat_ind_2_succ … m n) -m -n
 [ /3 width=1 by or_introl, conj/
-| #m #o #Ho
+| #m #_ #o #Ho
   lapply (eq_inv_nplus_bi_sn … (𝟎) Ho) -Ho
   /3 width=1 by or_intror, conj/
 | #m #n #IH #o
diff --git a/matita/matita/contribs/lambdadelta/ground/arith/nat_plus_rplus.ma b/matita/matita/contribs/lambdadelta/ground/arith/nat_plus_rplus.ma
new file mode 100644 (file)
index 0000000..e80e241
--- /dev/null
@@ -0,0 +1,34 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/arith/nat_rplus_succ.ma".
+include "ground/arith/nat_plus.ma".
+
+(* ADDITION FOR NON-NEGATIVE INTEGERS ***************************************)
+
+(* Constructions with rplus *************************************************)
+
+lemma nrplus_inj_sn (p) (n):
+      ninj (p + n) = ninj p + n.
+#p #n @(nat_ind_succ … n) -n //
+#n #IH <nplus_succ_dx <IH //
+qed.
+
+(* Constructions with rplus and npsucc **************************************)
+
+lemma nrplus_npsucc_sn (m) (n):
+      npsucc (m + n) = npsucc m + n.
+#m @(nat_ind_succ … m) -m //
+#m #IH #n <npsucc_succ <nrplus_succ_sn //
+qed.
index 4acdf37b5f1997531e980ac9b9195b333c28c71e..d7f79d76b8084d89079406c281a86de8872545f8 100644 (file)
@@ -18,10 +18,17 @@ include "ground/arith/nat.ma".
 
 (* PREDECESSOR FOR NON-NEGATIVE INTEGERS ************************************)
 
+definition pnpred (p): nat ≝
+           psplit … (𝟎) ninj p.
+
+interpretation
+  "positive predecessor (non-negative integers)"
+  'DownArrow p = (pnpred p).
+
 (*** pred *)
 definition npred (m): nat ≝ match m with
 [ nzero  ⇒ 𝟎
-| ninj p ⇒ psplit … (𝟎) ninj p
+| ninj p ⇒ p
 ].
 
 interpretation
@@ -34,6 +41,9 @@ interpretation
 lemma npred_zero: 𝟎 = ↓𝟎.
 // qed.
 
+lemma npred_inj (p): ↓p = ↓(ninj p).
+// qed.
+
 lemma npred_one: 𝟎 = ↓𝟏.
 // qed.
 
index 3d79e371ebb0561e12510868a5af77df236c3868..dafe179103c40e47e1826004af3b277d07961bd2 100644 (file)
@@ -17,6 +17,21 @@ include "ground/arith/nat_pred.ma".
 
 (* PREDECESSOR FOR NON-NEGATIVE INTEGERS ************************************)
 
+(* Constructions with npsucc ************************************************)
+
+lemma pnpred_succ (n): n = pnpred (npsucc n).
+* //
+qed.
+
+lemma npsucc_pred (p): p = npsucc (pnpred p).
+* //
+qed.
+
+(* Constructions with nsucc and psucc ***************************************)
+
+lemma pnpred_psucc (p): pnpred (psucc p) = nsucc (pnpred p).
+* // qed.
+
 (* Constructions with nsucc *************************************************)
 
 (*** pred_Sn pred_S *)
diff --git a/matita/matita/contribs/lambdadelta/ground/arith/nat_rplus.ma b/matita/matita/contribs/lambdadelta/ground/arith/nat_rplus.ma
new file mode 100644 (file)
index 0000000..694ac94
--- /dev/null
@@ -0,0 +1,36 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/arith/nat_iter.ma".
+
+(* RIGHT ADDITION FOR NON-NEGATIVE INTEGERS *********************************)
+
+definition nrplus: pnat → nat → pnat ≝
+           λp,n. psucc^n p.
+
+interpretation
+  "right plus (non-negative integers)"
+  'plus p n = (nrplus p n).
+
+(* Basic constructions ******************************************************)
+
+lemma nrplus_zero_dx (p): p = p + 𝟎.
+// qed.
+
+lemma nrplus_unit_dx (p): ↑p = p + 𝟏.
+// qed.
+
+lemma nrplus_succ_sn (p) (n): ↑(p+n) = ↑p + n.
+#p #n @(niter_appl … psucc)
+qed.
diff --git a/matita/matita/contribs/lambdadelta/ground/arith/nat_rplus_succ.ma b/matita/matita/contribs/lambdadelta/ground/arith/nat_rplus_succ.ma
new file mode 100644 (file)
index 0000000..d7dfaa1
--- /dev/null
@@ -0,0 +1,38 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/arith/nat_succ_iter.ma".
+include "ground/arith/nat_rplus.ma".
+
+(* RIGHT ADDITION FOR NON-NEGATIVE INTEGERS *********************************)
+
+(* Constructions with nsucc *************************************************)
+
+lemma nrplus_succ_dx (p) (n): ↑(p+n) = p + ↑n.
+#p #n @(niter_succ … psucc)
+qed.
+
+lemma nrplus_succ_shift (p) (n): ↑p + n = p + ↑n.
+// qed.
+
+lemma nrplus_unit_sn (n): ↑n = 𝟏 + n.
+#n @(nat_ind_succ … n) -n //
+qed.
+
+(* Advanced constructions ***************************************************)
+
+lemma nrplus_comm_23 (p) (n1) (n2):
+      p + n1 + n2 = p + n2 + n1.
+#p #n1 @(nat_ind_succ … n1) -n1 //
+qed.
index bb2300f021a2e549d6f25bbb13dd49ace62a07cc..742c6b25776f397bfddd57541f8a007ad5a0b4cc 100644 (file)
@@ -16,7 +16,7 @@ include "ground/arith/nat.ma".
 
 (* SUCCESSOR FOR NON-NEGATIVE INTEGERS **************************************)
 
-definition nsucc_pos (m): pnat ≝
+definition npsucc (m): pnat ≝
 match m with
 [ nzero  ⇒ 𝟏
 | ninj p ⇒ ↑p
@@ -24,7 +24,7 @@ match m with
 
 interpretation
   "positive successor (non-negative integers)"
-  'UpArrow m = (nsucc_pos m).
+  'UpArrow m = (npsucc m).
 
 definition nsucc (m): nat ≝
            ninj (↑m).
@@ -35,12 +35,21 @@ interpretation
 
 (* Basic constructions ******************************************************)
 
+lemma npsucc_zero: (𝟏) = ↑𝟎.
+// qed.
+
+lemma npsucc_inj (p): (↑p) = ↑(ninj p).
+// qed.
+
 lemma nsucc_zero: ninj (𝟏) = ↑𝟎.
 // qed.
 
 lemma nsucc_inj (p): ninj (↑p) = ↑(ninj p).
 // qed.
 
+lemma npsucc_succ (n): psucc (npsucc n) = npsucc (nsucc n).
+// qed.
+
 (* Basic eliminations *******************************************************)
 
 (*** nat_ind *)
@@ -53,7 +62,7 @@ qed-.
 (*** nat_elim2 *)
 lemma nat_ind_2_succ (Q:relation2 …):
       (∀n. Q (𝟎) n) →
-      (∀m. Q (↑m) (𝟎)) →
+      (∀m. Q m (𝟎) → Q (↑m) (𝟎)) →
       (∀m,n. Q m n → Q (↑m) (↑n)) →
       ∀m,n. Q m n.
 #Q #IH1 #IH2 #IH3 #m @(nat_ind_succ … m) -m [ // ]
@@ -62,15 +71,20 @@ qed-.
 
 (* Basic inversions *********************************************************)
 
-(*** injective_S *)
-lemma eq_inv_nsucc_bi: injective … nsucc.
+lemma eq_inv_npsucc_bi: injective … npsucc.
 * [| #p1 ] * [2,4: #p2 ]
-[1,4: <nsucc_zero <nsucc_inj #H destruct
-| <nsucc_inj <nsucc_inj #H destruct //
+[ 1,4: <npsucc_zero <npsucc_inj #H destruct
+| <npsucc_inj <npsucc_inj #H destruct //
 | //
 ]
 qed-.
 
+(*** injective_S *)
+lemma eq_inv_nsucc_bi: injective … nsucc.
+#n1 #n2 #H
+@eq_inv_npsucc_bi @eq_inv_ninj_bi @H
+qed-.
+
 lemma eq_inv_nsucc_zero (m): ↑m = 𝟎 → ⊥.
 * [ <nsucc_zero | #p <nsucc_inj ] #H destruct
 qed-.
index d90f8dd8d23ec00b536a5db1aeb06221aa0ab20d..516ba683a1687802780fa3b7eba0724612941562 100644 (file)
@@ -55,3 +55,14 @@ lemma eq_pnat_dec (p1,p2:pnat): Decidable (p1 = p2).
 | /2 width=1 by or_introl/
 ]
 qed-.
+
+(* Basic eliminations *******************************************************)
+
+lemma pnat_ind_2 (Q:relation2 …):
+      (∀q. Q (𝟏) q) →
+      (∀p. Q p (𝟏) → Q (↑p) (𝟏)) →
+      (∀p,q. Q p q → Q (↑p) (↑q)) →
+      ∀p,q. Q p q.
+#Q #IH1 #IH2 #IH3 #p elim p -p [ // ]
+#p #IH #q elim q -q /2 width=1 by/
+qed-.
diff --git a/matita/matita/contribs/lambdadelta/ground/arith/pnat_le.ma b/matita/matita/contribs/lambdadelta/ground/arith/pnat_le.ma
new file mode 100644 (file)
index 0000000..e33853b
--- /dev/null
@@ -0,0 +1,119 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/generated/insert_eq_1.ma".
+include "ground/arith/pnat.ma".
+
+(* ORDER FOR POSITIVE INTEGERS **********************************************)
+
+inductive ple (p:pnat): predicate pnat ≝
+| ple_refl   : ple p p
+| ple_succ_dx: ∀q. ple p q → ple p (↑q)
+.
+
+interpretation
+  "less equal (positive integers)"
+  'leq p q = (ple p q).
+
+(* Basic constructions ******************************************************)
+
+lemma ple_succ_dx_refl (p): p ≤ ↑p.
+/2 width=1 by ple_refl, ple_succ_dx/ qed.
+
+lemma ple_unit_sx (p): 𝟏 ≤ p.
+#p elim p -p /2 width=1 by ple_succ_dx/
+qed.
+
+lemma ple_succ_bi (p) (q): p ≤ q → ↑p ≤ ↑q.
+#p #q #H elim H -q /2 width=1 by ple_refl, ple_succ_dx/
+qed.
+
+lemma pnat_split_le_ge (p) (q): ∨∨ p ≤ q | q ≤ p.
+#p #q @(pnat_ind_2 … p q) -p -q
+[ /2 width=1 by or_introl/
+| /2 width=1 by or_intror/
+| #p #q * /3 width=2 by ple_succ_bi, or_introl, or_intror/
+]
+qed-.
+
+(* Basic destructions *******************************************************)
+
+lemma ple_des_succ_sn (p) (q): ↑p ≤ q → p ≤ q.
+#p #q #H elim H -q /2 width=1 by ple_succ_dx/
+qed-.
+
+(* Basic inversions *********************************************************)
+
+lemma ple_inv_succ_bi (p) (q): ↑p ≤ ↑q → p ≤ q.
+#p #q @(insert_eq_1 … (↑q))
+#x * -x
+[ #H destruct //
+| #o #Ho #H destruct
+  /2 width=1 by ple_des_succ_sn/ 
+]
+qed-.
+
+lemma ple_inv_unit_dx (p): p ≤ 𝟏 → 𝟏 = p.
+#p @(insert_eq_1 … (𝟏))
+#y * -y
+[ #H destruct //
+| #y #_ #H destruct
+]
+qed-.
+
+(* Advanced inversions ******************************************************)
+
+lemma ple_inv_succ_unit (p): ↑p ≤ 𝟏 → ⊥.
+#p #H
+lapply (ple_inv_unit_dx … H) -H #H destruct
+qed-.
+
+lemma ple_inv_succ_sn_refl (p): ↑p ≤ p → ⊥.
+#p elim p -p [| #p #IH ] #H
+[ /2 width=2 by ple_inv_succ_unit/
+| /3 width=1 by ple_inv_succ_bi/
+]
+qed-.
+
+theorem ple_antisym (p) (q): p ≤ q → q ≤ p → p = q.
+#p #q #H elim H -q //
+#q #_ #IH #Hq
+lapply (ple_des_succ_sn … Hq) #H
+lapply (IH H) -IH -H #H destruct
+elim (ple_inv_succ_sn_refl … Hq)
+qed-.
+
+(* Advanced eliminations ****************************************************)
+
+lemma ple_ind_alt (Q: relation2 pnat pnat):
+      (∀q. Q (𝟏) (q)) →
+      (∀p,q. p ≤ q → Q p q → Q (↑p) (↑q)) →
+      ∀p,q. p ≤ q → Q p q.
+#Q #IH1 #IH2 #p #q @(pnat_ind_2 … p q) -p -q //
+[ #p #_ #H elim (ple_inv_succ_unit … H)
+| /4 width=1 by ple_inv_succ_bi/
+]
+qed-.
+
+(* Advanced constructions ***************************************************)
+
+theorem ple_trans: Transitive … ple.
+#p #q #H elim H -q /3 width=1 by ple_des_succ_sn/
+qed-.
+
+lemma ple_dec (p) (q): Decidable … (p ≤ q).
+#p #q elim (pnat_split_le_ge p q) [ /2 width=1 by or_introl/ ]
+#Hqp elim (eq_pnat_dec p q) [ #H destruct /2 width=1 by ple_refl, or_introl/ ]
+/4 width=1 by ple_antisym, or_intror/
+qed-.
diff --git a/matita/matita/contribs/lambdadelta/ground/arith/pnat_le_plus.ma b/matita/matita/contribs/lambdadelta/ground/arith/pnat_le_plus.ma
new file mode 100644 (file)
index 0000000..8d5a28a
--- /dev/null
@@ -0,0 +1,29 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/arith/pnat_plus.ma".
+include "ground/arith/pnat_le.ma".
+
+(* ORDER FOR POSITIVE INTEGERS **********************************************)
+
+(* Constructions with pplus *************************************************)
+
+lemma ple_plus_bi_dx (p) (q1) (q2): q1 ≤ q2 → q1 + p ≤ q2 + p.
+#p #q1 #q2 #H elim H -q2 /2 width=3 by ple_trans/
+qed.
+
+lemma ple_plus_bi_sn (p) (q1) (q2): q1 ≤ q2 → p + q1 ≤ p + q2.
+#p #q1 #q2 #H <pplus_comm <pplus_comm in ⊢ (??%);
+/2 width=1 by ple_plus_bi_dx/
+qed.
diff --git a/matita/matita/contribs/lambdadelta/ground/arith/pnat_le_pred.ma b/matita/matita/contribs/lambdadelta/ground/arith/pnat_le_pred.ma
new file mode 100644 (file)
index 0000000..fb706fd
--- /dev/null
@@ -0,0 +1,54 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/arith/pnat_pred.ma".
+include "ground/arith/pnat_le.ma".
+
+(* ORDER FOR POSITIVE INTEGERS **********************************************)
+
+(* Destructions with ppred **************************************************)
+
+lemma ple_inv_pred_sn (p) (q): ↓p ≤ q → p ≤ ↑q.
+#p #q elim p -p
+/2 width=1 by ple_succ_bi/
+qed-.
+
+(* Constructions with ppred *************************************************)
+
+lemma ple_succ_pred_dx_refl (p): p ≤ ↑↓p.
+#p @ple_inv_pred_sn // qed.
+
+lemma ple_pred_sn_refl (p): ↓p ≤ p.
+#p elim p -p //
+qed.
+
+lemma ple_pred_bi (p) (q): p ≤ q → ↓p ≤ ↓q.
+#p #q #H elim H -q //
+/2 width=3 by ple_trans/
+qed.
+
+lemma ple_pred_sn (p) (q): p ≤ ↑q → ↓p ≤ q.
+#p #q elim p -p //
+/2 width=1 by ple_pred_bi/
+qed-.
+
+(* Inversions with ppred ****************************************************)
+
+lemma ple_inv_succ_sn (p) (q):
+      ↑p ≤ q → ∧∧ p ≤ ↓q & q = ↑↓q.
+#p #q * -q
+[ /2 width=3 by ple_refl, conj/
+| #q #Hq /3 width=1 by ple_des_succ_sn, conj/
+]
+qed-.
diff --git a/matita/matita/contribs/lambdadelta/ground/arith/pnat_lt.ma b/matita/matita/contribs/lambdadelta/ground/arith/pnat_lt.ma
new file mode 100644 (file)
index 0000000..ef4c322
--- /dev/null
@@ -0,0 +1,148 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/xoa/or_3.ma".
+include "ground/arith/pnat_le.ma".
+
+(* STRICT ORDER FOR POSITIVE INTEGERS ***************************************)
+
+definition plt: relation2 pnat pnat ≝
+           λp,q. ↑p ≤ q.
+
+interpretation
+  "less (positive integers)"
+  'lt p q = (plt p q).
+
+(* Basic constructions ******************************************************)
+
+lemma plt_i (p) (q): ↑p ≤ q → p < q.
+// qed.
+
+lemma plt_refl_succ (q): q < ↑q.
+// qed.
+
+lemma plt_succ_dx (p) (q): p ≤ q → p < ↑q.
+/2 width=1 by ple_succ_bi/ qed.
+
+lemma plt_succ_dx_trans (p) (q): p < q → p < ↑q.
+/2 width=1 by ple_succ_dx/ qed.
+
+lemma plt_unit_succ (p): 𝟏 < ↑p.
+/2 width=1 by ple_succ_bi/ qed.
+
+lemma plt_succ_bi (p) (q): p < q → ↑p < ↑q.
+/2 width=1 by ple_succ_bi/ qed.
+
+lemma ple_split_lt_eq (p) (q): p ≤ q → ∨∨ p < q | p = q.
+#p #q * -q /3 width=1 by ple_succ_bi, or_introl/
+qed-.
+
+lemma pnat_split_unit_gt (q): ∨∨ 𝟏 = q | 𝟏 < q.
+#q elim (ple_split_lt_eq (𝟏) q ?)
+/2 width=1 by or_introl, or_intror/
+qed-.
+
+lemma pnat_split_lt_ge (p) (q): ∨∨ p < q | q ≤ p.
+#p #q elim (pnat_split_le_ge p q) /2 width=1 by or_intror/
+#H elim (ple_split_lt_eq … H) -H /2 width=1 by ple_refl, or_introl, or_intror/
+qed-.
+
+lemma pnat_split_lt_eq_gt (p) (q): ∨∨ p < q | q = p | q < p.
+#p #q elim (pnat_split_lt_ge p q) /2 width=1 by or3_intro0/
+#H elim (ple_split_lt_eq … H) -H /2 width=1 by or3_intro1, or3_intro2/
+qed-.
+
+lemma le_false_plt (p) (q): (q ≤ p → ⊥) → p < q.
+#p #q elim (pnat_split_lt_ge p q) [ // ]
+#H #Hq elim Hq -Hq // 
+qed.
+
+lemma plt_ple_trans (r) (p) (q): p < r → r ≤ q → p < q.
+/2 width=3 by ple_trans/ qed-.
+
+lemma ple_plt_trans (r) (p) (q): p ≤ r → r < q → p < q.
+/3 width=3 by ple_succ_bi, ple_trans/ qed-.
+
+(* Basic inversions *********************************************************)
+
+lemma plt_inv_succ_dx (p) (q): p < ↑q → p ≤ q.
+/2 width=1 by ple_inv_succ_bi/ qed-.
+
+lemma plt_inv_succ_bi (p) (q): ↑p < ↑q → p < q.
+/2 width=1 by ple_inv_succ_bi/ qed-.
+
+lemma plt_ge_false (p) (q): p < q → q ≤ p → ⊥.
+/3 width=4 by ple_inv_succ_sn_refl, plt_ple_trans/ qed-.
+
+lemma plt_inv_refl (p): p < p → ⊥.
+/2 width=4 by plt_ge_false/ qed-.
+
+lemma plt_inv_unit_dx (p): p < 𝟏 → ⊥.
+/2 width=4 by plt_ge_false/ qed-.
+
+(* Basic destructions *******************************************************)
+
+lemma plt_des_le (p) (q): p < q → p ≤ q.
+/2 width=3 by ple_trans/ qed-.
+
+lemma plt_des_lt_unit_sn (p) (q): p < q → 𝟏 < q.
+/3 width=3 by ple_plt_trans/ qed-.
+
+(* Main constructions *******************************************************)
+
+theorem plt_trans: Transitive … plt.
+/3 width=3 by plt_des_le, plt_ple_trans/ qed-.
+
+(* Advanced eliminations ****************************************************)
+
+lemma pnat_ind_lt_le (Q:predicate …):
+      (∀q. (∀p. p < q → Q p) → Q q) → ∀q,p. p ≤ q → Q p.
+#Q #H1 #q elim q -q
+[ #p #H <(ple_inv_unit_dx … H) -p
+  @H1 -H1 #r #H elim (plt_inv_unit_dx … H)
+| /5 width=3 by plt_ple_trans, ple_inv_succ_bi/
+]
+qed-.
+
+lemma pnat_ind_lt (Q:predicate …):
+      (∀q. (∀p. p < q → Q p) → Q q) → ∀q. Q q.
+/4 width=2 by pnat_ind_lt_le/ qed-.
+
+lemma plt_ind_alt (Q: relation2 pnat pnat):
+      (∀q. Q (𝟏) (↑q)) →
+      (∀p,q. p < q → Q p q → Q (↑p) (↑q)) →
+      ∀p,q. p < q → Q p q.
+#Q #IH1 #IH2 #p #q @(pnat_ind_2 … q p) -p -q //
+[ #p #H
+  elim (plt_inv_unit_dx … H)
+| /4 width=1 by plt_inv_succ_bi/
+]
+qed-.
+
+(* Advanced constructions (decidability) ************************************)
+
+lemma dec_plt (R:predicate pnat):
+      (∀q. Decidable … (R q)) →
+      ∀q. Decidable … (∃∃p. p < q & R p).
+#R #HR #q elim q -q [| #q * ]
+[ @or_intror * /2 width=2 by plt_inv_unit_dx/
+| * /4 width=3 by plt_succ_dx_trans, ex2_intro, or_introl/
+| #H0 elim (HR q) -HR
+  [ /3 width=3 by or_introl, ex2_intro/
+  | #Hq @or_intror * #p #Hpq #Hp
+    elim (ple_split_lt_eq … Hpq) -Hpq #H destruct [ -Hq | -H0 ]
+    /4 width=3 by plt_inv_succ_bi, ex2_intro/
+  ]
+]
+qed-.
diff --git a/matita/matita/contribs/lambdadelta/ground/arith/pnat_lt_pred.ma b/matita/matita/contribs/lambdadelta/ground/arith/pnat_lt_pred.ma
new file mode 100644 (file)
index 0000000..da550d5
--- /dev/null
@@ -0,0 +1,57 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/arith/pnat_le_pred.ma".
+include "ground/arith/pnat_lt.ma".
+
+(* STRICT ORDER FOR POSITIVE INTEGERS ***************************************)
+
+(* Destructions with ppred **************************************************)
+
+lemma plt_des_gen (p) (q): p < q → q = ↑↓q.
+#p #q elim q -q //
+#H elim (plt_inv_unit_dx … H)
+qed-.
+
+(* Inversions with ppred ****************************************************)
+
+lemma plt_inv_gen (p) (q): p < q → ∧∧ p ≤ ↓q & q = ↑↓q.
+/2 width=1 by ple_inv_succ_sn/ qed-.
+
+lemma plt_inv_succ_sn (p) (q): ↑p < q → ∧∧ p < ↓q & q = ↑↓q.
+/2 width=1 by ple_inv_succ_sn/ qed-.
+
+lemma plt_inv_pred_dx (p) (q): p < ↓q → ↑p < q.
+#p #q #H >(plt_des_gen (𝟏) q)
+[ /2 width=1 by plt_succ_bi/
+| /3 width=3 by ple_plt_trans, plt_ple_trans/
+]
+qed-.
+
+lemma plt_inv_pred_bi (p) (q):
+      ↓p < ↓q → p < q.
+/3 width=3 by plt_inv_pred_dx, ple_plt_trans/
+qed-.
+
+(* Constructions with ppred *************************************************)
+
+lemma plt_unit_sn (q): q = ↑↓q → 𝟏 < q.
+// qed.
+
+lemma plt_pred_bi (p) (q): 𝟏 < p → p < q → ↓p < ↓q.
+#p #q #Hp #Hpq
+@ple_inv_succ_bi
+<(plt_des_gen … Hp) -Hp
+<(plt_des_gen … Hpq) //
+qed.
index 8fd6b5c47034a1cf6783ab55845b669dce8e9513..1ff7afbb4c1945ff56bfca1781eca4a586177ce4 100644 (file)
@@ -49,3 +49,25 @@ lemma pplus_assoc: associative … pplus.
 #p #q #r elim r -r //
 #r #IH <pplus_succ_dx <pplus_succ_dx <IH -IH //
 qed.
+
+(* Basic inversions *********************************************************)
+
+lemma eq_inv_unit_pplus (p) (q): 𝟏 = p + q → ⊥.
+#p #q elim q -q
+[ <pplus_one_dx #H destruct
+| #q #_ <pplus_succ_dx #H destruct
+]
+qed-.
+
+lemma eq_inv_pplus_unit (p) (q):
+      p + q = 𝟏 → ⊥.
+/2 width=3 by eq_inv_unit_pplus/ qed-.
+
+lemma eq_inv_pplus_bi_dx (r) (p) (q): p + r = q + r → p = q.
+#r elim r -r /3 width=1 by eq_inv_psucc_bi/
+qed-.
+
+lemma eq_inv_pplus_bi_sn (r) (p) (q): r + p = r + q → p = q.
+#r #p #q <pplus_comm <pplus_comm in ⊢ (???%→?);
+/2 width=2 by eq_inv_pplus_bi_dx/
+qed-.
diff --git a/matita/matita/contribs/lambdadelta/ground/arith/pnat_pred.ma b/matita/matita/contribs/lambdadelta/ground/arith/pnat_pred.ma
new file mode 100644 (file)
index 0000000..2723aba
--- /dev/null
@@ -0,0 +1,44 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/notation/functions/downarrow_1.ma".
+include "ground/arith/pnat_split.ma".
+
+(* PREDECESSOR FOR POSITIVE INTEGERS ****************************************)
+
+definition ppred (p): pnat ≝ psplit … (𝟏) (λp.p) p.
+
+interpretation
+  "predecessor (positive integers)"
+  'DownArrow p = (ppred p).
+
+(* Basic constructions ******************************************************)
+
+lemma ppred_unit: 𝟏 = ↓𝟏.
+// qed.
+
+lemma ppred_succ (p): p = ↓↑p.
+// qed.
+
+(* Basic inversions *********************************************************)
+
+lemma ppred_inv_refl (p): p = ↓p → 𝟏 = p.
+#p elim p -p //
+#p #IH #H /2 width=1 by/
+qed-.
+
+lemma pnat_split_unit_pos (p): ∨∨ 𝟏 = p | p = ↑↓p.
+#p elim p -p
+/2 width=1 by or_introl, or_intror/
+qed-.
diff --git a/matita/matita/contribs/lambdadelta/ground/notation/relations/ratsucc_3.ma b/matita/matita/contribs/lambdadelta/ground/notation/relations/ratsucc_3.ma
new file mode 100644 (file)
index 0000000..8f7e286
--- /dev/null
@@ -0,0 +1,19 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+(* GROUND NOTATION **********************************************************)
+
+notation "hvbox( @↑❪ term 46 T1 , break term 46 f ❫ ≘ break term 46 T2 )"
+  non associative with precedence 45
+  for @{ 'RAtSucc $T1 $f $T2 }.
index 0016e8c0dbcdb32c620f548b85d513a6e944e12a..6d3cb82d3eb8ceac002d0d18b19a13e8f733538e 100644 (file)
@@ -14,7 +14,7 @@
 
 include "ground/notation/functions/diamond_0.ma".
 include "ground/notation/functions/semicolon_3.ma".
-include "ground/lib/arith.ma".
+include "ground/arith/nat.ma".
 
 (* MULTIPLE RELOCATION WITH PAIRS *******************************************)
 
index 51ac826b08e633f66d17cb6a344f5d04b92f7ea1..6d60ead1bd4cdeb1fddec63a3e0aa2491a7d9fed 100644 (file)
@@ -13,6 +13,8 @@
 (**************************************************************************)
 
 include "ground/notation/relations/rat_3.ma".
+include "ground/arith/nat_plus.ma".
+include "ground/arith/nat_lt.ma".
 include "ground/relocation/mr2.ma".
 
 (* MULTIPLE RELOCATION WITH PAIRS *******************************************)
@@ -61,14 +63,14 @@ lemma at_inv_cons_lt: ∀cs,l,m,i1,i2. @❪i1, ❨l, m❩;cs❫ ≘ i2 →
                       i1 < l → @❪i1, cs❫ ≘ i2.
 #cs #l #m #i1 #m2 #H
 elim (at_inv_cons … H) -H * // #Hli1 #_ #Hi1l
-elim (lt_le_false … Hi1l Hli1)
+elim (nlt_ge_false … Hi1l Hli1)
 qed-.
 
 lemma at_inv_cons_ge: ∀cs,l,m,i1,i2. @❪i1, ❨l, m❩;cs❫ ≘ i2 →
                       l ≤ i1 → @❪i1 + m, cs❫ ≘ i2.
 #cs #l #m #i1 #m2 #H
 elim (at_inv_cons … H) -H * // #Hi1l #_ #Hli1
-elim (lt_le_false … Hi1l Hli1)
+elim (nlt_ge_false … Hi1l Hli1)
 qed-.
 
 (* Main properties **********************************************************)
index 422a635dc2865cbb3a0bb7f95d22f0d4db6d6013..49001d50877bca7617eb83714b2f74f6e3933cf6 100644 (file)
 (*                                                                        *)
 (**************************************************************************)
 
+include "ground/xoa/ex_3_1.ma".
 include "ground/notation/relations/rminus_3.ma".
+include "ground/arith/nat_plus.ma".
+include "ground/arith/nat_minus.ma".
+include "ground/arith/nat_lt.ma".
 include "ground/relocation/mr2.ma".
 
 (* MULTIPLE RELOCATION WITH PAIRS *******************************************)
@@ -63,12 +67,12 @@ lemma minuss_inv_cons1_ge: ∀cs1,cs2,l,m,i. ❨l, m❩;cs1 ▭ i ≘ cs2 →
                            l ≤ i → cs1 ▭ m + i ≘ cs2.
 #cs1 #cs2 #l #m #i #H
 elim (minuss_inv_cons1 … H) -H * // #cs #Hil #_ #_ #Hli
-elim (lt_le_false … Hil Hli)
+elim (nlt_ge_false … Hil Hli)
 qed-.
 
 lemma minuss_inv_cons1_lt: ∀cs1,cs2,l,m,i. ❨l, m❩;cs1 ▭ i ≘ cs2 →
                            i < l →
                            ∃∃cs. cs1 ▭ i ≘ cs & cs2 = ❨l - i, m❩;cs.
 #cs1 #cs2 #l #m #i #H elim (minuss_inv_cons1 … H) -H * /2 width=3 by ex2_intro/
-#Hli #_ #Hil elim (lt_le_false … Hil Hli)
+#Hli #_ #Hil elim (nlt_ge_false … Hil Hli)
 qed-.
index 07374a027d845560ef722c68452522cef322e845..29c76eb3369b2ce8d83c17745dfa1a8b338982df 100644 (file)
@@ -12,6 +12,7 @@
 (*                                                                        *)
 (**************************************************************************)
 
+include "ground/arith/nat_minus_plus.ma".
 include "ground/relocation/mr2.ma".
 
 (* MULTIPLE RELOCATION WITH PAIRS *******************************************)
@@ -26,7 +27,7 @@ interpretation "plus (multiple relocation with pairs)"
 
 (* Basic properties *********************************************************)
 
-lemma pluss_SO2: ∀l,m,cs. (❨l,m❩;cs) + 1 = ❨↑l,m❩;cs + 1.
+lemma pluss_SO2: ∀l,m,cs. ((❨l,m❩;cs) + 𝟏) = ❨↑l,m❩;cs + 𝟏.
 normalize // qed.
 
 (* Basic inversion lemmas ***************************************************)
@@ -41,6 +42,6 @@ lemma pluss_inv_cons2: ∀i,l,m,cs2,cs. cs + i = ❨l,m❩;cs2 →
 #i #l #m #cs2 *
 [ normalize #H destruct
 | #l1 #m1 #cs1 whd in ⊢ (??%?→?); #H destruct
-  <minus_plus_m_m /2 width=3 by ex2_intro/
+  <nminus_plus_sn_refl_sn /2 width=3 by ex2_intro/
 ]
 qed-.
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/nstream.ma b/matita/matita/contribs/lambdadelta/ground/relocation/nstream.ma
deleted file mode 100644 (file)
index 8819cdc..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-(**************************************************************************)
-(*       ___                                                              *)
-(*      ||M||                                                             *)
-(*      ||A||       A project by Andrea Asperti                           *)
-(*      ||T||                                                             *)
-(*      ||I||       Developers:                                           *)
-(*      ||T||         The HELM team.                                      *)
-(*      ||A||         http://helm.cs.unibo.it                             *)
-(*      \   /                                                             *)
-(*       \ /        This file is distributed under the terms of the       *)
-(*        v         GNU General Public License Version 2                  *)
-(*                                                                        *)
-(**************************************************************************)
-
-include "ground/notation/functions/upspoon_1.ma".
-include "ground/lib/stream_tls.ma".
-
-(* RELOCATION N-STREAM ******************************************************)
-
-definition rtmap: Type[0] ≝ stream nat.
-
-definition push: rtmap → rtmap ≝ λf. 0⨮f.
-
-interpretation "push (nstream)" 'UpSpoon f = (push f).
-
-definition next: rtmap → rtmap.
-* #n #f @(↑n⨮f)
-defined.
-
-interpretation "next (nstream)" 'UpArrow f = (next f).
-
-(* Basic properties *********************************************************)
-
-lemma push_rew: ∀f. 0⨮f = ⫯f.
-// qed.
-
-lemma next_rew: ∀f,n. (↑n)⨮f = ↑(n⨮f).
-// qed.
-
-(* Basic inversion lemmas ***************************************************)
-
-lemma injective_push: injective ? ? push.
-#f1 #f2 normalize #H destruct //
-qed-.
-
-lemma discr_push_next: ∀f1,f2. ⫯f1 = ↑f2 → ⊥.
-#f1 * #n2 #f2 normalize #H destruct
-qed-.
-
-lemma discr_next_push: ∀f1,f2. ↑f1 = ⫯f2 → ⊥.
-* #n1 #f1 #f2 normalize #H destruct
-qed-.
-
-lemma injective_next: injective ? ? next.
-* #n1 #f1 * #n2 #f2 normalize #H destruct //
-qed-.
-
-lemma push_inv_seq_sn: ∀f,g,n. n⨮g = ⫯f → 0 = n ∧ g = f.
-#f #g #n <push_rew #H destruct /2 width=1 by conj/
-qed-.
-
-lemma push_inv_seq_dx: ∀f,g,n. ⫯f = n⨮g → 0 = n ∧ g = f.
-#f #g #n <push_rew #H destruct /2 width=1 by conj/
-qed-.
-
-lemma next_inv_seq_sn: ∀f,g,n. n⨮g = ↑f → ∃∃m. m⨮g = f & ↑m = n.
-* #m #f #g #n <next_rew #H destruct /2 width=3 by ex2_intro/
-qed-.
-
-lemma next_inv_seq_dx: ∀f,g,n. ↑f = n⨮g → ∃∃m. m⨮g = f & ↑m = n.
-* #m #f #g #n <next_rew #H destruct /2 width=3 by ex2_intro/
-qed-.
-
-lemma case_prop: ∀R:predicate rtmap.
-                 (∀f. R (⫯f)) → (∀f. R (↑f)) → ∀f. R f.
-#R #H1 #H2 * * //
-qed-.
-
-lemma case_type0: ∀R:rtmap→Type[0].
-                  (∀f. R (⫯f)) → (∀f. R (↑f)) → ∀f. R f.
-#R #H1 #H2 * * //
-qed-.
-
-lemma iota_push: ∀R,a,b,f. a f = case_type0 R a b (⫯f).
-// qed.
-
-lemma iota_next: ∀R,a,b,f. b f = case_type0 R a b (↑f).
-#R #a #b * //
-qed.
-
-(* Poperties with stream_tl *************************************************)
-
-lemma tl_push: ∀f. f = ⫰⫯f.
-// qed.
-
-lemma tl_next: ∀f. ⫰f = ⫰↑f.
-* // qed.
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/nstream_after.ma b/matita/matita/contribs/lambdadelta/ground/relocation/nstream_after.ma
deleted file mode 100644 (file)
index b3f63d4..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-(**************************************************************************)
-(*       ___                                                              *)
-(*      ||M||                                                             *)
-(*      ||A||       A project by Andrea Asperti                           *)
-(*      ||T||                                                             *)
-(*      ||I||       Developers:                                           *)
-(*      ||T||         The HELM team.                                      *)
-(*      ||A||         http://helm.cs.unibo.it                             *)
-(*      \   /                                                             *)
-(*       \ /        This file is distributed under the terms of the       *)
-(*        v         GNU General Public License Version 2                  *)
-(*                                                                        *)
-(**************************************************************************)
-
-include "ground/relocation/nstream_istot.ma".
-include "ground/relocation/rtmap_after.ma".
-
-(* RELOCATION N-STREAM ******************************************************)
-
-corec definition compose: rtmap → rtmap → rtmap.
-#f2 * #n1 #f1 @(seq … (f2@❨n1❩)) @(compose ? f1) -compose -f1
-@(⫰*[↑n1] f2)
-defined.
-
-interpretation "functional composition (nstream)"
-   'compose f2 f1 = (compose f2 f1).
-
-(* Basic properies on compose ***********************************************)
-
-lemma compose_rew: ∀f2,f1,n1. f2@❨n1❩⨮(⫰*[↑n1]f2)∘f1 = f2∘(n1⨮f1).
-#f2 #f1 #n1 <(stream_rew … (f2∘(n1⨮f1))) normalize //
-qed.
-
-lemma compose_next: ∀f2,f1,f. f2∘f1 = f → (↑f2)∘f1 = ↑f.
-#f2 * #n1 #f1 #f <compose_rew <compose_rew
-* -f <tls_S1 /2 width=1 by eq_f2/
-qed.
-
-(* Basic inversion lemmas on compose ****************************************)
-
-lemma compose_inv_rew: ∀f2,f1,f,n1,n. f2∘(n1⨮f1) = n⨮f →
-                       f2@❨n1❩ = n ∧ (⫰*[↑n1]f2)∘f1 = f.
-#f2 #f1 #f #n1 #n <(stream_rew … (f2∘(n1⨮f1))) normalize
-#H destruct /2 width=1 by conj/
-qed-.
-
-lemma compose_inv_O2: ∀f2,f1,f,n2,n. (n2⨮f2)∘(⫯f1) = n⨮f →
-                      n2 = n ∧ f2∘f1 = f.
-#f2 #f1 #f #n2 #n <compose_rew
-#H destruct /2 width=1 by conj/
-qed-.
-
-lemma compose_inv_S2: ∀f2,f1,f,n2,n1,n. (n2⨮f2)∘(↑n1⨮f1) = n⨮f →
-                      ↑(n2+f2@❨n1❩) = n ∧ f2∘(n1⨮f1) = f2@❨n1❩⨮f.
-#f2 #f1 #f #n2 #n1 #n <compose_rew
-#H destruct <tls_S1 /2 width=1 by conj/
-qed-.
-
-lemma compose_inv_S1: ∀f2,f1,f,n1,n. (↑f2)∘(n1⨮f1) = n⨮f →
-                      ↑(f2@❨n1❩) = n ∧ f2∘(n1⨮f1) = f2@❨n1❩⨮f.
-#f2 #f1 #f #n1 #n <compose_rew
-#H destruct <tls_S1 /2 width=1 by conj/
-qed-.
-
-(* Specific properties on after *********************************************)
-
-lemma after_O2: ∀f2,f1,f. f2 ⊚ f1 ≘ f →
-                ∀n. n⨮f2 ⊚ ⫯f1 ≘ n⨮f.
-#f2 #f1 #f #Hf #n elim n -n /2 width=7 by after_refl, after_next/
-qed.
-
-lemma after_S2: ∀f2,f1,f,n1,n. f2 ⊚ n1⨮f1 ≘ n⨮f →
-                ∀n2. n2⨮f2 ⊚ ↑n1⨮f1 ≘ ↑(n2+n)⨮f.
-#f2 #f1 #f #n1 #n #Hf #n2 elim n2 -n2 /2 width=7 by after_next, after_push/
-qed.
-
-lemma after_apply: ∀n1,f2,f1,f. (⫰*[↑n1] f2) ⊚ f1 ≘ f → f2 ⊚ n1⨮f1 ≘ f2@❨n1❩⨮f.
-#n1 elim n1 -n1
-[ * /2 width=1 by after_O2/
-| #n1 #IH * /3 width=1 by after_S2/
-]
-qed-.
-
-corec lemma after_total_aux: ∀f2,f1,f. f2 ∘ f1 = f → f2 ⊚ f1 ≘ f.
-* #n2 #f2 * #n1 #f1 * #n #f cases n2 -n2
-[ cases n1 -n1
-  [ #H cases (compose_inv_O2 … H) -H /3 width=7 by after_refl, eq_f2/
-  | #n1 #H cases (compose_inv_S2 … H) -H * -n /3 width=7 by after_push/
-  ]
-| #n2 >next_rew #H cases (compose_inv_S1 … H) -H * -n /3 width=5 by after_next/
-]
-qed-.
-
-theorem after_total: ∀f1,f2. f2 ⊚ f1 ≘ f2 ∘ f1.
-/2 width=1 by after_total_aux/ qed.
-
-(* Specific inversion lemmas on after ***************************************)
-
-lemma after_inv_xpx: ∀f2,g2,f,n2,n. n2⨮f2 ⊚ g2 ≘ n⨮f → ∀f1. ⫯f1 = g2 →
-                     f2 ⊚ f1 ≘ f ∧ n2 = n.
-#f2 #g2 #f #n2 elim n2 -n2
-[ #n #Hf #f1 #H2 elim (after_inv_ppx … Hf … H2) -g2 [2,3: // ]
-  #g #Hf #H elim (push_inv_seq_dx … H) -H destruct /2 width=1 by conj/
-| #n2 #IH #n #Hf #f1 #H2 elim (after_inv_nxx … Hf) -Hf [2,3: // ]
-  #g1 #Hg #H1 elim (next_inv_seq_dx … H1) -H1
-  #x #Hx #H destruct elim (IH … Hg) [2,3: // ] -IH -Hg
-  #H destruct /2 width=1 by conj/
-]
-qed-.
-
-lemma after_inv_xnx: ∀f2,g2,f,n2,n. n2⨮f2 ⊚ g2 ≘ n⨮f → ∀f1. ↑f1 = g2 →
-                     ∃∃m. f2 ⊚ f1 ≘ m⨮f & ↑(n2+m) = n.
-#f2 #g2 #f #n2 elim n2 -n2
-[ #n #Hf #f1 #H2 elim (after_inv_pnx … Hf … H2) -g2 [2,3: // ]
-  #g #Hf #H elim (next_inv_seq_dx … H) -H
-  #x #Hx #Hg destruct /2 width=3 by ex2_intro/
-| #n2 #IH #n #Hf #f1 #H2 elim (after_inv_nxx … Hf) -Hf [2,3: // ]
-  #g #Hg #H elim (next_inv_seq_dx … H) -H
-  #x #Hx #H destruct elim (IH … Hg) -IH -Hg [2,3: // ]
-  #m #Hf #Hm destruct /2 width=3 by ex2_intro/
-]
-qed-.
-
-lemma after_inv_const: ∀f2,f1,f,n1,n. n⨮f2 ⊚ n1⨮f1 ≘ n⨮f → f2 ⊚ f1 ≘ f ∧ 0 = n1.
-#f2 #f1 #f #n1 #n elim n -n
-[ #H elim (after_inv_pxp … H) -H [ |*: // ]
-  #g2 #Hf #H elim (push_inv_seq_dx … H) -H /2 width=1 by conj/
-| #n #IH #H lapply (after_inv_nxn … H ????) -H /2 width=5 by/
-]
-qed-.
-
-lemma after_inv_total: ∀f2,f1,f. f2 ⊚ f1 ≘ f → f2 ∘ f1 ≡ f.
-/2 width=4 by after_mono/ qed-.
-
-(* Specific forward lemmas on after *****************************************)
-
-lemma after_fwd_hd: ∀f2,f1,f,n1,n. f2 ⊚ n1⨮f1 ≘ n⨮f → f2@❨n1❩ = n.
-#f2 #f1 #f #n1 #n #H lapply (after_fwd_at ? n1 0 … H) -H [1,2,3: // ]
-/3 width=2 by at_inv_O1, sym_eq/
-qed-.
-
-lemma after_fwd_tls: ∀f,f1,n1,f2,n2,n. n2⨮f2 ⊚ n1⨮f1 ≘ n⨮f →
-                     (⫰*[n1]f2) ⊚ f1 ≘ f.
-#f #f1 #n1 elim n1 -n1
-[ #f2 #n2 #n #H elim (after_inv_xpx … H) -H //
-| #n1 #IH * #m1 #f2 #n2 #n #H elim (after_inv_xnx … H) -H [2,3: // ]
-  #m #Hm #H destruct /2 width=3 by/
-]
-qed-.
-
-lemma after_inv_apply: ∀f2,f1,f,n2,n1,n. n2⨮f2 ⊚ n1⨮f1 ≘ n⨮f →
-                       (n2⨮f2)@❨n1❩ = n ∧ (⫰*[n1]f2) ⊚ f1 ≘ f.
-/3 width=3 by after_fwd_tls, after_fwd_hd, conj/ qed-.
-
-(* Properties on apply ******************************************************)
-
-lemma compose_apply (f2) (f1) (i): f2@❨f1@❨i❩❩ = (f2∘f1)@❨i❩.
-/4 width=6 by after_fwd_at, at_inv_total, sym_eq/ qed.
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/nstream_basic.ma b/matita/matita/contribs/lambdadelta/ground/relocation/nstream_basic.ma
deleted file mode 100644 (file)
index 703bee0..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-(**************************************************************************)
-(*       ___                                                              *)
-(*      ||M||                                                             *)
-(*      ||A||       A project by Andrea Asperti                           *)
-(*      ||T||                                                             *)
-(*      ||I||       Developers:                                           *)
-(*      ||T||         The HELM team.                                      *)
-(*      ||A||         http://helm.cs.unibo.it                             *)
-(*      \   /                                                             *)
-(*       \ /        This file is distributed under the terms of the       *)
-(*        v         GNU General Public License Version 2                  *)
-(*                                                                        *)
-(**************************************************************************)
-
-include "ground/relocation/rtmap_basic.ma".
-include "ground/relocation/nstream_after.ma".
-
-(* RELOCATION N-STREAM ******************************************************)
-
-(* Specific properties on basic relocation **********************************)
-
-lemma apply_basic_lt: ∀m,n,i. i < m → 𝐁❨m,n❩@❨i❩ = i.
-/3 width=1 by at_inv_total, at_basic_lt/ qed-.
-
-lemma apply_basic_ge: ∀m,n,i. m ≤ i → 𝐁❨m,n❩@❨i❩ = n+i.
-/3 width=1 by at_inv_total, at_basic_ge/ qed-.
-
-(* Specific main properties on basic relocation *****************************)
-
-theorem basic_swap: ∀d1,d2. d2 ≤ d1 →
-                    ∀h1,h2. 𝐁❨d2,h2❩∘𝐁❨d1,h1❩ ≡ 𝐁❨h2+d1,h1❩∘𝐁❨d2,h2❩.
-#d1 #d2 #Hd21 #h1 #h2
-@nstream_inv_eq
-@nstream_eq_inv_ext #i
-<compose_apply <compose_apply
-elim (lt_or_ge i d2) #Hd2
-[ lapply (lt_to_le_to_lt … Hd2 Hd21) -Hd21 #Hd1
-  >(apply_basic_lt … Hd1) >(apply_basic_lt … Hd2) >apply_basic_lt
-  /2 width=1 by le_plus_a/
-| elim (lt_or_ge i d1) -Hd21 #Hd1
-  [ >(apply_basic_lt … Hd1) >(apply_basic_ge … Hd2) >apply_basic_lt
-    /2 width=1 by monotonic_lt_plus_r/
-  | >(apply_basic_ge … Hd1) >(apply_basic_ge … Hd2)
-    >apply_basic_ge [2: /2 width=1 by le_plus_a/ ]
-    >apply_basic_ge /2 width=1 by monotonic_le_plus_r/
-  ]
-]
-qed-.
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/nstream_coafter.ma b/matita/matita/contribs/lambdadelta/ground/relocation/nstream_coafter.ma
deleted file mode 100644 (file)
index 368647a..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-(**************************************************************************)
-(*       ___                                                              *)
-(*      ||M||                                                             *)
-(*      ||A||       A project by Andrea Asperti                           *)
-(*      ||T||                                                             *)
-(*      ||I||       Developers:                                           *)
-(*      ||T||         The HELM team.                                      *)
-(*      ||A||         http://helm.cs.unibo.it                             *)
-(*      \   /                                                             *)
-(*       \ /        This file is distributed under the terms of the       *)
-(*        v         GNU General Public License Version 2                  *)
-(*                                                                        *)
-(**************************************************************************)
-
-include "ground/notation/functions/cocompose_2.ma".
-include "ground/relocation/rtmap_coafter.ma".
-
-(* RELOCATION N-STREAM ******************************************************)
-
-rec definition fun0 (n1:nat) on n1: rtmap → nat.
-* * [ | #n2 #f2 @0 ]
-#f2 cases n1 -n1 [ @0 ]
-#n1 @(↑(fun0 n1 f2))
-defined.
-
-rec definition fun2 (n1:nat) on n1: rtmap → rtmap.
-* * [ | #n2 #f2 @(n2⨮f2) ]
-#f2 cases n1 -n1 [ @f2 ]
-#n1 @(fun2 n1 f2)
-defined.
-
-rec definition fun1 (n1:nat) (f1:rtmap) on n1: rtmap → rtmap.
-* * [ | #n2 #f2 @(n1⨮f1) ]
-#f2 cases n1 -n1 [ @f1 ]
-#n1 @(fun1 n1 f1 f2)
-defined.
-
-corec definition cocompose: rtmap → rtmap → rtmap.
-#f2 * #n1 #f1 @(seq … (fun0 n1 f2)) @(cocompose (fun2 n1 f2) (fun1 n1 f1 f2))
-defined.
-
-interpretation "functional co-composition (nstream)"
-   'CoCompose f1 f2 = (cocompose f1 f2).
-
-(* Basic properties on funs *************************************************)
-
-(* Note: we need theese since matita blocks recursive δ when ι is blocked *)
-lemma fun0_xn: ∀f2,n1. 0 = fun0 n1 (↑f2).
-* #n2 #f2 * //
-qed.
-
-lemma fun2_xn: ∀f2,n1. f2 = fun2 n1 (↑f2).
-* #n2 #f2 * //
-qed.
-
-lemma fun1_xxn: ∀f2,f1,n1. fun1 n1 f1 (↑f2) = n1⨮f1.
-* #n2 #f2 #f1 * //
-qed.
-
-(* Basic properies on cocompose *********************************************)
-
-lemma cocompose_rew: ∀f2,f1,n1. (fun0 n1 f2)⨮(fun2 n1 f2)~∘(fun1 n1 f1 f2) = f2 ~∘ (n1⨮f1).
-#f2 #f1 #n1 <(stream_rew … (f2~∘(n1⨮f1))) normalize //
-qed.
-
-(* Basic inversion lemmas on compose ****************************************)
-
-lemma cocompose_inv_ppx: ∀f2,f1,f,x. (⫯f2) ~∘ (⫯f1) = x⨮f →
-                         0 = x ∧ f2 ~∘ f1 = f.
-#f2 #f1 #f #x
-<cocompose_rew #H destruct
-normalize /2 width=1 by conj/
-qed-.
-
-lemma cocompose_inv_pnx: ∀f2,f1,f,n1,x. (⫯f2) ~∘ (↑n1⨮f1) = x⨮f →
-                         ∃∃n. ↑n = x & f2 ~∘ (n1⨮f1) = n⨮f.
-#f2 #f1 #f #n1 #x
-<cocompose_rew #H destruct
-@(ex2_intro … (fun0 n1 f2)) // <cocompose_rew
-/3 width=1 by eq_f2/
-qed-.
-
-lemma cocompose_inv_nxx: ∀f2,f1,f,n1,x. (↑f2) ~∘ (n1⨮f1) = x⨮f →
-                         0 = x ∧ f2 ~∘ (n1⨮f1) = f.
-#f2 #f1 #f #n1 #x
-<cocompose_rew #H destruct
-/2 width=1 by conj/
-qed-.
-
-(* Specific properties on coafter *******************************************)
-
-corec lemma coafter_total_aux: ∀f2,f1,f. f2 ~∘ f1 = f → f2 ~⊚ f1 ≘ f.
-* #n2 #f2 * #n1 #f1 * #n #f cases n2 -n2
-[ cases n1 -n1
-  [ #H cases (cocompose_inv_ppx … H) -H /3 width=7 by coafter_refl, eq_f2/
-  | #n1 #H cases (cocompose_inv_pnx … H) -H /3 width=7 by coafter_push/
-  ]
-| #n2 >next_rew #H cases (cocompose_inv_nxx … H) -H /3 width=5 by coafter_next/
-]
-qed-.
-
-theorem coafter_total: ∀f2,f1. f2 ~⊚ f1 ≘ f2 ~∘ f1.
-/2 width=1 by coafter_total_aux/ qed.
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/nstream_eq.ma b/matita/matita/contribs/lambdadelta/ground/relocation/nstream_eq.ma
deleted file mode 100644 (file)
index 9678dcc..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-(**************************************************************************)
-(*       ___                                                              *)
-(*      ||M||                                                             *)
-(*      ||A||       A project by Andrea Asperti                           *)
-(*      ||T||                                                             *)
-(*      ||I||       Developers:                                           *)
-(*      ||T||         The HELM team.                                      *)
-(*      ||A||         http://helm.tcs.unibo.it                            *)
-(*      \   /                                                             *)
-(*       \ /        This file is distributed under the terms of the       *)
-(*        v         GNU General Public License Version 2                  *)
-(*                                                                        *)
-(**************************************************************************)
-
-include "ground/relocation/rtmap_eq.ma".
-
-(* RELOCATION N-STREAM ******************************************************)
-
-(* Specific properties ******************************************************)
-
-fact eq_inv_seq_aux: ∀f1,f2,n1,n2. n1⨮f1 ≡ n2⨮f2 → n1 = n2 ∧ f1 ≡ f2.
-#f1 #f2 #n1 #n2 @(nat_elim2 … n1 n2) -n1 -n2
-[ #n2 #H elim (eq_inv_px … H) -H [2,3: // ]
-  #g1 #H1 #H elim (push_inv_seq_dx … H) -H /2 width=1 by conj/
-| #n1 #H elim (eq_inv_np … H) -H //
-| #n1 #n2 #IH #H lapply (eq_inv_nn … H ????) -H [1,2,3,4: // ]
-  #H elim (IH H) -IH -H /2 width=1 by conj/
-]
-qed-.
-
-lemma eq_inv_seq: ∀g1,g2. g1 ≡ g2 → ∀f1,f2,n1,n2. n1⨮f1 = g1 → n2⨮f2 = g2 →
-                  n1 = n2 ∧ f1 ≡ f2.
-/2 width=1 by eq_inv_seq_aux/ qed-.
-
-corec lemma nstream_eq: ∀f1,f2. f1 ≡ f2 → f1 ≗ f2.
-* #n1 #f1 * #n2 #f2 #Hf cases (eq_inv_gen … Hf) -Hf *
-#g1 #g2 #Hg #H1 #H2
-[ cases (push_inv_seq_dx … H1) -H1 * -n1 #H1
-  cases (push_inv_seq_dx … H2) -H2 * -n2 #H2
-  @eq_seq /2 width=1 by/
-| cases (next_inv_seq_dx … H1) -H1 #m1 #H1 * -n1
-  cases (next_inv_seq_dx … H2) -H2 #m2 #H2 * -n2
-  cases (eq_inv_seq … Hg … H1 H2) -g1 -g2 #Hm #Hf
-  @eq_seq /2 width=1 by/
-]
-qed-.
-
-corec lemma nstream_inv_eq: ∀f1,f2. f1 ≗ f2 → f1 ≡ f2.
-* #n1 #f1 * #n2 #f2 #H cases (eq_stream_inv_seq ??? H) -H [2,3,4,5,6,7: // ]
-#Hf * -n2 cases n1 -n1 /3 width=5 by eq_push/
-#n @eq_next /3 width=5 by eq_seq/
-qed.
-
-lemma eq_seq_id: ∀f1,f2. f1 ≡ f2 → ∀n. n⨮f1 ≡ n⨮f2.
-/4 width=1 by nstream_inv_eq, nstream_eq, eq_seq/ qed.
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/nstream_id.ma b/matita/matita/contribs/lambdadelta/ground/relocation/nstream_id.ma
deleted file mode 100644 (file)
index f3a1cce..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-(**************************************************************************)
-(*       ___                                                              *)
-(*      ||M||                                                             *)
-(*      ||A||       A project by Andrea Asperti                           *)
-(*      ||T||                                                             *)
-(*      ||I||       Developers:                                           *)
-(*      ||T||         The HELM team.                                      *)
-(*      ||A||         http://helm.cs.unibo.it                             *)
-(*      \   /                                                             *)
-(*       \ /        This file is distributed under the terms of the       *)
-(*        v         GNU General Public License Version 2                  *)
-(*                                                                        *)
-(**************************************************************************)
-
-include "ground/notation/functions/identity_0.ma".
-include "ground/relocation/rtmap_eq.ma".
-
-(* RELOCATION N-STREAM ******************************************************)
-
-corec definition id: rtmap ≝ ⫯id.
-
-interpretation "identity (nstream)"
-   'Identity = (id).
-
-(* Basic properties *********************************************************)
-
-lemma id_rew: ⫯𝐈𝐝 = 𝐈𝐝.
-<(stream_rew … (𝐈𝐝)) in ⊢ (???%); normalize //
-qed.
-
-lemma id_eq_rew: ⫯𝐈𝐝 ≡ 𝐈𝐝.
-cases id_rew in ⊢ (??%); //
-qed.
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/nstream_isid.ma b/matita/matita/contribs/lambdadelta/ground/relocation/nstream_isid.ma
deleted file mode 100644 (file)
index 48ab9aa..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-(**************************************************************************)
-(*       ___                                                              *)
-(*      ||M||                                                             *)
-(*      ||A||       A project by Andrea Asperti                           *)
-(*      ||T||                                                             *)
-(*      ||I||       Developers:                                           *)
-(*      ||T||         The HELM team.                                      *)
-(*      ||A||         http://helm.cs.unibo.it                             *)
-(*      \   /                                                             *)
-(*       \ /        This file is distributed under the terms of the       *)
-(*        v         GNU General Public License Version 2                  *)
-(*                                                                        *)
-(**************************************************************************)
-
-include "ground/notation/functions/identity_0.ma".
-include "ground/relocation/rtmap_isid.ma".
-
-(* RELOCATION N-STREAM ******************************************************)
-
-(* Specific inversion lemmas ************************************************)
-
-lemma isid_inv_seq: ∀f,n. 𝐈❪n⨮f❫ → 𝐈❪f❫ ∧ 0 = n.
-#f #n #H elim (isid_inv_gen … H) -H
-#g #Hg #H elim (push_inv_seq_dx … H) -H /2 width=1 by conj/
-qed-.
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/nstream_istot.ma b/matita/matita/contribs/lambdadelta/ground/relocation/nstream_istot.ma
deleted file mode 100644 (file)
index e1eaf0f..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-(**************************************************************************)
-(*       ___                                                              *)
-(*      ||M||                                                             *)
-(*      ||A||       A project by Andrea Asperti                           *)
-(*      ||T||                                                             *)
-(*      ||I||       Developers:                                           *)
-(*      ||T||         The HELM team.                                      *)
-(*      ||A||         http://helm.tcs.unibo.it                            *)
-(*      \   /                                                             *)
-(*       \ /        This file is distributed under the terms of the       *)
-(*        v         GNU General Public License Version 2                  *)
-(*                                                                        *)
-(**************************************************************************)
-
-include "ground/notation/functions/apply_2.ma".
-include "ground/relocation/nstream_eq.ma".
-include "ground/relocation/rtmap_istot.ma".
-
-(* RELOCATION N-STREAM ******************************************************)
-
-rec definition apply (i: nat) on i: rtmap → nat ≝ ?.
-* #n #f cases i -i
-[ @n
-| #i lapply (apply i f) -apply -i -f
-  #i @(↑(n+i))
-]
-defined.
-
-interpretation "functional application (nstream)"
-   'Apply f i = (apply i f).
-
-(* Specific properties on at ************************************************)
-
-lemma at_O1: ∀i2,f. @❪0, i2⨮f❫ ≘ i2.
-#i2 elim i2 -i2 /2 width=5 by at_refl, at_next/
-qed.
-
-lemma at_S1: ∀n,f,i1,i2. @❪i1, f❫ ≘ i2 → @❪↑i1, n⨮f❫ ≘ ↑(n+i2).
-#n elim n -n /3 width=7 by at_push, at_next/
-qed.
-
-lemma at_total: ∀i1,f. @❪i1, f❫ ≘ f@❨i1❩.
-#i1 elim i1 -i1
-[ * // | #i #IH * /3 width=1 by at_S1/ ]
-qed.
-
-lemma at_istot: ∀f. 𝐓❪f❫.
-/2 width=2 by ex_intro/ qed.
-
-lemma at_plus2: ∀f,i1,i,n,m. @❪i1, n⨮f❫ ≘ i → @❪i1, (m+n)⨮f❫ ≘ m+i.
-#f #i1 #i #n #m #H elim m -m //
-#m <plus_S1 /2 width=5 by at_next/ (**) (* full auto fails *)
-qed.
-
-(* Specific inversion lemmas on at ******************************************)
-
-lemma at_inv_O1: ∀f,n,i2. @❪0, n⨮f❫ ≘ i2 → n = i2.
-#f #n elim n -n /2 width=6 by at_inv_ppx/
-#n #IH #i2 #H elim (at_inv_xnx … H) -H [2,3: // ]
-#j2 #Hj * -i2 /3 width=1 by eq_f/
-qed-.
-
-lemma at_inv_S1: ∀f,n,j1,i2. @❪↑j1, n⨮f❫ ≘ i2 →
-                 ∃∃j2. @❪j1, f❫ ≘ j2 & ↑(n+j2) = i2.
-#f #n elim n -n /2 width=5 by at_inv_npx/
-#n #IH #j1 #i2 #H elim (at_inv_xnx … H) -H [2,3: // ]
-#j2 #Hj * -i2 elim (IH … Hj) -IH -Hj
-#i2 #Hi * -j2 /2 width=3 by ex2_intro/
-qed-.
-
-lemma at_inv_total: ∀f,i1,i2. @❪i1, f❫ ≘ i2 → f@❨i1❩ = i2.
-/2 width=6 by at_mono/ qed-.
-
-(* Spercific forward lemmas on at *******************************************)
-
-lemma at_increasing_plus: ∀f,n,i1,i2. @❪i1, n⨮f❫ ≘ i2 → i1 + n ≤ i2.
-#f #n *
-[ #i2 #H <(at_inv_O1 … H) -i2 //
-| #i1 #i2 #H elim (at_inv_S1 … H) -H
-  #j1 #Ht * -i2 /4 width=2 by at_increasing, monotonic_le_plus_r, le_S_S/
-]
-qed-.
-
-lemma at_fwd_id: ∀f,n,i. @❪i, n⨮f❫ ≘ i → 0 = n.
-#f #n #i #H elim (at_fwd_id_ex … H) -H
-#g #H elim (push_inv_seq_dx … H) -H //
-qed-.
-
-(* Basic properties *********************************************************)
-
-lemma apply_O1: ∀n,f. (n⨮f)@❨0❩ = n.
-// qed.
-
-lemma apply_S1: ∀n,f,i. (n⨮f)@❨↑i❩ = ↑(n+f@❨i❩).
-// qed.
-
-lemma apply_eq_repl (i): eq_repl … (λf1,f2. f1@❨i❩ = f2@❨i❩).
-#i elim i -i [2: #i #IH ] * #n1 #f1 * #n2 #f2 #H
-elim (eq_inv_seq_aux … H) -H normalize //
-#Hn #Hf /4 width=1 by eq_f2, eq_f/
-qed.
-
-lemma apply_S2: ∀f,i. (↑f)@❨i❩ = ↑(f@❨i❩).
-* #n #f * //
-qed.
-
-(* Main inversion lemmas ****************************************************)
-
-theorem apply_inj: ∀f,i1,i2,j. f@❨i1❩ = j → f@❨i2❩ = j → i1 = i2.
-/2 width=4 by at_inj/ qed-.
-
-corec theorem nstream_eq_inv_ext: ∀f1,f2. (∀i. f1@❨i❩ = f2@❨i❩) → f1 ≗ f2.
-* #n1 #f1 * #n2 #f2 #Hf @eq_seq
-[ @(Hf 0)
-| @nstream_eq_inv_ext -nstream_eq_inv_ext #i
-  lapply (Hf 0) >apply_O1 >apply_O1 #H destruct
-  lapply (Hf (↑i)) >apply_S1 >apply_S1 #H
-  /3 width=2 by injective_plus_r, injective_S/
-]
-qed-.
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/nstream_sor.ma b/matita/matita/contribs/lambdadelta/ground/relocation/nstream_sor.ma
deleted file mode 100644 (file)
index 2e77581..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-(**************************************************************************)
-(*       ___                                                              *)
-(*      ||M||                                                             *)
-(*      ||A||       A project by Andrea Asperti                           *)
-(*      ||T||                                                             *)
-(*      ||I||       Developers:                                           *)
-(*      ||T||         The HELM team.                                      *)
-(*      ||A||         http://helm.cs.unibo.it                             *)
-(*      \   /                                                             *)
-(*       \ /        This file is distributed under the terms of the       *)
-(*        v         GNU General Public License Version 2                  *)
-(*                                                                        *)
-(**************************************************************************)
-
-include "ground/relocation/rtmap_sor.ma".
-
-(* RELOCATION N-STREAM ******************************************************)
-
-axiom union: rtmap → rtmap → rtmap.
-
-interpretation "union (nstream)"
-   'union f1 f2 = (union f1 f2).
-
-(* Specific properties on sor ***********************************************)
-
-axiom sor_total: ∀f1,f2. f1 ⋓ f2 ≘ f1 ∪ f2.
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/pstream.ma b/matita/matita/contribs/lambdadelta/ground/relocation/pstream.ma
new file mode 100644 (file)
index 0000000..7092798
--- /dev/null
@@ -0,0 +1,90 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/notation/functions/upspoon_1.ma".
+include "ground/lib/stream.ma".
+include "ground/arith/pnat.ma".
+
+(* RELOCATION P-STREAM ******************************************************)
+
+definition rtmap: Type[0] ≝ stream pnat.
+
+definition push: rtmap → rtmap ≝ λf. 𝟏⨮f.
+
+interpretation "push (pstream)" 'UpSpoon f = (push f).
+
+definition next: rtmap → rtmap.
+* #p #f @(↑p⨮f)
+defined.
+
+interpretation "next (pstream)" 'UpArrow f = (next f).
+
+(* Basic properties *********************************************************)
+
+lemma push_rew: ∀f. 𝟏⨮f = ⫯f.
+// qed.
+
+lemma next_rew: ∀f,p. (↑p)⨮f = ↑(p⨮f).
+// qed.
+
+(* Basic inversion lemmas ***************************************************)
+
+lemma injective_push: injective ? ? push.
+#f1 #f2 <push_rew <push_rew #H destruct //
+qed-.
+
+lemma discr_push_next: ∀f1,f2. ⫯f1 = ↑f2 → ⊥.
+#f1 * #p2 #f2 <push_rew <next_rew #H destruct
+qed-.
+
+lemma discr_next_push: ∀f1,f2. ↑f1 = ⫯f2 → ⊥.
+* #p1 #f1 #f2 <next_rew <push_rew #H destruct
+qed-.
+
+lemma injective_next: injective ? ? next.
+* #p1 #f1 * #p2 #f2 <next_rew <next_rew #H destruct //
+qed-.
+
+lemma push_inv_seq_sn: ∀f,g,p. p⨮g = ⫯f → ∧∧ 𝟏 = p & g = f.
+#f #g #p <push_rew #H destruct /2 width=1 by conj/
+qed-.
+
+lemma push_inv_seq_dx: ∀f,g,p. ⫯f = p⨮g → ∧∧ 𝟏 = p & g = f.
+#f #g #p <push_rew #H destruct /2 width=1 by conj/
+qed-.
+
+lemma next_inv_seq_sn: ∀f,g,p. p⨮g = ↑f → ∃∃q. q⨮g = f & ↑q = p.
+* #q #f #g #p <next_rew #H destruct /2 width=3 by ex2_intro/
+qed-.
+
+lemma next_inv_seq_dx: ∀f,g,p. ↑f = p⨮g → ∃∃q. q⨮g = f & ↑q = p.
+* #q #f #g #p <next_rew #H destruct /2 width=3 by ex2_intro/
+qed-.
+
+lemma case_prop (Q:predicate rtmap):
+      (∀f. Q (⫯f)) → (∀f. Q (↑f)) → ∀f. Q f.
+#Q #H1 #H2 * * //
+qed-.
+
+lemma case_type0 (Q:rtmap→Type[0]):
+      (∀f. Q (⫯f)) → (∀f. Q (↑f)) → ∀f. Q f.
+#Q #H1 #H2 * * //
+qed-.
+
+lemma iota_push: ∀Q,a,b,f. a f = case_type0 Q a b (⫯f).
+// qed.
+
+lemma iota_next: ∀Q,a,b,f. b f = case_type0 Q a b (↑f).
+#Q #a #b * //
+qed.
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/pstream_after.ma b/matita/matita/contribs/lambdadelta/ground/relocation/pstream_after.ma
new file mode 100644 (file)
index 0000000..0aa4d6b
--- /dev/null
@@ -0,0 +1,166 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/relocation/pstream_tls.ma".
+include "ground/relocation/pstream_istot.ma".
+include "ground/relocation/rtmap_after.ma".
+
+(* RELOCATION N-STREAM ******************************************************)
+
+corec definition compose: rtmap → rtmap → rtmap.
+#f2 * #p1 #f1 @(stream_cons … (f2@❨p1❩)) @(compose ? f1) -compose -f1
+@(⫰*[p1]f2)
+defined.
+
+interpretation "functional composition (nstream)"
+   'compose f2 f1 = (compose f2 f1).
+
+(* Basic properies on compose ***********************************************)
+
+lemma compose_rew: ∀f2,f1,p1. f2@❨p1❩⨮(⫰*[p1]f2)∘f1 = f2∘(p1⨮f1).
+#f2 #f1 #p1 <(stream_rew … (f2∘(p1⨮f1))) normalize //
+qed.
+
+lemma compose_next: ∀f2,f1,f. f2∘f1 = f → (↑f2)∘f1 = ↑f.
+#f2 * #p1 #f1 #f <compose_rew <compose_rew
+* -f /2 width=1 by eq_f2/
+qed.
+
+(* Basic inversion lemmas on compose ****************************************)
+
+lemma compose_inv_rew: ∀f2,f1,f,p1,p. f2∘(p1⨮f1) = p⨮f →
+                       f2@❨p1❩ = p ∧ (⫰*[p1]f2)∘f1 = f.
+#f2 #f1 #f #p1 #p <compose_rew
+#H destruct /2 width=1 by conj/
+qed-.
+
+lemma compose_inv_O2: ∀f2,f1,f,p2,p. (p2⨮f2)∘(⫯f1) = p⨮f →
+                      p2 = p ∧ f2∘f1 = f.
+#f2 #f1 #f #p2 #p <compose_rew
+#H destruct /2 width=1 by conj/
+qed-.
+
+lemma compose_inv_S2: ∀f2,f1,f,p2,p1,p. (p2⨮f2)∘(↑p1⨮f1) = p⨮f →
+                      f2@❨p1❩+p2 = p ∧ f2∘(p1⨮f1) = f2@❨p1❩⨮f.
+#f2 #f1 #f #p2 #p1 #p <compose_rew
+#H destruct >nsucc_inj <stream_tls_swap
+/2 width=1 by conj/
+qed-.
+
+lemma compose_inv_S1: ∀f2,f1,f,p1,p. (↑f2)∘(p1⨮f1) = p⨮f →
+                      ↑(f2@❨p1❩) = p ∧ f2∘(p1⨮f1) = f2@❨p1❩⨮f.
+#f2 #f1 #f #p1 #p <compose_rew
+#H destruct /2 width=1 by conj/
+qed-.
+
+(* Specific properties on after *********************************************)
+
+lemma after_O2: ∀f2,f1,f. f2 ⊚ f1 ≘ f →
+                ∀p. p⨮f2 ⊚ ⫯f1 ≘ p⨮f.
+#f2 #f1 #f #Hf #p elim p -p
+/2 width=7 by after_refl, after_next/
+qed.
+
+lemma after_S2: ∀f2,f1,f,p1,p. f2 ⊚ p1⨮f1 ≘ p⨮f →
+                ∀p2. p2⨮f2 ⊚ ↑p1⨮f1 ≘ (p+p2)⨮f.
+#f2 #f1 #f #p1 #p #Hf #p2 elim p2 -p2
+/2 width=7 by after_next, after_push/
+qed.
+
+lemma after_apply: ∀p1,f2,f1,f.
+      (⫰*[ninj p1] f2) ⊚ f1 ≘ f → f2 ⊚ p1⨮f1 ≘ f2@❨p1❩⨮f.
+#p1 elim p1 -p1
+[ * /2 width=1 by after_O2/
+| #p1 #IH * #p2 #f2 >nsucc_inj <stream_tls_swap
+  /3 width=1 by after_S2/
+]
+qed-.
+
+corec lemma after_total_aux: ∀f2,f1,f. f2 ∘ f1 = f → f2 ⊚ f1 ≘ f.
+* #p2 #f2 * #p1 #f1 * #p #f cases p2 -p2
+[ cases p1 -p1
+  [ #H cases (compose_inv_O2 … H) -H /3 width=7 by after_refl, eq_f2/
+  | #p1 #H cases (compose_inv_S2 … H) -H * -p /3 width=7 by after_push/
+  ]
+| #p2 >next_rew #H cases (compose_inv_S1 … H) -H * -p >next_rew
+  /3 width=5 by after_next/
+]
+qed-.
+
+theorem after_total: ∀f1,f2. f2 ⊚ f1 ≘ f2 ∘ f1.
+/2 width=1 by after_total_aux/ qed.
+
+(* Specific inversion lemmas on after ***************************************)
+
+lemma after_inv_xpx: ∀f2,g2,f,p2,p. p2⨮f2 ⊚ g2 ≘ p⨮f → ∀f1. ⫯f1 = g2 →
+                     f2 ⊚ f1 ≘ f ∧ p2 = p.
+#f2 #g2 #f #p2 elim p2 -p2
+[ #p #Hf #f1 #H2 elim (after_inv_ppx … Hf … H2) -g2 [|*: // ]
+  #g #Hf #H elim (push_inv_seq_dx … H) -H destruct /2 width=1 by conj/
+| #p2 #IH #p #Hf #f1 #H2 elim (after_inv_nxx … Hf) -Hf [|*: // ]
+  #g1 #Hg #H1 elim (next_inv_seq_dx … H1) -H1
+  #x #Hx #H destruct elim (IH … Hg) [|*: // ] -IH -Hg
+  #H destruct /2 width=1 by conj/
+]
+qed-.
+
+lemma after_inv_xnx: ∀f2,g2,f,p2,p. p2⨮f2 ⊚ g2 ≘ p⨮f → ∀f1. ↑f1 = g2 →
+                     ∃∃q. f2 ⊚ f1 ≘ q⨮f & q+p2 = p.
+#f2 #g2 #f #p2 elim p2 -p2
+[ #p #Hf #f1 #H2 elim (after_inv_pnx … Hf … H2) -g2 [|*: // ]
+  #g #Hf #H elim (next_inv_seq_dx … H) -H
+  #x #Hx #Hg destruct /2 width=3 by ex2_intro/
+| #p2 #IH #p #Hf #f1 #H2 elim (after_inv_nxx … Hf) -Hf [|*: // ]
+  #g #Hg #H elim (next_inv_seq_dx … H) -H
+  #x #Hx #H destruct elim (IH … Hg) -IH -Hg [|*: // ]
+  #m #Hf #Hm destruct /2 width=3 by ex2_intro/
+]
+qed-.
+
+lemma after_inv_const: ∀f2,f1,f,p1,p.
+      p⨮f2 ⊚ p1⨮f1 ≘ p⨮f → f2 ⊚ f1 ≘ f ∧ 𝟏 = p1.
+#f2 #f1 #f #p1 #p elim p -p
+[ #H elim (after_inv_pxp … H) -H [|*: // ]
+  #g2 #Hf #H elim (push_inv_seq_dx … H) -H /2 width=1 by conj/
+| #p #IH #H lapply (after_inv_nxn … H ????) -H /2 width=5 by/
+]
+qed-.
+
+lemma after_inv_total: ∀f2,f1,f. f2 ⊚ f1 ≘ f → f2 ∘ f1 ≡ f.
+/2 width=4 by after_mono/ qed-.
+
+(* Specific forward lemmas on after *****************************************)
+
+lemma after_fwd_hd: ∀f2,f1,f,p1,p. f2 ⊚ p1⨮f1 ≘ p⨮f → f2@❨p1❩ = p.
+#f2 #f1 #f #p1 #p #H lapply (after_fwd_at ? p1 (𝟏) … H) -H [4:|*: // ]
+/3 width=2 by at_inv_O1, sym_eq/
+qed-.
+
+lemma after_fwd_tls: ∀f,f1,p1,f2,p2,p. p2⨮f2 ⊚ p1⨮f1 ≘ p⨮f →
+                     (⫰*[↓p1]f2) ⊚ f1 ≘ f.
+#f #f1 #p1 elim p1 -p1
+[ #f2 #p2 #p #H elim (after_inv_xpx … H) -H //
+| #p1 #IH * #q2 #f2 #p2 #p #H elim (after_inv_xnx … H) -H [|*: // ]
+  #x #Hx #H destruct /2 width=3 by/
+]
+qed-.
+
+lemma after_inv_apply: ∀f2,f1,f,p2,p1,p. p2⨮f2 ⊚ p1⨮f1 ≘ p⨮f →
+                       (p2⨮f2)@❨p1❩ = p ∧ (⫰*[↓p1]f2) ⊚ f1 ≘ f.
+/3 width=3 by after_fwd_tls, after_fwd_hd, conj/ qed-.
+
+(* Properties on apply ******************************************************)
+
+lemma compose_apply (f2) (f1) (i): f2@❨f1@❨i❩❩ = (f2∘f1)@❨i❩.
+/4 width=6 by after_fwd_at, at_inv_total, sym_eq/ qed.
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/pstream_basic.ma b/matita/matita/contribs/lambdadelta/ground/relocation/pstream_basic.ma
new file mode 100644 (file)
index 0000000..072b509
--- /dev/null
@@ -0,0 +1,50 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/arith/nat_lt_plus.ma".
+include "ground/relocation/rtmap_basic_at.ma".
+include "ground/relocation/pstream_after.ma".
+
+(* RELOCATION N-STREAM ******************************************************)
+
+(* Specific properties on basic relocation **********************************)
+
+lemma apply_basic_lt: ∀m,n,i. ninj i ≤ m → 𝐁❨m,n❩@❨i❩ = i.
+/3 width=1 by at_inv_total, at_basic_lt/ qed-.
+
+lemma apply_basic_ge: ∀m,n,i. m < ninj i → 𝐁❨m,n❩@❨i❩ = i+n.
+/3 width=1 by at_inv_total, at_basic_ge/ qed-.
+
+(* Specific main properties on basic relocation *****************************)
+
+theorem basic_swap: ∀d1,d2. d2 ≤ d1 →
+                    ∀h1,h2. 𝐁❨d2,h2❩∘𝐁❨d1,h1❩ ≡ 𝐁❨d1+h2,h1❩∘𝐁❨d2,h2❩.
+#d1 #d2 #Hd21 #h1 #h2
+@nstream_inv_eq
+@nstream_eq_inv_ext #i
+<compose_apply <compose_apply
+elim (nat_split_lt_ge d2 i) #Hd2
+[ elim (nat_split_lt_ge d1 i) -Hd21 #Hd1
+  [ >(apply_basic_ge … Hd1) >(apply_basic_ge … Hd2) >apply_basic_ge
+    [ >apply_basic_ge // >nrplus_inj_sn /2 width=1 by nlt_plus_bi_sn/
+    | >nrplus_inj_sn /2 width=2 by nlt_plus_dx_dx/
+    ]
+  | >(apply_basic_lt … Hd1) >(apply_basic_ge … Hd2)
+    >apply_basic_lt // >nrplus_inj_sn /2 width=1 by nle_plus_bi_dx/
+  ]
+| lapply (nle_trans … Hd2 … Hd21) -Hd21 #Hd1
+  >(apply_basic_lt … Hd1) >(apply_basic_lt … Hd2)
+  >apply_basic_lt /2 width=1 by nle_plus_dx_dx/
+]
+qed-.
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/pstream_coafter.ma b/matita/matita/contribs/lambdadelta/ground/relocation/pstream_coafter.ma
new file mode 100644 (file)
index 0000000..4dd17dd
--- /dev/null
@@ -0,0 +1,104 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/notation/functions/cocompose_2.ma".
+include "ground/relocation/rtmap_coafter.ma".
+
+(* RELOCATION N-STREAM ******************************************************)
+
+rec definition fun0 (p1:pnat) on p1: rtmap → pnat.
+* * [ | #p2 #f2 @(𝟏) ]
+#f2 cases p1 -p1 [ @(𝟏) ]
+#p1 @(↑(fun0 p1 f2))
+defined.
+
+rec definition fun2 (p1:pnat) on p1: rtmap → rtmap.
+* * [ | #p2 #f2 @(p2⨮f2) ]
+#f2 cases p1 -p1 [ @f2 ]
+#p1 @(fun2 p1 f2)
+defined.
+
+rec definition fun1 (p1:pnat) (f1:rtmap) on p1: rtmap → rtmap.
+* * [ | #p2 #f2 @(p1⨮f1) ]
+#f2 cases p1 -p1 [ @f1 ]
+#p1 @(fun1 p1 f1 f2)
+defined.
+
+corec definition cocompose: rtmap → rtmap → rtmap.
+#f2 * #p1 #f1
+@(stream_cons … (fun0 p1 f2)) @(cocompose (fun2 p1 f2) (fun1 p1 f1 f2))
+defined.
+
+interpretation "functional co-composition (nstream)"
+   'CoCompose f1 f2 = (cocompose f1 f2).
+
+(* Basic properties on funs *************************************************)
+
+(* Note: we need theese since matita blocks recursive δ when ι is blocked *)
+lemma fun0_xn: ∀f2,p1. 𝟏 = fun0 p1 (↑f2).
+* #p2 #f2 * //
+qed.
+
+lemma fun2_xn: ∀f2,p1. f2 = fun2 p1 (↑f2).
+* #p2 #f2 * //
+qed.
+
+lemma fun1_xxn: ∀f2,f1,p1. fun1 p1 f1 (↑f2) = p1⨮f1.
+* #p2 #f2 #f1 * //
+qed.
+
+(* Basic properies on cocompose *********************************************)
+
+lemma cocompose_rew: ∀f2,f1,p1. (fun0 p1 f2)⨮(fun2 p1 f2)~∘(fun1 p1 f1 f2) = f2 ~∘ (p1⨮f1).
+#f2 #f1 #p1 <(stream_rew … (f2~∘(p1⨮f1))) normalize //
+qed.
+
+(* Basic inversion lemmas on compose ****************************************)
+
+lemma cocompose_inv_ppx: ∀f2,f1,f,x. (⫯f2) ~∘ (⫯f1) = x⨮f →
+                         ∧∧ 𝟏 = x & f2 ~∘ f1 = f.
+#f2 #f1 #f #x
+<cocompose_rew #H destruct
+normalize /2 width=1 by conj/
+qed-.
+
+lemma cocompose_inv_pnx: ∀f2,f1,f,p1,x. (⫯f2) ~∘ (↑p1⨮f1) = x⨮f →
+                         ∃∃p. ↑p = x & f2 ~∘ (p1⨮f1) = p⨮f.
+#f2 #f1 #f #p1 #x
+<cocompose_rew #H destruct
+@(ex2_intro … (fun0 p1 f2)) // <cocompose_rew
+/3 width=1 by eq_f2/
+qed-.
+
+lemma cocompose_inv_nxx: ∀f2,f1,f,p1,x. (↑f2) ~∘ (p1⨮f1) = x⨮f →
+                         ∧∧ 𝟏 = x & f2 ~∘ (p1⨮f1) = f.
+#f2 #f1 #f #p1 #x
+<cocompose_rew #H destruct
+/2 width=1 by conj/
+qed-.
+
+(* Specific properties on coafter *******************************************)
+
+corec lemma coafter_total_aux: ∀f2,f1,f. f2 ~∘ f1 = f → f2 ~⊚ f1 ≘ f.
+* #p2 #f2 * #p1 #f1 * #p #f cases p2 -p2
+[ cases p1 -p1
+  [ #H cases (cocompose_inv_ppx … H) -H /3 width=7 by coafter_refl, eq_f2/
+  | #p1 #H cases (cocompose_inv_pnx … H) -H /3 width=7 by coafter_push/
+  ]
+| #p2 >next_rew #H cases (cocompose_inv_nxx … H) -H /3 width=5 by coafter_next/
+]
+qed-.
+
+theorem coafter_total: ∀f2,f1. f2 ~⊚ f1 ≘ f2 ~∘ f1.
+/2 width=1 by coafter_total_aux/ qed.
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/pstream_eq.ma b/matita/matita/contribs/lambdadelta/ground/relocation/pstream_eq.ma
new file mode 100644 (file)
index 0000000..12663ae
--- /dev/null
@@ -0,0 +1,56 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.tcs.unibo.it                            *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/lib/stream_eq.ma".
+include "ground/relocation/rtmap_eq.ma".
+
+(* RELOCATION N-STREAM ******************************************************)
+
+(* Specific properties ******************************************************)
+
+fact eq_inv_seq_aux: ∀f1,f2,p1,p2. p1⨮f1 ≡ p2⨮f2 → p1 = p2 ∧ f1 ≡ f2.
+#f1 #f2 #p1 #p2 @(pnat_ind_2 … p1 p2) -p1 -p2
+[ #p2 #H elim (eq_inv_px … H) -H [2,3: // ]
+  #g1 #H1 #H elim (push_inv_seq_dx … H) -H /2 width=1 by conj/
+| #p1 #_ #H elim (eq_inv_np … H) -H //
+| #p1 #p2 #IH #H lapply (eq_inv_nn … H ????) -H [5:|*: // ]
+  #H elim (IH H) -IH -H /2 width=1 by conj/
+]
+qed-.
+
+lemma eq_inv_seq: ∀g1,g2. g1 ≡ g2 → ∀f1,f2,p1,p2. p1⨮f1 = g1 → p2⨮f2 = g2 →
+                  p1 = p2 ∧ f1 ≡ f2.
+/2 width=1 by eq_inv_seq_aux/ qed-.
+
+corec lemma nstream_eq: ∀f1,f2. f1 ≡ f2 → f1 ≗ f2.
+* #p1 #f1 * #p2 #f2 #Hf cases (eq_inv_gen … Hf) -Hf *
+#g1 #g2 #Hg #H1 #H2
+[ cases (push_inv_seq_dx … H1) -H1 * -p1 #H1
+  cases (push_inv_seq_dx … H2) -H2 * -p2 #H2
+  @stream_eq_cons /2 width=1 by/
+| cases (next_inv_seq_dx … H1) -H1 #m1 #H1 * -p1
+  cases (next_inv_seq_dx … H2) -H2 #m2 #H2 * -p2
+  cases (eq_inv_seq … Hg … H1 H2) -g1 -g2 #Hm #Hf
+  @stream_eq_cons /2 width=1 by/
+]
+qed-.
+
+corec lemma nstream_inv_eq: ∀f1,f2. f1 ≗ f2 → f1 ≡ f2.
+* #p1 #f1 * #p2 #f2 #H cases (stream_eq_inv_cons ??? H) -H [|*: // ]
+#Hf * -p2 cases p1 -p1 /3 width=5 by eq_push/
+#n @eq_next /3 width=5 by stream_eq_cons/
+qed.
+
+lemma eq_seq_id: ∀f1,f2. f1 ≡ f2 → ∀n. n⨮f1 ≡ n⨮f2.
+/4 width=1 by nstream_inv_eq, nstream_eq, stream_eq_cons/ qed.
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/pstream_id.ma b/matita/matita/contribs/lambdadelta/ground/relocation/pstream_id.ma
new file mode 100644 (file)
index 0000000..f3a1cce
--- /dev/null
@@ -0,0 +1,33 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/notation/functions/identity_0.ma".
+include "ground/relocation/rtmap_eq.ma".
+
+(* RELOCATION N-STREAM ******************************************************)
+
+corec definition id: rtmap ≝ ⫯id.
+
+interpretation "identity (nstream)"
+   'Identity = (id).
+
+(* Basic properties *********************************************************)
+
+lemma id_rew: ⫯𝐈𝐝 = 𝐈𝐝.
+<(stream_rew … (𝐈𝐝)) in ⊢ (???%); normalize //
+qed.
+
+lemma id_eq_rew: ⫯𝐈𝐝 ≡ 𝐈𝐝.
+cases id_rew in ⊢ (??%); //
+qed.
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/pstream_isid.ma b/matita/matita/contribs/lambdadelta/ground/relocation/pstream_isid.ma
new file mode 100644 (file)
index 0000000..fa647fd
--- /dev/null
@@ -0,0 +1,24 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/relocation/rtmap_isid.ma".
+
+(* RELOCATION N-STREAM ******************************************************)
+
+(* Specific inversion lemmas ************************************************)
+
+lemma isid_inv_seq: ∀f,p. 𝐈❪p⨮f❫ → 𝐈❪f❫ ∧ 𝟏 = p.
+#f #p #H elim (isid_inv_gen … H) -H
+#g #Hg #H elim (push_inv_seq_dx … H) -H /2 width=1 by conj/
+qed-.
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/pstream_istot.ma b/matita/matita/contribs/lambdadelta/ground/relocation/pstream_istot.ma
new file mode 100644 (file)
index 0000000..f8b66a3
--- /dev/null
@@ -0,0 +1,122 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.tcs.unibo.it                            *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/notation/functions/apply_2.ma".
+include "ground/arith/pnat_le_plus.ma".
+include "ground/relocation/pstream_eq.ma".
+include "ground/relocation/rtmap_istot.ma".
+
+(* RELOCATION N-STREAM ******************************************************)
+
+rec definition apply (i: pnat) on i: rtmap → pnat.
+* #p #f cases i -i
+[ @p
+| #i lapply (apply i f) -apply -i -f
+  #i @(i+p)
+]
+defined.
+
+interpretation "functional application (nstream)"
+   'Apply f i = (apply i f).
+
+(* Specific properties on at ************************************************)
+
+lemma at_O1: ∀i2,f. @❪𝟏, i2⨮f❫ ≘ i2.
+#i2 elim i2 -i2 /2 width=5 by at_refl, at_next/
+qed.
+
+lemma at_S1: ∀p,f,i1,i2. @❪i1, f❫ ≘ i2 → @❪↑i1, p⨮f❫ ≘ i2+p.
+#p elim p -p /3 width=7 by at_push, at_next/
+qed.
+
+lemma at_total: ∀i1,f. @❪i1, f❫ ≘ f@❨i1❩.
+#i1 elim i1 -i1
+[ * // | #i #IH * /3 width=1 by at_S1/ ]
+qed.
+
+lemma at_istot: ∀f. 𝐓❪f❫.
+/2 width=2 by ex_intro/ qed.
+
+lemma at_plus2: ∀f,i1,i,p,q. @❪i1, p⨮f❫ ≘ i → @❪i1, (p+q)⨮f❫ ≘ i+q.
+#f #i1 #i #p #q #H elim q -q
+/2 width=5 by at_next/
+qed.
+
+(* Specific inversion lemmas on at ******************************************)
+
+lemma at_inv_O1: ∀f,p,i2. @❪𝟏, p⨮f❫ ≘ i2 → p = i2.
+#f #p elim p -p /2 width=6 by at_inv_ppx/
+#p #IH #i2 #H elim (at_inv_xnx … H) -H [|*: // ]
+#j2 #Hj * -i2 /3 width=1 by eq_f/
+qed-.
+
+lemma at_inv_S1: ∀f,p,j1,i2. @❪↑j1, p⨮f❫ ≘ i2 →
+                 ∃∃j2. @❪j1, f❫ ≘ j2 & j2+p = i2.
+#f #p elim p -p /2 width=5 by at_inv_npx/
+#p #IH #j1 #i2 #H elim (at_inv_xnx … H) -H [|*: // ]
+#j2 #Hj * -i2 elim (IH … Hj) -IH -Hj
+#i2 #Hi * -j2 /2 width=3 by ex2_intro/
+qed-.
+
+lemma at_inv_total: ∀f,i1,i2. @❪i1, f❫ ≘ i2 → f@❨i1❩ = i2.
+/2 width=6 by at_mono/ qed-.
+
+(* Spercific forward lemmas on at *******************************************)
+
+lemma at_increasing_plus: ∀f,p,i1,i2. @❪i1, p⨮f❫ ≘ i2 → i1 + p ≤ ↑i2.
+#f #p *
+[ #i2 #H <(at_inv_O1 … H) -i2 //
+| #i1 #i2 #H elim (at_inv_S1 … H) -H
+  #j1 #Ht * -i2 <pplus_succ_sn 
+  /4 width=2 by at_increasing, ple_plus_bi_dx, ple_succ_bi/
+]
+qed-.
+
+lemma at_fwd_id: ∀f,p,i. @❪i, p⨮f❫ ≘ i → 𝟏 = p.
+#f #p #i #H elim (at_fwd_id_ex … H) -H
+#g #H elim (push_inv_seq_dx … H) -H //
+qed-.
+
+(* Basic properties *********************************************************)
+
+lemma apply_O1: ∀p,f. (p⨮f)@❨𝟏❩ = p.
+// qed.
+
+lemma apply_S1: ∀p,f,i. (p⨮f)@❨↑i❩ = f@❨i❩+p.
+// qed.
+
+lemma apply_eq_repl (i): eq_repl … (λf1,f2. f1@❨i❩ = f2@❨i❩).
+#i elim i -i [2: #i #IH ] * #p1 #f1 * #p2 #f2 #H
+elim (eq_inv_seq_aux … H) -H #Hp #Hf //
+>apply_S1 >apply_S1 /3 width=1 by eq_f2/
+qed.
+
+lemma apply_S2: ∀f,i. (↑f)@❨i❩ = ↑(f@❨i❩).
+* #p #f * //
+qed.
+
+(* Main inversion lemmas ****************************************************)
+
+theorem apply_inj: ∀f,i1,i2,j. f@❨i1❩ = j → f@❨i2❩ = j → i1 = i2.
+/2 width=4 by at_inj/ qed-.
+
+corec theorem nstream_eq_inv_ext: ∀f1,f2. (∀i. f1@❨i❩ = f2@❨i❩) → f1 ≗ f2.
+* #p1 #f1 * #p2 #f2 #Hf @stream_eq_cons
+[ @(Hf (𝟏))
+| @nstream_eq_inv_ext -nstream_eq_inv_ext #i
+  lapply (Hf (𝟏)) >apply_O1 >apply_O1 #H destruct
+  lapply (Hf (↑i)) >apply_S1 >apply_S1 #H
+  /3 width=2 by eq_inv_pplus_bi_dx, eq_inv_psucc_bi/
+]
+qed-.
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/pstream_sor.ma b/matita/matita/contribs/lambdadelta/ground/relocation/pstream_sor.ma
new file mode 100644 (file)
index 0000000..2e77581
--- /dev/null
@@ -0,0 +1,26 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/relocation/rtmap_sor.ma".
+
+(* RELOCATION N-STREAM ******************************************************)
+
+axiom union: rtmap → rtmap → rtmap.
+
+interpretation "union (nstream)"
+   'union f1 f2 = (union f1 f2).
+
+(* Specific properties on sor ***********************************************)
+
+axiom sor_total: ∀f1,f2. f1 ⋓ f2 ≘ f1 ∪ f2.
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/pstream_tl.ma b/matita/matita/contribs/lambdadelta/ground/relocation/pstream_tl.ma
new file mode 100644 (file)
index 0000000..318b7da
--- /dev/null
@@ -0,0 +1,26 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/lib/stream_hdtl.ma".
+include "ground/relocation/pstream.ma".
+
+(* RELOCATION P-STREAM ******************************************************)
+
+(* Poperties with stream_tl *************************************************)
+
+lemma tl_push: ∀f. f = ⫰⫯f.
+// qed.
+
+lemma tl_next: ∀f. ⫰f = ⫰↑f.
+* // qed.
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/pstream_tls.ma b/matita/matita/contribs/lambdadelta/ground/relocation/pstream_tls.ma
new file mode 100644 (file)
index 0000000..e7232fa
--- /dev/null
@@ -0,0 +1,25 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/lib/stream_tls.ma".
+include "ground/arith/nat_pred_succ.ma".
+include "ground/relocation/pstream_tl.ma".
+
+(* RELOCATION P-STREAM ******************************************************)
+
+(* Poperties with stream_tls ************************************************)
+
+lemma tls_next: ∀f. ∀p:pnat. ⫰*[p]f = ⫰*[p]↑f.
+#f #p >(npsucc_pred p) <stream_tls_swap <stream_tls_swap //
+qed.
index dd8e0288affeeb22f369347a3dda01dfb7954fbc..23cf0d46d5cee21112c0de0f101ace82b292ba1a 100644 (file)
@@ -12,7 +12,7 @@
 (*                                                                        *)
 (**************************************************************************)
 
-include "ground/relocation/nstream.ma".
+include "ground/relocation/pstream.ma".
 
 (* RELOCATION MAP ***********************************************************)
 
index ae6c2de4e502e0695ec001ed92fe5d33cf9311c4..569ea3143372c1375106494f25bf596dceb80eeb 100644 (file)
@@ -13,6 +13,7 @@
 (**************************************************************************)
 
 include "ground/notation/relations/rafter_3.ma".
+include "ground/arith/nat_pred_succ.ma".
 include "ground/relocation/rtmap_istot.ma".
 
 (* RELOCATION MAP ***********************************************************)
@@ -267,9 +268,10 @@ lemma after_mono_eq: ∀f1,f2,f. f1 ⊚ f2 ≘ f → ∀g1,g2,g. g1 ⊚ g2 ≘ g
 
 (* Properties on tls ********************************************************)
 
-lemma after_tls: ∀n,f1,f2,f. @❪0, f1❫ ≘ n →
+(* Note: this requires ↑ on first n *)
+lemma after_tls: ∀n,f1,f2,f. @❪𝟏, f1❫ ≘ ↑n →
                  f1 ⊚ f2 ≘ f → ⫱*[n]f1 ⊚ f2 ≘ ⫱*[n]f.
-#n elim n -n //
+#n @(nat_ind_succ … n) -n //
 #n #IH #f1 #f2 #f #Hf1 #Hf
 cases (at_inv_pxn … Hf1) -Hf1 [ |*: // ] #g1 #Hg1 #H1
 cases (after_inv_nxx … Hf … H1) -Hf #g #Hg #H0 destruct
@@ -315,31 +317,6 @@ qed-.
 lemma after_inv_isid3: ∀f1,f2,f. f1 ⊚ f2 ≘ f → 𝐈❪f❫ → 𝐈❪f1❫ ∧ 𝐈❪f2❫.
 /3 width=4 by after_fwd_isid2, after_fwd_isid1, conj/ qed-.
 
-(* Properties on isuni ******************************************************)
-
-lemma after_isid_isuni: ∀f1,f2. 𝐈❪f2❫ → 𝐔❪f1❫ → f1 ⊚ ↑f2 ≘ ↑f1.
-#f1 #f2 #Hf2 #H elim H -H
-/5 width=7 by after_isid_dx, after_eq_repl_back2, after_next, after_push, eq_push_inv_isid/
-qed.
-
-lemma after_uni_next2: ∀f2. 𝐔❪f2❫ → ∀f1,f. ↑f2 ⊚ f1 ≘ f → f2 ⊚ ↑f1 ≘ f.
-#f2 #H elim H -f2
-[ #f2 #Hf2 #f1 #f #Hf
-  elim (after_inv_nxx … Hf) -Hf [2,3: // ] #g #Hg #H0 destruct
-  /4 width=7 by after_isid_inv_sn, after_isid_sn, after_eq_repl_back0, eq_next/
-| #f2 #_ #g2 #H2 #IH #f1 #f #Hf
-  elim (after_inv_nxx … Hf) -Hf [2,3: // ] #g #Hg #H0 destruct
-  /3 width=5 by after_next/
-]
-qed.
-
-(* Properties on uni ********************************************************)
-
-lemma after_uni: ∀n1,n2. 𝐔❨n1❩ ⊚ 𝐔❨n2❩ ≘ 𝐔❨n1+n2❩.
-@nat_elim2 [3: #n #m <plus_n_Sm ] (**) (* full auto fails *)
-/4 width=5 by after_uni_next2, after_isid_dx, after_isid_sn, after_next/
-qed.
-
 (* Forward lemmas on at *****************************************************)
 
 lemma after_at_fwd: ∀i,i1,f. @❪i1, f❫ ≘ i → ∀f2,f1. f2 ⊚ f1 ≘ f →
@@ -401,87 +378,6 @@ lemma after_fwd_at1: ∀i,i2,i1,f,f2. @❪i1, f❫ ≘ i → @❪i2, f2❫ ≘ i
 ]
 qed-.
 
-(* Properties with at *******************************************************)
-
-lemma after_uni_dx: ∀i2,i1,f2. @❪i1, f2❫ ≘ i2 →
-                    ∀f. f2 ⊚ 𝐔❨i1❩ ≘ f → 𝐔❨i2❩ ⊚ ⫱*[i2] f2 ≘ f.
-#i2 elim i2 -i2
-[ #i1 #f2 #Hf2 #f #Hf
-  elim (at_inv_xxp … Hf2) -Hf2 // #g2 #H1 #H2 destruct
-  lapply (after_isid_inv_dx … Hf ?) -Hf
-  /3 width=3 by after_isid_sn, after_eq_repl_back0/
-| #i2 #IH #i1 #f2 #Hf2 #f #Hf
-  elim (at_inv_xxn … Hf2) -Hf2 [1,3: * |*: // ]
-  [ #g2 #j1 #Hg2 #H1 #H2 destruct
-    elim (after_inv_pnx … Hf) -Hf [ |*: // ] #g #Hg #H destruct
-    <tls_xn /3 width=5 by after_next/
-  | #g2 #Hg2 #H2 destruct
-    elim (after_inv_nxx … Hf) -Hf [2,3: // ] #g #Hg #H destruct
-    <tls_xn /3 width=5 by after_next/
-  ]
-]
-qed.
-
-lemma after_uni_sn: ∀i2,i1,f2. @❪i1, f2❫ ≘ i2 →
-                    ∀f. 𝐔❨i2❩ ⊚ ⫱*[i2] f2 ≘ f → f2 ⊚ 𝐔❨i1❩ ≘ f.
-#i2 elim i2 -i2
-[ #i1 #f2 #Hf2 #f #Hf
-  elim (at_inv_xxp … Hf2) -Hf2 // #g2 #H1 #H2 destruct
-  lapply (after_isid_inv_sn … Hf ?) -Hf
-  /3 width=3 by after_isid_dx, after_eq_repl_back0/
-| #i2 #IH #i1 #f2 #Hf2 #f #Hf
-  elim (after_inv_nxx … Hf) -Hf [2,3: // ] #g #Hg #H destruct
-  elim (at_inv_xxn … Hf2) -Hf2 [1,3: * |*: // ]
-  [ #g2 #j1 #Hg2 #H1 #H2 destruct /3 width=7 by after_push/
-  | #g2 #Hg2 #H2 destruct /3 width=5 by after_next/
-  ]
-]
-qed-.
-
-lemma after_uni_succ_dx: ∀i2,i1,f2. @❪i1, f2❫ ≘ i2 →
-                         ∀f. f2 ⊚ 𝐔❨↑i1❩ ≘ f → 𝐔❨↑i2❩ ⊚ ⫱*[↑i2] f2 ≘ f.
-#i2 elim i2 -i2
-[ #i1 #f2 #Hf2 #f #Hf
-  elim (at_inv_xxp … Hf2) -Hf2 // #g2 #H1 #H2 destruct
-  elim (after_inv_pnx … Hf) -Hf [ |*: // ] #g #Hg #H
-  lapply (after_isid_inv_dx … Hg ?) -Hg
-  /4 width=5 by after_isid_sn, after_eq_repl_back0, after_next/
-| #i2 #IH #i1 #f2 #Hf2 #f #Hf
-  elim (at_inv_xxn … Hf2) -Hf2 [1,3: * |*: // ]
-  [ #g2 #j1 #Hg2 #H1 #H2 destruct
-    elim (after_inv_pnx … Hf) -Hf [ |*: // ] #g #Hg #H destruct
-    <tls_xn /3 width=5 by after_next/
-  | #g2 #Hg2 #H2 destruct
-    elim (after_inv_nxx … Hf) -Hf [2,3: // ] #g #Hg #H destruct
-    <tls_xn /3 width=5 by after_next/
-  ]
-]
-qed.
-
-lemma after_uni_succ_sn: ∀i2,i1,f2. @❪i1, f2❫ ≘ i2 →
-                         ∀f. 𝐔❨↑i2❩ ⊚ ⫱*[↑i2] f2 ≘ f → f2 ⊚ 𝐔❨↑i1❩ ≘ f.
-#i2 elim i2 -i2
-[ #i1 #f2 #Hf2 #f #Hf
-  elim (at_inv_xxp … Hf2) -Hf2 // #g2 #H1 #H2 destruct
-  elim (after_inv_nxx … Hf) -Hf [ |*: // ] #g #Hg #H destruct
-  lapply (after_isid_inv_sn … Hg ?) -Hg
-  /4 width=7 by after_isid_dx, after_eq_repl_back0, after_push/
-| #i2 #IH #i1 #f2 #Hf2 #f #Hf
-  elim (after_inv_nxx … Hf) -Hf [2,3: // ] #g #Hg #H destruct
-  elim (at_inv_xxn … Hf2) -Hf2 [1,3: * |*: // ]
-  [ #g2 #j1 #Hg2 #H1 #H2 destruct <tls_xn in Hg; /3 width=7 by after_push/
-  | #g2 #Hg2 #H2 destruct <tls_xn in Hg; /3 width=5 by after_next/
-  ]
-]
-qed-.
-
-lemma after_uni_one_dx: ∀f2,f. ⫯f2 ⊚ 𝐔❨↑O❩ ≘ f → 𝐔❨↑O❩ ⊚ f2 ≘ f.
-#f2 #f #H @(after_uni_succ_dx … (⫯f2)) /2 width=3 by at_refl/
-qed.
-
-lemma after_uni_one_sn: ∀f1,f. 𝐔❨↑O❩ ⊚ f1 ≘ f → ⫯f1 ⊚ 𝐔❨↑O❩ ≘ f.
-/3 width=3 by after_uni_succ_sn, at_refl/ qed-.
-
 (* Forward lemmas on istot **************************************************)
 
 lemma after_istot_fwd: ∀f2,f1,f. f2 ⊚ f1 ≘ f → 𝐓❪f2❫ → 𝐓❪f1❫ → 𝐓❪f❫.
@@ -527,23 +423,23 @@ lemma after_fwd_isid_dx: ∀f2,f1,f.  𝐓❪f❫ → f2 ⊚ f1 ≘ f → f2 ≡
 /3 width=8 by at_inj, at_eq_repl_back/
 qed-.
 
-corec fact after_inj_O_aux: ∀f1. @❪0, f1❫ ≘ 0 → H_after_inj f1.
+corec fact after_inj_O_aux: ∀f1. @❪𝟏, f1❫ ≘ 𝟏 → H_after_inj f1.
 #f1 #H1f1 #H2f1 #f #f21 #f22 #H1f #H2f
 cases (at_inv_pxp … H1f1) -H1f1 [ |*: // ] #g1 #H1
 lapply (istot_inv_push … H2f1 … H1) -H2f1 #H2g1
-cases (H2g1 0) #n #Hn
+cases (H2g1 (𝟏)) #p #Hp
 cases (after_inv_pxx … H1f … H1) -H1f * #g21 #g #H1g #H21 #H
 [ cases (after_inv_pxp … H2f … H1 H) -f1 -f #g22 #H2g #H22
   @(eq_push … H21 H22) -f21 -f22
 | cases (after_inv_pxn … H2f … H1 H) -f1 -f #g22 #H2g #H22
   @(eq_next … H21 H22) -f21 -f22
 ]
-@(after_inj_O_aux (⫱*[n]g1) … (⫱*[n]g)) -after_inj_O_aux
+@(after_inj_O_aux (⫱*[↓p]g1) … (⫱*[↓p]g)) -after_inj_O_aux
 /2 width=1 by after_tls, istot_tls, at_pxx_tls/
 qed-.
 
-fact after_inj_aux: (∀f1. @❪0, f1❫ ≘ 0 → H_after_inj f1) →
-                    ∀i2,f1. @❪0, f1❫ ≘ i2 → H_after_inj f1.
+fact after_inj_aux: (∀f1. @❪𝟏, f1❫ ≘ 𝟏 → H_after_inj f1) →
+                    ∀i2,f1. @❪𝟏, f1❫ ≘ i2 → H_after_inj f1.
 #H0 #i2 elim i2 -i2 /2 width=1 by/ -H0
 #i2 #IH #f1 #H1f1 #H2f1 #f #f21 #f22 #H1f #H2f
 elim (at_inv_pxn … H1f1) -H1f1 [ |*: // ] #g1 #H1g1 #H1
@@ -553,5 +449,5 @@ lapply (after_inv_nxn … H2f … H1 H) -f #H2g
 qed-.
 
 theorem after_inj: ∀f1. H_after_inj f1.
-#f1 #H cases (H 0) /3 width=7 by after_inj_aux, after_inj_O_aux/
+#f1 #H cases (H (𝟏)) /3 width=7 by after_inj_aux, after_inj_O_aux/
 qed-.
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/rtmap_after_nat_uni.ma b/matita/matita/contribs/lambdadelta/ground/relocation/rtmap_after_nat_uni.ma
new file mode 100644 (file)
index 0000000..ba2e4a8
--- /dev/null
@@ -0,0 +1,55 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/relocation/rtmap_uni.ma".
+include "ground/relocation/rtmap_nat.ma".
+include "ground/relocation/rtmap_after.ma".
+
+(* RELOCATION MAP ***********************************************************)
+
+lemma after_uni_dx: ∀l2,l1,f2. @↑❪l1, f2❫ ≘ l2 →
+                    ∀f. f2 ⊚ 𝐔❨l1❩ ≘ f → 𝐔❨l2❩ ⊚ ⫱*[l2] f2 ≘ f.
+#l2 @(nat_ind_succ … l2) -l2
+[ #l1 #f2 #Hf2 #f #Hf
+  elim (rm_nat_inv_xxp … Hf2) -Hf2 // #g2 #H1 #H2 destruct
+  lapply (after_isid_inv_dx … Hf ?) -Hf
+  /3 width=3 by after_isid_sn, after_eq_repl_back0/
+| #l2 #IH #l1 #f2 #Hf2 #f #Hf
+  elim (rm_nat_inv_xxn … Hf2) -Hf2 [1,3: * |*: // ]
+  [ #g2 #k1 #Hg2 #H1 #H2 destruct
+    elim (after_inv_pnx … Hf) -Hf [ |*: // ] #g #Hg #H destruct
+    <tls_xn /3 width=5 by after_next/
+  | #g2 #Hg2 #H2 destruct
+    elim (after_inv_nxx … Hf) -Hf [ |*: // ] #g #Hg #H destruct
+    <tls_xn /3 width=5 by after_next/
+  ]
+]
+qed.
+
+lemma after_uni_sn: ∀l2,l1,f2. @↑❪l1, f2❫ ≘ l2 →
+                    ∀f. 𝐔❨l2❩ ⊚ ⫱*[l2] f2 ≘ f → f2 ⊚ 𝐔❨l1❩ ≘ f.
+#l2 @(nat_ind_succ … l2) -l2
+[ #l1 #f2 #Hf2 #f #Hf
+  elim (rm_nat_inv_xxp … Hf2) -Hf2 // #g2 #H1 #H2 destruct
+  lapply (after_isid_inv_sn … Hf ?) -Hf
+  /3 width=3 by after_isid_dx, after_eq_repl_back0/
+| #l2 #IH #l1 #f2 #Hf2 #f #Hf
+  elim (after_inv_nxx … Hf) -Hf [2,3: // ] #g #Hg #H destruct
+  elim (rm_nat_inv_xxn … Hf2) -Hf2 [1,3: * |*: // ]
+  [ #g2 #k1 #Hg2 #H1 #H2 destruct /3 width=7 by after_push/
+  | #g2 #Hg2 #H2 destruct /3 width=5 by after_next/
+  ]
+]
+qed-.
+
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/rtmap_after_uni.ma b/matita/matita/contribs/lambdadelta/ground/relocation/rtmap_after_uni.ma
new file mode 100644 (file)
index 0000000..92cba1d
--- /dev/null
@@ -0,0 +1,95 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/arith/nat_plus.ma".
+include "ground/relocation/rtmap_uni.ma".
+include "ground/relocation/rtmap_after.ma".
+
+(* RELOCATION MAP ***********************************************************)
+
+(* Properties on isuni ******************************************************)
+
+lemma after_isid_isuni: ∀f1,f2. 𝐈❪f2❫ → 𝐔❪f1❫ → f1 ⊚ ↑f2 ≘ ↑f1.
+#f1 #f2 #Hf2 #H elim H -H
+/5 width=7 by after_isid_dx, after_eq_repl_back2, after_next, after_push, eq_push_inv_isid/
+qed.
+
+lemma after_uni_next2: ∀f2. 𝐔❪f2❫ → ∀f1,f. ↑f2 ⊚ f1 ≘ f → f2 ⊚ ↑f1 ≘ f.
+#f2 #H elim H -f2
+[ #f2 #Hf2 #f1 #f #Hf
+  elim (after_inv_nxx … Hf) -Hf [2,3: // ] #g #Hg #H0 destruct
+  /4 width=7 by after_isid_inv_sn, after_isid_sn, after_eq_repl_back0, eq_next/
+| #f2 #_ #g2 #H2 #IH #f1 #f #Hf
+  elim (after_inv_nxx … Hf) -Hf [2,3: // ] #g #Hg #H0 destruct
+  /3 width=5 by after_next/
+]
+qed.
+
+(* Properties on uni ********************************************************)
+
+lemma after_uni: ∀n1,n2. 𝐔❨n1❩ ⊚ 𝐔❨n2❩ ≘ 𝐔❨n2+n1❩.
+#n1 @(nat_ind_succ … n1) -n1
+/3 width=5 by after_isid_sn, after_next, eq_f/
+qed.
+
+lemma after_uni_sn_pushs (m) (f): 𝐔❨m❩ ⊚ f ≘ ↑*[m]f.
+#m @(nat_ind_succ … m) -m
+/2 width=5 by after_isid_sn, after_next/
+qed.
+
+(* Properties with at *******************************************************)
+
+lemma after_uni_succ_dx: ∀i2,i1,f2. @❪i1, f2❫ ≘ i2 →
+                         ∀f. f2 ⊚ 𝐔❨i1❩ ≘ f → 𝐔❨i2❩ ⊚ ⫱*[i2] f2 ≘ f.
+#i2 elim i2 -i2
+[ #i1 #f2 #Hf2 #f #Hf
+  elim (at_inv_xxp … Hf2) -Hf2 // #g2 #H1 #H2 destruct
+  elim (after_inv_pnx … Hf) -Hf [ |*: // ] #g #Hg #H
+  lapply (after_isid_inv_dx … Hg ?) -Hg
+  /4 width=5 by after_isid_sn, after_eq_repl_back0, after_next/
+| #i2 #IH #i1 #f2 #Hf2 #f #Hf >nsucc_inj
+  elim (at_inv_xxn … Hf2) -Hf2 [1,3: * |*: // ]
+  [ #g2 #j1 #Hg2 #H1 #H2 destruct >nsucc_inj in Hf; #Hf
+    elim (after_inv_pnx … Hf) -Hf [ |*: // ] #g #Hg #H destruct
+    <tls_xn /3 width=5 by after_next/
+  | #g2 #Hg2 #H2 destruct
+    elim (after_inv_nxx … Hf) -Hf [2,3: // ] #g #Hg #H destruct
+    <tls_xn /3 width=5 by after_next/
+  ]
+]
+qed.
+
+lemma after_uni_succ_sn: ∀i2,i1,f2. @❪i1, f2❫ ≘ i2 →
+                         ∀f. 𝐔❨i2❩ ⊚ ⫱*[i2] f2 ≘ f → f2 ⊚ 𝐔❨i1❩ ≘ f.
+#i2 elim i2 -i2
+[ #i1 #f2 #Hf2 #f #Hf
+  elim (at_inv_xxp … Hf2) -Hf2 // #g2 #H1 #H2 destruct
+  elim (after_inv_nxx … Hf) -Hf [ |*: // ] #g #Hg #H destruct
+  lapply (after_isid_inv_sn … Hg ?) -Hg
+  /4 width=7 by after_isid_dx, after_eq_repl_back0, after_push/
+| #i2 #IH #i1 #f2 #Hf2 #f >nsucc_inj #Hf
+  elim (after_inv_nxx … Hf) -Hf [2,3: // ] #g #Hg #H destruct
+  elim (at_inv_xxn … Hf2) -Hf2 [1,3: * |*: // ]
+  [ #g2 #j1 #Hg2 #H1 #H2 destruct <tls_xn in Hg; /3 width=7 by after_push/
+  | #g2 #Hg2 #H2 destruct <tls_xn in Hg; /3 width=5 by after_next/
+  ]
+]
+qed-.
+
+lemma after_uni_one_dx: ∀f2,f. ⫯f2 ⊚ 𝐔❨𝟏❩ ≘ f → 𝐔❨𝟏❩ ⊚ f2 ≘ f.
+#f2 #f #H @(after_uni_succ_dx … (⫯f2)) /2 width=3 by at_refl/
+qed.
+
+lemma after_uni_one_sn: ∀f1,f. 𝐔❨𝟏❩ ⊚ f1 ≘ f → ⫯f1 ⊚ 𝐔❨𝟏❩ ≘ f.
+/3 width=3 by after_uni_succ_sn, at_refl/ qed-.
index 41871b15cfc56433ff894d1e4b33b79051a300a6..ddb1819a57a956d36b3febaf45f8d84d401546f6 100644 (file)
 (**************************************************************************)
 
 include "ground/notation/relations/rat_3.ma".
-include "ground/relocation/rtmap_uni.ma".
+include "ground/arith/pnat_plus.ma".
+include "ground/arith/pnat_lt_pred.ma".
+include "ground/relocation/rtmap_id.ma".
 
 (* RELOCATION MAP ***********************************************************)
 
-coinductive at: rtmap → relation nat ≝
-| at_refl: ∀f,g,j1,j2. ⫯f = g → 0 = j1 → 0 = j2 → at g j1 j2
+coinductive at: relation3 rtmap pnat pnat ≝
+| at_refl: ∀f,g,j1,j2. ⫯f = g → 𝟏 = j1 → 𝟏 = j2 → at g j1 j2
 | at_push: ∀f,i1,i2. at f i1 i2 → ∀g,j1,j2. ⫯f = g → ↑i1 = j1 → ↑i2 = j2 → at g j1 j2
 | at_next: ∀f,i1,i2. at f i1 i2 → ∀g,j2. ↑f = g → ↑i2 = j2 → at g i1 j2
 .
@@ -32,7 +34,7 @@ definition H_at_div: relation4 rtmap rtmap rtmap rtmap ≝ λf2,g2,f1,g1.
 
 (* Basic inversion lemmas ***************************************************)
 
-lemma at_inv_ppx: ∀f,i1,i2. @❪i1,f❫ ≘ i2 → ∀g. 0 = i1 → ⫯g = f → 0 = i2.
+lemma at_inv_ppx: ∀f,i1,i2. @❪i1,f❫ ≘ i2 → ∀g. 𝟏 = i1 → ⫯g = f → 𝟏 = i2.
 #f #i1 #i2 * -f -i1 -i2 //
 [ #f #i1 #i2 #_ #g #j1 #j2 #_ * #_ #x #H destruct
 | #f #i1 #i2 #_ #g #j2 * #_ #x #_ #H elim (discr_push_next … H)
@@ -59,14 +61,16 @@ qed-.
 
 (* Advanced inversion lemmas ************************************************)
 
+alias symbol "UpArrow" (instance 3) = "successor (positive integers)".
 lemma at_inv_ppn: ∀f,i1,i2. @❪i1,f❫ ≘ i2 →
-                  ∀g,j2. 0 = i1 → ⫯g = f → ↑j2 = i2 → ⊥.
+                  ∀g,j2. 𝟏 = i1 → ⫯g = f → ↑j2 = i2 → ⊥.
 #f #i1 #i2 #Hf #g #j2 #H1 #H <(at_inv_ppx … Hf … H1 H) -f -g -i1 -i2
 #H destruct
 qed-.
 
+alias symbol "UpArrow" (instance 7) = "successor (positive integers)".
 lemma at_inv_npp: ∀f,i1,i2. @❪i1,f❫ ≘ i2 →
-                  ∀g,j1. ↑j1 = i1 → ⫯g = f → 0 = i2 → ⊥.
+                  ∀g,j1. ↑j1 = i1 → ⫯g = f → 𝟏 = i2 → ⊥.
 #f #i1 #i2 #Hf #g #j1 #H1 #H elim (at_inv_npx … Hf … H1 H) -f -i1
 #x2 #Hg * -i2 #H destruct
 qed-.
@@ -78,7 +82,7 @@ lemma at_inv_npn: ∀f,i1,i2. @❪i1,f❫ ≘ i2 →
 qed-.
 
 lemma at_inv_xnp: ∀f,i1,i2. @❪i1,f❫ ≘ i2 →
-                  ∀g. ↑g = f → 0 = i2 → ⊥.
+                  ∀g. ↑g = f → 𝟏 = i2 → ⊥.
 #f #i1 #i2 #Hf #g #H elim (at_inv_xnx … Hf … H) -f
 #x2 #Hg * -i2 #H destruct
 qed-.
@@ -89,12 +93,12 @@ lemma at_inv_xnn: ∀f,i1,i2. @❪i1,f❫ ≘ i2 →
 #x2 #Hg * -i2 #H destruct //
 qed-.
 
-lemma at_inv_pxp: ∀f,i1,i2. @❪i1,f❫ ≘ i2 → 0 = i1 → 0 = i2 → ∃g. ⫯g = f.
+lemma at_inv_pxp: ∀f,i1,i2. @❪i1,f❫ ≘ i2 → 𝟏 = i1 → 𝟏 = i2 → ∃g. ⫯g = f.
 #f elim (pn_split … f) * /2 width=2 by ex_intro/
 #g #H #i1 #i2 #Hf #H1 #H2 cases (at_inv_xnp … Hf … H H2)
 qed-.
 
-lemma at_inv_pxn: ∀f,i1,i2. @❪i1,f❫ ≘ i2 → ∀j2. 0 = i1 → ↑j2 = i2 →
+lemma at_inv_pxn: ∀f,i1,i2. @❪i1,f❫ ≘ i2 → ∀j2. 𝟏 = i1 → ↑j2 = i2 →
                   ∃∃g. @❪i1,g❫ ≘ j2 & ↑g = f.
 #f elim (pn_split … f) *
 #g #H #i1 #i2 #Hf #j2 #H1 #H2
@@ -103,8 +107,9 @@ lemma at_inv_pxn: ∀f,i1,i2. @❪i1,f❫ ≘ i2 → ∀j2. 0 = i1 → ↑j2 = i
 ]
 qed-.
 
+alias symbol "UpArrow" (instance 5) = "successor (positive integers)".
 lemma at_inv_nxp: ∀f,i1,i2. @❪i1,f❫ ≘ i2 →
-                  ∀j1. ↑j1 = i1 → 0 = i2 → ⊥.
+                  ∀j1. ↑j1 = i1 → 𝟏 = i2 → ⊥.
 #f elim (pn_split f) *
 #g #H #i1 #i2 #Hf #j1 #H1 #H2
 [ elim (at_inv_npp … Hf … H1 H H2)
@@ -121,15 +126,15 @@ qed-.
 
 (* Note: the following inversion lemmas must be checked *)
 lemma at_inv_xpx: ∀f,i1,i2. @❪i1,f❫ ≘ i2 → ∀g. ⫯g = f →
-                  (0 = i1 ∧ 0 = i2) ∨
-                  ∃∃j1,j2. @❪j1,g❫ ≘ j2 & ↑j1 = i1 & ↑j2 = i2.
+                  ∨∨ ∧∧ 𝟏 = i1 & 𝟏 = i2
+                   | ∃∃j1,j2. @❪j1,g❫ ≘ j2 & ↑j1 = i1 & ↑j2 = i2.
 #f * [2: #i1 ] #i2 #Hf #g #H
 [ elim (at_inv_npx … Hf … H) -f /3 width=5 by or_intror, ex3_2_intro/
 | >(at_inv_ppx … Hf … H) -f /3 width=1 by conj, or_introl/
 ]
 qed-.
 
-lemma at_inv_xpp: ∀f,i1,i2. @❪i1,f❫ ≘ i2 → ∀g. ⫯g = f → 0 = i2 → 0 = i1.
+lemma at_inv_xpp: ∀f,i1,i2. @❪i1,f❫ ≘ i2 → ∀g. ⫯g = f → 𝟏 = i2 → 𝟏 = i1.
 #f #i1 #i2 #Hf #g #H elim (at_inv_xpx … Hf … H) -f * //
 #j1 #j2 #_ #_ * -i2 #H destruct
 qed-.
@@ -142,8 +147,8 @@ lemma at_inv_xpn: ∀f,i1,i2. @❪i1,f❫ ≘ i2 → ∀g,j2. ⫯g = f → ↑j2
 ]
 qed-.
 
-lemma at_inv_xxp: ∀f,i1,i2. @❪i1,f❫ ≘ i2 → 0 = i2 →
-                  ∃∃g. 0 = i1 & ⫯g = f.
+lemma at_inv_xxp: ∀f,i1,i2. @❪i1,f❫ ≘ i2 → 𝟏 = i2 →
+                  ∃∃g. 𝟏 = i1 & ⫯g = f.
 #f elim (pn_split f) *
 #g #H #i1 #i2 #Hf #H2
 [ /3 width=6 by at_inv_xpp, ex2_intro/
@@ -168,21 +173,21 @@ lemma at_increasing: ∀i2,i1,f. @❪i1,f❫ ≘ i2 → i1 ≤ i2.
 [ #i1 #f #Hf elim (at_inv_xxp … Hf) -Hf //
 | #i2 #IH * //
   #i1 #f #Hf elim (at_inv_nxn … Hf) -Hf [1,4: * |*: // ]
-  /3 width=2 by le_S_S, le_S/
+  /3 width=2 by ple_succ_bi, ple_succ_dx/
 ]
 qed-.
 
 lemma at_increasing_strict: ∀g,i1,i2. @❪i1,g❫ ≘ i2 → ∀f. ↑f = g →
                             i1 < i2 ∧ @❪i1,f❫ ≘ ↓i2.
 #g #i1 #i2 #Hg #f #H elim (at_inv_xnx … Hg … H) -Hg -H
-/4 width=2 by conj, at_increasing, le_S_S/
+/4 width=2 by conj, at_increasing, ple_succ_bi/
 qed-.
 
 lemma at_fwd_id_ex: ∀f,i. @❪i,f❫ ≘ i → ∃g. ⫯g = f.
 #f elim (pn_split f) * /2 width=2 by ex_intro/
 #g #H #i #Hf elim (at_inv_xnx … Hf … H) -Hf -H
 #j2 #Hg #H destruct lapply (at_increasing … Hg) -Hg
-#H elim (lt_le_false … H) -H //
+#H elim (plt_ge_false … H) -H //
 qed-.
 
 (* Basic properties *********************************************************)
@@ -205,20 +210,20 @@ lemma at_le_ex: ∀j2,i2,f. @❪i2,f❫ ≘ j2 → ∀i1. i1 ≤ i2 →
 [ elim (at_inv_xxn … Hf) -Hf [1,3: * |*: // ]
   #g [ #x2 ] #Hg [ #H2 ] #H0
   [ * /3 width=3 by at_refl, ex2_intro/
-    #i1 #Hi12 destruct lapply (le_S_S_to_le … Hi12) -Hi12
+    #i1 #Hi12 destruct lapply (ple_inv_succ_bi … Hi12) -Hi12
     #Hi12 elim (IH … Hg … Hi12) -x2 -IH
-    /3 width=7 by at_push, ex2_intro, le_S_S/
+    /3 width=7 by at_push, ex2_intro, ple_succ_bi/
   | #i1 #Hi12 elim (IH … Hg … Hi12) -IH -i2
-    /3 width=5 by at_next, ex2_intro, le_S_S/
+    /3 width=5 by at_next, ex2_intro, ple_succ_bi/
   ]
 | elim (at_inv_xxp … Hf) -Hf //
-  #g * -i2 #H2 #i1 #Hi12 <(le_n_O_to_eq … Hi12)
+  #g * -i2 #H2 #i1 #Hi12 <(ple_inv_unit_dx … Hi12)
   /3 width=3 by at_refl, ex2_intro/
 ]
 qed-.
 
 lemma at_id_le: ∀i1,i2. i1 ≤ i2 → ∀f. @❪i2,f❫ ≘ i2 → @❪i1,f❫ ≘ i1.
-#i1 #i2 #H @(le_elim … H) -i1 -i2 [ #i2 | #i1 #i2 #IH ]
+#i1 #i2 #H @(ple_ind_alt … H) -i1 -i2 [ #i2 | #i1 #i2 #_ #IH ]
 #f #Hf elim (at_fwd_id_ex … Hf) /4 width=7 by at_inv_npn, at_push, at_refl/
 qed-.
 
@@ -228,14 +233,14 @@ theorem at_monotonic: ∀j2,i2,f. @❪i2,f❫ ≘ j2 → ∀j1,i1. @❪i1,f❫ 
                       i1 < i2 → j1 < j2.
 #j2 elim j2 -j2
 [ #i2 #f #H2f elim (at_inv_xxp … H2f) -H2f //
-  #g #H21 #_ #j1 #i1 #_ #Hi elim (lt_le_false … Hi) -Hi //
+  #g #H21 #_ #j1 #i1 #_ #Hi elim (plt_ge_false … Hi) -Hi //
 | #j2 #IH #i2 #f #H2f * //
-  #j1 #i1 #H1f #Hi elim (lt_inv_gen … Hi)
-  #x2 #_ #H21 elim (at_inv_nxn … H2f … H21) -H2f [1,3: * |*: // ]
+  #j1 #i1 #H1f #Hi elim (plt_inv_gen … Hi)
+  #_ #Hi2 elim (at_inv_nxn … H2f (↓i2)) -H2f [1,3: * |*: // ]
   #g #H2g #H
   [ elim (at_inv_xpn … H1f … H) -f
-    /4 width=8 by lt_S_S_to_lt, lt_S_S/
-  | /4 width=8 by at_inv_xnn, lt_S_S/
+    /4 width=8 by plt_inv_succ_bi, plt_succ_bi/
+  | /4 width=8 by at_inv_xnn, plt_succ_bi/
   ]
 ]
 qed-.
@@ -244,17 +249,17 @@ theorem at_inv_monotonic: ∀j1,i1,f. @❪i1,f❫ ≘ j1 → ∀j2,i2. @❪i2,f
                           j1 < j2 → i1 < i2.
 #j1 elim j1 -j1
 [ #i1 #f #H1f elim (at_inv_xxp … H1f) -H1f //
-  #g * -i1 #H #j2 #i2 #H2f #Hj elim (lt_inv_O1 … Hj) -Hj
-  #x2 #H22 elim (at_inv_xpn … H2f … H H22) -f //
+  #g * -i1 #H #j2 #i2 #H2f #Hj lapply (plt_des_gen … Hj) -Hj
+  #H22 elim (at_inv_xpn … H2f … (↓j2) H) -f //
 | #j1 #IH *
   [ #f #H1f elim (at_inv_pxn … H1f) -H1f [ |*: // ]
-    #g #H1g #H #j2 #i2 #H2f #Hj elim (lt_inv_S1 … Hj) -Hj
+    #g #H1g #H #j2 #i2 #H2f #Hj elim (plt_inv_succ_sn … Hj) -Hj
     /3 width=7 by at_inv_xnn/
-  | #i1 #f #H1f #j2 #i2 #H2f #Hj elim (lt_inv_S1 … Hj) -Hj
-    #y2 #Hj #H22 elim (at_inv_nxn … H1f) -H1f [1,4: * |*: // ]
+  | #i1 #f #H1f #j2 #i2 #H2f #Hj elim (plt_inv_succ_sn … Hj) -Hj
+    #Hj #H22 elim (at_inv_nxn … H1f) -H1f [1,4: * |*: // ]
     #g #Hg #H
-    [ elim (at_inv_xpn … H2f … H H22) -f -H22
-      /3 width=7 by lt_S_S/
+    [ elim (at_inv_xpn … H2f … (↓j2) H) -f
+      /3 width=7 by plt_succ_bi/
     | /3 width=7 by at_inv_xnn/
     ]
   ]
@@ -262,13 +267,13 @@ theorem at_inv_monotonic: ∀j1,i1,f. @❪i1,f❫ ≘ j1 → ∀j2,i2. @❪i2,f
 qed-.
 
 theorem at_mono: ∀f,i,i1. @❪i,f❫ ≘ i1 → ∀i2. @❪i,f❫ ≘ i2 → i2 = i1.
-#f #i #i1 #H1 #i2 #H2 elim (lt_or_eq_or_gt i2 i1) //
-#Hi elim (lt_le_false i i) /3 width=6 by at_inv_monotonic, eq_sym/
+#f #i #i1 #H1 #i2 #H2 elim (pnat_split_lt_eq_gt i2 i1) //
+#Hi elim (plt_ge_false i i) /3 width=6 by at_inv_monotonic, eq_sym/
 qed-.
 
 theorem at_inj: ∀f,i1,i. @❪i1,f❫ ≘ i → ∀i2. @❪i2,f❫ ≘ i → i1 = i2.
-#f #i1 #i #H1 #i2 #H2 elim (lt_or_eq_or_gt i2 i1) //
-#Hi elim (lt_le_false i i) /3 width=6 by at_monotonic, eq_sym/
+#f #i1 #i #H1 #i2 #H2 elim (pnat_split_lt_eq_gt i2 i1) //
+#Hi elim (plt_ge_false i i) /2 width=6 by at_monotonic/
 qed-.
 
 theorem at_div_comm: ∀f2,g2,f1,g1.
@@ -312,17 +317,19 @@ theorem at_div_pn: ∀f2,g2,f1,g1.
 
 (* Properties on tls ********************************************************)
 
-lemma at_pxx_tls: ∀n,f. @❪0,f❫ ≘ n → @❪0,⫱*[n]f❫ ≘ 0.
-#n elim n -n //
+(* Note: this requires ↑ on first n *)
+lemma at_pxx_tls: ∀n,f. @❪𝟏,f❫ ≘ ↑n → @❪𝟏,⫱*[n]f❫ ≘ 𝟏.
+#n @(nat_ind_succ … n) -n //
 #n #IH #f #Hf
 cases (at_inv_pxn … Hf) -Hf [ |*: // ] #g #Hg #H0 destruct
 <tls_xn /2 width=1 by/
 qed.
 
-lemma at_tls: ∀i2,f. ⫯⫱*[↑i2]f ≡ ⫱*[i2]f → ∃i1. @❪i1,f❫ ≘ i2.
-#i2 elim i2 -i2
+(* Note: this requires ↑ on third n2 *)
+lemma at_tls: ∀n2,f. ⫯⫱*[↑n2]f ≡ ⫱*[n2]f → ∃i1. @❪i1,f❫ ≘ ↑n2.
+#n2 @(nat_ind_succ … n2) -n2
 [ /4 width=4 by at_eq_repl_back, at_refl, ex_intro/
-| #i2 #IH #f <tls_xn <tls_xn in ⊢ (??%→?); #H
+| #n2 #IH #f <tls_xn <tls_xn in ⊢ (??%→?); #H
   elim (IH … H) -IH -H #i1 #Hf
   elim (pn_split f) * #g #Hg destruct /3 width=8 by at_push, at_next, ex_intro/
 ]
@@ -330,8 +337,9 @@ qed-.
 
 (* Inversion lemmas with tls ************************************************)
 
-lemma at_inv_nxx: ∀n,g,i1,j2. @❪↑i1,g❫ ≘ j2 → @❪0,g❫ ≘ n →
-                  ∃∃i2. @❪i1,⫱*[↑n]g❫ ≘ i2 & ↑(n+i2) = j2.
+(* Note: this does not require ↑ on second and third p *)
+lemma at_inv_nxx: ∀p,g,i1,j2. @❪↑i1,g❫ ≘ j2 → @❪𝟏,g❫ ≘ p →
+                  ∃∃i2. @❪i1,⫱*[p]g❫ ≘ i2 & p+i2 = j2.
 #n elim n -n
 [ #g #i1 #j2 #Hg #H
   elim (at_inv_pxp … H) -H [ |*: // ] #f #H0
@@ -345,11 +353,12 @@ lemma at_inv_nxx: ∀n,g,i1,j2. @❪↑i1,g❫ ≘ j2 → @❪0,g❫ ≘ n →
 ]
 qed-.
 
-lemma at_inv_tls: ∀i2,i1,f. @❪i1,f❫ ≘ i2 → ⫯⫱*[↑i2]f ≡ ⫱*[i2]f.
-#i2 elim i2 -i2
+(* Note: this requires ↑ on first n2 *)
+lemma at_inv_tls: ∀n2,i1,f. @❪i1,f❫ ≘ ↑n2 → ⫯⫱*[↑n2]f ≡ ⫱*[n2]f.
+#n2 @(nat_ind_succ … n2) -n2
 [ #i1 #f #Hf elim (at_inv_xxp … Hf) -Hf // #g #H1 #H destruct
   /2 width=1 by eq_refl/
-| #i2 #IH #i1 #f #Hf
+| #n2 #IH #i1 #f #Hf
   elim (at_inv_xxn … Hf) -Hf [1,3: * |*: // ]
   [ #g #j1 #Hg #H1 #H2 | #g #Hg #Ho ] destruct
   <tls_xn /2 width=2 by/
@@ -371,7 +380,7 @@ lemma isid_inv_at_mono: ∀f,i1,i2. 𝐈❪f❫ → @❪i1,f❫ ≘ i2 → i1 =
 (* Advanced properties on isid **********************************************)
 
 corec lemma isid_at: ∀f. (∀i. @❪i,f❫ ≘ i) → 𝐈❪f❫.
-#f #Hf lapply (Hf 0)
+#f #Hf lapply (Hf (𝟏))
 #H cases (at_fwd_id_ex … H) -H
 #g #H @(isid_push … H) /3 width=7 by at_inv_npn/
 qed-.
@@ -399,14 +408,3 @@ qed-.
 
 theorem at_div_id_sn: ∀f. H_at_div 𝐈𝐝 f f 𝐈𝐝.
 /3 width=6 by at_div_id_dx, at_div_comm/ qed-.
-
-(* Properties with uniform relocations **************************************)
-
-lemma at_uni: ∀n,i. @❪i,𝐔❨n❩❫ ≘ n+i.
-#n elim n -n /2 width=5 by at_next/
-qed.
-
-(* Inversion lemmas with uniform relocations ********************************)
-
-lemma at_inv_uni: ∀n,i,j. @❪i,𝐔❨n❩❫ ≘ j → j = n+i.
-/2 width=4 by at_mono/ qed-.
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/rtmap_at_uni.ma b/matita/matita/contribs/lambdadelta/ground/relocation/rtmap_at_uni.ma
new file mode 100644 (file)
index 0000000..fed9d86
--- /dev/null
@@ -0,0 +1,30 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.tcs.unibo.it                            *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/arith/nat_rplus_succ.ma".
+include "ground/relocation/rtmap_uni.ma".
+include "ground/relocation/rtmap_at.ma".
+
+(* RELOCATION MAP ***********************************************************)
+
+(* Properties with uniform relocations **************************************)
+
+lemma at_uni: ∀n,i. @❪i,𝐔❨n❩❫ ≘ i+n.
+#n @(nat_ind_succ … n) -n /2 width=5 by at_next/
+qed.
+
+(* Inversion lemmas with uniform relocations ********************************)
+
+lemma at_inv_uni: ∀n,i,j. @❪i,𝐔❨n❩❫ ≘ j → j = i+n.
+/2 width=4 by at_mono/ qed-.
index 60ea38e24bcdcf01636d393ee7f8b09dbfe55875..f6671fa46e9d8ae78bd4f4e35e83550832ddc302 100644 (file)
@@ -13,7 +13,7 @@
 (**************************************************************************)
 
 include "ground/notation/functions/basic_2.ma".
-include "ground/relocation/rtmap_at.ma".
+include "ground/relocation/rtmap_uni.ma".
 
 (* RELOCATION MAP ***********************************************************)
 
@@ -22,25 +22,12 @@ definition basic: nat → nat → rtmap ≝ λm,n. ⫯*[m] 𝐔❨n❩.
 interpretation "basic relocation (rtmap)"
    'Basic m n = (basic m n).
 
-(* Prioerties with application **********************************************)
+(* Basic properties *********************************************************)
 
-lemma at_basic_lt: ∀m,n,i. i < m → @❪i, 𝐁❨m,n❩❫ ≘ i.
-#m elim m -m [ #n #i #H elim (lt_zero_false … H) ]
-#m #IH #n * [ /2 width=2 by refl, at_refl/ ]
-#i #H lapply (lt_S_S_to_lt … H) -H /3 width=7 by refl, at_push/
+lemma at_basic_succ_sn (m) (n): ⫯𝐁❨m,n❩ = 𝐁❨↑m,n❩.
+#m #n >pushs_S //
 qed.
 
-lemma at_basic_ge: ∀m,n,i. m ≤ i → @❪i, 𝐁❨m,n❩❫ ≘ n+i.
-#m elim m -m //
-#m #IH #n #j #H
-elim (le_inv_S1 … H) -H #i #Hmi #H destruct
-/3 width=7 by refl, at_push/
+lemma at_basic_zero_succ (n): ↑𝐁❨𝟎,n❩ = 𝐁❨𝟎,↑n❩.
+#n >nexts_S //
 qed.
-
-(* Inversion lemmas with application ****************************************)
-
-lemma at_basic_inv_lt: ∀m,n,i,j. i < m → @❪i, 𝐁❨m,n❩❫ ≘ j → i = j.
-/3 width=4 by at_basic_lt, at_mono/ qed-.
-
-lemma at_basic_inv_ge: ∀m,n,i,j. m ≤ i → @❪i, 𝐁❨m,n❩❫ ≘ j → n+i = j.
-/3 width=4 by at_basic_ge, at_mono/ qed-.
index 3bcde30924d58b3c7b563a61d1aad15681754aa4..792fa995d660583de99c41043499c052495000a2 100644 (file)
 (*                                                                        *)
 (**************************************************************************)
 
-include "ground/relocation/rtmap_after.ma".
+include "ground/arith/nat_le_pred.ma".
+include "ground/relocation/rtmap_after_uni.ma".
 include "ground/relocation/rtmap_basic.ma".
 
 (* RELOCATION MAP ***********************************************************)
 
 (* Properties with composition **********************************************)
 
-lemma after_basic_rc (m2,m1,n2,n1):
-                     m1 ≤ m2 → m2 ≤ m1+n1 → 𝐁❨m2,n2❩ ⊚ 𝐁❨m1,n1❩ ≘ 𝐁❨m1,n2+n1❩.
-#m2 elim m2 -m2
-[ #m1 #n2 #n1 #Hm21 #_
-  <(le_n_O_to_eq … Hm21) -m1 //
-| #m2 #IH *
-  [ #n2 #n1 #_ < plus_O_n #H
-    elim (le_inv_S1 … H) -H #x #Hx #H destruct
-    <plus_n_Sm
-    @after_push [4:|*: // ]
-    @(IH 0 … Hx) -IH -n2 -x //
-  | #m1 #n2 #n1 #H1 #H2
-    lapply (le_S_S_to_le … H1) -H1 #H1
-    lapply (le_S_S_to_le … H2) -H2 #H2
-    /3 width=7 by after_refl/
-  ]
+lemma after_basic_rc (m2,m1):
+      m1 ≤ m2 → ∀n2,n1.m2 ≤ n1+m1 → 𝐁❨m2,n2❩ ⊚ 𝐁❨m1,n1❩ ≘ 𝐁❨m1,n1+n2❩.
+#m2 #m1 @(nat_ind_2_succ … m2 m1) -m2 -m1
+[ #m1 #H #n2 #n1 #_
+  <(nle_inv_zero_dx … H) -m1 //
+| #m2 #IH #_ #n2 #n1 <nplus_zero_dx #H
+  elim (nle_inv_succ_sn … H) -H #Hm2 #Hn1
+  >Hn1 -Hn1 <nplus_succ_sn
+  /3 width=7 by after_push/
+| #m2 #m1 #IH #H1 #n2 #n1 <nplus_succ_dx #H2
+  lapply (nle_inv_succ_bi … H1) -H1 #H1
+  lapply (nle_inv_succ_bi … H2) -H2 #H2
+  /3 width=7 by after_refl/
 ]
 qed.
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/rtmap_basic_at.ma b/matita/matita/contribs/lambdadelta/ground/relocation/rtmap_basic_at.ma
new file mode 100644 (file)
index 0000000..00e2509
--- /dev/null
@@ -0,0 +1,42 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/arith/nat_plus_rplus.ma".
+include "ground/relocation/rtmap_basic_nat.ma".
+
+(* RELOCATION MAP ***********************************************************)
+
+(* Prioerties with application **********************************************)
+
+lemma at_basic_lt (m) (n) (i):
+      ninj i ≤ m → @❪i, 𝐁❨m,n❩❫ ≘ i.
+#m #n #i >(npsucc_pred i) #Hmi
+/2 width=1 by rm_nat_basic_lt/
+qed.
+
+lemma at_basic_ge (m) (n) (i):
+      m < ninj i → @❪i, 𝐁❨m,n❩❫ ≘ i+n.
+#m #n #i >(npsucc_pred i) #Hmi <nrplus_npsucc_sn
+/3 width=1 by rm_nat_basic_ge, nlt_inv_succ_dx/
+qed.
+
+(* Inversion lemmas with application ****************************************)
+
+lemma at_basic_inv_lt (m) (n) (i) (j):
+      ninj i ≤ m → @❪i, 𝐁❨m,n❩❫ ≘ j → i = j.
+/3 width=4 by at_basic_lt, at_mono/ qed-.
+
+lemma at_basic_inv_ge (m) (n) (i) (j):
+      m < ninj i → @❪i, 𝐁❨m,n❩❫ ≘ j → i+n = j.
+/3 width=4 by at_basic_ge, at_mono/ qed-.
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/rtmap_basic_nat.ma b/matita/matita/contribs/lambdadelta/ground/relocation/rtmap_basic_nat.ma
new file mode 100644 (file)
index 0000000..bf61597
--- /dev/null
@@ -0,0 +1,51 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/relocation/rtmap_nat_uni.ma".
+include "ground/relocation/rtmap_basic.ma".
+
+(* RELOCATION MAP ***********************************************************)
+
+(* Prioerties with application **********************************************)
+
+lemma rm_nat_basic_lt (m) (n) (l):
+      l < m → @↑❪l, 𝐁❨m,n❩❫ ≘ l.
+#m @(nat_ind_succ … m) -m
+[ #n #i #H elim (nlt_inv_zero_dx … H)
+| #m #IH #n #l @(nat_ind_succ … l) -l
+  [ #_ /2 width=2 by refl, at_refl/
+  | #l #_ #H
+    lapply (nlt_inv_succ_bi … H) -H #Hlm
+    /3 width=7 by refl, at_push/
+  ]
+]
+qed.
+
+lemma rm_nat_basic_ge (m) (n) (l):
+      m ≤ l → @↑❪l, 𝐁❨m,n❩❫ ≘ l+n.
+#m @(nat_ind_succ … m) -m //
+#m #IH #n #l #H
+elim (nle_inv_succ_sn … H) -H #Hml #H >H -H
+/3 width=7 by rm_nat_push/
+qed.
+
+(* Inversion lemmas with application ****************************************)
+
+lemma rm_nat_basic_inv_lt (m) (n) (l) (k):
+      l < m → @↑❪l, 𝐁❨m,n❩❫ ≘ k → l = k.
+/3 width=4 by rm_nat_basic_lt, rm_nat_mono/ qed-.
+
+lemma rm_nat_basic_inv_ge (m) (n) (l) (k):
+      m ≤ l → @↑❪l, 𝐁❨m,n❩❫ ≘ k → l+n = k.
+/3 width=4 by rm_nat_basic_ge, rm_nat_mono/ qed-.
index e74866dac69eb1b77631eb88233dab2c52cdb9c2..aede6b3a31512f86a2e2afbf0adec99cd4e0bc1d 100644 (file)
@@ -14,6 +14,7 @@
 
 include "ground/notation/relations/rcoafter_3.ma".
 include "ground/relocation/rtmap_sor.ma".
+include "ground/relocation/rtmap_nat.ma".
 include "ground/relocation/rtmap_after.ma".
 
 (* RELOCATION MAP ***********************************************************)
@@ -238,21 +239,21 @@ lemma coafter_mono_eq: ∀f1,f2,f. f1 ~⊚ f2 ≘ f → ∀g1,g2,g. g1 ~⊚ g2 
 
 (* Forward lemmas with pushs ************************************************)
 
-lemma coafter_fwd_pushs: ∀j,i,g2,f1,g. g2 ~⊚ ⫯*[i]f1 ≘ g → @❪i, g2❫ ≘ j →
-                         ∃f. ⫯*[j] f = g.
-#j elim j -j
-[ #i #g2 #f1 #g #Hg #H
-  elim (at_inv_xxp … H) -H [|*: // ] #f2 #H1 #H2 destruct
-  /2 width=2 by ex_intro/
-| #j #IH * [| #i ] #g2 #f1 #g #Hg #H
-  [ elim (at_inv_pxn … H) -H [|*: // ] #f2 #Hij #H destruct
+lemma coafter_fwd_pushs: ∀k,l,g2,f1,g. g2 ~⊚ ⫯*[l]f1 ≘ g → @↑❪l, g2❫ ≘ k →
+                         ∃∃f. ⫱*[k]g2 ~⊚ f1 ≘ f & ⫯*[k] f = g.
+#k @(nat_ind_succ … k) -k
+[ #l #g2 #f1 #g #Hg #H
+  elim (rm_nat_inv_xxp … H) -H [|*: // ] #f2 #H1 #H2 destruct
+  /2 width=3 by ex2_intro/
+| #k #IH * [| #l ] #g2 #f1 #g #Hg #H
+  [ elim (rm_nat_inv_pxn … H) -H [|*: // ] #f2 #Hlk #H destruct
     elim (coafter_inv_nxx … Hg) -Hg [|*: // ] #f #Hf #H destruct
-    elim (IH … Hf Hij) -f1 -f2 -IH /2 width=2 by ex_intro/
-  | elim (at_inv_nxn … H) -H [1,4: * |*: // ] #f2 #Hij #H destruct
+    elim (IH … Hf Hlk) -IH -Hf -Hlk /2 width=3 by ex2_intro/
+  | elim (rm_nat_inv_nxn … H) -H [1,4: * |*: // ] #f2 #Hlk #H destruct
     [ elim (coafter_inv_ppx … Hg) -Hg [|*: // ] #f #Hf #H destruct
-      elim (IH … Hf Hij) -f1 -f2 -i /2 width=2 by ex_intro/
+      elim (IH … Hf Hlk) -IH -Hf -Hlk /2 width=3 by ex2_intro/
     | elim (coafter_inv_nxx … Hg) -Hg [|*: // ] #f #Hf #H destruct
-      elim (IH … Hf Hij) -f1 -f2 -i /2 width=2 by ex_intro/
+      elim (IH … Hf Hlk) -IH -Hf -Hlk /2 width=3 by ex2_intro/
     ]
   ]
 ]
@@ -278,14 +279,14 @@ qed-.
 
 (* Properties with iterated tail ********************************************)
 
-lemma coafter_tls: ∀j,i,f1,f2,f. @❪i, f1❫ ≘ j →
-                   f1 ~⊚ f2 ≘ f → ⫱*[j]f1 ~⊚ ⫱*[i]f2 ≘ ⫱*[j]f.
-#j elim j -j [ #i | #j #IH * [| #i ] ] #f1 #f2 #f #Hf1 #Hf
-[ elim (at_inv_xxp … Hf1) -Hf1 [ |*: // ] #g1 #Hg1 #H1 destruct //
-| elim (at_inv_pxn … Hf1) -Hf1 [ |*: // ] #g1 #Hg1 #H1
+lemma coafter_tls: ∀l2,l1,f1,f2,f. @↑❪l1, f1❫ ≘ l2 →
+                   f1 ~⊚ f2 ≘ f → ⫱*[l2]f1 ~⊚ ⫱*[l1]f2 ≘ ⫱*[l2]f.
+#l2 @(nat_ind_succ … l2) -l2 [ #l1 | #l2 #IH * [| #l1 ] ] #f1 #f2 #f #Hf1 #Hf
+[ elim (rm_nat_inv_xxp … Hf1) -Hf1 [ |*: // ] #g1 #Hg1 #H1 destruct //
+| elim (rm_nat_inv_pxn … Hf1) -Hf1 [ |*: // ] #g1 #Hg1 #H1
   elim (coafter_inv_nxx … Hf … H1) -Hf #g #Hg #H0 destruct
   lapply (IH … Hg1 Hg) -IH -Hg1 -Hg //
-| elim (at_inv_nxn … Hf1) -Hf1 [1,4: * |*: // ] #g1 #Hg1 #H1
+| elim (rm_nat_inv_xxn … Hf1) -Hf1 [1,3: * |*: // ] #g1 [ #k1 ] #Hg1 [ #H ] #H1
   [ elim (coafter_inv_pxx … Hf … H1) -Hf * #g2 #g #Hg #H2 #H0 destruct
     lapply (IH … Hg1 Hg) -IH -Hg1 -Hg #H //
   | elim (coafter_inv_nxx … Hf … H1) -Hf #g #Hg #H0 destruct
@@ -294,24 +295,25 @@ lemma coafter_tls: ∀j,i,f1,f2,f. @❪i, f1❫ ≘ j →
 ]
 qed.
 
-lemma coafter_tls_O: ∀n,f1,f2,f. @❪0, f1❫ ≘ n →
-                     f1 ~⊚ f2 ≘ f → ⫱*[n]f1 ~⊚ f2 ≘ ⫱*[n]f.
+lemma coafter_tls_O: ∀k,f1,f2,f. @↑❪𝟎, f1❫ ≘ k →
+                     f1 ~⊚ f2 ≘ f → ⫱*[k]f1 ~⊚ f2 ≘ ⫱*[k]f.
 /2 width=1 by coafter_tls/ qed.
 
+(* Note: this does not require ↑ first and second j *)
 lemma coafter_tls_succ: ∀g2,g1,g. g2 ~⊚ g1 ≘ g →
-                        ∀n. @❪0, g2❫ ≘ n → ⫱*[↑n]g2 ~⊚ ⫱g1 ≘ ⫱*[↑n]g.
-#g2 #g1 #g #Hg #n #Hg2
+                        ∀j. @❪𝟏, g2❫ ≘ j → ⫱*[j]g2 ~⊚ ⫱g1 ≘ ⫱*[j]g.
+#g2 #g1 #g #Hg #j #Hg2
+lapply (rm_nat_pred_bi … Hg2) -Hg2 #Hg2
 lapply (coafter_tls … Hg2 … Hg) -Hg #Hg
 lapply (at_pxx_tls … Hg2) -Hg2 #H
 elim (at_inv_pxp … H) -H [ |*: // ] #f2 #H2
-elim (coafter_inv_pxx … Hg … H2) -Hg * #f1 #f #Hf #H1 #H0 destruct
-<tls_S <tls_S <H2 <H0 -g2 -g -n //
+elim (coafter_inv_pxx … Hg … H2) -Hg * #f1 #f #Hf #H1 #H0
+>(npsucc_pred j) <tls_S <tls_S //
 qed.
-
-lemma coafter_fwd_xpx_pushs: ∀g2,f1,g,i,j. @❪i, g2❫ ≘ j → g2 ~⊚ ⫯*[↑i]f1 ≘ g →
-                             ∃∃f.  ⫱*[↑j]g2 ~⊚ f1 ≘ f & ⫯*[↑j]f = g.
-#g2 #g1 #g #i #j #Hg2 <pushs_xn #Hg
-elim (coafter_fwd_pushs … Hg Hg2) #f #H0 destruct
+(*
+lemma coafter_fwd_xpx_pushs: ∀g2,f1,g,i,j. @❪i, g2❫ ≘ j → g2 ~⊚ ⫯*[i]⫯f1 ≘ g →
+                             ∃∃f.  ⫱*[↑j]g2 ~⊚ f1 ≘ f & ⫯*[j]⫯f = g.
+#g2 #g1 #g #i #j #Hg2 <pushs_xn #Hg(coafter_fwd_pushs … Hg Hg2) #f #H0 destruct
 lapply (coafter_tls … Hg2 Hg) -Hg <tls_pushs <tls_pushs #Hf
 lapply (at_inv_tls … Hg2) -Hg2 #H
 lapply (coafter_eq_repl_fwd2 … Hf … H) -H -Hf #Hf
@@ -329,7 +331,7 @@ lapply (coafter_eq_repl_fwd2 … Hf … H) -H -Hf #Hf
 elim (coafter_inv_pnx … Hf) [|*: // ] -Hf #g #Hg #H destruct
 /2 width=3 by ex2_intro/
 qed-.
-
+*)
 (* Properties with test for identity ****************************************)
 
 corec lemma coafter_isid_sn: ∀f1. 𝐈❪f1❫ → ∀f2. f1 ~⊚ f2 ≘ f2.
@@ -352,248 +354,25 @@ lemma coafter_isid_inv_sn: ∀f1,f2,f. f1 ~⊚ f2 ≘ f → 𝐈❪f1❫ → f2
 lemma coafter_isid_inv_dx: ∀f1,f2,f. f1 ~⊚ f2 ≘ f → 𝐈❪f2❫ → 𝐈❪f❫.
 /4 width=4 by eq_id_isid, coafter_isid_dx, coafter_mono/ qed-.
 
-(* Properties with test for uniform relocations *****************************)
-
-lemma coafter_isuni_isid: ∀f2. 𝐈❪f2❫ → ∀f1. 𝐔❪f1❫ → f1 ~⊚ f2 ≘ f2.
-#f #Hf #g #H elim H -g
-/3 width=5 by coafter_isid_sn, coafter_eq_repl_back0, coafter_next, eq_push_inv_isid/
-qed.
-
-
-(*
-lemma coafter_isid_isuni: ∀f1,f2. 𝐈❪f2❫ → 𝐔❪f1❫ → f1 ~⊚ ↑f2 ≘ ↑f1.
-#f1 #f2 #Hf2 #H elim H -H
-/5 width=7 by coafter_isid_dx, coafter_eq_repl_back2, coafter_next, coafter_push, eq_push_inv_isid/
-qed.
-
-lemma coafter_uni_next2: ∀f2. 𝐔❪f2❫ → ∀f1,f. ↑f2 ~⊚ f1 ≘ f → f2 ~⊚ ↑f1 ≘ f.
-#f2 #H elim H -f2
-[ #f2 #Hf2 #f1 #f #Hf
-  elim (coafter_inv_nxx … Hf) -Hf [2,3: // ] #g #Hg #H0 destruct
-  /4 width=7 by coafter_isid_inv_sn, coafter_isid_sn, coafter_eq_repl_back0, eq_next/
-| #f2 #_ #g2 #H2 #IH #f1 #f #Hf
-  elim (coafter_inv_nxx … Hf) -Hf [2,3: // ] #g #Hg #H0 destruct
-  /3 width=5 by coafter_next/
-]
-qed.
-*)
-
-(* Properties with uniform relocations **************************************)
-
-lemma coafter_uni_sn: ∀i,f. 𝐔❨i❩ ~⊚ f ≘ ⫯*[i] f.
-#i elim i -i /2 width=5 by coafter_isid_sn, coafter_next/
-qed.
-
-(*
-lemma coafter_uni: ∀n1,n2. 𝐔❨n1❩ ~⊚ 𝐔❨n2❩ ≘ 𝐔❨n1+n2❩.
-@nat_elim2
-/4 width=5 by coafter_uni_next2, coafter_isid_sn, coafter_isid_dx, coafter_next/
-qed.
-
-(* Forward lemmas on at *****************************************************)
-
-lemma coafter_at_fwd: ∀i,i1,f. @❪i1, f❫ ≘ i → ∀f2,f1. f2 ~⊚ f1 ≘ f →
-                      ∃∃i2. @❪i1, f1❫ ≘ i2 & @❪i2, f2❫ ≘ i.
-#i elim i -i [2: #i #IH ] #i1 #f #Hf #f2 #f1 #Hf21
-[ elim (at_inv_xxn … Hf) -Hf [1,3:* |*: // ]
-  [1: #g #j1 #Hg #H0 #H |2,4: #g #Hg #H ]
-| elim (at_inv_xxp … Hf) -Hf //
-  #g #H1 #H
-]
-[2: elim (coafter_inv_xxn … Hf21 … H) -f *
-    [ #g2 #g1 #Hg21 #H2 #H1 | #g2 #Hg21 #H2 ]
-|*: elim (coafter_inv_xxp … Hf21 … H) -f
-    #g2 #g1 #Hg21 #H2 #H1
-]
-[4: -Hg21 |*: elim (IH … Hg … Hg21) -g -IH ]
-/3 width=9 by at_refl, at_push, at_next, ex2_intro/
-qed-.
-
-lemma coafter_fwd_at: ∀i,i2,i1,f1,f2. @❪i1, f1❫ ≘ i2 → @❪i2, f2❫ ≘ i →
-                      ∀f. f2 ~⊚ f1 ≘ f → @❪i1, f❫ ≘ i.
-#i elim i -i [2: #i #IH ] #i2 #i1 #f1 #f2 #Hf1 #Hf2 #f #Hf
-[ elim (at_inv_xxn … Hf2) -Hf2 [1,3: * |*: // ]
-  #g2 [ #j2 ] #Hg2 [ #H22 ] #H20
-  [ elim (at_inv_xxn … Hf1 … H22) -i2 *
-    #g1 [ #j1 ] #Hg1 [ #H11 ] #H10
-    [ elim (coafter_inv_ppx … Hf … H20 H10) -f1 -f2 /3 width=7 by at_push/
-    | elim (coafter_inv_pnx … Hf … H20 H10) -f1 -f2 /3 width=6 by at_next/
-    ]
-  | elim (coafter_inv_nxx … Hf … H20) -f2 /3 width=7 by at_next/
-  ]
-| elim (at_inv_xxp … Hf2) -Hf2 // #g2 #H22 #H20
-  elim (at_inv_xxp … Hf1 … H22) -i2 #g1 #H11 #H10
-  elim (coafter_inv_ppx … Hf … H20 H10) -f1 -f2 /2 width=2 by at_refl/
-]
-qed-.
-
-lemma coafter_fwd_at2: ∀f,i1,i. @❪i1, f❫ ≘ i → ∀f1,i2. @❪i1, f1❫ ≘ i2 →
-                       ∀f2. f2 ~⊚ f1 ≘ f → @❪i2, f2❫ ≘ i.
-#f #i1 #i #Hf #f1 #i2 #Hf1 #f2 #H elim (coafter_at_fwd … Hf … H) -f
-#j1 #H #Hf2 <(at_mono … Hf1 … H) -i1 -i2 //
-qed-.
-
-lemma coafter_fwd_at1: ∀i,i2,i1,f,f2. @❪i1, f❫ ≘ i → @❪i2, f2❫ ≘ i →
-                       ∀f1. f2 ~⊚ f1 ≘ f → @❪i1, f1❫ ≘ i2.
-#i elim i -i [2: #i #IH ] #i2 #i1 #f #f2 #Hf #Hf2 #f1 #Hf1
-[ elim (at_inv_xxn … Hf) -Hf [1,3: * |*: // ]
-  #g [ #j1 ] #Hg [ #H01 ] #H00
-  elim (at_inv_xxn … Hf2) -Hf2 [1,3,5,7: * |*: // ]
-  #g2 [1,3: #j2 ] #Hg2 [1,2: #H22 ] #H20
-  [ elim (coafter_inv_pxp … Hf1 … H20 H00) -f2 -f /3 width=7 by at_push/
-  | elim (coafter_inv_pxn … Hf1 … H20 H00) -f2 -f /3 width=5 by at_next/
-  | elim (coafter_inv_nxp … Hf1 … H20 H00)
-  | /4 width=9 by coafter_inv_nxn, at_next/
-  ]
-| elim (at_inv_xxp … Hf) -Hf // #g #H01 #H00
-  elim (at_inv_xxp … Hf2) -Hf2 // #g2 #H21 #H20
-  elim (coafter_inv_pxp … Hf1 … H20 H00) -f2 -f /3 width=2 by at_refl/
-]
-qed-.
-
-(* Properties with at *******************************************************)
-
-lemma coafter_uni_dx: ∀i2,i1,f2. @❪i1, f2❫ ≘ i2 →
-                      ∀f. f2 ~⊚ 𝐔❨i1❩ ≘ f → 𝐔❨i2❩ ~⊚ ⫱*[i2] f2 ≘ f.
-#i2 elim i2 -i2
-[ #i1 #f2 #Hf2 #f #Hf
-  elim (at_inv_xxp … Hf2) -Hf2 // #g2 #H1 #H2 destruct
-  lapply (coafter_isid_inv_dx … Hf ?) -Hf
-  /3 width=3 by coafter_isid_sn, coafter_eq_repl_back0/
-| #i2 #IH #i1 #f2 #Hf2 #f #Hf
-  elim (at_inv_xxn … Hf2) -Hf2 [1,3: * |*: // ]
-  [ #g2 #j1 #Hg2 #H1 #H2 destruct
-    elim (coafter_inv_pnx … Hf) -Hf [ |*: // ] #g #Hg #H destruct
-    /3 width=5 by coafter_next/
-  | #g2 #Hg2 #H2 destruct
-    elim (coafter_inv_nxx … Hf) -Hf [2,3: // ] #g #Hg #H destruct
-    /3 width=5 by coafter_next/
-  ]
-]
-qed.
-
-lemma coafter_uni_sn: ∀i2,i1,f2. @❪i1, f2❫ ≘ i2 →
-                      ∀f. 𝐔❨i2❩ ~⊚ ⫱*[i2] f2 ≘ f → f2 ~⊚ 𝐔❨i1❩ ≘ f.
-#i2 elim i2 -i2
-[ #i1 #f2 #Hf2 #f #Hf
-  elim (at_inv_xxp … Hf2) -Hf2 // #g2 #H1 #H2 destruct
-  lapply (coafter_isid_inv_sn … Hf ?) -Hf
-  /3 width=3 by coafter_isid_dx, coafter_eq_repl_back0/
-| #i2 #IH #i1 #f2 #Hf2 #f #Hf
-  elim (coafter_inv_nxx … Hf) -Hf [2,3: // ] #g #Hg #H destruct
-  elim (at_inv_xxn … Hf2) -Hf2 [1,3: * |*: // ]
-  [ #g2 #j1 #Hg2 #H1 #H2 destruct /3 width=7 by coafter_push/
-  | #g2 #Hg2 #H2 destruct /3 width=5 by coafter_next/
-  ]
-]
-qed-.
-
-lemma coafter_uni_succ_dx: ∀i2,i1,f2. @❪i1, f2❫ ≘ i2 →
-                           ∀f. f2 ~⊚ 𝐔❨↑i1❩ ≘ f → 𝐔❨↑i2❩ ~⊚ ⫱*[↑i2] f2 ≘ f.
-#i2 elim i2 -i2
-[ #i1 #f2 #Hf2 #f #Hf
-  elim (at_inv_xxp … Hf2) -Hf2 // #g2 #H1 #H2 destruct
-  elim (coafter_inv_pnx … Hf) -Hf [ |*: // ] #g #Hg #H
-  lapply (coafter_isid_inv_dx … Hg ?) -Hg
-  /4 width=5 by coafter_isid_sn, coafter_eq_repl_back0, coafter_next/
-| #i2 #IH #i1 #f2 #Hf2 #f #Hf
-  elim (at_inv_xxn … Hf2) -Hf2 [1,3: * |*: // ]
-  [ #g2 #j1 #Hg2 #H1 #H2 destruct
-    elim (coafter_inv_pnx … Hf) -Hf [ |*: // ] #g #Hg #H destruct
-    /3 width=5 by coafter_next/
-  | #g2 #Hg2 #H2 destruct
-    elim (coafter_inv_nxx … Hf) -Hf [2,3: // ] #g #Hg #H destruct
-    /3 width=5 by coafter_next/
-  ]
-]
-qed.
-
-lemma coafter_uni_succ_sn: ∀i2,i1,f2. @❪i1, f2❫ ≘ i2 →
-                           ∀f. 𝐔❨↑i2❩ ~⊚ ⫱*[↑i2] f2 ≘ f → f2 ~⊚ 𝐔❨↑i1❩ ≘ f.
-#i2 elim i2 -i2
-[ #i1 #f2 #Hf2 #f #Hf
-  elim (at_inv_xxp … Hf2) -Hf2 // #g2 #H1 #H2 destruct
-  elim (coafter_inv_nxx … Hf) -Hf [ |*: // ] #g #Hg #H destruct
-  lapply (coafter_isid_inv_sn … Hg ?) -Hg
-  /4 width=7 by coafter_isid_dx, coafter_eq_repl_back0, coafter_push/
-| #i2 #IH #i1 #f2 #Hf2 #f #Hf
-  elim (coafter_inv_nxx … Hf) -Hf [2,3: // ] #g #Hg #H destruct
-  elim (at_inv_xxn … Hf2) -Hf2 [1,3: * |*: // ]
-  [ #g2 #j1 #Hg2 #H1 #H2 destruct <tls_xn in Hg; /3 width=7 by coafter_push/
-  | #g2 #Hg2 #H2 destruct <tls_xn in Hg; /3 width=5 by coafter_next/
-  ]
-]
-qed-.
-
-lemma coafter_uni_one_dx: ∀f2,f. ⫯f2 ~⊚ 𝐔❨↑O❩ ≘ f → 𝐔❨↑O❩ ~⊚ f2 ≘ f.
-#f2 #f #H @(coafter_uni_succ_dx … (⫯f2)) /2 width=3 by at_refl/
-qed.
-
-lemma coafter_uni_one_sn: ∀f1,f. 𝐔❨↑O❩ ~⊚ f1 ≘ f → ⫯f1 ~⊚ 𝐔❨↑O❩ ≘ f.
-/3 width=3 by coafter_uni_succ_sn, at_refl/ qed-.
-*)
 (* Forward lemmas with istot ************************************************)
-(*
-lemma coafter_istot_fwd: ∀f2,f1,f. f2 ~⊚ f1 ≘ f → 𝐓❪f2❫ → 𝐓❪f1❫ → 𝐓❪f❫.
-#f2 #f1 #f #Hf #Hf2 #Hf1 #i1 elim (Hf1 i1) -Hf1
-#i2 #Hf1 elim (Hf2 i2) -Hf2
-/3 width=7 by coafter_fwd_at, ex_intro/
-qed-.
-
-lemma coafter_fwd_istot_dx: ∀f2,f1,f. f2 ~⊚ f1 ≘ f → 𝐓❪f❫ → 𝐓❪f1❫.
-#f2 #f1 #f #H #Hf #i1 elim (Hf i1) -Hf
-#i2 #Hf elim (coafter_at_fwd … Hf … H) -f /2 width=2 by ex_intro/
-qed-.
 
-lemma coafter_fwd_istot_sn: ∀f2,f1,f. f2 ~⊚ f1 ≘ f → 𝐓❪f❫ → 𝐓❪f2❫.
-#f2 #f1 #f #H #Hf #i1 elim (Hf i1) -Hf
-#i #Hf elim (coafter_at_fwd … Hf … H) -f
-#i2 #Hf1 #Hf2 lapply (at_increasing … Hf1) -f1
-#Hi12 elim (at_le_ex … Hf2 … Hi12) -i2 /2 width=2 by ex_intro/
-qed-.
-
-lemma coafter_inv_istot: ∀f2,f1,f. f2 ~⊚ f1 ≘ f → 𝐓❪f❫ → 𝐓❪f2❫ ∧ 𝐓❪f1❫.
-/3 width=4 by coafter_fwd_istot_sn, coafter_fwd_istot_dx, conj/ qed-.
-
-lemma coafter_at1_fwd: ∀f1,i1,i2. @❪i1, f1❫ ≘ i2 → ∀f2. 𝐓❪f2❫ → ∀f. f2 ~⊚ f1 ≘ f →
-                     ∃∃i. @❪i2, f2❫ ≘ i & @❪i1, f❫ ≘ i.
-#f1 #i1 #i2 #Hf1 #f2 #Hf2 #f #Hf elim (Hf2 i2) -Hf2
-/3 width=8 by coafter_fwd_at, ex2_intro/
-qed-.
-
-lemma coafter_fwd_isid_sn: ∀f2,f1,f. 𝐓❪f❫ → f2 ~⊚ f1 ≘ f → f1 ≡ f → 𝐈❪f2❫.
-#f2 #f1 #f #H #Hf elim (coafter_inv_istot … Hf H) -H
-#Hf2 #Hf1 #H @isid_at_total // -Hf2
-#i2 #i #Hf2 elim (Hf1 i2) -Hf1
-#i0 #Hf1 lapply (at_increasing … Hf1)
-#Hi20 lapply (coafter_fwd_at2 … i0 … Hf1 … Hf) -Hf
-/3 width=7 by at_eq_repl_back, at_mono, at_id_le/
-qed-.
-
-lemma coafter_fwd_isid_dx: ∀f2,f1,f.  𝐓❪f❫ → f2 ~⊚ f1 ≘ f → f2 ≡ f → 𝐈❪f1❫.
-#f2 #f1 #f #H #Hf elim (coafter_inv_istot … Hf H) -H
-#Hf2 #Hf1 #H2 @isid_at_total // -Hf1
-#i1 #i2 #Hi12 elim (coafter_at1_fwd … Hi12 … Hf) -f1
-/3 width=8 by at_inj, at_eq_repl_back/
-qed-.
-*)
-corec fact coafter_inj_O_aux: ∀f1. @❪0, f1❫ ≘ 0 → H_coafter_inj f1.
+corec fact coafter_inj_O_aux: ∀f1. @❪𝟏, f1❫ ≘ 𝟏 → H_coafter_inj f1.
 #f1 #H1f1 #H2f1 #f #f21 #f22 #H1f #H2f
 cases (at_inv_pxp … H1f1) -H1f1 [ |*: // ] #g1 #H1
 lapply (istot_inv_push … H2f1 … H1) -H2f1 #H2g1
-cases (H2g1 0) #n #Hn
+cases (H2g1 (𝟏)) #n #Hn
 cases (coafter_inv_pxx … H1f … H1) -H1f * #g21 #g #H1g #H21 #H
 [ cases (coafter_inv_pxp … H2f … H1 H) -f1 -f #g22 #H2g #H22
   @(eq_push … H21 H22) -f21 -f22
 | cases (coafter_inv_pxn … H2f … H1 H) -f1 -f #g22 #H2g #H22
   @(eq_next … H21 H22) -f21 -f22
 ]
-@(coafter_inj_O_aux (⫱*[n]g1) … (⫱*[n]g)) -coafter_inj_O_aux
+@(coafter_inj_O_aux (⫱*[↓n]g1) … (⫱*[↓n]g)) -coafter_inj_O_aux
 /2 width=1 by coafter_tls, istot_tls, at_pxx_tls/
 qed-.
 
-fact coafter_inj_aux: (∀f1. @❪0, f1❫ ≘ 0 → H_coafter_inj f1) →
-                      ∀i2,f1. @❪0, f1❫ ≘ i2 → H_coafter_inj f1.
+fact coafter_inj_aux: (∀f1. @❪𝟏, f1❫ ≘ 𝟏 → H_coafter_inj f1) →
+                      ∀i2,f1. @❪𝟏, f1❫ ≘ i2 → H_coafter_inj f1.
 #H0 #i2 elim i2 -i2 /2 width=1 by/ -H0
 #i2 #IH #f1 #H1f1 #H2f1 #f #f21 #f22 #H1f #H2f
 elim (at_inv_pxn … H1f1) -H1f1 [ |*: // ] #g1 #H1g1 #H1
@@ -603,15 +382,15 @@ lapply (coafter_inv_nxp … H2f … H1 H) -f #H2g
 qed-.
 
 theorem coafter_inj: ∀f1. H_coafter_inj f1.
-#f1 #H cases (H 0) /3 width=7 by coafter_inj_aux, coafter_inj_O_aux/
+#f1 #H cases (H (𝟏)) /3 width=7 by coafter_inj_aux, coafter_inj_O_aux/
 qed-.
 
-corec fact coafter_fwd_isid2_O_aux: ∀f1. @❪0, f1❫ ≘ 0 →
+corec fact coafter_fwd_isid2_O_aux: ∀f1. @❪𝟏, f1❫ ≘ 𝟏 →
                                     H_coafter_fwd_isid2 f1.
 #f1 #H1f1 #f2 #f #H #H2f1 #Hf
 cases (at_inv_pxp … H1f1) -H1f1 [ |*: // ] #g1 #H1
 lapply (istot_inv_push … H2f1 … H1) -H2f1 #H2g1
-cases (H2g1 0) #n #Hn
+cases (H2g1 (𝟏)) #n #Hn
 cases (coafter_inv_pxx … H … H1) -H * #g2 #g #H #H2 #H0
 [ lapply (isid_inv_push … Hf … H0) -Hf #Hg
   @(isid_push … H2) -H2
@@ -620,8 +399,8 @@ cases (coafter_inv_pxx … H … H1) -H * #g2 #g #H #H2 #H0
 ]
 qed-.
 
-fact coafter_fwd_isid2_aux: (∀f1. @❪0, f1❫ ≘ 0 → H_coafter_fwd_isid2 f1) →
-                            ∀i2,f1. @❪0, f1❫ ≘ i2 → H_coafter_fwd_isid2 f1.
+fact coafter_fwd_isid2_aux: (∀f1. @❪𝟏, f1❫ ≘ 𝟏 → H_coafter_fwd_isid2 f1) →
+                            ∀i2,f1. @❪𝟏, f1❫ ≘ i2 → H_coafter_fwd_isid2 f1.
 #H0 #i2 elim i2 -i2 /2 width=1 by/ -H0
 #i2 #IH #f1 #H1f1 #f2 #f #H #H2f1 #Hf
 elim (at_inv_pxn … H1f1) -H1f1 [ |*: // ] #g1 #Hg1 #H1
@@ -630,11 +409,11 @@ elim (coafter_inv_nxx … H … H1) -H #g #Hg #H0
 qed-.
 
 lemma coafter_fwd_isid2: ∀f1. H_coafter_fwd_isid2 f1.
-#f1 #f2 #f #Hf #H cases (H 0)
+#f1 #f2 #f #Hf #H cases (H (𝟏))
 /3 width=7 by coafter_fwd_isid2_aux, coafter_fwd_isid2_O_aux/
 qed-.
 
-fact coafter_isfin2_fwd_O_aux: ∀f1. @❪0, f1❫ ≘ 0 →
+fact coafter_isfin2_fwd_O_aux: ∀f1. @❪𝟏, f1❫ ≘ 𝟏 →
                                H_coafter_isfin2_fwd f1.
 #f1 #Hf1 #f2 #H
 generalize in match Hf1; generalize in match f1; -f1
@@ -643,14 +422,14 @@ generalize in match Hf1; generalize in match f1; -f1
 #f2 #_ #IH #f1 #H #Hf1 #f #Hf
 elim (at_inv_pxp … H) -H [ |*: // ] #g1 #H1
 lapply (istot_inv_push … Hf1 … H1) -Hf1 #Hg1
-elim (Hg1 0) #n #Hn
+elim (Hg1 (𝟏)) #n #Hn
 [ elim (coafter_inv_ppx … Hf) | elim (coafter_inv_pnx … Hf)
 ] -Hf [1,6: |*: // ] #g #Hg #H0 destruct
 /5 width=6 by isfin_next, isfin_push, isfin_inv_tls, istot_tls, at_pxx_tls, coafter_tls_O/
 qed-.
 
-fact coafter_isfin2_fwd_aux: (∀f1. @❪0, f1❫ ≘ 0 → H_coafter_isfin2_fwd f1) →
-                             ∀i2,f1. @❪0, f1❫ ≘ i2 → H_coafter_isfin2_fwd f1.
+fact coafter_isfin2_fwd_aux: (∀f1. @❪𝟏, f1❫ ≘ 𝟏 → H_coafter_isfin2_fwd f1) →
+                             ∀i2,f1. @❪𝟏, f1❫ ≘ i2 → H_coafter_isfin2_fwd f1.
 #H0 #i2 elim i2 -i2 /2 width=1 by/ -H0
 #i2 #IH #f1 #H1f1 #f2 #Hf2 #H2f1 #f #Hf
 elim (at_inv_pxn … H1f1) -H1f1 [ |*: // ] #g1 #Hg1 #H1
@@ -660,7 +439,7 @@ lapply (IH … Hg1 … Hg) -i2 -Hg
 qed-.
 
 lemma coafter_isfin2_fwd: ∀f1. H_coafter_isfin2_fwd f1.
-#f1 #f2 #Hf2 #Hf1 cases (Hf1 0)
+#f1 #f2 #Hf2 #Hf1 cases (Hf1 (𝟏))
 /3 width=7 by coafter_isfin2_fwd_aux, coafter_isfin2_fwd_O_aux/
 qed-.
 
@@ -715,54 +494,3 @@ lemma coafter_sor: ∀f. 𝐅❪f❫ → ∀f2. 𝐓❪f2❫ → ∀f1. f2 ~⊚
   /3 width=11 by coafter_refl, coafter_push, sor_np, sor_pn, sor_nn, ex3_2_intro/
 ]
 qed-.
-
-(* Properties with after ****************************************************)
-(*
-corec theorem coafter_trans1: ∀f0,f3,f4. f0 ~⊚ f3 ≘ f4 →
-                            ∀f1,f2. f1 ~⊚ f2 ≘ f0 →
-                            ∀f. f2 ~⊚ f3 ≘ f → f1 ~⊚ f ≘ f4.
-#f0 #f3 #f4 * -f0 -f3 -f4 #f0 #f3 #f4 #g0 [1,2: #g3 ] #g4
-[ #Hf4 #H0 #H3 #H4 #g1 #g2 #Hg0 #g #Hg
-  cases (coafter_inv_xxp … Hg0 … H0) -g0
-  #f1 #f2 #Hf0 #H1 #H2
-  cases (coafter_inv_ppx … Hg … H2 H3) -g2 -g3
-  #f #Hf #H /3 width=7 by coafter_refl/
-| #Hf4 #H0 #H3 #H4 #g1 #g2 #Hg0 #g #Hg
-  cases (coafter_inv_xxp … Hg0 … H0) -g0
-  #f1 #f2 #Hf0 #H1 #H2
-  cases (coafter_inv_pnx … Hg … H2 H3) -g2 -g3
-  #f #Hf #H /3 width=7 by coafter_push/
-| #Hf4 #H0 #H4 #g1 #g2 #Hg0 #g #Hg
-  cases (coafter_inv_xxn … Hg0 … H0) -g0 *
-  [ #f1 #f2 #Hf0 #H1 #H2
-    cases (coafter_inv_nxx … Hg … H2) -g2
-    #f #Hf #H /3 width=7 by coafter_push/
-  | #f1 #Hf0 #H1 /3 width=6 by coafter_next/
-  ]
-]
-qed-.
-
-corec theorem coafter_trans2: ∀f1,f0,f4. f1 ~⊚ f0 ≘ f4 →
-                            ∀f2, f3. f2 ~⊚ f3 ≘ f0 →
-                            ∀f. f1 ~⊚ f2 ≘ f → f ~⊚ f3 ≘ f4.
-#f1 #f0 #f4 * -f1 -f0 -f4 #f1 #f0 #f4 #g1 [1,2: #g0 ] #g4
-[ #Hf4 #H1 #H0 #H4 #g2 #g3 #Hg0 #g #Hg
-  cases (coafter_inv_xxp … Hg0 … H0) -g0
-  #f2 #f3 #Hf0 #H2 #H3
-  cases (coafter_inv_ppx … Hg … H1 H2) -g1 -g2
-  #f #Hf #H /3 width=7 by coafter_refl/
-| #Hf4 #H1 #H0 #H4 #g2 #g3 #Hg0 #g #Hg
-  cases (coafter_inv_xxn … Hg0 … H0) -g0 *
-  [ #f2 #f3 #Hf0 #H2 #H3
-    cases (coafter_inv_ppx … Hg … H1 H2) -g1 -g2
-    #f #Hf #H /3 width=7 by coafter_push/
-  | #f2 #Hf0 #H2
-    cases (coafter_inv_pnx … Hg … H1 H2) -g1 -g2
-    #f #Hf #H /3 width=6 by coafter_next/
-  ]
-| #Hf4 #H1 #H4 #f2 #f3 #Hf0 #g #Hg
-  cases (coafter_inv_nxx … Hg … H1) -g1
-  #f #Hg #H /3 width=6 by coafter_next/
-]
-qed-.
-*)
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/rtmap_coafter_uni.ma b/matita/matita/contribs/lambdadelta/ground/relocation/rtmap_coafter_uni.ma
new file mode 100644 (file)
index 0000000..f9890a2
--- /dev/null
@@ -0,0 +1,32 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/relocation/rtmap_uni.ma".
+include "ground/relocation/rtmap_coafter.ma".
+
+(* RELOCATION MAP ***********************************************************)
+
+(* Properties with test for uniform relocations *****************************)
+
+lemma coafter_isuni_isid: ∀f2. 𝐈❪f2❫ → ∀f1. 𝐔❪f1❫ → f1 ~⊚ f2 ≘ f2.
+#f #Hf #g #H elim H -g
+/3 width=5 by coafter_isid_sn, coafter_eq_repl_back0, coafter_next, eq_push_inv_isid/
+qed.
+
+(* Properties with uniform relocations **************************************)
+
+lemma coafter_uni_sn: ∀n,f. 𝐔❨n❩ ~⊚ f ≘ ⫯*[n] f.
+#n @(nat_ind_succ … n) -n
+/2 width=5 by coafter_isid_sn, coafter_next/
+qed.
index 3474543c4983b8ba7abe485682c44e939e20f3c4..4b983a4f1f73bf79ca725d1e71bd8620d2c64ccb 100644 (file)
@@ -18,7 +18,7 @@ include "ground/relocation/rtmap_isid.ma".
 (* RELOCATION MAP ***********************************************************)
 
 inductive fcla: relation2 rtmap nat ≝
-| fcla_isid: ∀f. 𝐈❪f❫ → fcla f 0
+| fcla_isid: ∀f. 𝐈❪f❫ → fcla f (𝟎)
 | fcla_push: ∀f,n. fcla f n → fcla (⫯f) n
 | fcla_next: ∀f,n. fcla f n → fcla (↑f) (↑n)
 .
@@ -45,20 +45,20 @@ qed-.
 
 lemma cla_inv_nn: ∀g,m. 𝐂❪g❫ ≘ m → ∀f,n. ↑f = g → ↑n = m → 𝐂❪f❫ ≘ n.
 #g #m #H #f #n #H1 #H2 elim (fcla_inv_nx … H … H1) -g
-#x #Hf #H destruct //
+#x #Hf #H destruct <(eq_inv_nsucc_bi … H) -n //
 qed-.
 
-lemma cla_inv_np: ∀g,m. 𝐂❪g❫ ≘ m → ∀f. ↑f = g → 0 = m → ⊥.
+lemma cla_inv_np: ∀g,m. 𝐂❪g❫ ≘ m → ∀f. ↑f = g → 𝟎 = m → ⊥.
 #g #m #H #f #H1 elim (fcla_inv_nx … H … H1) -g
-#x #_ #H1 #H2 destruct
+#x #_ #H1 #H2 destruct /2 width=2 by eq_inv_zero_nsucc/
 qed-.
 
-lemma fcla_inv_xp: ∀g,m. 𝐂❪g❫ ≘ m → 0 = m → 𝐈❪g❫.
+lemma fcla_inv_xp: ∀g,m. 𝐂❪g❫ ≘ m → 𝟎 = m → 𝐈❪g❫.
 #g #m #H elim H -g -m /3 width=3 by isid_push/
-#g #m #_ #_ #H destruct
+#g #m #_ #_ #H destruct elim (eq_inv_zero_nsucc … H)
 qed-.
 
-lemma fcla_inv_isid: ∀f,n. 𝐂❪f❫ ≘ n → 𝐈❪f❫ → 0 = n.
+lemma fcla_inv_isid: ∀f,n. 𝐂❪f❫ ≘ n → 𝐈❪f❫ → 𝟎 = n.
 #f #n #H elim H -f -n /3 width=3 by isid_inv_push/
 #f #n #_ #_ #H elim (isid_inv_next … H) -H //
 qed-.
@@ -70,7 +70,7 @@ theorem fcla_mono: ∀f,n1. 𝐂❪f❫ ≘ n1 → ∀n2. 𝐂❪f❫ ≘ n2 →
 [ /2 width=3 by fcla_inv_isid/
 | /3 width=3 by fcla_inv_px/
 | #f #n1 #_ #IH #n2 #H elim (fcla_inv_nx … H) -H [2,3 : // ]
-  #g #Hf #H destruct /3 width=1 by eq_f/
+  #g #Hf #H destruct >IH //
 ]
 qed-.
 
index 6446254d008e4de599f540135df624892dace650..2ab5b383e79b09e9fbb328b0f19b11919e856a2a 100644 (file)
@@ -12,7 +12,7 @@
 (*                                                                        *)
 (**************************************************************************)
 
-include "ground/relocation/nstream_id.ma".
+include "ground/relocation/pstream_id.ma".
 include "ground/relocation/rtmap_isid.ma".
 
 (* RELOCATION MAP ***********************************************************)
index 1b6ce598e938e4991512b6b30ffdbca2f05527cb..fa421497a194bf9d174e342f71325bb55b59bab1 100644 (file)
@@ -79,13 +79,13 @@ qed-.
 (* Properties with iterated next ********************************************)
 
 lemma isdiv_nexts: ∀n,f. 𝛀❪f❫ → 𝛀❪↑*[n]f❫.
-#n elim n -n /3 width=3 by isdiv_next/
+#n @(nat_ind_succ … n) -n /3 width=3 by isdiv_next/
 qed.
 
 (* Inversion lemmas with iterated next **************************************)
 
 lemma isdiv_inv_nexts: ∀n,g. 𝛀❪↑*[n]g❫ → 𝛀❪g❫.
-#n elim n -n /3 width=3 by isdiv_inv_next/
+#n @(nat_ind_succ … n) -n /3 width=3 by isdiv_inv_next/
 qed.
 
 (* Properties with tail *****************************************************)
@@ -100,5 +100,5 @@ qed.
 (* Properties with iterated tail ********************************************)
 
 lemma isdiv_tls: ∀n,g. 𝛀❪g❫ → 𝛀❪⫱*[n]g❫.
-#n elim n -n /3 width=1 by isdiv_tl/
+#n @(nat_ind_succ … n) -n /3 width=1 by isdiv_tl/
 qed.
index 5439f36eebd06f2010c31c052482b6546ac9ba87..7da7f85ad0d313eb650dc5563878033ba14abe8d 100644 (file)
@@ -67,13 +67,13 @@ qed.
 (* Properties with iterated push ********************************************)
 
 lemma isfin_pushs: ∀n,f. 𝐅❪f❫ → 𝐅❪⫯*[n]f❫.
-#n elim n -n /3 width=3 by isfin_push/
+#n @(nat_ind_succ … n) -n /3 width=3 by isfin_push/
 qed.
 
 (* Inversion lemmas with iterated push **************************************)
 
 lemma isfin_inv_pushs: ∀n,g. 𝐅❪⫯*[n]g❫ → 𝐅❪g❫.
-#n elim n -n /3 width=3 by isfin_inv_push/
+#n @(nat_ind_succ … n) -n /3 width=3 by isfin_inv_push/
 qed.
 
 (* Properties with tail *****************************************************)
@@ -92,5 +92,5 @@ qed-.
 (* Inversion lemmas with iterated tail **************************************)
 
 lemma isfin_inv_tls: ∀n,f. 𝐅❪⫱*[n]f❫ → 𝐅❪f❫.
-#n elim n -n /3 width=1 by isfin_inv_tl/
+#n @(nat_ind_succ … n) -n /3 width=1 by isfin_inv_tl/
 qed-.
index e43b0bc086a97104f04a2a7c81b353b85b987055..f52700b3e86fb09d65ff27c073a04731785c899d 100644 (file)
@@ -78,13 +78,13 @@ qed-.
 (* Properties with iterated push ********************************************)
 
 lemma isid_pushs: ∀n,f. 𝐈❪f❫ → 𝐈❪⫯*[n]f❫.
-#n elim n -n /3 width=3 by isid_push/
+#n @(nat_ind_succ … n) -n /3 width=3 by isid_push/
 qed.
 
 (* Inversion lemmas with iterated push **************************************)
 
 lemma isid_inv_pushs: ∀n,g. 𝐈❪⫯*[n]g❫ → 𝐈❪g❫.
-#n elim n -n /3 width=3 by isid_inv_push/
+#n @(nat_ind_succ … n) -n /3 width=3 by isid_inv_push/
 qed.
 
 (* Properties with tail *****************************************************)
@@ -99,5 +99,5 @@ qed.
 (* Properties with iterated tail ********************************************)
 
 lemma isid_tls: ∀n,g. 𝐈❪g❫ → 𝐈❪⫱*[n]g❫.
-#n elim n -n /3 width=1 by isid_tl/
+#n @(nat_ind_succ … n) -n /3 width=1 by isid_tl/
 qed.
index 472a6694513156b8b992bcf93833e65bb1becfc5..f93936acf3c14af701f71d36e81d6e9e82c39fbe 100644 (file)
@@ -12,7 +12,7 @@
 (*                                                                        *)
 (**************************************************************************)
 
-include "ground/notation/relations/istotal_1.ma".
+include "ground/notation/relations/ist_1.ma".
 include "ground/relocation/rtmap_at.ma".
 
 (* RELOCATION MAP ***********************************************************)
@@ -20,7 +20,7 @@ include "ground/relocation/rtmap_at.ma".
 definition istot: predicate rtmap ≝ λf. ∀i. ∃j. @❪i,f❫ ≘ j.
 
 interpretation "test for totality (rtmap)"
-   'IsTotal f = (istot f).
+   'IsT f = (istot f).
 
 (* Basic inversion lemmas ***************************************************)
 
@@ -44,7 +44,9 @@ qed.
 (* Properties on tls ********************************************************)
 
 lemma istot_tls: ∀n,f. 𝐓❪f❫ → 𝐓❪⫱*[n]f❫.
-#n elim n -n /3 width=1 by istot_tl/
+#n @(nat_ind_succ … n) -n //
+#n #IH #f #Hf <tls_S
+/3 width=1 by istot_tl/
 qed.
 
 (* Main forward lemmas on at ************************************************)
@@ -57,14 +59,14 @@ corec theorem at_ext: ∀f1,f2. 𝐓❪f1❫ → 𝐓❪f2❫ →
 #Hf1 #Hf2 #Hi
 [ @(eq_push … H1 H2) @at_ext -at_ext /2 width=3 by istot_inv_push/ -Hf1 -Hf2
   #i #i1 #i2 #Hg1 #Hg2 lapply (Hi (↑i) (↑i1) (↑i2) ??) /2 width=7 by at_push/
-| cases (Hf2 0) -Hf1 -Hf2 -at_ext
+| cases (Hf2 (𝟏)) -Hf1 -Hf2 -at_ext
   #j2 #Hf2 cases (at_increasing_strict … Hf2 … H2) -H2
-  lapply (Hi 0 0 j2 … Hf2) /2 width=2 by at_refl/ -Hi -Hf2 -H1
-  #H2 #H cases (lt_le_false … H) -H //
-| cases (Hf1 0) -Hf1 -Hf2 -at_ext
+  lapply (Hi (𝟏) (𝟏) j2 … Hf2) /2 width=2 by at_refl/ -Hi -Hf2 -H1
+  #H2 #H cases (plt_ge_false … H) -H //
+| cases (Hf1 (𝟏)) -Hf1 -Hf2 -at_ext
   #j1 #Hf1 cases (at_increasing_strict … Hf1 … H1) -H1
-  lapply (Hi 0 j1 0 Hf1 ?) /2 width=2 by at_refl/ -Hi -Hf1 -H2
-  #H1 #H cases (lt_le_false … H) -H //
+  lapply (Hi (𝟏) j1 (𝟏) Hf1 ?) /2 width=2 by at_refl/ -Hi -Hf1 -H2
+  #H1 #H cases (plt_ge_false … H) -H //
 | @(eq_next … H1 H2) @at_ext -at_ext /2 width=3 by istot_inv_next/ -Hf1 -Hf2
   #i #i1 #i2 #Hg1 #Hg2 lapply (Hi i (↑i1) (↑i2) ??) /2 width=5 by at_next/
 ]
@@ -74,24 +76,20 @@ qed-.
 
 lemma at_dec: ∀f,i1,i2. 𝐓❪f❫ → Decidable (@❪i1,f❫ ≘ i2).
 #f #i1 #i2 #Hf lapply (Hf i1) -Hf *
-#j2 #Hf elim (eq_nat_dec i2 j2)
+#j2 #Hf elim (eq_pnat_dec i2 j2)
 [ #H destruct /2 width=1 by or_introl/
 | /4 width=6 by at_mono, or_intror/
 ]
 qed-.
 
-lemma is_at_dec_le: ∀f,i2,i. 𝐓❪f❫ → (∀i1. i1 + i ≤ i2 → @❪i1,f❫ ≘ i2 → ⊥) →
-                    Decidable (∃i1. @❪i1,f❫ ≘ i2).
-#f #i2 #i #Hf elim i -i
-[ #Ht @or_intror * /3 width=3 by at_increasing/
-| #i #IH #Ht elim (at_dec f (i2-i) i2) /3 width=2 by ex_intro, or_introl/
-  #Hi2 @IH -IH #i1 #H #Hi elim (le_to_or_lt_eq … H) -H /2 width=3 by/
-  #H destruct -Ht /2 width=1 by/
-]
-qed-.
-
 lemma is_at_dec: ∀f,i2. 𝐓❪f❫ → Decidable (∃i1. @❪i1,f❫ ≘ i2).
-#f #i2 #Hf @(is_at_dec_le ?? (↑i2)) /2 width=4 by lt_le_false/
+#f #i2 #Hf
+lapply (dec_plt (λi1.@❪i1,f❫ ≘ i2) … (↑i2)) [| * ]
+[ /2 width=1 by at_dec/
+| * /3 width=2 by ex_intro, or_introl/
+| #H @or_intror * #i1 #Hi12
+  /5 width=3 by at_increasing, plt_succ_dx, ex2_intro/
+]
 qed-.
 
 (* Advanced properties on isid **********************************************)
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/rtmap_nat.ma b/matita/matita/contribs/lambdadelta/ground/relocation/rtmap_nat.ma
new file mode 100644 (file)
index 0000000..b46b617
--- /dev/null
@@ -0,0 +1,247 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.tcs.unibo.it                            *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/notation/relations/ratsucc_3.ma".
+include "ground/arith/nat_lt_pred.ma".
+include "ground/relocation/rtmap_at.ma".
+
+(* NON-NEGATIVE APPLICATION FOR RELOCATION MAPS *****************************)
+
+definition rm_nat: relation3 rtmap nat nat ≝
+           λf,l1,l2. @❪↑l1,f❫ ≘ ↑l2.
+
+interpretation
+  "relational non-negative application (relocation maps)"
+  'RAtSucc l1 f l2 = (rm_nat f l1 l2).
+
+(* Basic properties *********************************************************)
+
+lemma rm_nat_refl (f) (g) (k1) (k2):
+      (⫯f) = g → 𝟎 = k1 → 𝟎 = k2 → @↑❪k1,g❫ ≘ k2.
+#f #g #k1 #k2 #H1 #H2 #H3 destruct
+/2 width=2 by at_refl/
+qed.
+
+lemma rm_nat_push (f) (l1) (l2) (g) (k1) (k2):
+      @↑❪l1,f❫ ≘ l2 → ⫯f = g → ↑l1 = k1 → ↑l2 = k2 → @↑❪k1,g❫ ≘ k2.
+#f #l1 #l2 #g #k1 #k2 #Hf #H1 #H2 #H3 destruct
+/2 width=7 by at_push/
+qed.
+
+lemma rm_nat_next (f) (l1) (l2) (g) (k2):
+      @↑❪l1,f❫ ≘ l2 → ↑f = g → ↑l2 = k2 → @↑❪l1,g❫ ≘ k2.
+#f #l1 #l2 #g #k2 #Hf #H1 #H2 destruct
+/2 width=5 by at_next/
+qed.
+
+lemma rm_nat_pred_bi (f) (i1) (i2):
+      @❪i1,f❫ ≘ i2 → @↑❪↓i1,f❫ ≘ ↓i2.
+#f #i1 #i2
+>(npsucc_pred i1) in ⊢ (%→?); >(npsucc_pred i2) in ⊢ (%→?);
+//
+qed.
+
+(* Basic inversion lemmas ***************************************************)
+
+lemma rm_nat_inv_ppx (f) (l1) (l2):
+      @↑❪l1,f❫ ≘ l2 → ∀g. 𝟎 = l1 → ⫯g = f → 𝟎 = l2.
+#f #l1 #l2 #H #g #H1 #H2 destruct
+lapply (at_inv_ppx … H ???) -H
+/2 width=2 by eq_inv_npsucc_bi/
+qed-.
+
+lemma rm_nat_inv_npx (f) (l1) (l2):
+      @↑❪l1,f❫ ≘ l2 → ∀g,k1. ↑k1 = l1 → ⫯g = f →
+      ∃∃k2. @↑❪k1,g❫ ≘ k2 & ↑k2 = l2.
+#f #l1 #l2 #H #g #k1 #H1 #H2 destruct
+elim (at_inv_npx … H) -H [|*: // ] #k2 #Hg
+>(npsucc_pred (↑l2)) #H
+@(ex2_intro … (↓k2)) //
+<pnpred_psucc //
+qed-.
+
+lemma rm_nat_inv_xnx (f) (l1) (l2):
+      @↑❪l1,f❫ ≘ l2 → ∀g. ↑g = f →
+      ∃∃k2. @↑❪l1,g❫ ≘ k2 & ↑k2 = l2.
+#f #l1 #l2 #H #g #H1 destruct
+elim (at_inv_xnx … H) -H [|*: // ] #k2
+>(npsucc_pred (k2)) in ⊢ (%→?→?); #Hg #H
+@(ex2_intro … (↓k2)) //
+<pnpred_psucc //
+qed-.
+
+(* Advanced inversion lemmas ************************************************)
+
+lemma rm_nat_inv_ppn (f) (l1) (l2):
+      @↑❪l1,f❫ ≘ l2 → ∀g,k2. 𝟎 = l1 → ⫯g = f → ↑k2 = l2 → ⊥.
+#f #l1 #l2 #Hf #g #k2 #H1 #H <(rm_nat_inv_ppx … Hf … H1 H) -f -g -l1 -l2
+/2 width=3 by eq_inv_nsucc_zero/
+qed-.
+
+lemma rm_nat_inv_npp (f) (l1) (l2):
+      @↑❪l1,f❫ ≘ l2 → ∀g,k1. ↑k1 = l1 → ⫯g = f → 𝟎 = l2 → ⊥.
+#f #l1 #l2 #Hf #g #k1 #H1 #H elim (rm_nat_inv_npx … Hf … H1 H) -f -l1
+#x2 #Hg * -l2 /2 width=3 by eq_inv_zero_nsucc/
+qed-.
+
+lemma rm_nat_inv_npn (f) (l1) (l2):
+      @↑❪l1,f❫ ≘ l2 → ∀g,k1,k2. ↑k1 = l1 → ⫯g = f → ↑k2 = l2 → @↑❪k1,g❫ ≘ k2.
+#f #l1 #l2 #Hf #g #k1 #k2 #H1 #H elim (rm_nat_inv_npx … Hf … H1 H) -f -l1
+#x2 #Hg * -l2 #H >(eq_inv_nsucc_bi … H) -k2 //
+qed-.
+
+lemma rm_nat_inv_xnp (f) (l1) (l2):
+      @↑❪l1,f❫ ≘ l2 → ∀g. ↑g = f → 𝟎 = l2 → ⊥.
+#f #l1 #l2 #Hf #g #H elim (rm_nat_inv_xnx … Hf … H) -f
+#x2 #Hg * -l2 /2 width=3 by eq_inv_zero_nsucc/
+qed-.
+
+lemma rm_nat_inv_xnn (f) (l1) (l2):
+      @↑❪l1,f❫ ≘ l2 → ∀g,k2. ↑g = f → ↑k2 = l2 → @↑❪l1,g❫ ≘ k2.
+#f #l1 #l2 #Hf #g #k2 #H elim (rm_nat_inv_xnx … Hf … H) -f
+#x2 #Hg * -l2 #H >(eq_inv_nsucc_bi … H) -k2 //
+qed-.
+
+lemma rm_nat_inv_pxp (f) (l1) (l2):
+      @↑❪l1,f❫ ≘ l2 → 𝟎 = l1 → 𝟎 = l2 → ∃g. ⫯g = f.
+#f elim (pn_split … f) * /2 width=2 by ex_intro/
+#g #H #l1 #l2 #Hf #H1 #H2 cases (rm_nat_inv_xnp … Hf … H H2)
+qed-.
+
+lemma rm_nat_inv_pxn (f) (l1) (l2):
+      @↑❪l1,f❫ ≘ l2 → ∀k2. 𝟎 = l1 → ↑k2 = l2 →
+      ∃∃g. @↑❪l1,g❫ ≘ k2 & ↑g = f.
+#f elim (pn_split … f) *
+#g #H #l1 #l2 #Hf #k2 #H1 #H2
+[ elim (rm_nat_inv_ppn … Hf … H1 H H2)
+| /3 width=5 by rm_nat_inv_xnn, ex2_intro/
+]
+qed-.
+
+lemma rm_nat_inv_nxp (f) (l1) (l2):
+      @↑❪l1,f❫ ≘ l2 → ∀k1. ↑k1 = l1 → 𝟎 = l2 → ⊥.
+#f elim (pn_split f) *
+#g #H #l1 #l2 #Hf #k1 #H1 #H2
+[ elim (rm_nat_inv_npp … Hf … H1 H H2)
+| elim (rm_nat_inv_xnp … Hf … H H2)
+]
+qed-.
+
+lemma rm_nat_inv_nxn (f) (l1) (l2):
+      @↑❪l1,f❫ ≘ l2 → ∀k1,k2. ↑k1 = l1 → ↑k2 = l2 →
+      ∨∨ ∃∃g. @↑❪k1,g❫ ≘ k2 & ⫯g = f
+       | ∃∃g. @↑❪l1,g❫ ≘ k2 & ↑g = f.
+#f elim (pn_split f) *
+/4 width=7 by rm_nat_inv_xnn, rm_nat_inv_npn, ex2_intro, or_intror, or_introl/
+qed-.
+
+(* Note: the following inversion lemmas must be checked *)
+lemma rm_nat_inv_xpx (f) (l1) (l2):
+      @↑❪l1,f❫ ≘ l2 → ∀g. ⫯g = f →
+      ∨∨ ∧∧ 𝟎 = l1 & 𝟎 = l2
+       | ∃∃k1,k2. @↑❪k1,g❫ ≘ k2 & ↑k1 = l1 & ↑k2 = l2.
+#f * [2: #l1 ] #l2 #Hf #g #H
+[ elim (rm_nat_inv_npx … Hf … H) -f /3 width=5 by or_intror, ex3_2_intro/
+| >(rm_nat_inv_ppx … Hf … H) -f /3 width=1 by conj, or_introl/
+]
+qed-.
+
+lemma rm_nat_inv_xpp (f) (l1) (l2):
+      @↑❪l1,f❫ ≘ l2 → ∀g. ⫯g = f → 𝟎 = l2 → 𝟎 = l1.
+#f #l1 #l2 #Hf #g #H elim (rm_nat_inv_xpx … Hf … H) -f * //
+#k1 #k2 #_ #_ * -l2 #H elim (eq_inv_zero_nsucc … H)
+qed-.
+
+lemma rm_nat_inv_xpn (f) (l1) (l2):
+      @↑❪l1,f❫ ≘ l2 → ∀g,k2. ⫯g = f → ↑k2 = l2 →
+      ∃∃k1. @↑❪k1,g❫ ≘ k2 & ↑k1 = l1.
+#f #l1 #l2 #Hf #g #k2 #H elim (rm_nat_inv_xpx … Hf … H) -f *
+[ #_ * -l2 #H elim (eq_inv_nsucc_zero … H)
+| #x1 #x2 #Hg #H1 * -l2 #H
+  lapply (eq_inv_nsucc_bi … H) -H #H destruct
+  /2 width=3 by ex2_intro/
+]
+qed-.
+
+lemma rm_nat_inv_xxp (f) (l1) (l2):
+      @↑❪l1,f❫ ≘ l2 → 𝟎 = l2 → ∃∃g. 𝟎 = l1 & ⫯g = f.
+#f elim (pn_split f) *
+#g #H #l1 #l2 #Hf #H2
+[ /3 width=6 by rm_nat_inv_xpp, ex2_intro/
+| elim (rm_nat_inv_xnp … Hf … H H2)
+]
+qed-.
+
+lemma rm_nat_inv_xxn (f) (l1) (l2): @↑❪l1,f❫ ≘ l2 → ∀k2.  ↑k2 = l2 →
+      ∨∨ ∃∃g,k1. @↑❪k1,g❫ ≘ k2 & ↑k1 = l1 & ⫯g = f
+       | ∃∃g. @↑❪l1,g❫ ≘ k2 & ↑g = f.
+#f elim (pn_split f) *
+#g #H #l1 #l2 #Hf #k2 #H2
+[ elim (rm_nat_inv_xpn … Hf … H H2) -l2 /3 width=5 by or_introl, ex3_2_intro/
+| lapply (rm_nat_inv_xnn … Hf … H H2) -l2 /3 width=3 by or_intror, ex2_intro/
+]
+qed-.
+
+(* Main destructions ********************************************************)
+
+theorem rm_nat_monotonic (k2) (l2) (f):
+        @↑❪l2,f❫ ≘ k2 → ∀k1,l1. @↑❪l1,f❫ ≘ k1 → l1 < l2 → k1 < k2.
+#k2 @(nat_ind_succ … k2) -k2
+[ #l2 #f #H2f elim (rm_nat_inv_xxp … H2f) -H2f //
+  #g #H21 #_ #k1 #l1 #_ #Hi destruct
+  elim (nlt_inv_zero_dx … Hi)
+| #k2 #IH #l2 #f #H2f #k1 @(nat_ind_succ … k1) -k1 //
+  #k1 #_ #l1 #H1f #Hl elim (nlt_inv_gen … Hl)
+  #_ #Hl2 elim (rm_nat_inv_nxn … H2f (↓l2)) -H2f [1,3: * |*: // ]
+  #g #H2g #H
+  [ elim (rm_nat_inv_xpn … H1f … H) -f
+    /4 width=8 by nlt_inv_succ_bi, nlt_succ_bi/
+  | /4 width=8 by rm_nat_inv_xnn, nlt_succ_bi/
+  ]
+]
+qed-.
+
+theorem rm_nat_inv_monotonic (k1) (l1) (f):
+        @↑❪l1,f❫ ≘ k1 → ∀k2,l2. @↑❪l2,f❫ ≘ k2 → k1 < k2 → l1 < l2.
+#k1 @(nat_ind_succ … k1) -k1
+[ #l1 #f #H1f elim (rm_nat_inv_xxp … H1f) -H1f //
+  #g * -l1 #H #k2 #l2 #H2f #Hk
+  lapply (nlt_des_gen … Hk) -Hk #H22
+  elim (rm_nat_inv_xpn … H2f … (↓k2) H) -f //
+| #k1 #IH #l1 @(nat_ind_succ … l1) -l1
+  [ #f #H1f elim (rm_nat_inv_pxn … H1f) -H1f [ |*: // ]
+    #g #H1g #H #k2 #l2 #H2f #Hj elim (nlt_inv_succ_sn … Hj) -Hj
+    /3 width=7 by rm_nat_inv_xnn/
+  | #l1 #_ #f #H1f #k2 #l2 #H2f #Hj elim (nlt_inv_succ_sn … Hj) -Hj
+    #Hj #H22 elim (rm_nat_inv_nxn … H1f) -H1f [1,4: * |*: // ]
+    #g #Hg #H
+    [ elim (rm_nat_inv_xpn … H2f … (↓k2) H) -f
+      /3 width=7 by nlt_succ_bi/
+    | /3 width=7 by rm_nat_inv_xnn/
+    ]
+  ]
+]
+qed-.
+
+theorem rm_nat_mono (f) (l) (l1) (l2):
+        @↑❪l,f❫ ≘ l1 → @↑❪l,f❫ ≘ l2 → l2 = l1.
+#f #l #l1 #l2 #H1 #H2 elim (nat_split_lt_eq_gt l2 l1) //
+#Hi elim (nlt_ge_false l l) /3 width=6 by rm_nat_inv_monotonic, eq_sym/
+qed-.
+
+theorem rm_nat_inj (f) (l1) (l2) (l):
+        @↑❪l1,f❫ ≘ l → @↑❪l2,f❫ ≘ l → l1 = l2.
+#f #l1 #l2 #l #H1 #H2 elim (nat_split_lt_eq_gt l2 l1) //
+#Hi elim (nlt_ge_false l l) /2 width=6 by rm_nat_monotonic/
+qed-.
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/rtmap_nat_uni.ma b/matita/matita/contribs/lambdadelta/ground/relocation/rtmap_nat_uni.ma
new file mode 100644 (file)
index 0000000..3faf3c9
--- /dev/null
@@ -0,0 +1,30 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.tcs.unibo.it                            *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "ground/arith/nat_plus.ma".
+include "ground/relocation/rtmap_uni.ma".
+include "ground/relocation/rtmap_nat.ma".
+
+(* NON-NEGATIVE APPLICATION FOR RELOCATION MAPS *****************************)
+
+(* Properties with uniform relocations **************************************)
+
+lemma rm_nat_uni (n) (l): @↑❪l,𝐔❨n❩❫ ≘ l+n.
+#n @(nat_ind_succ … n) -n /2 width=5 by rm_nat_next/
+qed.
+
+(* Inversion lemmas with uniform relocations ********************************)
+
+lemma rm_nat_inv_uni (n) (l) (k): @↑❪l,𝐔❨n❩❫ ≘ k → k = l+n.
+/2 width=4 by rm_nat_mono/ qed-.
index 08851ebe6670fcec05738458e018546574846858..128c26d6438b6b754ec79c8f109bd2ff891727b5 100644 (file)
 (**************************************************************************)
 
 include "ground/notation/functions/uparrowstar_2.ma".
+include "ground/arith/nat_succ_iter.ma".
 include "ground/relocation/rtmap_eq.ma".
 
 (* RELOCATION MAP ***********************************************************)
 
-rec definition nexts (f:rtmap) (n:nat) on n: rtmap ≝ match n with
-[ O ⇒ f | S m ⇒ ↑(nexts f m) ].
+definition nexts (f:rtmap) (n:nat) ≝ next^n f.
 
 interpretation "nexts (rtmap)" 'UpArrowStar n f = (nexts f n).
 
+(* Basic properties *********************************************************)
+
+lemma nexts_O: ∀f. f = ↑*[𝟎] f.
+// qed.
+
+lemma nexts_S: ∀f,n. ↑↑*[n] f = ↑*[↑n] f.
+#f #n @(niter_succ … next)
+qed.
+
+lemma nexts_eq_repl: ∀n. eq_repl (λf1,f2. ↑*[n] f1 ≡ ↑*[n] f2).
+#n @(nat_ind_succ … n) -n /3 width=5 by eq_next/
+qed.
+
+(* Advanced properties ******************************************************)
+
+lemma nexts_swap: ∀f,n. ↑↑*[n] f = ↑*[n] ↑f.
+#f #n @(niter_appl … next)
+qed.
+
+lemma nexts_xn: ∀n,f. ↑*[n] ↑f = ↑*[↑n] f.
+// qed.
+
 (* Basic_inversion lemmas *****************************************************)
 
 lemma eq_inv_nexts_sn: ∀n,f1,g2. ↑*[n] f1 ≡ g2 →
                        ∃∃f2. f1 ≡ f2 & ↑*[n] f2 = g2.
-#n elim n -n /2 width=3 by ex2_intro/
+#n @(nat_ind_succ … n) -n /2 width=3 by ex2_intro/
 #n #IH #f1 #g2 #H elim (eq_inv_nx … H) -H [|*: // ]
 #f0 #Hf10 #H1 elim (IH … Hf10) -IH -Hf10 #f2 #Hf12 #H2 destruct
 /2 width=3 by ex2_intro/
@@ -34,26 +56,8 @@ qed-.
 
 lemma eq_inv_nexts_dx: ∀n,f2,g1. g1 ≡ ↑*[n] f2 →
                        ∃∃f1. f1 ≡ f2 & ↑*[n] f1 = g1.
-#n elim n -n /2 width=3 by ex2_intro/
+#n @(nat_ind_succ … n) -n /2 width=3 by ex2_intro/
 #n #IH #f2 #g1 #H elim (eq_inv_xn … H) -H [|*: // ]
 #f0 #Hf02 #H1 elim (IH … Hf02) -IH -Hf02 #f1 #Hf12 #H2 destruct
 /2 width=3 by ex2_intro/
 qed-.
-
-(* Basic properties *********************************************************)
-
-lemma nexts_O: ∀f. f = ↑*[0] f.
-// qed.
-
-lemma nexts_S: ∀f,n. ↑↑*[n] f = ↑*[↑n] f.
-// qed.
-
-lemma nexts_eq_repl: ∀n. eq_repl (λf1,f2. ↑*[n] f1 ≡ ↑*[n] f2).
-#n elim n -n /3 width=5 by eq_next/
-qed.
-
-(* Advanced properties ******************************************************)
-
-lemma nexts_xn: ∀n,f. ↑*[n] ↑f = ↑*[↑n] f.
-#n elim n -n //
-qed.
index 420143933390124d7079b2ea639b54b7f59d22d4..5c43f1872fd2d38c283303613bcf03dc8271572c 100644 (file)
 (**************************************************************************)
 
 include "ground/notation/functions/upspoonstar_2.ma".
+include "ground/arith/nat_succ_iter.ma".
 include "ground/relocation/rtmap_eq.ma".
 
 (* RELOCATION MAP ***********************************************************)
 
-rec definition pushs (f:rtmap) (n:nat) on n: rtmap ≝ match n with
-[ O ⇒ f | S m ⇒ ⫯(pushs f m) ].
+definition pushs (f:rtmap) (n:nat) ≝ push^n f.
 
 interpretation "pushs (rtmap)" 'UpSpoonStar n f = (pushs f n).
 
+(* Basic properties *********************************************************)
+
+lemma pushs_O: ∀f. f = ⫯*[𝟎] f.
+// qed.
+
+lemma pushs_S: ∀f,n. ⫯⫯*[n] f = ⫯*[↑n] f.
+#f #n @(niter_succ … push)
+qed.
+
+lemma pushs_eq_repl: ∀n. eq_repl (λf1,f2. ⫯*[n] f1 ≡ ⫯*[n] f2).
+#n @(nat_ind_succ … n) -n /3 width=5 by eq_push/
+qed.
+
+(* Advanced properties ******************************************************)
+
+lemma push_swap (n) (f):  ⫯⫯*[n] f = ⫯*[n] ⫯f.
+#n #f @(niter_appl … push)
+qed.
+
+lemma pushs_xn: ∀n,f. ⫯*[n] ⫯f = ⫯*[↑n] f.
+// qed.
+
 (* Basic_inversion lemmas *****************************************************)
 
 lemma eq_inv_pushs_sn: ∀n,f1,g2. ⫯*[n] f1 ≡ g2 →
                        ∃∃f2. f1 ≡ f2 & ⫯*[n] f2 = g2.
-#n elim n -n /2 width=3 by ex2_intro/
+#n @(nat_ind_succ … n) -n /2 width=3 by ex2_intro/
 #n #IH #f1 #g2 #H elim (eq_inv_px … H) -H [|*: // ]
 #f0 #Hf10 #H1 elim (IH … Hf10) -IH -Hf10 #f2 #Hf12 #H2 destruct
 /2 width=3 by ex2_intro/
@@ -34,26 +56,8 @@ qed-.
 
 lemma eq_inv_pushs_dx: ∀n,f2,g1. g1 ≡ ⫯*[n] f2 →
                        ∃∃f1. f1 ≡ f2 & ⫯*[n] f1 = g1.
-#n elim n -n /2 width=3 by ex2_intro/
+#n @(nat_ind_succ … n) -n /2 width=3 by ex2_intro/
 #n #IH #f2 #g1 #H elim (eq_inv_xp … H) -H [|*: // ]
 #f0 #Hf02 #H1 elim (IH … Hf02) -IH -Hf02 #f1 #Hf12 #H2 destruct
 /2 width=3 by ex2_intro/
 qed-.
-
-(* Basic properties *********************************************************)
-
-lemma pushs_O: ∀f. f = ⫯*[0] f.
-// qed.
-
-lemma pushs_S: ∀f,n. ⫯⫯*[n] f = ⫯*[↑n] f.
-// qed.
-
-lemma pushs_eq_repl: ∀n. eq_repl (λf1,f2. ⫯*[n] f1 ≡ ⫯*[n] f2).
-#n elim n -n /3 width=5 by eq_push/
-qed.
-
-(* Advanced properties ******************************************************)
-
-lemma pushs_xn: ∀n,f. ⫯*[n] ⫯f = ⫯*[↑n] f.
-#n elim n -n //
-qed.
index edd9623545bea1b748892953600924cacbfe3056..002e6eac7ae61258e1ebfb375492c7dbcf936fc9 100644 (file)
@@ -111,10 +111,11 @@ corec theorem sle_trans: Transitive … sle.
 /3 width=5 by sle_push, sle_next, sle_weak/
 qed-.
 
-(* Properties with iteraded push ********************************************)
+(* Properties with iterated push ********************************************)
 
-lemma sle_pushs: ∀f1,f2. f1 ⊆ f2 → ∀i. ⫯*[i] f1 ⊆ ⫯*[i] f2.
-#f1 #f2 #Hf12 #i elim i -i /2 width=5 by sle_push/
+lemma sle_pushs: ∀f1,f2. f1 ⊆ f2 → ∀n. ⫯*[n] f1 ⊆ ⫯*[n] f2.
+#f1 #f2 #Hf12 #n @(nat_ind_succ … n) -n
+/2 width=5 by sle_push/
 qed.
 
 (* Properties with tail *****************************************************)
@@ -148,8 +149,9 @@ qed-.
 
 (* Properties with iteraded tail ********************************************)
 
-lemma sle_tls: ∀f1,f2. f1 ⊆ f2 → ∀i. ⫱*[i] f1 ⊆ ⫱*[i] f2.
-#f1 #f2 #Hf12 #i elim i -i /2 width=5 by sle_tl/
+lemma sle_tls: ∀f1,f2. f1 ⊆ f2 → ∀n. ⫱*[n] f1 ⊆ ⫱*[n] f2.
+#f1 #f2 #Hf12 #n @(nat_ind_succ … n) -n
+/2 width=5 by sle_tl/
 qed.
 
 (* Properties with isid *****************************************************)
index 0b3f0ddaa59d345586212b12658283e426aff7f2..bcc7055219a858e6c0b5cf6364fe3874744a47a7 100644 (file)
 (*                                                                        *)
 (**************************************************************************)
 
+include "ground/xoa/or_3.ma".
+include "ground/xoa/ex_3_1.ma".
 include "ground/xoa/ex_4_2.ma".
 include "ground/notation/relations/runion_3.ma".
+include "ground/arith/nat_plus.ma".
+include "ground/arith/nat_le_max.ma".
 include "ground/relocation/rtmap_isfin.ma".
 include "ground/relocation/rtmap_sle.ma".
 
@@ -305,7 +309,8 @@ qed-.
 
 lemma sor_tls: ∀f1,f2,f. f1 ⋓ f2 ≘ f →
                ∀n. ⫱*[n]f1 ⋓ ⫱*[n]f2 ≘ ⫱*[n]f.
-#f1 #f2 #f #Hf #n elim n -n /2 width=1 by sor_tl/
+#f1 #f2 #f #Hf #n @(nat_ind_succ … n) -n
+/2 width=1 by sor_tl/
 qed.
 
 (* Properies with test for identity *****************************************)
@@ -370,11 +375,11 @@ lemma sor_fcla_ex: ∀f1,n1. 𝐂❪f1❫ ≘ n1 → ∀f2,n2. 𝐂❪f2❫ ≘
                    ∃∃f,n. f1 ⋓ f2 ≘ f & 𝐂❪f❫ ≘ n & (n1 ∨ n2) ≤ n & n ≤ n1 + n2.
 #f1 #n1 #Hf1 elim Hf1 -f1 -n1 /3 width=6 by sor_isid_sn, ex4_2_intro/
 #f1 #n1 #Hf1 #IH #f2 #n2 * -f2 -n2 /3 width=6 by fcla_push, fcla_next, ex4_2_intro, sor_isid_dx/
-#f2 #n2 #Hf2 elim (IH … Hf2) -IH -Hf2 -Hf1 [2,4: #f #n <plus_n_Sm ] (**) (* full auto fails *)
-[ /3 width=7 by fcla_next, sor_pn, max_S2_le_S, le_S_S, ex4_2_intro/
-| /4 width=7 by fcla_next, sor_nn, le_S, le_S_S, ex4_2_intro/
+#f2 #n2 #Hf2 elim (IH … Hf2) -IH -Hf2 -Hf1 [2,4: #f #n <nplus_succ_dx ] (**) (* full auto fails *)
+[ /3 width=7 by fcla_next, sor_pn, nle_max_sn_succ_dx, nle_succ_bi, ex4_2_intro/
+| /4 width=7 by fcla_next, sor_nn, nle_succ_dx, nle_succ_bi, ex4_2_intro/
 | /3 width=7 by fcla_push, sor_pp, ex4_2_intro/
-| /3 width=7 by fcla_next, sor_np, max_S1_le_S, le_S_S, ex4_2_intro/
+| /3 width=7 by fcla_next, sor_np, nle_max_sn_succ_sn, nle_succ_bi, ex4_2_intro/
 ]
 qed-.
 
@@ -395,7 +400,7 @@ lemma sor_fwd_fcla_sn_ex: ∀f,n. 𝐂❪f❫ ≘ n → ∀f1,f2. f1 ⋓ f2 ≘
   elim (IH … Hf) -f /3 width=3 by fcla_push, ex2_intro/
 | #f #n #_ #IH #f1 #f2 #H
   elim (sor_inv_xxn … H) -H [1,3,4: * |*: // ] #g1 #g2 #Hf #H1 #H2 destruct
-  elim (IH … Hf) -f /3 width=3 by fcla_push, fcla_next, le_S_S, le_S, ex2_intro/
+  elim (IH … Hf) -f /3 width=3 by fcla_push, fcla_next, nle_succ_bi, nle_succ_dx, ex2_intro/
 ]
 qed-.
 
index d4cb4d21644a23794e4f7251fd7ff4963f39ea35..e6aea52db0cc50c753bccc5e29162c05b9a9dce3 100644 (file)
@@ -18,32 +18,35 @@ include "ground/relocation/rtmap_tl.ma".
 
 (* RELOCATION MAP ***********************************************************)
 
-rec definition tls (f:rtmap) (n:nat) on n: rtmap ≝ match n with
-[ O ⇒ f | S m ⇒ ⫱(tls f m) ].
+definition tls (f:rtmap) (n:nat) ≝ tl^n f.
 
 interpretation "tls (rtmap)" 'DropPreds n f = (tls f n).
 
 (* Basic properties *********************************************************)
 
-lemma tls_O: ∀f. f = ⫱*[0] f.
+lemma tls_O: ∀f. f = ⫱*[𝟎] f.
 // qed.
 
 lemma tls_S: ∀f,n. ⫱ ⫱*[n] f = ⫱*[↑n] f.
-// qed.
+#f #n @(niter_succ … tl)
+qed.
 
 lemma tls_eq_repl: ∀n. eq_repl (λf1,f2. ⫱*[n] f1 ≡ ⫱*[n] f2).
-#n elim n -n /3 width=1 by tl_eq_repl/
+#n @(nat_ind_succ … n) -n /3 width=1 by tl_eq_repl/
 qed.
 
 (* Advanced properties ******************************************************)
 
-lemma tls_xn: ∀n,f. ⫱*[n] ⫱f = ⫱*[↑n] f.
-#n elim n -n //
+lemma tls_swap (n) (f): ⫱ ⫱*[n] f = ⫱*[n] ⫱f.
+#f #n @(niter_appl … tl)
 qed.
 
+lemma tls_xn: ∀n,f. ⫱*[n] ⫱f = ⫱*[↑n] f.
+// qed.
+
 (* Properties with pushs ****************************************************)
 
 lemma tls_pushs: ∀n,f. f = ⫱*[n] ⫯*[n] f.
-#n elim n -n //
-#n #IH #f <tls_xn //
+#n @(nat_ind_succ … n) -n //
+#n #IH #f <tls_xn <pushs_S <tl_push_rew //
 qed.
index 3195a8332a29091e1ce82ab66884e0507a141d23..4eb1e17b4963ed55727fd55b267b03aa5804cd25 100644 (file)
 (**************************************************************************)
 
 include "ground/notation/functions/uniform_1.ma".
+include "ground/relocation/rtmap_nexts.ma".
 include "ground/relocation/rtmap_id.ma".
 include "ground/relocation/rtmap_isuni.ma".
 
 (* RELOCATION MAP ***********************************************************)
 
-rec definition uni (n:nat) on n: rtmap  ≝ match n with
-[ O   ⇒ 𝐈𝐝
-| S n ⇒ ↑(uni n)
-].
+definition uni (n) ≝ ↑*[n] 𝐈𝐝.
 
 interpretation "uniform relocation (rtmap)"
    'Uniform n = (uni n).
 
 (* Basic properties *********************************************************)
 
-lemma uni_zero: 𝐈𝐝 = 𝐔❨0❩.
+lemma uni_zero: 𝐈𝐝 = 𝐔❨𝟎❩.
 // qed.
 
 lemma uni_succ: ∀n. ↑𝐔❨n❩ = 𝐔❨↑n❩.
-// qed.
+/2 width=1 by nexts_S/ qed.
 
 (* Basic inversion lemmas ***************************************************)
 
-lemma uni_inv_push_dx: ∀f,n. 𝐔❨n❩ ≡ ⫯f → 0 = n ∧ 𝐈𝐝 ≡ f.
-#f * /3 width=5 by eq_inv_pp, conj/
-#n <uni_succ #H elim (eq_inv_np … H) -H //
+lemma uni_inv_push_dx: ∀f,n. 𝐔❨n❩ ≡ ⫯f → 𝟎 = n ∧ 𝐈𝐝 ≡ f.
+#f #n @(nat_ind_succ … n) -n
+[ /3 width=5 by eq_inv_pp, conj/
+| #n #_ <uni_succ #H elim (eq_inv_np … H) -H //
+]
 qed-.
 
-lemma uni_inv_push_sn: ∀f,n. ⫯f ≡ 𝐔❨n❩ → 0 = n ∧ 𝐈𝐝 ≡ f.
+lemma uni_inv_push_sn: ∀f,n. ⫯f ≡ 𝐔❨n❩ → 𝟎 = n ∧ 𝐈𝐝 ≡ f.
 /3 width=1 by uni_inv_push_dx, eq_sym/ qed-.
 
-lemma uni_inv_id_dx: ∀n. 𝐔❨n❩ ≡ 𝐈𝐝 → 0 = n.
+lemma uni_inv_id_dx: ∀n. 𝐔❨n❩ ≡ 𝐈𝐝 → 𝟎 = n.
 #n <id_rew #H elim (uni_inv_push_dx … H) -H //
 qed-.
 
-lemma uni_inv_id_sn: ∀n.  𝐈𝐝 ≡ 𝐔❨n❩ → 0 = n.
+lemma uni_inv_id_sn: ∀n.  𝐈𝐝 ≡ 𝐔❨n❩ → 𝟎 = n.
 /3 width=1 by uni_inv_id_dx, eq_sym/ qed-.
 
 lemma uni_inv_next_dx: ∀f,n. 𝐔❨n❩ ≡ ↑f → ∃∃m. 𝐔❨m❩ ≡ f & ↑m = n.
-#f *
+#f #n @(nat_ind_succ … n) -n
 [ <uni_zero <id_rew #H elim (eq_inv_pn … H) -H //
-| #n <uni_succ /3 width=5 by eq_inv_nn, ex2_intro/
+| #n #_ <uni_succ /3 width=5 by eq_inv_nn, ex2_intro/
 ]
 qed-.
 
@@ -63,18 +63,19 @@ lemma uni_inv_next_sn: ∀f,n. ↑f ≡ 𝐔❨n❩ → ∃∃m. 𝐔❨m❩ ≡
 
 (* Properties with test for identity ****************************************)
 
-lemma uni_isid: ∀f. 𝐈❪f❫ → 𝐔❨0❩ ≡ f.
+lemma uni_isid: ∀f. 𝐈❪f❫ → 𝐔❨𝟎❩ ≡ f.
 /2 width=1 by eq_id_inv_isid/ qed-.
 
 (* Inversion lemmas with test for identity **********************************)
 
-lemma uni_inv_isid: ∀f. 𝐔❨0❩ ≡ f → 𝐈❪f❫.
+lemma uni_inv_isid: ∀f. 𝐔❨𝟎❩ ≡ f → 𝐈❪f❫.
 /2 width=1 by eq_id_isid/ qed-.
 
 (* Properties with finite colength assignment ***************************)
 
 lemma fcla_uni: ∀n. 𝐂❪𝐔❨n❩❫ ≘ n.
-#n elim n -n /2 width=1 by fcla_isid, fcla_next/
+#n @(nat_ind_succ … n) -n
+/2 width=1 by fcla_isid, fcla_next/
 qed.
 
 (* Properties with test for finite colength ***************************)
@@ -85,7 +86,8 @@ lemma isfin_uni: ∀n. 𝐅❪𝐔❨n❩❫.
 (* Properties with test for uniformity **************************************)
 
 lemma isuni_uni: ∀n. 𝐔❪𝐔❨n❩❫.
-#n elim n -n /3 width=3 by isuni_isid, isuni_next/
+#n @(nat_ind_succ … n) -n
+/3 width=3 by isuni_isid, isuni_next/
 qed.
 
 lemma uni_isuni: ∀f. 𝐔❪f❫ → ∃n. 𝐔❨n❩ ≡ f.
@@ -96,6 +98,8 @@ qed-.
 (* Inversion lemmas with test for uniformity ********************************)
 
 lemma uni_inv_isuni: ∀n,f. 𝐔❨n❩ ≡ f →  𝐔❪f❫.
-#n elim n -n /3 width=1 by uni_inv_isid, isuni_isid/
-#n #IH #x <uni_succ #H elim (eq_inv_nx … H) -H /3 width=3 by isuni_next/
+#n @(nat_ind_succ … n) -n
+[ /3 width=1 by uni_inv_isid, isuni_isid/
+| #n #IH #x <uni_succ #H elim (eq_inv_nx … H) -H /3 width=3 by isuni_next/
+]
 qed-.
index f5fe3c956b44834b1c7f6e8b4b9d106a2382c254..54733490fd2067df6116a3bbf51f7b5eb6c08d12 100644 (file)
@@ -71,14 +71,18 @@ table {
           [ "nat_le ( ?≤? )" "nat_le_pred" "nat_le_plus" "nat_le_minus" "nat_le_minus_plus" "nat_le_max" * ]
           [ "nat_max ( ?∨? )" * ]
           [ "nat_minus ( ?-? )" "nat_minus_plus" * ]
-          [ "nat_plus ( ?+? )" "nat_plus_pred" * ]
+          [ "nat_plus ( ?+? )" "nat_plus_pred" "nat_plus_rplus" * ]
+          [ "nat_rplus ( ?+? )" "nat_rplus_succ" * ]
           [ "nat_pred ( ↓? )" "nat_pred_succ" * ]
           [ "nat_succ ( ↑? )" "nat_succ_iter" "nat_succ_tri" * ]
           [ "nat ( 𝟎 )" "nat_iter ( ?^{?}? )" *"nat_tri"  ]
         }
       ]
       [ { "positive integers" * } {
+          [ "nat_lt ( ?&lt;? )" "pnat_lt_pred" * ]
+          [ "pnat_le ( ?≤? )" "pnat_le_pred" "pnat_le_plus" * ]
           [ "pnat_plus ( ?+? )" * ]
+          [ "nat_pred ( ↓? )" * ]
           [ "pnat ( 𝟏 ) ( ↑? )" "pnat_dis" "pnat_iter ( ?^{?}? )" "pnat_tri" * ]
         }
       ]