]> matita.cs.unibo.it Git - helm.git/commitdiff
commit by user andrea
authormatitaweb <claudio.sacerdoticoen@unibo.it>
Tue, 8 Nov 2011 16:54:31 +0000 (16:54 +0000)
committermatitaweb <claudio.sacerdoticoen@unibo.it>
Tue, 8 Nov 2011 16:54:31 +0000 (16:54 +0000)
weblib/tutorial/chapter4.ma

index 9bfb3891c8db8c51c7483cdc83ed2fd161bf3513..79b6bafff14a082f5ed40334cd1b60332c84b79c 100644 (file)
@@ -45,7 +45,7 @@ interpretation "atom" 'atom a = (char ? a).
 notation "ϵ" non associative with precedence 90 for @{ 'epsilon }.
 interpretation "epsilon" 'epsilon = (epsilon ?).
 
-notation "∅" non associative with precedence 90 for @{ 'empty }.
+notation "∅" (* slash emptyv *) non associative with precedence 90 for @{ 'empty }.
 interpretation "empty" 'empty = (zero ?).
 
 let rec flatten (S : \ 5a href="cic:/matita/tutorial/chapter4/Alpha.ind(1,0,0)"\ 6Alpha\ 5/a\ 6) (l : \ 5a href="cic:/matita/tutorial/chapter3/list.ind(1,0,1)"\ 6list\ 5/a\ 6 (\ 5a href="cic:/matita/tutorial/chapter4/word.def(3)"\ 6word\ 5/a\ 6 S)) on l : \ 5a href="cic:/matita/tutorial/chapter4/word.def(3)"\ 6word\ 5/a\ 6 S ≝ 
@@ -67,76 +67,75 @@ interpretation "union lang" 'union a b = (union ? a b).
 
 definition cat : ∀S,l1,l2,w.Prop ≝ 
   λS.λl1,l2.λw:\ 5a href="cic:/matita/tutorial/chapter4/word.def(3)"\ 6word\ 5/a\ 6 S.\ 5a title="exists" href="cic:/fakeuri.def(1)"\ 6\ 5/a\ 6w1,w2.w1 \ 5a title="append" href="cic:/fakeuri.def(1)"\ 6@\ 5/a\ 6 w2 \ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"\ 6=\ 5/a\ 6 w \ 5a title="logical and" href="cic:/fakeuri.def(1)"\ 6\ 5/a\ 6 l1 w1 \ 5a title="logical and" href="cic:/fakeuri.def(1)"\ 6\ 5/a\ 6 l2 w2.
-interpretation "cat lang" 'pc a b = (cat ? a b).
+interpretation "cat lang" 'concat a b = (cat ? a b).
 
 definition star ≝ λS.λl.λw:\ 5a href="cic:/matita/tutorial/chapter4/word.def(3)"\ 6word\ 5/a\ 6 S.\ 5a title="exists" href="cic:/fakeuri.def(1)"\ 6\ 5/a\ 6lw. \ 5a href="cic:/matita/tutorial/chapter4/flatten.fix(0,1,4)"\ 6flatten\ 5/a\ 6 ? lw \ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"\ 6=\ 5/a\ 6 w \ 5a title="logical and" href="cic:/fakeuri.def(1)"\ 6\ 5/a\ 6 \ 5a href="cic:/matita/tutorial/chapter4/conjunct.fix(0,1,4)"\ 6conjunct\ 5/a\ 6 ? lw l. 
 interpretation "star lang" 'kstar l = (star ? l).
 
-notation > "𝐋 term 70 E" non associative with precedence 75 for @{in_l ? $E}.
+notation "ℓ term 70 E" non associative with precedence 75 for @{in_l ? $E}.
 
 let rec in_l (S : \ 5a href="cic:/matita/tutorial/chapter4/Alpha.ind(1,0,0)"\ 6Alpha\ 5/a\ 6) (r : \ 5a href="cic:/matita/tutorial/chapter4/re.ind(1,0,1)"\ 6re\ 5/a\ 6 S) on r : \ 5a href="cic:/matita/tutorial/chapter4/word.def(3)"\ 6word\ 5/a\ 6 S → Prop ≝ 
 match r with
- [ zero ⇒ \ 5a title="empty lang" href="cic:/fakeuri.def(1)"\ 6\ 5/a\ 6
+ [ zero ⇒ \ 5a title="empty lang" href="cic:/fakeuri.def(1)"\ 6\ 5/a\ 6 
  | epsilon ⇒ \ 5a title="sing lang" href="cic:/fakeuri.def(1)"\ 6{\ 5/a\ 6\ 5a title="nil" href="cic:/fakeuri.def(1)"\ 6[\ 5/a\ 6] }
- | char x ⇒ \ 5a title="sing lang" href="cic:/fakeuri.def(1)"\ 6{\ 5/a\ 6\ 5a title="cons" href="cic:/fakeuri.def(1)"\ 6[\ 5/a\ 6x]\ 5span style="text-decoration: underline;"\ 6\ 5/span\ 6}
- | _ ⇒ \ 5a title="empty lang" href="cic:/fakeuri.def(1)"\ 6\ 5/a\ 6
+ |  char x ⇒ \ 5a title="sing lang" href="cic:/fakeuri.def(1)"\ 6{\ 5/a\ 6: x\ 5a title="cons" href="cic:/fakeuri.def(1)"\ 6:\ 5/a\ 6:\ 5a title="nil" href="cic:/fakeuri.def(1)"\ 6[\ 5/a\ 6] }
+ | concat r1 r2 ⇒ ℓ r1 \ 5a title="cat lang" href="cic:/fakeuri.def(1)"\ 6·\ 5/a\ 6 ℓ r2 
+ | or r1 r2 ⇒ ℓ r1 \ 5a title="union lang" href="cic:/fakeuri.def(1)"\ 6\ 5/a\ 6 ℓ r2 
+ | star r1 ⇒ (ℓ r1)\ 5a title="star lang" href="cic:/fakeuri.def(1)"\ 6^\ 5/a\ 6
  ].
 
-
-(*
- | concat r1 r2 ⇒ 𝐋 r1 · 𝐋 r2
- | or r1 r2 ⇒  𝐋 r1 ∪ 𝐋 r2
- | star r1 ⇒ (𝐋 r1) ^*
- ].
-
-*)
-
- notation "𝐋 term 70 E" non associative with precedence 75 for @{'in_l $E}.
+notation "ℓ term 70 E" non associative with precedence 75 for @{'in_l $E}.
 interpretation "in_l" 'in_l E = (in_l ? E).
 interpretation "in_l mem" 'mem w l = (in_l ? l w).
 
-notation "a || b" left associative with precedence 30 for @{'orb $a $b}.
+notation "a  b" left associative with precedence 30 for @{'orb $a $b}.
 interpretation "orb" 'orb a b = (orb a b).
 
-ndefinition if_then_else ≝ λT:Type[0].λe,t,f.match e return λ_.T with [ true ⇒ t | false ⇒ f].
+(* ndefinition if_then_else ≝ λT:Type[0].λe,t,f.match e return λ_.T with [ true ⇒ t | false ⇒ f].
 notation > "'if' term 19 e 'then' term 19 t 'else' term 19 f" non associative with precedence 19 for @{ 'if_then_else $e $t $f }.
 notation < "'if' \nbsp term 19 e \nbsp 'then' \nbsp term 19 t \nbsp 'else' \nbsp term 90 f \nbsp" non associative with precedence 19 for @{ 'if_then_else $e $t $f }.
-interpretation "if_then_else" 'if_then_else e t f = (if_then_else ? e t f).
-
-ninductive pitem (S: Alpha) : Type[0] ≝
  pz: pitem S
- | pe: pitem S
- | ps: S → pitem S
- | pp: S → pitem S
- | pc: pitem S → pitem S → pitem S
- | po: pitem S → pitem S → pitem S
- | pk: pitem S → pitem S.
+interpretation "if_then_else" 'if_then_else e t f = (if_then_else ? e t f). *)
+
+inductive pitem (S: \ 5a href="cic:/matita/tutorial/chapter4/Alpha.ind(1,0,0)"\ 6Alpha\ 5/a\ 6) : Type[0] ≝
| pzero: pitem S
+ | pepsilon: pitem S
+ | pchar: S → pitem S
+ | ppoint: S → pitem S
+ | pconcat: pitem S → pitem S → pitem S
+ | por: pitem S → pitem S → pitem S
+ | pstar: pitem S → pitem S.
  
-ndefinition pre ≝ λS.pitem S × bool.
-
-interpretation "pstar" 'pk a = (pk ? a).
-interpretation "por" 'plus a b = (po ? a b).
-interpretation "pcat" 'pc a b = (pc ? a b).
-notation < ".a" non associative with precedence 90 for @{ 'pp $a}.
-notation > "`. term 90 a" non associative with precedence 90 for @{ 'pp $a}.
-interpretation "ppatom" 'pp a = (pp ? a).
-(* to get rid of \middot *)
-ncoercion pc : ∀S.∀p:pitem S. pitem S → pitem S  ≝ pc on _p : pitem ? to ∀_:?.?.
-interpretation "patom" 'ps a = (ps ? a).
-interpretation "pepsilon" 'epsilon = (pe ?).
-interpretation "pempty" 'empty = (pz ?).
-
-notation > "|term 19 e|" non associative with precedence 70 for @{forget ? $e}.
-nlet rec forget (S: Alpha) (l : pitem S) on l: re S ≝
+definition pre ≝ λS.\ 5a href="cic:/matita/tutorial/chapter4/pitem.ind(1,0,1)"\ 6pitem\ 5/a\ 6 S \ 5a title="Product" href="cic:/fakeuri.def(1)"\ 6×\ 5/a\ 6 \ 5a href="cic:/matita/basics/bool/bool.ind(1,0,0)" title="null"\ 6bool\ 5/a\ 6.
+
+interpretation "pstar" 'kstar a = (pstar ? a).
+interpretation "por" 'plus a b = (por ? a b).
+interpretation "pcat" 'concat a b = (pconcat ? a b).
+
+notation "• a" non associative with precedence 90 for @{ 'ppoint $a}.
+(* notation > "`. term 90 a" non associative with precedence 90 for @{ 'pp $a}. *)
+
+interpretation "ppatom" 'ppoint a = (ppoint ? a).
+(* to get rid of \middot 
+ncoercion pc : ∀S.∀p:pitem S. pitem S → pitem S  ≝ pc on _p : pitem ? to ∀_:?.?. *)
+interpretation "patom" 'pchar a = (pchar ? a).
+interpretation "pepsilon" 'epsilon = (pepsilon ?).
+interpretation "pempty" 'empty = (pzero ?).
+
+notation "\boxv term 19 e \boxv" (* slash boxv *) non associative with precedence 70 for @{forget ? $e}.
+
+let rec forget (S: \ 5a href="cic:/matita/tutorial/chapter4/Alpha.ind(1,0,0)"\ 6Alpha\ 5/a\ 6) (l : \ 5a href="cic:/matita/tutorial/chapter4/pitem.ind(1,0,1)"\ 6pitem\ 5/a\ 6 S) on l: \ 5a href="cic:/matita/tutorial/chapter4/re.ind(1,0,1)"\ 6re\ 5/a\ 6 S ≝
  match l with
-  [ pz ⇒ ∅
-  | pe ⇒ ϵ
-  | ps x ⇒ `x
-  | pp x ⇒ `x
-  | pc E1 E2 ⇒ (|E1| · |E2|)
-  | po E1 E2 ⇒ (|E1| + |E2|)
-  | pk E ⇒ |E|^* ].
+  [ pzero ⇒ \ 5a title="empty" href="cic:/fakeuri.def(1)"\ 6\ 5/a\ 6
+  | pepsilon ⇒ \ 5a title="epsilon" href="cic:/fakeuri.def(1)"\ 6ϵ\ 5/a\ 6
+  | pchar x ⇒ \ 5a href="cic:/matita/tutorial/chapter4/re.con(0,3,1)"\ 6char\ 5/a\ 6 ? x 
+  | ppoint x ⇒ \ 5a href="cic:/matita/tutorial/chapter4/re.con(0,3,1)"\ 6char\ 5/a\ 6 ? x  
+  | pconcat e1 e2 ⇒ │e1│ \ 5a title="cat" href="cic:/fakeuri.def(1)"\ 6·\ 5/a\ 6 │e2│
+  | por e1 e2 ⇒ │e1│  \ 5a title="or" href="cic:/fakeuri.def(1)"\ 6+\ 5/a\ 6 │e2│
+  | pstar e ⇒ │e│\ 5a title="star" href="cic:/fakeuri.def(1)"\ 6^\ 5/a\ 6
+  ].
+
 notation < "|term 19 e|" non associative with precedence 70 for @{'forget $e}.
 interpretation "forget" 'forget a = (forget ? a).
 
-notation "\fst term 90 x" non associative with precedence 90 for @{'fst $x}.
\ No newline at end of file
+
+notation "\fst term 90 x" non associative with precedence 90 for @{'fst $x}.